Skip to contentSkip to conversation

iio: accel: mma8452: ignore the return value of reset operation

PATCH Applied [email protected] 3 participants 5 messages Jun 15, 2022 – Jun 18, 2022 IIO

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 iio: accel: mma8452: ignore the return value of reset operation

From: Haibo Chen <[email protected]>

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.

---
 drivers/iio/accel/mma8452.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/accel/mma8452.c +7 -3
index e0f0c0abed28..c7d9ca96dbaa 100644
@@ -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);
Signature · 1 line
2.25.1
Reviewed-by on v2 1/1
#1 lore raw

Hi,

Quoted 7 lines · On 6/15/22 13:31, [email protected] wrote:

From: Haibo Chen <[email protected]>

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.

Thanks, patch looks good to me:

Regards,

Hans

Quoted 26 lines
---
 drivers/iio/accel/mma8452.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/accel/mma8452.c +7 -3
index e0f0c0abed28..c7d9ca96dbaa 100644
@@ -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);
maintainer
#2 lore raw
Quoted 9 lines · On Wed, 15 Jun 2022 18:10:47 +0200 Hans de Goede <[email protected]> wrote:

Hi,

Quoted 6 lines · On 6/15/22 13:31, [email protected] wrote:

From: Haibo Chen <[email protected]>

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.

Quoted 5 lines
Quoted 1 line

Thanks, patch looks good to me:

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

Quoted 34 lines

Regards,

Hans

Quoted 26 lines
---
 drivers/iio/accel/mma8452.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/accel/mma8452.c +7 -3
index e0f0c0abed28..c7d9ca96dbaa 100644
@@ -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);  
author
#3 lore raw
Quoted 22 lines

-----Original Message-----
From: Jonathan Cameron <[email protected]>
Sent: 2022年6月16日 5:16
To: Hans de Goede <[email protected]>
Cc: Bough Chen <[email protected]>; [email protected]; [email protected]; dl-linux-imx <[email protected]>
Subject: Re: [PATCH v2] iio: accel: mma8452: ignore the return value of reset operation

Quoted 8 lines · On Wed, 15 Jun 2022 18:10:47 +0200 Hans de Goede <[email protected]> wrote:

Hi,

Quoted 5 lines · On 6/15/22 13:31, [email protected] wrote:

From: Haibo Chen <[email protected]>

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.

Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Thanks, patch looks good to me:

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

Quoted 41 lines

Thanks,

Jonathan

Quoted 11 lines

Regards,

Hans

Quoted 4 lines
---
 drivers/iio/accel/mma8452.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
Quoted 6 lines

drivers/iio/accel/mma8452.c static int mma8452_reset(struct i2c_client

Quoted 6 lines
(quoted diff) +0 -0

b/drivers/iio/accel/mma8452.c index e0f0c0abed28..c7d9ca96dbaa 100644

drivers/iio/accel/mma8452.c +0 -0
@@ -1511,10 +1511,14 @@ static int mma8452_reset(struct i2c_client

*client)

Quoted 18 lines
Quoted 17 lines
drivers/iio/accel/mma8452.c +7 -3
 	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);
maintainer Applied
#4 lore raw
Quoted 26 lines · On Thu, 16 Jun 2022 01:34:03 +0000 Bough Chen <[email protected]> wrote:
Quoted 26 lines

-----Original Message-----
From: Jonathan Cameron <[email protected]>
Sent: 2022年6月16日 5:16
To: Hans de Goede <[email protected]>
Cc: Bough Chen <[email protected]>; [email protected]; [email protected]; dl-linux-imx <[email protected]>
Subject: Re: [PATCH v2] iio: accel: mma8452: ignore the return value of reset operation

Quoted 8 lines · On Wed, 15 Jun 2022 18:10:47 +0200 Hans de Goede <[email protected]> wrote:

Hi,

Quoted 5 lines · On 6/15/22 13:31, [email protected] wrote:

From: Haibo Chen <[email protected]>

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.

Quoted 5 lines
Quoted 2 lines

Thanks, patch looks good to me:

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

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

Quoted 45 lines

Best Regards
Bough Chen

Quoted 41 lines

Thanks,

Jonathan

Quoted 11 lines

Regards,

Hans

Quoted 4 lines
---
 drivers/iio/accel/mma8452.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
Quoted 6 lines

drivers/iio/accel/mma8452.c static int mma8452_reset(struct i2c_client

Quoted 6 lines
(quoted diff) +0 -0

b/drivers/iio/accel/mma8452.c index e0f0c0abed28..c7d9ca96dbaa 100644

drivers/iio/accel/mma8452.c +0 -0
@@ -1511,10 +1511,14 @@ static int mma8452_reset(struct i2c_client  

*client)

Quoted 18 lines
Quoted 17 lines
drivers/iio/accel/mma8452.c +7 -3
 	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);