diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2016-03-02 17:16:03 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2016-03-12 07:00:29 -0500 |
commit | ab97b8cc560eabfd8139dd97924a09e46a3c9632 (patch) | |
tree | bc5e1c1bfe9e902c91c20a37e35b4f1fbe881890 /arch/ia64/sn | |
parent | f50dd8c3dae5703704441ab2255dff99c021a340 (diff) |
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>
Diffstat (limited to 'arch/ia64/sn')
-rw-r--r-- | arch/ia64/sn/kernel/io_acpi_init.c | 10 | ||||
-rw-r--r-- | arch/ia64/sn/kernel/io_init.c | 39 |
2 files changed, 22 insertions, 27 deletions
diff --git a/arch/ia64/sn/kernel/io_acpi_init.c b/arch/ia64/sn/kernel/io_acpi_init.c index 0640739cc20c..815c29163e1d 100644 --- a/arch/ia64/sn/kernel/io_acpi_init.c +++ b/arch/ia64/sn/kernel/io_acpi_init.c | |||
@@ -429,6 +429,7 @@ sn_acpi_slot_fixup(struct pci_dev *dev) | |||
429 | void __iomem *addr; | 429 | void __iomem *addr; |
430 | struct pcidev_info *pcidev_info = NULL; | 430 | struct pcidev_info *pcidev_info = NULL; |
431 | struct sn_irq_info *sn_irq_info = NULL; | 431 | struct sn_irq_info *sn_irq_info = NULL; |
432 | struct resource *res; | ||
432 | size_t image_size, size; | 433 | size_t image_size, size; |
433 | 434 | ||
434 | if (sn_acpi_get_pcidev_info(dev, &pcidev_info, &sn_irq_info)) { | 435 | if (sn_acpi_get_pcidev_info(dev, &pcidev_info, &sn_irq_info)) { |
@@ -446,14 +447,13 @@ sn_acpi_slot_fixup(struct pci_dev *dev) | |||
446 | addr = ioremap(pcidev_info->pdi_pio_mapped_addr[PCI_ROM_RESOURCE], | 447 | addr = ioremap(pcidev_info->pdi_pio_mapped_addr[PCI_ROM_RESOURCE], |
447 | size); | 448 | size); |
448 | image_size = pci_get_rom_size(dev, addr, size); | 449 | image_size = pci_get_rom_size(dev, addr, size); |
449 | dev->resource[PCI_ROM_RESOURCE].start = (unsigned long) addr; | 450 | res = &dev->resource[PCI_ROM_RESOURCE]; |
450 | dev->resource[PCI_ROM_RESOURCE].end = | 451 | res->start = (unsigned long) addr; |
451 | (unsigned long) addr + image_size - 1; | 452 | res->end = (unsigned long) addr + image_size - 1; |
452 | dev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_BIOS_COPY; | 453 | res->flags |= IORESOURCE_ROM_BIOS_COPY; |
453 | } | 454 | } |
454 | sn_pci_fixup_slot(dev, pcidev_info, sn_irq_info); | 455 | sn_pci_fixup_slot(dev, pcidev_info, sn_irq_info); |
455 | } | 456 | } |
456 | |||
457 | EXPORT_SYMBOL(sn_acpi_slot_fixup); | 457 | EXPORT_SYMBOL(sn_acpi_slot_fixup); |
458 | 458 | ||
459 | 459 | ||
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c index 1be65eb074ec..40c02635f19f 100644 --- a/arch/ia64/sn/kernel/io_init.c +++ b/arch/ia64/sn/kernel/io_init.c | |||
@@ -150,7 +150,8 @@ void | |||
150 | sn_io_slot_fixup(struct pci_dev *dev) | 150 | sn_io_slot_fixup(struct pci_dev *dev) |
151 | { | 151 | { |
152 | int idx; | 152 | int idx; |
153 | unsigned long addr, end, size, start; | 153 | struct resource *res; |
154 | unsigned long addr, size; | ||
154 | struct pcidev_info *pcidev_info; | 155 | struct pcidev_info *pcidev_info; |
155 | struct sn_irq_info *sn_irq_info; | 156 | struct sn_irq_info *sn_irq_info; |
156 | int status; | 157 | int status; |
@@ -175,33 +176,31 @@ sn_io_slot_fixup(struct pci_dev *dev) | |||
175 | 176 | ||
176 | /* Copy over PIO Mapped Addresses */ | 177 | /* Copy over PIO Mapped Addresses */ |
177 | for (idx = 0; idx <= PCI_ROM_RESOURCE; idx++) { | 178 | for (idx = 0; idx <= PCI_ROM_RESOURCE; idx++) { |
178 | 179 | if (!pcidev_info->pdi_pio_mapped_addr[idx]) | |
179 | if (!pcidev_info->pdi_pio_mapped_addr[idx]) { | ||
180 | continue; | 180 | continue; |
181 | } | ||
182 | 181 | ||
183 | start = dev->resource[idx].start; | 182 | res = &dev->resource[idx]; |
184 | end = dev->resource[idx].end; | 183 | |
185 | size = end - start; | 184 | size = res->end - res->start; |
186 | if (size == 0) { | 185 | if (size == 0) |
187 | continue; | 186 | continue; |
188 | } | 187 | |
189 | addr = pcidev_info->pdi_pio_mapped_addr[idx]; | 188 | addr = pcidev_info->pdi_pio_mapped_addr[idx]; |
190 | addr = ((addr << 4) >> 4) | __IA64_UNCACHED_OFFSET; | 189 | addr = ((addr << 4) >> 4) | __IA64_UNCACHED_OFFSET; |
191 | dev->resource[idx].start = addr; | 190 | res->start = addr; |
192 | dev->resource[idx].end = addr + size; | 191 | res->end = addr + size; |
193 | 192 | ||
194 | /* | 193 | /* |
195 | * if it's already in the device structure, remove it before | 194 | * if it's already in the device structure, remove it before |
196 | * inserting | 195 | * inserting |
197 | */ | 196 | */ |
198 | if (dev->resource[idx].parent && dev->resource[idx].parent->child) | 197 | if (res->parent && res->parent->child) |
199 | release_resource(&dev->resource[idx]); | 198 | release_resource(res); |
200 | 199 | ||
201 | if (dev->resource[idx].flags & IORESOURCE_IO) | 200 | if (res->flags & IORESOURCE_IO) |
202 | insert_resource(&ioport_resource, &dev->resource[idx]); | 201 | insert_resource(&ioport_resource, res); |
203 | else | 202 | else |
204 | insert_resource(&iomem_resource, &dev->resource[idx]); | 203 | insert_resource(&iomem_resource, res); |
205 | /* | 204 | /* |
206 | * If ROM, set the actual ROM image size, and mark as | 205 | * If ROM, set the actual ROM image size, and mark as |
207 | * shadowed in PROM. | 206 | * shadowed in PROM. |
@@ -213,17 +212,13 @@ sn_io_slot_fixup(struct pci_dev *dev) | |||
213 | rom = ioremap(pci_resource_start(dev, PCI_ROM_RESOURCE), | 212 | rom = ioremap(pci_resource_start(dev, PCI_ROM_RESOURCE), |
214 | size + 1); | 213 | size + 1); |
215 | image_size = pci_get_rom_size(dev, rom, size + 1); | 214 | image_size = pci_get_rom_size(dev, rom, size + 1); |
216 | dev->resource[PCI_ROM_RESOURCE].end = | 215 | res->end = res->start + image_size - 1; |
217 | dev->resource[PCI_ROM_RESOURCE].start + | 216 | res->flags |= IORESOURCE_ROM_BIOS_COPY; |
218 | image_size - 1; | ||
219 | dev->resource[PCI_ROM_RESOURCE].flags |= | ||
220 | IORESOURCE_ROM_BIOS_COPY; | ||
221 | } | 217 | } |
222 | } | 218 | } |
223 | 219 | ||
224 | sn_pci_fixup_slot(dev, pcidev_info, sn_irq_info); | 220 | sn_pci_fixup_slot(dev, pcidev_info, sn_irq_info); |
225 | } | 221 | } |
226 | |||
227 | EXPORT_SYMBOL(sn_io_slot_fixup); | 222 | EXPORT_SYMBOL(sn_io_slot_fixup); |
228 | 223 | ||
229 | /* | 224 | /* |