From patchwork Wed Jul 8 18:47:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 6750611 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A06099F38C for ; Wed, 8 Jul 2015 18:49:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B59F8204EA for ; Wed, 8 Jul 2015 18:49:26 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 72F1420546 for ; Wed, 8 Jul 2015 18:49:25 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 62460265A9E; Wed, 8 Jul 2015 20:49:24 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 682F7265A7C; Wed, 8 Jul 2015 20:48:32 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 07FC7265A73; Wed, 8 Jul 2015 20:48:30 +0200 (CEST) Received: from smtp-out-104.synserver.de (smtp-out-104.synserver.de [212.40.185.104]) by alsa0.perex.cz (Postfix) with ESMTP id 25148265A1D for ; Wed, 8 Jul 2015 20:47:52 +0200 (CEST) Received: (qmail 20852 invoked by uid 0); 8 Jul 2015 18:47:50 -0000 X-SynServer-TrustedSrc: 1 X-SynServer-AuthUser: lars@metafoo.de X-SynServer-PPID: 20683 Received: from ppp-188-174-59-27.dynamic.mnet-online.de (HELO lars-laptop.fritz.box) [188.174.59.27] by 217.119.54.87 with SMTP; 8 Jul 2015 18:47:50 -0000 From: Lars-Peter Clausen To: Mark Brown , Liam Girdwood Date: Wed, 8 Jul 2015 20:47:44 +0200 Message-Id: <1436381264-6924-2-git-send-email-lars@metafoo.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1436381264-6924-1-git-send-email-lars@metafoo.de> References: <1436381264-6924-1-git-send-email-lars@metafoo.de> Cc: alsa-devel@alsa-project.org, Lars-Peter Clausen Subject: [alsa-devel] [PATCH 2/2] ASoC: Use card field to indicate whether a component is bound X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Use the card field of a component to indicate whether it is bound or not. This makes a certain sense given that the field contains the card the component is bound to and a component can only be bound to one card at a time. And it also requires to unset the card field when the component is unbound from the card. This makes the probded flag redundant and it can be removed. Signed-off-by: Lars-Peter Clausen --- include/sound/soc.h | 1 - sound/soc/soc-core.c | 16 ++++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index 3ccd82a..ab69e26 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -758,7 +758,6 @@ struct snd_soc_component { unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */ unsigned int registered_as_component:1; - unsigned int probed:1; struct list_head list; diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index d9ae826..2fc461c 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -980,7 +980,7 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num) static void soc_remove_component(struct snd_soc_component *component) { - if (!component->probed) + if (!component->card) return; /* This is a HACK and will be removed soon */ @@ -993,7 +993,7 @@ static void soc_remove_component(struct snd_soc_component *component) snd_soc_dapm_free(snd_soc_component_get_dapm(component)); soc_cleanup_component_debugfs(component); - component->probed = 0; + component->card = NULL; module_put(component->dev->driver->owner); } @@ -1107,7 +1107,7 @@ static int soc_probe_component(struct snd_soc_card *card, if (!strcmp(component->name, "snd-soc-dummy")) return 0; - if (component->probed) { + if (component->card) { if (component->card != card) { dev_err(component->dev, "Trying to bind component to card \"%s\" but is already bound to card \"%s\"\n", @@ -1117,13 +1117,13 @@ static int soc_probe_component(struct snd_soc_card *card, return 0; } + if (!try_module_get(component->dev->driver->owner)) + return -ENODEV; + component->card = card; dapm->card = card; soc_set_name_prefix(card, component); - if (!try_module_get(component->dev->driver->owner)) - return -ENODEV; - soc_init_component_debugfs(component); if (component->dapm_widgets) { @@ -1167,7 +1167,6 @@ static int soc_probe_component(struct snd_soc_card *card, snd_soc_dapm_add_routes(dapm, component->dapm_routes, component->num_dapm_routes); - component->probed = 1; list_add(&dapm->list, &card->dapm_list); /* This is a HACK and will be removed soon */ @@ -1178,6 +1177,7 @@ static int soc_probe_component(struct snd_soc_card *card, err_probe: soc_cleanup_component_debugfs(component); + component->card = NULL; module_put(component->dev->driver->owner); return ret; @@ -1461,7 +1461,7 @@ static void soc_remove_aux_dev(struct snd_soc_card *card, int num) rtd->dev_registered = 0; } - if (component && component->probed) + if (component) soc_remove_component(component); }