Re: [PATCH v5 2/3] iio: acpi_als: Add local variable dev in probe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 16, 2020 at 11:41 PM Gwendal Grignou <gwendal@xxxxxxxxxxxx> 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@xxxxxxxxx>

> Signed-off-by: Gwendal Grignou <gwendal@xxxxxxxxxxxx>
> ---
>  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



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux