Linux-Hwmon Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/3] hwmon: convert subsystem to i2c_new_dummy_device()
@ 2019-07-22 17:26 Wolfram Sang
  2019-07-22 17:26 ` [PATCH 1/3] hwmon: asb100: convert to i2c_new_dummy_device Wolfram Sang
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Wolfram Sang @ 2019-07-22 17:26 UTC (permalink / raw)
  To: linux-i2c; +Cc: Wolfram Sang, linux-hwmon, linux-kernel

This series is part of a tree-wide movement to replace the I2C API call
'i2c_new_dummy' which returns NULL with its new counterpart returning an
ERRPTR.

The series was generated with coccinelle (audited afterwards, of course) and
build tested by me and by buildbot. No tests on HW have been performed.

The branch is based on v5.3-rc1. A branch (with some more stuff included) can
be found here:

git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git renesas/i2c/new_dummy

Some drivers still need to be manually converted. Patches for those will be
sent out individually.


Wolfram Sang (3):
  hwmon: asb100: convert to i2c_new_dummy_device
  hwmon: smm665: convert to i2c_new_dummy_device
  hwmon: w83781d: convert to i2c_new_dummy_device

 drivers/hwmon/asb100.c  | 12 ++++++------
 drivers/hwmon/smm665.c  |  6 +++---
 drivers/hwmon/w83781d.c |  6 +++---
 3 files changed, 12 insertions(+), 12 deletions(-)

-- 
2.20.1


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

* [PATCH 1/3] hwmon: asb100: convert to i2c_new_dummy_device
  2019-07-22 17:26 [PATCH 0/3] hwmon: convert subsystem to i2c_new_dummy_device() Wolfram Sang
@ 2019-07-22 17:26 ` Wolfram Sang
  2019-07-22 18:28   ` Guenter Roeck
  2019-07-22 17:26 ` [PATCH 2/3] hwmon: smm665: " Wolfram Sang
  2019-07-22 17:26 ` [PATCH 3/3] hwmon: w83781d: " Wolfram Sang
  2 siblings, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2019-07-22 17:26 UTC (permalink / raw)
  To: linux-i2c
  Cc: Wolfram Sang, Jean Delvare, Guenter Roeck, linux-hwmon, linux-kernel

Move from i2c_new_dummy() to i2c_new_dummy_device(), so we now get an
ERRPTR which we use in error handling.

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

Generated with coccinelle. Build tested by me and buildbot. Not tested on HW.

 drivers/hwmon/asb100.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/hwmon/asb100.c b/drivers/hwmon/asb100.c
index c9fa84b25678..4c609e23a4ef 100644
--- a/drivers/hwmon/asb100.c
+++ b/drivers/hwmon/asb100.c
@@ -706,21 +706,21 @@ static int asb100_detect_subclients(struct i2c_client *client)
 		goto ERROR_SC_2;
 	}
 
-	data->lm75[0] = i2c_new_dummy(adapter, sc_addr[0]);
-	if (!data->lm75[0]) {
+	data->lm75[0] = i2c_new_dummy_device(adapter, sc_addr[0]);
+	if (IS_ERR(data->lm75[0])) {
 		dev_err(&client->dev,
 			"subclient %d registration at address 0x%x failed.\n",
 			1, sc_addr[0]);
-		err = -ENOMEM;
+		err = PTR_ERR(data->lm75[0]);
 		goto ERROR_SC_2;
 	}
 
-	data->lm75[1] = i2c_new_dummy(adapter, sc_addr[1]);
-	if (!data->lm75[1]) {
+	data->lm75[1] = i2c_new_dummy_device(adapter, sc_addr[1]);
+	if (IS_ERR(data->lm75[1])) {
 		dev_err(&client->dev,
 			"subclient %d registration at address 0x%x failed.\n",
 			2, sc_addr[1]);
-		err = -ENOMEM;
+		err = PTR_ERR(data->lm75[1]);
 		goto ERROR_SC_3;
 	}
 
-- 
2.20.1


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

* [PATCH 2/3] hwmon: smm665: convert to i2c_new_dummy_device
  2019-07-22 17:26 [PATCH 0/3] hwmon: convert subsystem to i2c_new_dummy_device() Wolfram Sang
  2019-07-22 17:26 ` [PATCH 1/3] hwmon: asb100: convert to i2c_new_dummy_device Wolfram Sang
@ 2019-07-22 17:26 ` " Wolfram Sang
  2019-07-22 18:29   ` Guenter Roeck
  2019-07-22 17:26 ` [PATCH 3/3] hwmon: w83781d: " Wolfram Sang
  2 siblings, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2019-07-22 17:26 UTC (permalink / raw)
  To: linux-i2c
  Cc: Wolfram Sang, Guenter Roeck, Jean Delvare, linux-hwmon, linux-kernel

Move from i2c_new_dummy() to i2c_new_dummy_device(), so we now get an
ERRPTR which we use in error handling.

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

Generated with coccinelle. Build tested by me and buildbot. Not tested on HW.

 drivers/hwmon/smm665.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/hwmon/smm665.c b/drivers/hwmon/smm665.c
index d8c91c2cb8cf..6eff14fe395d 100644
--- a/drivers/hwmon/smm665.c
+++ b/drivers/hwmon/smm665.c
@@ -586,10 +586,10 @@ static int smm665_probe(struct i2c_client *client,
 
 	data->client = client;
 	data->type = id->driver_data;
-	data->cmdreg = i2c_new_dummy(adapter, (client->addr & ~SMM665_REGMASK)
+	data->cmdreg = i2c_new_dummy_device(adapter, (client->addr & ~SMM665_REGMASK)
 				     | SMM665_CMDREG_BASE);
-	if (!data->cmdreg)
-		return -ENOMEM;
+	if (IS_ERR(data->cmdreg))
+		return PTR_ERR(data->cmdreg);
 
 	switch (data->type) {
 	case smm465:
-- 
2.20.1


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

* [PATCH 3/3] hwmon: w83781d: convert to i2c_new_dummy_device
  2019-07-22 17:26 [PATCH 0/3] hwmon: convert subsystem to i2c_new_dummy_device() Wolfram Sang
  2019-07-22 17:26 ` [PATCH 1/3] hwmon: asb100: convert to i2c_new_dummy_device Wolfram Sang
  2019-07-22 17:26 ` [PATCH 2/3] hwmon: smm665: " Wolfram Sang
@ 2019-07-22 17:26 ` " Wolfram Sang
  2019-07-22 18:30   ` Guenter Roeck
  2 siblings, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2019-07-22 17:26 UTC (permalink / raw)
  To: linux-i2c
  Cc: Wolfram Sang, Jean Delvare, Guenter Roeck, linux-hwmon, linux-kernel

Move from i2c_new_dummy() to i2c_new_dummy_device(), so we now get an
ERRPTR which we use in error handling.

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

Generated with coccinelle. Build tested by me and buildbot. Not tested on HW.

 drivers/hwmon/w83781d.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c
index d2c04b6a3f2b..015f1ea31966 100644
--- a/drivers/hwmon/w83781d.c
+++ b/drivers/hwmon/w83781d.c
@@ -894,12 +894,12 @@ w83781d_detect_subclients(struct i2c_client *new_client)
 	}
 
 	for (i = 0; i < num_sc; i++) {
-		data->lm75[i] = i2c_new_dummy(adapter, sc_addr[i]);
-		if (!data->lm75[i]) {
+		data->lm75[i] = i2c_new_dummy_device(adapter, sc_addr[i]);
+		if (IS_ERR(data->lm75[i])) {
 			dev_err(&new_client->dev,
 				"Subclient %d registration at address 0x%x failed.\n",
 				i, sc_addr[i]);
-			err = -ENOMEM;
+			err = PTR_ERR(data->lm75[i]);
 			if (i == 1)
 				goto ERROR_SC_3;
 			goto ERROR_SC_2;
-- 
2.20.1


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

* Re: [PATCH 1/3] hwmon: asb100: convert to i2c_new_dummy_device
  2019-07-22 17:26 ` [PATCH 1/3] hwmon: asb100: convert to i2c_new_dummy_device Wolfram Sang
@ 2019-07-22 18:28   ` Guenter Roeck
  0 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2019-07-22 18:28 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, Jean Delvare, linux-hwmon, linux-kernel

On Mon, Jul 22, 2019 at 07:26:08PM +0200, Wolfram Sang wrote:
> Move from i2c_new_dummy() to i2c_new_dummy_device(), so we now get an
> ERRPTR which we use in error handling.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied to hwmon-next.

Thanks,
Guenter

> ---
> 
> Generated with coccinelle. Build tested by me and buildbot. Not tested on HW.
> 
>  drivers/hwmon/asb100.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/hwmon/asb100.c b/drivers/hwmon/asb100.c
> index c9fa84b25678..4c609e23a4ef 100644
> --- a/drivers/hwmon/asb100.c
> +++ b/drivers/hwmon/asb100.c
> @@ -706,21 +706,21 @@ static int asb100_detect_subclients(struct i2c_client *client)
>  		goto ERROR_SC_2;
>  	}
>  
> -	data->lm75[0] = i2c_new_dummy(adapter, sc_addr[0]);
> -	if (!data->lm75[0]) {
> +	data->lm75[0] = i2c_new_dummy_device(adapter, sc_addr[0]);
> +	if (IS_ERR(data->lm75[0])) {
>  		dev_err(&client->dev,
>  			"subclient %d registration at address 0x%x failed.\n",
>  			1, sc_addr[0]);
> -		err = -ENOMEM;
> +		err = PTR_ERR(data->lm75[0]);
>  		goto ERROR_SC_2;
>  	}
>  
> -	data->lm75[1] = i2c_new_dummy(adapter, sc_addr[1]);
> -	if (!data->lm75[1]) {
> +	data->lm75[1] = i2c_new_dummy_device(adapter, sc_addr[1]);
> +	if (IS_ERR(data->lm75[1])) {
>  		dev_err(&client->dev,
>  			"subclient %d registration at address 0x%x failed.\n",
>  			2, sc_addr[1]);
> -		err = -ENOMEM;
> +		err = PTR_ERR(data->lm75[1]);
>  		goto ERROR_SC_3;
>  	}
>  

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

* Re: [PATCH 2/3] hwmon: smm665: convert to i2c_new_dummy_device
  2019-07-22 17:26 ` [PATCH 2/3] hwmon: smm665: " Wolfram Sang
@ 2019-07-22 18:29   ` Guenter Roeck
  0 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2019-07-22 18:29 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, Jean Delvare, linux-hwmon, linux-kernel

On Mon, Jul 22, 2019 at 07:26:09PM +0200, Wolfram Sang wrote:
> Move from i2c_new_dummy() to i2c_new_dummy_device(), so we now get an
> ERRPTR which we use in error handling.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied to hwmon-next.

Thanks,
Guenter

> ---
> 
> Generated with coccinelle. Build tested by me and buildbot. Not tested on HW.
> 
>  drivers/hwmon/smm665.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hwmon/smm665.c b/drivers/hwmon/smm665.c
> index d8c91c2cb8cf..6eff14fe395d 100644
> --- a/drivers/hwmon/smm665.c
> +++ b/drivers/hwmon/smm665.c
> @@ -586,10 +586,10 @@ static int smm665_probe(struct i2c_client *client,
>  
>  	data->client = client;
>  	data->type = id->driver_data;
> -	data->cmdreg = i2c_new_dummy(adapter, (client->addr & ~SMM665_REGMASK)
> +	data->cmdreg = i2c_new_dummy_device(adapter, (client->addr & ~SMM665_REGMASK)
>  				     | SMM665_CMDREG_BASE);
> -	if (!data->cmdreg)
> -		return -ENOMEM;
> +	if (IS_ERR(data->cmdreg))
> +		return PTR_ERR(data->cmdreg);
>  
>  	switch (data->type) {
>  	case smm465:

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

* Re: [PATCH 3/3] hwmon: w83781d: convert to i2c_new_dummy_device
  2019-07-22 17:26 ` [PATCH 3/3] hwmon: w83781d: " Wolfram Sang
@ 2019-07-22 18:30   ` Guenter Roeck
  0 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2019-07-22 18:30 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, Jean Delvare, linux-hwmon, linux-kernel

On Mon, Jul 22, 2019 at 07:26:10PM +0200, Wolfram Sang wrote:
> Move from i2c_new_dummy() to i2c_new_dummy_device(), so we now get an
> ERRPTR which we use in error handling.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied to hwmon-next.

Thanks,
Guenter

> ---
> 
> Generated with coccinelle. Build tested by me and buildbot. Not tested on HW.
> 
>  drivers/hwmon/w83781d.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c
> index d2c04b6a3f2b..015f1ea31966 100644
> --- a/drivers/hwmon/w83781d.c
> +++ b/drivers/hwmon/w83781d.c
> @@ -894,12 +894,12 @@ w83781d_detect_subclients(struct i2c_client *new_client)
>  	}
>  
>  	for (i = 0; i < num_sc; i++) {
> -		data->lm75[i] = i2c_new_dummy(adapter, sc_addr[i]);
> -		if (!data->lm75[i]) {
> +		data->lm75[i] = i2c_new_dummy_device(adapter, sc_addr[i]);
> +		if (IS_ERR(data->lm75[i])) {
>  			dev_err(&new_client->dev,
>  				"Subclient %d registration at address 0x%x failed.\n",
>  				i, sc_addr[i]);
> -			err = -ENOMEM;
> +			err = PTR_ERR(data->lm75[i]);
>  			if (i == 1)
>  				goto ERROR_SC_3;
>  			goto ERROR_SC_2;

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

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-22 17:26 [PATCH 0/3] hwmon: convert subsystem to i2c_new_dummy_device() Wolfram Sang
2019-07-22 17:26 ` [PATCH 1/3] hwmon: asb100: convert to i2c_new_dummy_device Wolfram Sang
2019-07-22 18:28   ` Guenter Roeck
2019-07-22 17:26 ` [PATCH 2/3] hwmon: smm665: " Wolfram Sang
2019-07-22 18:29   ` Guenter Roeck
2019-07-22 17:26 ` [PATCH 3/3] hwmon: w83781d: " Wolfram Sang
2019-07-22 18:30   ` Guenter Roeck

Linux-Hwmon Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-hwmon/0 linux-hwmon/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-hwmon linux-hwmon/ https://lore.kernel.org/linux-hwmon \
		linux-hwmon@vger.kernel.org linux-hwmon@archiver.kernel.org
	public-inbox-index linux-hwmon


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-hwmon


AGPL code for this site: git clone https://public-inbox.org/ public-inbox