* [PATCH] iio: accel: da280: Drop unnecessarily used braces
@ 2021-03-28 18:01 Mugilraj Dhavachelvan
[not found] ` <CAHp75Vdv4zAsn_v1TaUcYgY_PpQrfhfGNsc8=QTbPY=oFN_xbA@mail.gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Mugilraj Dhavachelvan @ 2021-03-28 18:01 UTC (permalink / raw)
To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
Peter Meerwald-Stadler, Mugilraj Dhavachelvan, linux-iio,
linux-kernel
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:
Signed-off-by: Mugilraj Dhavachelvan <dmugil2000@gmail.com>
---
drivers/iio/accel/da280.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/accel/da280.c b/drivers/iio/accel/da280.c
index 227bea2d738b..31f290ae4386 100644
--- a/drivers/iio/accel/da280.c
+++ b/drivers/iio/accel/da280.c
@@ -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";
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] iio: accel: da280: Drop unnecessarily used braces
[not found] ` <CAHp75Vdv4zAsn_v1TaUcYgY_PpQrfhfGNsc8=QTbPY=oFN_xbA@mail.gmail.com>
@ 2021-03-29 10:52 ` Andy Shevchenko
2021-03-29 10:54 ` Hans de Goede
0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2021-03-29 10:52 UTC (permalink / raw)
To: Mugilraj Dhavachelvan, Hans de Goede
Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
Peter Meerwald-Stadler, linux-iio, linux-kernel
+Cc: Hans (just for your opinion)
On Sun, Mar 28, 2021 at 10:40 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Sunday, March 28, 2021, Mugilraj Dhavachelvan <dmugil2000@gmail.com> wrote:
>>
>> 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.
>
>
>
>> Signed-off-by: Mugilraj Dhavachelvan <dmugil2000@gmail.com>
>> ---
>> drivers/iio/accel/da280.c | 5 ++---
>> 1 file changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/iio/accel/da280.c b/drivers/iio/accel/da280.c
>> index 227bea2d738b..31f290ae4386 100644
>> --- a/drivers/iio/accel/da280.c
>> +++ b/drivers/iio/accel/da280.c
>> @@ -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";
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iio: accel: da280: Drop unnecessarily used braces
2021-03-29 10:52 ` Andy Shevchenko
@ 2021-03-29 10:54 ` Hans de Goede
0 siblings, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2021-03-29 10:54 UTC (permalink / raw)
To: Andy Shevchenko, Mugilraj Dhavachelvan
Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
Peter Meerwald-Stadler, linux-iio, linux-kernel
Hi,
On 3/29/21 12:52 PM, Andy Shevchenko wrote:
> +Cc: Hans (just for your opinion)
>
> On Sun, Mar 28, 2021 at 10:40 PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
>> On Sunday, March 28, 2021, Mugilraj Dhavachelvan <dmugil2000@gmail.com> wrote:
>>>
>>> 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
>>
>>
>>
>>> Signed-off-by: Mugilraj Dhavachelvan <dmugil2000@gmail.com>
>>> ---
>>> drivers/iio/accel/da280.c | 5 ++---
>>> 1 file changed, 2 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/iio/accel/da280.c b/drivers/iio/accel/da280.c
>>> index 227bea2d738b..31f290ae4386 100644
>>> --- a/drivers/iio/accel/da280.c
>>> +++ b/drivers/iio/accel/da280.c
>>> @@ -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";
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-29 10:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-28 18:01 [PATCH] iio: accel: da280: Drop unnecessarily used braces Mugilraj Dhavachelvan
[not found] ` <CAHp75Vdv4zAsn_v1TaUcYgY_PpQrfhfGNsc8=QTbPY=oFN_xbA@mail.gmail.com>
2021-03-29 10:52 ` Andy Shevchenko
2021-03-29 10:54 ` Hans de Goede
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.