Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

range.h: Move resource API and constant to respective files

range.h works with struct range data type. The resource_size_t
is an alien here.

(1) Move cap_resource() implementation into its only user, and
(2) rename and move RESOURCE_SIZE_MAX to limits.h.

Link: https://lkml.kernel.org/r/20230804064636.15368-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Cc: Borislav Petkov (AMD) <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Andy Shevchenko and committed by
Andrew Morton
3c9d017c be33db21

+12 -10
+1 -1
arch/mips/cavium-octeon/setup.c
··· 1240 1240 */ 1241 1241 octeon_dummy_iospace = vzalloc(IO_SPACE_LIMIT); 1242 1242 set_io_port_base((unsigned long)octeon_dummy_iospace); 1243 - ioport_resource.start = MAX_RESOURCE; 1243 + ioport_resource.start = RESOURCE_SIZE_MAX; 1244 1244 ioport_resource.end = 0; 1245 1245 return 0; 1246 1246 }
+8
arch/x86/pci/amd_bus.c
··· 51 51 return NULL; 52 52 } 53 53 54 + static inline resource_size_t cap_resource(u64 val) 55 + { 56 + if (val > RESOURCE_SIZE_MAX) 57 + return RESOURCE_SIZE_MAX; 58 + 59 + return val; 60 + } 61 + 54 62 /** 55 63 * early_root_info_init() 56 64 * called before pcibios_scan_root and pci_scan_bus
+1 -1
arch/x86/pci/bus_numa.c
··· 101 101 if (start > end) 102 102 return; 103 103 104 - if (start == MAX_RESOURCE) 104 + if (start == RESOURCE_SIZE_MAX) 105 105 return; 106 106 107 107 if (!merge)
+2
include/linux/limits.h
··· 10 10 #define SSIZE_MAX ((ssize_t)(SIZE_MAX >> 1)) 11 11 #define PHYS_ADDR_MAX (~(phys_addr_t)0) 12 12 13 + #define RESOURCE_SIZE_MAX ((resource_size_t)~0) 14 + 13 15 #define U8_MAX ((u8)~0U) 14 16 #define S8_MAX ((s8)(U8_MAX >> 1)) 15 17 #define S8_MIN ((s8)(-S8_MAX - 1))
-8
include/linux/range.h
··· 31 31 32 32 void sort_range(struct range *range, int nr_range); 33 33 34 - #define MAX_RESOURCE ((resource_size_t)~0) 35 - static inline resource_size_t cap_resource(u64 val) 36 - { 37 - if (val > MAX_RESOURCE) 38 - return MAX_RESOURCE; 39 - 40 - return val; 41 - } 42 34 #endif