Skip to content

Commit f0d9693

Browse files
daowens01broonie
authored andcommitted
ASoC: ti: omap-mcbsp: duplicate sysfs error
Convert to managed versions of sysfs and clk allocation to simplify unbinding and error handling in probe. Managed sysfs node creation specifically addresses the following error seen the second time probe is attempted after sdma_pcm_platform_register() previously requsted probe deferral: sysfs: cannot create duplicate filename '/devices/platform/68000000.ocp/49022000.mcbsp/max_tx_thres' Signed-off-by: David Owens <dowens@precisionplanting.com> Link: https://lore.kernel.org/r/20220620183744.3176557-1-dowens@precisionplanting.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 242a88f commit f0d9693

3 files changed

Lines changed: 4 additions & 31 deletions

File tree

sound/soc/ti/omap-mcbsp-priv.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,6 @@ static inline int omap_mcbsp_read(struct omap_mcbsp *mcbsp, u16 reg,
316316

317317
/* Sidetone specific API */
318318
int omap_mcbsp_st_init(struct platform_device *pdev);
319-
void omap_mcbsp_st_cleanup(struct platform_device *pdev);
320-
321319
int omap_mcbsp_st_start(struct omap_mcbsp *mcbsp);
322320
int omap_mcbsp_st_stop(struct omap_mcbsp *mcbsp);
323321

sound/soc/ti/omap-mcbsp-st.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ int omap_mcbsp_st_init(struct platform_device *pdev)
347347
if (!st_data)
348348
return -ENOMEM;
349349

350-
st_data->mcbsp_iclk = clk_get(mcbsp->dev, "ick");
350+
st_data->mcbsp_iclk = devm_clk_get(mcbsp->dev, "ick");
351351
if (IS_ERR(st_data->mcbsp_iclk)) {
352352
dev_warn(mcbsp->dev,
353353
"Failed to get ick, sidetone might be broken\n");
@@ -359,7 +359,7 @@ int omap_mcbsp_st_init(struct platform_device *pdev)
359359
if (!st_data->io_base_st)
360360
return -ENOMEM;
361361

362-
ret = sysfs_create_group(&mcbsp->dev->kobj, &sidetone_attr_group);
362+
ret = devm_device_add_group(mcbsp->dev, &sidetone_attr_group);
363363
if (ret)
364364
return ret;
365365

@@ -368,16 +368,6 @@ int omap_mcbsp_st_init(struct platform_device *pdev)
368368
return 0;
369369
}
370370

371-
void omap_mcbsp_st_cleanup(struct platform_device *pdev)
372-
{
373-
struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev);
374-
375-
if (mcbsp->st_data) {
376-
sysfs_remove_group(&mcbsp->dev->kobj, &sidetone_attr_group);
377-
clk_put(mcbsp->st_data->mcbsp_iclk);
378-
}
379-
}
380-
381371
static int omap_mcbsp_st_info_volsw(struct snd_kcontrol *kcontrol,
382372
struct snd_ctl_elem_info *uinfo)
383373
{

sound/soc/ti/omap-mcbsp.c

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -702,25 +702,15 @@ static int omap_mcbsp_init(struct platform_device *pdev)
702702
mcbsp->max_tx_thres = max_thres(mcbsp) - 0x10;
703703
mcbsp->max_rx_thres = max_thres(mcbsp) - 0x10;
704704

705-
ret = sysfs_create_group(&mcbsp->dev->kobj,
706-
&additional_attr_group);
705+
ret = devm_device_add_group(mcbsp->dev, &additional_attr_group);
707706
if (ret) {
708707
dev_err(mcbsp->dev,
709708
"Unable to create additional controls\n");
710709
return ret;
711710
}
712711
}
713712

714-
ret = omap_mcbsp_st_init(pdev);
715-
if (ret)
716-
goto err_st;
717-
718-
return 0;
719-
720-
err_st:
721-
if (mcbsp->pdata->buffer_size)
722-
sysfs_remove_group(&mcbsp->dev->kobj, &additional_attr_group);
723-
return ret;
713+
return omap_mcbsp_st_init(pdev);
724714
}
725715

726716
/*
@@ -1431,11 +1421,6 @@ static int asoc_mcbsp_remove(struct platform_device *pdev)
14311421
if (cpu_latency_qos_request_active(&mcbsp->pm_qos_req))
14321422
cpu_latency_qos_remove_request(&mcbsp->pm_qos_req);
14331423

1434-
if (mcbsp->pdata->buffer_size)
1435-
sysfs_remove_group(&mcbsp->dev->kobj, &additional_attr_group);
1436-
1437-
omap_mcbsp_st_cleanup(pdev);
1438-
14391424
return 0;
14401425
}
14411426

0 commit comments

Comments
 (0)