Merge tag 'iio-fixes-for-5.19a' of https://git.kernel.org/pub/scm/linux/kernel/git...
[platform/kernel/linux-rpi.git] / drivers / iio / accel / mma8452.c
index 912a447..c7d9ca9 100644 (file)
@@ -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);
@@ -1557,11 +1561,13 @@ static int mma8452_probe(struct i2c_client *client,
        mutex_init(&data->lock);
 
        data->chip_info = device_get_match_data(&client->dev);
-       if (!data->chip_info && id) {
-               data->chip_info = &mma_chip_info_table[id->driver_data];
-       } else {
-               dev_err(&client->dev, "unknown device model\n");
-               return -ENODEV;
+       if (!data->chip_info) {
+               if (id) {
+                       data->chip_info = &mma_chip_info_table[id->driver_data];
+               } else {
+                       dev_err(&client->dev, "unknown device model\n");
+                       return -ENODEV;
+               }
        }
 
        ret = iio_read_mount_matrix(&client->dev, &data->orientation);