From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Gwendal Grignou <gwendal@chromium.org>
Cc: Gabriele Mazzotta <gabriele.mzt@gmail.com>,
Jonathan Cameron <jic23@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
linux-iio <linux-iio@vger.kernel.org>
Subject: Re: [PATCH v5 2/3] iio: acpi_als: Add local variable dev in probe
Date: Thu, 17 Dec 2020 00:40:28 +0200 [thread overview]
Message-ID: <CAHp75Ve+mA7NhyRN34KA--rhUMNo1YNV2fan15Cfw7b47jQe+A@mail.gmail.com> (raw)
In-Reply-To: <20201216214107.774969-3-gwendal@chromium.org>
On Wed, Dec 16, 2020 at 11:41 PM Gwendal Grignou <gwendal@chromium.org> wrote:
>
> Use dev = &device->dev in probe routine for clarity.
> Remove setting parent of iio device, already done in iio_device_alloc().
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
> ---
> Added in v4.
> Changes in v5:
> Follow inverted xmas tree declaration convention.
>
> drivers/iio/light/acpi-als.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/light/acpi-als.c b/drivers/iio/light/acpi-als.c
> index 6dbaeeebe2041..fd20808d4a119 100644
> --- a/drivers/iio/light/acpi-als.c
> +++ b/drivers/iio/light/acpi-als.c
> @@ -161,11 +161,12 @@ static const struct iio_info acpi_als_info = {
>
> static int acpi_als_add(struct acpi_device *device)
> {
> - struct acpi_als *als;
I was talking only about dev, but I don't think it's a big deal for
maintainers to have this change here.
> + struct device *dev = &device->dev;
> struct iio_dev *indio_dev;
> struct iio_buffer *buffer;
> + struct acpi_als *als;
>
> - indio_dev = devm_iio_device_alloc(&device->dev, sizeof(*als));
> + indio_dev = devm_iio_device_alloc(dev, sizeof(*als));
> if (!indio_dev)
> return -ENOMEM;
>
> @@ -181,13 +182,13 @@ static int acpi_als_add(struct acpi_device *device)
> indio_dev->channels = acpi_als_channels;
> indio_dev->num_channels = ARRAY_SIZE(acpi_als_channels);
>
> - buffer = devm_iio_kfifo_allocate(&device->dev);
> + buffer = devm_iio_kfifo_allocate(dev);
> if (!buffer)
> return -ENOMEM;
>
> iio_device_attach_buffer(indio_dev, buffer);
>
> - return devm_iio_device_register(&device->dev, indio_dev);
> + return devm_iio_device_register(dev, indio_dev);
> }
>
> static const struct acpi_device_id acpi_als_device_ids[] = {
> --
> 2.29.2.729.g45daf8777d-goog
>
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2020-12-16 22:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-16 21:41 [PATCH v5 0/3] iio: acpi_als: Add sotfware trigger support Gwendal Grignou
2020-12-16 21:41 ` [PATCH v5 1/3] iio: acpi_als: Add timestamp channel Gwendal Grignou
2020-12-16 22:39 ` Andy Shevchenko
2020-12-16 21:41 ` [PATCH v5 2/3] iio: acpi_als: Add local variable dev in probe Gwendal Grignou
2020-12-16 22:40 ` Andy Shevchenko [this message]
2020-12-16 21:41 ` [PATCH v5 3/3] iio: acpi_als: Add trigger support Gwendal Grignou
2020-12-16 22:38 ` Andy Shevchenko
2020-12-29 17:24 ` Jonathan Cameron
2020-12-29 17:33 ` Andy Shevchenko
2020-12-29 17:52 ` Jonathan Cameron
2020-12-29 18:13 ` Andy Shevchenko
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=CAHp75Ve+mA7NhyRN34KA--rhUMNo1YNV2fan15Cfw7b47jQe+A@mail.gmail.com \
--to=andy.shevchenko@gmail.com \
--cc=gabriele.mzt@gmail.com \
--cc=gwendal@chromium.org \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.