On Mon, 2010-01-04 at 15:47 -0800, Greg KH wrote: > On Mon, Jan 04, 2010 at 03:32:07PM -0800, Bruce Blinn wrote: [...] > > > On Sat, Jan 02, 2010 at 09:10:08PM +0800, Shawn wrote: > > > > hello guys, > > > > I got a newbie confused when I was looking into the source code of > > > > s3c2440's RTC driver.I dont know what is __v excatly > > > means.anyone can > > > > tell?thanks anyway! > > > > > > > > #define readb(c) ({ __u8 __v = __raw_readb(__mem_pci(c)); __v; }) > > > > > > __v is an variable that the macro creates and then returns > > > the value of. > > > > > > Don't code like this, it's horrible :) > > > > Could you be more specific with what you find wrong with this. The reason I > > ask is there is code like this all over the kernel. > > Like what specifically? > > Wrapping up a function call in a macro just because someone doesn't want > to type the whole thing out? That's the horrible thing. > > Returning a temporary variable isn't a big deal, but an inline function > is better to use as you will get the proper type safety. So which is better (in the kernel and for this functions, macros or whatever they really maybe!)? a) #define readb(c) ((__u8)__raw_readb(__mem_pci(c))) which is more a rephrase of the above b) static inline __u8 readb(const void *c) { return __raw_readb(__mem_pci(c)); } Caveat emptor: Not compile-tested. Bernd -- mobil: +43 664 4416156 http://bernd.petrovitsch.priv.at/ Linux Software Entwicklung, Beratung und Dienstleistungen -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ