All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 00/12] i2c: replace i2c_new_probed_device with an ERR_PTR variant
@ 2019-11-06  9:50 ` Wolfram Sang
  0 siblings, 0 replies; 47+ messages in thread
From: Wolfram Sang @ 2019-11-06  9:50 UTC (permalink / raw)
  To: linux-i2c
  Cc: Wolfram Sang, dri-devel, linux-fbdev, linux-input, linux-kernel,
	linux-media, linuxppc-dev

From: Wolfram Sang <wsa@the-dreams.de>

In the on-going mission to let i2c_new_* calls return an ERR_PTR instead
of NULL, here is a series converting i2c_new_probed_device(). A new
function called i2c_new_scanned_device() is introduced with the new
retval, but for now, a compatibility helper is provided until all users
are converted. The rest of the patches convert all current in-tree
users.

Note that these patches are RFC because I want feedback on the approach
and hopefully collect acks on the driver conversions. If all goes well,
I'll apply the first two patches for the next merge window. Then, once
this dependency is upstream, I'll resend this series with all issues
fixed and acks collected.

Core changes tested on a Renesas Salvator-XS board (R-Car M3-N), driver
patches build tested by me and buildbot.

Wolfram Sang (12):
  i2c: replace i2c_new_probed_device with an ERR_PTR variant
  i2c: icy: convert to i2c_new_scanned_device
  macintosh: convert to i2c_new_scanned_device
  platform: chrome: convert to i2c_new_scanned_device
  video: fbdev: matrox: convert to i2c_new_scanned_device
  input: mouse: convert to i2c_new_scanned_device
  media: pci: cx23885: convert to i2c_new_scanned_device
  media: pci: cx88: convert to i2c_new_scanned_device
  media: pci: bt8xx: convert to i2c_new_scanned_device
  media: pci: cx18: convert to i2c_new_scanned_device
  media: pci: ivtv: convert to i2c_new_scanned_device
  media: v4l2-core: convert to i2c_new_scanned_device

 Documentation/i2c/instantiating-devices.rst | 10 ++++-----
 Documentation/i2c/writing-clients.rst       |  8 +++----
 drivers/i2c/busses/i2c-icy.c                |  8 +++----
 drivers/i2c/i2c-core-base.c                 | 25 ++++++++++++++++-----
 drivers/input/mouse/psmouse-smbus.c         |  8 ++++---
 drivers/macintosh/therm_windtunnel.c        |  4 ++--
 drivers/media/pci/bt8xx/bttv-input.c        |  6 ++---
 drivers/media/pci/cx18/cx18-i2c.c           |  2 +-
 drivers/media/pci/cx23885/cx23885-i2c.c     |  4 ++--
 drivers/media/pci/cx88/cx88-input.c         |  2 +-
 drivers/media/pci/ivtv/ivtv-i2c.c           |  6 ++---
 drivers/media/pci/ivtv/ivtv-i2c.h           |  2 +-
 drivers/media/v4l2-core/v4l2-i2c.c          | 10 ++++-----
 drivers/platform/chrome/chromeos_laptop.c   | 18 ++++++++-------
 drivers/video/fbdev/matrox/i2c-matroxfb.c   |  4 ++--
 include/linux/i2c.h                         | 12 +++++++---
 16 files changed, 76 insertions(+), 53 deletions(-)

-- 
2.20.1


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

* [RFC PATCH 00/12] i2c: replace i2c_new_probed_device with an ERR_PTR variant
@ 2019-11-06  9:50 ` Wolfram Sang
  0 siblings, 0 replies; 47+ messages in thread
From: Wolfram Sang @ 2019-11-06  9:50 UTC (permalink / raw)
  To: linux-i2c
  Cc: Wolfram Sang, dri-devel, linux-fbdev, linux-input, linux-kernel,
	linux-media, linuxppc-dev

From: Wolfram Sang <wsa@the-dreams.de>

In the on-going mission to let i2c_new_* calls return an ERR_PTR instead
of NULL, here is a series converting i2c_new_probed_device(). A new
function called i2c_new_scanned_device() is introduced with the new
retval, but for now, a compatibility helper is provided until all users
are converted. The rest of the patches convert all current in-tree
users.

Note that these patches are RFC because I want feedback on the approach
and hopefully collect acks on the driver conversions. If all goes well,
I'll apply the first two patches for the next merge window. Then, once
this dependency is upstream, I'll resend this series with all issues
fixed and acks collected.

Core changes tested on a Renesas Salvator-XS board (R-Car M3-N), driver
patches build tested by me and buildbot.

Wolfram Sang (12):
  i2c: replace i2c_new_probed_device with an ERR_PTR variant
  i2c: icy: convert to i2c_new_scanned_device
  macintosh: convert to i2c_new_scanned_device
  platform: chrome: convert to i2c_new_scanned_device
  video: fbdev: matrox: convert to i2c_new_scanned_device
  input: mouse: convert to i2c_new_scanned_device
  media: pci: cx23885: convert to i2c_new_scanned_device
  media: pci: cx88: convert to i2c_new_scanned_device
  media: pci: bt8xx: convert to i2c_new_scanned_device
  media: pci: cx18: convert to i2c_new_scanned_device
  media: pci: ivtv: convert to i2c_new_scanned_device
  media: v4l2-core: convert to i2c_new_scanned_device

 Documentation/i2c/instantiating-devices.rst | 10 ++++-----
 Documentation/i2c/writing-clients.rst       |  8 +++----
 drivers/i2c/busses/i2c-icy.c                |  8 +++----
 drivers/i2c/i2c-core-base.c                 | 25 ++++++++++++++++-----
 drivers/input/mouse/psmouse-smbus.c         |  8 ++++---
 drivers/macintosh/therm_windtunnel.c        |  4 ++--
 drivers/media/pci/bt8xx/bttv-input.c        |  6 ++---
 drivers/media/pci/cx18/cx18-i2c.c           |  2 +-
 drivers/media/pci/cx23885/cx23885-i2c.c     |  4 ++--
 drivers/media/pci/cx88/cx88-input.c         |  2 +-
 drivers/media/pci/ivtv/ivtv-i2c.c           |  6 ++---
 drivers/media/pci/ivtv/ivtv-i2c.h           |  2 +-
 drivers/media/v4l2-core/v4l2-i2c.c          | 10 ++++-----
 drivers/platform/chrome/chromeos_laptop.c   | 18 ++++++++-------
 drivers/video/fbdev/matrox/i2c-matroxfb.c   |  4 ++--
 include/linux/i2c.h                         | 12 +++++++---
 16 files changed, 76 insertions(+), 53 deletions(-)

-- 
2.20.1

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

* [RFC PATCH 00/12] i2c: replace i2c_new_probed_device with an ERR_PTR variant
@ 2019-11-06  9:50 ` Wolfram Sang
  0 siblings, 0 replies; 47+ messages in thread
From: Wolfram Sang @ 2019-11-06  9:50 UTC (permalink / raw)
  To: linux-i2c
  Cc: linux-fbdev, Wolfram Sang, linux-kernel, dri-devel, linux-input,
	linuxppc-dev, linux-media

From: Wolfram Sang <wsa@the-dreams.de>

In the on-going mission to let i2c_new_* calls return an ERR_PTR instead
of NULL, here is a series converting i2c_new_probed_device(). A new
function called i2c_new_scanned_device() is introduced with the new
retval, but for now, a compatibility helper is provided until all users
are converted. The rest of the patches convert all current in-tree
users.

Note that these patches are RFC because I want feedback on the approach
and hopefully collect acks on the driver conversions. If all goes well,
I'll apply the first two patches for the next merge window. Then, once
this dependency is upstream, I'll resend this series with all issues
fixed and acks collected.

Core changes tested on a Renesas Salvator-XS board (R-Car M3-N), driver
patches build tested by me and buildbot.

Wolfram Sang (12):
  i2c: replace i2c_new_probed_device with an ERR_PTR variant
  i2c: icy: convert to i2c_new_scanned_device
  macintosh: convert to i2c_new_scanned_device
  platform: chrome: convert to i2c_new_scanned_device
  video: fbdev: matrox: convert to i2c_new_scanned_device
  input: mouse: convert to i2c_new_scanned_device
  media: pci: cx23885: convert to i2c_new_scanned_device
  media: pci: cx88: convert to i2c_new_scanned_device
  media: pci: bt8xx: convert to i2c_new_scanned_device
  media: pci: cx18: convert to i2c_new_scanned_device
  media: pci: ivtv: convert to i2c_new_scanned_device
  media: v4l2-core: convert to i2c_new_scanned_device

 Documentation/i2c/instantiating-devices.rst | 10 ++++-----
 Documentation/i2c/writing-clients.rst       |  8 +++----
 drivers/i2c/busses/i2c-icy.c                |  8 +++----
 drivers/i2c/i2c-core-base.c                 | 25 ++++++++++++++++-----
 drivers/input/mouse/psmouse-smbus.c         |  8 ++++---
 drivers/macintosh/therm_windtunnel.c        |  4 ++--
 drivers/media/pci/bt8xx/bttv-input.c        |  6 ++---
 drivers/media/pci/cx18/cx18-i2c.c           |  2 +-
 drivers/media/pci/cx23885/cx23885-i2c.c     |  4 ++--
 drivers/media/pci/cx88/cx88-input.c         |  2 +-
 drivers/media/pci/ivtv/ivtv-i2c.c           |  6 ++---
 drivers/media/pci/ivtv/ivtv-i2c.h           |  2 +-
 drivers/media/v4l2-core/v4l2-i2c.c          | 10 ++++-----
 drivers/platform/chrome/chromeos_laptop.c   | 18 ++++++++-------
 drivers/video/fbdev/matrox/i2c-matroxfb.c   |  4 ++--
 include/linux/i2c.h                         | 12 +++++++---
 16 files changed, 76 insertions(+), 53 deletions(-)

-- 
2.20.1


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

* [RFC PATCH 00/12] i2c: replace i2c_new_probed_device with an ERR_PTR variant
@ 2019-11-06  9:50 ` Wolfram Sang
  0 siblings, 0 replies; 47+ messages in thread
From: Wolfram Sang @ 2019-11-06  9:50 UTC (permalink / raw)
  To: linux-i2c
  Cc: linux-fbdev, Wolfram Sang, linux-kernel, dri-devel, linux-input,
	linuxppc-dev, linux-media

From: Wolfram Sang <wsa@the-dreams.de>

In the on-going mission to let i2c_new_* calls return an ERR_PTR instead
of NULL, here is a series converting i2c_new_probed_device(). A new
function called i2c_new_scanned_device() is introduced with the new
retval, but for now, a compatibility helper is provided until all users
are converted. The rest of the patches convert all current in-tree
users.

Note that these patches are RFC because I want feedback on the approach
and hopefully collect acks on the driver conversions. If all goes well,
I'll apply the first two patches for the next merge window. Then, once
this dependency is upstream, I'll resend this series with all issues
fixed and acks collected.

Core changes tested on a Renesas Salvator-XS board (R-Car M3-N), driver
patches build tested by me and buildbot.

Wolfram Sang (12):
  i2c: replace i2c_new_probed_device with an ERR_PTR variant
  i2c: icy: convert to i2c_new_scanned_device
  macintosh: convert to i2c_new_scanned_device
  platform: chrome: convert to i2c_new_scanned_device
  video: fbdev: matrox: convert to i2c_new_scanned_device
  input: mouse: convert to i2c_new_scanned_device
  media: pci: cx23885: convert to i2c_new_scanned_device
  media: pci: cx88: convert to i2c_new_scanned_device
  media: pci: bt8xx: convert to i2c_new_scanned_device
  media: pci: cx18: convert to i2c_new_scanned_device
  media: pci: ivtv: convert to i2c_new_scanned_device
  media: v4l2-core: convert to i2c_new_scanned_device

 Documentation/i2c/instantiating-devices.rst | 10 ++++-----
 Documentation/i2c/writing-clients.rst       |  8 +++----
 drivers/i2c/busses/i2c-icy.c                |  8 +++----
 drivers/i2c/i2c-core-base.c                 | 25 ++++++++++++++++-----
 drivers/input/mouse/psmouse-smbus.c         |  8 ++++---
 drivers/macintosh/therm_windtunnel.c        |  4 ++--
 drivers/media/pci/bt8xx/bttv-input.c        |  6 ++---
 drivers/media/pci/cx18/cx18-i2c.c           |  2 +-
 drivers/media/pci/cx23885/cx23885-i2c.c     |  4 ++--
 drivers/media/pci/cx88/cx88-input.c         |  2 +-
 drivers/media/pci/ivtv/ivtv-i2c.c           |  6 ++---
 drivers/media/pci/ivtv/ivtv-i2c.h           |  2 +-
 drivers/media/v4l2-core/v4l2-i2c.c          | 10 ++++-----
 drivers/platform/chrome/chromeos_laptop.c   | 18 ++++++++-------
 drivers/video/fbdev/matrox/i2c-matroxfb.c   |  4 ++--
 include/linux/i2c.h                         | 12 +++++++---
 16 files changed, 76 insertions(+), 53 deletions(-)

-- 
2.20.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [RFC PATCH 01/12] i2c: replace i2c_new_probed_device with an ERR_PTR variant
  2019-11-06  9:50 ` Wolfram Sang
                   ` (2 preceding siblings ...)
  (?)
@ 2019-11-06  9:50 ` Wolfram Sang
  2019-11-06 12:39   ` Max Staudt
                     ` (2 more replies)
  -1 siblings, 3 replies; 47+ messages in thread
From: Wolfram Sang @ 2019-11-06  9:50 UTC (permalink / raw)
  To: linux-i2c; +Cc: Wolfram Sang, Wolfram Sang, linux-kernel

In the general move to have i2c_new_*_device functions which return
ERR_PTR instead of NULL, this patch converts i2c_new_probed_device().

There are only few users, so this patch converts the I2C core and all
users in one go. The function gets renamed to i2c_new_scanned_device()
so out-of-tree users will get a build failure to understand they need to
adapt their error checking code.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 Documentation/i2c/instantiating-devices.rst | 10 ++++-----
 Documentation/i2c/writing-clients.rst       |  8 +++----
 drivers/i2c/i2c-core-base.c                 | 25 ++++++++++++++++-----
 include/linux/i2c.h                         | 12 +++++++---
 4 files changed, 37 insertions(+), 18 deletions(-)

diff --git a/Documentation/i2c/instantiating-devices.rst b/Documentation/i2c/instantiating-devices.rst
index 1238f1fa3382..875ebe9e78e3 100644
--- a/Documentation/i2c/instantiating-devices.rst
+++ b/Documentation/i2c/instantiating-devices.rst
@@ -123,7 +123,7 @@ present or not (for example for an optional feature which is not present
 on cheap variants of a board but you have no way to tell them apart), or
 it may have different addresses from one board to the next (manufacturer
 changing its design without notice). In this case, you can call
-i2c_new_probed_device() instead of i2c_new_device().
+i2c_new_scanned_device() instead of i2c_new_device().
 
 Example (from the nxp OHCI driver)::
 
@@ -139,8 +139,8 @@ Example (from the nxp OHCI driver)::
 	i2c_adap = i2c_get_adapter(2);
 	memset(&i2c_info, 0, sizeof(struct i2c_board_info));
 	strscpy(i2c_info.type, "isp1301_nxp", sizeof(i2c_info.type));
-	isp1301_i2c_client = i2c_new_probed_device(i2c_adap, &i2c_info,
-						   normal_i2c, NULL);
+	isp1301_i2c_client = i2c_new_scanned_device(i2c_adap, &i2c_info,
+						    normal_i2c, NULL);
 	i2c_put_adapter(i2c_adap);
 	(...)
   }
@@ -153,14 +153,14 @@ simply gives up.
 The driver which instantiated the I2C device is responsible for destroying
 it on cleanup. This is done by calling i2c_unregister_device() on the
 pointer that was earlier returned by i2c_new_device() or
-i2c_new_probed_device().
+i2c_new_scanned_device().
 
 
 Method 3: Probe an I2C bus for certain devices
 ----------------------------------------------
 
 Sometimes you do not have enough information about an I2C device, not even
-to call i2c_new_probed_device(). The typical case is hardware monitoring
+to call i2c_new_scanned_device(). The typical case is hardware monitoring
 chips on PC mainboards. There are several dozen models, which can live
 at 25 different addresses. Given the huge number of mainboards out there,
 it is next to impossible to build an exhaustive list of the hardware
diff --git a/Documentation/i2c/writing-clients.rst b/Documentation/i2c/writing-clients.rst
index dddf0a14ab7c..ced309b5e0cc 100644
--- a/Documentation/i2c/writing-clients.rst
+++ b/Documentation/i2c/writing-clients.rst
@@ -185,14 +185,14 @@ Sometimes you know that a device is connected to a given I2C bus, but you
 don't know the exact address it uses.  This happens on TV adapters for
 example, where the same driver supports dozens of slightly different
 models, and I2C device addresses change from one model to the next.  In
-that case, you can use the i2c_new_probed_device() variant, which is
+that case, you can use the i2c_new_scanned_device() variant, which is
 similar to i2c_new_device(), except that it takes an additional list of
 possible I2C addresses to probe.  A device is created for the first
 responsive address in the list.  If you expect more than one device to be
-present in the address range, simply call i2c_new_probed_device() that
+present in the address range, simply call i2c_new_scanned_device() that
 many times.
 
-The call to i2c_new_device() or i2c_new_probed_device() typically happens
+The call to i2c_new_device() or i2c_new_scanned_device() typically happens
 in the I2C bus driver. You may want to save the returned i2c_client
 reference for later use.
 
@@ -237,7 +237,7 @@ Device Deletion
 ---------------
 
 Each I2C device which has been created using i2c_new_device() or
-i2c_new_probed_device() can be unregistered by calling
+i2c_new_scanned_device() can be unregistered by calling
 i2c_unregister_device().  If you don't call it explicitly, it will be
 called automatically before the underlying I2C bus itself is removed, as a
 device can't survive its parent in the device driver model.
diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index 6a5183cffdfc..380bde2dc23e 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -2277,10 +2277,10 @@ int i2c_probe_func_quick_read(struct i2c_adapter *adap, unsigned short addr)
 EXPORT_SYMBOL_GPL(i2c_probe_func_quick_read);
 
 struct i2c_client *
-i2c_new_probed_device(struct i2c_adapter *adap,
-		      struct i2c_board_info *info,
-		      unsigned short const *addr_list,
-		      int (*probe)(struct i2c_adapter *adap, unsigned short addr))
+i2c_new_scanned_device(struct i2c_adapter *adap,
+		       struct i2c_board_info *info,
+		       unsigned short const *addr_list,
+		       int (*probe)(struct i2c_adapter *adap, unsigned short addr))
 {
 	int i;
 
@@ -2310,11 +2310,24 @@ i2c_new_probed_device(struct i2c_adapter *adap,
 
 	if (addr_list[i] == I2C_CLIENT_END) {
 		dev_dbg(&adap->dev, "Probing failed, no device found\n");
-		return NULL;
+		return ERR_PTR(-ENODEV);
 	}
 
 	info->addr = addr_list[i];
-	return i2c_new_device(adap, info);
+	return i2c_new_client_device(adap, info);
+}
+EXPORT_SYMBOL_GPL(i2c_new_scanned_device);
+
+struct i2c_client *
+i2c_new_probed_device(struct i2c_adapter *adap,
+		      struct i2c_board_info *info,
+		      unsigned short const *addr_list,
+		      int (*probe)(struct i2c_adapter *adap, unsigned short addr))
+{
+	struct i2c_client *client;
+
+	client = i2c_new_scanned_device(adap, info, addr_list, probe);
+	return IS_ERR(client) ? NULL : client;
 }
 EXPORT_SYMBOL_GPL(i2c_new_probed_device);
 
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index aaf57d9b41db..df3044513464 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -452,10 +452,16 @@ i2c_new_client_device(struct i2c_adapter *adap, struct i2c_board_info const *inf
  * a default probing method is used.
  */
 extern struct i2c_client *
+i2c_new_scanned_device(struct i2c_adapter *adap,
+		       struct i2c_board_info *info,
+		       unsigned short const *addr_list,
+		       int (*probe)(struct i2c_adapter *adap, unsigned short addr));
+
+extern struct i2c_client *
 i2c_new_probed_device(struct i2c_adapter *adap,
-		      struct i2c_board_info *info,
-		      unsigned short const *addr_list,
-		      int (*probe)(struct i2c_adapter *adap, unsigned short addr));
+		       struct i2c_board_info *info,
+		       unsigned short const *addr_list,
+		       int (*probe)(struct i2c_adapter *adap, unsigned short addr));
 
 /* Common custom probe functions */
 extern int i2c_probe_func_quick_read(struct i2c_adapter *adap, unsigned short addr);
-- 
2.20.1


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

* [RFC PATCH 02/12] i2c: icy: convert to i2c_new_scanned_device
  2019-11-06  9:50 ` Wolfram Sang
                   ` (3 preceding siblings ...)
  (?)
@ 2019-11-06  9:50 ` Wolfram Sang
  2019-11-06 11:33   ` Max Staudt
  2019-11-28 16:16   ` Wolfram Sang
  -1 siblings, 2 replies; 47+ messages in thread
From: Wolfram Sang @ 2019-11-06  9:50 UTC (permalink / raw)
  To: linux-i2c; +Cc: Wolfram Sang, Max Staudt, linux-kernel

Move from the deprecated i2c_new_probed_device() to the new
i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/busses/i2c-icy.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-icy.c b/drivers/i2c/busses/i2c-icy.c
index 8382eb64b424..07baa4d8de39 100644
--- a/drivers/i2c/busses/i2c-icy.c
+++ b/drivers/i2c/busses/i2c-icy.c
@@ -188,10 +188,10 @@ static int icy_probe(struct zorro_dev *z,
 		ltc2990_info.fwnode = new_fwnode;
 
 		i2c->ltc2990_client =
-			i2c_new_probed_device(&i2c->adapter,
-					      &ltc2990_info,
-					      icy_ltc2990_addresses,
-					      NULL);
+			i2c_new_scanned_device(&i2c->adapter,
+					       &ltc2990_info,
+					       icy_ltc2990_addresses,
+					       NULL);
 	}
 
 	return 0;
-- 
2.20.1


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

* [RFC PATCH 03/12] macintosh: convert to i2c_new_scanned_device
  2019-11-06  9:50 ` Wolfram Sang
@ 2019-11-06  9:50   ` Wolfram Sang
  -1 siblings, 0 replies; 47+ messages in thread
From: Wolfram Sang @ 2019-11-06  9:50 UTC (permalink / raw)
  To: linux-i2c
  Cc: Wolfram Sang, Benjamin Herrenschmidt, linuxppc-dev, linux-kernel

Move from the deprecated i2c_new_probed_device() to the new
i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Build tested only. RFC, please comment and/or ack, but don't apply yet.

 drivers/macintosh/therm_windtunnel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c
index 8c744578122a..f15fec5e1cb6 100644
--- a/drivers/macintosh/therm_windtunnel.c
+++ b/drivers/macintosh/therm_windtunnel.c
@@ -321,10 +321,10 @@ do_attach( struct i2c_adapter *adapter )
 
 		memset(&info, 0, sizeof(struct i2c_board_info));
 		strlcpy(info.type, "therm_ds1775", I2C_NAME_SIZE);
-		i2c_new_probed_device(adapter, &info, scan_ds1775, NULL);
+		i2c_new_scanned_device(adapter, &info, scan_ds1775, NULL);
 
 		strlcpy(info.type, "therm_adm1030", I2C_NAME_SIZE);
-		i2c_new_probed_device(adapter, &info, scan_adm1030, NULL);
+		i2c_new_scanned_device(adapter, &info, scan_adm1030, NULL);
 
 		if( x.thermostat && x.fan ) {
 			x.running = 1;
-- 
2.20.1


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

* [RFC PATCH 03/12] macintosh: convert to i2c_new_scanned_device
@ 2019-11-06  9:50   ` Wolfram Sang
  0 siblings, 0 replies; 47+ messages in thread
From: Wolfram Sang @ 2019-11-06  9:50 UTC (permalink / raw)
  To: linux-i2c; +Cc: Wolfram Sang, linuxppc-dev, linux-kernel

Move from the deprecated i2c_new_probed_device() to the new
i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Build tested only. RFC, please comment and/or ack, but don't apply yet.

 drivers/macintosh/therm_windtunnel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c
index 8c744578122a..f15fec5e1cb6 100644
--- a/drivers/macintosh/therm_windtunnel.c
+++ b/drivers/macintosh/therm_windtunnel.c
@@ -321,10 +321,10 @@ do_attach( struct i2c_adapter *adapter )
 
 		memset(&info, 0, sizeof(struct i2c_board_info));
 		strlcpy(info.type, "therm_ds1775", I2C_NAME_SIZE);
-		i2c_new_probed_device(adapter, &info, scan_ds1775, NULL);
+		i2c_new_scanned_device(adapter, &info, scan_ds1775, NULL);
 
 		strlcpy(info.type, "therm_adm1030", I2C_NAME_SIZE);
-		i2c_new_probed_device(adapter, &info, scan_adm1030, NULL);
+		i2c_new_scanned_device(adapter, &info, scan_adm1030, NULL);
 
 		if( x.thermostat && x.fan ) {
 			x.running = 1;
-- 
2.20.1


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

* [RFC PATCH 04/12] platform: chrome: convert to i2c_new_scanned_device
  2019-11-06  9:50 ` Wolfram Sang
                   ` (5 preceding siblings ...)
  (?)
@ 2019-11-06  9:50 ` Wolfram Sang
  -1 siblings, 0 replies; 47+ messages in thread
From: Wolfram Sang @ 2019-11-06  9:50 UTC (permalink / raw)
  To: linux-i2c
  Cc: Wolfram Sang, Benson Leung, Enric Balletbo i Serra, linux-kernel

Move from the deprecated i2c_new_probed_device() to the new
i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Build tested only. RFC, please comment and/or ack, but don't apply yet.

 drivers/platform/chrome/chromeos_laptop.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/platform/chrome/chromeos_laptop.c b/drivers/platform/chrome/chromeos_laptop.c
index 8723bcf10c93..4f3651fcd9fe 100644
--- a/drivers/platform/chrome/chromeos_laptop.c
+++ b/drivers/platform/chrome/chromeos_laptop.c
@@ -63,7 +63,7 @@ struct acpi_peripheral {
 struct chromeos_laptop {
 	/*
 	 * Note that we can't mark this pointer as const because
-	 * i2c_new_probed_device() changes passed in I2C board info, so.
+	 * i2c_new_scanned_device() changes passed in I2C board info, so.
 	 */
 	struct i2c_peripheral *i2c_peripherals;
 	unsigned int num_i2c_peripherals;
@@ -87,8 +87,8 @@ chromes_laptop_instantiate_i2c_device(struct i2c_adapter *adapter,
 	 * address we scan secondary addresses. In any case the client
 	 * structure gets assigned primary address.
 	 */
-	client = i2c_new_probed_device(adapter, info, addr_list, NULL);
-	if (!client && alt_addr) {
+	client = i2c_new_scanned_device(adapter, info, addr_list, NULL);
+	if (IS_ERR(client) && alt_addr) {
 		struct i2c_board_info dummy_info = {
 			I2C_BOARD_INFO("dummy", info->addr),
 		};
@@ -97,9 +97,9 @@ chromes_laptop_instantiate_i2c_device(struct i2c_adapter *adapter,
 		};
 		struct i2c_client *dummy;
 
-		dummy = i2c_new_probed_device(adapter, &dummy_info,
-					      alt_addr_list, NULL);
-		if (dummy) {
+		dummy = i2c_new_scanned_device(adapter, &dummy_info,
+					       alt_addr_list, NULL);
+		if (!IS_ERR(dummy)) {
 			pr_debug("%d-%02x is probed at %02x\n",
 				 adapter->nr, info->addr, dummy->addr);
 			i2c_unregister_device(dummy);
@@ -107,12 +107,14 @@ chromes_laptop_instantiate_i2c_device(struct i2c_adapter *adapter,
 		}
 	}
 
-	if (!client)
+	if (IS_ERR(client)) {
+		client = NULL;
 		pr_debug("failed to register device %d-%02x\n",
 			 adapter->nr, info->addr);
-	else
+	} else {
 		pr_debug("added i2c device %d-%02x\n",
 			 adapter->nr, info->addr);
+	}
 
 	return client;
 }
-- 
2.20.1


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

* [RFC PATCH 05/12] video: fbdev: matrox: convert to i2c_new_scanned_device
  2019-11-06  9:50 ` Wolfram Sang
  (?)
@ 2019-11-06  9:50   ` Wolfram Sang
  -1 siblings, 0 replies; 47+ messages in thread
From: Wolfram Sang @ 2019-11-06  9:50 UTC (permalink / raw)
  To: linux-i2c
  Cc: Wolfram Sang, Bartlomiej Zolnierkiewicz, dri-devel, linux-fbdev,
	linux-kernel

Move from the deprecated i2c_new_probed_device() to the new
i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Build tested only. RFC, please comment and/or ack, but don't apply yet.

 drivers/video/fbdev/matrox/i2c-matroxfb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/matrox/i2c-matroxfb.c b/drivers/video/fbdev/matrox/i2c-matroxfb.c
index 34e2659c3189..e2e4705e3fe0 100644
--- a/drivers/video/fbdev/matrox/i2c-matroxfb.c
+++ b/drivers/video/fbdev/matrox/i2c-matroxfb.c
@@ -191,8 +191,8 @@ static void* i2c_matroxfb_probe(struct matrox_fb_info* minfo) {
 				0x1b, I2C_CLIENT_END
 			};
 
-			i2c_new_probed_device(&m2info->maven.adapter,
-					      &maven_info, addr_list, NULL);
+			i2c_new_scanned_device(&m2info->maven.adapter,
+					       &maven_info, addr_list, NULL);
 		}
 	}
 	return m2info;
-- 
2.20.1


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

* [RFC PATCH 05/12] video: fbdev: matrox: convert to i2c_new_scanned_device
@ 2019-11-06  9:50   ` Wolfram Sang
  0 siblings, 0 replies; 47+ messages in thread
From: Wolfram Sang @ 2019-11-06  9:50 UTC (permalink / raw)
  To: linux-i2c
  Cc: Wolfram Sang, Bartlomiej Zolnierkiewicz, dri-devel, linux-fbdev,
	linux-kernel

Move from the deprecated i2c_new_probed_device() to the new
i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Build tested only. RFC, please comment and/or ack, but don't apply yet.

 drivers/video/fbdev/matrox/i2c-matroxfb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/matrox/i2c-matroxfb.c b/drivers/video/fbdev/matrox/i2c-matroxfb.c
index 34e2659c3189..e2e4705e3fe0 100644
--- a/drivers/video/fbdev/matrox/i2c-matroxfb.c
+++ b/drivers/video/fbdev/matrox/i2c-matroxfb.c
@@ -191,8 +191,8 @@ static void* i2c_matroxfb_probe(struct matrox_fb_info* minfo) {
 				0x1b, I2C_CLIENT_END
 			};
 
-			i2c_new_probed_device(&m2info->maven.adapter,
-					      &maven_info, addr_list, NULL);
+			i2c_new_scanned_device(&m2info->maven.adapter,
+					       &maven_info, addr_list, NULL);
 		}
 	}
 	return m2info;
-- 
2.20.1

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

* [RFC PATCH 05/12] video: fbdev: matrox: convert to i2c_new_scanned_device
@ 2019-11-06  9:50   ` Wolfram Sang
  0 siblings, 0 replies; 47+ messages in thread
From: Wolfram Sang @ 2019-11-06  9:50 UTC (permalink / raw)
  To: linux-i2c
  Cc: Wolfram Sang, linux-fbdev, linux-kernel, dri-devel,
	Bartlomiej Zolnierkiewicz

Move from the deprecated i2c_new_probed_device() to the new
i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Build tested only. RFC, please comment and/or ack, but don't apply yet.

 drivers/video/fbdev/matrox/i2c-matroxfb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/matrox/i2c-matroxfb.c b/drivers/video/fbdev/matrox/i2c-matroxfb.c
index 34e2659c3189..e2e4705e3fe0 100644
--- a/drivers/video/fbdev/matrox/i2c-matroxfb.c
+++ b/drivers/video/fbdev/matrox/i2c-matroxfb.c
@@ -191,8 +191,8 @@ static void* i2c_matroxfb_probe(struct matrox_fb_info* minfo) {
 				0x1b, I2C_CLIENT_END
 			};
 
-			i2c_new_probed_device(&m2info->maven.adapter,
-					      &maven_info, addr_list, NULL);
+			i2c_new_scanned_device(&m2info->maven.adapter,
+					       &maven_info, addr_list, NULL);
 		}
 	}
 	return m2info;
-- 
2.20.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [RFC PATCH 06/12] input: mouse: convert to i2c_new_scanned_device
  2019-11-06  9:50 ` Wolfram Sang
                   ` (7 preceding siblings ...)
  (?)
@ 2019-11-06  9:50 ` Wolfram Sang
  2019-11-11 18:19   ` Dmitry Torokhov
  -1 siblings, 1 reply; 47+ messages in thread
From: Wolfram Sang @ 2019-11-06  9:50 UTC (permalink / raw)
  To: linux-i2c; +Cc: Wolfram Sang, Dmitry Torokhov, linux-input, linux-kernel

Move from the deprecated i2c_new_probed_device() to the new
i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Build tested only. RFC, please comment and/or ack, but don't apply yet.

 drivers/input/mouse/psmouse-smbus.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/input/mouse/psmouse-smbus.c b/drivers/input/mouse/psmouse-smbus.c
index 027efdd2b2ad..35bf50a871d2 100644
--- a/drivers/input/mouse/psmouse-smbus.c
+++ b/drivers/input/mouse/psmouse-smbus.c
@@ -198,10 +198,12 @@ static int psmouse_smbus_create_companion(struct device *dev, void *data)
 	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_HOST_NOTIFY))
 		return 0;
 
-	smbdev->client = i2c_new_probed_device(adapter, &smbdev->board,
-					       addr_list, NULL);
-	if (!smbdev->client)
+	smbdev->client = i2c_new_scanned_device(adapter, &smbdev->board,
+					        addr_list, NULL);
+	if (IS_ERR(smbdev->client)) {
+		smbdev->client = NULL;
 		return 0;
+	}
 
 	/* We have our(?) device, stop iterating i2c bus. */
 	return 1;
-- 
2.20.1


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

* [RFC PATCH 07/12] media: pci: cx23885: convert to i2c_new_scanned_device
  2019-11-06  9:50 ` Wolfram Sang
                   ` (8 preceding siblings ...)
  (?)
@ 2019-11-06  9:50 ` Wolfram Sang
  2019-11-06 11:18   ` Hans Verkuil
  -1 siblings, 1 reply; 47+ messages in thread
From: Wolfram Sang @ 2019-11-06  9:50 UTC (permalink / raw)
  To: linux-i2c; +Cc: Wolfram Sang, Mauro Carvalho Chehab, linux-media, linux-kernel

Move from the deprecated i2c_new_probed_device() to the new
i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Build tested only. RFC, please comment and/or ack, but don't apply yet.

 drivers/media/pci/cx23885/cx23885-i2c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/pci/cx23885/cx23885-i2c.c b/drivers/media/pci/cx23885/cx23885-i2c.c
index 4f327ee9659e..f51fad33dc04 100644
--- a/drivers/media/pci/cx23885/cx23885-i2c.c
+++ b/drivers/media/pci/cx23885/cx23885-i2c.c
@@ -337,8 +337,8 @@ int cx23885_i2c_register(struct cx23885_i2c *bus)
 		strscpy(info.type, "ir_video", I2C_NAME_SIZE);
 		/* Use quick read command for probe, some IR chips don't
 		 * support writes */
-		i2c_new_probed_device(&bus->i2c_adap, &info, addr_list,
-				      i2c_probe_func_quick_read);
+		i2c_new_scanned_device(&bus->i2c_adap, &info, addr_list,
+				       i2c_probe_func_quick_read);
 	}
 
 	return bus->i2c_rc;
-- 
2.20.1


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

* [RFC PATCH 08/12] media: pci: cx88: convert to i2c_new_scanned_device
  2019-11-06  9:50 ` Wolfram Sang
                   ` (9 preceding siblings ...)
  (?)
@ 2019-11-06  9:50 ` Wolfram Sang
  2019-11-06 11:18   ` Hans Verkuil
  -1 siblings, 1 reply; 47+ messages in thread
From: Wolfram Sang @ 2019-11-06  9:50 UTC (permalink / raw)
  To: linux-i2c; +Cc: Wolfram Sang, Mauro Carvalho Chehab, linux-media, linux-kernel

Move from the deprecated i2c_new_probed_device() to the new
i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Build tested only. RFC, please comment and/or ack, but don't apply yet.

 drivers/media/pci/cx88/cx88-input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/pci/cx88/cx88-input.c b/drivers/media/pci/cx88/cx88-input.c
index 589f52d961eb..c7c2acd55266 100644
--- a/drivers/media/pci/cx88/cx88-input.c
+++ b/drivers/media/pci/cx88/cx88-input.c
@@ -613,7 +613,7 @@ void cx88_i2c_init_ir(struct cx88_core *core)
 	}
 
 	/*
-	 * We can't call i2c_new_probed_device() because it uses
+	 * We can't call i2c_new_scanned_device() because it uses
 	 * quick writes for probing and at least some RC receiver
 	 * devices only reply to reads.
 	 * Also, Hauppauge XVR needs to be specified, as address 0x71
-- 
2.20.1


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

* [RFC PATCH 09/12] media: pci: bt8xx: convert to i2c_new_scanned_device
  2019-11-06  9:50 ` Wolfram Sang
                   ` (10 preceding siblings ...)
  (?)
@ 2019-11-06  9:50 ` Wolfram Sang
  2019-11-06 11:19   ` Hans Verkuil
  -1 siblings, 1 reply; 47+ messages in thread
From: Wolfram Sang @ 2019-11-06  9:50 UTC (permalink / raw)
  To: linux-i2c; +Cc: Wolfram Sang, Mauro Carvalho Chehab, linux-media, linux-kernel

Move from the deprecated i2c_new_probed_device() to the new
i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Build tested only. RFC, please comment and/or ack, but don't apply yet.

 drivers/media/pci/bt8xx/bttv-input.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/pci/bt8xx/bttv-input.c b/drivers/media/pci/bt8xx/bttv-input.c
index 492bc85c2700..41226f1d0e5b 100644
--- a/drivers/media/pci/bt8xx/bttv-input.c
+++ b/drivers/media/pci/bt8xx/bttv-input.c
@@ -386,7 +386,7 @@ void init_bttv_i2c_ir(struct bttv *btv)
 
 	if (btv->init_data.name) {
 		info.platform_data = &btv->init_data;
-		i2c_dev = i2c_new_device(&btv->c.i2c_adap, &info);
+		i2c_dev = i2c_new_client_device(&btv->c.i2c_adap, &info);
 	} else {
 		/*
 		 * The external IR receiver is at i2c address 0x34 (0x35 for
@@ -396,9 +396,9 @@ void init_bttv_i2c_ir(struct bttv *btv)
 		 * internal.
 		 * That's why we probe 0x1a (~0x34) first. CB
 		 */
-		i2c_dev = i2c_new_probed_device(&btv->c.i2c_adap, &info, addr_list, NULL);
+		i2c_dev = i2c_new_scanned_device(&btv->c.i2c_adap, &info, addr_list, NULL);
 	}
-	if (NULL == i2c_dev)
+	if (IS_ERR(i2c_dev))
 		return;
 
 #if defined(CONFIG_MODULES) && defined(MODULE)
-- 
2.20.1


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

* [RFC PATCH 10/12] media: pci: cx18: convert to i2c_new_scanned_device
  2019-11-06  9:50 ` Wolfram Sang
                   ` (11 preceding siblings ...)
  (?)
@ 2019-11-06  9:50 ` Wolfram Sang
  2019-11-06 11:23   ` Hans Verkuil
  -1 siblings, 1 reply; 47+ messages in thread
From: Wolfram Sang @ 2019-11-06  9:50 UTC (permalink / raw)
  To: linux-i2c
  Cc: Wolfram Sang, Andy Walls, Mauro Carvalho Chehab, linux-media,
	linux-kernel

Move from the deprecated i2c_new_probed_device() to the new
i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Build tested only. RFC, please comment and/or ack, but don't apply yet.

 drivers/media/pci/cx18/cx18-i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/pci/cx18/cx18-i2c.c b/drivers/media/pci/cx18/cx18-i2c.c
index 1ef7ccf4a722..a83435245251 100644
--- a/drivers/media/pci/cx18/cx18-i2c.c
+++ b/drivers/media/pci/cx18/cx18-i2c.c
@@ -88,7 +88,7 @@ static int cx18_i2c_new_ir(struct cx18 *cx, struct i2c_adapter *adap, u32 hw,
 		break;
 	}
 
-	return i2c_new_probed_device(adap, &info, addr_list, NULL) == NULL ?
+	return IS_ERR(i2c_new_scanned_device(adap, &info, addr_list, NULL)) ?
 	       -1 : 0;
 }
 
-- 
2.20.1


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

* [RFC PATCH 11/12] media: pci: ivtv: convert to i2c_new_scanned_device
  2019-11-06  9:50 ` Wolfram Sang
                   ` (12 preceding siblings ...)
  (?)
@ 2019-11-06  9:50 ` Wolfram Sang
  2019-11-06 11:21   ` Hans Verkuil
  -1 siblings, 1 reply; 47+ messages in thread
From: Wolfram Sang @ 2019-11-06  9:50 UTC (permalink / raw)
  To: linux-i2c
  Cc: Wolfram Sang, Andy Walls, Mauro Carvalho Chehab, linux-media,
	linux-kernel

Move from the deprecated i2c_new_probed_device() to the new
i2c_new_scanned_device(). Make use of the new ERRPTR if suitable. Change
the legacy function to simply return void because the retval was never
used anywhere.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Build tested only. RFC, please comment and/or ack, but don't apply yet.

 drivers/media/pci/ivtv/ivtv-i2c.c | 6 +++---
 drivers/media/pci/ivtv/ivtv-i2c.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/pci/ivtv/ivtv-i2c.c b/drivers/media/pci/ivtv/ivtv-i2c.c
index 0772d757a389..982045c4eea8 100644
--- a/drivers/media/pci/ivtv/ivtv-i2c.c
+++ b/drivers/media/pci/ivtv/ivtv-i2c.c
@@ -208,12 +208,12 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr)
 	info.platform_data = init_data;
 	strscpy(info.type, type, I2C_NAME_SIZE);
 
-	return i2c_new_probed_device(adap, &info, addr_list, NULL) == NULL ?
+	return IS_ERR(i2c_new_scanned_device(adap, &info, addr_list, NULL)) ?
 	       -1 : 0;
 }
 
 /* Instantiate the IR receiver device using probing -- undesirable */
-struct i2c_client *ivtv_i2c_new_ir_legacy(struct ivtv *itv)
+void ivtv_i2c_new_ir_legacy(struct ivtv *itv)
 {
 	struct i2c_board_info info;
 	/*
@@ -235,7 +235,7 @@ struct i2c_client *ivtv_i2c_new_ir_legacy(struct ivtv *itv)
 
 	memset(&info, 0, sizeof(struct i2c_board_info));
 	strscpy(info.type, "ir_video", I2C_NAME_SIZE);
-	return i2c_new_probed_device(&itv->i2c_adap, &info, addr_list, NULL);
+	i2c_new_scanned_device(&itv->i2c_adap, &info, addr_list, NULL);
 }
 
 int ivtv_i2c_register(struct ivtv *itv, unsigned idx)
diff --git a/drivers/media/pci/ivtv/ivtv-i2c.h b/drivers/media/pci/ivtv/ivtv-i2c.h
index 462f73449a6e..2d9cdaa682c5 100644
--- a/drivers/media/pci/ivtv/ivtv-i2c.h
+++ b/drivers/media/pci/ivtv/ivtv-i2c.h
@@ -9,7 +9,7 @@
 #ifndef IVTV_I2C_H
 #define IVTV_I2C_H
 
-struct i2c_client *ivtv_i2c_new_ir_legacy(struct ivtv *itv);
+void ivtv_i2c_new_ir_legacy(struct ivtv *itv);
 int ivtv_i2c_register(struct ivtv *itv, unsigned idx);
 struct v4l2_subdev *ivtv_find_hw(struct ivtv *itv, u32 hw);
 
-- 
2.20.1


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

* [RFC PATCH 12/12] media: v4l2-core: convert to i2c_new_scanned_device
  2019-11-06  9:50 ` Wolfram Sang
                   ` (13 preceding siblings ...)
  (?)
@ 2019-11-06  9:50 ` Wolfram Sang
  2019-11-06 11:24   ` Hans Verkuil
  -1 siblings, 1 reply; 47+ messages in thread
From: Wolfram Sang @ 2019-11-06  9:50 UTC (permalink / raw)
  To: linux-i2c; +Cc: Wolfram Sang, Mauro Carvalho Chehab, linux-media, linux-kernel

Move from the deprecated i2c_new_probed_device() to the new
i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Build tested only. RFC, please comment and/or ack, but don't apply yet.

 drivers/media/v4l2-core/v4l2-i2c.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-i2c.c b/drivers/media/v4l2-core/v4l2-i2c.c
index 5bf99e7c0c09..25ddda3b7ce6 100644
--- a/drivers/media/v4l2-core/v4l2-i2c.c
+++ b/drivers/media/v4l2-core/v4l2-i2c.c
@@ -74,10 +74,10 @@ struct v4l2_subdev
 
 	/* Create the i2c client */
 	if (info->addr == 0 && probe_addrs)
-		client = i2c_new_probed_device(adapter, info, probe_addrs,
-					       NULL);
+		client = i2c_new_scanned_device(adapter, info, probe_addrs,
+					        NULL);
 	else
-		client = i2c_new_device(adapter, info);
+		client = i2c_new_client_device(adapter, info);
 
 	/*
 	 * Note: by loading the module first we are certain that c->driver
@@ -88,7 +88,7 @@ struct v4l2_subdev
 	 * want to use the i2c device, so explicitly loading the module
 	 * is the best alternative.
 	 */
-	if (!client || !client->dev.driver)
+	if (IS_ERR(client) || !client->dev.driver)
 		goto error;
 
 	/* Lock the module so we can safely get the v4l2_subdev pointer */
@@ -110,7 +110,7 @@ struct v4l2_subdev
 	 * If we have a client but no subdev, then something went wrong and
 	 * we must unregister the client.
 	 */
-	if (client && !sd)
+	if (!IS_ERR(client) && !sd)
 		i2c_unregister_device(client);
 	return sd;
 }
-- 
2.20.1


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

* Re: [RFC PATCH 00/12] i2c: replace i2c_new_probed_device with an ERR_PTR variant
  2019-11-06  9:50 ` Wolfram Sang
  (?)
  (?)
@ 2019-11-06 10:06   ` Sean Young
  -1 siblings, 0 replies; 47+ messages in thread
From: Sean Young @ 2019-11-06 10:06 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, Wolfram Sang, dri-devel, linux-fbdev, linux-input,
	linux-kernel, linux-media, linuxppc-dev

On Wed, Nov 06, 2019 at 10:50:18AM +0100, Wolfram Sang wrote:
> From: Wolfram Sang <wsa@the-dreams.de>
> 
> In the on-going mission to let i2c_new_* calls return an ERR_PTR instead
> of NULL, here is a series converting i2c_new_probed_device(). A new
> function called i2c_new_scanned_device() is introduced with the new
> retval, but for now, a compatibility helper is provided until all users
> are converted. The rest of the patches convert all current in-tree
> users.
> 
> Note that these patches are RFC because I want feedback on the approach
> and hopefully collect acks on the driver conversions. If all goes well,
> I'll apply the first two patches for the next merge window. Then, once
> this dependency is upstream, I'll resend this series with all issues
> fixed and acks collected.

The patches to drivers/media/pci/* are all IR related which have touched
on/read over the years. So, for those:

Acked-by: Sean Young <sean@mess.org>

> 
> Core changes tested on a Renesas Salvator-XS board (R-Car M3-N), driver
> patches build tested by me and buildbot.
> 
> Wolfram Sang (12):
>   i2c: replace i2c_new_probed_device with an ERR_PTR variant
>   i2c: icy: convert to i2c_new_scanned_device
>   macintosh: convert to i2c_new_scanned_device
>   platform: chrome: convert to i2c_new_scanned_device
>   video: fbdev: matrox: convert to i2c_new_scanned_device
>   input: mouse: convert to i2c_new_scanned_device
>   media: pci: cx23885: convert to i2c_new_scanned_device
>   media: pci: cx88: convert to i2c_new_scanned_device
>   media: pci: bt8xx: convert to i2c_new_scanned_device
>   media: pci: cx18: convert to i2c_new_scanned_device
>   media: pci: ivtv: convert to i2c_new_scanned_device
>   media: v4l2-core: convert to i2c_new_scanned_device
> 
>  Documentation/i2c/instantiating-devices.rst | 10 ++++-----
>  Documentation/i2c/writing-clients.rst       |  8 +++----
>  drivers/i2c/busses/i2c-icy.c                |  8 +++----
>  drivers/i2c/i2c-core-base.c                 | 25 ++++++++++++++++-----
>  drivers/input/mouse/psmouse-smbus.c         |  8 ++++---
>  drivers/macintosh/therm_windtunnel.c        |  4 ++--
>  drivers/media/pci/bt8xx/bttv-input.c        |  6 ++---
>  drivers/media/pci/cx18/cx18-i2c.c           |  2 +-
>  drivers/media/pci/cx23885/cx23885-i2c.c     |  4 ++--
>  drivers/media/pci/cx88/cx88-input.c         |  2 +-
>  drivers/media/pci/ivtv/ivtv-i2c.c           |  6 ++---
>  drivers/media/pci/ivtv/ivtv-i2c.h           |  2 +-
>  drivers/media/v4l2-core/v4l2-i2c.c          | 10 ++++-----
>  drivers/platform/chrome/chromeos_laptop.c   | 18 ++++++++-------
>  drivers/video/fbdev/matrox/i2c-matroxfb.c   |  4 ++--
>  include/linux/i2c.h                         | 12 +++++++---
>  16 files changed, 76 insertions(+), 53 deletions(-)
> 
> -- 
> 2.20.1

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

* Re: [RFC PATCH 00/12] i2c: replace i2c_new_probed_device with an ERR_PTR variant
@ 2019-11-06 10:06   ` Sean Young
  0 siblings, 0 replies; 47+ messages in thread
From: Sean Young @ 2019-11-06 10:06 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, Wolfram Sang, dri-devel, linux-fbdev, linux-input,
	linux-kernel, linux-media, linuxppc-dev

On Wed, Nov 06, 2019 at 10:50:18AM +0100, Wolfram Sang wrote:
> From: Wolfram Sang <wsa@the-dreams.de>
> 
> In the on-going mission to let i2c_new_* calls return an ERR_PTR instead
> of NULL, here is a series converting i2c_new_probed_device(). A new
> function called i2c_new_scanned_device() is introduced with the new
> retval, but for now, a compatibility helper is provided until all users
> are converted. The rest of the patches convert all current in-tree
> users.
> 
> Note that these patches are RFC because I want feedback on the approach
> and hopefully collect acks on the driver conversions. If all goes well,
> I'll apply the first two patches for the next merge window. Then, once
> this dependency is upstream, I'll resend this series with all issues
> fixed and acks collected.

The patches to drivers/media/pci/* are all IR related which have touched
on/read over the years. So, for those:

Acked-by: Sean Young <sean@mess.org>

> 
> Core changes tested on a Renesas Salvator-XS board (R-Car M3-N), driver
> patches build tested by me and buildbot.
> 
> Wolfram Sang (12):
>   i2c: replace i2c_new_probed_device with an ERR_PTR variant
>   i2c: icy: convert to i2c_new_scanned_device
>   macintosh: convert to i2c_new_scanned_device
>   platform: chrome: convert to i2c_new_scanned_device
>   video: fbdev: matrox: convert to i2c_new_scanned_device
>   input: mouse: convert to i2c_new_scanned_device
>   media: pci: cx23885: convert to i2c_new_scanned_device
>   media: pci: cx88: convert to i2c_new_scanned_device
>   media: pci: bt8xx: convert to i2c_new_scanned_device
>   media: pci: cx18: convert to i2c_new_scanned_device
>   media: pci: ivtv: convert to i2c_new_scanned_device
>   media: v4l2-core: convert to i2c_new_scanned_device
> 
>  Documentation/i2c/instantiating-devices.rst | 10 ++++-----
>  Documentation/i2c/writing-clients.rst       |  8 +++----
>  drivers/i2c/busses/i2c-icy.c                |  8 +++----
>  drivers/i2c/i2c-core-base.c                 | 25 ++++++++++++++++-----
>  drivers/input/mouse/psmouse-smbus.c         |  8 ++++---
>  drivers/macintosh/therm_windtunnel.c        |  4 ++--
>  drivers/media/pci/bt8xx/bttv-input.c        |  6 ++---
>  drivers/media/pci/cx18/cx18-i2c.c           |  2 +-
>  drivers/media/pci/cx23885/cx23885-i2c.c     |  4 ++--
>  drivers/media/pci/cx88/cx88-input.c         |  2 +-
>  drivers/media/pci/ivtv/ivtv-i2c.c           |  6 ++---
>  drivers/media/pci/ivtv/ivtv-i2c.h           |  2 +-
>  drivers/media/v4l2-core/v4l2-i2c.c          | 10 ++++-----
>  drivers/platform/chrome/chromeos_laptop.c   | 18 ++++++++-------
>  drivers/video/fbdev/matrox/i2c-matroxfb.c   |  4 ++--
>  include/linux/i2c.h                         | 12 +++++++---
>  16 files changed, 76 insertions(+), 53 deletions(-)
> 
> -- 
> 2.20.1

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

* Re: [RFC PATCH 00/12] i2c: replace i2c_new_probed_device with an ERR_PTR variant
@ 2019-11-06 10:06   ` Sean Young
  0 siblings, 0 replies; 47+ messages in thread
From: Sean Young @ 2019-11-06 10:06 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-fbdev, Wolfram Sang, linux-kernel, dri-devel, linux-i2c,
	linux-input, linuxppc-dev, linux-media

On Wed, Nov 06, 2019 at 10:50:18AM +0100, Wolfram Sang wrote:
> From: Wolfram Sang <wsa@the-dreams.de>
> 
> In the on-going mission to let i2c_new_* calls return an ERR_PTR instead
> of NULL, here is a series converting i2c_new_probed_device(). A new
> function called i2c_new_scanned_device() is introduced with the new
> retval, but for now, a compatibility helper is provided until all users
> are converted. The rest of the patches convert all current in-tree
> users.
> 
> Note that these patches are RFC because I want feedback on the approach
> and hopefully collect acks on the driver conversions. If all goes well,
> I'll apply the first two patches for the next merge window. Then, once
> this dependency is upstream, I'll resend this series with all issues
> fixed and acks collected.

The patches to drivers/media/pci/* are all IR related which have touched
on/read over the years. So, for those:

Acked-by: Sean Young <sean@mess.org>

> 
> Core changes tested on a Renesas Salvator-XS board (R-Car M3-N), driver
> patches build tested by me and buildbot.
> 
> Wolfram Sang (12):
>   i2c: replace i2c_new_probed_device with an ERR_PTR variant
>   i2c: icy: convert to i2c_new_scanned_device
>   macintosh: convert to i2c_new_scanned_device
>   platform: chrome: convert to i2c_new_scanned_device
>   video: fbdev: matrox: convert to i2c_new_scanned_device
>   input: mouse: convert to i2c_new_scanned_device
>   media: pci: cx23885: convert to i2c_new_scanned_device
>   media: pci: cx88: convert to i2c_new_scanned_device
>   media: pci: bt8xx: convert to i2c_new_scanned_device
>   media: pci: cx18: convert to i2c_new_scanned_device
>   media: pci: ivtv: convert to i2c_new_scanned_device
>   media: v4l2-core: convert to i2c_new_scanned_device
> 
>  Documentation/i2c/instantiating-devices.rst | 10 ++++-----
>  Documentation/i2c/writing-clients.rst       |  8 +++----
>  drivers/i2c/busses/i2c-icy.c                |  8 +++----
>  drivers/i2c/i2c-core-base.c                 | 25 ++++++++++++++++-----
>  drivers/input/mouse/psmouse-smbus.c         |  8 ++++---
>  drivers/macintosh/therm_windtunnel.c        |  4 ++--
>  drivers/media/pci/bt8xx/bttv-input.c        |  6 ++---
>  drivers/media/pci/cx18/cx18-i2c.c           |  2 +-
>  drivers/media/pci/cx23885/cx23885-i2c.c     |  4 ++--
>  drivers/media/pci/cx88/cx88-input.c         |  2 +-
>  drivers/media/pci/ivtv/ivtv-i2c.c           |  6 ++---
>  drivers/media/pci/ivtv/ivtv-i2c.h           |  2 +-
>  drivers/media/v4l2-core/v4l2-i2c.c          | 10 ++++-----
>  drivers/platform/chrome/chromeos_laptop.c   | 18 ++++++++-------
>  drivers/video/fbdev/matrox/i2c-matroxfb.c   |  4 ++--
>  include/linux/i2c.h                         | 12 +++++++---
>  16 files changed, 76 insertions(+), 53 deletions(-)
> 
> -- 
> 2.20.1

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

* Re: [RFC PATCH 00/12] i2c: replace i2c_new_probed_device with an ERR_PTR variant
@ 2019-11-06 10:06   ` Sean Young
  0 siblings, 0 replies; 47+ messages in thread
From: Sean Young @ 2019-11-06 10:06 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-fbdev, Wolfram Sang, linux-kernel, dri-devel, linux-i2c,
	linux-input, linuxppc-dev, linux-media

On Wed, Nov 06, 2019 at 10:50:18AM +0100, Wolfram Sang wrote:
> From: Wolfram Sang <wsa@the-dreams.de>
> 
> In the on-going mission to let i2c_new_* calls return an ERR_PTR instead
> of NULL, here is a series converting i2c_new_probed_device(). A new
> function called i2c_new_scanned_device() is introduced with the new
> retval, but for now, a compatibility helper is provided until all users
> are converted. The rest of the patches convert all current in-tree
> users.
> 
> Note that these patches are RFC because I want feedback on the approach
> and hopefully collect acks on the driver conversions. If all goes well,
> I'll apply the first two patches for the next merge window. Then, once
> this dependency is upstream, I'll resend this series with all issues
> fixed and acks collected.

The patches to drivers/media/pci/* are all IR related which have touched
on/read over the years. So, for those:

Acked-by: Sean Young <sean@mess.org>

> 
> Core changes tested on a Renesas Salvator-XS board (R-Car M3-N), driver
> patches build tested by me and buildbot.
> 
> Wolfram Sang (12):
>   i2c: replace i2c_new_probed_device with an ERR_PTR variant
>   i2c: icy: convert to i2c_new_scanned_device
>   macintosh: convert to i2c_new_scanned_device
>   platform: chrome: convert to i2c_new_scanned_device
>   video: fbdev: matrox: convert to i2c_new_scanned_device
>   input: mouse: convert to i2c_new_scanned_device
>   media: pci: cx23885: convert to i2c_new_scanned_device
>   media: pci: cx88: convert to i2c_new_scanned_device
>   media: pci: bt8xx: convert to i2c_new_scanned_device
>   media: pci: cx18: convert to i2c_new_scanned_device
>   media: pci: ivtv: convert to i2c_new_scanned_device
>   media: v4l2-core: convert to i2c_new_scanned_device
> 
>  Documentation/i2c/instantiating-devices.rst | 10 ++++-----
>  Documentation/i2c/writing-clients.rst       |  8 +++----
>  drivers/i2c/busses/i2c-icy.c                |  8 +++----
>  drivers/i2c/i2c-core-base.c                 | 25 ++++++++++++++++-----
>  drivers/input/mouse/psmouse-smbus.c         |  8 ++++---
>  drivers/macintosh/therm_windtunnel.c        |  4 ++--
>  drivers/media/pci/bt8xx/bttv-input.c        |  6 ++---
>  drivers/media/pci/cx18/cx18-i2c.c           |  2 +-
>  drivers/media/pci/cx23885/cx23885-i2c.c     |  4 ++--
>  drivers/media/pci/cx88/cx88-input.c         |  2 +-
>  drivers/media/pci/ivtv/ivtv-i2c.c           |  6 ++---
>  drivers/media/pci/ivtv/ivtv-i2c.h           |  2 +-
>  drivers/media/v4l2-core/v4l2-i2c.c          | 10 ++++-----
>  drivers/platform/chrome/chromeos_laptop.c   | 18 ++++++++-------
>  drivers/video/fbdev/matrox/i2c-matroxfb.c   |  4 ++--
>  include/linux/i2c.h                         | 12 +++++++---
>  16 files changed, 76 insertions(+), 53 deletions(-)
> 
> -- 
> 2.20.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [RFC PATCH 08/12] media: pci: cx88: convert to i2c_new_scanned_device
  2019-11-06  9:50 ` [RFC PATCH 08/12] media: pci: cx88: " Wolfram Sang
@ 2019-11-06 11:18   ` Hans Verkuil
  2019-11-06 14:49     ` Wolfram Sang
  0 siblings, 1 reply; 47+ messages in thread
From: Hans Verkuil @ 2019-11-06 11:18 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c; +Cc: Mauro Carvalho Chehab, linux-media, linux-kernel

On 11/6/19 10:50 AM, Wolfram Sang wrote:
> Move from the deprecated i2c_new_probed_device() to the new
> i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.

This commit text is a bit out-of-sync with the actual patch.

This should be improved for the next version. Looks good otherwise.

Regards,

	Hans

> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> 
> Build tested only. RFC, please comment and/or ack, but don't apply yet.
> 
>  drivers/media/pci/cx88/cx88-input.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/pci/cx88/cx88-input.c b/drivers/media/pci/cx88/cx88-input.c
> index 589f52d961eb..c7c2acd55266 100644
> --- a/drivers/media/pci/cx88/cx88-input.c
> +++ b/drivers/media/pci/cx88/cx88-input.c
> @@ -613,7 +613,7 @@ void cx88_i2c_init_ir(struct cx88_core *core)
>  	}
>  
>  	/*
> -	 * We can't call i2c_new_probed_device() because it uses
> +	 * We can't call i2c_new_scanned_device() because it uses
>  	 * quick writes for probing and at least some RC receiver
>  	 * devices only reply to reads.
>  	 * Also, Hauppauge XVR needs to be specified, as address 0x71
> 


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

* Re: [RFC PATCH 07/12] media: pci: cx23885: convert to i2c_new_scanned_device
  2019-11-06  9:50 ` [RFC PATCH 07/12] media: pci: cx23885: " Wolfram Sang
@ 2019-11-06 11:18   ` Hans Verkuil
  0 siblings, 0 replies; 47+ messages in thread
From: Hans Verkuil @ 2019-11-06 11:18 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c; +Cc: Mauro Carvalho Chehab, linux-media, linux-kernel

On 11/6/19 10:50 AM, Wolfram Sang wrote:
> Move from the deprecated i2c_new_probed_device() to the new
> i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

Regards,

	Hans

> ---
> 
> Build tested only. RFC, please comment and/or ack, but don't apply yet.
> 
>  drivers/media/pci/cx23885/cx23885-i2c.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/pci/cx23885/cx23885-i2c.c b/drivers/media/pci/cx23885/cx23885-i2c.c
> index 4f327ee9659e..f51fad33dc04 100644
> --- a/drivers/media/pci/cx23885/cx23885-i2c.c
> +++ b/drivers/media/pci/cx23885/cx23885-i2c.c
> @@ -337,8 +337,8 @@ int cx23885_i2c_register(struct cx23885_i2c *bus)
>  		strscpy(info.type, "ir_video", I2C_NAME_SIZE);
>  		/* Use quick read command for probe, some IR chips don't
>  		 * support writes */
> -		i2c_new_probed_device(&bus->i2c_adap, &info, addr_list,
> -				      i2c_probe_func_quick_read);
> +		i2c_new_scanned_device(&bus->i2c_adap, &info, addr_list,
> +				       i2c_probe_func_quick_read);
>  	}
>  
>  	return bus->i2c_rc;
> 


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

* Re: [RFC PATCH 09/12] media: pci: bt8xx: convert to i2c_new_scanned_device
  2019-11-06  9:50 ` [RFC PATCH 09/12] media: pci: bt8xx: " Wolfram Sang
@ 2019-11-06 11:19   ` Hans Verkuil
  0 siblings, 0 replies; 47+ messages in thread
From: Hans Verkuil @ 2019-11-06 11:19 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c; +Cc: Mauro Carvalho Chehab, linux-media, linux-kernel

On 11/6/19 10:50 AM, Wolfram Sang wrote:
> Move from the deprecated i2c_new_probed_device() to the new
> i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

Regards,

	Hans

> ---
> 
> Build tested only. RFC, please comment and/or ack, but don't apply yet.
> 
>  drivers/media/pci/bt8xx/bttv-input.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/pci/bt8xx/bttv-input.c b/drivers/media/pci/bt8xx/bttv-input.c
> index 492bc85c2700..41226f1d0e5b 100644
> --- a/drivers/media/pci/bt8xx/bttv-input.c
> +++ b/drivers/media/pci/bt8xx/bttv-input.c
> @@ -386,7 +386,7 @@ void init_bttv_i2c_ir(struct bttv *btv)
>  
>  	if (btv->init_data.name) {
>  		info.platform_data = &btv->init_data;
> -		i2c_dev = i2c_new_device(&btv->c.i2c_adap, &info);
> +		i2c_dev = i2c_new_client_device(&btv->c.i2c_adap, &info);
>  	} else {
>  		/*
>  		 * The external IR receiver is at i2c address 0x34 (0x35 for
> @@ -396,9 +396,9 @@ void init_bttv_i2c_ir(struct bttv *btv)
>  		 * internal.
>  		 * That's why we probe 0x1a (~0x34) first. CB
>  		 */
> -		i2c_dev = i2c_new_probed_device(&btv->c.i2c_adap, &info, addr_list, NULL);
> +		i2c_dev = i2c_new_scanned_device(&btv->c.i2c_adap, &info, addr_list, NULL);
>  	}
> -	if (NULL == i2c_dev)
> +	if (IS_ERR(i2c_dev))
>  		return;
>  
>  #if defined(CONFIG_MODULES) && defined(MODULE)
> 


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

* Re: [RFC PATCH 11/12] media: pci: ivtv: convert to i2c_new_scanned_device
  2019-11-06  9:50 ` [RFC PATCH 11/12] media: pci: ivtv: " Wolfram Sang
@ 2019-11-06 11:21   ` Hans Verkuil
  0 siblings, 0 replies; 47+ messages in thread
From: Hans Verkuil @ 2019-11-06 11:21 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c
  Cc: Andy Walls, Mauro Carvalho Chehab, linux-media, linux-kernel

On 11/6/19 10:50 AM, Wolfram Sang wrote:
> Move from the deprecated i2c_new_probed_device() to the new
> i2c_new_scanned_device(). Make use of the new ERRPTR if suitable. Change
> the legacy function to simply return void because the retval was never
> used anywhere.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

Regards,

	Hans

> ---
> 
> Build tested only. RFC, please comment and/or ack, but don't apply yet.
> 
>  drivers/media/pci/ivtv/ivtv-i2c.c | 6 +++---
>  drivers/media/pci/ivtv/ivtv-i2c.h | 2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/pci/ivtv/ivtv-i2c.c b/drivers/media/pci/ivtv/ivtv-i2c.c
> index 0772d757a389..982045c4eea8 100644
> --- a/drivers/media/pci/ivtv/ivtv-i2c.c
> +++ b/drivers/media/pci/ivtv/ivtv-i2c.c
> @@ -208,12 +208,12 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr)
>  	info.platform_data = init_data;
>  	strscpy(info.type, type, I2C_NAME_SIZE);
>  
> -	return i2c_new_probed_device(adap, &info, addr_list, NULL) == NULL ?
> +	return IS_ERR(i2c_new_scanned_device(adap, &info, addr_list, NULL)) ?
>  	       -1 : 0;
>  }
>  
>  /* Instantiate the IR receiver device using probing -- undesirable */
> -struct i2c_client *ivtv_i2c_new_ir_legacy(struct ivtv *itv)
> +void ivtv_i2c_new_ir_legacy(struct ivtv *itv)
>  {
>  	struct i2c_board_info info;
>  	/*
> @@ -235,7 +235,7 @@ struct i2c_client *ivtv_i2c_new_ir_legacy(struct ivtv *itv)
>  
>  	memset(&info, 0, sizeof(struct i2c_board_info));
>  	strscpy(info.type, "ir_video", I2C_NAME_SIZE);
> -	return i2c_new_probed_device(&itv->i2c_adap, &info, addr_list, NULL);
> +	i2c_new_scanned_device(&itv->i2c_adap, &info, addr_list, NULL);
>  }
>  
>  int ivtv_i2c_register(struct ivtv *itv, unsigned idx)
> diff --git a/drivers/media/pci/ivtv/ivtv-i2c.h b/drivers/media/pci/ivtv/ivtv-i2c.h
> index 462f73449a6e..2d9cdaa682c5 100644
> --- a/drivers/media/pci/ivtv/ivtv-i2c.h
> +++ b/drivers/media/pci/ivtv/ivtv-i2c.h
> @@ -9,7 +9,7 @@
>  #ifndef IVTV_I2C_H
>  #define IVTV_I2C_H
>  
> -struct i2c_client *ivtv_i2c_new_ir_legacy(struct ivtv *itv);
> +void ivtv_i2c_new_ir_legacy(struct ivtv *itv);
>  int ivtv_i2c_register(struct ivtv *itv, unsigned idx);
>  struct v4l2_subdev *ivtv_find_hw(struct ivtv *itv, u32 hw);
>  
> 


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

* Re: [RFC PATCH 10/12] media: pci: cx18: convert to i2c_new_scanned_device
  2019-11-06  9:50 ` [RFC PATCH 10/12] media: pci: cx18: " Wolfram Sang
@ 2019-11-06 11:23   ` Hans Verkuil
  0 siblings, 0 replies; 47+ messages in thread
From: Hans Verkuil @ 2019-11-06 11:23 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c
  Cc: Andy Walls, Mauro Carvalho Chehab, linux-media, linux-kernel

On 11/6/19 10:50 AM, Wolfram Sang wrote:
> Move from the deprecated i2c_new_probed_device() to the new
> i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

Regards,

	Hans

> ---
> 
> Build tested only. RFC, please comment and/or ack, but don't apply yet.
> 
>  drivers/media/pci/cx18/cx18-i2c.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/pci/cx18/cx18-i2c.c b/drivers/media/pci/cx18/cx18-i2c.c
> index 1ef7ccf4a722..a83435245251 100644
> --- a/drivers/media/pci/cx18/cx18-i2c.c
> +++ b/drivers/media/pci/cx18/cx18-i2c.c
> @@ -88,7 +88,7 @@ static int cx18_i2c_new_ir(struct cx18 *cx, struct i2c_adapter *adap, u32 hw,
>  		break;
>  	}
>  
> -	return i2c_new_probed_device(adap, &info, addr_list, NULL) == NULL ?
> +	return IS_ERR(i2c_new_scanned_device(adap, &info, addr_list, NULL)) ?
>  	       -1 : 0;
>  }
>  
> 


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

* Re: [RFC PATCH 12/12] media: v4l2-core: convert to i2c_new_scanned_device
  2019-11-06  9:50 ` [RFC PATCH 12/12] media: v4l2-core: " Wolfram Sang
@ 2019-11-06 11:24   ` Hans Verkuil
  0 siblings, 0 replies; 47+ messages in thread
From: Hans Verkuil @ 2019-11-06 11:24 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c; +Cc: Mauro Carvalho Chehab, linux-media, linux-kernel

On 11/6/19 10:50 AM, Wolfram Sang wrote:
> Move from the deprecated i2c_new_probed_device() to the new
> i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

Regards,

	Hans

> ---
> 
> Build tested only. RFC, please comment and/or ack, but don't apply yet.
> 
>  drivers/media/v4l2-core/v4l2-i2c.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-i2c.c b/drivers/media/v4l2-core/v4l2-i2c.c
> index 5bf99e7c0c09..25ddda3b7ce6 100644
> --- a/drivers/media/v4l2-core/v4l2-i2c.c
> +++ b/drivers/media/v4l2-core/v4l2-i2c.c
> @@ -74,10 +74,10 @@ struct v4l2_subdev
>  
>  	/* Create the i2c client */
>  	if (info->addr == 0 && probe_addrs)
> -		client = i2c_new_probed_device(adapter, info, probe_addrs,
> -					       NULL);
> +		client = i2c_new_scanned_device(adapter, info, probe_addrs,
> +					        NULL);
>  	else
> -		client = i2c_new_device(adapter, info);
> +		client = i2c_new_client_device(adapter, info);
>  
>  	/*
>  	 * Note: by loading the module first we are certain that c->driver
> @@ -88,7 +88,7 @@ struct v4l2_subdev
>  	 * want to use the i2c device, so explicitly loading the module
>  	 * is the best alternative.
>  	 */
> -	if (!client || !client->dev.driver)
> +	if (IS_ERR(client) || !client->dev.driver)
>  		goto error;
>  
>  	/* Lock the module so we can safely get the v4l2_subdev pointer */
> @@ -110,7 +110,7 @@ struct v4l2_subdev
>  	 * If we have a client but no subdev, then something went wrong and
>  	 * we must unregister the client.
>  	 */
> -	if (client && !sd)
> +	if (!IS_ERR(client) && !sd)
>  		i2c_unregister_device(client);
>  	return sd;
>  }
> 


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

* Re: [RFC PATCH 02/12] i2c: icy: convert to i2c_new_scanned_device
  2019-11-06  9:50 ` [RFC PATCH 02/12] i2c: icy: convert to i2c_new_scanned_device Wolfram Sang
@ 2019-11-06 11:33   ` Max Staudt
  2019-11-28 16:16   ` Wolfram Sang
  1 sibling, 0 replies; 47+ messages in thread
From: Max Staudt @ 2019-11-06 11:33 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c; +Cc: linux-kernel

On 11/06/2019 10:50 AM, Wolfram Sang wrote:
> Move from the deprecated i2c_new_probed_device() to the new
> i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  drivers/i2c/busses/i2c-icy.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-icy.c b/drivers/i2c/busses/i2c-icy.c
> index 8382eb64b424..07baa4d8de39 100644
> --- a/drivers/i2c/busses/i2c-icy.c
> +++ b/drivers/i2c/busses/i2c-icy.c
> @@ -188,10 +188,10 @@ static int icy_probe(struct zorro_dev *z,
>  		ltc2990_info.fwnode = new_fwnode;
>  
>  		i2c->ltc2990_client =
> -			i2c_new_probed_device(&i2c->adapter,
> -					      &ltc2990_info,
> -					      icy_ltc2990_addresses,
> -					      NULL);
> +			i2c_new_scanned_device(&i2c->adapter,
> +					       &ltc2990_info,
> +					       icy_ltc2990_addresses,
> +					       NULL);

Looks good, thank you for patching this!

i2c_unregister_device() checks the pointer using IS_ERR_OR_NULL(), so the simple logic in i2c-icy (where the pointer is not checked on i2c_new_scanned_device()) still works.


Acked-by: Max Staudt <max@enpas.org>

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

* Re: [RFC PATCH 01/12] i2c: replace i2c_new_probed_device with an ERR_PTR variant
  2019-11-06  9:50 ` [RFC PATCH 01/12] " Wolfram Sang
@ 2019-11-06 12:39   ` Max Staudt
  2019-11-07 17:31   ` Luca Ceresoli
  2019-11-28 16:16   ` Wolfram Sang
  2 siblings, 0 replies; 47+ messages in thread
From: Max Staudt @ 2019-11-06 12:39 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c; +Cc: Wolfram Sang, linux-kernel

I'm not an I2C expert, but as far as I can see: This patch looks useful and well done to me.
Thanks for moving forward on making the interfaces use ERR_PTR instead of NULL.

Max


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

* Re: [RFC PATCH 08/12] media: pci: cx88: convert to i2c_new_scanned_device
  2019-11-06 11:18   ` Hans Verkuil
@ 2019-11-06 14:49     ` Wolfram Sang
  0 siblings, 0 replies; 47+ messages in thread
From: Wolfram Sang @ 2019-11-06 14:49 UTC (permalink / raw)
  To: Hans Verkuil
  Cc: Wolfram Sang, linux-i2c, Mauro Carvalho Chehab, linux-media,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 394 bytes --]

On Wed, Nov 06, 2019 at 12:18:28PM +0100, Hans Verkuil wrote:
> On 11/6/19 10:50 AM, Wolfram Sang wrote:
> > Move from the deprecated i2c_new_probed_device() to the new
> > i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.
> 
> This commit text is a bit out-of-sync with the actual patch.

Ha, true :) Thanks for pointing out (and the other reviews, too, of
course!)


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [RFC PATCH 05/12] video: fbdev: matrox: convert to i2c_new_scanned_device
  2019-11-06  9:50   ` Wolfram Sang
  (?)
@ 2019-11-07  8:33     ` Daniel Vetter
  -1 siblings, 0 replies; 47+ messages in thread
From: Daniel Vetter @ 2019-11-07  8:33 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, linux-fbdev, linux-kernel, dri-devel,
	Bartlomiej Zolnierkiewicz

On Wed, Nov 06, 2019 at 10:50:23AM +0100, Wolfram Sang wrote:
> Move from the deprecated i2c_new_probed_device() to the new
> i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Ack for merging through whatever tree you think this should best land
through.
-Daniel

> ---
> 
> Build tested only. RFC, please comment and/or ack, but don't apply yet.
> 
>  drivers/video/fbdev/matrox/i2c-matroxfb.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/video/fbdev/matrox/i2c-matroxfb.c b/drivers/video/fbdev/matrox/i2c-matroxfb.c
> index 34e2659c3189..e2e4705e3fe0 100644
> --- a/drivers/video/fbdev/matrox/i2c-matroxfb.c
> +++ b/drivers/video/fbdev/matrox/i2c-matroxfb.c
> @@ -191,8 +191,8 @@ static void* i2c_matroxfb_probe(struct matrox_fb_info* minfo) {
>  				0x1b, I2C_CLIENT_END
>  			};
>  
> -			i2c_new_probed_device(&m2info->maven.adapter,
> -					      &maven_info, addr_list, NULL);
> +			i2c_new_scanned_device(&m2info->maven.adapter,
> +					       &maven_info, addr_list, NULL);
>  		}
>  	}
>  	return m2info;
> -- 
> 2.20.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

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

* Re: [RFC PATCH 05/12] video: fbdev: matrox: convert to i2c_new_scanned_device
@ 2019-11-07  8:33     ` Daniel Vetter
  0 siblings, 0 replies; 47+ messages in thread
From: Daniel Vetter @ 2019-11-07  8:33 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, linux-fbdev, linux-kernel, dri-devel,
	Bartlomiej Zolnierkiewicz

On Wed, Nov 06, 2019 at 10:50:23AM +0100, Wolfram Sang wrote:
> Move from the deprecated i2c_new_probed_device() to the new
> i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Ack for merging through whatever tree you think this should best land
through.
-Daniel

> ---
> 
> Build tested only. RFC, please comment and/or ack, but don't apply yet.
> 
>  drivers/video/fbdev/matrox/i2c-matroxfb.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/video/fbdev/matrox/i2c-matroxfb.c b/drivers/video/fbdev/matrox/i2c-matroxfb.c
> index 34e2659c3189..e2e4705e3fe0 100644
> --- a/drivers/video/fbdev/matrox/i2c-matroxfb.c
> +++ b/drivers/video/fbdev/matrox/i2c-matroxfb.c
> @@ -191,8 +191,8 @@ static void* i2c_matroxfb_probe(struct matrox_fb_info* minfo) {
>  				0x1b, I2C_CLIENT_END
>  			};
>  
> -			i2c_new_probed_device(&m2info->maven.adapter,
> -					      &maven_info, addr_list, NULL);
> +			i2c_new_scanned_device(&m2info->maven.adapter,
> +					       &maven_info, addr_list, NULL);
>  		}
>  	}
>  	return m2info;
> -- 
> 2.20.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

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

* Re: [RFC PATCH 05/12] video: fbdev: matrox: convert to i2c_new_scanned_device
@ 2019-11-07  8:33     ` Daniel Vetter
  0 siblings, 0 replies; 47+ messages in thread
From: Daniel Vetter @ 2019-11-07  8:33 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-fbdev, Bartlomiej Zolnierkiewicz, linux-i2c, dri-devel,
	linux-kernel

On Wed, Nov 06, 2019 at 10:50:23AM +0100, Wolfram Sang wrote:
> Move from the deprecated i2c_new_probed_device() to the new
> i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Ack for merging through whatever tree you think this should best land
through.
-Daniel

> ---
> 
> Build tested only. RFC, please comment and/or ack, but don't apply yet.
> 
>  drivers/video/fbdev/matrox/i2c-matroxfb.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/video/fbdev/matrox/i2c-matroxfb.c b/drivers/video/fbdev/matrox/i2c-matroxfb.c
> index 34e2659c3189..e2e4705e3fe0 100644
> --- a/drivers/video/fbdev/matrox/i2c-matroxfb.c
> +++ b/drivers/video/fbdev/matrox/i2c-matroxfb.c
> @@ -191,8 +191,8 @@ static void* i2c_matroxfb_probe(struct matrox_fb_info* minfo) {
>  				0x1b, I2C_CLIENT_END
>  			};
>  
> -			i2c_new_probed_device(&m2info->maven.adapter,
> -					      &maven_info, addr_list, NULL);
> +			i2c_new_scanned_device(&m2info->maven.adapter,
> +					       &maven_info, addr_list, NULL);
>  		}
>  	}
>  	return m2info;
> -- 
> 2.20.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [RFC PATCH 01/12] i2c: replace i2c_new_probed_device with an ERR_PTR variant
  2019-11-06  9:50 ` [RFC PATCH 01/12] " Wolfram Sang
  2019-11-06 12:39   ` Max Staudt
@ 2019-11-07 17:31   ` Luca Ceresoli
  2019-11-07 19:22     ` Wolfram Sang
  2019-11-28 16:16   ` Wolfram Sang
  2 siblings, 1 reply; 47+ messages in thread
From: Luca Ceresoli @ 2019-11-07 17:31 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c; +Cc: Wolfram Sang, linux-kernel

Hi Wolfram,

On 06/11/19 10:50, Wolfram Sang wrote:
> In the general move to have i2c_new_*_device functions which return
> ERR_PTR instead of NULL, this patch converts i2c_new_probed_device().
> 
> There are only few users, so this patch converts the I2C core and all
> users in one go. The function gets renamed to i2c_new_scanned_device()
> so out-of-tree users will get a build failure to understand they need to
> adapt their error checking code.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  Documentation/i2c/instantiating-devices.rst | 10 ++++-----
>  Documentation/i2c/writing-clients.rst       |  8 +++----
>  drivers/i2c/i2c-core-base.c                 | 25 ++++++++++++++++-----
>  include/linux/i2c.h                         | 12 +++++++---
>  4 files changed, 37 insertions(+), 18 deletions(-)
> 
> diff --git a/Documentation/i2c/instantiating-devices.rst b/Documentation/i2c/instantiating-devices.rst
> index 1238f1fa3382..875ebe9e78e3 100644
> --- a/Documentation/i2c/instantiating-devices.rst
> +++ b/Documentation/i2c/instantiating-devices.rst
> @@ -123,7 +123,7 @@ present or not (for example for an optional feature which is not present
>  on cheap variants of a board but you have no way to tell them apart), or
>  it may have different addresses from one board to the next (manufacturer
>  changing its design without notice). In this case, you can call
> -i2c_new_probed_device() instead of i2c_new_device().
> +i2c_new_scanned_device() instead of i2c_new_device().
>  
>  Example (from the nxp OHCI driver)::
>  
> @@ -139,8 +139,8 @@ Example (from the nxp OHCI driver)::
>  	i2c_adap = i2c_get_adapter(2);
>  	memset(&i2c_info, 0, sizeof(struct i2c_board_info));
>  	strscpy(i2c_info.type, "isp1301_nxp", sizeof(i2c_info.type));
> -	isp1301_i2c_client = i2c_new_probed_device(i2c_adap, &i2c_info,
> -						   normal_i2c, NULL);
> +	isp1301_i2c_client = i2c_new_scanned_device(i2c_adap, &i2c_info,
> +						    normal_i2c, NULL);
>  	i2c_put_adapter(i2c_adap);
>  	(...)
>    }
> @@ -153,14 +153,14 @@ simply gives up.
>  The driver which instantiated the I2C device is responsible for destroying
>  it on cleanup. This is done by calling i2c_unregister_device() on the
>  pointer that was earlier returned by i2c_new_device() or
> -i2c_new_probed_device().
> +i2c_new_scanned_device().
>  
>  
>  Method 3: Probe an I2C bus for certain devices
>  ----------------------------------------------
>  
>  Sometimes you do not have enough information about an I2C device, not even
> -to call i2c_new_probed_device(). The typical case is hardware monitoring
> +to call i2c_new_scanned_device(). The typical case is hardware monitoring
>  chips on PC mainboards. There are several dozen models, which can live
>  at 25 different addresses. Given the huge number of mainboards out there,
>  it is next to impossible to build an exhaustive list of the hardware
> diff --git a/Documentation/i2c/writing-clients.rst b/Documentation/i2c/writing-clients.rst
> index dddf0a14ab7c..ced309b5e0cc 100644
> --- a/Documentation/i2c/writing-clients.rst
> +++ b/Documentation/i2c/writing-clients.rst
> @@ -185,14 +185,14 @@ Sometimes you know that a device is connected to a given I2C bus, but you
>  don't know the exact address it uses.  This happens on TV adapters for
>  example, where the same driver supports dozens of slightly different
>  models, and I2C device addresses change from one model to the next.  In
> -that case, you can use the i2c_new_probed_device() variant, which is
> +that case, you can use the i2c_new_scanned_device() variant, which is
>  similar to i2c_new_device(), except that it takes an additional list of
>  possible I2C addresses to probe.  A device is created for the first
>  responsive address in the list.  If you expect more than one device to be
> -present in the address range, simply call i2c_new_probed_device() that
> +present in the address range, simply call i2c_new_scanned_device() that
>  many times.
>  
> -The call to i2c_new_device() or i2c_new_probed_device() typically happens
> +The call to i2c_new_device() or i2c_new_scanned_device() typically happens
>  in the I2C bus driver. You may want to save the returned i2c_client
>  reference for later use.
>  
> @@ -237,7 +237,7 @@ Device Deletion
>  ---------------
>  
>  Each I2C device which has been created using i2c_new_device() or
> -i2c_new_probed_device() can be unregistered by calling
> +i2c_new_scanned_device() can be unregistered by calling
>  i2c_unregister_device().  If you don't call it explicitly, it will be
>  called automatically before the underlying I2C bus itself is removed, as a
>  device can't survive its parent in the device driver model.
> diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
> index 6a5183cffdfc..380bde2dc23e 100644
> --- a/drivers/i2c/i2c-core-base.c
> +++ b/drivers/i2c/i2c-core-base.c
> @@ -2277,10 +2277,10 @@ int i2c_probe_func_quick_read(struct i2c_adapter *adap, unsigned short addr)
>  EXPORT_SYMBOL_GPL(i2c_probe_func_quick_read);
>  
>  struct i2c_client *
> -i2c_new_probed_device(struct i2c_adapter *adap,
> -		      struct i2c_board_info *info,
> -		      unsigned short const *addr_list,
> -		      int (*probe)(struct i2c_adapter *adap, unsigned short addr))
> +i2c_new_scanned_device(struct i2c_adapter *adap,
> +		       struct i2c_board_info *info,
> +		       unsigned short const *addr_list,
> +		       int (*probe)(struct i2c_adapter *adap, unsigned short addr))
>  {
>  	int i;
>  
> @@ -2310,11 +2310,24 @@ i2c_new_probed_device(struct i2c_adapter *adap,
>  
>  	if (addr_list[i] == I2C_CLIENT_END) {
>  		dev_dbg(&adap->dev, "Probing failed, no device found\n");
> -		return NULL;
> +		return ERR_PTR(-ENODEV);
>  	}
>  
>  	info->addr = addr_list[i];
> -	return i2c_new_device(adap, info);
> +	return i2c_new_client_device(adap, info);
> +}
> +EXPORT_SYMBOL_GPL(i2c_new_scanned_device);
> +
> +struct i2c_client *
> +i2c_new_probed_device(struct i2c_adapter *adap,
> +		      struct i2c_board_info *info,
> +		      unsigned short const *addr_list,
> +		      int (*probe)(struct i2c_adapter *adap, unsigned short addr))
> +{
> +	struct i2c_client *client;
> +
> +	client = i2c_new_scanned_device(adap, info, addr_list, probe);
> +	return IS_ERR(client) ? NULL : client;
>  }
>  EXPORT_SYMBOL_GPL(i2c_new_probed_device);
>  
> diff --git a/include/linux/i2c.h b/include/linux/i2c.h
> index aaf57d9b41db..df3044513464 100644
> --- a/include/linux/i2c.h
> +++ b/include/linux/i2c.h
> @@ -452,10 +452,16 @@ i2c_new_client_device(struct i2c_adapter *adap, struct i2c_board_info const *inf
>   * a default probing method is used.
>   */
>  extern struct i2c_client *
> +i2c_new_scanned_device(struct i2c_adapter *adap,
> +		       struct i2c_board_info *info,
> +		       unsigned short const *addr_list,
> +		       int (*probe)(struct i2c_adapter *adap, unsigned short addr));
> +
> +extern struct i2c_client *

I beg your pardon for the newbie question, perhaps a stupid one, kind of
nitpicking, and not even strictly related to this patch, but what's the
reason for these functions being declared extern?

For the rest LGTM, I did some grep checks before/after the patchset, ran
some build tests, and everything looks fine.

-- 
Luca

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

* Re: [RFC PATCH 01/12] i2c: replace i2c_new_probed_device with an ERR_PTR variant
  2019-11-07 17:31   ` Luca Ceresoli
@ 2019-11-07 19:22     ` Wolfram Sang
  2019-11-08  8:01       ` Luca Ceresoli
  0 siblings, 1 reply; 47+ messages in thread
From: Wolfram Sang @ 2019-11-07 19:22 UTC (permalink / raw)
  To: Luca Ceresoli; +Cc: Wolfram Sang, linux-i2c, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 618 bytes --]

Hi Luca,

> I beg your pardon for the newbie question, perhaps a stupid one, kind of
> nitpicking, and not even strictly related to this patch, but what's the
> reason for these functions being declared extern?

I did this for consistency reasons. I agree that the 'extern' keyword
could need some second thought, yet I think that should be a seperate
patchset. And that does not have priority for me, so if someone is
interested... :)

> For the rest LGTM, I did some grep checks before/after the patchset, ran
> some build tests, and everything looks fine.

Cool, thanks for your review!

All the best,

   Wolfram


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [RFC PATCH 01/12] i2c: replace i2c_new_probed_device with an ERR_PTR variant
  2019-11-07 19:22     ` Wolfram Sang
@ 2019-11-08  8:01       ` Luca Ceresoli
  0 siblings, 0 replies; 47+ messages in thread
From: Luca Ceresoli @ 2019-11-08  8:01 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: Wolfram Sang, linux-i2c, linux-kernel

Hi Wolfram,

On 07/11/19 20:22, Wolfram Sang wrote:
> Hi Luca,
> 
>> I beg your pardon for the newbie question, perhaps a stupid one, kind of
>> nitpicking, and not even strictly related to this patch, but what's the
>> reason for these functions being declared extern?
> 
> I did this for consistency reasons. I agree that the 'extern' keyword
> could need some second thought, yet I think that should be a seperate
> patchset. And that does not have priority for me, so if someone is
> interested... :)

Ok, got it!

And then:
Reviewed-by: Luca Ceresoli <luca@lucaceresoli.net>

Bye,
-- 
Luca

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

* Re: [RFC PATCH 06/12] input: mouse: convert to i2c_new_scanned_device
  2019-11-06  9:50 ` [RFC PATCH 06/12] input: mouse: " Wolfram Sang
@ 2019-11-11 18:19   ` Dmitry Torokhov
  0 siblings, 0 replies; 47+ messages in thread
From: Dmitry Torokhov @ 2019-11-11 18:19 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, linux-input, linux-kernel

On Wed, Nov 06, 2019 at 10:50:24AM +0100, Wolfram Sang wrote:
> Move from the deprecated i2c_new_probed_device() to the new
> i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> 
> Build tested only. RFC, please comment and/or ack, but don't apply yet.
> 
>  drivers/input/mouse/psmouse-smbus.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/input/mouse/psmouse-smbus.c b/drivers/input/mouse/psmouse-smbus.c
> index 027efdd2b2ad..35bf50a871d2 100644
> --- a/drivers/input/mouse/psmouse-smbus.c
> +++ b/drivers/input/mouse/psmouse-smbus.c
> @@ -198,10 +198,12 @@ static int psmouse_smbus_create_companion(struct device *dev, void *data)
>  	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_HOST_NOTIFY))
>  		return 0;
>  
> -	smbdev->client = i2c_new_probed_device(adapter, &smbdev->board,
> -					       addr_list, NULL);
> -	if (!smbdev->client)
> +	smbdev->client = i2c_new_scanned_device(adapter, &smbdev->board,
> +					        addr_list, NULL);
> +	if (IS_ERR(smbdev->client)) {
> +		smbdev->client = NULL;
>  		return 0;
> +	}
>  
>  	/* We have our(?) device, stop iterating i2c bus. */
>  	return 1;

I'd prefer postponing assignment until after we get valid value. I.e.

	client = i2c_new_probed_device(...);
	if (IS_ERR(client))
		return 0;

	/* We have our(?) device, stop iterating i2c bus. */
	smbdev->client = client;
	return 1;

Thanks.

-- 
Dmitry

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

* Re: [RFC PATCH 01/12] i2c: replace i2c_new_probed_device with an ERR_PTR variant
  2019-11-06  9:50 ` [RFC PATCH 01/12] " Wolfram Sang
  2019-11-06 12:39   ` Max Staudt
  2019-11-07 17:31   ` Luca Ceresoli
@ 2019-11-28 16:16   ` Wolfram Sang
  2 siblings, 0 replies; 47+ messages in thread
From: Wolfram Sang @ 2019-11-28 16:16 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 666 bytes --]

On Wed, Nov 06, 2019 at 10:50:19AM +0100, Wolfram Sang wrote:
> In the general move to have i2c_new_*_device functions which return
> ERR_PTR instead of NULL, this patch converts i2c_new_probed_device().
> 
> There are only few users, so this patch converts the I2C core and all
> users in one go. The function gets renamed to i2c_new_scanned_device()
> so out-of-tree users will get a build failure to understand they need to
> adapt their error checking code.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Eeks, this nearly slipped through the cracks because I marked it as RFC
in patchwork...

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [RFC PATCH 02/12] i2c: icy: convert to i2c_new_scanned_device
  2019-11-06  9:50 ` [RFC PATCH 02/12] i2c: icy: convert to i2c_new_scanned_device Wolfram Sang
  2019-11-06 11:33   ` Max Staudt
@ 2019-11-28 16:16   ` Wolfram Sang
  1 sibling, 0 replies; 47+ messages in thread
From: Wolfram Sang @ 2019-11-28 16:16 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, Max Staudt, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 299 bytes --]

On Wed, Nov 06, 2019 at 10:50:20AM +0100, Wolfram Sang wrote:
> Move from the deprecated i2c_new_probed_device() to the new
> i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [RFC PATCH 05/12] video: fbdev: matrox: convert to i2c_new_scanned_device
  2019-11-07  8:33     ` Daniel Vetter
  (?)
@ 2019-11-28 16:18       ` Wolfram Sang
  -1 siblings, 0 replies; 47+ messages in thread
From: Wolfram Sang @ 2019-11-28 16:18 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c, linux-fbdev, linux-kernel, dri-devel,
	Bartlomiej Zolnierkiewicz

[-- Attachment #1: Type: text/plain, Size: 517 bytes --]

On Thu, Nov 07, 2019 at 09:33:54AM +0100, Daniel Vetter wrote:
> On Wed, Nov 06, 2019 at 10:50:23AM +0100, Wolfram Sang wrote:
> > Move from the deprecated i2c_new_probed_device() to the new
> > i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.
> > 
> > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> 
> Ack for merging through whatever tree you think this should best land
> through.

Ok, because it is a single and simple patch, I'll apply it simply via
I2C. Thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [RFC PATCH 05/12] video: fbdev: matrox: convert to i2c_new_scanned_device
@ 2019-11-28 16:18       ` Wolfram Sang
  0 siblings, 0 replies; 47+ messages in thread
From: Wolfram Sang @ 2019-11-28 16:18 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c, linux-fbdev, linux-kernel, dri-devel,
	Bartlomiej Zolnierkiewicz

[-- Attachment #1: Type: text/plain, Size: 517 bytes --]

On Thu, Nov 07, 2019 at 09:33:54AM +0100, Daniel Vetter wrote:
> On Wed, Nov 06, 2019 at 10:50:23AM +0100, Wolfram Sang wrote:
> > Move from the deprecated i2c_new_probed_device() to the new
> > i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.
> > 
> > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> 
> Ack for merging through whatever tree you think this should best land
> through.

Ok, because it is a single and simple patch, I'll apply it simply via
I2C. Thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [RFC PATCH 05/12] video: fbdev: matrox: convert to i2c_new_scanned_device
@ 2019-11-28 16:18       ` Wolfram Sang
  0 siblings, 0 replies; 47+ messages in thread
From: Wolfram Sang @ 2019-11-28 16:18 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c, linux-fbdev, linux-kernel, dri-devel,
	Bartlomiej Zolnierkiewicz


[-- Attachment #1.1: Type: text/plain, Size: 517 bytes --]

On Thu, Nov 07, 2019 at 09:33:54AM +0100, Daniel Vetter wrote:
> On Wed, Nov 06, 2019 at 10:50:23AM +0100, Wolfram Sang wrote:
> > Move from the deprecated i2c_new_probed_device() to the new
> > i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.
> > 
> > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> 
> Ack for merging through whatever tree you think this should best land
> through.

Ok, because it is a single and simple patch, I'll apply it simply via
I2C. Thanks!


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [RFC PATCH 05/12] video: fbdev: matrox: convert to i2c_new_scanned_device
  2019-11-06  9:50   ` Wolfram Sang
  (?)
@ 2019-11-28 16:19     ` Wolfram Sang
  -1 siblings, 0 replies; 47+ messages in thread
From: Wolfram Sang @ 2019-11-28 16:19 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, Bartlomiej Zolnierkiewicz, dri-devel, linux-fbdev,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 299 bytes --]

On Wed, Nov 06, 2019 at 10:50:23AM +0100, Wolfram Sang wrote:
> Move from the deprecated i2c_new_probed_device() to the new
> i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [RFC PATCH 05/12] video: fbdev: matrox: convert to i2c_new_scanned_device
@ 2019-11-28 16:19     ` Wolfram Sang
  0 siblings, 0 replies; 47+ messages in thread
From: Wolfram Sang @ 2019-11-28 16:19 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, Bartlomiej Zolnierkiewicz, dri-devel, linux-fbdev,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 299 bytes --]

On Wed, Nov 06, 2019 at 10:50:23AM +0100, Wolfram Sang wrote:
> Move from the deprecated i2c_new_probed_device() to the new
> i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [RFC PATCH 05/12] video: fbdev: matrox: convert to i2c_new_scanned_device
@ 2019-11-28 16:19     ` Wolfram Sang
  0 siblings, 0 replies; 47+ messages in thread
From: Wolfram Sang @ 2019-11-28 16:19 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-kernel, linux-fbdev, linux-i2c, dri-devel,
	Bartlomiej Zolnierkiewicz


[-- Attachment #1.1: Type: text/plain, Size: 299 bytes --]

On Wed, Nov 06, 2019 at 10:50:23AM +0100, Wolfram Sang wrote:
> Move from the deprecated i2c_new_probed_device() to the new
> i2c_new_scanned_device(). Make use of the new ERRPTR if suitable.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied to for-next, thanks!


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2019-11-28 16:24 UTC | newest]

Thread overview: 47+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-06  9:50 [RFC PATCH 00/12] i2c: replace i2c_new_probed_device with an ERR_PTR variant Wolfram Sang
2019-11-06  9:50 ` Wolfram Sang
2019-11-06  9:50 ` Wolfram Sang
2019-11-06  9:50 ` Wolfram Sang
2019-11-06  9:50 ` [RFC PATCH 01/12] " Wolfram Sang
2019-11-06 12:39   ` Max Staudt
2019-11-07 17:31   ` Luca Ceresoli
2019-11-07 19:22     ` Wolfram Sang
2019-11-08  8:01       ` Luca Ceresoli
2019-11-28 16:16   ` Wolfram Sang
2019-11-06  9:50 ` [RFC PATCH 02/12] i2c: icy: convert to i2c_new_scanned_device Wolfram Sang
2019-11-06 11:33   ` Max Staudt
2019-11-28 16:16   ` Wolfram Sang
2019-11-06  9:50 ` [RFC PATCH 03/12] macintosh: " Wolfram Sang
2019-11-06  9:50   ` Wolfram Sang
2019-11-06  9:50 ` [RFC PATCH 04/12] platform: chrome: " Wolfram Sang
2019-11-06  9:50 ` [RFC PATCH 05/12] video: fbdev: matrox: " Wolfram Sang
2019-11-06  9:50   ` Wolfram Sang
2019-11-06  9:50   ` Wolfram Sang
2019-11-07  8:33   ` Daniel Vetter
2019-11-07  8:33     ` Daniel Vetter
2019-11-07  8:33     ` Daniel Vetter
2019-11-28 16:18     ` Wolfram Sang
2019-11-28 16:18       ` Wolfram Sang
2019-11-28 16:18       ` Wolfram Sang
2019-11-28 16:19   ` Wolfram Sang
2019-11-28 16:19     ` Wolfram Sang
2019-11-28 16:19     ` Wolfram Sang
2019-11-06  9:50 ` [RFC PATCH 06/12] input: mouse: " Wolfram Sang
2019-11-11 18:19   ` Dmitry Torokhov
2019-11-06  9:50 ` [RFC PATCH 07/12] media: pci: cx23885: " Wolfram Sang
2019-11-06 11:18   ` Hans Verkuil
2019-11-06  9:50 ` [RFC PATCH 08/12] media: pci: cx88: " Wolfram Sang
2019-11-06 11:18   ` Hans Verkuil
2019-11-06 14:49     ` Wolfram Sang
2019-11-06  9:50 ` [RFC PATCH 09/12] media: pci: bt8xx: " Wolfram Sang
2019-11-06 11:19   ` Hans Verkuil
2019-11-06  9:50 ` [RFC PATCH 10/12] media: pci: cx18: " Wolfram Sang
2019-11-06 11:23   ` Hans Verkuil
2019-11-06  9:50 ` [RFC PATCH 11/12] media: pci: ivtv: " Wolfram Sang
2019-11-06 11:21   ` Hans Verkuil
2019-11-06  9:50 ` [RFC PATCH 12/12] media: v4l2-core: " Wolfram Sang
2019-11-06 11:24   ` Hans Verkuil
2019-11-06 10:06 ` [RFC PATCH 00/12] i2c: replace i2c_new_probed_device with an ERR_PTR variant Sean Young
2019-11-06 10:06   ` Sean Young
2019-11-06 10:06   ` Sean Young
2019-11-06 10:06   ` Sean Young

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.