From patchwork Mon Apr 27 20:13:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 6282321 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7141C9F1C2 for ; Mon, 27 Apr 2015 20:14:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A55BE2021A for ; Mon, 27 Apr 2015 20:14:44 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 4D6BD202FE for ; Mon, 27 Apr 2015 20:14:43 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 6E1572612D2; Mon, 27 Apr 2015 22:14:42 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id C751426532C; Mon, 27 Apr 2015 22:14:19 +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 0DFD12654E8; Mon, 27 Apr 2015 22:14:18 +0200 (CEST) Received: from smtp-out-223.synserver.de (smtp-out-223.synserver.de [212.40.185.223]) by alsa0.perex.cz (Postfix) with ESMTP id 497F02612D2 for ; Mon, 27 Apr 2015 22:13:42 +0200 (CEST) Received: (qmail 17275 invoked by uid 0); 27 Apr 2015 20:13:39 -0000 X-SynServer-TrustedSrc: 1 X-SynServer-AuthUser: lars@metafoo.de X-SynServer-PPID: 17021 Received: from ppp-188-174-97-41.dynamic.mnet-online.de (HELO lars-adi-laptop.fritz.box) [188.174.97.41] by 217.119.54.87 with SMTP; 27 Apr 2015 20:13:39 -0000 From: Lars-Peter Clausen To: Mark Brown , Liam Girdwood Date: Mon, 27 Apr 2015 22:13:22 +0200 Message-Id: <1430165606-3072-1-git-send-email-lars@metafoo.de> X-Mailer: git-send-email 1.8.0 Cc: Oder Chiou , Brian Austin , Lars-Peter Clausen , Support Opensource , patches@opensource.wolfsonmicro.com, alsa-devel@alsa-project.org, Paul Handrigan , Peter Ujfalusi , Bard Liao , Charles Keepax Subject: [alsa-devel] [PATCH 1/4] ASoC: Add helper function getting CODEC's DAPM context 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 X-Virus-Scanned: ClamAV using ClamSMTP The DAPM context in the snd_soc_codec struct is redundant and scheduled to be replaced by the DAPM context in the snd_soc_component struct. This patch introduces a new helper function snd_soc_codec_get_dapm() which should be used for getting the DAPM context for a CODEC rather then directly accessing the dapm field. Once there are no more direct users of the dapm field left it is possible to transparently switch all drivers to the component DAPM context by updating snd_soc_codec_get_dapm() function. Signed-off-by: Lars-Peter Clausen --- include/sound/soc.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index f6226914..d57dc7c 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -819,7 +819,7 @@ struct snd_soc_codec { /* component */ struct snd_soc_component component; - /* dapm */ + /* Don't access this directly, use snd_soc_codec_get_dapm() */ struct snd_soc_dapm_context dapm; #ifdef CONFIG_DEBUG_FS @@ -1282,6 +1282,18 @@ static inline struct snd_soc_dapm_context *snd_soc_component_get_dapm( } /** + * snd_soc_codec_get_dapm() - Returns the DAPM context for the CODEC + * @codec: The CODEC for which to get the DAPM context + * + * Note: Use this function instead of directly accessing the CODEC's dapm field + */ +static inline struct snd_soc_dapm_context *snd_soc_codec_get_dapm( + struct snd_soc_codec *codec) +{ + return &codec->dapm; +} + +/** * snd_soc_dapm_kcontrol_codec() - Returns the codec associated to a kcontrol * @kcontrol: The kcontrol *