|
19 | 19 | #include <linux/hypervisor.h> |
20 | 20 | #include <linux/irqdomain.h> |
21 | 21 | #include <linux/pm_runtime.h> |
22 | | -#include <linux/list_sort.h> |
23 | 22 | #include "pci.h" |
24 | 23 |
|
25 | 24 | #define CARDBUS_LATENCY_TIMER 176 /* secondary latency timer */ |
@@ -875,31 +874,14 @@ static void pci_set_bus_msi_domain(struct pci_bus *bus) |
875 | 874 | dev_set_msi_domain(&bus->dev, d); |
876 | 875 | } |
877 | 876 |
|
878 | | -static int res_cmp(void *priv, const struct list_head *a, |
879 | | - const struct list_head *b) |
880 | | -{ |
881 | | - struct resource_entry *entry1, *entry2; |
882 | | - |
883 | | - entry1 = container_of(a, struct resource_entry, node); |
884 | | - entry2 = container_of(b, struct resource_entry, node); |
885 | | - |
886 | | - if (entry1->res->flags != entry2->res->flags) |
887 | | - return entry1->res->flags > entry2->res->flags; |
888 | | - |
889 | | - if (entry1->offset != entry2->offset) |
890 | | - return entry1->offset > entry2->offset; |
891 | | - |
892 | | - return entry1->res->start > entry2->res->start; |
893 | | -} |
894 | | - |
895 | 877 | static int pci_register_host_bridge(struct pci_host_bridge *bridge) |
896 | 878 | { |
897 | 879 | struct device *parent = bridge->dev.parent; |
898 | | - struct resource_entry *window, *next, *n; |
| 880 | + struct resource_entry *window, *n; |
899 | 881 | struct pci_bus *bus, *b; |
900 | | - resource_size_t offset, next_offset; |
| 882 | + resource_size_t offset; |
901 | 883 | LIST_HEAD(resources); |
902 | | - struct resource *res, *next_res; |
| 884 | + struct resource *res; |
903 | 885 | char addr[64], *fmt; |
904 | 886 | const char *name; |
905 | 887 | int err; |
@@ -979,35 +961,11 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge) |
979 | 961 | if (nr_node_ids > 1 && pcibus_to_node(bus) == NUMA_NO_NODE) |
980 | 962 | dev_warn(&bus->dev, "Unknown NUMA node; performance will be reduced\n"); |
981 | 963 |
|
982 | | - /* Sort and coalesce contiguous windows */ |
983 | | - list_sort(NULL, &resources, res_cmp); |
984 | | - resource_list_for_each_entry_safe(window, n, &resources) { |
985 | | - if (list_is_last(&window->node, &resources)) |
986 | | - break; |
987 | | - |
988 | | - next = list_next_entry(window, node); |
989 | | - offset = window->offset; |
990 | | - res = window->res; |
991 | | - next_offset = next->offset; |
992 | | - next_res = next->res; |
993 | | - |
994 | | - if (res->flags != next_res->flags || offset != next_offset) |
995 | | - continue; |
996 | | - |
997 | | - if (res->end + 1 == next_res->start) { |
998 | | - next_res->start = res->start; |
999 | | - res->flags = res->start = res->end = 0; |
1000 | | - } |
1001 | | - } |
1002 | | - |
1003 | 964 | /* Add initial resources to the bus */ |
1004 | 965 | resource_list_for_each_entry_safe(window, n, &resources) { |
| 966 | + list_move_tail(&window->node, &bridge->windows); |
1005 | 967 | offset = window->offset; |
1006 | 968 | res = window->res; |
1007 | | - if (!res->end) |
1008 | | - continue; |
1009 | | - |
1010 | | - list_move_tail(&window->node, &bridge->windows); |
1011 | 969 |
|
1012 | 970 | if (res->flags & IORESOURCE_BUS) |
1013 | 971 | pci_bus_insert_busn_res(bus, bus->number, res->end); |
|
0 commit comments