linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] Input: qt1050 - handle CHIP_ID reading error
@ 2024-06-25 19:30 Andrei Lalaev
  0 siblings, 0 replies; 5+ messages in thread
From: Andrei Lalaev @ 2024-06-25 19:30 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: andrey.lalaev, linux-input, linux-kernel, robh, m.felsch

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 319 bytes --]

> But how did we get into the situation with the chip being missing?

In my case, this chip is a part of an external board.
So, for example, I see this message in the case of a bad cable connection.

Also, I prefer to see messages with error codes instead of random values from a stack :)

Best regards,
Andrei Lalaev

^ permalink raw reply	[flat|nested] 5+ messages in thread
* [PATCH] Input: qt1050 - handle CHIP_ID reading error
@ 2024-06-17 18:30 Andrei Lalaev
  2024-06-25  8:32 ` Marco Felsch
  2024-06-25 16:14 ` Dmitry Torokhov
  0 siblings, 2 replies; 5+ messages in thread
From: Andrei Lalaev @ 2024-06-17 18:30 UTC (permalink / raw)
  To: dmitry.torokhov, robh, m.felsch
  Cc: andrey.lalaev, linux-input, linux-kernel, Andrei Lalaev

From: Andrei Lalaev <andrei.lalaev@anton-paar.com>

If the device is missing, we get the following error:

  qt1050 3-0041: ID -1340767592 not supported

Let's handle this situation and print more informative error
when reading of CHIP_ID fails:

  qt1050 3-0041: Failed to read chip ID: -6

Fixes: cbebf5addec1 ("Input: qt1050 - add Microchip AT42QT1050 support")
Signed-off-by: Andrei Lalaev <andrei.lalaev@anton-paar.com>
---
 drivers/input/keyboard/qt1050.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/input/keyboard/qt1050.c b/drivers/input/keyboard/qt1050.c
index b51dfcd76038..056e9bc26026 100644
--- a/drivers/input/keyboard/qt1050.c
+++ b/drivers/input/keyboard/qt1050.c
@@ -226,7 +226,12 @@ static bool qt1050_identify(struct qt1050_priv *ts)
 	int err;
 
 	/* Read Chip ID */
-	regmap_read(ts->regmap, QT1050_CHIP_ID, &val);
+	err = regmap_read(ts->regmap, QT1050_CHIP_ID, &val);
+	if (err) {
+		dev_err(&ts->client->dev, "Failed to read chip ID: %d\n", err);
+		return false;
+	}
+
 	if (val != QT1050_CHIP_ID_VER) {
 		dev_err(&ts->client->dev, "ID %d not supported\n", val);
 		return false;
-- 
2.35.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-06-25 19:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-25 19:30 [PATCH] Input: qt1050 - handle CHIP_ID reading error Andrei Lalaev
  -- strict thread matches above, loose matches on Subject: below --
2024-06-17 18:30 Andrei Lalaev
2024-06-25  8:32 ` Marco Felsch
2024-06-25 16:14 ` Dmitry Torokhov
2024-06-25 19:35   ` Andrei Lalaev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).