* [PATCH 1/2] ASoC: core: display the platform node name if there is no platform name @ 2012-09-10 22:02 Timur Tabi 2012-09-10 22:02 ` [PATCH 2/2] ASoC: fsl: use snd_soc_register_card to register the card Timur Tabi 2012-09-11 0:19 ` [PATCH 1/2] ASoC: core: display the platform node name if there is no platform name Mark Brown 0 siblings, 2 replies; 7+ messages in thread From: Timur Tabi @ 2012-09-10 22:02 UTC (permalink / raw) To: Mark Brown, alsa-devel A platform can be matched by either a string name or a device tree node pointer, so we can't assume that dai_link->platform_name is valid. Fix an error message in soc_bind_dai_link() to use the device tree node name if the platform name is null. Signed-off-by: Timur Tabi <timur@freescale.com> --- sound/soc/soc-core.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index ad65459..d81ef5b 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -897,7 +897,8 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num) } if (!rtd->platform) { dev_err(card->dev, "platform %s not registered\n", - dai_link->platform_name); + dai_link->platform_name ? : + dai_link->platform_of_node->full_name); return -EPROBE_DEFER; } -- 1.7.3.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] ASoC: fsl: use snd_soc_register_card to register the card 2012-09-10 22:02 [PATCH 1/2] ASoC: core: display the platform node name if there is no platform name Timur Tabi @ 2012-09-10 22:02 ` Timur Tabi 2012-09-11 0:13 ` Mark Brown 2012-09-11 0:19 ` [PATCH 1/2] ASoC: core: display the platform node name if there is no platform name Mark Brown 1 sibling, 1 reply; 7+ messages in thread From: Timur Tabi @ 2012-09-10 22:02 UTC (permalink / raw) To: Mark Brown, alsa-devel Use snd_soc_register_card() instead of platform_device_alloc("soc-audio") to register the sound card from the machine drivers. Although platform_device_alloc is officially deprecated, it is still used by several other drivers. Unfortunately, something is broken somewhere and the Freescale drivers don't register properly when using it. Since we need to transition to snd_soc_register_card() anyway, this fixes the problem and updates our code at the same time. We also transition the module initialize to late_initcall(), so that the machine driver loads last. Although this is technically not necessary, it does avoid this error message at boot time: ALSA device list: No soundcards found. Signed-off-by: Timur Tabi <timur@freescale.com> --- sound/soc/fsl/mpc8610_hpcd.c | 25 ++++++------------------- sound/soc/fsl/p1022_ds.c | 24 +++++------------------- 2 files changed, 11 insertions(+), 38 deletions(-) diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c index 60bcba1..65347de 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) container_of(dev, struct platform_device, dev); struct device_node *np = ssi_pdev->dev.of_node; struct device_node *codec_np = NULL; - struct platform_device *sound_device = NULL; struct mpc8610_hpcd_data *machine_data; int ret = -ENODEV; const char *sprop; @@ -341,34 +340,22 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev) machine_data->card.probe = mpc8610_hpcd_machine_probe; machine_data->card.remove = mpc8610_hpcd_machine_remove; machine_data->card.name = pdev->name; /* The platform driver name */ + machine_data->card.owner = THIS_MODULE; + machine_data->card.dev = &pdev->dev; machine_data->card.num_links = 2; machine_data->card.dai_link = machine_data->dai; - /* Allocate a new audio platform device structure */ - sound_device = platform_device_alloc("soc-audio", -1); - if (!sound_device) { - dev_err(&pdev->dev, "platform device alloc failed\n"); - ret = -ENOMEM; - goto error; - } - - /* Associate the card data with the sound device */ - platform_set_drvdata(sound_device, &machine_data->card); - /* Register with ASoC */ - ret = platform_device_add(sound_device); + ret = snd_soc_register_card(&machine_data->card); if (ret) { - dev_err(&pdev->dev, "platform device add failed\n"); - goto error_sound; + dev_err(&pdev->dev, "could not register card\n"); + goto error; } - dev_set_drvdata(&pdev->dev, sound_device); of_node_put(codec_np); return 0; -error_sound: - platform_device_put(sound_device); error: kfree(machine_data); error_alloc: @@ -443,7 +430,7 @@ static void __exit mpc8610_hpcd_exit(void) platform_driver_unregister(&mpc8610_hpcd_driver); } -module_init(mpc8610_hpcd_init); +late_initcall(mpc8610_hpcd_init); module_exit(mpc8610_hpcd_exit); MODULE_AUTHOR("Timur Tabi <timur@freescale.com>"); diff --git a/sound/soc/fsl/p1022_ds.c b/sound/soc/fsl/p1022_ds.c index 50adf40..13110c4 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) container_of(dev, struct platform_device, dev); struct device_node *np = ssi_pdev->dev.of_node; struct device_node *codec_np = NULL; - struct platform_device *sound_device = NULL; struct machine_data *mdata; int ret = -ENODEV; const char *sprop; @@ -349,36 +348,23 @@ static int p1022_ds_probe(struct platform_device *pdev) mdata->card.probe = p1022_ds_machine_probe; mdata->card.remove = p1022_ds_machine_remove; mdata->card.name = pdev->name; /* The platform driver name */ + mdata->card.owner = THIS_MODULE; + mdata->card.dev = &pdev->dev; mdata->card.num_links = 2; mdata->card.dai_link = mdata->dai; - /* Allocate a new audio platform device structure */ - sound_device = platform_device_alloc("soc-audio", -1); - if (!sound_device) { - dev_err(&pdev->dev, "platform device alloc failed\n"); - ret = -ENOMEM; - goto error; - } - - /* Associate the card data with the sound device */ - platform_set_drvdata(sound_device, &mdata->card); - /* Register with ASoC */ - ret = platform_device_add(sound_device); + ret = snd_soc_register_card(&mdata->card); if (ret) { - dev_err(&pdev->dev, "platform device add failed\n"); + dev_err(&pdev->dev, "could not register card\n"); goto error; } - dev_set_drvdata(&pdev->dev, sound_device); of_node_put(codec_np); return 0; error: - if (sound_device) - platform_device_put(sound_device); - kfree(mdata); error_put: of_node_put(codec_np); @@ -453,7 +439,7 @@ static void __exit p1022_ds_exit(void) platform_driver_unregister(&p1022_ds_driver); } -module_init(p1022_ds_init); +late_initcall(p1022_ds_init); module_exit(p1022_ds_exit); MODULE_AUTHOR("Timur Tabi <timur@freescale.com>"); -- 1.7.3.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] ASoC: fsl: use snd_soc_register_card to register the card 2012-09-10 22:02 ` [PATCH 2/2] ASoC: fsl: use snd_soc_register_card to register the card Timur Tabi @ 2012-09-11 0:13 ` Mark Brown 2012-09-11 0:27 ` Tabi Timur-B04825 0 siblings, 1 reply; 7+ messages in thread From: Mark Brown @ 2012-09-11 0:13 UTC (permalink / raw) To: Timur Tabi; +Cc: alsa-devel On Mon, Sep 10, 2012 at 05:02:56PM -0500, Timur Tabi wrote: > We also transition the module initialize to late_initcall(), so that > the machine driver loads last. Although this is technically not > necessary, it does avoid this error message at boot time: > > ALSA device list: > No soundcards found. This should've been a separate patch... if we we're going to do this we really should be doing it for all cards, not just this one, though it'd be better to either remove or fix the logging itself. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] ASoC: fsl: use snd_soc_register_card to register the card 2012-09-11 0:13 ` Mark Brown @ 2012-09-11 0:27 ` Tabi Timur-B04825 2012-09-11 0:31 ` Mark Brown 0 siblings, 1 reply; 7+ messages in thread From: Tabi Timur-B04825 @ 2012-09-11 0:27 UTC (permalink / raw) To: Mark Brown; +Cc: alsa-devel@alsa-project.org Mark Brown wrote: > This should've been a separate patch... if we we're going to do this we > really should be doing it for all cards, not just this one, though it'd > be better to either remove or fix the logging itself. Ok, I'll split it, but I do agree that it should be fixed in ASoC itself. I just don't know how to do that. I do admit that my change is a band-aid. -- Timur Tabi Linux kernel developer at Freescale ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] ASoC: fsl: use snd_soc_register_card to register the card 2012-09-11 0:27 ` Tabi Timur-B04825 @ 2012-09-11 0:31 ` Mark Brown 0 siblings, 0 replies; 7+ messages in thread From: Mark Brown @ 2012-09-11 0:31 UTC (permalink / raw) To: Tabi Timur-B04825; +Cc: alsa-devel@alsa-project.org On Tue, Sep 11, 2012 at 12:27:04AM +0000, Tabi Timur-B04825 wrote: > Ok, I'll split it, but I do agree that it should be fixed in ASoC itself. > I just don't know how to do that. I'd probably go with the simpler approach of just removing the log message, possibly replacing it with one as each card is instantiated. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] ASoC: core: display the platform node name if there is no platform name 2012-09-10 22:02 [PATCH 1/2] ASoC: core: display the platform node name if there is no platform name Timur Tabi 2012-09-10 22:02 ` [PATCH 2/2] ASoC: fsl: use snd_soc_register_card to register the card Timur Tabi @ 2012-09-11 0:19 ` Mark Brown 2012-09-11 0:27 ` Tabi Timur-B04825 1 sibling, 1 reply; 7+ messages in thread From: Mark Brown @ 2012-09-11 0:19 UTC (permalink / raw) To: Timur Tabi; +Cc: alsa-devel On Mon, Sep 10, 2012 at 05:02:55PM -0500, Timur Tabi wrote: > A platform can be matched by either a string name or a device tree node > pointer, so we can't assume that dai_link->platform_name is valid. Fix > an error message in soc_bind_dai_link() to use the device tree node > name if the platform name is null. Applied, but please avoid the use of the ternery operator in future. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] ASoC: core: display the platform node name if there is no platform name 2012-09-11 0:19 ` [PATCH 1/2] ASoC: core: display the platform node name if there is no platform name Mark Brown @ 2012-09-11 0:27 ` Tabi Timur-B04825 0 siblings, 0 replies; 7+ messages in thread From: Tabi Timur-B04825 @ 2012-09-11 0:27 UTC (permalink / raw) To: Mark Brown; +Cc: alsa-devel@alsa-project.org, Tabi Timur-B04825 Mark Brown wrote: > Applied, but please avoid the use of the ternery operator in future. Oh come on, how can you not love it? It's an awesome feature of the language. -- Timur Tabi Linux kernel developer at Freescale ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-09-11 0:31 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-09-10 22:02 [PATCH 1/2] ASoC: core: display the platform node name if there is no platform name Timur Tabi 2012-09-10 22:02 ` [PATCH 2/2] ASoC: fsl: use snd_soc_register_card to register the card Timur Tabi 2012-09-11 0:13 ` Mark Brown 2012-09-11 0:27 ` Tabi Timur-B04825 2012-09-11 0:31 ` Mark Brown 2012-09-11 0:19 ` [PATCH 1/2] ASoC: core: display the platform node name if there is no platform name Mark Brown 2012-09-11 0:27 ` Tabi Timur-B04825
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).