Re: [PATCH v2 1/2] iio: imu: bmi160: add support for bmi120

Jonathan Cameron
2024-05-11T11:59:23Z

> >
> > > + }
> > > +
> > > + return -ENODEV;
> > > +}
> > > +
> > > static int bmi160_chip_init(struct bmi160_data *data, bool use_spi)
> > > {
> > > int ret;
> > > @@ -737,12 +753,10 @@ static int bmi160_chip_init(struct bmi160_data *data, bool use_spi)
> > > dev_err(dev, "Error reading chip id\n");
> > > goto disable_regulator;
> > > }
> > > - if (val != BMI160_CHIP_ID_VAL) {
> > > - dev_err(dev, "Wrong chip id, got %x expected %x\n",
> > > - val, BMI160_CHIP_ID_VAL);
> > > - ret = -ENODEV;
> > > - goto disable_regulator;
> > > - }
> > > +
> > > + ret = bmi160_check_chip_id(val);
> > > + if (ret)
> > > + dev_warn(dev, "Chip id not found: %x\n", val);
> >
> > This changes the error with probe failure to a warning, but the commit
> > message doesn't explain why. We always want to know why changes were
> > made. :-)
> >
> > Should also probably be in a separate patch since changing the
> > behavior here is a separate change from adding support for a new chip.
> True, separate patch would be ideal as maybe someone will backport this change and
> not the rest.

Given I'd already picked up v3, I added a note on this to the commit rather
than splitting it.

I doubt anyone will care about dragging in bmi120 IDs along with the relaxation
of matching if they just want the relaxation.

Jonathan

> >
> > >
> > > ret = bmi160_set_mode(data, BMI160_ACCEL, true);
> > > if (ret)
> >
> > ...
>
>