range.h: Move resource API and constant to respective files
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 4 Aug 2023 06:46:36 +0000 (09:46 +0300)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 18 Aug 2023 17:19:00 +0000 (10:19 -0700)
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>
arch/mips/cavium-octeon/setup.c
arch/x86/pci/amd_bus.c
arch/x86/pci/bus_numa.c
include/linux/limits.h
include/linux/range.h

index c556101..1ad2602 100644 (file)
@@ -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;
 }
index dd40d3f..631512f 100644 (file)
@@ -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
index 2752c02..e4a525e 100644 (file)
@@ -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)
index f6bcc93..38eb7f6 100644 (file)
@@ -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))
index 7efb6a9..6ad0b73 100644 (file)
@@ -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