2017-03-01 18:16:35

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH] hid: usbhid: usbkbd: fix checkpatch.pl issues

Hi Avraham,

On Tue, Feb 21, 2017 at 07:26:50PM +0200, Avraham Shukron wrote:
> - Broke long lines
> - Added spaces where needed
> - Removed unnecessary / trailing whitespaces
> - Extracted assignments outside of 'if' statements
>
> Signed-off-by: Avraham Shukron <[email protected]>
> ---
> drivers/hid/usbhid/usbkbd.c | 121 ++++++++++++++++++++++++++------------------
> 1 file changed, 72 insertions(+), 49 deletions(-)
>
> diff --git a/drivers/hid/usbhid/usbkbd.c b/drivers/hid/usbhid/usbkbd.c
> index 7fb2d1e..ae40b0d 100644
> --- a/drivers/hid/usbhid/usbkbd.c
> +++ b/drivers/hid/usbhid/usbkbd.c
> @@ -45,22 +45,24 @@ MODULE_DESCRIPTION(DRIVER_DESC);
> MODULE_LICENSE("GPL");
>
> static const unsigned char usb_kbd_keycode[256] = {
> - 0, 0, 0, 0, 30, 48, 46, 32, 18, 33, 34, 35, 23, 36, 37, 38,
> - 50, 49, 24, 25, 16, 19, 31, 20, 22, 47, 17, 45, 21, 44, 2, 3,
> - 4, 5, 6, 7, 8, 9, 10, 11, 28, 1, 14, 15, 57, 12, 13, 26,
> - 27, 43, 43, 39, 40, 41, 51, 52, 53, 58, 59, 60, 61, 62, 63, 64,
> - 65, 66, 67, 68, 87, 88, 99, 70,119,110,102,104,111,107,109,106,
> - 105,108,103, 69, 98, 55, 74, 78, 96, 79, 80, 81, 75, 76, 77, 71,
> - 72, 73, 82, 83, 86,127,116,117,183,184,185,186,187,188,189,190,
> - 191,192,193,194,134,138,130,132,128,129,131,137,133,135,136,113,
> - 115,114, 0, 0, 0,121, 0, 89, 93,124, 92, 94, 95, 0, 0, 0,
> - 122,123, 90, 91, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> - 29, 42, 56,125, 97, 54,100,126,164,166,165,163,161,115,114,113,
> - 150,158,159,128,136,177,178,176,142,152,173,140
> + 0, 0, 0, 0, 30, 48, 46, 32, 18, 33, 34, 35, 23, 36,
> + 37, 38, 50, 49, 24, 25, 16, 19, 31, 20, 22, 47, 17, 45,
> + 21, 44, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 28, 1,
> + 14, 15, 57, 12, 13, 26, 27, 43, 43, 39, 40, 41, 51, 52,
> + 53, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 87, 88,
> + 99, 70, 119, 110, 102, 104, 111, 107, 109, 106, 105, 108, 103, 69,
> + 98, 55, 74, 78, 96, 79, 80, 81, 75, 76, 77, 71, 72, 73,
> + 82, 83, 86, 127, 116, 117, 183, 184, 185, 186, 187, 188, 189, 190,
> + 191, 192, 193, 194, 134, 138, 130, 132, 128, 129, 131, 137, 133, 135,
> + 136, 113, 115, 114, 0, 0, 0, 121, 0, 89, 93, 124, 92, 94,
> + 95, 0, 0, 0, 122, 123, 90, 91, 85, 0, 0, 0, 0, 0,
> + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> + 29, 42, 56, 125, 97, 54, 100, 126, 164, 166, 165, 163, 161, 115,
> + 114, 113, 150, 158, 159, 128, 136, 177, 178, 176, 142, 152, 173, 140
> };

This kind of change is definitely not helpful. The original table was
Nx16, you converted it to Nx14. Why do you think original table used 16
columns?

Regardless, it's a very old driver, just let it be.

Thanks.

--
Dmitry


2017-03-01 20:37:53

by Avraham Shukron

[permalink] [raw]
Subject: Re: [PATCH] hid: usbhid: usbkbd: fix checkpatch.pl issues

>
> This kind of change is definitely not helpful. The original table was
> Nx16, you converted it to Nx14. Why do you think original table used 16
> columns?
>
> Regardless, it's a very old driver, just let it be.
>
> Thanks.
>

I can make it Nx8 :)

Seriously now - I don't understand what is so wrong with checkpatch fixes?
I'm a new to kernel development, and the natural place to start is to do some
coding style fixes.
I thought fixing a driver that I actually use daily will be more satisfying.
Why driver being old is a good reason to ignore the coding style conventions?

2017-03-01 20:46:53

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH] hid: usbhid: usbkbd: fix checkpatch.pl issues

On Wed, Mar 01, 2017 at 09:59:31PM +0200, Avraham Shukron wrote:
> >
> > This kind of change is definitely not helpful. The original table was
> > Nx16, you converted it to Nx14. Why do you think original table used 16
> > columns?
> >
> > Regardless, it's a very old driver, just let it be.
> >
> > Thanks.
> >
>
> I can make it Nx8 :)

Or you can leave it as is.

>
> Seriously now - I don't understand what is so wrong with checkpatch fixes?

Checkpatch is a tool to make sure new code follows standard conversions,
not reshuffling old working code.

> I'm a new to kernel development, and the natural place to start is to do some
> coding style fixes.
> I thought fixing a driver that I actually use daily will be more satisfying.

You are not using this driver daily, pretty much nobody does. What you
are using is usbhid + hid-input + probably some hardware-specific hid
driver that twiddles the behavior of your keyboard.

> Why driver being old is a good reason to ignore the coding style conventions?

Since there is no active development nor use it is easy to introduce
bugs that won't be caught until much later. Checkpatch fixes are usually
welcome when there are additional fixes to the same driver.

Thanks.

--
Dmitry

2017-03-01 20:51:13

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH] hid: usbhid: usbkbd: fix checkpatch.pl issues

On Wed, 2017-03-01 at 21:59 +0200, Avraham Shukron wrote:
> >
> > This kind of change is definitely not helpful. The original table was
> > Nx16, you converted it to Nx14. Why do you think original table used 16
> > columns?
> >
> > Regardless, it's a very old driver, just let it be.
> >
> > Thanks.
> >
>
> I can make it Nx8 :)
>
> Seriously now - I don't understand what is so wrong with checkpatch fixes?

Some say is makes following logical changes more difficult.
git blame, etc... I'm not a big adherent of that though.

> I'm a new to kernel development, and the natural place to start is to do some
> coding style fixes.
> I thought fixing a driver that I actually use daily will be more satisfying.
> Why driver being old is a good reason to ignore the coding style conventions?

The space after comma rule _should_ be broken when
alignment is more obvious. The existing code is just fine.

Conventions are just that. It's OK to be unconventional.

It's better to know when to follow and when not to follow
those conventions.

checkpatch messages should be considered guides and not
dicta that must be followed to the last letter.

To me, the rest of the patch was OK though.

If you want to learn the kernel patch process, modifying files
in drivers/staging is a good place to start.

Otherwise, it's probably best to find/fix some actual defect
and suggest actual logical changes that reduce code size,
improve performance, expand test coverage, better document
the code, etc..

cheers, Joe

2017-03-01 21:00:25

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] hid: usbhid: usbkbd: fix checkpatch.pl issues

On Wed, Mar 01, 2017 at 09:59:31PM +0200, Avraham Shukron wrote:
> >
> > This kind of change is definitely not helpful. The original table was
> > Nx16, you converted it to Nx14. Why do you think original table used 16
> > columns?
> >
> > Regardless, it's a very old driver, just let it be.
> >
> > Thanks.
> >
>
> I can make it Nx8 :)
>
> Seriously now - I don't understand what is so wrong with checkpatch fixes?
> I'm a new to kernel development, and the natural place to start is to do some
> coding style fixes.

Start doing this in the drivers/staging/ portion of the kernel. Other
places usually do not want these types of changes for the reasons people
have given you already.

That is what drivers/staging/ is for, to learn the process. Please
stick to it there.

thanks,

greg k-h

2017-03-01 22:05:31

by Alan Stern

[permalink] [raw]
Subject: Re: [PATCH] hid: usbhid: usbkbd: fix checkpatch.pl issues

On Wed, 1 Mar 2017, Avraham Shukron wrote:

> I thought fixing a driver that I actually use daily will be more satisfying.

Unless there are special reasons, you should not be using the usbkbd
driver. It is legacy code; everyone should now use usbhid instead.

Alan Stern

2017-03-01 22:09:56

by Avraham Shukron

[permalink] [raw]
Subject: Re: [PATCH] hid: usbhid: usbkbd: fix checkpatch.pl issues


On 01/03/17 22:46, Joe Perches wrote:
> On Wed, 2017-03-01 at 21:59 +0200, Avraham Shukron wrote:
>>>
>>> This kind of change is definitely not helpful. The original table was
>>> Nx16, you converted it to Nx14. Why do you think original table used 16
>>> columns?
>>>
>>> Regardless, it's a very old driver, just let it be.
>>>
>>> Thanks.
>>>
>>
>> I can make it Nx8 :)
>>
>> Seriously now - I don't understand what is so wrong with checkpatch fixes?
>
> Some say is makes following logical changes more difficult.
> git blame, etc... I'm not a big adherent of that though.
>
>> I'm a new to kernel development, and the natural place to start is to do some
>> coding style fixes.
>> I thought fixing a driver that I actually use daily will be more satisfying.
>> Why driver being old is a good reason to ignore the coding style conventions?
>
> The space after comma rule _should_ be broken when
> alignment is more obvious. The existing code is just fine.
>
> Conventions are just that. It's OK to be unconventional.
>
> It's better to know when to follow and when not to follow
> those conventions.
>
> checkpatch messages should be considered guides and not
> dicta that must be followed to the last letter.
>
> To me, the rest of the patch was OK though.
>
> If you want to learn the kernel patch process, modifying files
> in drivers/staging is a good place to start.
>
> Otherwise, it's probably best to find/fix some actual defect
> and suggest actual logical changes that reduce code size,
> improve performance, expand test coverage, better document
> the code, etc..
>
> cheers, Joe
>

Thanks you very much for the the answer.
That explains the matter.