Skip to contentSkip to conversation

cx231xx: Small cleanups

PATCH New Matthias Schwarzott 1 participant 3 messages Dec 12, 2013 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

cover cx231xx: Small cleanups

Hi,

I am resending these patches in the hope that git send-email does keep the whitespace correct unlike Thunderbird.

Regards
Matthias

#1 lore raw

PATCH 1/2 cx231xx: Add missing selects for MEDIA_SUBDRV_AUTOSELECT

The two drivers LGDT3305 and TDA18271C2DD were not autoselected, so the cx231xx_dvb module could not be loaded when MEDIA_SUBDRV_AUTOSELECT=y.

---
 drivers/media/usb/cx231xx/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
drivers/media/usb/cx231xx/Kconfig +2 -0
index 86feeea..f14c5e8 100644
@@ -45,6 +45,8 @@ config VIDEO_CX231XX_DVB
 	select MEDIA_TUNER_XC5000 if MEDIA_SUBDRV_AUTOSELECT
 	select MEDIA_TUNER_TDA18271 if MEDIA_SUBDRV_AUTOSELECT
 	select DVB_MB86A20S if MEDIA_SUBDRV_AUTOSELECT
+	select DVB_LGDT3305 if MEDIA_SUBDRV_AUTOSELECT
+	select DVB_TDA18271C2DD if MEDIA_SUBDRV_AUTOSELECT
 
 	---help---
 	  This adds support for DVB cards based on the
Signature · 1 line
1.8.4.4
#2 lore raw

PATCH 2/2 cx231xx: fix i2c debug prints

In reply to Matthias Schwarzott

Do not shift the already 7bit i2c address.
Print a message also for write+read transactions.
For write+read, print the read buffer correctly instead of using the write buffer.

---
 drivers/media/usb/cx231xx/cx231xx-i2c.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/media/usb/cx231xx/cx231xx-i2c.c +12 -4
index 96a5a09..a0d2235 100644
@@ -371,9 +371,9 @@ static int cx231xx_i2c_xfer(struct i2c_adapter *i2c_adap,
 	mutex_lock(&dev->i2c_lock);
 	for (i = 0; i < num; i++) {
 
-		addr = msgs[i].addr >> 1;
+		addr = msgs[i].addr;
 
-		dprintk2(2, "%s %s addr=%x len=%d:",
+		dprintk2(2, "%s %s addr=0x%x len=%d:",
 			 (msgs[i].flags & I2C_M_RD) ? "read" : "write",
 			 i == num - 1 ? "stop" : "nonstop", addr, msgs[i].len);
 		if (!msgs[i].len) {
@@ -395,13 +395,21 @@ static int cx231xx_i2c_xfer(struct i2c_adapter *i2c_adap,
 		} else if (i + 1 < num && (msgs[i + 1].flags & I2C_M_RD) &&
 			   msgs[i].addr == msgs[i + 1].addr
 			   && (msgs[i].len <= 2) && (bus->nr < 3)) {
+			/* write bytes */
+			if (i2c_debug >= 2) {
+				for (byte = 0; byte < msgs[i].len; byte++)
+					printk(" %02x", msgs[i].buf[byte]);
+			}
 			/* read bytes */
+			dprintk2(2, "plus %s %s addr=0x%x len=%d:",
+				(msgs[i+1].flags & I2C_M_RD) ? "read" : "write",
+				i+1 == num - 1 ? "stop" : "nonstop", addr, msgs[i+1].len);
 			rc = cx231xx_i2c_recv_bytes_with_saddr(i2c_adap,
 							       &msgs[i],
 							       &msgs[i + 1]);
 			if (i2c_debug >= 2) {
-				for (byte = 0; byte < msgs[i].len; byte++)
-					printk(" %02x", msgs[i].buf[byte]);
+				for (byte = 0; byte < msgs[i+1].len; byte++)
+					printk(" %02x", msgs[i+1].buf[byte]);
 			}
 			i++;
 		} else {
Signature · 1 line
1.8.4.4