Add a #define for the PCI resource type mask. We use this mask multiple times in the bus setup.
Unified · Split
| @@ -1518,13 +1518,16 @@ static void __pci_bridge_assign_resources(const struct pci_dev *bridge, · 1517 unmodified lines | |||
| 1518 | break; | 1518 | break; |
| 1519 | } | 1519 | } |
| 1520 | } | 1520 | } |
| 1521 | |||
| 1522 | #define PCI_RES_TYPE_MASK \ | ||
| 1523 | (IORESOURCE_IO | IORESOURCE_MEM | IORESOURCE_PREFETCH |\ | ||
| 1524 | IORESOURCE_MEM_64) | ||
| 1525 | |||
| 1521 | static void pci_bridge_release_resources(struct pci_bus *bus, | 1526 | static void pci_bridge_release_resources(struct pci_bus *bus, |
| 1522 | unsigned long type) | 1527 | unsigned long type) |
| 1523 | { | 1528 | { |
| 1524 | struct pci_dev *dev = bus->self; | 1529 | struct pci_dev *dev = bus->self; |
| 1525 | struct resource *r; | 1530 | struct resource *r; |
| 1526 | unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM | | ||
| 1527 | IORESOURCE_PREFETCH | IORESOURCE_MEM_64; | ||
| 1528 | unsigned old_flags = 0; | 1531 | unsigned old_flags = 0; |
| 1529 | struct resource *b_res; | 1532 | struct resource *b_res; |
| 1530 | int idx = 1; | 1533 | int idx = 1; |
| @@ -1567,7 +1570,7 @@ static void pci_bridge_release_resources(struct pci_bus *bus, · 36 unmodified lines | |||
| 1567 | */ | 1570 | */ |
| 1568 | release_child_resources(r); | 1571 | release_child_resources(r); |
| 1569 | if (!release_resource(r)) { | 1572 | if (!release_resource(r)) { |
| 1570 | type = old_flags = r->flags & type_mask; | 1573 | type = old_flags = r->flags & PCI_RES_TYPE_MASK; |
| 1571 | dev_printk(KERN_DEBUG, &dev->dev, "resource %d %pR released\n", | 1574 | dev_printk(KERN_DEBUG, &dev->dev, "resource %d %pR released\n", |
| 1572 | PCI_BRIDGE_RESOURCES + idx, r); | 1575 | PCI_BRIDGE_RESOURCES + idx, r); |
| 1573 | /* keep the old size */ | 1576 | /* keep the old size */ |
| @@ -1758,8 +1761,6 @@ void pci_assign_unassigned_root_bus_resources(struct pci_bus *bus) · 184 unmodified lines | |||
| 1758 | enum release_type rel_type = leaf_only; | 1761 | enum release_type rel_type = leaf_only; |
| 1759 | LIST_HEAD(fail_head); | 1762 | LIST_HEAD(fail_head); |
| 1760 | struct pci_dev_resource *fail_res; | 1763 | struct pci_dev_resource *fail_res; |
| 1761 | unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM | | ||
| 1762 | IORESOURCE_PREFETCH | IORESOURCE_MEM_64; | ||
| 1763 | int pci_try_num = 1; | 1764 | int pci_try_num = 1; |
| 1764 | enum enable_type enable_local; | 1765 | enum enable_type enable_local; |
| 1765 | 1766 | ||
| @@ -1818,7 +1819,7 @@ again: · 52 unmodified lines | |||
| 1818 | */ | 1819 | */ |
| 1819 | list_for_each_entry(fail_res, &fail_head, list) | 1820 | list_for_each_entry(fail_res, &fail_head, list) |
| 1820 | pci_bus_release_bridge_resources(fail_res->dev->bus, | 1821 | pci_bus_release_bridge_resources(fail_res->dev->bus, |
| 1821 | fail_res->flags & type_mask, | 1822 | fail_res->flags & PCI_RES_TYPE_MASK, |
| 1822 | rel_type); | 1823 | rel_type); |
| 1823 | 1824 | ||
| 1824 | /* restore size and flags */ | 1825 | /* restore size and flags */ |
| @@ -1862,8 +1863,6 @@ void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge) · 37 unmodified lines | |||
| 1862 | LIST_HEAD(fail_head); | 1863 | LIST_HEAD(fail_head); |
| 1863 | struct pci_dev_resource *fail_res; | 1864 | struct pci_dev_resource *fail_res; |
| 1864 | int retval; | 1865 | int retval; |
| 1865 | unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM | | ||
| 1866 | IORESOURCE_PREFETCH | IORESOURCE_MEM_64; | ||
| 1867 | 1866 | ||
| 1868 | again: | 1867 | again: |
| 1869 | __pci_bus_size_bridges(parent, &add_list); | 1868 | __pci_bus_size_bridges(parent, &add_list); |
| @@ -1889,7 +1888,7 @@ again: · 19 unmodified lines | |||
| 1889 | */ | 1888 | */ |
| 1890 | list_for_each_entry(fail_res, &fail_head, list) | 1889 | list_for_each_entry(fail_res, &fail_head, list) |
| 1891 | pci_bus_release_bridge_resources(fail_res->dev->bus, | 1890 | pci_bus_release_bridge_resources(fail_res->dev->bus, |
| 1892 | fail_res->flags & type_mask, | 1891 | fail_res->flags & PCI_RES_TYPE_MASK, |
| 1893 | whole_subtree); | 1892 | whole_subtree); |
| 1894 | 1893 | ||
| 1895 | /* restore size and flags */ | 1894 | /* restore size and flags */ |