Skip to content

Instantly share code, notes, and snippets.

@b-rad-NDi
Last active June 24, 2020 18:05
Show Gist options
  • Save b-rad-NDi/f31ebfe033fed6ae1ba75d9710a861ec to your computer and use it in GitHub Desktop.
Save b-rad-NDi/f31ebfe033fed6ae1ba75d9710a861ec to your computer and use it in GitHub Desktop.
extra em28xx i2c debug where there's failure
diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c b/drivers/media/usb/em28xx/em28xx-i2c.c
index 592b98b3643a..555b7f55bb2c 100644
--- a/drivers/media/usb/em28xx/em28xx-i2c.c
+++ b/drivers/media/usb/em28xx/em28xx-i2c.c
@@ -294,6 +294,10 @@ static int em28xx_i2c_recv_bytes(struct em28xx *dev, u16 addr, u8 *buf, u16 len)
"reading from i2c device at 0x%x failed (error=%i)\n",
addr, ret);
return ret;
+ } else if (ret != len) {
+ dev_dbg(&dev->intf->dev,
+ "%i bytes read from i2c device at 0x%x requested, but %i bytes read\n",
+ ret, addr, len);
}
/*
* NOTE: some devices with two i2c buses have the bad habit to return 0
@@ -329,7 +333,7 @@ static int em28xx_i2c_recv_bytes(struct em28xx *dev, u16 addr, u8 *buf, u16 len)
}
dev_warn(&dev->intf->dev,
- "write to i2c device at 0x%x failed with unknown error (status=%i)\n",
+ "read from i2c device at 0x%x failed with unknown error (status=%i)\n",
addr, ret);
return -EIO;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment