From patchwork Tue Jun 2 22:24:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Zhang X-Patchwork-Id: 6532531 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 AEAC3C0020 for ; Wed, 3 Jun 2015 06:44:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D74DF206BA for ; Wed, 3 Jun 2015 06:44:55 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id A293C206B6 for ; Wed, 3 Jun 2015 06:44:54 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 90F052659B6; Wed, 3 Jun 2015 08:44: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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 319C0264F33; Wed, 3 Jun 2015 08:43:59 +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 DD9012657F3; Wed, 3 Jun 2015 00:24:32 +0200 (CEST) Received: from mail-ig0-f179.google.com (mail-ig0-f179.google.com [209.85.213.179]) by alsa0.perex.cz (Postfix) with ESMTP id 200B6265795 for ; Wed, 3 Jun 2015 00:24:22 +0200 (CEST) Received: by igbhj9 with SMTP id hj9so97985303igb.1 for ; Tue, 02 Jun 2015 15:24:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=yKfNf9iyo0VWct0lzEgjprDtU519ZL3R+ViJzafaPPo=; b=n70/+EWqy8MFMXuH+i/YkP4gazTOjt8iKdoTmglMqu0We7gGV01LlX1SW1j1MoNUk5 FL/C4lXY9FccaJvufcObWCbEJJB9VDCprS907L6bO1U9rhe/dcElYr0peXH3xCOK54pD Gnb92xVBj8kuXizZ/kUcHvuIF9fv46yw8rRjk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=yKfNf9iyo0VWct0lzEgjprDtU519ZL3R+ViJzafaPPo=; b=Rwi7i/T/oeQ+vYHhLRy/O5QxOXF+bPRRoUnICRmHWUdVslIxzmLuYsGPYJKdxScx9d A6S+isWJiaOMMUi3/x2CbdMEe74uwxcole20UNFNhSiUpcEJq6OKp5jM/S+4CftZZb0v Bb8kU7R9tyIbDwou15ZY71KACQAGm9ee3TRwpk+3HHPDSPFnjJWRmSKtunNg4pZItb+Z xL+dVWsXLnufS7UToAv0GBGHyB5z17FXFS2lXr5qwAvWApSyZchrO8tsGJTAchpQsWDP 0zi+OPX2iog34vY537GPlRCtM13yGkR8Z0dXp19GTMNkBfnq61gcush6j6SX/ps+8YaS SnXQ== X-Gm-Message-State: ALoCoQl0ec9EVpLIQcnF82OnOwecNhNv3+uHBTMpBVySCW3jn9UlVHdcRjEqzo92K88+OCS6eNii X-Received: by 10.50.4.66 with SMTP id i2mr23385388igi.40.1433283860681; Tue, 02 Jun 2015 15:24:20 -0700 (PDT) Received: from benzh.mtv.corp.google.com ([172.22.65.67]) by mx.google.com with ESMTPSA id lq3sm10890256igb.3.2015.06.02.15.24.19 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Jun 2015 15:24:19 -0700 (PDT) From: Ben Zhang To: Mark Brown Date: Tue, 2 Jun 2015 15:24:03 -0700 Message-Id: <1433283843-33856-1-git-send-email-benzh@chromium.org> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c X-Mailman-Approved-At: Wed, 03 Jun 2015 08:43:55 +0200 Cc: alsa-devel@alsa-project.org, Vinod Koul , linux-kernel@vger.kernel.org, Omair Mohammed Abdullah , Ben Zhang , Dylan Reid Subject: [alsa-devel] [PATCH] ASoC: core: Pass kcontrol pointer to bytes tlv callbacks 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 get/put callbacks need the kcontrol pointer to get context information like snd_soc_codec and drvdata. Signed-off-by: Ben Zhang Reviewed-by: Vinod Koul --- include/sound/soc.h | 6 ++++-- sound/soc/soc-ops.c | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index fcb312b..404265d 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1169,8 +1169,10 @@ struct soc_bytes { struct soc_bytes_ext { int max; /* used for TLV byte control */ - int (*get)(unsigned int __user *bytes, unsigned int size); - int (*put)(const unsigned int __user *bytes, unsigned int size); + int (*get)(struct snd_kcontrol *kcontrol, + unsigned int __user *bytes, unsigned int size); + int (*put)(struct snd_kcontrol *kcontrol, + const unsigned int __user *bytes, unsigned int size); }; /* multi register control */ diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c index 100d92b..7f53da9 100644 --- a/sound/soc/soc-ops.c +++ b/sound/soc/soc-ops.c @@ -751,11 +751,11 @@ int snd_soc_bytes_tlv_callback(struct snd_kcontrol *kcontrol, int op_flag, switch (op_flag) { case SNDRV_CTL_TLV_OP_READ: if (params->get) - ret = params->get(tlv, count); + ret = params->get(kcontrol, tlv, count); break; case SNDRV_CTL_TLV_OP_WRITE: if (params->put) - ret = params->put(tlv, count); + ret = params->put(kcontrol, tlv, count); break; } return ret;