media: i2c: adv7842: convert to i2c_new_dummy_device
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Fri, 9 Aug 2019 19:04:06 +0000 (16:04 -0300)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Tue, 13 Aug 2019 14:46:55 +0000 (11:46 -0300)
Move away from the to-be-removed i2c_new_dummy() to
i2c_new_dummy_device(). So, we now get an ERRPTR which we use in error
handling by printing the error code. To keep the rest of the driver
logic as is, internally a NULL ptr is still kept.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/i2c/adv7842.c

index 11ab2df02dc70c519148d1a71bec4d5050c0e47b..ffc3d174c4a16b1ba28edddf5a82dd6059751eb4 100644 (file)
@@ -3400,9 +3400,12 @@ static struct i2c_client *adv7842_dummy_client(struct v4l2_subdev *sd, const cha
                return NULL;
        }
 
-       cp = i2c_new_dummy(client->adapter, io_read(sd, io_reg) >> 1);
-       if (!cp)
-               v4l2_err(sd, "register %s on i2c addr 0x%x failed\n", desc, addr);
+       cp = i2c_new_dummy_device(client->adapter, io_read(sd, io_reg) >> 1);
+       if (IS_ERR(cp)) {
+               v4l2_err(sd, "register %s on i2c addr 0x%x failed with %ld\n",
+                        desc, addr, PTR_ERR(cp));
+               cp = NULL;
+       }
 
        return cp;
 }