aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/fsl/mpc8610_hpcd.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/fsl/mpc8610_hpcd.c')
-rw-r--r--sound/soc/fsl/mpc8610_hpcd.c32
1 files changed, 7 insertions, 25 deletions
diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c
index 60bcba1bc30e..9ff9318c52b9 100644
--- a/sound/soc/fsl/mpc8610_hpcd.c
+++ b/sound/soc/fsl/mpc8610_hpcd.c
@@ -192,7 +192,6 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev)
192 container_of(dev, struct platform_device, dev); 192 container_of(dev, struct platform_device, dev);
193 struct device_node *np = ssi_pdev->dev.of_node; 193 struct device_node *np = ssi_pdev->dev.of_node;
194 struct device_node *codec_np = NULL; 194 struct device_node *codec_np = NULL;
195 struct platform_device *sound_device = NULL;
196 struct mpc8610_hpcd_data *machine_data; 195 struct mpc8610_hpcd_data *machine_data;
197 int ret = -ENODEV; 196 int ret = -ENODEV;
198 const char *sprop; 197 const char *sprop;
@@ -341,34 +340,22 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev)
341 machine_data->card.probe = mpc8610_hpcd_machine_probe; 340 machine_data->card.probe = mpc8610_hpcd_machine_probe;
342 machine_data->card.remove = mpc8610_hpcd_machine_remove; 341 machine_data->card.remove = mpc8610_hpcd_machine_remove;
343 machine_data->card.name = pdev->name; /* The platform driver name */ 342 machine_data->card.name = pdev->name; /* The platform driver name */
343 machine_data->card.owner = THIS_MODULE;
344 machine_data->card.dev = &pdev->dev;
344 machine_data->card.num_links = 2; 345 machine_data->card.num_links = 2;
345 machine_data->card.dai_link = machine_data->dai; 346 machine_data->card.dai_link = machine_data->dai;
346 347
347 /* Allocate a new audio platform device structure */
348 sound_device = platform_device_alloc("soc-audio", -1);
349 if (!sound_device) {
350 dev_err(&pdev->dev, "platform device alloc failed\n");
351 ret = -ENOMEM;
352 goto error;
353 }
354
355 /* Associate the card data with the sound device */
356 platform_set_drvdata(sound_device, &machine_data->card);
357
358 /* Register with ASoC */ 348 /* Register with ASoC */
359 ret = platform_device_add(sound_device); 349 ret = snd_soc_register_card(&machine_data->card);
360 if (ret) { 350 if (ret) {
361 dev_err(&pdev->dev, "platform device add failed\n"); 351 dev_err(&pdev->dev, "could not register card\n");
362 goto error_sound; 352 goto error;
363 } 353 }
364 dev_set_drvdata(&pdev->dev, sound_device);
365 354
366 of_node_put(codec_np); 355 of_node_put(codec_np);
367 356
368 return 0; 357 return 0;
369 358
370error_sound:
371 platform_device_put(sound_device);
372error: 359error:
373 kfree(machine_data); 360 kfree(machine_data);
374error_alloc: 361error_alloc:
@@ -383,17 +370,12 @@ error_alloc:
383 */ 370 */
384static int __devexit mpc8610_hpcd_remove(struct platform_device *pdev) 371static int __devexit mpc8610_hpcd_remove(struct platform_device *pdev)
385{ 372{
386 struct platform_device *sound_device = dev_get_drvdata(&pdev->dev); 373 struct snd_soc_card *card = platform_get_drvdata(pdev);
387 struct snd_soc_card *card = platform_get_drvdata(sound_device);
388 struct mpc8610_hpcd_data *machine_data = 374 struct mpc8610_hpcd_data *machine_data =
389 container_of(card, struct mpc8610_hpcd_data, card); 375 container_of(card, struct mpc8610_hpcd_data, card);
390 376
391 platform_device_unregister(sound_device); 377 snd_soc_unregister_card(card);
392
393 kfree(machine_data); 378 kfree(machine_data);
394 sound_device->dev.platform_data = NULL;
395
396 dev_set_drvdata(&pdev->dev, NULL);
397 379
398 return 0; 380 return 0;
399} 381}