Re: Coding style question

2007-02-09 Thread Haavard Skinnemoen
On 2/9/07, Pavel Pisa <[EMAIL PROTECTED]> wrote: #define __val2mfld(mask,val) (((mask)&~((mask)<<1))*(val)&(mask)) #define __mfld2val(mask,val) (((val)&(mask))/((mask)&~((mask)<<1))) Looks a bit similar to the style I tend to use a lot: /* Bit manipulation macros */ #define MACB_BIT(name)

Re: Coding style question

2007-02-09 Thread Stefan Richter
Pavel Pisa wrote: > There are tightly copled two macros for preparation > and acquisition of muti-bit masked fields values > > #define __val2mfld(mask,val) (((mask)&~((mask)<<1))*(val)&(mask)) > > #define __mfld2val(mask,val) (((val)&(mask))/((mask)&~((mask)<<1))) The macro names are awkward. ht

Re: Coding style question

2007-02-09 Thread Jesper Juhl
On 09/02/07, Pavel Pisa <[EMAIL PROTECTED]> wrote: Hello All, I have question if next style of macros definitions for hardware registers is acceptable (tastefull for maintainers) for Linux kernel. It is generally preferred to keep macro names all uppercase. Also, when possible, static inline

Coding style question

2007-02-09 Thread Pavel Pisa
Hello All, I have question if next style of macros definitions for hardware registers is acceptable (tastefull for maintainers) for Linux kernel. /* Register offset against peripheral base */ #define SUBSYSTEM_REGISTER_o 0x0 /* The register field mask */ #define REGISTER_FUNCTION_m 0x0