2020-03-26 21:13:13

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 2/2] platform/mellanox: mlxreg-hotplug: convert to use i2c_new_client_device()

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

Signed-off-by: Wolfram Sang <[email protected]>
---
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


2020-03-27 07:39:14

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH 2/2] platform/mellanox: mlxreg-hotplug: convert to use i2c_new_client_device()

On Thu, Mar 26, 2020 at 11:10 PM Wolfram Sang
<[email protected]> wrote:
>
> Move away from the deprecated API and return the shiny new ERRPTR where
> useful.
>

Acked-by: Andy Shevchenko <[email protected]>

> Signed-off-by: Wolfram Sang <[email protected]>
> ---
> 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

2020-04-25 20:55:57

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH 2/2] platform/mellanox: mlxreg-hotplug: convert to use i2c_new_client_device()

On Fri, Mar 27, 2020 at 09:38:21AM +0200, Andy Shevchenko wrote:
> On Thu, Mar 26, 2020 at 11:10 PM Wolfram Sang
> <[email protected]> wrote:
> >
> > Move away from the deprecated API and return the shiny new ERRPTR where
> > useful.
> >
>
> Acked-by: Andy Shevchenko <[email protected]>

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?


Attachments:
(No filename) (494.00 B)
signature.asc (849.00 B)
Download all attachments

2020-04-26 08:36:12

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH 2/2] platform/mellanox: mlxreg-hotplug: convert to use i2c_new_client_device()

On Sat, Apr 25, 2020 at 11:54 PM Wolfram Sang <[email protected]> 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
> > <[email protected]> wrote:
> > >
> > > Move away from the deprecated API and return the shiny new ERRPTR where
> > > useful.
> > >
> >
> > Acked-by: Andy Shevchenko <[email protected]>
>
> 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

2020-04-26 08:59:14

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH 2/2] platform/mellanox: mlxreg-hotplug: convert to use i2c_new_client_device()


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


Attachments:
(No filename) (456.00 B)
signature.asc (849.00 B)
Download all attachments