From patchwork Fri Jun 29 12:32:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 140552 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp785318ljj; Fri, 29 Jun 2018 05:32:18 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeghTzrDksmOfBWWk46K2AaGPt/0MMh2lYVWELOTK2Wywraa5kLV8PJgLSUbMrzvkDXLuMb X-Received: by 2002:a1c:c44c:: with SMTP id u73-v6mr1561059wmf.99.1530275538130; Fri, 29 Jun 2018 05:32:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530275538; cv=none; d=google.com; s=arc-20160816; b=P1yimS81Jv8E5Mu1bpcjj7tIUVXsa/xuuyEJPqZScTzDJsmUX/HG+dSBaTcTTzrg69 q0Prs1llQ7EfHvSlUTbpFKwKD9JEXRxAXE3JcunMKdbaBMHe3diCvXeRPT/1NqYorhvs vrbMVVVrpLp9H81+8KkVDVo/4GsqTyBihqnS3n9EM+VAlQLnla9cHHI8L11kXCpyuODn qv+nipK0hSkbiKapslz04KfIwH+g6SiurTl+XNykndb2NWO8vyQQNGbn2CoDPkyjHjqh +rg84XvT7o5YJzovWW7uLz0bSLnninf3ALW+MYLiEPDXUZOOrNMxFODQf/Mspe/OYi7y xx7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:date:message-id:in-reply-to:to:from :dkim-signature:delivered-to:arc-authentication-results; bh=sz7dpEhT9cZINYHcdTWr1+Tv6xc7D95rHTRSM/QDa4A=; b=IAS7Nwr4nxJjvYgpYtI82lrQ8BJMdvUXlw1bdQDTD2g8r8lQ6hOWdhQweTGX+IoyW+ strKL1g95FPQN3O0ttZThMXFX/9ehQCoqzot5lVUwTReFNTF4jEwidzr+Jnt7MX4COSR 9wycj00y7B9Op7W5//hcjUnH12WHVgHP+aGOxfJ8L/twiI2+Zfpvo3P+8ueRNlJAf0uf MVgWfDAsFtFkA00O2nTw6g/VPDxnroh5rooTU+OfykwpGfD7yrUFAR63R5wAJalM5/gq VZXAKnBAboJ8T5A6fSR6JJtC6PyQnwK0gchq66Pj802etE1XBPrRPv/XtPYiAiRtr8eY 80DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=qfmi9Aoy; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id t12-v6si8430054wrq.254.2018.06.29.05.32.17; Fri, 29 Jun 2018 05:32:18 -0700 (PDT) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=qfmi9Aoy; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 5E544267A38; Fri, 29 Jun 2018 14:32:16 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id CC247267A43; Fri, 29 Jun 2018 14:32:13 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=disabled version=3.4.0 Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by alsa0.perex.cz (Postfix) with ESMTP id 54C91267705 for ; Fri, 29 Jun 2018 14:32:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=Fiajz/FMCs32Xq2jdJyl/HiDt6l6bAHYcVD7ny4EZX8=; b=qfmi9Aoy3ul6 7HfX4VDYxEbwf6mBj8RdwGh7ryoywHKlf41I/z80FuTfeTht7yBEp6ukNtHukMgej5h9P7XSdQNfW SUcbc84dzO5L1VcIZWeIErd5UY9HLiLwmN8ztFFtY/ctpXsqf5OJELmuklkldVAssH0CefTnr7/ya 1555c=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1fYsZM-0007or-Mx; Fri, 29 Jun 2018 12:32:08 +0000 Received: from broonie by debutante with local (Exim 4.91) (envelope-from ) id 1fYsZM-0005e4-9G; Fri, 29 Jun 2018 13:32:08 +0100 From: Mark Brown To: KaiChieh Chuang In-Reply-To: Message-Id: Date: Fri, 29 Jun 2018 13:32:08 +0100 Cc: alsa-devel@alsa-project.org, Mark Brown Subject: [alsa-devel] Applied "ASoC: mediatek: sub dai use list_head" to the asoc tree X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org The patch ASoC: mediatek: sub dai use list_head has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From f11c5db770ab675d270cb4d5a2bb90923066ef49 Mon Sep 17 00:00:00 2001 From: KaiChieh Chuang Date: Fri, 29 Jun 2018 20:29:44 +0800 Subject: [PATCH] ASoC: mediatek: sub dai use list_head use list_head for sub_dais, since original sub_dais array is sparsely occupied Signed-off-by: KaiChieh Chuang Signed-off-by: Mark Brown --- .../mediatek/common/mtk-afe-platform-driver.c | 64 +++++++------------ sound/soc/mediatek/common/mtk-base-afe.h | 6 +- 2 files changed, 28 insertions(+), 42 deletions(-) -- 2.18.0.rc2 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/mediatek/common/mtk-afe-platform-driver.c b/sound/soc/mediatek/common/mtk-afe-platform-driver.c index 51ec4ff6ed95..697aa50aff9a 100644 --- a/sound/soc/mediatek/common/mtk-afe-platform-driver.c +++ b/sound/soc/mediatek/common/mtk-afe-platform-driver.c @@ -15,20 +15,12 @@ int mtk_afe_combine_sub_dai(struct mtk_base_afe *afe) { - struct snd_soc_dai_driver *sub_dai_drivers; + struct mtk_base_afe_dai *dai; size_t num_dai_drivers = 0, dai_idx = 0; - int i; - - if (!afe->sub_dais) { - dev_err(afe->dev, "%s(), sub_dais == NULL\n", __func__); - return -EINVAL; - } /* calcualte total dai driver size */ - for (i = 0; i < afe->num_sub_dais; i++) { - if (afe->sub_dais[i].dai_drivers && - afe->sub_dais[i].num_dai_drivers != 0) - num_dai_drivers += afe->sub_dais[i].num_dai_drivers; + list_for_each_entry(dai, &afe->sub_dais, list) { + num_dai_drivers += dai->num_dai_drivers; } dev_info(afe->dev, "%s(), num of dai %zd\n", __func__, num_dai_drivers); @@ -42,19 +34,14 @@ int mtk_afe_combine_sub_dai(struct mtk_base_afe *afe) if (!afe->dai_drivers) return -ENOMEM; - for (i = 0; i < afe->num_sub_dais; i++) { - if (afe->sub_dais[i].dai_drivers && - afe->sub_dais[i].num_dai_drivers != 0) { - sub_dai_drivers = afe->sub_dais[i].dai_drivers; - /* dai driver */ - memcpy(&afe->dai_drivers[dai_idx], - sub_dai_drivers, - afe->sub_dais[i].num_dai_drivers * - sizeof(struct snd_soc_dai_driver)); - dai_idx += afe->sub_dais[i].num_dai_drivers; - } + list_for_each_entry(dai, &afe->sub_dais, list) { + /* dai driver */ + memcpy(&afe->dai_drivers[dai_idx], + dai->dai_drivers, + dai->num_dai_drivers * + sizeof(struct snd_soc_dai_driver)); + dai_idx += dai->num_dai_drivers; } - return 0; } EXPORT_SYMBOL_GPL(mtk_afe_combine_sub_dai); @@ -62,28 +49,25 @@ EXPORT_SYMBOL_GPL(mtk_afe_combine_sub_dai); int mtk_afe_add_sub_dai_control(struct snd_soc_component *component) { struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); - int i; + struct mtk_base_afe_dai *dai; - if (!afe->sub_dais) { - dev_err(afe->dev, "%s(), sub_dais == NULL\n", __func__); - return -EINVAL; - } - - for (i = 0; i < afe->num_sub_dais; i++) { - if (afe->sub_dais[i].controls) + list_for_each_entry(dai, &afe->sub_dais, list) { + if (dai->controls) snd_soc_add_component_controls(component, - afe->sub_dais[i].controls, - afe->sub_dais[i].num_controls); + dai->controls, + dai->num_controls); - if (afe->sub_dais[i].dapm_widgets) + if (dai->dapm_widgets) snd_soc_dapm_new_controls(&component->dapm, - afe->sub_dais[i].dapm_widgets, - afe->sub_dais[i].num_dapm_widgets); - - if (afe->sub_dais[i].dapm_routes) + dai->dapm_widgets, + dai->num_dapm_widgets); + } + /* add routes after all widgets are added */ + list_for_each_entry(dai, &afe->sub_dais, list) { + if (dai->dapm_routes) snd_soc_dapm_add_routes(&component->dapm, - afe->sub_dais[i].dapm_routes, - afe->sub_dais[i].num_dapm_routes); + dai->dapm_routes, + dai->num_dapm_routes); } snd_soc_dapm_new_widgets(component->dapm.card); diff --git a/sound/soc/mediatek/common/mtk-base-afe.h b/sound/soc/mediatek/common/mtk-base-afe.h index bcf562f029b6..bd8d5e0c6843 100644 --- a/sound/soc/mediatek/common/mtk-base-afe.h +++ b/sound/soc/mediatek/common/mtk-base-afe.h @@ -46,6 +46,7 @@ struct mtk_base_irq_data { }; struct device; +struct list_head; struct mtk_base_afe_memif; struct mtk_base_afe_irq; struct mtk_base_afe_dai; @@ -72,8 +73,7 @@ struct mtk_base_afe { struct mtk_base_afe_irq *irqs; int irqs_size; - struct mtk_base_afe_dai *sub_dais; - int num_sub_dais; + struct list_head sub_dais; struct snd_soc_dai_driver *dai_drivers; unsigned int num_dai_drivers; @@ -110,6 +110,8 @@ struct mtk_base_afe_dai { unsigned int num_dapm_widgets; const struct snd_soc_dapm_route *dapm_routes; unsigned int num_dapm_routes; + + struct list_head list; }; #endif