diff mbox series

[v2,2/5] iio: accel: kionix-kx022a: Warn on failed matches and assume compatibility

Message ID b6cb3d48ab9e4177b924b18e27487f8ef763dfd6.1682019544.git.mehdi.djait.k@gmail.com
State Superseded
Headers show
Series [v2,1/5] dt-bindings: iio: Add KX132-1211 accelerometer | expand

Commit Message

Mehdi Djait April 20, 2023, 8:22 p.m. UTC
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.

Signed-off-by: Mehdi Djait <mehdi.djait.k@gmail.com>
---
v2:
- no changes, this patch is introduced in the v2

 drivers/iio/accel/kionix-kx022a.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Jonathan Cameron April 22, 2023, 5:26 p.m. UTC | #1
On Fri, 21 Apr 2023 06:44:28 +0300
Matti Vaittinen <mazziesaccount@gmail.com> wrote:

> On 4/20/23 23:22, 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.
> > 
> > Signed-off-by: Mehdi Djait <mehdi.djait.k@gmail.com>
> > ---
> > v2:
> > - no changes, this patch is introduced in the v2
> > 
> >   drivers/iio/accel/kionix-kx022a.c | 4 +---
> >   1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/drivers/iio/accel/kionix-kx022a.c b/drivers/iio/accel/kionix-kx022a.c
> > index f98393d74666..70530005cad3 100644
> > --- a/drivers/iio/accel/kionix-kx022a.c
> > +++ b/drivers/iio/accel/kionix-kx022a.c
> > @@ -1038,9 +1038,7 @@ int kx022a_probe_internal(struct device *dev)
> >   		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;
> > -	}
> > +		dev_warn(dev, "unsupported device 0x%x\n", chip_id);  
> 
> Just a 'nit' - no need to re-spin the series for this if there is no 
> other changes requested.
> 
> Maybe a slightly better wording here would be "unknown device"? If I am 
> not mistaken the code proceeds because device is assumed to be supported.
> 
> Jonathan, do you think this change is worth backporting? If yes, then we 
> might need a Fixes tag.

We haven't backported similar cases as far as I know. 
It's fine to request it explicitly gets picked up for stable if we decide
we care later.

I'll tidy up above if I take this version..

Jonathan

> 
> Acked-by: Matti Vaittinen <mazziesaccount@gmail.com>
> 
> >   
> >   	irq = fwnode_irq_get_byname(fwnode, "INT1");
> >   	if (irq > 0) {  
>
Jonathan Cameron April 22, 2023, 5:28 p.m. UTC | #2
On Thu, 20 Apr 2023 22:22:02 +0200
Mehdi Djait <mehdi.djait.k@gmail.com> 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.
> 
> Signed-off-by: Mehdi Djait <mehdi.djait.k@gmail.com>
> ---
> v2:
> - no changes, this patch is introduced in the v2
> 
>  drivers/iio/accel/kionix-kx022a.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/accel/kionix-kx022a.c b/drivers/iio/accel/kionix-kx022a.c
> index f98393d74666..70530005cad3 100644
> --- a/drivers/iio/accel/kionix-kx022a.c
> +++ b/drivers/iio/accel/kionix-kx022a.c
> @@ -1038,9 +1038,7 @@ int kx022a_probe_internal(struct device *dev)
>  		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;
> -	}
> +		dev_warn(dev, "unsupported device 0x%x\n", chip_id);

Try building this ;)  You have remove the closing bracket but kept the opening
one.

Jonathan

>  
>  	irq = fwnode_irq_get_byname(fwnode, "INT1");
>  	if (irq > 0) {
Mehdi Djait April 23, 2023, 8:59 p.m. UTC | #3
Hello Jonathan,

On Sat, Apr 22, 2023 at 06:28:33PM +0100, Jonathan Cameron wrote:
> On Thu, 20 Apr 2023 22:22:02 +0200
> Mehdi Djait <mehdi.djait.k@gmail.com> 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.
> > 
> > Signed-off-by: Mehdi Djait <mehdi.djait.k@gmail.com>
> > ---
> > v2:
> > - no changes, this patch is introduced in the v2
> > 
> >  drivers/iio/accel/kionix-kx022a.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/drivers/iio/accel/kionix-kx022a.c b/drivers/iio/accel/kionix-kx022a.c
> > index f98393d74666..70530005cad3 100644
> > --- a/drivers/iio/accel/kionix-kx022a.c
> > +++ b/drivers/iio/accel/kionix-kx022a.c
> > @@ -1038,9 +1038,7 @@ int kx022a_probe_internal(struct device *dev)
> >  		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;
> > -	}
> > +		dev_warn(dev, "unsupported device 0x%x\n", chip_id);
> 
> Try building this ;)  You have remove the closing bracket but kept the opening
> one.

Oops! I will fix this :)

--
Kind Regards
Mehdi Djait
diff mbox series

Patch

diff --git a/drivers/iio/accel/kionix-kx022a.c b/drivers/iio/accel/kionix-kx022a.c
index f98393d74666..70530005cad3 100644
--- a/drivers/iio/accel/kionix-kx022a.c
+++ b/drivers/iio/accel/kionix-kx022a.c
@@ -1038,9 +1038,7 @@  int kx022a_probe_internal(struct device *dev)
 		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;
-	}
+		dev_warn(dev, "unsupported device 0x%x\n", chip_id);
 
 	irq = fwnode_irq_get_byname(fwnode, "INT1");
 	if (irq > 0) {