media: pci: cx88: convert to use i2c_new_client_device()
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Thu, 26 Mar 2020 21:09:41 +0000 (22:09 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 14 Apr 2020 09:28:55 +0000 (11:28 +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/pci/cx88/cx88-core.c
drivers/media/pci/cx88/cx88-input.c
drivers/media/pci/cx88/cx88-video.c

index dcadf78..48c8a34 100644 (file)
@@ -1070,8 +1070,7 @@ void cx88_core_put(struct cx88_core *core, struct pci_dev *pci)
        mutex_lock(&devlist);
        cx88_ir_fini(core);
        if (core->i2c_rc == 0) {
-               if (core->i2c_rtc)
-                       i2c_unregister_device(core->i2c_rtc);
+               i2c_unregister_device(core->i2c_rtc);
                i2c_del_adapter(&core->i2c_adap);
        }
        list_del(&core->devlist);
index c7c2acd..7e0fed9 100644 (file)
@@ -638,7 +638,7 @@ void cx88_i2c_init_ir(struct cx88_core *core)
                                   I2C_SMBUS_READ, 0,
                                   I2C_SMBUS_QUICK, NULL) >= 0) {
                        info.addr = *addrp;
-                       i2c_new_device(&core->i2c_adap, &info);
+                       i2c_new_client_device(&core->i2c_adap, &info);
                        break;
                }
        }
index 6aabc45..ba0e966 100644 (file)
@@ -1385,7 +1385,7 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
                };
 
                request_module("rtc-isl1208");
-               core->i2c_rtc = i2c_new_device(&core->i2c_adap, &rtc_info);
+               core->i2c_rtc = i2c_new_client_device(&core->i2c_adap, &rtc_info);
        }
                /* fall-through */
        case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO: