Thread (23 messages) 23 messages, 6 authors, 2014-08-05

[PATCH v3 1/3] asm-generic/io.h: Implement generic {read, write}s*()

From: arnd@arndb.de (Arnd Bergmann)
Date: 2014-07-19 09:11:15
Also in: linux-arch, lkml

On Saturday 19 July 2014 10:53:38 Sam Ravnborg wrote:
Then there are the other type where one IO access function
may re-use the implementation of another IO access function:

    #ifndef writeb
    #define writeb __raw_writeb
    #endif

This could have been implmented like this:

#ifndef writeb
#define writeb writeb
static inline void writeb(u8 b, volatile void __iomem *addr)
{
   __raw_writeb(b, addr);
}
#endif

In this way the prototype of the function is easy to understand and
we avoid the macro tricks were we blindly replace one function name,
with another function name.
And we also use the same pattarn all over for the various functions.

Concerning the efficiency the compiler should be smart enough to
do the same independent on the two implmentations.
I really don't have a strong opinion on those, as you say one is a
little shorter and the other is a little more readable, so my
preference in a case like this is to leave it up to the person
who last touches the code and let them decide.

	Arnd
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help