From patchwork Mon Jul 21 02:10:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 4592671 X-Patchwork-Delegate: tiwai@suse.de Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (unknown [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 67C2B9F375 for ; Mon, 21 Jul 2014 02:12:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A590F2012D for ; Mon, 21 Jul 2014 02:12:27 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 6B47F2011D for ; Mon, 21 Jul 2014 02:12:26 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 87FD32656CB; Mon, 21 Jul 2014 04:12:25 +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 4528E265167; Mon, 21 Jul 2014 04:10:38 +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 6287F26514A; Mon, 21 Jul 2014 04:10:31 +0200 (CEST) Received: from smtp303.phy.lolipop.jp (smtp303.phy.lolipop.jp [210.157.22.87]) by alsa0.perex.cz (Postfix) with ESMTP id F10742650FF for ; Mon, 21 Jul 2014 04:10:18 +0200 (CEST) Received: from smtp303.phy.lolipop.lan (HELO smtp303.phy.lolipop.jp) (172.17.1.87) (smtp-auth username m12129643-o-takashi, mechanism plain) by smtp303.phy.lolipop.jp (qpsmtpd/0.82) with ESMTPA; Mon, 21 Jul 2014 11:10:18 +0900 Received: from 127.0.0.1 (127.0.0.1) by smtp303.phy.lolipop.jp (LOLIPOP-Fsecure); Mon, 21 Jul 2014 11:10:07 +0900 (JST) X-Virus-Status: clean(LOLIPOP-Fsecure) From: Takashi Sakamoto To: clemens@ladisch.de, tiwai@suse.de, perex@perex.cz Date: Mon, 21 Jul 2014 11:10:04 +0900 Message-Id: <1405908605-8105-6-git-send-email-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1405908605-8105-1-git-send-email-o-takashi@sakamocchi.jp> References: <1405831835-26499-1-git-send-email-weiyj_lk@163.com> <1405908605-8105-1-git-send-email-o-takashi@sakamocchi.jp> Cc: alsa-devel@alsa-project.org, darrena092@gmail.com, ffado-devel@lists.sf.net Subject: [alsa-devel] [PATCH 5/6] bebob: Correction for return value of .put callback 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 This commit is for correction of my misunderstanding for return value of .put callback of ALSA Control interface. According to 'Writing ALSA Driver' (*1), return value of the callback has three patterns; 1: changed, 0: not changed, an negative value: fatal error. But I misunderstood that it's boolean; zero or nonzero. *1: Writing an ALSA Driver (2005, Takashi Iwai) http://www.alsa-project.org/main/index.php/ALSA_Driver_Documentation Signed-off-by: Takashi Sakamoto --- sound/firewire/bebob/bebob_maudio.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sound/firewire/bebob/bebob_maudio.c b/sound/firewire/bebob/bebob_maudio.c index f2277ce..acfe94a 100644 --- a/sound/firewire/bebob/bebob_maudio.c +++ b/sound/firewire/bebob/bebob_maudio.c @@ -396,8 +396,10 @@ static int special_clk_ctl_set(struct snd_kcontrol *kctl, if (err < 0) dev_err(&bebob->unit->device, "fail to change clock source: %d\n", err); + else + err = 1; - return err >= 0; + return err; } static struct snd_kcontrol_new special_clk_ctl = { .name = "Clock Source", @@ -519,13 +521,17 @@ static int special_dig_in_iface_ctl_set(struct snd_kcontrol *kctl, } /* For ADAT, optical interface is only available. */ - if (params->dig_in_fmt > 0) + if (params->dig_in_fmt > 0) { + err = 1; goto end; + } err = avc_audio_set_selector(bebob->unit, 0x00, 0x04, dig_in_iface); if (err < 0) dev_err(&bebob->unit->device, "fail to set digital input interface: %d\n", err); + else + err = 1; end: mutex_unlock(&bebob->mutex); return err; @@ -592,6 +598,8 @@ static int special_dig_out_iface_ctl_set(struct snd_kcontrol *kctl, if (err < 0) dev_err(&bebob->unit->device, "fail to change digital output interface: %d\n", err); + else + err = 1; return err; }