From: Arnd Bergmann <arnd@arndb.de>
To: Jaya Kumar <jayakumar.lkml@gmail.com>
Cc: Magnus Damm <magnus.damm@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-fbdev-devel@lists.sourceforge.net, adaplas@gmail.com,
linux-mm@kvack.org, lethal@linux-sh.org
Subject: Re: [PATCH] video: arch specific page protection support for deferred io
Date: Thu, 25 Jun 2009 22:57:49 +0200 [thread overview]
Message-ID: <200906252257.50235.arnd@arndb.de> (raw)
In-Reply-To: <45a44e480906251106h6cd72a72h380da4283be62506@mail.gmail.com>
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 <asm/foo.h>
#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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2009-06-25 20:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-24 10:54 Magnus Damm
2009-06-25 2:56 ` Andrew Morton
2009-06-25 3:09 ` Paul Mundt
2009-06-25 3:15 ` Andrew Morton
2009-06-25 6:06 ` Magnus Damm
2009-06-25 7:03 ` Andrew Morton
2009-06-25 17:38 ` Paul Mundt
2009-06-25 18:12 ` Andrew Morton
2009-06-25 18:36 ` Jaya Kumar
2009-06-25 18:50 ` Paul Mundt
2009-06-26 7:50 ` Magnus Damm
2009-06-26 5:37 ` Magnus Damm
2009-06-25 18:06 ` Jaya Kumar
2009-06-25 20:57 ` Arnd Bergmann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200906252257.50235.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=adaplas@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=jayakumar.lkml@gmail.com \
--cc=lethal@linux-sh.org \
--cc=linux-fbdev-devel@lists.sourceforge.net \
--cc=linux-mm@kvack.org \
--cc=magnus.damm@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox