From patchwork Mon Mar 12 17:58:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 131393 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp1042480ljb; Mon, 12 Mar 2018 10:59:07 -0700 (PDT) X-Google-Smtp-Source: AG47ELswYyK12pFDpzD2pBdAU/VVIY9Vel4PZgeh1h1YVZ4x80qeIbs4i6NNbelpvhwON8kSkkaI X-Received: by 10.28.112.8 with SMTP id l8mr6182262wmc.47.1520877547152; Mon, 12 Mar 2018 10:59:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520877547; cv=none; d=google.com; s=arc-20160816; b=uUdY371/Bm7HXnEaZpU5A7/zjar/W6nGeCpYqrGKmaXhi2rLykMfnsjyiWKHN9yx8Q Vy3WC14ybNcFdHJ7jsYTv7aQjMiRp/pLAuPQSJQ1J5FGkpVfMzmYSwxm9DPuAkkObN8U 66M2wdpjXC9tagdM0GTXSn/25e3b0wuFrqYQNr+MJGkp5XtqgvkmHyxtUCqbB+IIegBn UUYKOMcXfP8yQvE3JEkoUE/FKEz7Bz0kOsRbX93RgYpP4La0yzgMACb1DOqGF+j3O3n8 ZMBTJbUZKjvFQx2az9gE0AAjffkOZO/qB3s3Ad4v5Fd1LtAIXoSfsBs2+EtTKjRQIGEL GVAg== 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=8yEFvLXcPoopJx3hdbMLGHtksososafPQAjNeFn9FNU=; b=MXoKRiGjW0HYGycnzjzqRRm5NTY/N2sqWhcYyvUpn3G/QABlh9WuJnrNrMJTqIl7NS TCB/6fg12OcOcQr9kl27qEX5PN57EbZa2hRFp2KOCQqjXwf8kb4yhrHOmHsEcQQdNscf Wwv5OG+lV95qZinZnZejFUXYA5b7rbWPfiBXA28DD9R11qJTp7x/sOHj6kZ44UYNDAlA BVvmkiuAaHF0CTK4XhFRtUZ/6xXkFm6XaOv2ZUFFsvEhQcSoRrJxY04mfeUW8qVCu/rK V1ZffGBDrOGVO3SFIFN/mbSgV9WZSGEiSMaif2ke/Sb8DqkiIPz+UaxpFZ2vNCwbRfZl F+YQ== 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=r6NUGXia; 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 Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id b72si3497968wme.16.2018.03.12.10.59.06; Mon, 12 Mar 2018 10:59:07 -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=r6NUGXia; 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 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id D3448266E63; Mon, 12 Mar 2018 18:59:04 +0100 (CET) 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 3EC25266E78; Mon, 12 Mar 2018 18:59:02 +0100 (CET) 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, SPF_PASS, T_RP_MATCHES_RCVD 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 DD804266E43 for ; Mon, 12 Mar 2018 18:58:59 +0100 (CET) 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=P3mzNgnCnbBP4rOaB6gTfDVWIS/DvhPVUYjv7txfL6A=; b=r6NUGXia+xEa fRwUibDkhLpiYIhkcKAVqj9viL5fbgJgEUEKps3HQ7s8OlT+oR1oCoGgXK8AOJS3lVpw3HcAT8k08 vRTzyZ1+/7BdXpvuWy5viyq+jZoGYZcOY4Y9q1VQ8zc2zJuI61trSCugiod6cvITIYVXdKjmHCKLA QMyfk=; Received: from [65.153.83.185] (helo=finisterre.ee.mobilebroadband) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1evRis-00068x-4H; Mon, 12 Mar 2018 17:58:58 +0000 Received: by finisterre.ee.mobilebroadband (Postfix, from userid 1000) id 1D2B2440079; Mon, 12 Mar 2018 17:58:55 +0000 (GMT) From: Mark Brown To: Sylwester Nawrocki In-Reply-To: Message-Id: <20180312175855.1D2B2440079@finisterre.ee.mobilebroadband> Date: Mon, 12 Mar 2018 17:58:55 +0000 (GMT) Cc: alsa-devel@alsa-project.org, Mark Brown Subject: [alsa-devel] Applied "ASoC: Add snd_soc_of_put_dai_link_codecs() helper function" 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: Add snd_soc_of_put_dai_link_codecs() helper function 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 946857636d279486eaa47c930930185631f28fce Mon Sep 17 00:00:00 2001 From: Sylwester Nawrocki Date: Fri, 9 Mar 2018 18:48:54 +0100 Subject: [PATCH] ASoC: Add snd_soc_of_put_dai_link_codecs() helper function The code for dereferencing device nodes in the 'codecs' array is moved to a separate function so we can avoid open coding that in drivers. Signed-off-by: Sylwester Nawrocki Signed-off-by: Mark Brown --- include/sound/soc.h | 1 + sound/soc/soc-core.c | 32 +++++++++++++++++++++++--------- 2 files changed, 24 insertions(+), 9 deletions(-) -- 2.16.2 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/include/sound/soc.h b/include/sound/soc.h index 747fd583b9dc..4a387f0b3d56 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1807,6 +1807,7 @@ int snd_soc_of_get_dai_name(struct device_node *of_node, int snd_soc_of_get_dai_link_codecs(struct device *dev, struct device_node *of_node, struct snd_soc_dai_link *dai_link); +void snd_soc_of_put_dai_link_codecs(struct snd_soc_dai_link *dai_link); int snd_soc_add_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link); diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 96c44f6576c9..a1f86e85bff9 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -4397,6 +4397,26 @@ int snd_soc_of_get_dai_name(struct device_node *of_node, } EXPORT_SYMBOL_GPL(snd_soc_of_get_dai_name); +/* + * snd_soc_of_put_dai_link_codecs - Dereference device nodes in the codecs array + * @dai_link: DAI link + * + * Dereference device nodes acquired by snd_soc_of_get_dai_link_codecs(). + */ +void snd_soc_of_put_dai_link_codecs(struct snd_soc_dai_link *dai_link) +{ + struct snd_soc_dai_link_component *component = dai_link->codecs; + int index; + + for (index = 0; index < dai_link->num_codecs; index++, component++) { + if (!component->of_node) + break; + of_node_put(component->of_node); + component->of_node = NULL; + } +} +EXPORT_SYMBOL_GPL(snd_soc_of_put_dai_link_codecs); + /* * snd_soc_of_get_dai_link_codecs - Parse a list of CODECs in the devicetree * @dev: Card device @@ -4406,7 +4426,8 @@ EXPORT_SYMBOL_GPL(snd_soc_of_get_dai_name); * Builds an array of CODEC DAI components from the DAI link property * 'sound-dai'. * The array is set in the DAI link and the number of DAIs is set accordingly. - * The device nodes in the array (of_node) must be dereferenced by the caller. + * The device nodes in the array (of_node) must be dereferenced by calling + * snd_soc_of_put_dai_link_codecs() on @dai_link. * * Returns 0 for success */ @@ -4454,14 +4475,7 @@ int snd_soc_of_get_dai_link_codecs(struct device *dev, } return 0; err: - for (index = 0, component = dai_link->codecs; - index < dai_link->num_codecs; - index++, component++) { - if (!component->of_node) - break; - of_node_put(component->of_node); - component->of_node = NULL; - } + snd_soc_of_put_dai_link_codecs(dai_link); dai_link->codecs = NULL; dai_link->num_codecs = 0; return ret;