Commit 22f20375 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull pci fix from Bjorn Helgaas:

 - Fix mvebu PCI enumeration regression caused by converting to
   for_each_of_range() iterator (Klaus Kudielka)

* tag 'pci-v6.17-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci:
  PCI: mvebu: Fix use of for_each_of_range() iterator
parents 965c995c b8162653
Loading
Loading
Loading
Loading
+4 −17
Original line number Diff line number Diff line
@@ -1168,12 +1168,6 @@ static void __iomem *mvebu_pcie_map_registers(struct platform_device *pdev,
	return devm_ioremap_resource(&pdev->dev, &port->regs);
}

#define DT_FLAGS_TO_TYPE(flags)       (((flags) >> 24) & 0x03)
#define    DT_TYPE_IO                 0x1
#define    DT_TYPE_MEM32              0x2
#define DT_CPUADDR_TO_TARGET(cpuaddr) (((cpuaddr) >> 56) & 0xFF)
#define DT_CPUADDR_TO_ATTR(cpuaddr)   (((cpuaddr) >> 48) & 0xFF)

static int mvebu_get_tgt_attr(struct device_node *np, int devfn,
			      unsigned long type,
			      unsigned int *tgt,
@@ -1189,19 +1183,12 @@ static int mvebu_get_tgt_attr(struct device_node *np, int devfn,
		return -EINVAL;

	for_each_of_range(&parser, &range) {
		unsigned long rtype;
		u32 slot = upper_32_bits(range.bus_addr);

		if (DT_FLAGS_TO_TYPE(range.flags) == DT_TYPE_IO)
			rtype = IORESOURCE_IO;
		else if (DT_FLAGS_TO_TYPE(range.flags) == DT_TYPE_MEM32)
			rtype = IORESOURCE_MEM;
		else
			continue;

		if (slot == PCI_SLOT(devfn) && type == rtype) {
			*tgt = DT_CPUADDR_TO_TARGET(range.cpu_addr);
			*attr = DT_CPUADDR_TO_ATTR(range.cpu_addr);
		if (slot == PCI_SLOT(devfn) &&
		    type == (range.flags & IORESOURCE_TYPE_BITS)) {
			*tgt = (range.parent_bus_addr >> 56) & 0xFF;
			*attr = (range.parent_bus_addr >> 48) & 0xFF;
			return 0;
		}
	}