Skip to contentSkip to conversation

bttv: Move I2C IR initialization

PATCH In review Jean Delvare 2 participants 4 messages Feb 16, 2010 – Mar 6, 2010 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 bttv: Move I2C IR initialization

Move I2C IR initialization from just after I2C bus setup to right before non-I2C IR initialization. This avoids the case where an I2C IR device is blocking audio support (at least the PV951 suffers from this). It is also more logical to group IR support together, regardless of the connectivity.

This fixes bug #15184:
http://bugzilla.kernel.org/show_bug.cgi?id=15184

---
As this fixes a regression, I suggest pushing to Linus quickly. This is a candidate for 2.6.32-stable too.

 linux/drivers/media/video/bt8xx/bttv-driver.c |    1 +
 linux/drivers/media/video/bt8xx/bttv-i2c.c    |   10 +++++++---
 linux/drivers/media/video/bt8xx/bttvp.h       |    1 +
 3 files changed, 9 insertions(+), 3 deletions(-)
linux/drivers/media/video/bt8xx/bttv-i2c.c +7 -3
@@ -409,9 +409,14 @@ int __devinit init_bttv_i2c(struct bttv
 	}
 	if (0 == btv->i2c_rc && i2c_scan)
 		do_i2c_scan(btv->c.v4l2_dev.name, &btv->i2c_client);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
 
-	/* Instantiate the IR receiver device, if present */
+	return btv->i2c_rc;
+}
+
+/* Instantiate the I2C IR receiver device, if present */
+void __devinit init_bttv_i2c_ir(struct bttv *btv)
+{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
 	if (0 == btv->i2c_rc) {
 		struct i2c_board_info info;
 		/* The external IR receiver is at i2c address 0x34 (0x35 for
@@ -432,7 +437,6 @@ int __devinit init_bttv_i2c(struct bttv
 		i2c_new_probed_device(&btv->c.i2c_adap, &info, addr_list);
 	}
 #endif
-	return btv->i2c_rc;
 }
 
 int __devexit fini_bttv_i2c(struct bttv *btv)
linux/drivers/media/video/bt8xx/bttvp.h +1 -0
@@ -281,6 +281,7 @@ extern unsigned int bttv_debug;
 extern unsigned int bttv_gpio;
 extern void bttv_gpio_tracking(struct bttv *btv, char *comment);
 extern int init_bttv_i2c(struct bttv *btv);
+extern void init_bttv_i2c_ir(struct bttv *btv);
 extern int fini_bttv_i2c(struct bttv *btv);
 
 #define bttv_printk if (bttv_verbose) printk
linux/drivers/media/video/bt8xx/bttv-driver.c +1 -0
@@ -4498,6 +4498,7 @@ static int __devinit bttv_probe(struct p
 		request_modules(btv);
 	}
 
+	init_bttv_i2c_ir(btv);
 	bttv_input_init(btv);
 
 	/* everything is fine */
Signature · 1 line
Jean Delvare
#1 lore raw

Hi,

Quoted 5 lines · Jean Delvare

Move I2C IR initialization from just after I2C bus setup to right before non-I2C IR initialization. This avoids the case where an I2C IR device is blocking audio support (at least the PV951 suffers from this). It is also more logical to group IR support together, regardless of the connectivity.

Something could have gone wrong because this patch and the patch at http://linuxtv.org/hg/v4l-dvb/rev/659e08177aa3 has the

  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)

and

  #endif

pair at different places. The current result is the following compiler warning:

bttv-i2c.c: In function 'init_bttv_i2c':
bttv-i2c.c:440: warning: control reaches end of non-void function

Regard,

Márton Németh

Quoted 63 lines

This fixes bug #15184:
http://bugzilla.kernel.org/show_bug.cgi?id=15184

---
As this fixes a regression, I suggest pushing to Linus quickly. This is a candidate for 2.6.32-stable too.

 linux/drivers/media/video/bt8xx/bttv-driver.c |    1 +
 linux/drivers/media/video/bt8xx/bttv-i2c.c    |   10 +++++++---
 linux/drivers/media/video/bt8xx/bttvp.h       |    1 +
 3 files changed, 9 insertions(+), 3 deletions(-)
linux/drivers/media/video/bt8xx/bttv-i2c.c +7 -3
@@ -409,9 +409,14 @@ int __devinit init_bttv_i2c(struct bttv
 	}
 	if (0 == btv->i2c_rc && i2c_scan)
 		do_i2c_scan(btv->c.v4l2_dev.name, &btv->i2c_client);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
 
-	/* Instantiate the IR receiver device, if present */
+	return btv->i2c_rc;
+}
+
+/* Instantiate the I2C IR receiver device, if present */
+void __devinit init_bttv_i2c_ir(struct bttv *btv)
+{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
 	if (0 == btv->i2c_rc) {
 		struct i2c_board_info info;
 		/* The external IR receiver is at i2c address 0x34 (0x35 for
@@ -432,7 +437,6 @@ int __devinit init_bttv_i2c(struct bttv
 		i2c_new_probed_device(&btv->c.i2c_adap, &info, addr_list);
 	}
 #endif
-	return btv->i2c_rc;
 }
 
 int __devexit fini_bttv_i2c(struct bttv *btv)
linux/drivers/media/video/bt8xx/bttvp.h +1 -0
@@ -281,6 +281,7 @@ extern unsigned int bttv_debug;
 extern unsigned int bttv_gpio;
 extern void bttv_gpio_tracking(struct bttv *btv, char *comment);
 extern int init_bttv_i2c(struct bttv *btv);
+extern void init_bttv_i2c_ir(struct bttv *btv);
 extern int fini_bttv_i2c(struct bttv *btv);
 
 #define bttv_printk if (bttv_verbose) printk
linux/drivers/media/video/bt8xx/bttv-driver.c +1 -0
@@ -4498,6 +4498,7 @@ static int __devinit bttv_probe(struct p
 		request_modules(btv);
 	}
 
+	init_bttv_i2c_ir(btv);
 	bttv_input_init(btv);
 
 	/* everything is fine */
#2 lore raw

PATCH 1/1 bttv: fix compiler warning before kernel 2.6.30

From: Márton Németh <[email protected]>

Fix the following compiler warnings when compiling before Linux kernel version 2.6.30:
bttv-i2c.c: In function 'init_bttv_i2c':
bttv-i2c.c:440: warning: control reaches end of non-void function

---

linux/drivers/media/video/bt8xx/bttv-i2c.c +1 -1
diff -r 41c5482f2dac linux/drivers/media/video/bt8xx/bttv-i2c.c
@@ -409,7 +409,6 @@
 	}
 	if (0 == btv->i2c_rc && i2c_scan)
 		do_i2c_scan(btv->c.v4l2_dev.name, &btv->i2c_client);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
 
 	return btv->i2c_rc;
 }
@@ -417,6 +416,7 @@
 /* Instantiate the I2C IR receiver device, if present */
 void __devinit init_bttv_i2c_ir(struct bttv *btv)
 {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
 	if (0 == btv->i2c_rc) {
 		struct i2c_board_info info;
 		/* The external IR receiver is at i2c address 0x34 (0x35 for
author Acked-by on v1 1/1
#3 lore raw

Re: [PATCH] bttv: fix compiler warning before kernel 2.6.30

Quoted 8 lines · Németh Márton

From: Márton Németh <[email protected]>

Fix the following compiler warnings when compiling before Linux kernel version 2.6.30:
bttv-i2c.c: In function 'init_bttv_i2c':
bttv-i2c.c:440: warning: control reaches end of non-void function

Good catch.

Douglas, please apply quickly.

Quoted 21 lines

---
diff -r 41c5482f2dac linux/drivers/media/video/bt8xx/bttv-i2c.c

linux/drivers/media/video/bt8xx/bttv-i2c.c +1 -1
@@ -409,7 +409,6 @@
 	}
 	if (0 == btv->i2c_rc && i2c_scan)
 		do_i2c_scan(btv->c.v4l2_dev.name, &btv->i2c_client);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
 
 	return btv->i2c_rc;
 }
@@ -417,6 +416,7 @@
 /* Instantiate the I2C IR receiver device, if present */
 void __devinit init_bttv_i2c_ir(struct bttv *btv)
 {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
 	if (0 == btv->i2c_rc) {
 		struct i2c_board_info info;
 		/* The external IR receiver is at i2c address 0x34 (0x35 for
Signature · 1 line
Jean Delvare