All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Randy Dunlap <rdunlap@xenotime.net>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
	Amerigo Wang <amwang@redhat.com>,
	gregkh@suse.de, linux-next@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	linux-mm@kvack.org
Subject: Re: [PATCH -next] drivers/base/inode.c: let vmstat_text be optional
Date: Tue, 23 Aug 2011 14:39:12 -0700	[thread overview]
Message-ID: <20110823143912.0691d442.akpm@linux-foundation.org> (raw)
In-Reply-To: <20110804152211.ea10e3e7.rdunlap@xenotime.net>


> Subject: [PATCH -next] drivers/base/inode.c: let vmstat_text be optional

The patch-against-next thing always disturbs me.  It implies that the
patch is only needed in linux-next, but often that's wrong.  So I have
to go off and work out what kernel it really is applicable to.

And that's OK, it keeps me healthy.  But two minds are better than one,
and if the originator has already worked this out, they should state it
explicitly, please.

On Thu, 4 Aug 2011 15:22:11 -0700
Randy Dunlap <rdunlap@xenotime.net> wrote:

> From: Randy Dunlap <rdunlap@xenotime.net>
> 
> vmstat_text is only available when PROC_FS or SYSFS is enabled.
> This causes build errors in drivers/base/node.c when they are
> both disabled:
> 
> drivers/built-in.o: In function `node_read_vmstat':
> node.c:(.text+0x10e28f): undefined reference to `vmstat_text'
> 
> Rather than litter drivers/base/node.c with #ifdef/#endif around
> the affected lines of code, add macros for optional sysdev
> attributes so that those lines of code will be ignored, without
> using #ifdef/#endif in the .c file(s).  I.e., the ifdeffery
> is done only in a header file with sysdev_create_file_optional()
> and sysdev_remove_file_optional().
> 
> --- linux-next-20110804.orig/include/linux/vmstat.h
> +++ linux-next-20110804/include/linux/vmstat.h
> @@ -258,6 +258,8 @@ static inline void refresh_zone_stat_thr
>  
>  #endif		/* CONFIG_SMP */
>  
> +#if defined(CONFIG_PROC_FS) || defined(CONFIG_SYSFS)
>  extern const char * const vmstat_text[];
> +#endif
>

The ifdef around the declaration isn't needed, really.  If we remove
it then a build-time error becomes a link-time (or even moddep-time) error,
which is a bit of a pain.  But it's less painful than having ifdefs
around squillions of declarations.



WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: Randy Dunlap <rdunlap@xenotime.net>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
	Amerigo Wang <amwang@redhat.com>,
	gregkh@suse.de, linux-next@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	linux-mm@kvack.org
Subject: Re: [PATCH -next] drivers/base/inode.c: let vmstat_text be optional
Date: Tue, 23 Aug 2011 14:39:12 -0700	[thread overview]
Message-ID: <20110823143912.0691d442.akpm@linux-foundation.org> (raw)
In-Reply-To: <20110804152211.ea10e3e7.rdunlap@xenotime.net>


> Subject: [PATCH -next] drivers/base/inode.c: let vmstat_text be optional

The patch-against-next thing always disturbs me.  It implies that the
patch is only needed in linux-next, but often that's wrong.  So I have
to go off and work out what kernel it really is applicable to.

And that's OK, it keeps me healthy.  But two minds are better than one,
and if the originator has already worked this out, they should state it
explicitly, please.

On Thu, 4 Aug 2011 15:22:11 -0700
Randy Dunlap <rdunlap@xenotime.net> wrote:

> From: Randy Dunlap <rdunlap@xenotime.net>
> 
> vmstat_text is only available when PROC_FS or SYSFS is enabled.
> This causes build errors in drivers/base/node.c when they are
> both disabled:
> 
> drivers/built-in.o: In function `node_read_vmstat':
> node.c:(.text+0x10e28f): undefined reference to `vmstat_text'
> 
> Rather than litter drivers/base/node.c with #ifdef/#endif around
> the affected lines of code, add macros for optional sysdev
> attributes so that those lines of code will be ignored, without
> using #ifdef/#endif in the .c file(s).  I.e., the ifdeffery
> is done only in a header file with sysdev_create_file_optional()
> and sysdev_remove_file_optional().
> 
> --- linux-next-20110804.orig/include/linux/vmstat.h
> +++ linux-next-20110804/include/linux/vmstat.h
> @@ -258,6 +258,8 @@ static inline void refresh_zone_stat_thr
>  
>  #endif		/* CONFIG_SMP */
>  
> +#if defined(CONFIG_PROC_FS) || defined(CONFIG_SYSFS)
>  extern const char * const vmstat_text[];
> +#endif
>

The ifdef around the declaration isn't needed, really.  If we remove
it then a build-time error becomes a link-time (or even moddep-time) error,
which is a bit of a pain.  But it's less painful than having ifdefs
around squillions of declarations.


--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2011-08-23 21:39 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-04  4:58 linux-next: Tree for Aug 4 Stephen Rothwell
2011-08-04 21:24 ` linux-next: Tree for Aug 4 (zcache) Randy Dunlap
2011-08-04 21:44   ` Greg KH
2011-08-04 21:51     ` Randy Dunlap
2011-08-04 21:54       ` Thadeu Lima de Souza Cascardo
2011-08-04 21:54         ` Thadeu Lima de Souza Cascardo
2011-08-04 22:00       ` [PATCH] zcache: Use div_u64 for 64-bit division Thadeu Lima de Souza Cascardo
2011-08-04 22:17         ` Randy Dunlap
2011-08-04 22:22 ` [PATCH -next] drivers/base/inode.c: let vmstat_text be optional Randy Dunlap
2011-08-04 22:22   ` Randy Dunlap
2011-08-05  2:38   ` Cong Wang
2011-08-05  2:38     ` Cong Wang
2011-08-05  2:38     ` Cong Wang
2011-08-05  5:43     ` Randy Dunlap
2011-08-05  5:43       ` Randy Dunlap
2011-08-05  8:02       ` Cong Wang
2011-08-05  8:02         ` Cong Wang
2011-08-05  8:02         ` Cong Wang
2011-08-23 21:39   ` Andrew Morton [this message]
2011-08-23 21:39     ` Andrew Morton
2011-08-24  3:34     ` [Patch] numa: introduce CONFIG_NUMA_SYSFS for drivers/base/node.c Cong Wang
2011-08-25  2:14       ` Randy Dunlap
2011-08-25  2:14         ` Randy Dunlap
2011-08-25  3:31         ` Cong Wang
2011-08-25  3:31           ` Cong Wang
2011-08-25  3:50           ` Randy Dunlap
2011-08-25  3:50             ` Randy Dunlap
2011-08-25  5:04             ` David Rientjes
2011-08-25  5:04               ` David Rientjes
2011-08-25 10:22               ` Cong Wang
2011-08-25 10:22                 ` Cong Wang
2011-08-25 10:22                 ` Cong Wang
2011-08-25 20:57                 ` David Rientjes
2011-08-25 20:57                   ` David Rientjes
2011-08-29  2:29                   ` Cong Wang
2011-08-29  2:29                     ` Cong Wang
2011-08-29  2:29                     ` Cong Wang
2011-08-25  5:55           ` [patch] numa: fix NUMA compile error when sysfs and procfs are disabled David Rientjes
2011-08-25  5:55             ` David Rientjes
2011-08-25 17:17             ` Randy Dunlap
2011-08-25 17:17               ` Randy Dunlap

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=20110823143912.0691d442.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=amwang@redhat.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-next@vger.kernel.org \
    --cc=rdunlap@xenotime.net \
    --cc=sfr@canb.auug.org.au \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.