public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthias Schwarzott <zzam@gentoo.org>
To: linux-media@vger.kernel.org, m.chehab@samsung.com
Subject: [PATCH] cx231xx: fix i2c debug prints
Date: Wed, 27 Nov 2013 17:15:01 +0100	[thread overview]
Message-ID: <52961A85.4080009@gentoo.org> (raw)

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.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
---
  drivers/media/usb/cx231xx/cx231xx-i2c.c | 16 ++++++++++++----
  1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c 
b/drivers/media/usb/cx231xx/cx231xx-i2c.c
index 96a5a09..a0d2235 100644
--- a/drivers/media/usb/cx231xx/cx231xx-i2c.c
+++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c
@@ -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 {


                 reply	other threads:[~2013-11-27 16:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52961A85.4080009@gentoo.org \
    --to=zzam@gentoo.org \
    --cc=linux-media@vger.kernel.org \
    --cc=m.chehab@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox