linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-i2c <linux-i2c@vger.kernel.org>,
	Andy Shevchenko <andy@infradead.org>,
	Darren Hart <dvhart@infradead.org>,
	Vadim Pasternak <vadimp@mellanox.com>,
	Platform Driver <platform-driver-x86@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] platform/mellanox: mlxreg-hotplug: convert to use i2c_new_client_device()
Date: Fri, 27 Mar 2020 09:38:21 +0200	[thread overview]
Message-ID: <CAHp75Vfw4_0ttE2F-WxdULf7hRGsQvqzCLdCNVy7RBaFdEsCGA@mail.gmail.com> (raw)
In-Reply-To: <20200326210952.12857-3-wsa+renesas@sang-engineering.com>

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

  reply	other threads:[~2020-03-27  7:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2020-04-25 20:54     ` Wolfram Sang
2020-04-26  8:34       ` Andy Shevchenko
2020-04-26  8:57         ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHp75Vfw4_0ttE2F-WxdULf7hRGsQvqzCLdCNVy7RBaFdEsCGA@mail.gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=andy@infradead.org \
    --cc=dvhart@infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=vadimp@mellanox.com \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).