Skip to content

Commit cb21bc9

Browse files
ChristianKoenigAMDbjorn-helgaas
authored andcommitted
PCI: Add PCI resource type mask #define
Add a #define for the PCI resource type mask. We use this mask multiple times in the bus setup. Signed-off-by: Christian König <christian.koenig@amd.com> [bhelgaas: move to setup-bus.c] Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
1 parent 9e66317 commit cb21bc9

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

drivers/pci/setup-bus.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,13 +1518,16 @@ static void __pci_bridge_assign_resources(const struct pci_dev *bridge,
15181518
break;
15191519
}
15201520
}
1521+
1522+
#define PCI_RES_TYPE_MASK \
1523+
(IORESOURCE_IO | IORESOURCE_MEM | IORESOURCE_PREFETCH |\
1524+
IORESOURCE_MEM_64)
1525+
15211526
static void pci_bridge_release_resources(struct pci_bus *bus,
15221527
unsigned long type)
15231528
{
15241529
struct pci_dev *dev = bus->self;
15251530
struct resource *r;
1526-
unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM |
1527-
IORESOURCE_PREFETCH | IORESOURCE_MEM_64;
15281531
unsigned old_flags = 0;
15291532
struct resource *b_res;
15301533
int idx = 1;
@@ -1567,7 +1570,7 @@ static void pci_bridge_release_resources(struct pci_bus *bus,
15671570
*/
15681571
release_child_resources(r);
15691572
if (!release_resource(r)) {
1570-
type = old_flags = r->flags & type_mask;
1573+
type = old_flags = r->flags & PCI_RES_TYPE_MASK;
15711574
dev_printk(KERN_DEBUG, &dev->dev, "resource %d %pR released\n",
15721575
PCI_BRIDGE_RESOURCES + idx, r);
15731576
/* keep the old size */
@@ -1758,8 +1761,6 @@ void pci_assign_unassigned_root_bus_resources(struct pci_bus *bus)
17581761
enum release_type rel_type = leaf_only;
17591762
LIST_HEAD(fail_head);
17601763
struct pci_dev_resource *fail_res;
1761-
unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM |
1762-
IORESOURCE_PREFETCH | IORESOURCE_MEM_64;
17631764
int pci_try_num = 1;
17641765
enum enable_type enable_local;
17651766

@@ -1818,7 +1819,7 @@ void pci_assign_unassigned_root_bus_resources(struct pci_bus *bus)
18181819
*/
18191820
list_for_each_entry(fail_res, &fail_head, list)
18201821
pci_bus_release_bridge_resources(fail_res->dev->bus,
1821-
fail_res->flags & type_mask,
1822+
fail_res->flags & PCI_RES_TYPE_MASK,
18221823
rel_type);
18231824

18241825
/* restore size and flags */
@@ -1862,8 +1863,6 @@ void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge)
18621863
LIST_HEAD(fail_head);
18631864
struct pci_dev_resource *fail_res;
18641865
int retval;
1865-
unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM |
1866-
IORESOURCE_PREFETCH | IORESOURCE_MEM_64;
18671866

18681867
again:
18691868
__pci_bus_size_bridges(parent, &add_list);
@@ -1889,7 +1888,7 @@ void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge)
18891888
*/
18901889
list_for_each_entry(fail_res, &fail_head, list)
18911890
pci_bus_release_bridge_resources(fail_res->dev->bus,
1892-
fail_res->flags & type_mask,
1891+
fail_res->flags & PCI_RES_TYPE_MASK,
18931892
whole_subtree);
18941893

18951894
/* restore size and flags */

0 commit comments

Comments
 (0)