range.h: Move resource API and constant to respective files
PATCH v3 1/1 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.
Signed-off-by Andy Shevchenko <[email protected]>
Acked-by Bjorn Helgaas <[email protected]>
---
v3: Cc'ed to Andrew to pick up
(I believe with Bjorn Ack we are fine to route it via your tree as it doesn't change any code behaviour)
arch/mips/cavium-octeon/setup.c | 2 +- arch/x86/pci/amd_bus.c | 8 ++++++++ arch/x86/pci/bus_numa.c | 2 +- include/linux/limits.h | 2 ++ include/linux/range.h | 8 -------- 5 files changed, 12 insertions(+), 10 deletions(-)
arch/mips/cavium-octeon/setup.c +1 -1
@@ -1240,7 +1240,7 @@ static int __init octeon_no_pci_init(void)*/ octeon_dummy_iospace =vzalloc (IO_SPACE_LIMIT );set_io_port_base ((unsigned long )octeon_dummy_iospace); - ioport_resource.start =MAX_RESOURCE ; + ioport_resource.start =RESOURCE_SIZE_MAX ; ioport_resource.end =0 ;return 0 ; }
arch/x86/pci/amd_bus.c +8 -0
@@ -51,6 +51,14 @@ static struct pci_root_info __init *find_pci_root_info(int node, int link)return NULL ; } +static inline resource_size_t cap_resource (u64 val) +{ +if (val >RESOURCE_SIZE_MAX ) +return RESOURCE_SIZE_MAX ; + +return val; +} +/** * early_root_info_init() * called before pcibios_scan_root and pci_scan_bus
arch/x86/pci/bus_numa.c +1 -1
@@ -101,7 +101,7 @@ void update_res(struct pci_root_info *info, resource_size_t start,if (start > end)return ; -if (start ==MAX_RESOURCE ) +if (start ==RESOURCE_SIZE_MAX )return ;if (!merge)
include/linux/limits.h +2 -0
@@ -10,6 +10,8 @@#define SSIZE_MAX ((ssize_t)(SIZE_MAX >> 1))#define PHYS_ADDR_MAX (~(phys_addr_t)0) +#define RESOURCE_SIZE_MAX ((resource_size_t)~0) +#define U8_MAX ((u8)~0U)#define S8_MAX ((s8)(U8_MAX >> 1))#define S8_MIN ((s8)(-S8_MAX - 1))
include/linux/range.h +0 -8
@@ -31,12 +31,4 @@ int clean_sort_range(struct range *range, int az);void sort_range (struct range *range,int nr_range); -#define MAX_RESOURCE ((resource_size_t)~0) -static inline resource_size_t cap_resource (u64 val) -{ -if (val >MAX_RESOURCE ) -return MAX_RESOURCE ; - -return val; -}#endif
Signature · 1 line
2.40.0.1.gaa8946217a0b