Relax failure when driver gets an unknown device id for
allow probe for register compatible devices.
Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org>
---
drivers/iio/magnetometer/ak8975.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c
index ccbebe5b66cd..8eef4d5dd9e2 100644
--- a/drivers/iio/magnetometer/ak8975.c
+++ b/drivers/iio/magnetometer/ak8975.c
@@ -484,10 +484,13 @@ static int ak8975_who_i_am(struct i2c_client *client,
if (wia_val[1] == AK09916_DEVICE_ID)
return 0;
break;
- default:
- dev_err(&client->dev, "Type %d unknown\n", type);
}
- return -ENODEV;
+
+ dev_info(&client->dev, "Device ID %x is unknown.\n", wia_val[1]);
+ /* Let driver to probe on unknown id for support more register
+ * compatible variants.
+ */
+ return 0;
}
/*
--
2.46.0
On Mon, 19 Aug 2024 00:29:39 +0200 Barnabás Czémán <barnabas.czeman@mainlining.org> wrote: > Relax failure when driver gets an unknown device id for > allow probe for register compatible devices. > > Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org> > --- > drivers/iio/magnetometer/ak8975.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c > index ccbebe5b66cd..8eef4d5dd9e2 100644 > --- a/drivers/iio/magnetometer/ak8975.c > +++ b/drivers/iio/magnetometer/ak8975.c > @@ -484,10 +484,13 @@ static int ak8975_who_i_am(struct i2c_client *client, > if (wia_val[1] == AK09916_DEVICE_ID) > return 0; > break; > - default: > - dev_err(&client->dev, "Type %d unknown\n", type); > } > - return -ENODEV; > + > + dev_info(&client->dev, "Device ID %x is unknown.\n", wia_val[1]); > + /* Let driver to probe on unknown id for support more register Comment style wrong, I'll fix it up. With that tweak applied to the togreg branch of iio.git Thanks, Jonathan > + * compatible variants. > + */ > + return 0; > } > > /* >
On Fri, Aug 23, 2024 at 07:32:03PM +0100, Jonathan Cameron wrote:
> On Mon, 19 Aug 2024 00:29:39 +0200
> Barnabás Czémán <barnabas.czeman@mainlining.org> wrote:
...
> > + /* Let driver to probe on unknown id for support more register
> Comment style wrong, I'll fix it up.
>
> With that tweak applied to the togreg branch of iio.git
>
> Thanks,
>
> Jonathan
>
>
> > + * compatible variants.
> > + */
There is another one also wrong.
+ [AK09918] = {
+ /* ak09918 is register compatible with ak09912 this is for avoid
+ * unknown id messages.
+ */
--
With Best Regards,
Andy Shevchenko
On Fri, 23 Aug 2024 22:11:15 +0300
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
> On Fri, Aug 23, 2024 at 07:32:03PM +0100, Jonathan Cameron wrote:
> > On Mon, 19 Aug 2024 00:29:39 +0200
> > Barnabás Czémán <barnabas.czeman@mainlining.org> wrote:
>
> ...
>
> > > + /* Let driver to probe on unknown id for support more register
> > Comment style wrong, I'll fix it up.
> >
> > With that tweak applied to the togreg branch of iio.git
> >
> > Thanks,
> >
> > Jonathan
> >
> >
> > > + * compatible variants.
> > > + */
>
> There is another one also wrong.
>
> + [AK09918] = {
> + /* ak09918 is register compatible with ak09912 this is for avoid
> + * unknown id messages.
> + */
>
>
I think unrelated to this series, but nice to cleanup.
Patches welcome :) Or it I get bored, I might do a scrub of the full subsystem
to get everything in the same style and not provide incorrect choices to
cut and paste.
Jonathan
On Mon, Aug 26, 2024 at 11:39:20AM +0100, Jonathan Cameron wrote:
> On Fri, 23 Aug 2024 22:11:15 +0300
> Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
> > On Fri, Aug 23, 2024 at 07:32:03PM +0100, Jonathan Cameron wrote:
> > > On Mon, 19 Aug 2024 00:29:39 +0200
> > > Barnabás Czémán <barnabas.czeman@mainlining.org> wrote:
...
> > > > + /* Let driver to probe on unknown id for support more register
> > > Comment style wrong, I'll fix it up.
> > >
> > > With that tweak applied to the togreg branch of iio.git
> > > > + * compatible variants.
> > > > + */
> >
> > There is another one also wrong.
> >
> > + [AK09918] = {
> > + /* ak09918 is register compatible with ak09912 this is for avoid
> > + * unknown id messages.
> > + */
>
> I think unrelated to this series, but nice to cleanup.
> Patches welcome :)
Sure, but I leave this to newbies to have a material to exercise on.
> Or it I get bored, I might do a scrub of the full subsystem to get everything
> in the same style and not provide incorrect choices to cut and paste.
:-)
I believe we still have more interesting cases, than white space cleanups.
--
With Best Regards,
Andy Shevchenko
© 2016 - 2025 Red Hat, Inc.