Re: [PATCH v2 2/4] iio: imu: inv_icm42600: warn on whoami mismatch instead of failing probe
Jonathan Cameron <[email protected]>
| Newsgroups | org.kernel.vger.linux-iio,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <20260728222015.6a62b287@jic23-huawei> |
On Tue, 28 Jul 2026 17:51:57 +0100 Conor Dooley <[email protected]> wrote: > On Fri, Jul 24, 2026 at 10:27:06PM +0200, Jorijn van der Graaf wrote: > > A WHOAMI value differing from the one the compatible implies aborts > > probe with -ENODEV, which prevents a register-compatible part described > > with a fallback compatible from probing at all. > > > > The devicetree compatible is authoritative for which part is fitted: > > demote the mismatch to a warning and continue, as st_sensors does since > > commit a3c2c5c937ed ("iio: st_sensors: relax WhoAmI check in > > st_sensors_verify_id()"). This changes the probe outcome on mismatch > > for all parts the driver supports. > > > > Tested via a backport to a Fairphone 6 running a 7.1-based kernel: its > > ICM-42630 (WHOAMI 0x0C), described with an icm42631 fallback compatible > > and matched as icm42631, warns once and probes, and accelerometer, > > gyroscope and temperature reads work. > > > > Suggested-by: Conor Dooley <[email protected]> > > I don't want this to warn, I want it gone. Fallback use should not > produce a warning. We've had enough problems with 'supposed' like for like replacements in the past that were anything but that I've been allowing some type of print. Don't mind it being a dev_info() though if that works for you. Some have I think gone as far as dev_dbg() which would be fine from my point of view as well. Jonathan > > > Link: https://lore.kernel.org/all/20260722-creature-volley-0f083b904c1d@spud/ > > Assisted-by: Claude:claude-fable-5 > > Signed-off-by: Jorijn van der Graaf <[email protected]> > > --- > > New in v2. > > drivers/iio/imu/inv_icm42600/inv_icm42600_core.c | 8 +++----- > > 1 file changed, 3 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c > > index dc97d8a274e3..f306e3ffca48 100644 > > --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c > > +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c > > @@ -509,11 +509,9 @@ static int inv_icm42600_setup(struct inv_icm42600_state *st, > > ret = regmap_read(st->map, INV_ICM42600_REG_WHOAMI, &val); > > if (ret) > > return ret; > > - if (val != hw->whoami) { > > - dev_err(dev, "invalid whoami %#02x expected %#02x (%s)\n", > > - val, hw->whoami, hw->name); > > - return -ENODEV; > > - } > > + if (val != hw->whoami) > > + dev_warn(dev, "unexpected whoami %#02x, expected %#02x (%s)\n", > > + val, hw->whoami, hw->name); > > st->name = hw->name; > > > > /* reset to make sure previous state are not there */ > > -- > > 2.55.0 > >