Message ID | 20200326210952.12857-3-wsa+renesas@sang-engineering.com |
---|---|
State | Accepted |
Headers | show |
Series | platform: convert to use new I2C API | expand |
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 >
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?
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.
> > 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.
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; }
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(-)