From: Willy Tarreau <willy@w.ods.org>
To: Pekka Enberg <penberg@gmail.com>
Cc: "Bouchard, Sebastien" <Sebastien.Bouchard@ca.kontron.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Lorenzini, Mario" <mario.lorenzini@ca.kontron.com>,
Pekka Enberg <penberg@cs.helsinki.fi>
Subject: Re: Patch of a new driver for kernel 2.4.x that need review
Date: Wed, 22 Jun 2005 22:32:11 +0200 [thread overview]
Message-ID: <20050622203211.GI8907@alpha.home.local> (raw)
In-Reply-To: <84144f020506221243163d06a2@mail.gmail.com>
Hi,
On Wed, Jun 22, 2005 at 10:43:40PM +0300, Pekka Enberg wrote:
> On 6/22/05, Bouchard, Sebastien <Sebastien.Bouchard@ca.kontron.com> wrote:
> > --- 2.4.31-ori/drivers/char/tlclk.c Wed Dec 31 19:00:00 1969
> > +++ 2.4.31-mod/drivers/char/tlclk.c Wed Jun 22 09:43:10 2005
> > +/* Telecom clock I/O register definition */
> > +#define TLCLK_BASE 0xa08
> > +#define TLCLK_REG0 TLCLK_BASE
> > +#define TLCLK_REG1 TLCLK_BASE+1
> > +#define TLCLK_REG2 TLCLK_BASE+2
> > +#define TLCLK_REG3 TLCLK_BASE+3
> > +#define TLCLK_REG4 TLCLK_BASE+4
> > +#define TLCLK_REG5 TLCLK_BASE+5
> > +#define TLCLK_REG6 TLCLK_BASE+6
> > +#define TLCLK_REG7 TLCLK_BASE+7
>
> Please use enums instead.
I dont agree with you here : enums are good to simply specify an ordering.
But they must not be used to specify static mapping. Eg: if REG4 *must* be
equal to BASE+4, you should not use enums, otherwise it will render the
code unreadable. I personnaly don't want to count the position of REG7 in
the enum to discover that it's at BASE+7.
> > +#define RESET_ON 0x00
> > +#define RESET_OFF 0x01
>
> Please use enums instead (applies to other parts of this file too).
Same comment here : if writing the *bit* 0 asserts the reset line, and
writing the *bit* 1 deasserts it, enum is not adequate at all. Enums are
adequate when you don't care about the values themselves, eg the sysctl
entries, etc... (eventhough most of them are statically assigned). But
if you need something more verbose to say exactly "write 7 to port 123",
it's better to use defines (or even variables sometimes) than enums.
Regards,
Willy
next prev parent reply other threads:[~2005-06-22 20:37 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-22 15:12 Patch of a new driver for kernel 2.4.x that need review Bouchard, Sebastien
2005-06-22 19:43 ` Pekka Enberg
2005-06-22 20:32 ` Willy Tarreau [this message]
2005-06-22 20:59 ` Bill Gatliff
2005-06-22 21:58 ` Willy Tarreau
2005-06-23 4:58 ` Pekka Enberg
2005-06-23 4:16 ` Pekka J Enberg
2005-06-23 4:49 ` Willy Tarreau
2005-07-06 21:11 ` Mark Gross
2005-07-07 6:00 ` Pekka J Enberg
2005-07-07 6:50 ` Dmitry Torokhov
2005-07-07 6:55 ` Pekka J Enberg
2005-07-07 7:13 ` Dmitry Torokhov
2005-07-07 7:43 ` Pekka J Enberg
2005-07-07 6:10 ` Pekka J Enberg
2005-06-22 20:04 ` Pekka Enberg
2005-06-23 21:42 ` Alan Cox
2005-06-22 21:18 ` Jesper Juhl
2005-07-06 21:14 ` Mark Gross
2005-07-06 22:49 ` randy_dunlap
2005-07-06 22:57 ` Greg KH
2005-08-08 15:35 ` Mark Gross
2005-08-09 7:17 ` Pekka Enberg
2005-08-09 16:56 ` Mark Gross
2005-08-09 17:51 ` Nishanth Aravamudan
-- strict thread matches above, loose matches on Subject: below --
2005-07-07 8:15 moreau francis
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=20050622203211.GI8907@alpha.home.local \
--to=willy@w.ods.org \
--cc=Sebastien.Bouchard@ca.kontron.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.lorenzini@ca.kontron.com \
--cc=penberg@cs.helsinki.fi \
--cc=penberg@gmail.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