Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754981Ab3J0VZJ (ORCPT ); Sun, 27 Oct 2013 17:25:09 -0400 Received: from ring0.de ([91.143.88.219]:60015 "EHLO smtp.ring0.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753605Ab3J0VZG (ORCPT ); Sun, 27 Oct 2013 17:25:06 -0400 X-Spam-Report: * -0.0 NO_RELAYS Informational: message was not relayed via SMTP * -1.9 BAYES_00 BODY: Spamwahrscheinlichkeit nach Bayes-Test: 0-1% * [score: 0.0000] * -0.0 NO_RECEIVED Informational: message has no Received headers From: Sebastian Reichel To: Sebastian Reichel , Peter Ujfalusi Cc: Rob Herring , Pawel Moll , Mark Rutland , Stephen Warren , Ian Campbell , Rob Landley , Tony Lindgren , Russell King , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Mark Brown , Jarkko Nikula , Grant Likely , Linus Walleij , devicetree@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, alsa-devel@alsa-project.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= , Sebastian Reichel Subject: [RFC 1/4] ASoC: omap: rx51: Use snd_soc_register_card Date: Sun, 27 Oct 2013 22:24:43 +0100 Message-Id: <1382909086-10493-2-git-send-email-sre@debian.org> X-Mailer: git-send-email 1.8.4.rc3 In-Reply-To: <1382909086-10493-1-git-send-email-sre@debian.org> References: <1382909086-10493-1-git-send-email-sre@debian.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2859 Lines: 107 From: Pali Rohár This patch converts the rx51 ASoC module to use snd_soc_register_card. It also adds module alias to support driver autoloading. Signed-off-by: Pali Rohár Signed-off-by: Sebastian Reichel --- sound/soc/omap/rx51.c | 49 +++++++++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/sound/soc/omap/rx51.c b/sound/soc/omap/rx51.c index 611179c..41f26ae 100644 --- a/sound/soc/omap/rx51.c +++ b/sound/soc/omap/rx51.c @@ -390,10 +390,9 @@ static struct snd_soc_card rx51_sound_card = { .num_configs = ARRAY_SIZE(rx51_codec_conf), }; -static struct platform_device *rx51_snd_device; - -static int __init rx51_soc_init(void) +static int rx51_soc_probe(struct platform_device *pdev) { + struct snd_soc_card *card = &rx51_sound_card; int err; if (!machine_is_nokia_rx51() && !of_machine_is_compatible("nokia,omap3-n900")) @@ -408,22 +407,17 @@ static int __init rx51_soc_init(void) if (err) goto err_gpio_eci_sw; - rx51_snd_device = platform_device_alloc("soc-audio", -1); - if (!rx51_snd_device) { - err = -ENOMEM; - goto err1; - } - - platform_set_drvdata(rx51_snd_device, &rx51_sound_card); + card->dev = &pdev->dev; - err = platform_device_add(rx51_snd_device); - if (err) - goto err2; + err = snd_soc_register_card(card); + if (err) { + dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", err); + goto err_snd; + } return 0; -err2: - platform_device_put(rx51_snd_device); -err1: +err_snd: + card->dev = NULL; gpio_free(RX51_ECI_SW_GPIO); err_gpio_eci_sw: gpio_free(RX51_TVOUT_SEL_GPIO); @@ -432,19 +426,34 @@ err_gpio_tvout_sel: return err; } -static void __exit rx51_soc_exit(void) +static int rx51_soc_remove(struct platform_device *pdev) { + struct snd_soc_card *card = platform_get_drvdata(pdev); + snd_soc_jack_free_gpios(&rx51_av_jack, ARRAY_SIZE(rx51_av_jack_gpios), rx51_av_jack_gpios); - platform_device_unregister(rx51_snd_device); + snd_soc_unregister_card(card); + card->dev = NULL; + gpio_free(RX51_ECI_SW_GPIO); gpio_free(RX51_TVOUT_SEL_GPIO); + + return 0; } -module_init(rx51_soc_init); -module_exit(rx51_soc_exit); +static struct platform_driver rx51_soc_driver = { + .driver = { + .name = "rx51-audio", + .owner = THIS_MODULE, + }, + .probe = rx51_soc_probe, + .remove = rx51_soc_remove, +}; + +module_platform_driver(rx51_soc_driver); MODULE_AUTHOR("Nokia Corporation"); MODULE_DESCRIPTION("ALSA SoC Nokia RX-51"); MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:rx51-audio"); -- 1.8.4.rc3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/