diff mbox series

[v4,2/3] iio: acpi_als: Add local variable dev in probe

Message ID 20201216060233.597689-3-gwendal@chromium.org (mailing list archive)
State New, archived
Headers show
Series iio: acpi_als: Add sotfware trigger support | expand

Commit Message

Gwendal Grignou Dec. 16, 2020, 6:02 a.m. UTC
Use dev = &device->dev in probe routine for clarity.
Remove setting parent of iio device, already done in iio_device_alloc().

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
---
 Added in v4.

 drivers/iio/light/acpi-als.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Andy Shevchenko Dec. 16, 2020, 4:17 p.m. UTC | #1
On Wed, Dec 16, 2020 at 8:02 AM 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().

...

>         struct acpi_als *als;
>         struct iio_dev *indio_dev;
>         struct iio_buffer *buffer;
> +       struct device *dev = &device->dev;

Try to keep reversed xmas tree order.
diff mbox series

Patch

diff --git a/drivers/iio/light/acpi-als.c b/drivers/iio/light/acpi-als.c
index 57512ac74eba1..32cd0f8438c33 100644
--- a/drivers/iio/light/acpi-als.c
+++ b/drivers/iio/light/acpi-als.c
@@ -165,8 +165,9 @@  static int acpi_als_add(struct acpi_device *device)
 	struct acpi_als *als;
 	struct iio_dev *indio_dev;
 	struct iio_buffer *buffer;
+	struct device *dev = &device->dev;
 
-	indio_dev = devm_iio_device_alloc(&device->dev, sizeof(*als));
+	indio_dev = devm_iio_device_alloc(dev, sizeof(*als));
 	if (!indio_dev)
 		return -ENOMEM;
 
@@ -182,13 +183,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[] = {