lkml.org 
[lkml]   [2005]   [Jul]   [7]   [last100]   RSS Feed
Views: [more markup]   [less markup]   [headers]   [forward]  
 
 
Messages in this thread
/
DateThu, 7 Jul 2005 10:15:37 +0200 (CEST)
Frommoreau francis <>
SubjectRe: Patch of a new driver for kernel 2.4.x that need review
Pekka J Enberg wrote:

> Hi Willy,
> Willy Tarreau writes:
>
>> 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.
>
>
> Sorry, what do you have to count with the following?
> enum {
>       TLCLK_REG0 = TLCLK_BASE,
>       TLCLK_REG1 = TLCLK_BASE+1,
>       TLCLK_REG2 = TLCLK_BASE+2,
> };
> Please note that enums are a general way of specifying _constants_ with the
type int, not necessarily named enumerations. 

BTW, a lot of drivers use define for register mapping in kernel. Since enum
is not a new C feature, I'm wondering why kernel have prefered using define
in the past...

thanks,

      Francis









___________________________________________________________________________ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-07-07 10:18    [from the cache]
©2003-2008