linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] platform: convert to use new I2C API
@ 2020-03-26 21:09 Wolfram Sang
  2020-03-26 21:09 ` [PATCH 1/2] platform/chrome: chromeos_laptop: make I2C API conversion complete Wolfram Sang
  2020-03-26 21:09 ` [PATCH 2/2] platform/mellanox: mlxreg-hotplug: convert to use i2c_new_client_device() Wolfram Sang
  0 siblings, 2 replies; 8+ messages in thread
From: Wolfram Sang @ 2020-03-26 21:09 UTC (permalink / raw)
  To: linux-i2c
  Cc: Wolfram Sang, Enric Balletbo i Serra, linux-kernel, platform-driver-x86

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


Wolfram Sang (2):
  platform/chrome: chromeos_laptop: make I2C API conversion complete
  platform/mellanox: mlxreg-hotplug: convert to use
    i2c_new_client_device()

 drivers/platform/chrome/chromeos_laptop.c  |  2 +-
 drivers/platform/mellanox/mlxreg-hotplug.c | 11 +++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

-- 
2.20.1


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

* [PATCH 1/2] platform/chrome: chromeos_laptop: make I2C API conversion complete
  2020-03-26 21:09 [PATCH 0/2] platform: convert to use new I2C API Wolfram Sang
@ 2020-03-26 21:09 ` Wolfram Sang
  2020-03-30 14:11   ` Enric Balletbo i Serra
  2020-03-26 21:09 ` [PATCH 2/2] platform/mellanox: mlxreg-hotplug: convert to use i2c_new_client_device() Wolfram Sang
  1 sibling, 1 reply; 8+ messages in thread
From: Wolfram Sang @ 2020-03-26 21:09 UTC (permalink / raw)
  To: linux-i2c
  Cc: Wolfram Sang, Benson Leung, Enric Balletbo i Serra, linux-kernel

When converting to i2c_new_scanned_device(), it was overlooked that a
conversion to i2c_new_client_device() was also needed. Fix it.

Fixes: c82ebf1bf738 ("platform/chrome: chromeos_laptop: Convert to i2c_new_scanned_device")
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/platform/chrome/chromeos_laptop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/chrome/chromeos_laptop.c b/drivers/platform/chrome/chromeos_laptop.c
index 4f3651fcd9fe..472a03daa869 100644
--- a/drivers/platform/chrome/chromeos_laptop.c
+++ b/drivers/platform/chrome/chromeos_laptop.c
@@ -103,7 +103,7 @@ chromes_laptop_instantiate_i2c_device(struct i2c_adapter *adapter,
 			pr_debug("%d-%02x is probed at %02x\n",
 				 adapter->nr, info->addr, dummy->addr);
 			i2c_unregister_device(dummy);
-			client = i2c_new_device(adapter, info);
+			client = i2c_new_client_device(adapter, info);
 		}
 	}
 
-- 
2.20.1


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

* [PATCH 2/2] platform/mellanox: mlxreg-hotplug: convert to use i2c_new_client_device()
  2020-03-26 21:09 [PATCH 0/2] platform: convert to use new I2C API Wolfram Sang
  2020-03-26 21:09 ` [PATCH 1/2] platform/chrome: chromeos_laptop: make I2C API conversion complete Wolfram Sang
@ 2020-03-26 21:09 ` Wolfram Sang
  2020-03-27  7:38   ` Andy Shevchenko
  1 sibling, 1 reply; 8+ messages in thread
From: Wolfram Sang @ 2020-03-26 21:09 UTC (permalink / raw)
  To: linux-i2c
  Cc: Wolfram Sang, Andy Shevchenko, Darren Hart, Vadim Pasternak,
	platform-driver-x86, linux-kernel

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

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/platform/mellanox/mlxreg-hotplug.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/mellanox/mlxreg-hotplug.c b/drivers/platform/mellanox/mlxreg-hotplug.c
index 77be37a1fbcf..ed48917af162 100644
--- a/drivers/platform/mellanox/mlxreg-hotplug.c
+++ b/drivers/platform/mellanox/mlxreg-hotplug.c
@@ -101,6 +101,7 @@ static int mlxreg_hotplug_device_create(struct mlxreg_hotplug_priv_data *priv,
 					struct mlxreg_core_data *data)
 {
 	struct mlxreg_core_hotplug_platform_data *pdata;
+	struct i2c_client *client;
 
 	/* Notify user by sending hwmon uevent. */
 	kobject_uevent(&priv->hwmon->kobj, KOBJ_CHANGE);
@@ -121,18 +122,20 @@ static int mlxreg_hotplug_device_create(struct mlxreg_hotplug_priv_data *priv,
 		return -EFAULT;
 	}
 
-	data->hpdev.client = i2c_new_device(data->hpdev.adapter,
-					    data->hpdev.brdinfo);
-	if (!data->hpdev.client) {
+	client = i2c_new_client_device(data->hpdev.adapter,
+				       data->hpdev.brdinfo);
+	if (IS_ERR(client)) {
 		dev_err(priv->dev, "Failed to create client %s at bus %d at addr 0x%02x\n",
 			data->hpdev.brdinfo->type, data->hpdev.nr +
 			pdata->shift_nr, data->hpdev.brdinfo->addr);
 
 		i2c_put_adapter(data->hpdev.adapter);
 		data->hpdev.adapter = NULL;
-		return -EFAULT;
+		return PTR_ERR(client);
 	}
 
+	data->hpdev.client = client;
+
 	return 0;
 }
 
-- 
2.20.1


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

* Re: [PATCH 2/2] platform/mellanox: mlxreg-hotplug: convert to use i2c_new_client_device()
  2020-03-26 21:09 ` [PATCH 2/2] platform/mellanox: mlxreg-hotplug: convert to use i2c_new_client_device() Wolfram Sang
@ 2020-03-27  7:38   ` Andy Shevchenko
  2020-04-25 20:54     ` Wolfram Sang
  0 siblings, 1 reply; 8+ messages in thread
From: Andy Shevchenko @ 2020-03-27  7:38 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, Andy Shevchenko, Darren Hart, Vadim Pasternak,
	Platform Driver, Linux Kernel Mailing List

On Thu, Mar 26, 2020 at 11:10 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> Move away from the deprecated API and return the shiny new ERRPTR where
> useful.
>

Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  drivers/platform/mellanox/mlxreg-hotplug.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/platform/mellanox/mlxreg-hotplug.c b/drivers/platform/mellanox/mlxreg-hotplug.c
> index 77be37a1fbcf..ed48917af162 100644
> --- a/drivers/platform/mellanox/mlxreg-hotplug.c
> +++ b/drivers/platform/mellanox/mlxreg-hotplug.c
> @@ -101,6 +101,7 @@ static int mlxreg_hotplug_device_create(struct mlxreg_hotplug_priv_data *priv,
>                                         struct mlxreg_core_data *data)
>  {
>         struct mlxreg_core_hotplug_platform_data *pdata;
> +       struct i2c_client *client;
>
>         /* Notify user by sending hwmon uevent. */
>         kobject_uevent(&priv->hwmon->kobj, KOBJ_CHANGE);
> @@ -121,18 +122,20 @@ static int mlxreg_hotplug_device_create(struct mlxreg_hotplug_priv_data *priv,
>                 return -EFAULT;
>         }
>
> -       data->hpdev.client = i2c_new_device(data->hpdev.adapter,
> -                                           data->hpdev.brdinfo);
> -       if (!data->hpdev.client) {
> +       client = i2c_new_client_device(data->hpdev.adapter,
> +                                      data->hpdev.brdinfo);
> +       if (IS_ERR(client)) {
>                 dev_err(priv->dev, "Failed to create client %s at bus %d at addr 0x%02x\n",
>                         data->hpdev.brdinfo->type, data->hpdev.nr +
>                         pdata->shift_nr, data->hpdev.brdinfo->addr);
>
>                 i2c_put_adapter(data->hpdev.adapter);
>                 data->hpdev.adapter = NULL;
> -               return -EFAULT;
> +               return PTR_ERR(client);
>         }
>
> +       data->hpdev.client = client;
> +
>         return 0;
>  }
>
> --
> 2.20.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 1/2] platform/chrome: chromeos_laptop: make I2C API conversion complete
  2020-03-26 21:09 ` [PATCH 1/2] platform/chrome: chromeos_laptop: make I2C API conversion complete Wolfram Sang
@ 2020-03-30 14:11   ` Enric Balletbo i Serra
  0 siblings, 0 replies; 8+ messages in thread
From: Enric Balletbo i Serra @ 2020-03-30 14:11 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c; +Cc: Benson Leung, linux-kernel

Hi Wolfram,

On 26/3/20 22:09, Wolfram Sang wrote:
> When converting to i2c_new_scanned_device(), it was overlooked that a
> conversion to i2c_new_client_device() was also needed. Fix it.
> 
> Fixes: c82ebf1bf738 ("platform/chrome: chromeos_laptop: Convert to i2c_new_scanned_device")
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  drivers/platform/chrome/chromeos_laptop.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/chrome/chromeos_laptop.c b/drivers/platform/chrome/chromeos_laptop.c
> index 4f3651fcd9fe..472a03daa869 100644
> --- a/drivers/platform/chrome/chromeos_laptop.c
> +++ b/drivers/platform/chrome/chromeos_laptop.c
> @@ -103,7 +103,7 @@ chromes_laptop_instantiate_i2c_device(struct i2c_adapter *adapter,
>  			pr_debug("%d-%02x is probed at %02x\n",
>  				 adapter->nr, info->addr, dummy->addr);
>  			i2c_unregister_device(dummy);
> -			client = i2c_new_device(adapter, info);
> +			client = i2c_new_client_device(adapter, info);
>  		}
>  	}
>  
> 

Queued for 5.7.

Thanks.
Enric

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

* Re: [PATCH 2/2] platform/mellanox: mlxreg-hotplug: convert to use i2c_new_client_device()
  2020-03-27  7:38   ` Andy Shevchenko
@ 2020-04-25 20:54     ` Wolfram Sang
  2020-04-26  8:34       ` Andy Shevchenko
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfram Sang @ 2020-04-25 20:54 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Wolfram Sang, linux-i2c, Andy Shevchenko, Darren Hart,
	Vadim Pasternak, Platform Driver, Linux Kernel Mailing List

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

On Fri, Mar 27, 2020 at 09:38:21AM +0200, Andy Shevchenko wrote:
> On Thu, Mar 26, 2020 at 11:10 PM Wolfram Sang
> <wsa+renesas@sang-engineering.com> wrote:
> >
> > Move away from the deprecated API and return the shiny new ERRPTR where
> > useful.
> >
> 
> Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>

Thanks, Andy! Is there a platform-x86-tree where this can go in? Or
shall I take it via the I2C tree? Same question for the similar patch
for x86/platform/intel-mid?


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

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

* Re: [PATCH 2/2] platform/mellanox: mlxreg-hotplug: convert to use i2c_new_client_device()
  2020-04-25 20:54     ` Wolfram Sang
@ 2020-04-26  8:34       ` Andy Shevchenko
  2020-04-26  8:57         ` Wolfram Sang
  0 siblings, 1 reply; 8+ messages in thread
From: Andy Shevchenko @ 2020-04-26  8:34 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Wolfram Sang, linux-i2c, Andy Shevchenko, Darren Hart,
	Vadim Pasternak, Platform Driver, Linux Kernel Mailing List

On Sat, Apr 25, 2020 at 11:54 PM Wolfram Sang <wsa@the-dreams.de> wrote:
>
> On Fri, Mar 27, 2020 at 09:38:21AM +0200, Andy Shevchenko wrote:
> > On Thu, Mar 26, 2020 at 11:10 PM Wolfram Sang
> > <wsa+renesas@sang-engineering.com> wrote:
> > >
> > > Move away from the deprecated API and return the shiny new ERRPTR where
> > > useful.
> > >
> >
> > Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
>
> Thanks, Andy! Is there a platform-x86-tree where this can go in? Or
> shall I take it via the I2C tree?

platform/mellanox usually goes via other trees, so, feel free to carry on.

> Same question for the similar patch
> for x86/platform/intel-mid?

TIP maintainers usually take this. If I didn't tag it, feel free to add my Rb.

-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 2/2] platform/mellanox: mlxreg-hotplug: convert to use i2c_new_client_device()
  2020-04-26  8:34       ` Andy Shevchenko
@ 2020-04-26  8:57         ` Wolfram Sang
  0 siblings, 0 replies; 8+ messages in thread
From: Wolfram Sang @ 2020-04-26  8:57 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Wolfram Sang, linux-i2c, Andy Shevchenko, Darren Hart,
	Vadim Pasternak, Platform Driver, Linux Kernel Mailing List

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


> > Thanks, Andy! Is there a platform-x86-tree where this can go in? Or
> > shall I take it via the I2C tree?
> 
> platform/mellanox usually goes via other trees, so, feel free to carry on.

Then, I will pick it.

> > Same question for the similar patch
> > for x86/platform/intel-mid?
> 
> TIP maintainers usually take this. If I didn't tag it, feel free to add my Rb.

You tagged it. Thanks for the heads up, I will wait some more here.


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

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

end of thread, other threads:[~2020-04-26  8:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-26 21:09 [PATCH 0/2] platform: convert to use new I2C API Wolfram Sang
2020-03-26 21:09 ` [PATCH 1/2] platform/chrome: chromeos_laptop: make I2C API conversion complete Wolfram Sang
2020-03-30 14:11   ` Enric Balletbo i Serra
2020-03-26 21:09 ` [PATCH 2/2] platform/mellanox: mlxreg-hotplug: convert to use i2c_new_client_device() Wolfram Sang
2020-03-27  7:38   ` Andy Shevchenko
2020-04-25 20:54     ` Wolfram Sang
2020-04-26  8:34       ` Andy Shevchenko
2020-04-26  8:57         ` Wolfram Sang

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