public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] HugeTLB: Fix unused variable warning
@ 2009-09-24 10:02 David Howells
  2009-09-24 11:51 ` Eric B Munson
  2009-09-24 18:45 ` David Rientjes
  0 siblings, 2 replies; 3+ messages in thread
From: David Howells @ 2009-09-24 10:02 UTC (permalink / raw)
  To: torvalds, akpm; +Cc: ebmunson, rientjes, dhowells, linux-kernel

Fix an unused variable warning:

	mm/mmap.c: In function 'do_mmap_pgoff':
	mm/mmap.c:953: warning: unused variable 'user'

by converting the CONFIG_HUGETLBFS=n version of hugetlb_file_setup() into an
inline function instead of a macro.

Introduced by:

	commit 4e52780d41a741fb4861ae1df2413dd816ec11b1
	Author: Eric B Munson <ebmunson@us.ibm.com>
	Date:   Mon Sep 21 17:03:47 2009 -0700
	hugetlb: add MAP_HUGETLB for mmaping pseudo-anonymous huge page regions

Signed-off-by: David Howells <dhowells@redhat.com>
---

 include/linux/hugetlb.h |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)


diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 176e7ee..c5d3111 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -3,6 +3,8 @@
 
 #include <linux/fs.h>
 
+struct user_struct;
+
 #ifdef CONFIG_HUGETLB_PAGE
 
 #include <linux/mempolicy.h>
@@ -10,7 +12,6 @@
 #include <asm/tlbflush.h>
 
 struct ctl_table;
-struct user_struct;
 
 int PageHuge(struct page *page);
 
@@ -187,7 +188,13 @@ static inline void set_file_hugepages(struct file *file)
 
 #define is_file_hugepages(file)			0
 #define set_file_hugepages(file)		BUG()
-#define hugetlb_file_setup(name,size,acct,user,creat)	ERR_PTR(-ENOSYS)
+
+static inline
+struct file *hugetlb_file_setup(const char *name, size_t size, int acctflag,
+				struct user_struct **user, int creat_flags)
+{
+ 	return ERR_PTR(-ENOSYS);
+}
 
 #endif /* !CONFIG_HUGETLBFS */
 


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] HugeTLB: Fix unused variable warning
  2009-09-24 10:02 [PATCH] HugeTLB: Fix unused variable warning David Howells
@ 2009-09-24 11:51 ` Eric B Munson
  2009-09-24 18:45 ` David Rientjes
  1 sibling, 0 replies; 3+ messages in thread
From: Eric B Munson @ 2009-09-24 11:51 UTC (permalink / raw)
  To: David Howells; +Cc: torvalds, akpm, rientjes, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 654 bytes --]

On Thu, 24 Sep 2009, David Howells wrote:

> Fix an unused variable warning:
> 
> 	mm/mmap.c: In function 'do_mmap_pgoff':
> 	mm/mmap.c:953: warning: unused variable 'user'
> 
> by converting the CONFIG_HUGETLBFS=n version of hugetlb_file_setup() into an
> inline function instead of a macro.
> 
> Introduced by:
> 
> 	commit 4e52780d41a741fb4861ae1df2413dd816ec11b1
> 	Author: Eric B Munson <ebmunson@us.ibm.com>
> 	Date:   Mon Sep 21 17:03:47 2009 -0700
> 	hugetlb: add MAP_HUGETLB for mmaping pseudo-anonymous huge page regions
> 
> Signed-off-by: David Howells <dhowells@redhat.com>

Acked-by: Eric B Munson <ebmunson@us.ibm.com>

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] HugeTLB: Fix unused variable warning
  2009-09-24 10:02 [PATCH] HugeTLB: Fix unused variable warning David Howells
  2009-09-24 11:51 ` Eric B Munson
@ 2009-09-24 18:45 ` David Rientjes
  1 sibling, 0 replies; 3+ messages in thread
From: David Rientjes @ 2009-09-24 18:45 UTC (permalink / raw)
  To: David Howells; +Cc: torvalds, akpm, ebmunson, linux-kernel

On Thu, 24 Sep 2009, David Howells wrote:

> Fix an unused variable warning:
> 
> 	mm/mmap.c: In function 'do_mmap_pgoff':
> 	mm/mmap.c:953: warning: unused variable 'user'
> 
> by converting the CONFIG_HUGETLBFS=n version of hugetlb_file_setup() into an
> inline function instead of a macro.
> 
> Introduced by:
> 
> 	commit 4e52780d41a741fb4861ae1df2413dd816ec11b1
> 	Author: Eric B Munson <ebmunson@us.ibm.com>
> 	Date:   Mon Sep 21 17:03:47 2009 -0700
> 	hugetlb: add MAP_HUGETLB for mmaping pseudo-anonymous huge page regions
> 
> Signed-off-by: David Howells <dhowells@redhat.com>

Andrew added hugetlb_file_setup-use-c-not-cpp.patch to -mm on Tuesday and 
it should appear in the next mmotm.


From: Andrew Morton <akpm@linux-foundation.org>

why macros are always wrong:

mm/mmap.c: In function 'do_mmap_pgoff':
mm/mmap.c:953: warning: unused variable 'user'

also, move a couple of struct forward-decls outside `#ifdef
CONFIG_HUGETLB_PAGE' - it's pointless and frequently harmful to make these
conditional (eg, this patch needed `struct user_struct').

Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Nishanth Aravamudan <nacc@us.ibm.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Adam Litke <agl@us.ibm.com>
Cc: Andy Whitcroft <apw@canonical.com>
Cc: Eric Whitney <eric.whitney@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 include/linux/hugetlb.h |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff -puN include/linux/hugetlb.h~hugetlb_file_setup-use-c-not-cpp include/linux/hugetlb.h
--- a/include/linux/hugetlb.h~hugetlb_file_setup-use-c-not-cpp
+++ a/include/linux/hugetlb.h
@@ -3,15 +3,15 @@

 #include <linux/fs.h>

+struct ctl_table;
+struct user_struct;
+
 #ifdef CONFIG_HUGETLB_PAGE

 #include <linux/mempolicy.h>
 #include <linux/shm.h>
 #include <asm/tlbflush.h>

-struct ctl_table;
-struct user_struct;
-
 int PageHuge(struct page *page);

 static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
@@ -187,7 +187,11 @@ static inline void set_file_hugepages(st

 #define is_file_hugepages(file)                        0
 #define set_file_hugepages(file)               BUG()
-#define hugetlb_file_setup(name,size,acct,user,creat)  ERR_PTR(-ENOSYS)
+static inline struct file *hugetlb_file_setup(const char *name, size_t size, int acctflag,
+                               struct user_struct **user, int creat_flags)
+{
+       return ERR_PTR(-ENOSYS);
+}

 #endif /* !CONFIG_HUGETLBFS */
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-09-24 18:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-24 10:02 [PATCH] HugeTLB: Fix unused variable warning David Howells
2009-09-24 11:51 ` Eric B Munson
2009-09-24 18:45 ` David Rientjes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox