Skip to contentSkip to conversation

iio: accel: da280: Drop unnecessarily used braces

PATCH In review Mugilraj Dhavachelvan 3 participants 3 messages Mar 28, 2021 – Mar 29, 2021 1 message not in the archive IIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: accel: da280: Drop unnecessarily used braces

As per linux kernel coding style braces are not needed for single statement.
Checkpatch
warning: braces {} are not necessary for any arm of this statement 128: FILE: drivers/iio/accel/da280.c:128:

---
 drivers/iio/accel/da280.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/accel/da280.c +2 -3
index 227bea2d738b..31f290ae4386 100644
@@ -125,11 +125,10 @@ static int da280_probe(struct i2c_client *client,
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->channels = da280_channels;
 
-	if (ACPI_HANDLE(&client->dev)) {
+	if (ACPI_HANDLE(&client->dev))
 		chip = da280_match_acpi_device(&client->dev);
-	} else {
+	else
 		chip = id->driver_data;
-	}
 
 	if (chip == da226) {
 		indio_dev->name = "da226";
Signature · 1 line
2.25.1

A message that is not in the archive (sent off-list or not yet received): CAHp75Vdv4zAsn_v1TaUcYgY_PpQrfhfGNsc8=QTbPY=oFN_xbA@mail.gmail.com

#2 lore raw

+Cc: Hans (just for your opinion)

Quoted 49 lines · Andy Shevchenko
Quoted 7 lines · Mugilraj Dhavachelvan

As per linux kernel coding style braces are not needed for single statement.
Checkpatch
warning: braces {} are not necessary for any arm of this statement 128: FILE: drivers/iio/accel/da280.c:128:

While it’s the correct patch, I would rather recommend making the driver non-ACPI centric. I.e.:
- replace that custom function by device_get_match_data() call

- replace that condition by something like
type = device_get_match_data();

- drop ACPI_PTR()

- replace acpi.h by mod_devicetable.h and property.h

- convert to use ->probe_new()

Everything, except the last one is in one patch, the last one is another patch.

Quoted 23 lines
---
 drivers/iio/accel/da280.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/accel/da280.c +2 -3
index 227bea2d738b..31f290ae4386 100644
@@ -125,11 +125,10 @@ static int da280_probe(struct i2c_client *client,
        indio_dev->modes = INDIO_DIRECT_MODE;
        indio_dev->channels = da280_channels;
 
-       if (ACPI_HANDLE(&client->dev)) {
+       if (ACPI_HANDLE(&client->dev))
                chip = da280_match_acpi_device(&client->dev);
-       } else {
+       else
                chip = id->driver_data;
-       }
 
        if (chip == da226) {
                indio_dev->name = "da226";
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw

Hi,

Quoted 27 lines · Andy Shevchenko

+Cc: Hans (just for your opinion)

Quoted 23 lines · Andy Shevchenko
Quoted 7 lines · Mugilraj Dhavachelvan

As per linux kernel coding style braces are not needed for single statement.
Checkpatch
warning: braces {} are not necessary for any arm of this statement 128: FILE: drivers/iio/accel/da280.c:128:

While it’s the correct patch, I would rather recommend making the driver non-ACPI centric. I.e.:
- replace that custom function by device_get_match_data() call

- replace that condition by something like
type = device_get_match_data();

- drop ACPI_PTR()

- replace acpi.h by mod_devicetable.h and property.h

- convert to use ->probe_new()

Everything, except the last one is in one patch, the last one is another patch.

I agree that *carefully* converting to driver to device_get_match_data() would be good.

Regards,

Hans

Quoted 27 lines
Quoted 26 lines
Quoted 26 lines
---
 drivers/iio/accel/da280.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/accel/da280.c +2 -3
index 227bea2d738b..31f290ae4386 100644
@@ -125,11 +125,10 @@ static int da280_probe(struct i2c_client *client,
        indio_dev->modes = INDIO_DIRECT_MODE;
        indio_dev->channels = da280_channels;
 
-       if (ACPI_HANDLE(&client->dev)) {
+       if (ACPI_HANDLE(&client->dev))
                chip = da280_match_acpi_device(&client->dev);
-       } else {
+       else
                chip = id->driver_data;
-       }
 
        if (chip == da226) {
                indio_dev->name = "da226";