Skip to content

Commit 87c5587

Browse files
rppttorvalds
authored andcommitted
memblock: make memblock_debug and related functionality private
The only user of memblock_dbg() outside memblock was s390 setup code and it is converted to use pr_debug() instead. This allows to stop exposing memblock_debug and memblock_dbg() to the rest of the kernel. [[email protected]: make memblock_dbg() safer and neater] Signed-off-by: Mike Rapoport <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Reviewed-by: Baoquan He <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Daniel Axtens <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Emil Renner Berthing <[email protected]> Cc: Hari Bathini <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jonathan Cameron <[email protected]> Cc: Marek Szyprowski <[email protected]> Cc: Max Filippov <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Michal Simek <[email protected]> Cc: Miguel Ojeda <[email protected]> Cc: Palmer Dabbelt <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Paul Walmsley <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Russell King <[email protected]> Cc: Stafford Horne <[email protected]> Cc: Thomas Bogendoerfer <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Will Deacon <[email protected]> Cc: Yoshinori Sato <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent cd991db commit 87c5587

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

arch/s390/kernel/setup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -776,8 +776,8 @@ static void __init memblock_add_mem_detect_info(void)
776776
unsigned long start, end;
777777
int i;
778778

779-
memblock_dbg("physmem info source: %s (%hhd)\n",
780-
get_mem_info_source(), mem_detect.info_source);
779+
pr_debug("physmem info source: %s (%hhd)\n",
780+
get_mem_info_source(), mem_detect.info_source);
781781
/* keep memblock lists close to the kernel */
782782
memblock_set_bottom_up(true);
783783
for_each_mem_detect_block(i, &start, &end) {

include/linux/memblock.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ struct memblock {
8686
};
8787

8888
extern struct memblock memblock;
89-
extern int memblock_debug;
9089

9190
#ifndef CONFIG_ARCH_KEEP_MEMBLOCK
9291
#define __init_memblock __meminit
@@ -98,9 +97,6 @@ void memblock_discard(void);
9897
static inline void memblock_discard(void) {}
9998
#endif
10099

101-
#define memblock_dbg(fmt, ...) \
102-
if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
103-
104100
phys_addr_t memblock_find_in_range(phys_addr_t start, phys_addr_t end,
105101
phys_addr_t size, phys_addr_t align);
106102
void memblock_allow_resize(void);
@@ -476,13 +472,7 @@ bool memblock_is_region_memory(phys_addr_t base, phys_addr_t size);
476472
bool memblock_is_reserved(phys_addr_t addr);
477473
bool memblock_is_region_reserved(phys_addr_t base, phys_addr_t size);
478474

479-
extern void __memblock_dump_all(void);
480-
481-
static inline void memblock_dump_all(void)
482-
{
483-
if (memblock_debug)
484-
__memblock_dump_all();
485-
}
475+
void memblock_dump_all(void);
486476

487477
/**
488478
* memblock_set_current_limit - Set the current allocation limit to allow

mm/memblock.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,13 @@ struct memblock_type physmem = {
137137
i < memblock_type->cnt; \
138138
i++, rgn = &memblock_type->regions[i])
139139

140-
int memblock_debug __initdata_memblock;
140+
#define memblock_dbg(fmt, ...) \
141+
do { \
142+
if (memblock_debug) \
143+
pr_info(fmt, ##__VA_ARGS__); \
144+
} while (0)
145+
146+
static int memblock_debug __initdata_memblock;
141147
static bool system_has_some_mirror __initdata_memblock = false;
142148
static int memblock_can_resize __initdata_memblock;
143149
static int memblock_memory_in_slab __initdata_memblock = 0;
@@ -1920,7 +1926,7 @@ static void __init_memblock memblock_dump(struct memblock_type *type)
19201926
}
19211927
}
19221928

1923-
void __init_memblock __memblock_dump_all(void)
1929+
static void __init_memblock __memblock_dump_all(void)
19241930
{
19251931
pr_info("MEMBLOCK configuration:\n");
19261932
pr_info(" memory size = %pa reserved size = %pa\n",
@@ -1934,6 +1940,12 @@ void __init_memblock __memblock_dump_all(void)
19341940
#endif
19351941
}
19361942

1943+
void __init_memblock memblock_dump_all(void)
1944+
{
1945+
if (memblock_debug)
1946+
__memblock_dump_all();
1947+
}
1948+
19371949
void __init memblock_allow_resize(void)
19381950
{
19391951
memblock_can_resize = 1;

0 commit comments

Comments
 (0)