Commit 1c03b5bf authored by Bjorn Helgaas's avatar Bjorn Helgaas
Browse files

Merge branch 'pci/resource'

- Add pci_dev_for_each_resource() and pci_bus_for_each_resource() iterators
  to simplify loops (Andy Shevchenko)

* pci/resource:
  EISA: Drop unused pci_bus_for_each_resource() index argument
  PCI: Make pci_bus_for_each_resource() index optional
  PCI: Document pci_bus_for_each_resource()
  PCI: Introduce pci_dev_for_each_resource()
  PCI: Introduce pci_resource_n()
parents 43ca31e0 e34a6ba5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -520,6 +520,7 @@ ForEachMacros:
  - 'of_property_for_each_string'
  - 'of_property_for_each_u32'
  - 'pci_bus_for_each_resource'
  - 'pci_dev_for_each_resource'
  - 'pci_doe_for_each_off'
  - 'pcl_for_each_chunk'
  - 'pcl_for_each_segment'
+2 −3
Original line number Diff line number Diff line
@@ -288,11 +288,10 @@ pcibios_claim_one_bus(struct pci_bus *b)
	struct pci_bus *child_bus;

	list_for_each_entry(dev, &b->devices, bus_list) {
		struct resource *r;
		int i;

		for (i = 0; i < PCI_NUM_RESOURCES; i++) {
			struct resource *r = &dev->resource[i];

		pci_dev_for_each_resource(dev, r, i) {
			if (r->parent || !r->start || !r->flags)
				continue;
			if (pci_has_flag(PCI_PROBE_ONLY) ||
+7 −9
Original line number Diff line number Diff line
@@ -142,15 +142,15 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_89C940F,
 */
static void pci_fixup_dec21285(struct pci_dev *dev)
{
	int i;

	if (dev->devfn == 0) {
		struct resource *r;

		dev->class &= 0xff;
		dev->class |= PCI_CLASS_BRIDGE_HOST << 8;
		for (i = 0; i < PCI_NUM_RESOURCES; i++) {
			dev->resource[i].start = 0;
			dev->resource[i].end   = 0;
			dev->resource[i].flags = 0;
		pci_dev_for_each_resource(dev, r) {
			r->start = 0;
			r->end = 0;
			r->flags = 0;
		}
	}
}
@@ -162,13 +162,11 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21285, pci_fixup_d
static void pci_fixup_ide_bases(struct pci_dev *dev)
{
	struct resource *r;
	int i;

	if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE)
		return;

	for (i = 0; i < PCI_NUM_RESOURCES; i++) {
		r = dev->resource + i;
	pci_dev_for_each_resource(dev, r) {
		if ((r->start & ~0x80) == 0x374) {
			r->start |= 2;
			r->end = r->start;
+5 −5
Original line number Diff line number Diff line
@@ -142,14 +142,14 @@ static struct pci_ops pcie_ops = {
static void rc_pci_fixup(struct pci_dev *dev)
{
	if (dev->bus->parent == NULL && dev->devfn == 0) {
		int i;
		struct resource *r;

		dev->class &= 0xff;
		dev->class |= PCI_CLASS_BRIDGE_HOST << 8;
		for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
			dev->resource[i].start = 0;
			dev->resource[i].end   = 0;
			dev->resource[i].flags = 0;
		pci_dev_for_each_resource(dev, r) {
			r->start = 0;
			r->end   = 0;
			r->flags = 0;
		}
	}
}
+5 −5
Original line number Diff line number Diff line
@@ -186,14 +186,14 @@ static struct pci_ops pcie_ops = {
static void rc_pci_fixup(struct pci_dev *dev)
{
	if (dev->bus->parent == NULL && dev->devfn == 0) {
		int i;
		struct resource *r;

		dev->class &= 0xff;
		dev->class |= PCI_CLASS_BRIDGE_HOST << 8;
		for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
			dev->resource[i].start = 0;
			dev->resource[i].end   = 0;
			dev->resource[i].flags = 0;
		pci_dev_for_each_resource(dev, r) {
			r->start = 0;
			r->end   = 0;
			r->flags = 0;
		}
	}
}
Loading