ia64/PCI: Use temporary struct resource * to avoid repetition

Use a temporary struct resource pointer to avoid needless repetition of
"dev->resource[idx]".  No functional change intended.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
This commit is contained in:
Bjorn Helgaas 2016-03-02 16:16:03 -06:00
Родитель f50dd8c3da
Коммит ab97b8cc56
2 изменённых файлов: 22 добавлений и 27 удалений

Просмотреть файл

@ -429,6 +429,7 @@ sn_acpi_slot_fixup(struct pci_dev *dev)
void __iomem *addr; void __iomem *addr;
struct pcidev_info *pcidev_info = NULL; struct pcidev_info *pcidev_info = NULL;
struct sn_irq_info *sn_irq_info = NULL; struct sn_irq_info *sn_irq_info = NULL;
struct resource *res;
size_t image_size, size; size_t image_size, size;
if (sn_acpi_get_pcidev_info(dev, &pcidev_info, &sn_irq_info)) { if (sn_acpi_get_pcidev_info(dev, &pcidev_info, &sn_irq_info)) {
@ -446,14 +447,13 @@ sn_acpi_slot_fixup(struct pci_dev *dev)
addr = ioremap(pcidev_info->pdi_pio_mapped_addr[PCI_ROM_RESOURCE], addr = ioremap(pcidev_info->pdi_pio_mapped_addr[PCI_ROM_RESOURCE],
size); size);
image_size = pci_get_rom_size(dev, addr, size); image_size = pci_get_rom_size(dev, addr, size);
dev->resource[PCI_ROM_RESOURCE].start = (unsigned long) addr; res = &dev->resource[PCI_ROM_RESOURCE];
dev->resource[PCI_ROM_RESOURCE].end = res->start = (unsigned long) addr;
(unsigned long) addr + image_size - 1; res->end = (unsigned long) addr + image_size - 1;
dev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_BIOS_COPY; res->flags |= IORESOURCE_ROM_BIOS_COPY;
} }
sn_pci_fixup_slot(dev, pcidev_info, sn_irq_info); sn_pci_fixup_slot(dev, pcidev_info, sn_irq_info);
} }
EXPORT_SYMBOL(sn_acpi_slot_fixup); EXPORT_SYMBOL(sn_acpi_slot_fixup);

Просмотреть файл

@ -150,7 +150,8 @@ void
sn_io_slot_fixup(struct pci_dev *dev) sn_io_slot_fixup(struct pci_dev *dev)
{ {
int idx; int idx;
unsigned long addr, end, size, start; struct resource *res;
unsigned long addr, size;
struct pcidev_info *pcidev_info; struct pcidev_info *pcidev_info;
struct sn_irq_info *sn_irq_info; struct sn_irq_info *sn_irq_info;
int status; int status;
@ -175,33 +176,31 @@ sn_io_slot_fixup(struct pci_dev *dev)
/* Copy over PIO Mapped Addresses */ /* Copy over PIO Mapped Addresses */
for (idx = 0; idx <= PCI_ROM_RESOURCE; idx++) { for (idx = 0; idx <= PCI_ROM_RESOURCE; idx++) {
if (!pcidev_info->pdi_pio_mapped_addr[idx])
if (!pcidev_info->pdi_pio_mapped_addr[idx]) {
continue; continue;
}
start = dev->resource[idx].start; res = &dev->resource[idx];
end = dev->resource[idx].end;
size = end - start; size = res->end - res->start;
if (size == 0) { if (size == 0)
continue; continue;
}
addr = pcidev_info->pdi_pio_mapped_addr[idx]; addr = pcidev_info->pdi_pio_mapped_addr[idx];
addr = ((addr << 4) >> 4) | __IA64_UNCACHED_OFFSET; addr = ((addr << 4) >> 4) | __IA64_UNCACHED_OFFSET;
dev->resource[idx].start = addr; res->start = addr;
dev->resource[idx].end = addr + size; res->end = addr + size;
/* /*
* if it's already in the device structure, remove it before * if it's already in the device structure, remove it before
* inserting * inserting
*/ */
if (dev->resource[idx].parent && dev->resource[idx].parent->child) if (res->parent && res->parent->child)
release_resource(&dev->resource[idx]); release_resource(res);
if (dev->resource[idx].flags & IORESOURCE_IO) if (res->flags & IORESOURCE_IO)
insert_resource(&ioport_resource, &dev->resource[idx]); insert_resource(&ioport_resource, res);
else else
insert_resource(&iomem_resource, &dev->resource[idx]); insert_resource(&iomem_resource, res);
/* /*
* If ROM, set the actual ROM image size, and mark as * If ROM, set the actual ROM image size, and mark as
* shadowed in PROM. * shadowed in PROM.
@ -213,17 +212,13 @@ sn_io_slot_fixup(struct pci_dev *dev)
rom = ioremap(pci_resource_start(dev, PCI_ROM_RESOURCE), rom = ioremap(pci_resource_start(dev, PCI_ROM_RESOURCE),
size + 1); size + 1);
image_size = pci_get_rom_size(dev, rom, size + 1); image_size = pci_get_rom_size(dev, rom, size + 1);
dev->resource[PCI_ROM_RESOURCE].end = res->end = res->start + image_size - 1;
dev->resource[PCI_ROM_RESOURCE].start + res->flags |= IORESOURCE_ROM_BIOS_COPY;
image_size - 1;
dev->resource[PCI_ROM_RESOURCE].flags |=
IORESOURCE_ROM_BIOS_COPY;
} }
} }
sn_pci_fixup_slot(dev, pcidev_info, sn_irq_info); sn_pci_fixup_slot(dev, pcidev_info, sn_irq_info);
} }
EXPORT_SYMBOL(sn_io_slot_fixup); EXPORT_SYMBOL(sn_io_slot_fixup);
/* /*