[PATCH] shmem: fix compilation warnings on unused functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Compiling shmem.c with CONFIG_SHMEM and
CONFIG_TRANSAPRENT_HUGE_PAGECACHE enabled raises warnings on two unused
functions when CONFIG_TMPFS and CONFIG_SYSFS are both disabled:

mm/shmem.c:390:20: warning: ‘shmem_format_huge’ defined but not used
[-Wunused-function]
 static const char *shmem_format_huge(int huge)
                    ^~~~~~~~~~~~~~~~~
mm/shmem.c:373:12: warning: ‘shmem_parse_huge’ defined but not used
[-Wunused-function]
 static int shmem_parse_huge(const char *str)
             ^~~~~~~~~~~~~~~~

A conditional compilation on tmpfs or sysfs removes the warnings.

Signed-off-by: Jérémy Lefaure <jeremy.lefaure@xxxxxxxxxxxx>
---
 mm/shmem.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/shmem.c b/mm/shmem.c
index 2c74186..99595d8 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -370,6 +370,7 @@ static bool shmem_confirm_swap(struct address_space *mapping,
 
 int shmem_huge __read_mostly;
 
+#if defined(CONFIG_SYSFS) || defined(CONFIG_TMPFS)
 static int shmem_parse_huge(const char *str)
 {
 	if (!strcmp(str, "never"))
@@ -407,6 +408,7 @@ static const char *shmem_format_huge(int huge)
 		return "bad_val";
 	}
 }
+#endif
 
 static unsigned long shmem_unused_huge_shrink(struct shmem_sb_info *sbinfo,
 		struct shrink_control *sc, unsigned long nr_to_split)
-- 
2.10.2

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]