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 dcadf78657d643c1ba4d5155e0e13ffabd012a84..48c8a34295424bf08ab0480632830138fb8d4cc7 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 c7c2acd5526636f8435b2dc6428a50c46d5c2c96..7e0fed9cd200ba2008e4375557d90f091622fc72 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 6aabc45aa93cb596659c31507a3e16f83f6ce71a..ba0e9660a047c5e171dabd59151a266ff3392de4 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: