Skip to content

Commit cff02bf

Browse files
committed
x86/boot/e820: Clean up e820__setup_pci_gap()/e820_search_gap() a bit
Apply misc cleanups: - Use a bit more readable variable names, we haven't run out of underscore characters in the kernel yet. - s/0x400000/SZ_4M - s/1024*1024/SZ_1M Suggested-by: Andy Shevchenko <andy@kernel.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Arnd Bergmann <arnd@kernel.org> Cc: David Woodhouse <dwmw@amazon.co.uk> Cc: H . Peter Anvin <hpa@zytor.com> Cc: Juergen Gross <jgross@suse.com> Cc: Kees Cook <keescook@chromium.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Rapoport <rppt@kernel.org> Cc: Paul Menzel <pmenzel@molgen.mpg.de> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://patch.msgid.link/20250515120549.2820541-21-mingo@kernel.org
1 parent 46f3e7d commit cff02bf

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

arch/x86/kernel/e820.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ static void __init e820__update_table_kexec(void)
638638
/*
639639
* Search for a gap in the E820 memory space from 0 to MAX_GAP_END (4GB).
640640
*/
641-
static int __init e820_search_gap(unsigned long *gapstart, unsigned long *gapsize)
641+
static int __init e820_search_gap(unsigned long *gap_start, unsigned long *gap_size)
642642
{
643643
u64 last = MAX_GAP_END;
644644
int idx = e820_table->nr_entries;
@@ -655,9 +655,9 @@ static int __init e820_search_gap(unsigned long *gapstart, unsigned long *gapsiz
655655
if (last > end) {
656656
unsigned long gap = last - end;
657657

658-
if (gap >= *gapsize) {
659-
*gapsize = gap;
660-
*gapstart = end;
658+
if (gap >= *gap_size) {
659+
*gap_size = gap;
660+
*gap_start = end;
661661
found = 1;
662662
}
663663
}
@@ -677,29 +677,29 @@ static int __init e820_search_gap(unsigned long *gapstart, unsigned long *gapsiz
677677
*/
678678
__init void e820__setup_pci_gap(void)
679679
{
680-
unsigned long gapstart, gapsize;
680+
unsigned long gap_start, gap_size;
681681
int found;
682682

683-
gapsize = 0x400000;
684-
found = e820_search_gap(&gapstart, &gapsize);
683+
gap_size = SZ_4M;
684+
found = e820_search_gap(&gap_start, &gap_size);
685685

686686
if (!found) {
687687
#ifdef CONFIG_X86_64
688-
gapstart = (max_pfn << PAGE_SHIFT) + 1024*1024;
688+
gap_start = (max_pfn << PAGE_SHIFT) + SZ_1M;
689689
pr_err("Cannot find an available gap in the 32-bit address range\n");
690690
pr_err("PCI devices with unassigned 32-bit BARs may not work!\n");
691691
#else
692-
gapstart = 0x10000000;
692+
gap_start = 0x10000000;
693693
#endif
694694
}
695695

696696
/*
697697
* e820__reserve_resources_late() protects stolen RAM already:
698698
*/
699-
pci_mem_start = gapstart;
699+
pci_mem_start = gap_start;
700700

701701
pr_info("[gap %#010lx-%#010lx] available for PCI devices\n",
702-
gapstart, gapstart + gapsize - 1);
702+
gap_start, gap_start + gap_size - 1);
703703
}
704704

705705
/*

0 commit comments

Comments
 (0)