From patchwork Tue Nov 5 06:45:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 11226969 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 126721515 for ; Tue, 5 Nov 2019 06:47:16 +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 9721A217F5 for ; Tue, 5 Nov 2019 06:47:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="RmoJKqtg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9721A217F5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.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 A244C1719; Tue, 5 Nov 2019 07:46:21 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A244C1719 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1572936431; bh=RadIaX4+X0cWnAjt+YnRgHKCTYtSq7Q9KhkxxIoB43g=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=RmoJKqtg4STJyW+9m0yMELX7Kp9Tpkq+LtqdVQvdY9KQasP26CLYJqNB+xeyJ9drB XgC7rKBZFtJsBmmPfZINIgHsVQg5IYafRzkb0L2KDNlu435vtGNLrMfSLREVPArjtL damewGmFotRoHba8naGZUDqG5fGcvT3SDzcECJHA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 48718F805AE; Tue, 5 Nov 2019 07:45:49 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id B7FD4F805DF; Tue, 5 Nov 2019 07:45:47 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS, SURBL_BLOCKED,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa1.perex.cz (Postfix) with ESMTP id BBD83F80535 for ; Tue, 5 Nov 2019 07:45:42 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BBD83F80535 Date: 05 Nov 2019 15:45:41 +0900 X-IronPort-AV: E=Sophos;i="5.68,270,1569250800"; d="scan'208";a="30858123" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 05 Nov 2019 15:45:41 +0900 Received: from morimoto-PC.renesas.com (unknown [10.166.18.140]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 44A684009409; Tue, 5 Nov 2019 15:45:41 +0900 (JST) Message-ID: <87eeym3joq.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.5 Mule/6.0 To: Mark Brown In-Reply-To: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> References: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Linux-ALSA , Pierre-Louis Bossart , Ranjani Sridharan Subject: [alsa-devel] [PATCH v3 01/19] ASoC: soc-core: move soc_init_dai_link() 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" From: Kuninori Morimoto This patch moves soc_init_dai_link() next to soc_bind_dai_link(). This is prepare for soc_bind_dai_link() cleanup. Signed-off-by: Kuninori Morimoto Reviewed-by: Pierre-Louis Bossart --- v2 -> v3 - no change - add Reviewed-by sound/soc/soc-core.c | 192 +++++++++++++++++++++++++-------------------------- 1 file changed, 96 insertions(+), 96 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index b07ecfa..a141828 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -941,6 +941,102 @@ static bool soc_is_dai_link_bound(struct snd_soc_card *card, return false; } +static int soc_init_dai_link(struct snd_soc_card *card, + struct snd_soc_dai_link *link) +{ + int i; + struct snd_soc_dai_link_component *codec, *platform; + + for_each_link_codecs(link, i, codec) { + /* + * Codec must be specified by 1 of name or OF node, + * not both or neither. + */ + if (!!codec->name == !!codec->of_node) { + dev_err(card->dev, "ASoC: Neither/both codec name/of_node are set for %s\n", + link->name); + return -EINVAL; + } + + /* Codec DAI name must be specified */ + if (!codec->dai_name) { + dev_err(card->dev, "ASoC: codec_dai_name not set for %s\n", + link->name); + return -EINVAL; + } + + /* + * Defer card registration if codec component is not added to + * component list. + */ + if (!soc_find_component(codec)) + return -EPROBE_DEFER; + } + + for_each_link_platforms(link, i, platform) { + /* + * Platform may be specified by either name or OF node, but it + * can be left unspecified, then no components will be inserted + * in the rtdcom list + */ + if (!!platform->name == !!platform->of_node) { + dev_err(card->dev, + "ASoC: Neither/both platform name/of_node are set for %s\n", + link->name); + return -EINVAL; + } + + /* + * Defer card registration if platform component is not added to + * component list. + */ + if (!soc_find_component(platform)) + return -EPROBE_DEFER; + } + + /* FIXME */ + if (link->num_cpus > 1) { + dev_err(card->dev, + "ASoC: multi cpu is not yet supported %s\n", + link->name); + return -EINVAL; + } + + /* + * CPU device may be specified by either name or OF node, but + * can be left unspecified, and will be matched based on DAI + * name alone.. + */ + if (link->cpus->name && link->cpus->of_node) { + dev_err(card->dev, + "ASoC: Neither/both cpu name/of_node are set for %s\n", + link->name); + return -EINVAL; + } + + /* + * Defer card registartion if cpu dai component is not added to + * component list. + */ + if ((link->cpus->of_node || link->cpus->name) && + !soc_find_component(link->cpus)) + return -EPROBE_DEFER; + + /* + * At least one of CPU DAI name or CPU device name/node must be + * specified + */ + if (!link->cpus->dai_name && + !(link->cpus->name || link->cpus->of_node)) { + dev_err(card->dev, + "ASoC: Neither cpu_dai_name nor cpu_name/of_node are set for %s\n", + link->name); + return -EINVAL; + } + + return 0; +} + static int soc_bind_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link) { @@ -1283,102 +1379,6 @@ static int soc_probe_link_components(struct snd_soc_card *card) return 0; } -static int soc_init_dai_link(struct snd_soc_card *card, - struct snd_soc_dai_link *link) -{ - int i; - struct snd_soc_dai_link_component *codec, *platform; - - for_each_link_codecs(link, i, codec) { - /* - * Codec must be specified by 1 of name or OF node, - * not both or neither. - */ - if (!!codec->name == !!codec->of_node) { - dev_err(card->dev, "ASoC: Neither/both codec name/of_node are set for %s\n", - link->name); - return -EINVAL; - } - - /* Codec DAI name must be specified */ - if (!codec->dai_name) { - dev_err(card->dev, "ASoC: codec_dai_name not set for %s\n", - link->name); - return -EINVAL; - } - - /* - * Defer card registration if codec component is not added to - * component list. - */ - if (!soc_find_component(codec)) - return -EPROBE_DEFER; - } - - for_each_link_platforms(link, i, platform) { - /* - * Platform may be specified by either name or OF node, but it - * can be left unspecified, then no components will be inserted - * in the rtdcom list - */ - if (!!platform->name == !!platform->of_node) { - dev_err(card->dev, - "ASoC: Neither/both platform name/of_node are set for %s\n", - link->name); - return -EINVAL; - } - - /* - * Defer card registration if platform component is not added to - * component list. - */ - if (!soc_find_component(platform)) - return -EPROBE_DEFER; - } - - /* FIXME */ - if (link->num_cpus > 1) { - dev_err(card->dev, - "ASoC: multi cpu is not yet supported %s\n", - link->name); - return -EINVAL; - } - - /* - * CPU device may be specified by either name or OF node, but - * can be left unspecified, and will be matched based on DAI - * name alone.. - */ - if (link->cpus->name && link->cpus->of_node) { - dev_err(card->dev, - "ASoC: Neither/both cpu name/of_node are set for %s\n", - link->name); - return -EINVAL; - } - - /* - * Defer card registartion if cpu dai component is not added to - * component list. - */ - if ((link->cpus->of_node || link->cpus->name) && - !soc_find_component(link->cpus)) - return -EPROBE_DEFER; - - /* - * At least one of CPU DAI name or CPU device name/node must be - * specified - */ - if (!link->cpus->dai_name && - !(link->cpus->name || link->cpus->of_node)) { - dev_err(card->dev, - "ASoC: Neither cpu_dai_name nor cpu_name/of_node are set for %s\n", - link->name); - return -EINVAL; - } - - return 0; -} - void snd_soc_disconnect_sync(struct device *dev) { struct snd_soc_component *component = From patchwork Tue Nov 5 06:45:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 11226971 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 230381515 for ; Tue, 5 Nov 2019 06:48:02 +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 A7E25217F5 for ; Tue, 5 Nov 2019 06:48:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="pEnkTGll" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A7E25217F5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.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 D9C391727; Tue, 5 Nov 2019 07:47:07 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D9C391727 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1572936478; bh=S+GCeF/DRKYGeNBEV1A0L0vYH4HNCnAUFOSN7KLE9ic=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=pEnkTGll7UeWTqgokcAu2Vj7CtVVVTHbVJGcW0S7YxH4cg5A5RPjOeRdKlHcD+KIH co3PdTYHmWRT5ZqwpM3/W3DHZRRFYLLlTYiHG16zaVqfqyRqtN/x9ExYOijchH6i/u 56r6/9dMBWFAcIM7I50XjWm9QNs+ulEYpyOU2XlI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 2807DF805FF; Tue, 5 Nov 2019 07:45:59 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2DD86F80600; Tue, 5 Nov 2019 07:45:57 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.0 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa1.perex.cz (Postfix) with ESMTP id 96D19F805DF for ; Tue, 5 Nov 2019 07:45:52 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 96D19F805DF Date: 05 Nov 2019 15:45:50 +0900 X-IronPort-AV: E=Sophos;i="5.68,270,1569250800"; d="scan'208";a="30858149" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 05 Nov 2019 15:45:50 +0900 Received: from morimoto-PC.renesas.com (unknown [10.166.18.140]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id D93EF41946B8; Tue, 5 Nov 2019 15:45:50 +0900 (JST) Message-ID: <87d0e63joh.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.5 Mule/6.0 To: Mark Brown In-Reply-To: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> References: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Linux-ALSA , Pierre-Louis Bossart , Ranjani Sridharan Subject: [alsa-devel] [PATCH v3 02/19] ASoC: soc-core: tidyup soc_init_dai_link() 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" From: Kuninori Morimoto soc_init_dai_link() is needed to be called before soc_bind_dai_link(). int snd_soc_instantiate_card() { for_each_card_prelinks(...) { (1) ret = soc_init_dai_link(...); ... } ... for_each_card_prelinks(...) { (2) ret = soc_bind_dai_link(...); ... } ... for_each_card_links(...) { ... (A) ret = soc_init_dai_link(...); ... (B) ret = soc_bind_dai_link(...); } ... (1) is for (2), and (A) is for (B) (1) and (2) are for card prelink dai_link. (A) and (B) are for topology added dai_link. soc_init_dai_link() is sanity check for dai_link, not initializing today. Therefore, it is confusable naming. We can rename it as sanity_check. And this check is for soc_bind_dai_link(). It can be more simple code if we can call it from soc_bind_dai_link(). This patch renames it to soc_dai_link_sanity_check(), and call it from soc_bind_dai_link(). Signed-off-by: Kuninori Morimoto Reviewed-by: Pierre-Louis Bossart Signed-off-by: Kuninori Morimoto Tested-by: Jon Hunter --- v2 -> v3 - add Reviewed-by - call soc_dai_link_sanity_check() after soc_is_dai_link_bound() sound/soc/soc-core.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index a141828..827625b 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -941,8 +941,8 @@ static bool soc_is_dai_link_bound(struct snd_soc_card *card, return false; } -static int soc_init_dai_link(struct snd_soc_card *card, - struct snd_soc_dai_link *link) +static int soc_dai_link_sanity_check(struct snd_soc_card *card, + struct snd_soc_dai_link *link) { int i; struct snd_soc_dai_link_component *codec, *platform; @@ -1043,7 +1043,7 @@ static int soc_bind_dai_link(struct snd_soc_card *card, struct snd_soc_pcm_runtime *rtd; struct snd_soc_dai_link_component *codec, *platform; struct snd_soc_component *component; - int i; + int i, ret; if (dai_link->ignore) return 0; @@ -1056,6 +1056,10 @@ static int soc_bind_dai_link(struct snd_soc_card *card, return 0; } + ret = soc_dai_link_sanity_check(card, dai_link); + if (ret < 0) + return ret; + rtd = soc_new_pcm_runtime(card, dai_link); if (!rtd) return -ENOMEM; @@ -1985,15 +1989,6 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) int ret, i; mutex_lock(&client_mutex); - for_each_card_prelinks(card, i, dai_link) { - ret = soc_init_dai_link(card, dai_link); - if (ret) { - dev_err(card->dev, "ASoC: failed to init link %s: %d\n", - dai_link->name, ret); - mutex_unlock(&client_mutex); - return ret; - } - } mutex_lock_nested(&card->mutex, SND_SOC_CARD_CLASS_INIT); snd_soc_dapm_init(&card->dapm, card, NULL); @@ -2073,9 +2068,6 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) if (soc_is_dai_link_bound(card, dai_link)) continue; - ret = soc_init_dai_link(card, dai_link); - if (ret) - goto probe_end; ret = soc_bind_dai_link(card, dai_link); if (ret) goto probe_end; From patchwork Tue Nov 5 06:46:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 11226973 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A20DC1390 for ; Tue, 5 Nov 2019 06:48:48 +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 283C5217F4 for ; Tue, 5 Nov 2019 06:48:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="R0v58+yf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 283C5217F4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.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 47FB3170A; Tue, 5 Nov 2019 07:47:56 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 47FB3170A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1572936526; bh=8X3154ZBTqj3m5eSrwgnw2T/ySskTLHLltvloVnQKbg=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=R0v58+yfiF006FQSu86hV06VrB4yeJzqPLL3Eo11uVuOqtmMzmVUXQOIeroyjzV7x FbspgaGrRo4hWJAvmCuX9W1XwS5tHtv/zdvAEFyAfjoYLN4fTYcckxJedDGajSfchn 6VP2B4XYW9o1CNzQuyWbWYuboP3WzHWPqGuBmygc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id ACEAEF80610; Tue, 5 Nov 2019 07:46:09 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id AF943F80611; Tue, 5 Nov 2019 07:46:06 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS, SURBL_BLOCKED,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa1.perex.cz (Postfix) with ESMTP id 49892F8060D for ; Tue, 5 Nov 2019 07:46:02 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 49892F8060D Date: 05 Nov 2019 15:46:00 +0900 X-IronPort-AV: E=Sophos;i="5.68,270,1569250800"; d="scan'208";a="30858167" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 05 Nov 2019 15:46:00 +0900 Received: from morimoto-PC.renesas.com (unknown [10.166.18.140]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 6CEF14001B75; Tue, 5 Nov 2019 15:46:00 +0900 (JST) Message-ID: <87bltq3jo7.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.5 Mule/6.0 To: Mark Brown In-Reply-To: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> References: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Linux-ALSA , Pierre-Louis Bossart , Ranjani Sridharan Subject: [alsa-devel] [PATCH v3 03/19] ASoC: soc-core: typo fix at soc_dai_link_sanity_check() 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" From: Kuninori Morimoto Reported-by: Pierre-Louis Bossart Signed-off-by: Kuninori Morimoto --- v2 -> v3 - new patch sound/soc/soc-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 827625b..e1b0d86 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1015,7 +1015,7 @@ static int soc_dai_link_sanity_check(struct snd_soc_card *card, } /* - * Defer card registartion if cpu dai component is not added to + * Defer card registration if cpu dai component is not added to * component list. */ if ((link->cpus->of_node || link->cpus->name) && From patchwork Tue Nov 5 06:46:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 11226975 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3140A1390 for ; Tue, 5 Nov 2019 06:49:18 +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 AB583217F4 for ; Tue, 5 Nov 2019 06:49:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="KIir3jjE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AB583217F4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.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 E2E1F170B; Tue, 5 Nov 2019 07:48:25 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E2E1F170B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1572936556; bh=M8K599iU9M2lwamhwuz7+FBbuvL/gi9ujj3zdXvvGjk=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=KIir3jjEwWgcC/aUUG8dRy4/DntLn1piNbZ3OEY4wZ/yFZ1nDEpVHzwVXXQhX3ROe QM7+YWgLBqo0yn78pkOcsDLLQPsXXqvYaWMATh0hMZwBbpBcj9sTh+kGzCUej47Idc 8HzFzEppmbCetSFuG9b/O9k7e4pG9v9wLufPmv6c= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 34F41F8049B; Tue, 5 Nov 2019 07:46:22 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id BF6BBF80634; Tue, 5 Nov 2019 07:46:20 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS, SURBL_BLOCKED,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa1.perex.cz (Postfix) with ESMTP id 8D817F80446 for ; Tue, 5 Nov 2019 07:46:16 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8D817F80446 Date: 05 Nov 2019 15:46:15 +0900 X-IronPort-AV: E=Sophos;i="5.68,270,1569250800"; d="scan'208";a="30858190" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 05 Nov 2019 15:46:15 +0900 Received: from morimoto-PC.renesas.com (unknown [10.166.18.140]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 18F89400940C; Tue, 5 Nov 2019 15:46:15 +0900 (JST) Message-ID: <87a79a3jns.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.5 Mule/6.0 To: Mark Brown In-Reply-To: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> References: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Linux-ALSA , Pierre-Louis Bossart , Ranjani Sridharan Subject: [alsa-devel] [PATCH v3 04/19] ASoC: soc-core: remove duplicated soc_is_dai_link_bound() 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" From: Kuninori Morimoto soc_is_dai_link_bound() check will be called both *before* soc_bind_dai_link() (A), and *under* soc_bind_dai_link() (B). These are very verbose code. Let's remove one of them. * static int soc_bind_dai_link(...) { ... (B) if (soc_is_dai_link_bound(...)) { ... return 0; } ... } static int snd_soc_instantiate_card(...) { ... for_each_card_links(...) { (A) if (soc_is_dai_link_bound(...)) continue; * ret = soc_bind_dai_link(...); if (ret) goto probe_end; } ... } Signed-off-by: Kuninori Morimoto Reviewed-by: Pierre-Louis Bossart --- v2 -> v3 - no change - add Reviewed-by sound/soc/soc-core.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index e1b0d86..3cc36c2 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2065,9 +2065,6 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) * Components with topology may bring new DAIs and DAI links. */ for_each_card_links(card, dai_link) { - if (soc_is_dai_link_bound(card, dai_link)) - continue; - ret = soc_bind_dai_link(card, dai_link); if (ret) goto probe_end; From patchwork Tue Nov 5 06:46:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 11226977 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D452C16B1 for ; Tue, 5 Nov 2019 06:50:10 +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 6437D217F5 for ; Tue, 5 Nov 2019 06:50:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="a0YZGUNR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6437D217F5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.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 17F871725; Tue, 5 Nov 2019 07:49:18 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 17F871725 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1572936608; bh=BLvA/q0HBMQiFoesPyUSyAwJlxDic5H8XSQ/9EngYfw=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=a0YZGUNRQvS2NGbU/zcuxwiEpOi242RMlKhq9KSQiCkxEK7FpzbfZVd6q/0Txutaj KGq0fN73pAWKFCo/KziN/sv2dF9Z85mlCWV45xjNjVVDZMMA1yKIM/9vTH4j8esNRv w+YEc5F9Z7OK0K3oIj69b9BQxgbe294oQpBETldE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 52946F8063C; Tue, 5 Nov 2019 07:46:27 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id EDDB4F8063C; Tue, 5 Nov 2019 07:46:25 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS, SURBL_BLOCKED,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa1.perex.cz (Postfix) with ESMTP id E763BF80446 for ; Tue, 5 Nov 2019 07:46:20 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E763BF80446 Date: 05 Nov 2019 15:46:20 +0900 X-IronPort-AV: E=Sophos;i="5.68,270,1569250800"; d="scan'208";a="30858198" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 05 Nov 2019 15:46:20 +0900 Received: from morimoto-PC.renesas.com (unknown [10.166.18.140]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 726664003ED6; Tue, 5 Nov 2019 15:46:20 +0900 (JST) Message-ID: <878sou3jnn.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.5 Mule/6.0 To: Mark Brown In-Reply-To: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> References: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Linux-ALSA , Pierre-Louis Bossart , Ranjani Sridharan Subject: [alsa-devel] [PATCH v3 05/19] ASoC: soc-core: call soc_bind_dai_link() under snd_soc_add_dai_link() 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" From: Kuninori Morimoto If we focus to soc_bind_dai_link() at snd_soc_instantiate_card(), we will notice very complex operation. static int snd_soc_instantiate_card(...) { ... /* * (1) Bind dai_link via card pre-linked dai_link * * Bind dai_link via card pre-linked. * 1 dai_link will be 1 rtd, and connected to card. * for_each_card_prelinks() is for card pre-linked dai_link. * * Image * * card * - rtd(A) * - rtd(A) */ for_each_card_prelinks(card, i, dai_link) { ret = soc_bind_dai_link(card, dai_link); ... } ... /* * (2) Connect card pre-linked dai_link to card list * * Connect all card pre-linked dai_link to *card list*. * Here, (A) means from card pre-linked. * * Image * * card card list * - rtd(A) - dai_link(A) * - rtd(A) - dai_link(A) * - ... - ... */ for_each_card_prelinks(card, i, dai_link) { ret = snd_soc_add_dai_link(card, dai_link); ... } ... /* * (3) Probe binded component * * Each rtd has many components. * Here probes each rtd connected components. * rtd(A) in Image is the probe target. * * During this component probe, topology may add new dai_link to * *card list* by using snd_soc_add_dai_link() which is * used at (2). * Here, (B) means from topology * * Image * * card card list * - rtd(A) - dai_link(A) * - rtd(A) - dai_link(A) * - ... - ... * - dai_link(B) * - dai_link(B) */ ret = soc_probe_link_components(card); ... /* * (4) Bind dai_link again * * Bind dai_link again for topology. * Note, (1) used for_each_card_prelinks(), * here is using for_each_card_links() * * This means from card list. * As Image indicating, it has dai_link(A) (from card pre-link) * and dai_link(B) (from topology). * main target here is dai_link(B). * soc_bind_dai_link() ignores already used * dai_link (= dai_link(A)) * * Image * * card card list * - rtd(A) - dai_link(A) * - rtd(A) - dai_link(A) * - ... - ... * - rtd(B) - dai_link(B) * - rtd(B) - dai_link(B) */ for_each_card_links(card, dai_link) { ret = soc_bind_dai_link(card, dai_link); ... } ... } As you see above, it is doing very complex method. The problem is binding dai_link via "card pre-linked" (= (1)) and "topology added dai_link" (= (3)) are separated. The code can be simple if we can bind dai_link when dai_link is connected to *card list*. This patch do it. Signed-off-by: Kuninori Morimoto Reviewed-by: Pierre-Louis Bossart --- v2 -> v3 - no change - add Reviewed-by sound/soc/soc-core.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 3cc36c2..e8ff6f2 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1409,6 +1409,8 @@ EXPORT_SYMBOL_GPL(snd_soc_disconnect_sync); int snd_soc_add_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link) { + int ret; + if (dai_link->dobj.type && dai_link->dobj.type != SND_SOC_DOBJ_DAI_LINK) { dev_err(card->dev, "Invalid dai link type %d\n", @@ -1424,6 +1426,10 @@ int snd_soc_add_dai_link(struct snd_soc_card *card, if (dai_link->dobj.type && card->add_dai_link) card->add_dai_link(card, dai_link); + ret = soc_bind_dai_link(card, dai_link); + if (ret < 0) + return ret; + /* see for_each_card_links */ list_add_tail(&dai_link->list, &card->dai_link_list); @@ -1996,13 +2002,6 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) /* check whether any platform is ignore machine FE and using topology */ soc_check_tplg_fes(card); - /* bind DAIs */ - for_each_card_prelinks(card, i, dai_link) { - ret = soc_bind_dai_link(card, dai_link); - if (ret != 0) - goto probe_end; - } - /* bind aux_devs too */ ret = soc_bind_aux_dev(card); if (ret < 0) @@ -2060,16 +2059,6 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) if (ret < 0) goto probe_end; - /* - * Find new DAI links added during probing components and bind them. - * Components with topology may bring new DAIs and DAI links. - */ - for_each_card_links(card, dai_link) { - ret = soc_bind_dai_link(card, dai_link); - if (ret) - goto probe_end; - } - /* probe all DAI links on this card */ ret = soc_probe_link_dais(card); if (ret < 0) { From patchwork Tue Nov 5 06:46:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 11226979 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B09C316B1 for ; Tue, 5 Nov 2019 06:50:42 +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 423A4217F4 for ; Tue, 5 Nov 2019 06:50:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="NeN0xKC0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 423A4217F4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.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 78363172E; Tue, 5 Nov 2019 07:49:50 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 78363172E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1572936640; bh=nT1WaAcofWgz58P/kDXwuXEbvwADRHm5QGi5ogJyBVQ=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=NeN0xKC0Xj4r0V/lqSX5FvbuZo1jcGIdsEuFN6Vr22p81R8WWEXdnF/Sf1IMblSqh JvfBjHdwBcRNlYuIlUN9VL1N9vrOgHhkReLVrs7PNKpmbkX5TUM/d14rUxAPDU9dry 91BYfKPqd6ANuUetVrQNs5snyWQohb8Lpc02YIuM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4C5B7F8064C; Tue, 5 Nov 2019 07:46:32 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 43528F80642; Tue, 5 Nov 2019 07:46:31 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS, SURBL_BLOCKED,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id 67A88F80642 for ; Tue, 5 Nov 2019 07:46:26 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 67A88F80642 Date: 05 Nov 2019 15:46:25 +0900 X-IronPort-AV: E=Sophos;i="5.68,270,1569250800"; d="scan'208";a="30644941" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 05 Nov 2019 15:46:25 +0900 Received: from morimoto-PC.renesas.com (unknown [10.166.18.140]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 55E8C41946BB; Tue, 5 Nov 2019 15:46:25 +0900 (JST) Message-ID: <877e4e3jni.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.5 Mule/6.0 To: Mark Brown In-Reply-To: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> References: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Linux-ALSA , Pierre-Louis Bossart , Ranjani Sridharan Subject: [alsa-devel] [PATCH v3 06/19] ASoC: soc-core: add soc_unbind_dai_link() 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" From: Kuninori Morimoto It is easy to read code if it is cleanly using paired function/naming, like start <-> stop, register <-> unregister, etc, etc. But, current ALSA SoC code is very random, unbalance, not paired, etc. It is easy to create bug at the such code, and it will be difficult to debug. ALSA SoC has soc_bind_dai_link(), but its paired soc_unbind_dai_link() is not implemented. More confusable is that soc_remove_pcm_runtimes() which should be soc_unbind_dai_link() is implemented without synchronised to soc_bind_dai_link(). This patch cleanup this unbalance. Signed-off-by: Kuninori Morimoto Reviewed-by: Pierre-Louis Bossart Signed-off-by: Kuninori Morimoto --- v2 -> v3 - no change - add Reviewed-by sound/soc/soc-core.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index e8ff6f2..1e8dd19 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -470,14 +470,6 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime( return NULL; } -static void soc_remove_pcm_runtimes(struct snd_soc_card *card) -{ - struct snd_soc_pcm_runtime *rtd, *_rtd; - - for_each_card_rtds_safe(card, rtd, _rtd) - soc_free_pcm_runtime(rtd); -} - struct snd_soc_pcm_runtime *snd_soc_get_pcm_runtime(struct snd_soc_card *card, const char *dai_link) { @@ -1037,6 +1029,16 @@ static int soc_dai_link_sanity_check(struct snd_soc_card *card, return 0; } +static void soc_unbind_dai_link(struct snd_soc_card *card, + struct snd_soc_dai_link *dai_link) +{ + struct snd_soc_pcm_runtime *rtd; + + rtd = snd_soc_get_pcm_runtime(card, dai_link->name); + if (rtd) + soc_free_pcm_runtime(rtd); +} + static int soc_bind_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link) { @@ -1466,6 +1468,8 @@ void snd_soc_remove_dai_link(struct snd_soc_card *card, card->remove_dai_link(card, dai_link); list_del(&dai_link->list); + + soc_unbind_dai_link(card, dai_link); } EXPORT_SYMBOL_GPL(snd_soc_remove_dai_link); @@ -1974,8 +1978,6 @@ static void soc_cleanup_card_resources(struct snd_soc_card *card) for_each_card_links_safe(card, link, _link) snd_soc_remove_dai_link(card, link); - soc_remove_pcm_runtimes(card); - /* remove auxiliary devices */ soc_remove_aux_devices(card); soc_unbind_aux_dev(card); From patchwork Tue Nov 5 06:46:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 11226981 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EFF5816B1 for ; Tue, 5 Nov 2019 06:51:25 +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 81316217F5 for ; Tue, 5 Nov 2019 06:51:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="Hs51cu0M" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 81316217F5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.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 A20221728; Tue, 5 Nov 2019 07:50:33 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A20221728 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1572936683; bh=WhqZcq0KV65zZVlDQt7G0YhfuCOYeQWpgkcM4MF+M+U=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Hs51cu0MVaONqD3r609lm2+n2QKgRvG6yhQsOqCACkRHItx4CSnuwRCq06zc29+kA OPhsTeUymRikZi/kmNtW878ZP5tPHe0m7ET+NCfE/cpKgvIR0sTbjpDbiVqWlyUv91 wtZ3BOlgPVSS5NcCdxyg0IUesZEtt1r1ARSOMbLw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id A7CFFF80642; Tue, 5 Nov 2019 07:46:37 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id CC25FF80671; Tue, 5 Nov 2019 07:46:35 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id DCE62F80642 for ; Tue, 5 Nov 2019 07:46:30 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz DCE62F80642 Date: 05 Nov 2019 15:46:30 +0900 X-IronPort-AV: E=Sophos;i="5.68,270,1569250800"; d="scan'208";a="30644953" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 05 Nov 2019 15:46:30 +0900 Received: from morimoto-PC.renesas.com (unknown [10.166.18.140]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 68ED54003ED6; Tue, 5 Nov 2019 15:46:30 +0900 (JST) Message-ID: <875zjy3jnd.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.5 Mule/6.0 To: Mark Brown In-Reply-To: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> References: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Linux-ALSA , Pierre-Louis Bossart , Ranjani Sridharan Subject: [alsa-devel] [PATCH v3 07/19] ASoC: soc-core: move snd_soc_lookup_component() 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" From: Kuninori Morimoto This patch moves snd_soc_lookup_component() to upper side. This is prepare for snd_soc_unregister_component() Signed-off-by: Kuninori Morimoto Reviewed-by: Pierre-Louis Bossart --- v2 -> v3 - no change - add Reviewed-by sound/soc/soc-core.c | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 1e8dd19..b71bddb 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -356,6 +356,32 @@ struct snd_soc_component *snd_soc_rtdcom_lookup(struct snd_soc_pcm_runtime *rtd, } EXPORT_SYMBOL_GPL(snd_soc_rtdcom_lookup); +struct snd_soc_component *snd_soc_lookup_component(struct device *dev, + const char *driver_name) +{ + struct snd_soc_component *component; + struct snd_soc_component *ret; + + ret = NULL; + mutex_lock(&client_mutex); + for_each_component(component) { + if (dev != component->dev) + continue; + + if (driver_name && + (driver_name != component->driver->name) && + (strcmp(component->driver->name, driver_name) != 0)) + continue; + + ret = component; + break; + } + mutex_unlock(&client_mutex); + + return ret; +} +EXPORT_SYMBOL_GPL(snd_soc_lookup_component); + struct snd_pcm_substream *snd_soc_get_dai_substream(struct snd_soc_card *card, const char *dai_link, int stream) { @@ -2889,32 +2915,6 @@ void snd_soc_unregister_component(struct device *dev) } EXPORT_SYMBOL_GPL(snd_soc_unregister_component); -struct snd_soc_component *snd_soc_lookup_component(struct device *dev, - const char *driver_name) -{ - struct snd_soc_component *component; - struct snd_soc_component *ret; - - ret = NULL; - mutex_lock(&client_mutex); - for_each_component(component) { - if (dev != component->dev) - continue; - - if (driver_name && - (driver_name != component->driver->name) && - (strcmp(component->driver->name, driver_name) != 0)) - continue; - - ret = component; - break; - } - mutex_unlock(&client_mutex); - - return ret; -} -EXPORT_SYMBOL_GPL(snd_soc_lookup_component); - /* Retrieve a card's name from device tree */ int snd_soc_of_parse_card_name(struct snd_soc_card *card, const char *propname) From patchwork Tue Nov 5 06:46:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 11226983 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 386C21390 for ; Tue, 5 Nov 2019 06:52:08 +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 B43FD214B2 for ; Tue, 5 Nov 2019 06:52:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="rKYOkmTp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B43FD214B2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.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 D99A51729; Tue, 5 Nov 2019 07:51:15 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D99A51729 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1572936726; bh=2luxCIrqZpPvSCwehQolJpf16Vbt2j7JFGNQ7/Z/Z8g=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=rKYOkmTpuSr4pFuunj0rDjI8/tWI6T82cSqi4c/hXnWJ8JBDbAQngagvFbmwBrLVW cfYpDG6xfjYqR0TNT52YPCjJaUL5U8QanNqOGttA0wpS+AYJ849hk9U9u1dMwPC0Fe sJuRp6k1cz9qBFJKtTqlUcwZK4VzLm6oIoF6relI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D2AD9F8065C; Tue, 5 Nov 2019 07:46:41 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9C593F80676; Tue, 5 Nov 2019 07:46:40 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS, SURBL_BLOCKED,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id 0AE24F8065C for ; Tue, 5 Nov 2019 07:46:35 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0AE24F8065C Date: 05 Nov 2019 15:46:35 +0900 X-IronPort-AV: E=Sophos;i="5.68,270,1569250800"; d="scan'208";a="30644961" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 05 Nov 2019 15:46:35 +0900 Received: from morimoto-PC.renesas.com (unknown [10.166.18.140]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 8C93541946C2; Tue, 5 Nov 2019 15:46:35 +0900 (JST) Message-ID: <874kzi3jn8.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.5 Mule/6.0 To: Mark Brown In-Reply-To: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> References: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Linux-ALSA , Pierre-Louis Bossart , Ranjani Sridharan Subject: [alsa-devel] [PATCH v3 08/19] ASoC: soc-core: tidyup snd_soc_lookup_component() 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" From: Kuninori Morimoto snd_soc_lookup_component() is using mix of continue and break in the same loop. It is odd. This patch cleanup it. Reported-by: Pierre-Louis Bossart Signed-off-by: Kuninori Morimoto --- v2 -> v3 - new patch sound/soc/soc-core.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index b71bddb..acbaed4 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -360,25 +360,22 @@ struct snd_soc_component *snd_soc_lookup_component(struct device *dev, const char *driver_name) { struct snd_soc_component *component; - struct snd_soc_component *ret; + struct snd_soc_component *found_component; - ret = NULL; + found_component = NULL; mutex_lock(&client_mutex); for_each_component(component) { - if (dev != component->dev) - continue; - - if (driver_name && - (driver_name != component->driver->name) && - (strcmp(component->driver->name, driver_name) != 0)) - continue; - - ret = component; - break; + if ((dev == component->dev) && + (!driver_name || + (driver_name == component->driver->name) || + (strcmp(component->driver->name, driver_name) == 0))) { + found_component = component; + break; + } } mutex_unlock(&client_mutex); - return ret; + return found_component; } EXPORT_SYMBOL_GPL(snd_soc_lookup_component); From patchwork Tue Nov 5 06:46:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 11226985 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0A56B1390 for ; Tue, 5 Nov 2019 06:52:46 +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 90F7E217F4 for ; Tue, 5 Nov 2019 06:52:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="d8fwnJ/e" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 90F7E217F4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.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 A8AB61719; Tue, 5 Nov 2019 07:51:53 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A8AB61719 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1572936763; bh=bW5s7oZUCvjR7zrARShp6FJF8ODQc1E6XAp3OSqr5BA=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=d8fwnJ/eYTGpDkP1rRCKjV+2dKU9rzyyRYJcxyImkdshhiuk0dgL0FAVAQ38kYDbX YgUCUbLRRe6gie/yJXhw73MLwdEvR70/0x0g1X6kNH+TnIzT6/yWr0C9fHh0fEzDsa eIg/wYw+ORHiHmdL87pyshBClk5eYelCr281v3OI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B9B10F8067A; Tue, 5 Nov 2019 07:46:46 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5FCB8F8067B; Tue, 5 Nov 2019 07:46:45 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS, SURBL_BLOCKED,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa1.perex.cz (Postfix) with ESMTP id 1E78CF80678 for ; Tue, 5 Nov 2019 07:46:40 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1E78CF80678 Date: 05 Nov 2019 15:46:39 +0900 X-IronPort-AV: E=Sophos;i="5.68,270,1569250800"; d="scan'208";a="30858226" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 05 Nov 2019 15:46:39 +0900 Received: from morimoto-PC.renesas.com (unknown [10.166.18.140]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id D84E94001B75; Tue, 5 Nov 2019 15:46:39 +0900 (JST) Message-ID: <8736f23jn4.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.5 Mule/6.0 To: Mark Brown In-Reply-To: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> References: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Linux-ALSA , Pierre-Louis Bossart , Ranjani Sridharan Subject: [alsa-devel] [PATCH v3 09/19] ASoC: soc-core: add snd_soc_del_component_unlocked() 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" From: Kuninori Morimoto It is easy to read code if it is cleanly using paired function/naming, like start <-> stop, register <-> unregister, etc, etc. But, current ALSA SoC code is very random, unbalance, not paired, etc. It is easy to create bug at the such code, and is difficult to debug. Now ALSA SoC has snd_soc_add_component(), but there is no paired snd_soc_del_component(). Thus, snd_soc_unregister_component() is calling cleanup function randomly. it is difficult to read. This patch adds missing snd_soc_del_component_unlocked() and balance up code. Signed-off-by: Kuninori Morimoto Reviewed-by: Pierre-Louis Bossart --- v2 -> v3 - no change - add Reviewed-by sound/soc/soc-core.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index acbaed4..e91325b 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2764,12 +2764,7 @@ static void snd_soc_component_add(struct snd_soc_component *component) mutex_unlock(&client_mutex); } -static void snd_soc_component_cleanup(struct snd_soc_component *component) -{ - snd_soc_unregister_dais(component); -} - -static void snd_soc_component_del_unlocked(struct snd_soc_component *component) +static void snd_soc_component_del(struct snd_soc_component *component) { struct snd_soc_card *card = component->card; @@ -2823,6 +2818,12 @@ static void snd_soc_try_rebind_card(void) list_del(&card->list); } +static void snd_soc_del_component_unlocked(struct snd_soc_component *component) +{ + snd_soc_unregister_dais(component); + snd_soc_component_del(component); +} + int snd_soc_add_component(struct device *dev, struct snd_soc_component *component, const struct snd_soc_component_driver *component_driver, @@ -2855,7 +2856,7 @@ int snd_soc_add_component(struct device *dev, return 0; err_cleanup: - snd_soc_component_cleanup(component); + snd_soc_del_component_unlocked(component); err_free: return ret; } @@ -2893,15 +2894,12 @@ static int __snd_soc_unregister_component(struct device *dev) if (dev != component->dev) continue; - snd_soc_component_del_unlocked(component); + snd_soc_del_component_unlocked(component); found = 1; break; } mutex_unlock(&client_mutex); - if (found) - snd_soc_component_cleanup(component); - return found; } From patchwork Tue Nov 5 06:46:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 11226987 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 80B6116B1 for ; Tue, 5 Nov 2019 06:53:22 +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 115EB217F4 for ; Tue, 5 Nov 2019 06:53:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="NUxb2Ufi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 115EB217F4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.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 DA2F2170B; Tue, 5 Nov 2019 07:52:29 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DA2F2170B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1572936799; bh=yGINQjPZlZnWjbanDBK8yPi1+iYUZzXSiuJGy9bLhLk=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=NUxb2Ufii9wG0AYBfJyFQie2EWAg2i4eWkoFuIw2PD28KfQrcCHI1rdrXF1dfnnxP dsEPf7kMb7ehLqfoVapv75HGRZR2xJKxgFGkwxxp+R9N5HGY6g7bmqvfE088AYlh/x P8uvsEY9F47Y7N6HAMLuzEGghYRGtALE5qaScjaE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id A87C1F806E7; Tue, 5 Nov 2019 07:46:52 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9BED0F806E8; Tue, 5 Nov 2019 07:46:51 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS, SURBL_BLOCKED,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id 484FAF8067C for ; Tue, 5 Nov 2019 07:46:47 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 484FAF8067C Date: 05 Nov 2019 15:46:45 +0900 X-IronPort-AV: E=Sophos;i="5.68,270,1569250800"; d="scan'208";a="30644978" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 05 Nov 2019 15:46:45 +0900 Received: from morimoto-PC.renesas.com (unknown [10.166.18.140]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 43EA4400940C; Tue, 5 Nov 2019 15:46:45 +0900 (JST) Message-ID: <871rum3jmy.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.5 Mule/6.0 To: Mark Brown In-Reply-To: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> References: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Linux-ALSA , Pierre-Louis Bossart , Ranjani Sridharan Subject: [alsa-devel] [PATCH v3 10/19] ASoC: soc-core: remove snd_soc_component_add/del() 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" From: Kuninori Morimoto soc-core has snd_soc_add_component(), snd_soc_component_add(), snd_soc_del_component(), snd_soc_component_del(). These are very confusing naming. snd_soc_component_xxx() are called from snd_soc_xxx_component(), and these are very small. Let's merge these into snd_soc_xxx_component(), and remove snd_soc_component_xxx(). Reported-by: Pierre-Louis Bossart Signed-off-by: Kuninori Morimoto Reviewed-by: Pierre-Louis Bossart --- v2 -> v3 - no change - add Reviewed-by - add missing Reported-by sound/soc/soc-core.c | 58 ++++++++++++++++++++++------------------------------ 1 file changed, 25 insertions(+), 33 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index e91325b..bb05921 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2746,34 +2746,6 @@ EXPORT_SYMBOL_GPL(snd_soc_component_exit_regmap); #endif -static void snd_soc_component_add(struct snd_soc_component *component) -{ - mutex_lock(&client_mutex); - - if (!component->driver->write && !component->driver->read) { - if (!component->regmap) - component->regmap = dev_get_regmap(component->dev, - NULL); - if (component->regmap) - snd_soc_component_setup_regmap(component); - } - - /* see for_each_component */ - list_add(&component->list, &component_list); - - mutex_unlock(&client_mutex); -} - -static void snd_soc_component_del(struct snd_soc_component *component) -{ - struct snd_soc_card *card = component->card; - - if (card) - snd_soc_unbind_card(card, false); - - list_del(&component->list); -} - #define ENDIANNESS_MAP(name) \ (SNDRV_PCM_FMTBIT_##name##LE | SNDRV_PCM_FMTBIT_##name##BE) static u64 endianness_format_map[] = { @@ -2820,8 +2792,14 @@ static void snd_soc_try_rebind_card(void) static void snd_soc_del_component_unlocked(struct snd_soc_component *component) { + struct snd_soc_card *card = component->card; + snd_soc_unregister_dais(component); - snd_soc_component_del(component); + + if (card) + snd_soc_unbind_card(card, false); + + list_del(&component->list); } int snd_soc_add_component(struct device *dev, @@ -2833,6 +2811,8 @@ int snd_soc_add_component(struct device *dev, int ret; int i; + mutex_lock(&client_mutex); + ret = snd_soc_component_initialize(component, component_driver, dev); if (ret) goto err_free; @@ -2850,14 +2830,26 @@ int snd_soc_add_component(struct device *dev, goto err_cleanup; } - snd_soc_component_add(component); - snd_soc_try_rebind_card(); + if (!component->driver->write && !component->driver->read) { + if (!component->regmap) + component->regmap = dev_get_regmap(component->dev, + NULL); + if (component->regmap) + snd_soc_component_setup_regmap(component); + } - return 0; + /* see for_each_component */ + list_add(&component->list, &component_list); err_cleanup: - snd_soc_del_component_unlocked(component); + if (ret < 0) + snd_soc_del_component_unlocked(component); err_free: + mutex_unlock(&client_mutex); + + if (ret == 0) + snd_soc_try_rebind_card(); + return ret; } EXPORT_SYMBOL_GPL(snd_soc_add_component); From patchwork Tue Nov 5 06:46:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 11226989 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3369716B1 for ; Tue, 5 Nov 2019 06:54:13 +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 B8615217F4 for ; Tue, 5 Nov 2019 06:54:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="tO4fnNlM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B8615217F4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.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 B0E7516AF; Tue, 5 Nov 2019 07:53:20 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B0E7516AF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1572936850; bh=3X6WXlYw/x8jRgWjkb1nOhM1YXKCXuOjZPwvjx3D0OI=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=tO4fnNlMIKdCS0HPMmrsF4fw/IwkhKUckPDRo15S6vi29V3wXF1OPk37HZGU6zHpf rvs6z1MtLSqybGQYyuE1Gl0Qpq2TgSLn08eDDSoyDoTg15HQX2fZG5Iu1mljzGKYTt dywXI3gVSeWv+kdaqxz2eHAj09Hw+Q9xmIjOebeA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4F7FEF8070B; Tue, 5 Nov 2019 07:46:57 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 62337F8070C; Tue, 5 Nov 2019 07:46:56 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS, SURBL_BLOCKED,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id BF6FAF8067C for ; Tue, 5 Nov 2019 07:46:51 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BF6FAF8067C Date: 05 Nov 2019 15:46:51 +0900 X-IronPort-AV: E=Sophos;i="5.68,270,1569250800"; d="scan'208";a="30644983" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 05 Nov 2019 15:46:51 +0900 Received: from morimoto-PC.renesas.com (unknown [10.166.18.140]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 479694003885; Tue, 5 Nov 2019 15:46:51 +0900 (JST) Message-ID: <87zhha252c.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.5 Mule/6.0 To: Mark Brown In-Reply-To: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> References: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Linux-ALSA , Pierre-Louis Bossart , Ranjani Sridharan Subject: [alsa-devel] [PATCH v3 11/19] ASoC: soc-core: use snd_soc_lookup_component() at snd_soc_unregister_component() 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" From: Kuninori Morimoto snd_soc_unregister_component() is now finding component manually, but we already have snd_soc_lookup_component() to find component; Let's use existing function. Signed-off-by: Kuninori Morimoto Reviewed-by: Pierre-Louis Bossart --- v2 -> v3 - no change - add Reviewed-by sound/soc/soc-core.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index bb05921..0ce3336 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2876,29 +2876,19 @@ EXPORT_SYMBOL_GPL(snd_soc_register_component); * * @dev: The device to unregister */ -static int __snd_soc_unregister_component(struct device *dev) +void snd_soc_unregister_component(struct device *dev) { struct snd_soc_component *component; - int found = 0; mutex_lock(&client_mutex); - for_each_component(component) { - if (dev != component->dev) - continue; + while (1) { + component = snd_soc_lookup_component(dev, NULL); + if (!component) + break; snd_soc_del_component_unlocked(component); - found = 1; - break; } mutex_unlock(&client_mutex); - - return found; -} - -void snd_soc_unregister_component(struct device *dev) -{ - while (__snd_soc_unregister_component(dev)) - ; } EXPORT_SYMBOL_GPL(snd_soc_unregister_component); From patchwork Tue Nov 5 06:46:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 11226991 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 666341390 for ; Tue, 5 Nov 2019 06:54:51 +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 EA43A217F4 for ; Tue, 5 Nov 2019 06:54:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="mQTaKm4d" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EA43A217F4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.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 F10F5170D; Tue, 5 Nov 2019 07:53:57 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz F10F5170D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1572936888; bh=DEhyGoQV4APVnu/ZAs6NRDuaA26t0IATw36MkhuveFw=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=mQTaKm4dqZ0LczOW1gTc9PIzNWIVU8fWHaRZRKS+atmR/Ybnfcen+eohx+04icM/g stXTbL84CxCnTSZKxjBfOJtw1m1NP0WjbsiUbh1Lim5URJDzOsoZr10cfS87ANaMbe mfxUAPCh3PXFgmsyQkKEMlv3ziik2tTPpdT5r6ac= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 2FBB0F80714; Tue, 5 Nov 2019 07:47:02 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id B3EB4F80715; Tue, 5 Nov 2019 07:47:00 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS, SURBL_BLOCKED,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa1.perex.cz (Postfix) with ESMTP id C25B0F8070E for ; Tue, 5 Nov 2019 07:46:56 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C25B0F8070E Date: 05 Nov 2019 15:46:55 +0900 X-IronPort-AV: E=Sophos;i="5.68,270,1569250800"; d="scan'208";a="30858246" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 05 Nov 2019 15:46:55 +0900 Received: from morimoto-PC.renesas.com (unknown [10.166.18.140]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 8C73E41946C2; Tue, 5 Nov 2019 15:46:55 +0900 (JST) Message-ID: <87y2wu2528.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.5 Mule/6.0 To: Mark Brown In-Reply-To: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> References: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Linux-ALSA , Pierre-Louis Bossart , Ranjani Sridharan Subject: [alsa-devel] [PATCH v3 12/19] ASoC: soc-core: move snd_soc_register_dai() 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" From: Kuninori Morimoto This patch moves snd_soc_register_dai() next to snd_soc_register_dais(). This is prepare for snd_soc_register_dais() cleanup. Signed-off-by: Kuninori Morimoto Reviewed-by: Pierre-Louis Bossart --- v2 -> v3 - no change - add Reviewed-by sound/soc/soc-core.c | 72 ++++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 0ce3336..fb5f014 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2598,42 +2598,6 @@ static struct snd_soc_dai *soc_add_dai(struct snd_soc_component *component, } /** - * snd_soc_register_dais - Register a DAI with the ASoC core - * - * @component: The component the DAIs are registered for - * @dai_drv: DAI driver to use for the DAIs - * @count: Number of DAIs - */ -static int snd_soc_register_dais(struct snd_soc_component *component, - struct snd_soc_dai_driver *dai_drv, - size_t count) -{ - struct device *dev = component->dev; - struct snd_soc_dai *dai; - unsigned int i; - int ret; - - dev_dbg(dev, "ASoC: dai register %s #%zu\n", dev_name(dev), count); - - for (i = 0; i < count; i++) { - - dai = soc_add_dai(component, dai_drv + i, count == 1 && - !component->driver->non_legacy_dai_naming); - if (dai == NULL) { - ret = -ENOMEM; - goto err; - } - } - - return 0; - -err: - snd_soc_unregister_dais(component); - - return ret; -} - -/** * snd_soc_register_dai - Register a DAI dynamically & create its widgets * * @component: The component the DAIs are registered for @@ -2676,6 +2640,42 @@ int snd_soc_register_dai(struct snd_soc_component *component, } EXPORT_SYMBOL_GPL(snd_soc_register_dai); +/** + * snd_soc_register_dais - Register a DAI with the ASoC core + * + * @component: The component the DAIs are registered for + * @dai_drv: DAI driver to use for the DAIs + * @count: Number of DAIs + */ +static int snd_soc_register_dais(struct snd_soc_component *component, + struct snd_soc_dai_driver *dai_drv, + size_t count) +{ + struct device *dev = component->dev; + struct snd_soc_dai *dai; + unsigned int i; + int ret; + + dev_dbg(dev, "ASoC: dai register %s #%zu\n", dev_name(dev), count); + + for (i = 0; i < count; i++) { + + dai = soc_add_dai(component, dai_drv + i, count == 1 && + !component->driver->non_legacy_dai_naming); + if (dai == NULL) { + ret = -ENOMEM; + goto err; + } + } + + return 0; + +err: + snd_soc_unregister_dais(component); + + return ret; +} + static int snd_soc_component_initialize(struct snd_soc_component *component, const struct snd_soc_component_driver *driver, struct device *dev) { From patchwork Tue Nov 5 06:47:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 11226993 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 56FCD1390 for ; Tue, 5 Nov 2019 06:55:30 +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 DC1C8217F4 for ; Tue, 5 Nov 2019 06:55:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="dTxfALI1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DC1C8217F4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.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 16A151737; Tue, 5 Nov 2019 07:54:38 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 16A151737 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1572936928; bh=pzXq/ePIOifNI+eSCiMzyLhsTm9QK2HpwB70rp8yjqI=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=dTxfALI18kQ99E2MpmKqWULtNRXHgZJ6VKkyWkym8/8QKNhCdYhew6mMkBq3q1xrp QfdAaQObzuSZh0mVY/Z/n3aUvJMQX1pEnOeLEhnPOPI3oJNyMySQP2Y329r9RZf4Gm 7GnykyPkbWneZOtJ/zmQcb7cixUYIUUxxiVJ4NbQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 2AF1AF80535; Tue, 5 Nov 2019 07:47:15 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3AE04F8071F; Tue, 5 Nov 2019 07:47:06 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS, SURBL_BLOCKED,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id A477AF80717 for ; Tue, 5 Nov 2019 07:47:01 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A477AF80717 Date: 05 Nov 2019 15:47:00 +0900 X-IronPort-AV: E=Sophos;i="5.68,270,1569250800"; d="scan'208";a="30644996" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 05 Nov 2019 15:47:00 +0900 Received: from morimoto-PC.renesas.com (unknown [10.166.18.140]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id EA55841946BB; Tue, 5 Nov 2019 15:46:59 +0900 (JST) Message-ID: <87woce2524.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.5 Mule/6.0 To: Mark Brown In-Reply-To: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> References: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Linux-ALSA , Pierre-Louis Bossart , Ranjani Sridharan Subject: [alsa-devel] [PATCH v3 13/19] ASoC: soc-core: move snd_soc_unregister_dais() 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" From: Kuninori Morimoto This patch moves snd_soc_unregister_dais() next to snd_soc_register_dais(). This is prepare for snd_soc_register_dais() cleanup Signed-off-by: Kuninori Morimoto Reviewed-by: Pierre-Louis Bossart --- v2 -> v3 - no change - add Reviewed-by sound/soc/soc-core.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index fb5f014..c803447 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2532,22 +2532,6 @@ static inline char *fmt_multiple_name(struct device *dev, return devm_kstrdup(dev, dai_drv->name, GFP_KERNEL); } -/** - * snd_soc_unregister_dai - Unregister DAIs from the ASoC core - * - * @component: The component for which the DAIs should be unregistered - */ -static void snd_soc_unregister_dais(struct snd_soc_component *component) -{ - struct snd_soc_dai *dai, *_dai; - - for_each_component_dais_safe(component, dai, _dai) { - dev_dbg(component->dev, "ASoC: Unregistered DAI '%s'\n", - dai->name); - list_del(&dai->list); - } -} - /* Create a DAI and add it to the component's DAI list */ static struct snd_soc_dai *soc_add_dai(struct snd_soc_component *component, struct snd_soc_dai_driver *dai_drv, @@ -2641,6 +2625,22 @@ int snd_soc_register_dai(struct snd_soc_component *component, EXPORT_SYMBOL_GPL(snd_soc_register_dai); /** + * snd_soc_unregister_dai - Unregister DAIs from the ASoC core + * + * @component: The component for which the DAIs should be unregistered + */ +static void snd_soc_unregister_dais(struct snd_soc_component *component) +{ + struct snd_soc_dai *dai, *_dai; + + for_each_component_dais_safe(component, dai, _dai) { + dev_dbg(component->dev, "ASoC: Unregistered DAI '%s'\n", + dai->name); + list_del(&dai->list); + } +} + +/** * snd_soc_register_dais - Register a DAI with the ASoC core * * @component: The component the DAIs are registered for From patchwork Tue Nov 5 06:47:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 11226995 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AB5E716B1 for ; Tue, 5 Nov 2019 06:56:08 +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 3CD67217F4 for ; Tue, 5 Nov 2019 06:56:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="NrIX1Qqf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3CD67217F4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.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 61C591712; Tue, 5 Nov 2019 07:55:16 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 61C591712 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1572936966; bh=zWZW5ChnyEJIjlpFlcyJ1ynbBcDmzL7TIWjmih5G930=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=NrIX1QqfS1clRVORGovu2CtQBzTY9W7uiJ2XdYnP35f2Wb45igQdJie2XjT40TWSy o+j0ZjT4V/OtGkALDSfXaug6MqWaj1AqthHiCAOdOllfOYvjQN5kRllJFWqcm7ngKi Md8dpuBd4TLwO2VnMd5jT+LeO4VFhvrzPjpyzbC8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4937BF8015B; Tue, 5 Nov 2019 07:47:16 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id A0B7AF80717; Tue, 5 Nov 2019 07:47:09 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS, SURBL_BLOCKED,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id 34083F80716 for ; Tue, 5 Nov 2019 07:47:04 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 34083F80716 Date: 05 Nov 2019 15:47:04 +0900 X-IronPort-AV: E=Sophos;i="5.68,270,1569250800"; d="scan'208";a="30645000" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 05 Nov 2019 15:47:04 +0900 Received: from morimoto-PC.renesas.com (unknown [10.166.18.140]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id B56EC41946C9; Tue, 5 Nov 2019 15:47:04 +0900 (JST) Message-ID: <87v9ry251z.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.5 Mule/6.0 To: Mark Brown In-Reply-To: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> References: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Linux-ALSA , Pierre-Louis Bossart , Ranjani Sridharan Subject: [alsa-devel] [PATCH v3 14/19] ASoC: soc-core: add snd_soc_unregister_dai() 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" From: Kuninori Morimoto It is easy to read code if it is cleanly using paired function/naming, like start <-> stop, register <-> unregister, etc, etc. But, current ALSA SoC code is very random, unbalance, not paired, etc. It is easy to create bug at the such code, and is difficult to debug. This patch adds missing soc_del_dai() and snd_soc_unregister_dai(). Signed-off-by: Kuninori Morimoto Reviewed-by: Pierre-Louis Bossart --- v2 -> v3 - no change - add Reviewed-by include/sound/soc.h | 1 + sound/soc/soc-core.c | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index 320dcd4..daa0e10 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1328,6 +1328,7 @@ struct snd_soc_dai_link *snd_soc_find_dai_link(struct snd_soc_card *card, int snd_soc_register_dai(struct snd_soc_component *component, struct snd_soc_dai_driver *dai_drv); +void snd_soc_unregister_dai(struct snd_soc_dai *dai); struct snd_soc_dai *snd_soc_find_dai( const struct snd_soc_dai_link_component *dlc); diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index c803447..38199cd 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2532,6 +2532,12 @@ static inline char *fmt_multiple_name(struct device *dev, return devm_kstrdup(dev, dai_drv->name, GFP_KERNEL); } +static void soc_del_dai(struct snd_soc_dai *dai) +{ + dev_dbg(dai->dev, "ASoC: Unregistered DAI '%s'\n", dai->name); + list_del(&dai->list); +} + /* Create a DAI and add it to the component's DAI list */ static struct snd_soc_dai *soc_add_dai(struct snd_soc_component *component, struct snd_soc_dai_driver *dai_drv, @@ -2581,6 +2587,12 @@ static struct snd_soc_dai *soc_add_dai(struct snd_soc_component *component, return dai; } +void snd_soc_unregister_dai(struct snd_soc_dai *dai) +{ + soc_del_dai(dai); +} +EXPORT_SYMBOL_GPL(snd_soc_unregister_dai); + /** * snd_soc_register_dai - Register a DAI dynamically & create its widgets * @@ -2633,11 +2645,8 @@ static void snd_soc_unregister_dais(struct snd_soc_component *component) { struct snd_soc_dai *dai, *_dai; - for_each_component_dais_safe(component, dai, _dai) { - dev_dbg(component->dev, "ASoC: Unregistered DAI '%s'\n", - dai->name); - list_del(&dai->list); - } + for_each_component_dais_safe(component, dai, _dai) + snd_soc_unregister_dai(dai); } /** From patchwork Tue Nov 5 06:47:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 11226997 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 249EB1390 for ; Tue, 5 Nov 2019 06:56:49 +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 AAA33217F4 for ; Tue, 5 Nov 2019 06:56:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="LMYuWICG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AAA33217F4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.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 D83951734; Tue, 5 Nov 2019 07:55:56 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D83951734 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1572937006; bh=m5eOvbT2/tVd+6IaFGOudhNFmEdGYwt8tARluLnAMw4=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=LMYuWICGGfl09WapvmiUBdltGFZmeUij+aFrEe0L8mVOgrUYdp2VShYDgZstXUo2J v/oDgiB35WpiYiviMYjtWzkw0fA69bxlM8X89cW0BdirVOFgEIrTHsfilTGjpzDwCo IiT2vyp/UfO/zU69kpKk9oW/X8/mmIUihQsxuOF4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3735FF80726; Tue, 5 Nov 2019 07:47:18 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id A48D5F8071D; Tue, 5 Nov 2019 07:47:15 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS, SURBL_BLOCKED,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id B8ED1F8015B for ; Tue, 5 Nov 2019 07:47:09 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B8ED1F8015B Date: 05 Nov 2019 15:47:09 +0900 X-IronPort-AV: E=Sophos;i="5.68,270,1569250800"; d="scan'208";a="30645006" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 05 Nov 2019 15:47:09 +0900 Received: from morimoto-PC.renesas.com (unknown [10.166.18.140]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 4633E41946C9; Tue, 5 Nov 2019 15:47:09 +0900 (JST) Message-ID: <87tv7i251u.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.5 Mule/6.0 To: Mark Brown In-Reply-To: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> References: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Linux-ALSA , Pierre-Louis Bossart , Ranjani Sridharan Subject: [alsa-devel] [PATCH v3 15/19] ASoC: soc-core: have legacy_dai_naming at snd_soc_register_dai() 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" From: Kuninori Morimoto ALSA SoC has 2 functions. snd_soc_register_dai() is used from topology snd_soc_register_dais() is used from snd_soc_add_component() In general, people think like _dai() is called from _dais() with for loop. But in reality, these are very similar but different implementation. We shouldn't have duplicated and confusing implementation. snd_soc_register_dai() is now used from topology. But to reduce duplicated code, it should be used from _dais(), too. To prepare it, this patch adds missing parameter legacy_dai_naming to snd_soc_register_dai(). Signed-off-by: Kuninori Morimoto Reviewed-by: Pierre-Louis Bossart --- v2 -> v3 - no change - add Reviewed-by include/sound/soc.h | 3 ++- sound/soc/soc-core.c | 5 +++-- sound/soc/soc-topology.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index daa0e10..766fa81 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1327,7 +1327,8 @@ struct snd_soc_dai_link *snd_soc_find_dai_link(struct snd_soc_card *card, const char *stream_name); int snd_soc_register_dai(struct snd_soc_component *component, - struct snd_soc_dai_driver *dai_drv); + struct snd_soc_dai_driver *dai_drv, + bool legacy_dai_naming); void snd_soc_unregister_dai(struct snd_soc_dai *dai); struct snd_soc_dai *snd_soc_find_dai( diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 38199cd..6f4933f 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2604,7 +2604,8 @@ EXPORT_SYMBOL_GPL(snd_soc_unregister_dai); * will be freed in the component cleanup. */ int snd_soc_register_dai(struct snd_soc_component *component, - struct snd_soc_dai_driver *dai_drv) + struct snd_soc_dai_driver *dai_drv, + bool legacy_dai_naming) { struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); @@ -2618,7 +2619,7 @@ int snd_soc_register_dai(struct snd_soc_component *component, } lockdep_assert_held(&client_mutex); - dai = soc_add_dai(component, dai_drv, false); + dai = soc_add_dai(component, dai_drv, legacy_dai_naming); if (!dai) return -ENOMEM; diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index 0fd0329..b6e1456 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -1842,7 +1842,7 @@ static int soc_tplg_dai_create(struct soc_tplg *tplg, list_add(&dai_drv->dobj.list, &tplg->comp->dobj_list); /* register the DAI to the component */ - return snd_soc_register_dai(tplg->comp, dai_drv); + return snd_soc_register_dai(tplg->comp, dai_drv, false); } static void set_link_flags(struct snd_soc_dai_link *link, From patchwork Tue Nov 5 06:47:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 11226999 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 944B216B1 for ; Tue, 5 Nov 2019 06:57:27 +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 22DE0217F4 for ; Tue, 5 Nov 2019 06:57:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="KXJ9Wtip" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 22DE0217F4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.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 5260A171F; Tue, 5 Nov 2019 07:56:35 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5260A171F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1572937045; bh=PAnz7UPQHoFyZ0q+8JMcVaRXyaAuDLPyd1eCloaLUho=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=KXJ9WtipaG79Lcmhj/XrEE+VlY9ax0QVWyH1V19xw91PeC1toDG2K3dZ6QqeyOfaq pnNmdWnptXGkIhs6Sh2yhNDMfStYqPk3Tz0O2t/kSmVLMUOvQ4NgMSGbVOzB+REOXU A5HrdFF6mQRA3VZPZjUk4JFtWjVk8T/NM2FctriI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B3B3CF80724; Tue, 5 Nov 2019 07:47:22 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 66562F80736; Tue, 5 Nov 2019 07:47:21 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS, SURBL_BLOCKED,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa1.perex.cz (Postfix) with ESMTP id 259DBF80724 for ; Tue, 5 Nov 2019 07:47:15 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 259DBF80724 Date: 05 Nov 2019 15:47:14 +0900 X-IronPort-AV: E=Sophos;i="5.68,270,1569250800"; d="scan'208";a="30858272" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 05 Nov 2019 15:47:14 +0900 Received: from morimoto-PC.renesas.com (unknown [10.166.18.140]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 82C4D41946CB; Tue, 5 Nov 2019 15:47:14 +0900 (JST) Message-ID: <87sgn2251p.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.5 Mule/6.0 To: Mark Brown In-Reply-To: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> References: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Linux-ALSA , Pierre-Louis Bossart , Ranjani Sridharan Subject: [alsa-devel] [PATCH v3 16/19] ASoC: soc-core: don't call snd_soc_dapm_new_dai_widgets() at snd_soc_register_dai() 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" From: Kuninori Morimoto ALSA SoC has 2 functions. snd_soc_register_dai() is used from topology snd_soc_register_dais() is used from snd_soc_add_component() In general, people think like _dai() is called from _dais() with for loop. But in reality, these are very similar but different implementation. We shouldn't have duplicated and confusing implementation. snd_soc_register_dai() is now used from topology. But to reduce duplicated code, it should be used from _dais(), too. Because of topology side specific reason, it is calling snd_soc_dapm_new_dai_widgets(), but it is not needed _dais() side. This patch factorizes snd_soc_register_dai() to topology / _dais() common part, and topology specific part. And do topology specific part at soc-topology. Signed-off-by: Kuninori Morimoto Reviewed-by: Pierre-Louis Bossart --- v2 -> v3 - add Reviewed-by - directly return soc_add_dai() include/sound/soc.h | 6 +++--- sound/soc/soc-core.c | 29 +++++------------------------ sound/soc/soc-topology.c | 17 ++++++++++++++++- 3 files changed, 24 insertions(+), 28 deletions(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index 766fa81..4e38ee6 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1326,9 +1326,9 @@ struct snd_soc_dai_link *snd_soc_find_dai_link(struct snd_soc_card *card, int id, const char *name, const char *stream_name); -int snd_soc_register_dai(struct snd_soc_component *component, - struct snd_soc_dai_driver *dai_drv, - bool legacy_dai_naming); +struct snd_soc_dai *snd_soc_register_dai(struct snd_soc_component *component, + struct snd_soc_dai_driver *dai_drv, + bool legacy_dai_naming); void snd_soc_unregister_dai(struct snd_soc_dai *dai); struct snd_soc_dai *snd_soc_find_dai( diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 6f4933f..55b13c0 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2603,37 +2603,18 @@ EXPORT_SYMBOL_GPL(snd_soc_unregister_dai); * These DAIs's widgets will be freed in the card cleanup and the DAIs * will be freed in the component cleanup. */ -int snd_soc_register_dai(struct snd_soc_component *component, - struct snd_soc_dai_driver *dai_drv, - bool legacy_dai_naming) +struct snd_soc_dai *snd_soc_register_dai(struct snd_soc_component *component, + struct snd_soc_dai_driver *dai_drv, + bool legacy_dai_naming) { - struct snd_soc_dapm_context *dapm = - snd_soc_component_get_dapm(component); - struct snd_soc_dai *dai; - int ret; - if (dai_drv->dobj.type != SND_SOC_DOBJ_PCM) { dev_err(component->dev, "Invalid dai type %d\n", dai_drv->dobj.type); - return -EINVAL; + return NULL; } lockdep_assert_held(&client_mutex); - dai = soc_add_dai(component, dai_drv, legacy_dai_naming); - if (!dai) - return -ENOMEM; - - /* - * Create the DAI widgets here. After adding DAIs, topology may - * also add routes that need these widgets as source or sink. - */ - ret = snd_soc_dapm_new_dai_widgets(dapm, dai); - if (ret != 0) { - dev_err(component->dev, - "Failed to create DAI widgets %d\n", ret); - } - - return ret; + return soc_add_dai(component, dai_drv, legacy_dai_naming); } EXPORT_SYMBOL_GPL(snd_soc_register_dai); diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index b6e1456..81d2af0 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -1800,6 +1800,9 @@ static int soc_tplg_dai_create(struct soc_tplg *tplg, struct snd_soc_dai_driver *dai_drv; struct snd_soc_pcm_stream *stream; struct snd_soc_tplg_stream_caps *caps; + struct snd_soc_dai *dai; + struct snd_soc_dapm_context *dapm = + snd_soc_component_get_dapm(tplg->comp); int ret; dai_drv = kzalloc(sizeof(struct snd_soc_dai_driver), GFP_KERNEL); @@ -1842,7 +1845,19 @@ static int soc_tplg_dai_create(struct soc_tplg *tplg, list_add(&dai_drv->dobj.list, &tplg->comp->dobj_list); /* register the DAI to the component */ - return snd_soc_register_dai(tplg->comp, dai_drv, false); + dai = snd_soc_register_dai(tplg->comp, dai_drv, false); + if (!dai) + return -ENOMEM; + + /* Create the DAI widgets here */ + ret = snd_soc_dapm_new_dai_widgets(dapm, dai); + if (ret != 0) { + dev_err(dai->dev, "Failed to create DAI widgets %d\n", ret); + snd_soc_unregister_dai(dai); + return ret; + } + + return ret; } static void set_link_flags(struct snd_soc_dai_link *link, From patchwork Tue Nov 5 06:47:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 11227001 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 193E81390 for ; Tue, 5 Nov 2019 06:58:18 +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 9FE99217F4 for ; Tue, 5 Nov 2019 06:58:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="lIF1a6CN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9FE99217F4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.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 CB0F2173D; Tue, 5 Nov 2019 07:57:25 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz CB0F2173D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1572937095; bh=Jh++QKGB+50E9C2odEvL/elvFMym63iq35kt5bll9+Q=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=lIF1a6CNcHR+M4VbW2pPfFYffaDT5b9geEazx8FRyacRQS71dAEp4pyAh/cki7kaM 4ac9RbUErToOiF6HD3HHAByxJ6FIYT4yAamN0GMAxevE+kro8REoO+nalHFXhI6zO5 igMlnnEa5D+tWtxc+SOEANkbx5EfFm8Vw95m8SCc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B1085F8075A; Tue, 5 Nov 2019 07:47:26 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6A77AF8075B; Tue, 5 Nov 2019 07:47:25 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS, SURBL_BLOCKED,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id 437B3F80730 for ; Tue, 5 Nov 2019 07:47:20 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 437B3F80730 Date: 05 Nov 2019 15:47:18 +0900 X-IronPort-AV: E=Sophos;i="5.68,270,1569250800"; d="scan'208";a="30645017" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 05 Nov 2019 15:47:18 +0900 Received: from morimoto-PC.renesas.com (unknown [10.166.18.140]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id E1A8B4009409; Tue, 5 Nov 2019 15:47:18 +0900 (JST) Message-ID: <87r22m251l.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.5 Mule/6.0 To: Mark Brown In-Reply-To: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> References: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Linux-ALSA , Pierre-Louis Bossart , Ranjani Sridharan Subject: [alsa-devel] [PATCH v3 17/19] ASoC: soc-core: call snd_soc_register_dai() from snd_soc_register_dais() 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" From: Kuninori Morimoto ALSA SoC has 2 functions. snd_soc_register_dai() is used from topology snd_soc_register_dais() is used from snd_soc_add_component() In general, people think like _dai() is called from _dais() with for loop. But in reality, these are very similar but different implementation. We shouldn't have duplicated and confusing implementation. This patch calls snd_soc_register_dai() from snd_soc_register_dais() Signed-off-by: Kuninori Morimoto Reviewed-by: Pierre-Louis Bossart --- v2 -> v3 - no change - add Reviewed-by sound/soc/soc-core.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 55b13c0..86c45f7 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2607,12 +2607,16 @@ struct snd_soc_dai *snd_soc_register_dai(struct snd_soc_component *component, struct snd_soc_dai_driver *dai_drv, bool legacy_dai_naming) { - if (dai_drv->dobj.type != SND_SOC_DOBJ_PCM) { - dev_err(component->dev, "Invalid dai type %d\n", - dai_drv->dobj.type); + struct device *dev = component->dev; + + if (dai_drv->dobj.type && + dai_drv->dobj.type != SND_SOC_DOBJ_PCM) { + dev_err(dev, "Invalid dai type %d\n", dai_drv->dobj.type); return NULL; } + dev_dbg(dev, "ASoC: dai register %s\n", dai_drv->name); + lockdep_assert_held(&client_mutex); return soc_add_dai(component, dai_drv, legacy_dai_naming); } @@ -2642,16 +2646,12 @@ static int snd_soc_register_dais(struct snd_soc_component *component, struct snd_soc_dai_driver *dai_drv, size_t count) { - struct device *dev = component->dev; struct snd_soc_dai *dai; unsigned int i; int ret; - dev_dbg(dev, "ASoC: dai register %s #%zu\n", dev_name(dev), count); - for (i = 0; i < count; i++) { - - dai = soc_add_dai(component, dai_drv + i, count == 1 && + dai = snd_soc_register_dai(component, dai_drv + i, count == 1 && !component->driver->non_legacy_dai_naming); if (dai == NULL) { ret = -ENOMEM; From patchwork Tue Nov 5 06:47:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 11227003 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BA4E21390 for ; Tue, 5 Nov 2019 06:58:53 +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 4BE17217F4 for ; Tue, 5 Nov 2019 06:58:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="IjtRsl2I" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4BE17217F4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.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 5D2AC173E; Tue, 5 Nov 2019 07:58:01 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5D2AC173E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1572937131; bh=imwtuJRr6A0pwhbaS9GQxzT2oU1GDyb+lKpnr/l5RVU=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=IjtRsl2I3t707Ac9AsXcAaajOxXlRGUQBOs5nU0LHdA3P+clgyFxYaTYf/G2Jvl4x vYCzBfROpVsBNIlgVy64mmwd9OKJ85EHLcD7+eQq5NKAsArrsCauCsQNb1MT04r9Nk 56dwU5nlCKaDe0tVGR/Kqq9g3ULp7E6oG8VxyEvA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D764FF80760; Tue, 5 Nov 2019 07:47:29 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 277F2F80764; Tue, 5 Nov 2019 07:47:28 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS, SURBL_BLOCKED,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa1.perex.cz (Postfix) with ESMTP id 615E4F80750 for ; Tue, 5 Nov 2019 07:47:23 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 615E4F80750 Date: 05 Nov 2019 15:47:22 +0900 X-IronPort-AV: E=Sophos;i="5.68,270,1569250800"; d="scan'208";a="30858280" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 05 Nov 2019 15:47:22 +0900 Received: from morimoto-PC.renesas.com (unknown [10.166.18.140]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id E1B53400940C; Tue, 5 Nov 2019 15:47:22 +0900 (JST) Message-ID: <87pni6251h.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.5 Mule/6.0 To: Mark Brown In-Reply-To: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> References: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Linux-ALSA , Pierre-Louis Bossart , Ranjani Sridharan Subject: [alsa-devel] [PATCH v3 18/19] ASoC: soc-core: remove topology specific operation 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" From: Kuninori Morimoto soc-core has some API which is used from topology, but it is doing topology specific operation at soc-core. soc-core should care about core things, and topology should care about topology things, otherwise, it is very confusable. For example topology type is not related to soc-core, it is topology side issue. This patch removes meaningless check from soc-core. This patch keeps extra initialization/destruction at snd_soc_add_dai_link() / snd_soc_remove_dai_link() which were for topology. From this patch, non-topology card can use it. Signed-off-by: Kuninori Morimoto Reviewed-by: Pierre-Louis Bossart --- v2 -> v3 - no change - add Reviewed-by sound/soc/soc-core.c | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 86c45f7..cc59687 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1436,19 +1436,12 @@ int snd_soc_add_dai_link(struct snd_soc_card *card, { int ret; - if (dai_link->dobj.type - && dai_link->dobj.type != SND_SOC_DOBJ_DAI_LINK) { - dev_err(card->dev, "Invalid dai link type %d\n", - dai_link->dobj.type); - return -EINVAL; - } - lockdep_assert_held(&client_mutex); + /* * Notify the machine driver for extra initialization - * on the link created by topology. */ - if (dai_link->dobj.type && card->add_dai_link) + if (card->add_dai_link) card->add_dai_link(card, dai_link); ret = soc_bind_dai_link(card, dai_link); @@ -1475,19 +1468,12 @@ EXPORT_SYMBOL_GPL(snd_soc_add_dai_link); void snd_soc_remove_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link) { - if (dai_link->dobj.type - && dai_link->dobj.type != SND_SOC_DOBJ_DAI_LINK) { - dev_err(card->dev, "Invalid dai link type %d\n", - dai_link->dobj.type); - return; - } - lockdep_assert_held(&client_mutex); + /* * Notify the machine driver for extra destruction - * on the link created by topology. */ - if (dai_link->dobj.type && card->remove_dai_link) + if (card->remove_dai_link) card->remove_dai_link(card, dai_link); list_del(&dai_link->list); @@ -2609,12 +2595,6 @@ struct snd_soc_dai *snd_soc_register_dai(struct snd_soc_component *component, { struct device *dev = component->dev; - if (dai_drv->dobj.type && - dai_drv->dobj.type != SND_SOC_DOBJ_PCM) { - dev_err(dev, "Invalid dai type %d\n", dai_drv->dobj.type); - return NULL; - } - dev_dbg(dev, "ASoC: dai register %s\n", dai_drv->name); lockdep_assert_held(&client_mutex); From patchwork Tue Nov 5 06:47:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 11227005 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1DC2916B1 for ; Tue, 5 Nov 2019 06:59: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 976F1217F4 for ; Tue, 5 Nov 2019 06:59: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="UmtHgRMd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 976F1217F4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.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 BEEB31740; Tue, 5 Nov 2019 07:58:38 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BEEB31740 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1572937168; bh=7OE1CXQfu/9owiyLHxFA/G1LFx4Jjb+Vo9cndaFjDuI=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=UmtHgRMdS1vknkQM8BpWblaMSTHPFiPo+X7523tTDLrn3Umd7wbtMtYz9oz5Ni9H7 6OqJfj6Wguj161aYVBVM4u8GjFTnafKNG1mAbxVtpftCGQo4uvzBOjKFFeMEaIBk4C QrS1+m4pD28dVIliZZHtQB89XUlPNYNa7Sp3XMvU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D2B22F80769; Tue, 5 Nov 2019 07:47:35 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id C17C0F80764; Tue, 5 Nov 2019 07:47:29 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id 34965F80750 for ; Tue, 5 Nov 2019 07:47:26 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 34965F80750 Date: 05 Nov 2019 15:47:26 +0900 X-IronPort-AV: E=Sophos;i="5.68,270,1569250800"; d="scan'208";a="30645027" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 05 Nov 2019 15:47:26 +0900 Received: from morimoto-PC.renesas.com (unknown [10.166.18.140]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id B51CF41946CB; Tue, 5 Nov 2019 15:47:26 +0900 (JST) Message-ID: <87o8xq251d.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.5 Mule/6.0 To: Mark Brown In-Reply-To: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> References: <87ftj23jph.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Linux-ALSA , Pierre-Louis Bossart , Ranjani Sridharan Subject: [alsa-devel] [PATCH v3 19/19] ASoC: soc.h: dobj is used only when SND_SOC_TOPOLOGY 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" From: Kuninori Morimoto snd_soc_dobj is used only when SND_SOC_TOPOLOGY was selected. Let's enable it under SND_SOC_TOPOLOGY. Signed-off-by: Kuninori Morimoto Reviewed-by: Pierre-Louis Bossart --- v2 -> v3 - no change - add Reviewed-by include/sound/soc.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index 4e38ee6..e0855dc 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -847,7 +847,9 @@ struct snd_soc_dai_link { unsigned int ignore:1; struct list_head list; /* DAI link list of the soc card */ +#ifdef CONFIG_SND_SOC_TOPOLOGY struct snd_soc_dobj dobj; /* For topology */ +#endif }; #define for_each_link_codecs(link, i, codec) \ for ((i) = 0; \ @@ -1169,7 +1171,9 @@ struct soc_mixer_control { unsigned int sign_bit; unsigned int invert:1; unsigned int autodisable:1; +#ifdef CONFIG_SND_SOC_TOPOLOGY struct snd_soc_dobj dobj; +#endif }; struct soc_bytes { @@ -1180,8 +1184,9 @@ struct soc_bytes { struct soc_bytes_ext { int max; +#ifdef CONFIG_SND_SOC_TOPOLOGY struct snd_soc_dobj dobj; - +#endif /* used for TLV byte control */ int (*get)(struct snd_kcontrol *kcontrol, unsigned int __user *bytes, unsigned int size); @@ -1205,7 +1210,9 @@ struct soc_enum { const char * const *texts; const unsigned int *values; unsigned int autodisable:1; +#ifdef CONFIG_SND_SOC_TOPOLOGY struct snd_soc_dobj dobj; +#endif }; /* device driver data */