media: usb: cx231xx: convert to use i2c_new_client_device()
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Thu, 26 Mar 2020 21:09:44 +0000 (22:09 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 14 Apr 2020 09:31:32 +0000 (11:31 +0200)
Move away from the deprecated API and make use of the fact that
unregistering devices is NULL- and ERR_PTR-safe.

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+huawei@kernel.org>
drivers/media/usb/cx231xx/cx231xx-input.c

index 9f88c64..8149702 100644 (file)
@@ -88,7 +88,7 @@ int cx231xx_ir_init(struct cx231xx *dev)
        ir_i2c_bus = cx231xx_boards[dev->model].ir_i2c_master;
        dev_dbg(dev->dev, "Trying to bind ir at bus %d, addr 0x%02x\n",
                ir_i2c_bus, info.addr);
-       dev->ir_i2c_client = i2c_new_device(
+       dev->ir_i2c_client = i2c_new_client_device(
                cx231xx_get_i2c_adap(dev, ir_i2c_bus), &info);
 
        return 0;
@@ -96,7 +96,6 @@ int cx231xx_ir_init(struct cx231xx *dev)
 
 void cx231xx_ir_exit(struct cx231xx *dev)
 {
-       if (dev->ir_i2c_client)
-               i2c_unregister_device(dev->ir_i2c_client);
+       i2c_unregister_device(dev->ir_i2c_client);
        dev->ir_i2c_client = NULL;
 }