Re: [PATCH 3/5] iio: humidity: hts221: Allow unknown whoami for DT fallback

Andy Shevchenko <[email protected]>
Newsgroups dev.linux.lists.linux-kernel-mentees,org.kernel.vger.linux-iio,org.kernel.vger.linux-kernel
Organization Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo
Message-ID <[email protected]>
On Sat, Aug 08, 2026 at 05:00:24PM +0800, Adi Nata wrote:
> 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.

...

> static int hts221_check_whoami(struct hts221_hw *hw)

>  	int err, data;

With

	struct device *dev = hw->dev;

>  	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");

		return dev_err_probe(dev, err, "failed to read whoami register\n");

(a bit longer, but still fine to have on a single line).

> -	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);

		dev_info(dev, "unexpected whoami 0x%02x, continuing\n", data);

-- 
With Best Regards,
Andy Shevchenko
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.