linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/zbud: fix unused function warnings when CONFIG_ZPOOL is disabled
@ 2021-06-19  2:55 Miaohe Lin
  0 siblings, 0 replies; only message in thread
From: Miaohe Lin @ 2021-06-19  2:55 UTC (permalink / raw)
  To: akpm, sjenning, ddstreet, nathan; +Cc: linux-kernel, linux-mm, linmiaohe

There are several -Wunused-function warnings when CONFIG_ZPOOL is disabled.
As zbud won't do anything when CONFIG_ZPOOL is disabled, we can make zbud
depends on ZPOOL and eliminate the CONFIG_ZPOOL macro in zbud.c to fix
these warnings.

Fixes: 962b7e9ad124 ("mm/zbud: don't export any zbud API")
Reported-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
Hi, Andrew:
Please feel free to merge this patch with
mm-zbud-dont-export-any-zbud-api.patch.
Many thanks!
---
 mm/Kconfig |  1 +
 mm/zbud.c  | 10 ----------
 2 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/mm/Kconfig b/mm/Kconfig
index 8f748010f7ea..5dc28e9205e0 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -674,6 +674,7 @@ config ZPOOL
 
 config ZBUD
 	tristate "Low (Up to 2x) density storage for compressed pages"
+	depends on ZPOOL
 	help
 	  A special purpose allocator for storing compressed pages.
 	  It is designed to store up to two compressed pages per physical
diff --git a/mm/zbud.c b/mm/zbud.c
index 3f61304405cb..6348932430b8 100644
--- a/mm/zbud.c
+++ b/mm/zbud.c
@@ -111,10 +111,8 @@ struct zbud_pool {
 	struct list_head lru;
 	u64 pages_nr;
 	const struct zbud_ops *ops;
-#ifdef CONFIG_ZPOOL
 	struct zpool *zpool;
 	const struct zpool_ops *zpool_ops;
-#endif
 };
 
 /*
@@ -526,8 +524,6 @@ static u64 zbud_get_pool_size(struct zbud_pool *pool)
  * zpool
  ****************/
 
-#ifdef CONFIG_ZPOOL
-
 static int zbud_zpool_evict(struct zbud_pool *pool, unsigned long handle)
 {
 	if (pool->zpool && pool->zpool_ops && pool->zpool_ops->evict)
@@ -618,7 +614,6 @@ static struct zpool_driver zbud_zpool_driver = {
 };
 
 MODULE_ALIAS("zpool-zbud");
-#endif /* CONFIG_ZPOOL */
 
 static int __init init_zbud(void)
 {
@@ -626,19 +621,14 @@ static int __init init_zbud(void)
 	BUILD_BUG_ON(sizeof(struct zbud_header) > ZHDR_SIZE_ALIGNED);
 	pr_info("loaded\n");
 
-#ifdef CONFIG_ZPOOL
 	zpool_register_driver(&zbud_zpool_driver);
-#endif
 
 	return 0;
 }
 
 static void __exit exit_zbud(void)
 {
-#ifdef CONFIG_ZPOOL
 	zpool_unregister_driver(&zbud_zpool_driver);
-#endif
-
 	pr_info("unloaded\n");
 }
 
-- 
2.23.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-19  2:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-19  2:55 [PATCH] mm/zbud: fix unused function warnings when CONFIG_ZPOOL is disabled Miaohe Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).