diff options
Diffstat (limited to 'sound/soc/fsl/p1022_ds.c')
-rw-r--r-- | sound/soc/fsl/p1022_ds.c | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/sound/soc/fsl/p1022_ds.c b/sound/soc/fsl/p1022_ds.c index 50adf4032bcc..144d49603637 100644 --- a/sound/soc/fsl/p1022_ds.c +++ b/sound/soc/fsl/p1022_ds.c | |||
@@ -202,7 +202,6 @@ static int p1022_ds_probe(struct platform_device *pdev) | |||
202 | container_of(dev, struct platform_device, dev); | 202 | container_of(dev, struct platform_device, dev); |
203 | struct device_node *np = ssi_pdev->dev.of_node; | 203 | struct device_node *np = ssi_pdev->dev.of_node; |
204 | struct device_node *codec_np = NULL; | 204 | struct device_node *codec_np = NULL; |
205 | struct platform_device *sound_device = NULL; | ||
206 | struct machine_data *mdata; | 205 | struct machine_data *mdata; |
207 | int ret = -ENODEV; | 206 | int ret = -ENODEV; |
208 | const char *sprop; | 207 | const char *sprop; |
@@ -349,36 +348,23 @@ static int p1022_ds_probe(struct platform_device *pdev) | |||
349 | mdata->card.probe = p1022_ds_machine_probe; | 348 | mdata->card.probe = p1022_ds_machine_probe; |
350 | mdata->card.remove = p1022_ds_machine_remove; | 349 | mdata->card.remove = p1022_ds_machine_remove; |
351 | mdata->card.name = pdev->name; /* The platform driver name */ | 350 | mdata->card.name = pdev->name; /* The platform driver name */ |
351 | mdata->card.owner = THIS_MODULE; | ||
352 | mdata->card.dev = &pdev->dev; | ||
352 | mdata->card.num_links = 2; | 353 | mdata->card.num_links = 2; |
353 | mdata->card.dai_link = mdata->dai; | 354 | mdata->card.dai_link = mdata->dai; |
354 | 355 | ||
355 | /* Allocate a new audio platform device structure */ | ||
356 | sound_device = platform_device_alloc("soc-audio", -1); | ||
357 | if (!sound_device) { | ||
358 | dev_err(&pdev->dev, "platform device alloc failed\n"); | ||
359 | ret = -ENOMEM; | ||
360 | goto error; | ||
361 | } | ||
362 | |||
363 | /* Associate the card data with the sound device */ | ||
364 | platform_set_drvdata(sound_device, &mdata->card); | ||
365 | |||
366 | /* Register with ASoC */ | 356 | /* Register with ASoC */ |
367 | ret = platform_device_add(sound_device); | 357 | ret = snd_soc_register_card(&mdata->card); |
368 | if (ret) { | 358 | if (ret) { |
369 | dev_err(&pdev->dev, "platform device add failed\n"); | 359 | dev_err(&pdev->dev, "could not register card\n"); |
370 | goto error; | 360 | goto error; |
371 | } | 361 | } |
372 | dev_set_drvdata(&pdev->dev, sound_device); | ||
373 | 362 | ||
374 | of_node_put(codec_np); | 363 | of_node_put(codec_np); |
375 | 364 | ||
376 | return 0; | 365 | return 0; |
377 | 366 | ||
378 | error: | 367 | error: |
379 | if (sound_device) | ||
380 | platform_device_put(sound_device); | ||
381 | |||
382 | kfree(mdata); | 368 | kfree(mdata); |
383 | error_put: | 369 | error_put: |
384 | of_node_put(codec_np); | 370 | of_node_put(codec_np); |
@@ -392,17 +378,12 @@ error_put: | |||
392 | */ | 378 | */ |
393 | static int __devexit p1022_ds_remove(struct platform_device *pdev) | 379 | static int __devexit p1022_ds_remove(struct platform_device *pdev) |
394 | { | 380 | { |
395 | struct platform_device *sound_device = dev_get_drvdata(&pdev->dev); | 381 | struct snd_soc_card *card = platform_get_drvdata(pdev); |
396 | struct snd_soc_card *card = platform_get_drvdata(sound_device); | ||
397 | struct machine_data *mdata = | 382 | struct machine_data *mdata = |
398 | container_of(card, struct machine_data, card); | 383 | container_of(card, struct machine_data, card); |
399 | 384 | ||
400 | platform_device_unregister(sound_device); | 385 | snd_soc_unregister_card(card); |
401 | |||
402 | kfree(mdata); | 386 | kfree(mdata); |
403 | sound_device->dev.platform_data = NULL; | ||
404 | |||
405 | dev_set_drvdata(&pdev->dev, NULL); | ||
406 | 387 | ||
407 | return 0; | 388 | return 0; |
408 | } | 389 | } |