Skip to contentSkip to conversation

drxk: fix CNR calculus

PATCH New Mauro Carvalho Chehab 1 participant 3 messages Mar 22, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 drxk: fix CNR calculus

Changeset 8f3741e accidentally broke the CNR estimation. It should be calculated as "a + b - c". However, previously, the subtraction by c only occurred if SNR would be positive, due to a bad binding to DVBv3 API.

This also fixes the following warning:
drivers/media/dvb-frontends/drxk_hard.c:2556:6: warning: variable 'c' set but not used [-Wunused-but-set-variable]

---
 drivers/media/dvb-frontends/drxk_hard.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/dvb-frontends/drxk_hard.c +1 -1
index fc93bd3..55a4c22 100644
@@ -2628,7 +2628,7 @@ static int GetDVBTSignalToNoise(struct drxk_state *state,
 		/* log(x) x = (16bits + 16bits) << 15 ->32 bits  */
 		c = Log10Times100(SqrErrIQ);
 
-		iMER = a + b;
+		iMER = a + b - c;
 	}
 	*pSignalToNoise = iMER;
 
Signature · 1 line
1.8.1.4
#1 lore raw

PATCH 2/3 siano: remove the ir protocol field

This field is unused. Remove it.

---
 drivers/media/common/siano/smsir.h | 1 -
 1 file changed, 1 deletion(-)
drivers/media/common/siano/smsir.h +0 -1
index 69b59b9..fc8b792 100644
@@ -40,7 +40,6 @@ struct ir_t {
 	char phys[32];
 
 	char *rc_codes;
-	u64 protocol;
 
 	u32 timeout;
 	u32 controller;
Signature · 1 line
1.8.1.4
#2 lore raw

PATCH 3/3 m5602_ov7660: return error at ov7660_init()

In reply to Mauro Carvalho Chehab

It used to be a code that returns arror at ov7660_init. However, this was removed by changeset c84e412f:

@@ -231,33 +116,40 @@ int ov7660_init(struct sd *sd)

        if (dump_sensor)
                ov7660_dump_registers(sd);

- err = ov7660_set_gain(&sd->gspca_dev, sensor_settings[GAIN_IDX]);
- if (err < 0)
- return err;
+ return 0;
+}

- err = ov7660_set_auto_white_balance(&sd->gspca_dev,
- sensor_settings[AUTO_WHITE_BALANCE_IDX]);
- if (err < 0)
- return err;

As complained by gcc:

	drivers/media/usb/gspca/m5602/m5602_ov7660.c: In function 'ov7660_init':
	drivers/media/usb/gspca/m5602/m5602_ov7660.c:99:9: warning: variable 'err' set but not used [-Wunused-but-set-variable]

It should be noticed that the original error code was crappy, as it wasn't returning any error if sensor init fails.

Fix it by returning an error if the sensor can't be initialized.

---
 drivers/media/usb/gspca/m5602/m5602_ov7660.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/usb/gspca/m5602/m5602_ov7660.c +3 -1
index 4ac7889..64b3b03 100644
@@ -96,7 +96,7 @@ sensor_found:
 
 int ov7660_init(struct sd *sd)
 {
-	int i, err = 0;
+	int i, err;
 
 	/* Init the sensor */
 	for (i = 0; i < ARRAY_SIZE(init_ov7660); i++) {
@@ -111,6 +111,8 @@ int ov7660_init(struct sd *sd)
 			err = m5602_write_sensor(sd,
 				init_ov7660[i][1], data, 1);
 		}
+		if (err < 0)
+			return err;
 	}
 
 	if (dump_sensor)
Signature · 1 line
1.8.1.4