From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BD17C433DF for ; Fri, 31 Jul 2020 14:43:31 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C910D22B3F for ; Fri, 31 Jul 2020 14:43:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="PiD33Vp8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C910D22B3F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 4A65E1615; Fri, 31 Jul 2020 16:42:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4A65E1615 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1596206609; bh=v/vAgybYL67NYukCozNn5D1Wxq1BYkBlpkqbATXombw=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=PiD33Vp8y5+a7gX07EiEw95fU39rZW6ovcTTsoYv91YKOUqdPa6Oy82/SLPU5uduO mtlw6sNXCWzJypTU8kJ9TCv8bUfVdvLClsfjm8xA5BIGMY9eBHgVjt0IJInt3+6yPU rwE5cPToDwteKZHmA44i+DegN6QGDZh0hv7fqG9k= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D3C73F80161; Fri, 31 Jul 2020 16:42:38 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 57F73F80161; Fri, 31 Jul 2020 16:42:37 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A5785F80161 for ; Fri, 31 Jul 2020 16:42:29 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A5785F80161 IronPort-SDR: ru3X72X1J1dkjzLBxZAm9taQ/dlzbOkTceVxjIHGeHbtl1GoMP1gR6MLgCDkmrvP0BudylbeqI ife2bxPctJAw== X-IronPort-AV: E=McAfee;i="6000,8403,9698"; a="131352446" X-IronPort-AV: E=Sophos;i="5.75,418,1589266800"; d="scan'208";a="131352446" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jul 2020 07:42:28 -0700 IronPort-SDR: kQUTzL6EESwGNehCuk8W8yZbBA+1qr+262UvCY9NDbaXFYIuGMWf1Zu2zjFfGcTQUwoWPxMl87 rvd66Mv1wLQA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,418,1589266800"; d="scan'208";a="491505207" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by fmsmga005.fm.intel.com with ESMTP; 31 Jul 2020 07:42:25 -0700 From: Cezary Rojewski To: alsa-devel@alsa-project.org Subject: [PATCH 2/3] ASoC: core: Simplify snd_soc_component_initialize declaration Date: Fri, 31 Jul 2020 16:41:45 +0200 Message-Id: <20200731144146.6678-3-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200731144146.6678-1-cezary.rojewski@intel.com> References: <20200731144146.6678-1-cezary.rojewski@intel.com> Cc: pierre-louis.bossart@linux.intel.com, Cezary Rojewski , lars@metafoo.de, olivier.moysan@st.com, alexandre.torgue@st.com, tiwai@suse.com, arnaud.pouliquen@st.com, lgirdwood@gmail.com, broonie@kernel.org, mcoquelin.stm32@gmail.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Move 'name' field initialization responsibility back to snd_soc_component_initialize to prepare snd_soc_add_component function for being called separatelly as a second registration step. Signed-off-by: Cezary Rojewski --- include/sound/soc.h | 2 +- sound/soc/soc-core.c | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index 77a304d36c61..787374362f83 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -416,7 +416,7 @@ static inline int snd_soc_resume(struct device *dev) int snd_soc_poweroff(struct device *dev); int snd_soc_component_initialize(struct snd_soc_component *component, const struct snd_soc_component_driver *driver, - struct device *dev, const char *name); + struct device *dev); int snd_soc_add_component(struct device *dev, struct snd_soc_component *component, const struct snd_soc_component_driver *component_driver, diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 236755c7a79e..f528367bc3be 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2443,14 +2443,19 @@ static void snd_soc_del_component_unlocked(struct snd_soc_component *component) int snd_soc_component_initialize(struct snd_soc_component *component, const struct snd_soc_component_driver *driver, - struct device *dev, const char *name) + struct device *dev) { INIT_LIST_HEAD(&component->dai_list); INIT_LIST_HEAD(&component->dobj_list); INIT_LIST_HEAD(&component->card_list); mutex_init(&component->io_mutex); - component->name = name; + component->name = fmt_single_name(dev, &component->id); + if (!component->name) { + dev_err(dev, "ASoC: Failed to allocate name\n"); + return -ENOMEM; + } + component->dev = dev; component->driver = driver; @@ -2464,19 +2469,12 @@ int snd_soc_add_component(struct device *dev, struct snd_soc_dai_driver *dai_drv, int num_dai) { - const char *name = fmt_single_name(dev, &component->id); int ret; int i; - if (!name) { - dev_err(dev, "ASoC: Failed to allocate name\n"); - return -ENOMEM; - } - mutex_lock(&client_mutex); - ret = snd_soc_component_initialize(component, component_driver, - dev, name); + ret = snd_soc_component_initialize(component, component_driver, dev); if (ret) goto err_free; -- 2.17.1