iio: accel: da280: Drop unnecessarily used braces
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
@@ -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
+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 bydevice_get_match_data()call- replace that condition by something like
type =device_get_match_data();- drop
ACPI_PTR()- replace
acpi.hbymod_devicetable.handproperty.h- convert to use ->probe_new()
Everything, except the last one is in one patch, the last one is another patch.
Quoted 23 lines
Signed-off-by Mugilraj Dhavachelvan <[email protected]>--- drivers/iio/accel/da280.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/iio/accel/da280.c +2
-3@@ -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
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 bydevice_get_match_data()call- replace that condition by something like
type =device_get_match_data();- drop
ACPI_PTR()- replace
acpi.hbymod_devicetable.handproperty.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
Signed-off-by Mugilraj Dhavachelvan <[email protected]>--- drivers/iio/accel/da280.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/iio/accel/da280.c +2
-3@@ -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" ;