From patchwork Mon Apr 13 12:27:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charles Keepax X-Patchwork-Id: 6208491 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0CB04BF4A6 for ; Mon, 13 Apr 2015 12:37:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2AC8D2034B for ; Mon, 13 Apr 2015 12:37:55 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id CD6DA2037A for ; Mon, 13 Apr 2015 12:37:53 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 01FF126641A; Mon, 13 Apr 2015 14:37:52 +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,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 83C79265192; Mon, 13 Apr 2015 14:34:18 +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 C474D26508D; Mon, 13 Apr 2015 14:34:13 +0200 (CEST) Received: from opensource.wolfsonmicro.com (opensource.wolfsonmicro.com [80.75.67.52]) by alsa0.perex.cz (Postfix) with ESMTP id 90312265104 for ; Mon, 13 Apr 2015 14:34:07 +0200 (CEST) Received: from localhost.localdomain (unknown [87.246.78.26]) by opensource.wolfsonmicro.com (Postfix) with ESMTPSA id 1EA713B4107; Mon, 13 Apr 2015 13:34:06 +0100 (BST) From: Charles Keepax To: broonie@kernel.org Date: Mon, 13 Apr 2015 13:27:58 +0100 Message-Id: <1428928085-20250-7-git-send-email-ckeepax@opensource.wolfsonmicro.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1428928085-20250-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> References: <1428928085-20250-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> Cc: alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com, lgirdwood@gmail.com Subject: [alsa-devel] [PATCH 06/13] ASoC: wm_adsp: Clean up low level control read/write functions 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 Physically reading and writing controls to/from the DSP are handled by two low level functions (wm_coeff_{write|read}_control, these currently take in a snd_kcontrol pointer but immediately pull out a wm_coeff_ctl pointer from the private data. These functions don't handle the kcontrols at all they just shuttle data to and from the chip and all the call sites have a wm_coeff_ctl pointer available. This patch just passes the wm_coeff_ctl pointer straight into these functions. Signed-off-by: Charles Keepax --- sound/soc/codecs/wm_adsp.c | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-) diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index 6c4f013..37e01b0 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c @@ -372,10 +372,9 @@ static int wm_coeff_info(struct snd_kcontrol *kcontrol, return 0; } -static int wm_coeff_write_control(struct snd_kcontrol *kcontrol, +static int wm_coeff_write_control(struct wm_coeff_ctl *ctl, const void *buf, size_t len) { - struct wm_coeff_ctl *ctl = (struct wm_coeff_ctl *)kcontrol->private_value; struct wm_adsp_alg_region *alg_region = &ctl->alg_region; const struct wm_adsp_region *mem; struct wm_adsp *dsp = ctl->dsp; @@ -424,13 +423,12 @@ static int wm_coeff_put(struct snd_kcontrol *kcontrol, if (!ctl->enabled) return 0; - return wm_coeff_write_control(kcontrol, p, ctl->len); + return wm_coeff_write_control(ctl, p, ctl->len); } -static int wm_coeff_read_control(struct snd_kcontrol *kcontrol, +static int wm_coeff_read_control(struct wm_coeff_ctl *ctl, void *buf, size_t len) { - struct wm_coeff_ctl *ctl = (struct wm_coeff_ctl *)kcontrol->private_value; struct wm_adsp_alg_region *alg_region = &ctl->alg_region; const struct wm_adsp_region *mem; struct wm_adsp *dsp = ctl->dsp; @@ -739,7 +737,7 @@ static int wm_coeff_init_control_caches(struct wm_adsp *dsp) list_for_each_entry(ctl, &dsp->ctl_list, list) { if (!ctl->enabled || ctl->set) continue; - ret = wm_coeff_read_control(ctl->kcontrol, + ret = wm_coeff_read_control(ctl, ctl->cache, ctl->len); if (ret < 0) @@ -758,7 +756,7 @@ static int wm_coeff_sync_controls(struct wm_adsp *dsp) if (!ctl->enabled) continue; if (ctl->set) { - ret = wm_coeff_write_control(ctl->kcontrol, + ret = wm_coeff_write_control(ctl, ctl->cache, ctl->len); if (ret < 0)