[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201109271539.21533.arnd@arndb.de>
Date: Tue, 27 Sep 2011 15:39:21 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Robert Jarzmik <robert.jarzmik@...e.fr>
Cc: dedekind1@...il.com, dwmw2@...radead.org,
linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH V4] mtd: Add DiskOnChip G3 support
On Thursday 22 September 2011, Robert Jarzmik wrote:
> >> +#define doc_flashSequence(seq) \
> >> +do { \
> >> + doc_dbg("doc_flashSequence: %02x " #seq "\n", DoC_Seq_##seq); \
> >> + doc_writeb(DoC_Seq_##seq, DoC_FlashSequence); \
> >> +} while (0)
> >> +
> ...zip...
> >
> > Could you please turn these macros into 'static inline' function - this
> > is one of the modern patterns of kernel programming - we try to use
> > functions for better type checking.
>
> No sorry, that I cannot. If you look closely, the ##seq is not something you can
> convert with an inline function, neither the #seq.
Better not obfuscate the code like that then ;-)
Really, passing the entire register name into an inline function is much
preferred over string concatenation, because it lets you grep for where
certain definitions are used. You can also convert them to ALL_CAPS
identifiers instead of cAmeLCAsE.
Finally, don't use the __raw_readb() style functions but instead use
the regular readb() style, which is the correct one to use in device
drivers.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists