All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adi Nata <adinata.softwareengineer@gmail.com>
To: lorenzo@kernel.org, jic23@kernel.org, dlechner@baylibre.com,
	nuno.sa@analog.com, andy@kernel.org, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: linux-kernel-mentees@lists.linux.dev,
	Adi Nata <adinata.softwareengineer@gmail.com>
Subject: [PATCH 3/5] iio: humidity: hts221: Allow unknown whoami for DT fallback
Date: Sat,  8 Aug 2026 17:00:24 +0800	[thread overview]
Message-ID: <20260808090026.34187-4-adinata.softwareengineer@gmail.com> (raw)
In-Reply-To: <20260808090026.34187-1-adinata.softwareengineer@gmail.com>

The WHOAMI check currently returns -ENODEV when the chip ID is not
0xbc. That rejects Device Tree fallback compatibles.

Keep failing if the WHOAMI register cannot be read. On an unexpected
ID, log it and continue so OF fallback matching can work.

Use dev_err_probe() for the read-failure path.

Signed-off-by: Adi Nata <adinata.softwareengineer@gmail.com>
---
 drivers/iio/humidity/hts221_core.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
index 76a391f421f5..da773d2edc80 100644
--- a/drivers/iio/humidity/hts221_core.c
+++ b/drivers/iio/humidity/hts221_core.c
@@ -139,16 +139,13 @@ static int hts221_check_whoami(struct hts221_hw *hw)
 	int err, data;
 
 	err = regmap_read(hw->regmap, HTS221_REG_WHOAMI_ADDR, &data);
-	if (err < 0) {
-		dev_err(hw->dev, "failed to read whoami register\n");
-		return err;
-	}
+	if (err < 0)
+		return dev_err_probe(hw->dev, err,
+				     "failed to read whoami register\n");
 
-	if (data != HTS221_REG_WHOAMI_VAL) {
-		dev_err(hw->dev, "wrong whoami {%02x vs %02x}\n",
-			data, HTS221_REG_WHOAMI_VAL);
-		return -ENODEV;
-	}
+	if (data != HTS221_REG_WHOAMI_VAL)
+		dev_info(hw->dev,
+			 "unexpected whoami 0x%02x, continuing\n", data);
 
 	return 0;
 }
-- 
2.47.3


  parent reply	other threads:[~2026-08-08  9:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-08  9:00 [PATCH 0/5] iio: humidity: hts221: update probe and logging implementations Adi Nata
2026-08-08  9:00 ` [PATCH 1/5] iio: humidity: hts221: report available values via read_avail() Adi Nata
2026-08-10  0:09   ` Jonathan Cameron
2026-08-08  9:00 ` [PATCH 2/5] iio: humidity: hts221: Add a blank line after variable declarations Adi Nata
2026-08-10  8:40   ` Andy Shevchenko
2026-08-08  9:00 ` Adi Nata [this message]
2026-08-10  8:43   ` [PATCH 3/5] iio: humidity: hts221: Allow unknown whoami for DT fallback Andy Shevchenko
2026-08-08  9:00 ` [PATCH 4/5] iio: humidity: hts221: use dev_err_probe() in probe paths Adi Nata
2026-08-10  8:45   ` Andy Shevchenko
2026-08-08  9:00 ` [PATCH 5/5] iio: humidity: hts221: fix division by zero in calibration parsing Adi Nata

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=20260808090026.34187-4-adinata.softwareengineer@gmail.com \
    --to=adinata.softwareengineer@gmail.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel-mentees@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=nuno.sa@analog.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 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.