From patchwork Mon Nov 25 00:43:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 11259421 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 C47CB930 for ; Mon, 25 Nov 2019 00:44:55 +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 59DAF207DD for ; Mon, 25 Nov 2019 00:44:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="CFcQxfbL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 59DAF207DD 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 87B2B187D; Mon, 25 Nov 2019 01:44:03 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 87B2B187D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1574642693; bh=OLnP38DDz/9RjD29L1W80bq6mXotKaoWyL+XZsee8qk=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=CFcQxfbL9aSv5m1pJ0I9MKYMcPMqasJbJZJQOT3Apld19Z4YkvrEDlbn7Wo7wn3se GurvbJA946Ux7LB+9lInG4Kww9cl/gzSL0VfrOQWhZX8vB9rWElIk5CNdSOxNAHWOA z+XUUvqMpBjHhwdgMPiYptquBvrbxf3olaLSWjBM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 5B6F6F801F5; Mon, 25 Nov 2019 01:43:30 +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 4AE9AF801F7; Mon, 25 Nov 2019 01:43: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, SURBL_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 F36C9F800EB for ; Mon, 25 Nov 2019 01:43:24 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz F36C9F800EB Date: 25 Nov 2019 09:43:21 +0900 X-IronPort-AV: E=Sophos;i="5.69,239,1571670000"; d="scan'208";a="32536581" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 25 Nov 2019 09:43:21 +0900 Received: from morimoto-PC.renesas.com (unknown [10.166.18.140]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id E547A40062A5; Mon, 25 Nov 2019 09:43:21 +0900 (JST) Message-ID: <875zj8g506.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: <877e3og50x.wl-kuninori.morimoto.gx@renesas.com> References: <877e3og50x.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Linux-ALSA Subject: [alsa-devel] [PATCH v2 01/15] ASoC: soc-core: remove dai_link_list 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 ASoC is using many lists. Now, used dai_link is listed to card as dai_link_list. [card]->[dai_link]->[dai_link]->... BTW, this "dai_link" is used to create "rtd". And this rtd is listed to card as rtd_list. [card]->[rtd]->[rtd]->... Here, each rtd has dai_link. This means, we can track all dai_link via rtd list. This patch removes card dai_link_list, and uses rtd_list instead of it. Signed-off-by: Kuninori Morimoto Reviewed-by: Ranjani Sridharan --- include/sound/soc.h | 7 ------- sound/soc/soc-core.c | 17 +++++++---------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index c28a1ed..b7ba3b9 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -852,7 +852,6 @@ struct snd_soc_dai_link { /* Do not create a PCM for this DAI link (Backend 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 @@ -1037,7 +1036,6 @@ struct snd_soc_card { /* CPU <--> Codec DAI links */ struct snd_soc_dai_link *dai_link; /* predefined links only */ int num_links; /* predefined links only */ - struct list_head dai_link_list; /* all links */ struct list_head rtd_list; int num_rtd; @@ -1107,11 +1105,6 @@ struct snd_soc_card { ((i) < (card)->num_aux_devs) && ((aux) = &(card)->aux_dev[i]); \ (i)++) -#define for_each_card_links(card, link) \ - list_for_each_entry(link, &(card)->dai_link_list, list) -#define for_each_card_links_safe(card, link, _link) \ - list_for_each_entry_safe(link, _link, &(card)->dai_link_list, list) - #define for_each_card_rtds(card, rtd) \ list_for_each_entry(rtd, &(card)->rtd_list, list) #define for_each_card_rtds_safe(card, rtd, _rtd) \ diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 062653a..435a365 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -934,11 +934,14 @@ struct snd_soc_dai_link *snd_soc_find_dai_link(struct snd_soc_card *card, int id, const char *name, const char *stream_name) { + struct snd_soc_pcm_runtime *rtd; struct snd_soc_dai_link *link; lockdep_assert_held(&client_mutex); - for_each_card_links(card, link) { + for_each_card_rtds(card, rtd) { + link = rtd->dai_link; + if (link->id != id) continue; @@ -1075,8 +1078,6 @@ void snd_soc_remove_dai_link(struct snd_soc_card *card, if (card->remove_dai_link) card->remove_dai_link(card, dai_link); - list_del(&dai_link->list); - rtd = snd_soc_get_pcm_runtime(card, dai_link->name); if (rtd) soc_free_pcm_runtime(rtd); @@ -1158,9 +1159,6 @@ int snd_soc_add_dai_link(struct snd_soc_card *card, } } - /* see for_each_card_links */ - list_add_tail(&dai_link->list, &card->dai_link_list); - return 0; _err_defer: @@ -1931,7 +1929,7 @@ static void __soc_setup_card_name(char *name, int len, static void soc_cleanup_card_resources(struct snd_soc_card *card, int card_probed) { - struct snd_soc_dai_link *link, *_link; + struct snd_soc_pcm_runtime *rtd, *n; if (card->snd_card) snd_card_disconnect_sync(card->snd_card); @@ -1942,8 +1940,8 @@ static void soc_cleanup_card_resources(struct snd_soc_card *card, soc_remove_link_dais(card); soc_remove_link_components(card); - for_each_card_links_safe(card, link, _link) - snd_soc_remove_dai_link(card, link); + for_each_card_rtds_safe(card, rtd, n) + snd_soc_remove_dai_link(card, rtd->dai_link); /* remove auxiliary devices */ soc_remove_aux_devices(card); @@ -2393,7 +2391,6 @@ int snd_soc_register_card(struct snd_soc_card *card) INIT_LIST_HEAD(&card->aux_comp_list); INIT_LIST_HEAD(&card->component_dev_list); INIT_LIST_HEAD(&card->list); - INIT_LIST_HEAD(&card->dai_link_list); INIT_LIST_HEAD(&card->rtd_list); INIT_LIST_HEAD(&card->dapm_dirty); INIT_LIST_HEAD(&card->dobj_list);