aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorPrathyush K <prathyush.k@samsung.com>2013-04-02 07:23:02 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-04-03 12:56:44 -0400
commitc6f9b1eb0e5df468891eff17f981b76c86f95f3a (patch)
tree645e8062960737509820ff14cbbaf3be766b8f6b /sound
parenta9b977ecd3dbc5d4f0fe0b3d5c66d284859b1f2a (diff)
ASoC: Samsung: set drvdata before adding secondary device
Currently, a new platform device is created for secondary device by calling platform_device_register_resndata and then the drvdata is set for this device. The following patch has been added to driver core: "driver core: fix possible missing of device probe". This results in the added device getting probed immediately but the drvdata for the secondary device is not yet set. This patch removes the platform_device_register_resndata call and instead calls platform_device_alloc, platform_set_drvdata and platform_device_add which fixes the above issue. Signed-off-by: Prathyush K <prathyush.k@samsung.com> Signed-off-by: Padmavathi Venna <padma.v@samsung.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/samsung/i2s.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index f1fc06419560..6bbeb0bf1a73 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -972,6 +972,7 @@ static const struct snd_soc_dai_ops samsung_i2s_dai_ops = {
972static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec) 972static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec)
973{ 973{
974 struct i2s_dai *i2s; 974 struct i2s_dai *i2s;
975 int ret;
975 976
976 i2s = devm_kzalloc(&pdev->dev, sizeof(struct i2s_dai), GFP_KERNEL); 977 i2s = devm_kzalloc(&pdev->dev, sizeof(struct i2s_dai), GFP_KERNEL);
977 if (i2s == NULL) 978 if (i2s == NULL)
@@ -996,15 +997,17 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec)
996 i2s->i2s_dai_drv.capture.channels_max = 2; 997 i2s->i2s_dai_drv.capture.channels_max = 2;
997 i2s->i2s_dai_drv.capture.rates = SAMSUNG_I2S_RATES; 998 i2s->i2s_dai_drv.capture.rates = SAMSUNG_I2S_RATES;
998 i2s->i2s_dai_drv.capture.formats = SAMSUNG_I2S_FMTS; 999 i2s->i2s_dai_drv.capture.formats = SAMSUNG_I2S_FMTS;
1000 dev_set_drvdata(&i2s->pdev->dev, i2s);
999 } else { /* Create a new platform_device for Secondary */ 1001 } else { /* Create a new platform_device for Secondary */
1000 i2s->pdev = platform_device_register_resndata(NULL, 1002 i2s->pdev = platform_device_alloc("samsung-i2s-sec", -1);
1001 "samsung-i2s-sec", -1, NULL, 0, NULL, 0);
1002 if (IS_ERR(i2s->pdev)) 1003 if (IS_ERR(i2s->pdev))
1003 return NULL; 1004 return NULL;
1004 }
1005 1005
1006 /* Pre-assign snd_soc_dai_set_drvdata */ 1006 platform_set_drvdata(i2s->pdev, i2s);
1007 dev_set_drvdata(&i2s->pdev->dev, i2s); 1007 ret = platform_device_add(i2s->pdev);
1008 if (ret < 0)
1009 return NULL;
1010 }
1008 1011
1009 return i2s; 1012 return i2s;
1010} 1013}