diff mbox series

[v4,1/4] iio: magnetometer: ak8975: Relax failure on unknown id

Message ID 20240819-ak09918-v4-1-f0734d14cfb9@mainlining.org (mailing list archive)
State Accepted
Headers show
Series Add support for AK09918 | expand

Commit Message

Barnabás Czémán Aug. 18, 2024, 10:29 p.m. UTC
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(-)

Comments

Jonathan Cameron Aug. 23, 2024, 6:32 p.m. UTC | #1
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;
>  }
>  
>  /*
>
Andy Shevchenko Aug. 23, 2024, 7:11 p.m. UTC | #2
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.
+		 */
Jonathan Cameron Aug. 26, 2024, 10:39 a.m. UTC | #3
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
Andy Shevchenko Aug. 26, 2024, 10:42 a.m. UTC | #4
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.
diff mbox series

Patch

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;
 }
 
 /*