linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] iio: convert subsystem to i2c_new_dummy_device()
@ 2019-07-22 17:26 Wolfram Sang
  2019-07-22 17:26 ` [PATCH 1/3] iio: light: cm36651: 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-iio, 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):
  iio: light: cm36651: convert to i2c_new_dummy_device
  iio: light: veml6070: convert to i2c_new_dummy_device
  iio: pressure: hp03: convert to i2c_new_dummy_device

 drivers/iio/light/cm36651.c  | 12 ++++++------
 drivers/iio/light/veml6070.c |  6 +++---
 drivers/iio/pressure/hp03.c  |  6 +++---
 3 files changed, 12 insertions(+), 12 deletions(-)

-- 
2.20.1


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

* [PATCH 1/3] iio: light: cm36651: convert to i2c_new_dummy_device
  2019-07-22 17:26 [PATCH 0/3] iio: convert subsystem to i2c_new_dummy_device() Wolfram Sang
@ 2019-07-22 17:26 ` Wolfram Sang
  2019-07-27 19:56   ` Jonathan Cameron
  2019-07-22 17:26 ` [PATCH 2/3] iio: light: veml6070: " Wolfram Sang
  2019-07-22 17:26 ` [PATCH 3/3] iio: pressure: hp03: " 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, Kevin Tsai, Jonathan Cameron, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler, linux-iio,
	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/iio/light/cm36651.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/light/cm36651.c b/drivers/iio/light/cm36651.c
index 7702c2bcbcfa..1019d625adb1 100644
--- a/drivers/iio/light/cm36651.c
+++ b/drivers/iio/light/cm36651.c
@@ -646,18 +646,18 @@ static int cm36651_probe(struct i2c_client *client,
 	i2c_set_clientdata(client, indio_dev);
 
 	cm36651->client = client;
-	cm36651->ps_client = i2c_new_dummy(client->adapter,
+	cm36651->ps_client = i2c_new_dummy_device(client->adapter,
 						     CM36651_I2C_ADDR_PS);
-	if (!cm36651->ps_client) {
+	if (IS_ERR(cm36651->ps_client)) {
 		dev_err(&client->dev, "%s: new i2c device failed\n", __func__);
-		ret = -ENODEV;
+		ret = PTR_ERR(cm36651->ps_client);
 		goto error_disable_reg;
 	}
 
-	cm36651->ara_client = i2c_new_dummy(client->adapter, CM36651_ARA);
-	if (!cm36651->ara_client) {
+	cm36651->ara_client = i2c_new_dummy_device(client->adapter, CM36651_ARA);
+	if (IS_ERR(cm36651->ara_client)) {
 		dev_err(&client->dev, "%s: new i2c device failed\n", __func__);
-		ret = -ENODEV;
+		ret = PTR_ERR(cm36651->ara_client);
 		goto error_i2c_unregister_ps;
 	}
 
-- 
2.20.1


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

* [PATCH 2/3] iio: light: veml6070: convert to i2c_new_dummy_device
  2019-07-22 17:26 [PATCH 0/3] iio: convert subsystem to i2c_new_dummy_device() Wolfram Sang
  2019-07-22 17:26 ` [PATCH 1/3] iio: light: cm36651: convert to i2c_new_dummy_device Wolfram Sang
@ 2019-07-22 17:26 ` Wolfram Sang
  2019-07-27 19:58   ` Jonathan Cameron
  2019-07-22 17:26 ` [PATCH 3/3] iio: pressure: hp03: " 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, Jonathan Cameron, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler, linux-iio,
	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/iio/light/veml6070.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/light/veml6070.c b/drivers/iio/light/veml6070.c
index a3138e1b5803..0be553ad5989 100644
--- a/drivers/iio/light/veml6070.c
+++ b/drivers/iio/light/veml6070.c
@@ -158,10 +158,10 @@ static int veml6070_probe(struct i2c_client *client,
 	indio_dev->name = VEML6070_DRV_NAME;
 	indio_dev->modes = INDIO_DIRECT_MODE;
 
-	data->client2 = i2c_new_dummy(client->adapter, VEML6070_ADDR_DATA_LSB);
-	if (!data->client2) {
+	data->client2 = i2c_new_dummy_device(client->adapter, VEML6070_ADDR_DATA_LSB);
+	if (IS_ERR(data->client2)) {
 		dev_err(&client->dev, "i2c device for second chip address failed\n");
-		return -ENODEV;
+		return PTR_ERR(data->client2);
 	}
 
 	data->config = VEML6070_IT_10 | VEML6070_COMMAND_RSRVD |
-- 
2.20.1


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

* [PATCH 3/3] iio: pressure: hp03: convert to i2c_new_dummy_device
  2019-07-22 17:26 [PATCH 0/3] iio: convert subsystem to i2c_new_dummy_device() Wolfram Sang
  2019-07-22 17:26 ` [PATCH 1/3] iio: light: cm36651: convert to i2c_new_dummy_device Wolfram Sang
  2019-07-22 17:26 ` [PATCH 2/3] iio: light: veml6070: " Wolfram Sang
@ 2019-07-22 17:26 ` Wolfram Sang
  2019-07-27 19:59   ` Jonathan Cameron
  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, Jonathan Cameron, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler, linux-iio,
	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/iio/pressure/hp03.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/pressure/hp03.c b/drivers/iio/pressure/hp03.c
index f00102577fd5..026ba15ef68f 100644
--- a/drivers/iio/pressure/hp03.c
+++ b/drivers/iio/pressure/hp03.c
@@ -243,10 +243,10 @@ static int hp03_probe(struct i2c_client *client,
 	 * which has it's dedicated I2C address and contains
 	 * the calibration constants for the sensor.
 	 */
-	priv->eeprom_client = i2c_new_dummy(client->adapter, HP03_EEPROM_ADDR);
-	if (!priv->eeprom_client) {
+	priv->eeprom_client = i2c_new_dummy_device(client->adapter, HP03_EEPROM_ADDR);
+	if (IS_ERR(priv->eeprom_client)) {
 		dev_err(dev, "New EEPROM I2C device failed\n");
-		return -ENODEV;
+		return PTR_ERR(priv->eeprom_client);
 	}
 
 	priv->eeprom_regmap = regmap_init_i2c(priv->eeprom_client,
-- 
2.20.1


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

* Re: [PATCH 1/3] iio: light: cm36651: convert to i2c_new_dummy_device
  2019-07-22 17:26 ` [PATCH 1/3] iio: light: cm36651: convert to i2c_new_dummy_device Wolfram Sang
@ 2019-07-27 19:56   ` Jonathan Cameron
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2019-07-27 19:56 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, Kevin Tsai, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, linux-kernel

On Mon, 22 Jul 2019 19:26:11 +0200
Wolfram Sang <wsa+renesas@sang-engineering.com> 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>

Hi,

Hmm. I've been rather busy recently so the IIO tree is based before this
got introduced.

Meh, it's early in the cycle so I'm just going to rebase and hope it
doesn't cause anyone too much pain.  I suspect the number of people
tracking my togreg branch is very small to 0.

Applied to a rebase version of the togreg branch of iio.git and
pushed out as testing for the autobuilders to poke at it.

Thanks,

Jonathan


> ---
> 
> Generated with coccinelle. Build tested by me and buildbot. Not tested on HW.
> 
>  drivers/iio/light/cm36651.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iio/light/cm36651.c b/drivers/iio/light/cm36651.c
> index 7702c2bcbcfa..1019d625adb1 100644
> --- a/drivers/iio/light/cm36651.c
> +++ b/drivers/iio/light/cm36651.c
> @@ -646,18 +646,18 @@ static int cm36651_probe(struct i2c_client *client,
>  	i2c_set_clientdata(client, indio_dev);
>  
>  	cm36651->client = client;
> -	cm36651->ps_client = i2c_new_dummy(client->adapter,
> +	cm36651->ps_client = i2c_new_dummy_device(client->adapter,
>  						     CM36651_I2C_ADDR_PS);
> -	if (!cm36651->ps_client) {
> +	if (IS_ERR(cm36651->ps_client)) {
>  		dev_err(&client->dev, "%s: new i2c device failed\n", __func__);
> -		ret = -ENODEV;
> +		ret = PTR_ERR(cm36651->ps_client);
>  		goto error_disable_reg;
>  	}
>  
> -	cm36651->ara_client = i2c_new_dummy(client->adapter, CM36651_ARA);
> -	if (!cm36651->ara_client) {
> +	cm36651->ara_client = i2c_new_dummy_device(client->adapter, CM36651_ARA);
> +	if (IS_ERR(cm36651->ara_client)) {
>  		dev_err(&client->dev, "%s: new i2c device failed\n", __func__);
> -		ret = -ENODEV;
> +		ret = PTR_ERR(cm36651->ara_client);
>  		goto error_i2c_unregister_ps;
>  	}
>  


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

* Re: [PATCH 2/3] iio: light: veml6070: convert to i2c_new_dummy_device
  2019-07-22 17:26 ` [PATCH 2/3] iio: light: veml6070: " Wolfram Sang
@ 2019-07-27 19:58   ` Jonathan Cameron
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2019-07-27 19:58 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, linux-kernel

On Mon, 22 Jul 2019 19:26:12 +0200
Wolfram Sang <wsa+renesas@sang-engineering.com> 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 the togreg branch of iio.git and pushed out as testing
for the autobuilders to do something random with it.

Thanks,

Jonathan

> ---
> 
> Generated with coccinelle. Build tested by me and buildbot. Not tested on HW.
> 
>  drivers/iio/light/veml6070.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/light/veml6070.c b/drivers/iio/light/veml6070.c
> index a3138e1b5803..0be553ad5989 100644
> --- a/drivers/iio/light/veml6070.c
> +++ b/drivers/iio/light/veml6070.c
> @@ -158,10 +158,10 @@ static int veml6070_probe(struct i2c_client *client,
>  	indio_dev->name = VEML6070_DRV_NAME;
>  	indio_dev->modes = INDIO_DIRECT_MODE;
>  
> -	data->client2 = i2c_new_dummy(client->adapter, VEML6070_ADDR_DATA_LSB);
> -	if (!data->client2) {
> +	data->client2 = i2c_new_dummy_device(client->adapter, VEML6070_ADDR_DATA_LSB);
> +	if (IS_ERR(data->client2)) {
>  		dev_err(&client->dev, "i2c device for second chip address failed\n");
> -		return -ENODEV;
> +		return PTR_ERR(data->client2);
>  	}
>  
>  	data->config = VEML6070_IT_10 | VEML6070_COMMAND_RSRVD |


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

* Re: [PATCH 3/3] iio: pressure: hp03: convert to i2c_new_dummy_device
  2019-07-22 17:26 ` [PATCH 3/3] iio: pressure: hp03: " Wolfram Sang
@ 2019-07-27 19:59   ` Jonathan Cameron
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2019-07-27 19:59 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, linux-kernel

On Mon, 22 Jul 2019 19:26:13 +0200
Wolfram Sang <wsa+renesas@sang-engineering.com> 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, thanks.

J
> ---
> 
> Generated with coccinelle. Build tested by me and buildbot. Not tested on HW.
> 
>  drivers/iio/pressure/hp03.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/pressure/hp03.c b/drivers/iio/pressure/hp03.c
> index f00102577fd5..026ba15ef68f 100644
> --- a/drivers/iio/pressure/hp03.c
> +++ b/drivers/iio/pressure/hp03.c
> @@ -243,10 +243,10 @@ static int hp03_probe(struct i2c_client *client,
>  	 * which has it's dedicated I2C address and contains
>  	 * the calibration constants for the sensor.
>  	 */
> -	priv->eeprom_client = i2c_new_dummy(client->adapter, HP03_EEPROM_ADDR);
> -	if (!priv->eeprom_client) {
> +	priv->eeprom_client = i2c_new_dummy_device(client->adapter, HP03_EEPROM_ADDR);
> +	if (IS_ERR(priv->eeprom_client)) {
>  		dev_err(dev, "New EEPROM I2C device failed\n");
> -		return -ENODEV;
> +		return PTR_ERR(priv->eeprom_client);
>  	}
>  
>  	priv->eeprom_regmap = regmap_init_i2c(priv->eeprom_client,


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

end of thread, other threads:[~2019-07-27 19:59 UTC | newest]

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] iio: convert subsystem to i2c_new_dummy_device() Wolfram Sang
2019-07-22 17:26 ` [PATCH 1/3] iio: light: cm36651: convert to i2c_new_dummy_device Wolfram Sang
2019-07-27 19:56   ` Jonathan Cameron
2019-07-22 17:26 ` [PATCH 2/3] iio: light: veml6070: " Wolfram Sang
2019-07-27 19:58   ` Jonathan Cameron
2019-07-22 17:26 ` [PATCH 3/3] iio: pressure: hp03: " Wolfram Sang
2019-07-27 19:59   ` Jonathan Cameron

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