linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] memblock test: fix compilation errors
@ 2023-09-14  7:56 Mike Rapoport
  2023-09-14  7:56 ` [PATCH 1/2] memblock tests: fix warning: "__ALIGN_KERNEL" redefined Mike Rapoport
  2023-09-14  7:56 ` [PATCH 2/2] memblock tests: fix warning ‘struct seq_file’ declared inside parameter list Mike Rapoport
  0 siblings, 2 replies; 3+ messages in thread
From: Mike Rapoport @ 2023-09-14  7:56 UTC (permalink / raw)
  To: linux-mm; +Cc: Andrew Morton, Mike Rapoport, linux-kernel

From: "Mike Rapoport (IBM)" <rppt@kernel.org>

Hi,

These are small compilation warning fixes for the memblock tests.

If there are no objections I'm going to take them via memblock tree.

Mike Rapoport (IBM) (2):
  memblock tests: fix warning: "__ALIGN_KERNEL" redefined
  memblock tests: fix warning ‘struct seq_file’ declared inside
    parameter list

 tools/include/linux/mm.h                 | 2 --
 tools/include/linux/seq_file.h           | 2 ++
 tools/testing/memblock/tests/basic_api.c | 2 +-
 tools/testing/memblock/tests/common.h    | 1 +
 4 files changed, 4 insertions(+), 3 deletions(-)

-- 
2.39.2



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

* [PATCH 1/2] memblock tests: fix warning: "__ALIGN_KERNEL" redefined
  2023-09-14  7:56 [PATCH 0/2] memblock test: fix compilation errors Mike Rapoport
@ 2023-09-14  7:56 ` Mike Rapoport
  2023-09-14  7:56 ` [PATCH 2/2] memblock tests: fix warning ‘struct seq_file’ declared inside parameter list Mike Rapoport
  1 sibling, 0 replies; 3+ messages in thread
From: Mike Rapoport @ 2023-09-14  7:56 UTC (permalink / raw)
  To: linux-mm; +Cc: Andrew Morton, Mike Rapoport, linux-kernel

From: "Mike Rapoport (IBM)" <rppt@kernel.org>

Building memblock tests produces the following warning:

cc -I. -I../../include -Wall -O2 -fsanitize=address -fsanitize=undefined -D CONFIG_PHYS_ADDR_T_64BIT   -c -o main.o main.c
In file included from ../../include/linux/pfn.h:5,
                 from ./linux/memory_hotplug.h:6,
                 from ./linux/init.h:7,
                 from ./linux/memblock.h:11,
                 from tests/common.h:8,
                 from tests/basic_api.h:5,
                 from main.c:2:
../../include/linux/mm.h:14: warning: "__ALIGN_KERNEL" redefined
   14 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
      |
In file included from ../../include/linux/mm.h:6,
                 from ../../include/linux/pfn.h:5,
                 from ./linux/memory_hotplug.h:6,
                 from ./linux/init.h:7,
                 from ./linux/memblock.h:11,
                 from tests/common.h:8,
                 from tests/basic_api.h:5,
                 from main.c:2:
../../include/uapi/linux/const.h:31: note: this is the location of the previous definition
   31 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
      |

Remove definitions of __ALIGN_KERNEL and __ALIGN_KERNEL_MASK from
tools/include/linux/mm.h to fix it.

Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
---
 tools/include/linux/mm.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tools/include/linux/mm.h b/tools/include/linux/mm.h
index 2bc94079d616..f3c82ab5b14c 100644
--- a/tools/include/linux/mm.h
+++ b/tools/include/linux/mm.h
@@ -11,8 +11,6 @@
 
 #define PHYS_ADDR_MAX	(~(phys_addr_t)0)
 
-#define __ALIGN_KERNEL(x, a)		__ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
-#define __ALIGN_KERNEL_MASK(x, mask)	(((x) + (mask)) & ~(mask))
 #define ALIGN(x, a)			__ALIGN_KERNEL((x), (a))
 #define ALIGN_DOWN(x, a)		__ALIGN_KERNEL((x) - ((a) - 1), (a))
 
-- 
2.39.2



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

* [PATCH 2/2] memblock tests: fix warning ‘struct seq_file’ declared inside parameter list
  2023-09-14  7:56 [PATCH 0/2] memblock test: fix compilation errors Mike Rapoport
  2023-09-14  7:56 ` [PATCH 1/2] memblock tests: fix warning: "__ALIGN_KERNEL" redefined Mike Rapoport
@ 2023-09-14  7:56 ` Mike Rapoport
  1 sibling, 0 replies; 3+ messages in thread
From: Mike Rapoport @ 2023-09-14  7:56 UTC (permalink / raw)
  To: linux-mm; +Cc: Andrew Morton, Mike Rapoport, linux-kernel

From: "Mike Rapoport (IBM)" <rppt@kernel.org>

Building memblock tests produces the following warning:

cc -I. -I../../include -Wall -O2 -fsanitize=address -fsanitize=undefined -D CONFIG_PHYS_ADDR_T_64BIT   -c -o main.o main.c
In file included from tests/common.h:9,
                 from tests/basic_api.h:5,
                 from main.c:2:
./linux/memblock.h:601:50: warning: ‘struct seq_file’ declared inside parameter list will not be visible outside of this definition or declaration
  601 | static inline void memtest_report_meminfo(struct seq_file *m) { }
      |                                                  ^~~~~~~~

Add declaration of 'struct seq_file' to tools/include/linux/seq_file.h
to fix it.

Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
---
 tools/include/linux/seq_file.h           | 2 ++
 tools/testing/memblock/tests/basic_api.c | 2 +-
 tools/testing/memblock/tests/common.h    | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/include/linux/seq_file.h b/tools/include/linux/seq_file.h
index 102fd9217f1f..f6bc226af0c1 100644
--- a/tools/include/linux/seq_file.h
+++ b/tools/include/linux/seq_file.h
@@ -1,4 +1,6 @@
 #ifndef _TOOLS_INCLUDE_LINUX_SEQ_FILE_H
 #define _TOOLS_INCLUDE_LINUX_SEQ_FILE_H
 
+struct seq_file;
+
 #endif /* _TOOLS_INCLUDE_LINUX_SEQ_FILE_H */
diff --git a/tools/testing/memblock/tests/basic_api.c b/tools/testing/memblock/tests/basic_api.c
index 411647094cc3..57bf2688edfd 100644
--- a/tools/testing/memblock/tests/basic_api.c
+++ b/tools/testing/memblock/tests/basic_api.c
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
+#include "basic_api.h"
 #include <string.h>
 #include <linux/memblock.h>
-#include "basic_api.h"
 
 #define EXPECTED_MEMBLOCK_REGIONS			128
 #define FUNC_ADD					"memblock_add"
diff --git a/tools/testing/memblock/tests/common.h b/tools/testing/memblock/tests/common.h
index 4f23302ee677..b5ec59aa62d7 100644
--- a/tools/testing/memblock/tests/common.h
+++ b/tools/testing/memblock/tests/common.h
@@ -5,6 +5,7 @@
 #include <stdlib.h>
 #include <assert.h>
 #include <linux/types.h>
+#include <linux/seq_file.h>
 #include <linux/memblock.h>
 #include <linux/sizes.h>
 #include <linux/printk.h>
-- 
2.39.2



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

end of thread, other threads:[~2023-09-14  7:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-14  7:56 [PATCH 0/2] memblock test: fix compilation errors Mike Rapoport
2023-09-14  7:56 ` [PATCH 1/2] memblock tests: fix warning: "__ALIGN_KERNEL" redefined Mike Rapoport
2023-09-14  7:56 ` [PATCH 2/2] memblock tests: fix warning ‘struct seq_file’ declared inside parameter list Mike Rapoport

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).