Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: i2c: adv7842: convert to i2c_new_dummy_device

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>

authored by

Wolfram Sang and committed by
Mauro Carvalho Chehab
34925d9f 2f822f1d

+6 -3
+6 -3
drivers/media/i2c/adv7842.c
··· 3400 3400 return NULL; 3401 3401 } 3402 3402 3403 - cp = i2c_new_dummy(client->adapter, io_read(sd, io_reg) >> 1); 3404 - if (!cp) 3405 - v4l2_err(sd, "register %s on i2c addr 0x%x failed\n", desc, addr); 3403 + cp = i2c_new_dummy_device(client->adapter, io_read(sd, io_reg) >> 1); 3404 + if (IS_ERR(cp)) { 3405 + v4l2_err(sd, "register %s on i2c addr 0x%x failed with %ld\n", 3406 + desc, addr, PTR_ERR(cp)); 3407 + cp = NULL; 3408 + } 3406 3409 3407 3410 return cp; 3408 3411 }