Re: Lindent formatting issues
From: Laszlo Papp
Date: Thu Dec 19 2013 - 11:18:07 EST
On Tue, Dec 17, 2013 at 8:05 PM, Joe Perches <joe@xxxxxxxxxxx> wrote:
> On Tue, 2013-12-17 at 15:06 +0000, Laszlo Papp wrote:
>> ./scripts/Lindent seems to be working OK, but there are a few minor
>> issues like this:
>>
>> static struct i2c_driver max6651_driver = {
>> .driver = {
>> - .name = "gpio-max6651",
>> - .owner = THIS_MODULE,
>> - },
>> + .name = "gpio-max6651",
>> + .owner = THIS_MODULE,
>> + },
>>
>> Is there an option or something to mkae it work automatically? I am
>> referring to the "}," line which should not have changed.
>
> Assuming that was a copy/paste translation of
> tabs to spaces, the first form is more common
> in kernel sources and Lindent isn't doing the
> right thing here.
>
> You could also use scripts/checkpatch.pl with
> the --fix option.
>
> ./scripts/checkpatch.pl -f --fix <file>
>
> with various --types=<TYPE,...> options.
>
> Maybe use: https://lkml.org/lkml/2013/9/23/504
Thanks Joe. I seem to have further issues with this tool... I tried to
run it on a file I patched, but it generated a lot of noise unrelated
to my logical change... :(
Do you happen to know what the best way is to fix it in such cases? I
am providing some examples below:
if (devattr == &sensor_dev_attr_fan1_max_alarm.dev_attr
- || devattr == &sensor_dev_attr_fan1_min_alarm.dev_attr
- || devattr == &sensor_dev_attr_fan1_fault.dev_attr
- || devattr == &sensor_dev_attr_gpio1_alarm.dev_attr
- || devattr == &sensor_dev_attr_gpio2_alarm.dev_attr) {
+ || devattr == &sensor_dev_attr_fan1_min_alarm.dev_attr
+ || devattr == &sensor_dev_attr_fan1_fault.dev_attr
+ || devattr == &sensor_dev_attr_gpio1_alarm.dev_attr
+ || devattr == &sensor_dev_attr_gpio2_alarm.dev_attr) {
....
- int n)
+ int n)
....
- int sysfs_modes[4] = {0, 1, 2, 1};
+ int sysfs_modes[4] = { 0, 1, 2, 1 };
etc.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/