[PATCH] mm: include swap.h in swapops.h

Kiryl Shutsemau <[email protected]>
Newsgroups org.kvack.linux-mm,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
From: "Kiryl Shutsemau (Meta)" <[email protected]>

swapops.h uses MAX_SWAPFILES_SHIFT, SWP_MIGRATION_READ and SWP_PTE_MARKER,
all of which swap.h defines, but does not include swap.h.  It compiles only
where the translation unit pulled swap.h in first.  leafops.h includes
swapops.h on the line above swap.h, so a file whose include list reaches
leafops.h before swap.h gets:

    In file included from include/linux/leafops.h:11:
    include/linux/swapops.h:88:21: error: use of undeclared
    identifier 'MAX_SWAPFILES_SHIFT'

A header that uses a definition has to include the header that provides it.

Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Signed-off-by: Kiryl Shutsemau (Meta) <[email protected]>
---
 include/linux/swapops.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index 1f3ff3b93e16..e7d0d529f3e0 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -5,6 +5,7 @@
 #include <linux/radix-tree.h>
 #include <linux/bug.h>
 #include <linux/mm_types.h>
+#include <linux/swap.h>
 
 #ifdef CONFIG_MMU
 

base-commit: 33f61b12d297562321533c048e034b1fb21c1cf3
-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.