aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorroel kluin <roel.kluin@gmail.com>2008-12-17 12:01:07 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-30 06:40:13 -0500
commit0f28b79346439ef5db130020aa07be9ca7c2ee84 (patch)
treecbaf49fd38979d8f5d812a7d64bc153fbe902a13 /drivers/media/video
parentd25cb6461ac93683ac04b2e181bcaa0cc15c349b (diff)
V4L/DVB (10064): mt9m111: mt9m111_get_global_gain() - unsigned >= 0 is always true
unsigned >= 0 is always true and fix formula Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Acked-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/mt9m111.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/media/video/mt9m111.c b/drivers/media/video/mt9m111.c
index 63c52c0b3e72..343be9252fe7 100644
--- a/drivers/media/video/mt9m111.c
+++ b/drivers/media/video/mt9m111.c
@@ -634,18 +634,15 @@ static int mt9m111_set_flip(struct soc_camera_device *icd, int flip, int mask)
634 634
635static int mt9m111_get_global_gain(struct soc_camera_device *icd) 635static int mt9m111_get_global_gain(struct soc_camera_device *icd)
636{ 636{
637 unsigned int data, gain; 637 int data;
638 638
639 data = reg_read(GLOBAL_GAIN); 639 data = reg_read(GLOBAL_GAIN);
640 if (data >= 0) 640 if (data >= 0)
641 gain = ((data & (1 << 10)) * 2) 641 return (data & 0x2f) * (1 << ((data >> 10) & 1)) *
642 | ((data & (1 << 9)) * 2) 642 (1 << ((data >> 9) & 1));
643 | (data & 0x2f); 643 return data;
644 else
645 gain = data;
646
647 return gain;
648} 644}
645
649static int mt9m111_set_global_gain(struct soc_camera_device *icd, int gain) 646static int mt9m111_set_global_gain(struct soc_camera_device *icd, int gain)
650{ 647{
651 u16 val; 648 u16 val;