From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnd Bergmann Subject: Re: [PATCH] video: arch specific page protection support for deferred io Date: Thu, 25 Jun 2009 22:57:49 +0200 Message-ID: <200906252257.50235.arnd@arndb.de> References: <20090624105413.13925.65192.sendpatchset@rx1.opensource.se> <45a44e480906251106h6cd72a72h380da4283be62506@mail.gmail.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <45a44e480906251106h6cd72a72h380da4283be62506@mail.gmail.com> Sender: owner-linux-mm@kvack.org List-Id: Cc: Magnus Damm , Andrew Morton , linux-fbdev-devel@lists.sourceforge.net, adaplas@gmail.com, linux-mm@kvack.org, lethal@linux-sh.org On Thursday 25 June 2009, Jaya Kumar wrote: > The patch looks good. I was going to suggest that it might be > attractive to use __attribute__(weak) for each of the dummy functions > instead of ifdefs in this case, but I can't remember if there was a > consensus about attribute-weak versus ifdefs. We rarely use weak functions, the canonical way to express an optional subsystem is along the lines of /* include/linux/foo.h */ #ifdef CONFIG_FOO extern int bar(void); #else static inline int bar(void) { return 0; } #endif --- /* foo/foo.c */ int bar(void) { /* the real thing here */ ... } --- # foo/Makefile obj-$(CONFIG_FOO) += foo.c Most uses of __weak or __attribute__((weak)) are for working default implementations that can be overridden by architecture specific code. However, for these the preferred way to express seems to have shifted towards variations of: /* include/linux/foo.h */ #include #ifndef bar static inline int bar(void) { /* generic implementation */ ... } #endif /* arch/*/include/asm/foo.h */ #define bar bar static inline int bar(void) { /* arch specific implementation */ ... } Arnd <>< -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org