linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] media: convert to use new I2C API
@ 2020-03-26 21:09 Wolfram Sang
  2020-03-26 21:09 ` [PATCH 1/6] media: pci: cx88: convert to use i2c_new_client_device() Wolfram Sang
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Wolfram Sang @ 2020-03-26 21:09 UTC (permalink / raw)
  To: linux-i2c; +Cc: Wolfram Sang, linux-kernel, linux-media

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/6] media: pci: cx88: convert to use i2c_new_client_device()
  2020-03-26 21:09 [PATCH 0/6] media: convert to use new I2C API Wolfram Sang
@ 2020-03-26 21:09 ` Wolfram Sang
  2020-03-26 21:09 ` [PATCH 2/6] media: pci: saa7134: " Wolfram Sang
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Wolfram Sang @ 2020-03-26 21:09 UTC (permalink / raw)
  To: linux-i2c; +Cc: Wolfram Sang, Mauro Carvalho Chehab, linux-media, linux-kernel

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>
---
 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/6] media: pci: saa7134: convert to use i2c_new_client_device()
  2020-03-26 21:09 [PATCH 0/6] media: convert to use new I2C API Wolfram Sang
  2020-03-26 21:09 ` [PATCH 1/6] media: pci: cx88: convert to use i2c_new_client_device() Wolfram Sang
@ 2020-03-26 21:09 ` Wolfram Sang
  2020-03-26 21:09 ` [PATCH 3/6] media: marvell-ccic: " Wolfram Sang
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Wolfram Sang @ 2020-03-26 21:09 UTC (permalink / raw)
  To: linux-i2c; +Cc: Wolfram Sang, Mauro Carvalho Chehab, linux-media, linux-kernel

Move away from the deprecated API.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/media/pci/saa7134/saa7134-input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/pci/saa7134/saa7134-input.c b/drivers/media/pci/saa7134/saa7134-input.c
index 9aea7c30380b..8610eb473b39 100644
--- a/drivers/media/pci/saa7134/saa7134-input.c
+++ b/drivers/media/pci/saa7134/saa7134-input.c
@@ -982,7 +982,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev)
 
 	if (dev->init_data.name)
 		info.platform_data = &dev->init_data;
-	i2c_new_device(&dev->i2c_adap, &info);
+	i2c_new_client_device(&dev->i2c_adap, &info);
 }
 
 static int saa7134_raw_decode_irq(struct saa7134_dev *dev)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/6] media: marvell-ccic: convert to use i2c_new_client_device()
  2020-03-26 21:09 [PATCH 0/6] media: convert to use new I2C API Wolfram Sang
  2020-03-26 21:09 ` [PATCH 1/6] media: pci: cx88: convert to use i2c_new_client_device() Wolfram Sang
  2020-03-26 21:09 ` [PATCH 2/6] media: pci: saa7134: " Wolfram Sang
@ 2020-03-26 21:09 ` Wolfram Sang
  2020-03-26 21:09 ` [PATCH 4/6] media: usb: cx231xx: " Wolfram Sang
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Wolfram Sang @ 2020-03-26 21:09 UTC (permalink / raw)
  To: linux-i2c
  Cc: Wolfram Sang, Jonathan Corbet, Mauro Carvalho Chehab,
	linux-media, linux-kernel

Move away from the deprecated API and return the shiny new ERRPTR where
useful.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/media/platform/marvell-ccic/cafe-driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/marvell-ccic/cafe-driver.c b/drivers/media/platform/marvell-ccic/cafe-driver.c
index 37fdcc53a1c4..9a09a10a3631 100644
--- a/drivers/media/platform/marvell-ccic/cafe-driver.c
+++ b/drivers/media/platform/marvell-ccic/cafe-driver.c
@@ -556,7 +556,7 @@ static int cafe_pci_probe(struct pci_dev *pdev,
 	clkdev_create(mcam->mclk, "xclk", "%d-%04x",
 		i2c_adapter_id(cam->i2c_adapter), ov7670_info.addr);
 
-	if (i2c_new_device(cam->i2c_adapter, &ov7670_info)) {
+	if (!IS_ERR(i2c_new_client_device(cam->i2c_adapter, &ov7670_info))) {
 		cam->registered = 1;
 		return 0;
 	}
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/6] media: usb: cx231xx: convert to use i2c_new_client_device()
  2020-03-26 21:09 [PATCH 0/6] media: convert to use new I2C API Wolfram Sang
                   ` (2 preceding siblings ...)
  2020-03-26 21:09 ` [PATCH 3/6] media: marvell-ccic: " Wolfram Sang
@ 2020-03-26 21:09 ` Wolfram Sang
  2020-03-26 21:09 ` [PATCH 5/6] media: usb: hdpvr: " Wolfram Sang
  2020-03-26 21:09 ` [PATCH 6/6] media: usb: pvrusb2: " Wolfram Sang
  5 siblings, 0 replies; 8+ messages in thread
From: Wolfram Sang @ 2020-03-26 21:09 UTC (permalink / raw)
  To: linux-i2c; +Cc: Wolfram Sang, Mauro Carvalho Chehab, linux-media, linux-kernel

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>
---
 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/6] media: usb: hdpvr: convert to use i2c_new_client_device()
  2020-03-26 21:09 [PATCH 0/6] media: convert to use new I2C API Wolfram Sang
                   ` (3 preceding siblings ...)
  2020-03-26 21:09 ` [PATCH 4/6] media: usb: cx231xx: " Wolfram Sang
@ 2020-03-26 21:09 ` Wolfram Sang
  2020-03-26 21:09 ` [PATCH 6/6] media: usb: pvrusb2: " Wolfram Sang
  5 siblings, 0 replies; 8+ messages in thread
From: Wolfram Sang @ 2020-03-26 21:09 UTC (permalink / raw)
  To: linux-i2c
  Cc: Wolfram Sang, Hans Verkuil, Mauro Carvalho Chehab, linux-media,
	linux-kernel

Move away from the deprecated API and return the shiny new ERRPTR where
useful.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/media/usb/hdpvr/hdpvr-core.c | 4 ++--
 drivers/media/usb/hdpvr/hdpvr-i2c.c  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/usb/hdpvr/hdpvr-core.c b/drivers/media/usb/hdpvr/hdpvr-core.c
index b75c18a012a7..52e05a69c46e 100644
--- a/drivers/media/usb/hdpvr/hdpvr-core.c
+++ b/drivers/media/usb/hdpvr/hdpvr-core.c
@@ -363,9 +363,9 @@ static int hdpvr_probe(struct usb_interface *interface,
 	}
 
 	client = hdpvr_register_ir_i2c(dev);
-	if (!client) {
+	if (IS_ERR(client)) {
 		v4l2_err(&dev->v4l2_dev, "i2c IR device register failed\n");
-		retval = -ENODEV;
+		retval = PTR_ERR(client);
 		goto reg_fail;
 	}
 #endif
diff --git a/drivers/media/usb/hdpvr/hdpvr-i2c.c b/drivers/media/usb/hdpvr/hdpvr-i2c.c
index 785c8508a46e..070559b01b01 100644
--- a/drivers/media/usb/hdpvr/hdpvr-i2c.c
+++ b/drivers/media/usb/hdpvr/hdpvr-i2c.c
@@ -44,7 +44,7 @@ struct i2c_client *hdpvr_register_ir_i2c(struct hdpvr_device *dev)
 	init_data->polling_interval = 405; /* ms, duplicated from Windows */
 	info.platform_data = init_data;
 
-	return i2c_new_device(&dev->i2c_adapter, &info);
+	return i2c_new_client_device(&dev->i2c_adapter, &info);
 }
 
 static int hdpvr_i2c_read(struct hdpvr_device *dev, int bus,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 6/6] media: usb: pvrusb2: convert to use i2c_new_client_device()
  2020-03-26 21:09 [PATCH 0/6] media: convert to use new I2C API Wolfram Sang
                   ` (4 preceding siblings ...)
  2020-03-26 21:09 ` [PATCH 5/6] media: usb: hdpvr: " Wolfram Sang
@ 2020-03-26 21:09 ` Wolfram Sang
  2020-03-29  3:14   ` Mike Isely
  5 siblings, 1 reply; 8+ messages in thread
From: Wolfram Sang @ 2020-03-26 21:09 UTC (permalink / raw)
  To: linux-i2c
  Cc: Wolfram Sang, Mike Isely, Mauro Carvalho Chehab, linux-media,
	linux-kernel

Move away from the deprecated API.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 6/6] media: usb: pvrusb2: convert to use i2c_new_client_device()
  2020-03-26 21:09 ` [PATCH 6/6] media: usb: pvrusb2: " Wolfram Sang
@ 2020-03-29  3:14   ` Mike Isely
  0 siblings, 0 replies; 8+ messages in thread
From: Mike Isely @ 2020-03-29  3:14 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, Mauro Carvalho Chehab, linux-media,
	Linux Kernel Mailing List, Mike Isely


Acked-by: Mike Isely <isely@pobox.com>

On Thu, 26 Mar 2020, Wolfram Sang wrote:

> Move away from the deprecated API.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-03-29  3:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-26 21:09 [PATCH 0/6] media: convert to use new I2C API Wolfram Sang
2020-03-26 21:09 ` [PATCH 1/6] media: pci: cx88: convert to use i2c_new_client_device() Wolfram Sang
2020-03-26 21:09 ` [PATCH 2/6] media: pci: saa7134: " Wolfram Sang
2020-03-26 21:09 ` [PATCH 3/6] media: marvell-ccic: " Wolfram Sang
2020-03-26 21:09 ` [PATCH 4/6] media: usb: cx231xx: " Wolfram Sang
2020-03-26 21:09 ` [PATCH 5/6] media: usb: hdpvr: " Wolfram Sang
2020-03-26 21:09 ` [PATCH 6/6] media: usb: pvrusb2: " Wolfram Sang
2020-03-29  3:14   ` Mike Isely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).