From patchwork Thu Aug 25 14:08:31 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 1096522 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7PE8V8E016670 for ; Thu, 25 Aug 2011 14:09:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751653Ab1HYOIw (ORCPT ); Thu, 25 Aug 2011 10:08:52 -0400 Received: from smtp-vbr9.xs4all.nl ([194.109.24.29]:2172 "EHLO smtp-vbr9.xs4all.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752238Ab1HYOIt (ORCPT ); Thu, 25 Aug 2011 10:08:49 -0400 Received: from alastor.dyndns.org (215.80-203-102.nextgentel.com [80.203.102.215]) (authenticated bits=0) by smtp-vbr9.xs4all.nl (8.13.8/8.13.8) with ESMTP id p7PE8jeC048633 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Thu, 25 Aug 2011 16:08:45 +0200 (CEST) (envelope-from hverkuil@xs4all.nl) Received: from localhost.localdomain (tschai.lan [192.168.1.10]) (Authenticated sender: hans) by alastor.dyndns.org (Postfix) with ESMTPSA id 21C04168C00F0; Thu, 25 Aug 2011 16:08:38 +0200 (CEST) From: Hans Verkuil To: linux-media@vger.kernel.org Cc: Hans Verkuil Subject: [RFC PATCH 08/12] tvaudio: fix compiler warnings Date: Thu, 25 Aug 2011 16:08:31 +0200 Message-Id: <1de3891a303b5b33eb46e23310c1a2ee9b219111.1314281302.git.hans.verkuil@cisco.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1314281315-32366-1-git-send-email-hverkuil@xs4all.nl> References: <1314281315-32366-1-git-send-email-hverkuil@xs4all.nl> In-Reply-To: References: X-Virus-Scanned: by XS4ALL Virus Scanner Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 25 Aug 2011 14:09:22 +0000 (UTC) From: Hans Verkuil v4l-dvb-git/drivers/media/video/tvaudio.c: In function 'tvaudio_s_ctrl': v4l-dvb-git/drivers/media/video/tvaudio.c:1697:15: warning: variable 'balance' set but not used [-Wunused-but-set-variable] v4l-dvb-git/drivers/media/video/tvaudio.c:1697:7: warning: variable 'volume' set but not used [-Wunused-but-set-variable] This is indeed a bug: balance and volume must be used to set the left and right channel volume. Fixed. Signed-off-by: Hans Verkuil --- drivers/media/video/tvaudio.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c index c46a3bb..f22dbef 100644 --- a/drivers/media/video/tvaudio.c +++ b/drivers/media/video/tvaudio.c @@ -1695,14 +1695,17 @@ static int tvaudio_s_ctrl(struct v4l2_subdev *sd, case V4L2_CID_AUDIO_BALANCE: { int volume, balance; + if (!(desc->flags & CHIP_HAS_VOLUME)) break; - volume = max(chip->left,chip->right); + volume = max(chip->left, chip->right); balance = ctrl->value; + chip->left = (min(65536 - balance, 32768) * volume) / 32768; + chip->right = (min(balance, volume * (__u16)32768)) / 32768; - chip_write(chip,desc->leftreg,desc->volfunc(chip->left)); - chip_write(chip,desc->rightreg,desc->volfunc(chip->right)); + chip_write(chip, desc->leftreg, desc->volfunc(chip->left)); + chip_write(chip, desc->rightreg, desc->volfunc(chip->right)); return 0; }