From: Willy Tarreau <w@1wt.eu>
To: "Henri Häkkinen" <henuxd@gmail.com>
Cc: gregkh@suse.de, peterhuewe@gmx.de, julia@diku.dk,
sudhakar.raj@ti.com, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging:panel: Fixed coding conventions.
Date: Fri, 11 Jun 2010 14:44:42 +0200 [thread overview]
Message-ID: <20100611124442.GF8636@1wt.eu> (raw)
In-Reply-To: <1276258909-20838-1-git-send-email-henuxd@gmail.com>
On Fri, Jun 11, 2010 at 03:21:49PM +0300, Henri Häkkinen wrote:
> Fixed many coding convention issues as reported by checkpatch.pl tool.
> Many of the cleanups were hacky due to deeply nasted control structures.
NAK. With such a "cleanup", it becomes even harder to read, understand
and debug. Enforcing the 80-chars limit on an existing code generally
involves restructuring it differently. This might be appropriate, but
pushing all the right chars on the 80th column just for the sake of not
crossing the bound is the worst that can be done.
Also, single-line comments such as below area really boring to read
when converted to multi-line :
> #define KEYPAD_BUFFER 64
> #define INPUT_POLL_TIME (HZ/50) /* poll the keyboard this every second */
> #define KEYPAD_REP_START (10) /* a key starts to repeat after this times INPUT_POLL_TIME */
> #define KEYPAD_REP_DELAY (2) /* a key repeats this times INPUT_POLL_TIME */
becomes :
> +#define INPUT_POLL_TIME (HZ/50) /* poll the keyboard this every
> + second */
> +#define KEYPAD_REP_START (10) /* a key starts to repeat after
> + this times INPUT_POLL_TIME */
> +#define KEYPAD_REP_DELAY (2) /* a key repeats this times
> + INPUT_POLL_TIME */
Better shorten the comments or put them on their own line.
Also, I particularly hate changes as below. Looks, it's counter-productive,
you added 9 lines of code, which means you reduced a 80x25 terminal by half.
And the tests and statements are unreadable :
> @@ -1182,12 +1252,21 @@ static ssize_t lcd_write(struct file *file,
> value = 0;
> while (*esc && cgoffset < 8) {
> shift ^= 4;
> - if (*esc >= '0' && *esc <= '9')
> - value |= (*esc - '0') << shift;
> - else if (*esc >= 'A' && *esc <= 'Z')
> - value |= (*esc - 'A' + 10) << shift;
> - else if (*esc >= 'a' && *esc <= 'z')
> - value |= (*esc - 'a' + 10) << shift;
> + if (*esc >= '0' &&
> + *esc <= '9')
> + value |=
> + (*esc - '0')
> + << shift;
> + else if (*esc >= 'A' &&
> + *esc <= 'Z')
> + value |=
> + (*esc - 'A' +
> + 10) << shift;
> + else if (*esc >= 'a' &&
> + *esc <= 'z')
> + value |=
> + (*esc - 'a' +
> + 10) << shift;
If the line length really cause you trouble, see if you can move that
to an inline function and keep the code readable.
Thanks,
Willy
next prev parent reply other threads:[~2010-06-11 12:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-11 12:21 [PATCH] staging:panel: Fixed coding conventions Henri Häkkinen
2010-06-11 12:44 ` Willy Tarreau [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-06-11 21:27 Henri Häkkinen
2010-06-12 4:49 ` Willy Tarreau
2010-06-11 12:20 Henri Häkkinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100611124442.GF8636@1wt.eu \
--to=w@1wt.eu \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@suse.de \
--cc=henuxd@gmail.com \
--cc=julia@diku.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=peterhuewe@gmx.de \
--cc=sudhakar.raj@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox