diff mbox

[RFC,08/12] tvaudio: fix compiler warnings

Message ID 1de3891a303b5b33eb46e23310c1a2ee9b219111.1314281302.git.hans.verkuil@cisco.com (mailing list archive)
State RFC
Headers show

Commit Message

Hans Verkuil Aug. 25, 2011, 2:08 p.m. UTC
From: Hans Verkuil <hans.verkuil@cisco.com>

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 <hans.verkuil@cisco.com>
---
 drivers/media/video/tvaudio.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
diff mbox

Patch

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;
 	}