Commit f0d96937 authored by David Owens's avatar David Owens Committed by Mark Brown

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: default avatarDavid Owens <dowens@precisionplanting.com>
Link: https://lore.kernel.org/r/20220620183744.3176557-1-dowens@precisionplanting.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 242a88ff
...@@ -316,8 +316,6 @@ static inline int omap_mcbsp_read(struct omap_mcbsp *mcbsp, u16 reg, ...@@ -316,8 +316,6 @@ static inline int omap_mcbsp_read(struct omap_mcbsp *mcbsp, u16 reg,
/* Sidetone specific API */ /* Sidetone specific API */
int omap_mcbsp_st_init(struct platform_device *pdev); int omap_mcbsp_st_init(struct platform_device *pdev);
void omap_mcbsp_st_cleanup(struct platform_device *pdev);
int omap_mcbsp_st_start(struct omap_mcbsp *mcbsp); int omap_mcbsp_st_start(struct omap_mcbsp *mcbsp);
int omap_mcbsp_st_stop(struct omap_mcbsp *mcbsp); int omap_mcbsp_st_stop(struct omap_mcbsp *mcbsp);
......
...@@ -347,7 +347,7 @@ int omap_mcbsp_st_init(struct platform_device *pdev) ...@@ -347,7 +347,7 @@ int omap_mcbsp_st_init(struct platform_device *pdev)
if (!st_data) if (!st_data)
return -ENOMEM; return -ENOMEM;
st_data->mcbsp_iclk = clk_get(mcbsp->dev, "ick"); st_data->mcbsp_iclk = devm_clk_get(mcbsp->dev, "ick");
if (IS_ERR(st_data->mcbsp_iclk)) { if (IS_ERR(st_data->mcbsp_iclk)) {
dev_warn(mcbsp->dev, dev_warn(mcbsp->dev,
"Failed to get ick, sidetone might be broken\n"); "Failed to get ick, sidetone might be broken\n");
...@@ -359,7 +359,7 @@ int omap_mcbsp_st_init(struct platform_device *pdev) ...@@ -359,7 +359,7 @@ int omap_mcbsp_st_init(struct platform_device *pdev)
if (!st_data->io_base_st) if (!st_data->io_base_st)
return -ENOMEM; return -ENOMEM;
ret = sysfs_create_group(&mcbsp->dev->kobj, &sidetone_attr_group); ret = devm_device_add_group(mcbsp->dev, &sidetone_attr_group);
if (ret) if (ret)
return ret; return ret;
...@@ -368,16 +368,6 @@ int omap_mcbsp_st_init(struct platform_device *pdev) ...@@ -368,16 +368,6 @@ int omap_mcbsp_st_init(struct platform_device *pdev)
return 0; return 0;
} }
void omap_mcbsp_st_cleanup(struct platform_device *pdev)
{
struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev);
if (mcbsp->st_data) {
sysfs_remove_group(&mcbsp->dev->kobj, &sidetone_attr_group);
clk_put(mcbsp->st_data->mcbsp_iclk);
}
}
static int omap_mcbsp_st_info_volsw(struct snd_kcontrol *kcontrol, static int omap_mcbsp_st_info_volsw(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo) struct snd_ctl_elem_info *uinfo)
{ {
......
...@@ -702,8 +702,7 @@ static int omap_mcbsp_init(struct platform_device *pdev) ...@@ -702,8 +702,7 @@ static int omap_mcbsp_init(struct platform_device *pdev)
mcbsp->max_tx_thres = max_thres(mcbsp) - 0x10; mcbsp->max_tx_thres = max_thres(mcbsp) - 0x10;
mcbsp->max_rx_thres = max_thres(mcbsp) - 0x10; mcbsp->max_rx_thres = max_thres(mcbsp) - 0x10;
ret = sysfs_create_group(&mcbsp->dev->kobj, ret = devm_device_add_group(mcbsp->dev, &additional_attr_group);
&additional_attr_group);
if (ret) { if (ret) {
dev_err(mcbsp->dev, dev_err(mcbsp->dev,
"Unable to create additional controls\n"); "Unable to create additional controls\n");
...@@ -711,16 +710,7 @@ static int omap_mcbsp_init(struct platform_device *pdev) ...@@ -711,16 +710,7 @@ static int omap_mcbsp_init(struct platform_device *pdev)
} }
} }
ret = omap_mcbsp_st_init(pdev); return omap_mcbsp_st_init(pdev);
if (ret)
goto err_st;
return 0;
err_st:
if (mcbsp->pdata->buffer_size)
sysfs_remove_group(&mcbsp->dev->kobj, &additional_attr_group);
return ret;
} }
/* /*
...@@ -1431,11 +1421,6 @@ static int asoc_mcbsp_remove(struct platform_device *pdev) ...@@ -1431,11 +1421,6 @@ static int asoc_mcbsp_remove(struct platform_device *pdev)
if (cpu_latency_qos_request_active(&mcbsp->pm_qos_req)) if (cpu_latency_qos_request_active(&mcbsp->pm_qos_req))
cpu_latency_qos_remove_request(&mcbsp->pm_qos_req); cpu_latency_qos_remove_request(&mcbsp->pm_qos_req);
if (mcbsp->pdata->buffer_size)
sysfs_remove_group(&mcbsp->dev->kobj, &additional_attr_group);
omap_mcbsp_st_cleanup(pdev);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment