summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/mt9m111.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2008-12-17 18:01:07 +0100
committerGuennadi Liakhovetski <g.liakhovetski@gmx.de>2008-12-17 18:01:07 +0100
commit33a9296bbce53f4adc778193439835dd44892f72 (patch)
treec0c0f466a0b6ac9562565db193f17fa521385ea3 /linux/drivers/media/video/mt9m111.c
parent508d4c2d232f61a3ffc92c05bee7a9afe7559081 (diff)
downloadmediapointer-dvb-s2-33a9296bbce53f4adc778193439835dd44892f72.tar.gz
mediapointer-dvb-s2-33a9296bbce53f4adc778193439835dd44892f72.tar.bz2
mt9m111: mt9m111_get_global_gain() - unsigned >= 0 is always true
From: roel kluin <roel.kluin@gmail.com> 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> --- drivers/media/video/mt9m111.c | 13 +++++-------- 1 files changed, 5 insertions(+), 8 deletions(-)
Diffstat (limited to 'linux/drivers/media/video/mt9m111.c')
-rw-r--r--linux/drivers/media/video/mt9m111.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/linux/drivers/media/video/mt9m111.c b/linux/drivers/media/video/mt9m111.c
index 1fde94514..336bb8d8b 100644
--- a/linux/drivers/media/video/mt9m111.c
+++ b/linux/drivers/media/video/mt9m111.c
@@ -634,18 +634,15 @@ static int mt9m111_set_flip(struct soc_camera_device *icd, int flip, int mask)
static int mt9m111_get_global_gain(struct soc_camera_device *icd)
{
- unsigned int data, gain;
+ int data;
data = reg_read(GLOBAL_GAIN);
if (data >= 0)
- gain = ((data & (1 << 10)) * 2)
- | ((data & (1 << 9)) * 2)
- | (data & 0x2f);
- else
- gain = data;
-
- return gain;
+ return (data & 0x2f) * (1 << ((data >> 10) & 1)) *
+ (1 << ((data >> 9) & 1));
+ return data;
}
+
static int mt9m111_set_global_gain(struct soc_camera_device *icd, int gain)
{
u16 val;