2020-03-26 21:13:43

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 0/6] media: convert to use new I2C API

We are deprecating calls which return NULL in favor of new variants which
return an ERR_PTR. Only build tested.


Wolfram Sang (6):
media: pci: cx88: convert to use i2c_new_client_device()
media: pci: saa7134: convert to use i2c_new_client_device()
media: marvell-ccic: convert to use i2c_new_client_device()
media: usb: cx231xx: convert to use i2c_new_client_device()
media: usb: hdpvr: convert to use i2c_new_client_device()
media: usb: pvrusb2: convert to use i2c_new_client_device()

drivers/media/pci/cx88/cx88-core.c | 3 +--
drivers/media/pci/cx88/cx88-input.c | 2 +-
drivers/media/pci/cx88/cx88-video.c | 2 +-
drivers/media/pci/saa7134/saa7134-input.c | 2 +-
drivers/media/platform/marvell-ccic/cafe-driver.c | 2 +-
drivers/media/usb/cx231xx/cx231xx-input.c | 5 ++---
drivers/media/usb/hdpvr/hdpvr-core.c | 4 ++--
drivers/media/usb/hdpvr/hdpvr-i2c.c | 2 +-
drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c | 4 ++--
9 files changed, 12 insertions(+), 14 deletions(-)

--
2.20.1


2020-03-26 21:13:46

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 1/6] media: pci: cx88: convert to use i2c_new_client_device()

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 <[email protected]>
---
drivers/media/pci/cx88/cx88-core.c | 3 +--
drivers/media/pci/cx88/cx88-input.c | 2 +-
drivers/media/pci/cx88/cx88-video.c | 2 +-
3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/media/pci/cx88/cx88-core.c b/drivers/media/pci/cx88/cx88-core.c
index dcadf78657d6..48c8a3429542 100644
--- a/drivers/media/pci/cx88/cx88-core.c
+++ b/drivers/media/pci/cx88/cx88-core.c
@@ -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);
diff --git a/drivers/media/pci/cx88/cx88-input.c b/drivers/media/pci/cx88/cx88-input.c
index c7c2acd55266..7e0fed9cd200 100644
--- a/drivers/media/pci/cx88/cx88-input.c
+++ b/drivers/media/pci/cx88/cx88-input.c
@@ -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;
}
}
diff --git a/drivers/media/pci/cx88/cx88-video.c b/drivers/media/pci/cx88/cx88-video.c
index 6aabc45aa93c..ba0e9660a047 100644
--- a/drivers/media/pci/cx88/cx88-video.c
+++ b/drivers/media/pci/cx88/cx88-video.c
@@ -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:
--
2.20.1

2020-03-26 21:14:21

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 4/6] media: usb: cx231xx: convert to use i2c_new_client_device()

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 <[email protected]>
---
drivers/media/usb/cx231xx/cx231xx-input.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-input.c b/drivers/media/usb/cx231xx/cx231xx-input.c
index 9f88c640ec2b..8149702bcf89 100644
--- a/drivers/media/usb/cx231xx/cx231xx-input.c
+++ b/drivers/media/usb/cx231xx/cx231xx-input.c
@@ -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;
}
--
2.20.1

2020-03-26 21:14:38

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 6/6] media: usb: pvrusb2: convert to use i2c_new_client_device()

Move away from the deprecated API.

Signed-off-by: Wolfram Sang <[email protected]>
---
drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c
index 275394bafe7d..63db04fe12d3 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c
@@ -564,7 +564,7 @@ static void pvr2_i2c_register_ir(struct pvr2_hdw *hdw)
strscpy(info.type, "ir_video", I2C_NAME_SIZE);
pvr2_trace(PVR2_TRACE_INFO, "Binding %s to i2c address 0x%02x.",
info.type, info.addr);
- i2c_new_device(&hdw->i2c_adap, &info);
+ i2c_new_client_device(&hdw->i2c_adap, &info);
break;
case PVR2_IR_SCHEME_ZILOG: /* HVR-1950 style */
case PVR2_IR_SCHEME_24XXX_MCE: /* 24xxx MCE device */
@@ -579,7 +579,7 @@ static void pvr2_i2c_register_ir(struct pvr2_hdw *hdw)
strscpy(info.type, "ir_z8f0811_haup", I2C_NAME_SIZE);
pvr2_trace(PVR2_TRACE_INFO, "Binding %s to i2c address 0x%02x.",
info.type, info.addr);
- i2c_new_device(&hdw->i2c_adap, &info);
+ i2c_new_client_device(&hdw->i2c_adap, &info);
break;
default:
/* The device either doesn't support I2C-based IR or we
--
2.20.1

2020-03-29 03:20:40

by Mike Isely

[permalink] [raw]
Subject: Re: [PATCH 6/6] media: usb: pvrusb2: convert to use i2c_new_client_device()


Acked-by: Mike Isely <[email protected]>

On Thu, 26 Mar 2020, Wolfram Sang wrote:

> Move away from the deprecated API.
>
> Signed-off-by: Wolfram Sang <[email protected]>
> ---
> drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c
> index 275394bafe7d..63db04fe12d3 100644
> --- a/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c
> +++ b/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c
> @@ -564,7 +564,7 @@ static void pvr2_i2c_register_ir(struct pvr2_hdw *hdw)
> strscpy(info.type, "ir_video", I2C_NAME_SIZE);
> pvr2_trace(PVR2_TRACE_INFO, "Binding %s to i2c address 0x%02x.",
> info.type, info.addr);
> - i2c_new_device(&hdw->i2c_adap, &info);
> + i2c_new_client_device(&hdw->i2c_adap, &info);
> break;
> case PVR2_IR_SCHEME_ZILOG: /* HVR-1950 style */
> case PVR2_IR_SCHEME_24XXX_MCE: /* 24xxx MCE device */
> @@ -579,7 +579,7 @@ static void pvr2_i2c_register_ir(struct pvr2_hdw *hdw)
> strscpy(info.type, "ir_z8f0811_haup", I2C_NAME_SIZE);
> pvr2_trace(PVR2_TRACE_INFO, "Binding %s to i2c address 0x%02x.",
> info.type, info.addr);
> - i2c_new_device(&hdw->i2c_adap, &info);
> + i2c_new_client_device(&hdw->i2c_adap, &info);
> break;
> default:
> /* The device either doesn't support I2C-based IR or we
>

--

Mike Isely
isely @ isely (dot) net
PGP: 03 54 43 4D 75 E5 CC 92 71 16 01 E2 B5 F5 C1 E8