Message ID | 2c69e918cb6dfab663bb62952c554b6b72f58390.1692824815.git.mehdi.djait.k@gmail.com (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Series | iio: accel: Add support for Kionix/ROHM KX132-1211 accelerometer | expand |
On Wed, Aug 23, 2023 at 11:16:37PM +0200, Mehdi Djait wrote: > Avoid error returns on a failure to match and instead just warn with > assumption that we have a correct dt-binding telling us that > some new device with a different ID is backwards compatible. As we already discussed in the past I think this patch might be not okay in case a hardware vendor decides to make incompatible device with non-supported yet ID. It might be even harmful to the hardware to program register without knowing that this is safe. That said, I'm neither NAKing nor reviewing this and leave to maintainers to decide.
On Thu, 24 Aug 2023 14:51:49 +0300 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > On Wed, Aug 23, 2023 at 11:16:37PM +0200, Mehdi Djait wrote: > > Avoid error returns on a failure to match and instead just warn with > > assumption that we have a correct dt-binding telling us that > > some new device with a different ID is backwards compatible. > > As we already discussed in the past I think this patch might be > not okay in case a hardware vendor decides to make incompatible > device with non-supported yet ID. It might be even harmful to > the hardware to program register without knowing that this is safe. That only matters if they 'claim' it is compatible. Otherwise the driver never probes and we are fine. DT maintainers view was that the job of the kernel was not to defend against bugs in device tree firmwares or someone binding the driver to the wrong device by hand. > > That said, I'm neither NAKing nor reviewing this and leave to > maintainers to decide. >
diff --git a/drivers/iio/accel/kionix-kx022a.c b/drivers/iio/accel/kionix-kx022a.c index ff8aa7b9568e..494e81ba1da9 100644 --- a/drivers/iio/accel/kionix-kx022a.c +++ b/drivers/iio/accel/kionix-kx022a.c @@ -1036,10 +1036,8 @@ int kx022a_probe_internal(struct device *dev) if (ret) return dev_err_probe(dev, ret, "Failed to access sensor\n"); - if (chip_id != KX022A_ID) { - dev_err(dev, "unsupported device 0x%x\n", chip_id); - return -EINVAL; - } + if (chip_id != KX022A_ID) + dev_warn(dev, "unknown device 0x%x\n", chip_id); irq = fwnode_irq_get_byname(fwnode, "INT1"); if (irq > 0) {