Linux IIO development
 help / color / mirror / Atom feed
* [PATCH v2] iio: accel: mma8452: ignore the return value of reset operation
@ 2022-06-15 11:31 haibo.chen
  2022-06-15 16:10 ` Hans de Goede
  0 siblings, 1 reply; 5+ messages in thread
From: haibo.chen @ 2022-06-15 11:31 UTC (permalink / raw)
  To: jic23, lars; +Cc: haibo.chen, hdegoede, linux-iio, linux-imx

From: Haibo Chen <haibo.chen@nxp.com>

On fxls8471, after set the reset bit, the device will reset immediately,
will not give ACK. So ignore the return value of this reset operation,
let the following code logic to check whether the reset operation works.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
 drivers/iio/accel/mma8452.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
index e0f0c0abed28..c7d9ca96dbaa 100644
--- a/drivers/iio/accel/mma8452.c
+++ b/drivers/iio/accel/mma8452.c
@@ -1511,10 +1511,14 @@ static int mma8452_reset(struct i2c_client *client)
 	int i;
 	int ret;
 
-	ret = i2c_smbus_write_byte_data(client,	MMA8452_CTRL_REG2,
+	/*
+	 * Find on fxls8471, after config reset bit, it reset immediately,
+	 * and will not give ACK, so here do not check the return value.
+	 * The following code will read the reset register, and check whether
+	 * this reset works.
+	 */
+	i2c_smbus_write_byte_data(client, MMA8452_CTRL_REG2,
 					MMA8452_CTRL_REG2_RST);
-	if (ret < 0)
-		return ret;
 
 	for (i = 0; i < 10; i++) {
 		usleep_range(100, 200);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] iio: accel: mma8452: ignore the return value of reset operation
  2022-06-15 11:31 [PATCH v2] iio: accel: mma8452: ignore the return value of reset operation haibo.chen
@ 2022-06-15 16:10 ` Hans de Goede
  2022-06-15 21:15   ` Jonathan Cameron
  0 siblings, 1 reply; 5+ messages in thread
From: Hans de Goede @ 2022-06-15 16:10 UTC (permalink / raw)
  To: haibo.chen, jic23, lars; +Cc: linux-iio, linux-imx

Hi,

On 6/15/22 13:31, haibo.chen@nxp.com wrote:
> From: Haibo Chen <haibo.chen@nxp.com>
> 
> On fxls8471, after set the reset bit, the device will reset immediately,
> will not give ACK. So ignore the return value of this reset operation,
> let the following code logic to check whether the reset operation works.
> 
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans



> ---
>  drivers/iio/accel/mma8452.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
> index e0f0c0abed28..c7d9ca96dbaa 100644
> --- a/drivers/iio/accel/mma8452.c
> +++ b/drivers/iio/accel/mma8452.c
> @@ -1511,10 +1511,14 @@ static int mma8452_reset(struct i2c_client *client)
>  	int i;
>  	int ret;
>  
> -	ret = i2c_smbus_write_byte_data(client,	MMA8452_CTRL_REG2,
> +	/*
> +	 * Find on fxls8471, after config reset bit, it reset immediately,
> +	 * and will not give ACK, so here do not check the return value.
> +	 * The following code will read the reset register, and check whether
> +	 * this reset works.
> +	 */
> +	i2c_smbus_write_byte_data(client, MMA8452_CTRL_REG2,
>  					MMA8452_CTRL_REG2_RST);
> -	if (ret < 0)
> -		return ret;
>  
>  	for (i = 0; i < 10; i++) {
>  		usleep_range(100, 200);


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] iio: accel: mma8452: ignore the return value of reset operation
  2022-06-15 16:10 ` Hans de Goede
@ 2022-06-15 21:15   ` Jonathan Cameron
  2022-06-16  1:34     ` Bough Chen
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Cameron @ 2022-06-15 21:15 UTC (permalink / raw)
  To: Hans de Goede; +Cc: haibo.chen, lars, linux-iio, linux-imx

On Wed, 15 Jun 2022 18:10:47 +0200
Hans de Goede <hdegoede@redhat.com> wrote:

> Hi,
> 
> On 6/15/22 13:31, haibo.chen@nxp.com wrote:
> > From: Haibo Chen <haibo.chen@nxp.com>
> > 
> > On fxls8471, after set the reset bit, the device will reset immediately,
> > will not give ACK. So ignore the return value of this reset operation,
> > let the following code logic to check whether the reset operation works.
> > 
> > Signed-off-by: Haibo Chen <haibo.chen@nxp.com>  
> 
> Thanks, patch looks good to me:
> 
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Looks very much like a fix to me, so fixes tag please.
As it's otherwise good, just sending the tag in reply to this
message will be fine.

Thanks,

Jonathan

> 
> Regards,
> 
> Hans
> 
> 
> 
> > ---
> >  drivers/iio/accel/mma8452.c | 10 +++++++---
> >  1 file changed, 7 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
> > index e0f0c0abed28..c7d9ca96dbaa 100644
> > --- a/drivers/iio/accel/mma8452.c
> > +++ b/drivers/iio/accel/mma8452.c
> > @@ -1511,10 +1511,14 @@ static int mma8452_reset(struct i2c_client *client)
> >  	int i;
> >  	int ret;
> >  
> > -	ret = i2c_smbus_write_byte_data(client,	MMA8452_CTRL_REG2,
> > +	/*
> > +	 * Find on fxls8471, after config reset bit, it reset immediately,
> > +	 * and will not give ACK, so here do not check the return value.
> > +	 * The following code will read the reset register, and check whether
> > +	 * this reset works.
> > +	 */
> > +	i2c_smbus_write_byte_data(client, MMA8452_CTRL_REG2,
> >  					MMA8452_CTRL_REG2_RST);
> > -	if (ret < 0)
> > -		return ret;
> >  
> >  	for (i = 0; i < 10; i++) {
> >  		usleep_range(100, 200);  
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH v2] iio: accel: mma8452: ignore the return value of reset operation
  2022-06-15 21:15   ` Jonathan Cameron
@ 2022-06-16  1:34     ` Bough Chen
  2022-06-18 16:30       ` Jonathan Cameron
  0 siblings, 1 reply; 5+ messages in thread
From: Bough Chen @ 2022-06-16  1:34 UTC (permalink / raw)
  To: Jonathan Cameron, Hans de Goede
  Cc: lars@metafoo.de, linux-iio@vger.kernel.org, dl-linux-imx

> -----Original Message-----
> From: Jonathan Cameron <jic23@kernel.org>
> Sent: 2022年6月16日 5:16
> To: Hans de Goede <hdegoede@redhat.com>
> Cc: Bough Chen <haibo.chen@nxp.com>; lars@metafoo.de;
> linux-iio@vger.kernel.org; dl-linux-imx <linux-imx@nxp.com>
> Subject: Re: [PATCH v2] iio: accel: mma8452: ignore the return value of reset
> operation
> 
> On Wed, 15 Jun 2022 18:10:47 +0200
> Hans de Goede <hdegoede@redhat.com> wrote:
> 
> > Hi,
> >
> > On 6/15/22 13:31, haibo.chen@nxp.com wrote:
> > > From: Haibo Chen <haibo.chen@nxp.com>
> > >
> > > On fxls8471, after set the reset bit, the device will reset
> > > immediately, will not give ACK. So ignore the return value of this
> > > reset operation, let the following code logic to check whether the reset
> operation works.
> > >
> > > Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
> >
> > Thanks, patch looks good to me:
> >
> > Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> Looks very much like a fix to me, so fixes tag please.
> As it's otherwise good, just sending the tag in reply to this message will be fine.

Thanks for your quick review.

Fixes: ecabae713196 ("iio: mma8452: Initialise before activating")

Best Regards
Bough Chen
> 
> Thanks,
> 
> Jonathan
> 
> >
> > Regards,
> >
> > Hans
> >
> >
> >
> > > ---
> > >  drivers/iio/accel/mma8452.c | 10 +++++++---
> > >  1 file changed, 7 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/iio/accel/mma8452.c
> > > b/drivers/iio/accel/mma8452.c index e0f0c0abed28..c7d9ca96dbaa
> > > 100644
> > > --- a/drivers/iio/accel/mma8452.c
> > > +++ b/drivers/iio/accel/mma8452.c
> > > @@ -1511,10 +1511,14 @@ static int mma8452_reset(struct i2c_client
> *client)
> > >  	int i;
> > >  	int ret;
> > >
> > > -	ret = i2c_smbus_write_byte_data(client,	MMA8452_CTRL_REG2,
> > > +	/*
> > > +	 * Find on fxls8471, after config reset bit, it reset immediately,
> > > +	 * and will not give ACK, so here do not check the return value.
> > > +	 * The following code will read the reset register, and check whether
> > > +	 * this reset works.
> > > +	 */
> > > +	i2c_smbus_write_byte_data(client, MMA8452_CTRL_REG2,
> > >  					MMA8452_CTRL_REG2_RST);
> > > -	if (ret < 0)
> > > -		return ret;
> > >
> > >  	for (i = 0; i < 10; i++) {
> > >  		usleep_range(100, 200);
> >


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] iio: accel: mma8452: ignore the return value of reset operation
  2022-06-16  1:34     ` Bough Chen
@ 2022-06-18 16:30       ` Jonathan Cameron
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2022-06-18 16:30 UTC (permalink / raw)
  To: Bough Chen
  Cc: Hans de Goede, lars@metafoo.de, linux-iio@vger.kernel.org,
	dl-linux-imx

On Thu, 16 Jun 2022 01:34:03 +0000
Bough Chen <haibo.chen@nxp.com> wrote:

> > -----Original Message-----
> > From: Jonathan Cameron <jic23@kernel.org>
> > Sent: 2022年6月16日 5:16
> > To: Hans de Goede <hdegoede@redhat.com>
> > Cc: Bough Chen <haibo.chen@nxp.com>; lars@metafoo.de;
> > linux-iio@vger.kernel.org; dl-linux-imx <linux-imx@nxp.com>
> > Subject: Re: [PATCH v2] iio: accel: mma8452: ignore the return value of reset
> > operation
> > 
> > On Wed, 15 Jun 2022 18:10:47 +0200
> > Hans de Goede <hdegoede@redhat.com> wrote:
> >   
> > > Hi,
> > >
> > > On 6/15/22 13:31, haibo.chen@nxp.com wrote:  
> > > > From: Haibo Chen <haibo.chen@nxp.com>
> > > >
> > > > On fxls8471, after set the reset bit, the device will reset
> > > > immediately, will not give ACK. So ignore the return value of this
> > > > reset operation, let the following code logic to check whether the reset  
> > operation works.  
> > > >
> > > > Signed-off-by: Haibo Chen <haibo.chen@nxp.com>  
> > >
> > > Thanks, patch looks good to me:
> > >
> > > Reviewed-by: Hans de Goede <hdegoede@redhat.com>  
> > Looks very much like a fix to me, so fixes tag please.
> > As it's otherwise good, just sending the tag in reply to this message will be fine.  
> 
> Thanks for your quick review.
> 
> Fixes: ecabae713196 ("iio: mma8452: Initialise before activating")
Perfect.

Applied to the fixes-togreg branch of iio.git.

Thanks,

Jonathan

> 
> Best Regards
> Bough Chen
> > 
> > Thanks,
> > 
> > Jonathan
> >   
> > >
> > > Regards,
> > >
> > > Hans
> > >
> > >
> > >  
> > > > ---
> > > >  drivers/iio/accel/mma8452.c | 10 +++++++---
> > > >  1 file changed, 7 insertions(+), 3 deletions(-)
> > > >
> > > > diff --git a/drivers/iio/accel/mma8452.c
> > > > b/drivers/iio/accel/mma8452.c index e0f0c0abed28..c7d9ca96dbaa
> > > > 100644
> > > > --- a/drivers/iio/accel/mma8452.c
> > > > +++ b/drivers/iio/accel/mma8452.c
> > > > @@ -1511,10 +1511,14 @@ static int mma8452_reset(struct i2c_client  
> > *client)  
> > > >  	int i;
> > > >  	int ret;
> > > >
> > > > -	ret = i2c_smbus_write_byte_data(client,	MMA8452_CTRL_REG2,
> > > > +	/*
> > > > +	 * Find on fxls8471, after config reset bit, it reset immediately,
> > > > +	 * and will not give ACK, so here do not check the return value.
> > > > +	 * The following code will read the reset register, and check whether
> > > > +	 * this reset works.
> > > > +	 */
> > > > +	i2c_smbus_write_byte_data(client, MMA8452_CTRL_REG2,
> > > >  					MMA8452_CTRL_REG2_RST);
> > > > -	if (ret < 0)
> > > > -		return ret;
> > > >
> > > >  	for (i = 0; i < 10; i++) {
> > > >  		usleep_range(100, 200);  
> > >  
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-06-18 16:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-15 11:31 [PATCH v2] iio: accel: mma8452: ignore the return value of reset operation haibo.chen
2022-06-15 16:10 ` Hans de Goede
2022-06-15 21:15   ` Jonathan Cameron
2022-06-16  1:34     ` Bough Chen
2022-06-18 16:30       ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox