All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brad Love <brad@nextdimension.cc>
To: linux-media@vger.kernel.org, sean@mess.org
Cc: Brad Love <brad@nextdimension.cc>
Subject: [PATCH 3/4] em28xx-core: Fix i2c error debug
Date: Mon, 25 Jan 2021 19:54:15 -0600	[thread overview]
Message-ID: <20210126015416.5622-4-brad@nextdimension.cc> (raw)
In-Reply-To: <20210126015416.5622-1-brad@nextdimension.cc>

Read errors are currently reported as write errors.

An incorrectly received read operation is never reported at all.
Add a debug statement indicating the request mismatch.

Signed-off-by: Brad Love <brad@nextdimension.cc>
---
Since v1:
- Was not in v1

 drivers/media/usb/em28xx/em28xx-i2c.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c b/drivers/media/usb/em28xx/em28xx-i2c.c
index 592b98b3643a..255395959255 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 written\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;
 }
-- 
2.28.0


  parent reply	other threads:[~2021-01-26 22:56 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-12 18:39 [PATCH 0/3] MaxLinear mxl692 demod-tuner / Hauppauge usb QuadHD Brad Love
2020-06-12 18:39 ` [PATCH 1/3] mxl692: MaxLinear 692 ATSC demod-tuner driver Brad Love
2020-06-12 21:49   ` kernel test robot
2020-06-12 21:49     ` kernel test robot
2020-06-13  8:49   ` kernel test robot
2020-06-13  8:49     ` kernel test robot
2020-06-13 21:07   ` kernel test robot
2020-06-13 21:07     ` kernel test robot
2020-06-13 21:07   ` [PATCH] mxl692: fix platform_no_drv_owner.cocci warnings kernel test robot
2020-06-13 21:07     ` kernel test robot
2020-06-24  9:59   ` [PATCH 1/3] mxl692: MaxLinear 692 ATSC demod-tuner driver Sean Young
2020-06-26 17:41     ` Bradford Love
2020-06-29 17:33       ` Sean Young
2020-06-12 18:39 ` [PATCH 2/3] em28xx-core: Fix TS2 active led Brad Love
2020-06-12 18:39 ` [PATCH 3/3] em28xx: Add support for Hauppauge USB QuadHD Brad Love
2021-01-26  1:54 ` [PATCH 0/4] MaxLinear mxl692 demod-tuner / Hauppauge usb QuadHD Brad Love
2021-01-26  1:54   ` [PATCH 1/4] mxl692: MaxLinear 692 ATSC demod/tuner driver Brad Love
2021-01-26  1:54   ` [PATCH 2/4] em28xx-core: Fix TS2 active led Brad Love
2021-01-26  1:54   ` Brad Love [this message]
2021-01-26  1:54   ` [PATCH 4/4] em28xx: Add support for Hauppauge USB QuadHD Brad Love

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=20210126015416.5622-4-brad@nextdimension.cc \
    --to=brad@nextdimension.cc \
    --cc=linux-media@vger.kernel.org \
    --cc=sean@mess.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.