Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'pci-v3.16-changes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci

Pull more PCI updates from Bjorn Helgaas:
"Here are some more things I'd like to see in v3.16-rc1:

- DMA alias iterator, part of some work to fix IOMMU issues
- MVEBU, Tegra, DesignWare changes that I forgot to include before
- Some whitespace code cleanup

Details:

IOMMU
- Add DMA alias iterator (Alex Williamson)
- Add DMA alias quirks for ASMedia, ITE, Tundra bridges (Alex Williamson)
- Add DMA alias quirks for Marvell, Ricoh devices (Alex Williamson)
- Add DMA alias quirk for HighPoint devices (Jérôme Carretero)

MSI
- Fix leak in free_msi_irqs() (Alexei Starovoitov)

Marvell MVEBU
- Remove unnecessary use of 'conf_lock' spinlock (Andrew Murray)
- Avoid setting an undefined window size (Jason Gunthorpe)
- Allow several windows with the same target/attribute (Thomas Petazzoni)
- Split PCIe BARs into multiple MBus windows when needed (Thomas Petazzoni)
- Fix off-by-one in the computed size of the mbus windows (Willy Tarreau)

NVIDIA Tegra
- Use new OF interrupt mapping when possible (Lucas Stach)

Synopsys DesignWare
- Remove unnecessary use of 'conf_lock' spinlock (Andrew Murray)
- Use new OF interrupt mapping when possible (Lucas Stach)
- Split Exynos and i.MX bindings (Lucas Stach)
- Fix comment for setting number of lanes (Mohit Kumar)
- Fix iATU programming for cfg1, io and mem viewport (Mohit Kumar)

Miscellaneous
- EXPORT_SYMBOL cleanup (Ryan Desfosses)
- Whitespace cleanup (Ryan Desfosses)
- Merge multi-line quoted strings (Ryan Desfosses)"

* tag 'pci-v3.16-changes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (21 commits)
PCI: Add function 1 DMA alias quirk for HighPoint RocketRaid 642L
PCI/MSI: Fix memory leak in free_msi_irqs()
PCI: Merge multi-line quoted strings
PCI: Whitespace cleanup
PCI: Move EXPORT_SYMBOL so it immediately follows function/variable
PCI: Add bridge DMA alias quirk for ITE bridge
PCI: designware: Split Exynos and i.MX bindings
PCI: Add bridge DMA alias quirk for ASMedia and Tundra bridges
PCI: Add support for PCIe-to-PCI bridge DMA alias quirks
PCI: Add function 1 DMA alias quirk for Marvell devices
PCI: Add function 0 DMA alias quirk for Ricoh devices
PCI: Add support for DMA alias quirks
PCI: Convert pci_dev_flags definitions to bit shifts
PCI: Add DMA alias iterator
PCI: mvebu: Use '%pa' for printing 'phys_addr_t' type
PCI: mvebu: Remove unnecessary use of 'conf_lock' spinlock
PCI: designware: Remove unnecessary use of 'conf_lock' spinlock
PCI: designware: Use new OF interrupt mapping when possible
PCI: designware: Fix iATU programming for cfg1, io and mem viewport
PCI: designware: Fix comment for setting number of lanes
...

+1061 -1035
+6 -68
Documentation/devicetree/bindings/pci/designware-pcie.txt
··· 1 1 * Synopsys Designware PCIe interface 2 2 3 3 Required properties: 4 - - compatible: should contain "snps,dw-pcie" to identify the 5 - core, plus an identifier for the specific instance, such 6 - as "samsung,exynos5440-pcie" or "fsl,imx6q-pcie". 7 - - reg: base addresses and lengths of the pcie controller, 8 - the phy controller, additional register for the phy controller. 9 - - interrupts: interrupt values for level interrupt, 10 - pulse interrupt, special interrupt. 11 - - clocks: from common clock binding: handle to pci clock. 12 - - clock-names: from common clock binding: should be "pcie" and "pcie_bus". 4 + - compatible: should contain "snps,dw-pcie" to identify the core. 13 5 - #address-cells: set to <3> 14 6 - #size-cells: set to <2> 15 7 - device_type: set to "pci" ··· 11 19 to define the mapping of the PCIe interface to interrupt 12 20 numbers. 13 21 - num-lanes: number of lanes to use 22 + - clocks: Must contain an entry for each entry in clock-names. 23 + See ../clocks/clock-bindings.txt for details. 24 + - clock-names: Must include the following entries: 25 + - "pcie" 26 + - "pcie_bus" 14 27 15 28 Optional properties: 16 29 - reset-gpio: gpio pin number of power good signal 17 - 18 - Optional properties for fsl,imx6q-pcie 19 - - power-on-gpio: gpio pin number of power-enable signal 20 - - wake-up-gpio: gpio pin number of incoming wakeup signal 21 - - disable-gpio: gpio pin number of outgoing rfkill/endpoint disable signal 22 - 23 - Example: 24 - 25 - SoC specific DT Entry: 26 - 27 - pcie@290000 { 28 - compatible = "samsung,exynos5440-pcie", "snps,dw-pcie"; 29 - reg = <0x290000 0x1000 30 - 0x270000 0x1000 31 - 0x271000 0x40>; 32 - interrupts = <0 20 0>, <0 21 0>, <0 22 0>; 33 - clocks = <&clock 28>, <&clock 27>; 34 - clock-names = "pcie", "pcie_bus"; 35 - #address-cells = <3>; 36 - #size-cells = <2>; 37 - device_type = "pci"; 38 - ranges = <0x00000800 0 0x40000000 0x40000000 0 0x00001000 /* configuration space */ 39 - 0x81000000 0 0 0x40001000 0 0x00010000 /* downstream I/O */ 40 - 0x82000000 0 0x40011000 0x40011000 0 0x1ffef000>; /* non-prefetchable memory */ 41 - #interrupt-cells = <1>; 42 - interrupt-map-mask = <0 0 0 0>; 43 - interrupt-map = <0x0 0 &gic 53>; 44 - num-lanes = <4>; 45 - }; 46 - 47 - pcie@2a0000 { 48 - compatible = "samsung,exynos5440-pcie", "snps,dw-pcie"; 49 - reg = <0x2a0000 0x1000 50 - 0x272000 0x1000 51 - 0x271040 0x40>; 52 - interrupts = <0 23 0>, <0 24 0>, <0 25 0>; 53 - clocks = <&clock 29>, <&clock 27>; 54 - clock-names = "pcie", "pcie_bus"; 55 - #address-cells = <3>; 56 - #size-cells = <2>; 57 - device_type = "pci"; 58 - ranges = <0x00000800 0 0x60000000 0x60000000 0 0x00001000 /* configuration space */ 59 - 0x81000000 0 0 0x60001000 0 0x00010000 /* downstream I/O */ 60 - 0x82000000 0 0x60011000 0x60011000 0 0x1ffef000>; /* non-prefetchable memory */ 61 - #interrupt-cells = <1>; 62 - interrupt-map-mask = <0 0 0 0>; 63 - interrupt-map = <0x0 0 &gic 56>; 64 - num-lanes = <4>; 65 - }; 66 - 67 - Board specific DT Entry: 68 - 69 - pcie@290000 { 70 - reset-gpio = <&pin_ctrl 5 0>; 71 - }; 72 - 73 - pcie@2a0000 { 74 - reset-gpio = <&pin_ctrl 22 0>; 75 - };
+38
Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt
··· 1 + * Freescale i.MX6 PCIe interface 2 + 3 + This PCIe host controller is based on the Synopsis Designware PCIe IP 4 + and thus inherits all the common properties defined in designware-pcie.txt. 5 + 6 + Required properties: 7 + - compatible: "fsl,imx6q-pcie" 8 + - reg: base addresse and length of the pcie controller 9 + - interrupts: A list of interrupt outputs of the controller. Must contain an 10 + entry for each entry in the interrupt-names property. 11 + - interrupt-names: Must include the following entries: 12 + - "msi": The interrupt that is asserted when an MSI is received 13 + - clock-names: Must include the following additional entries: 14 + - "pcie_phy" 15 + 16 + Example: 17 + 18 + pcie@0x01000000 { 19 + compatible = "fsl,imx6q-pcie", "snps,dw-pcie"; 20 + reg = <0x01ffc000 0x4000>; 21 + #address-cells = <3>; 22 + #size-cells = <2>; 23 + device_type = "pci"; 24 + ranges = <0x00000800 0 0x01f00000 0x01f00000 0 0x00080000 25 + 0x81000000 0 0 0x01f80000 0 0x00010000 26 + 0x82000000 0 0x01000000 0x01000000 0 0x00f00000>; 27 + num-lanes = <1>; 28 + interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>; 29 + interrupt-names = "msi"; 30 + #interrupt-cells = <1>; 31 + interrupt-map-mask = <0 0 0 0x7>; 32 + interrupt-map = <0 0 0 1 &intc GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>, 33 + <0 0 0 2 &intc GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>, 34 + <0 0 0 3 &intc GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>, 35 + <0 0 0 4 &intc GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>; 36 + clocks = <&clks 144>, <&clks 206>, <&clks 189>; 37 + clock-names = "pcie", "pcie_bus", "pcie_phy"; 38 + };
+65
Documentation/devicetree/bindings/pci/samsung,exynos5440-pcie.txt
··· 1 + * Samsung Exynos 5440 PCIe interface 2 + 3 + This PCIe host controller is based on the Synopsis Designware PCIe IP 4 + and thus inherits all the common properties defined in designware-pcie.txt. 5 + 6 + Required properties: 7 + - compatible: "samsung,exynos5440-pcie" 8 + - reg: base addresses and lengths of the pcie controller, 9 + the phy controller, additional register for the phy controller. 10 + - interrupts: A list of interrupt outputs for level interrupt, 11 + pulse interrupt, special interrupt. 12 + 13 + Example: 14 + 15 + SoC specific DT Entry: 16 + 17 + pcie@290000 { 18 + compatible = "samsung,exynos5440-pcie", "snps,dw-pcie"; 19 + reg = <0x290000 0x1000 20 + 0x270000 0x1000 21 + 0x271000 0x40>; 22 + interrupts = <0 20 0>, <0 21 0>, <0 22 0>; 23 + clocks = <&clock 28>, <&clock 27>; 24 + clock-names = "pcie", "pcie_bus"; 25 + #address-cells = <3>; 26 + #size-cells = <2>; 27 + device_type = "pci"; 28 + ranges = <0x00000800 0 0x40000000 0x40000000 0 0x00001000 /* configuration space */ 29 + 0x81000000 0 0 0x40001000 0 0x00010000 /* downstream I/O */ 30 + 0x82000000 0 0x40011000 0x40011000 0 0x1ffef000>; /* non-prefetchable memory */ 31 + #interrupt-cells = <1>; 32 + interrupt-map-mask = <0 0 0 0>; 33 + interrupt-map = <0 0 0 0 &gic GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>; 34 + num-lanes = <4>; 35 + }; 36 + 37 + pcie@2a0000 { 38 + compatible = "samsung,exynos5440-pcie", "snps,dw-pcie"; 39 + reg = <0x2a0000 0x1000 40 + 0x272000 0x1000 41 + 0x271040 0x40>; 42 + interrupts = <0 23 0>, <0 24 0>, <0 25 0>; 43 + clocks = <&clock 29>, <&clock 27>; 44 + clock-names = "pcie", "pcie_bus"; 45 + #address-cells = <3>; 46 + #size-cells = <2>; 47 + device_type = "pci"; 48 + ranges = <0x00000800 0 0x60000000 0x60000000 0 0x00001000 /* configuration space */ 49 + 0x81000000 0 0 0x60001000 0 0x00010000 /* downstream I/O */ 50 + 0x82000000 0 0x60011000 0x60011000 0 0x1ffef000>; /* non-prefetchable memory */ 51 + #interrupt-cells = <1>; 52 + interrupt-map-mask = <0 0 0 0>; 53 + interrupt-map = <0 0 0 0 &gic GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>; 54 + num-lanes = <4>; 55 + }; 56 + 57 + Board specific DT Entry: 58 + 59 + pcie@290000 { 60 + reset-gpio = <&pin_ctrl 5 0>; 61 + }; 62 + 63 + pcie@2a0000 { 64 + reset-gpio = <&pin_ctrl 22 0>; 65 + };
+1 -4
drivers/pci/access.c
··· 231 231 } 232 232 233 233 if (time_after(jiffies, timeout)) { 234 - dev_printk(KERN_DEBUG, &dev->dev, 235 - "vpd r/w failed. This is likely a firmware " 236 - "bug on this device. Contact the card " 237 - "vendor for a firmware update."); 234 + dev_printk(KERN_DEBUG, &dev->dev, "vpd r/w failed. This is likely a firmware bug on this device. Contact the card vendor for a firmware update\n"); 238 235 return -ETIMEDOUT; 239 236 } 240 237 if (fatal_signal_pending(current))
+3 -3
drivers/pci/bus.c
··· 226 226 type_mask, alignf, alignf_data, 227 227 &pci_32_bit); 228 228 } 229 + EXPORT_SYMBOL(pci_bus_alloc_resource); 229 230 230 231 void __weak pcibios_resource_survey_bus(struct pci_bus *bus) { } 231 232 ··· 254 253 255 254 dev->is_added = 1; 256 255 } 256 + EXPORT_SYMBOL_GPL(pci_bus_add_device); 257 257 258 258 /** 259 259 * pci_bus_add_devices - start driver for PCI devices ··· 281 279 pci_bus_add_devices(child); 282 280 } 283 281 } 282 + EXPORT_SYMBOL(pci_bus_add_devices); 284 283 285 284 /** pci_walk_bus - walk devices on/under bus, calling callback. 286 285 * @top bus whose devices should be walked ··· 347 344 } 348 345 EXPORT_SYMBOL(pci_bus_put); 349 346 350 - EXPORT_SYMBOL(pci_bus_alloc_resource); 351 - EXPORT_SYMBOL_GPL(pci_bus_add_device); 352 - EXPORT_SYMBOL(pci_bus_add_devices);
-1
drivers/pci/host/pci-exynos.c
··· 545 545 pp->root_bus_nr = -1; 546 546 pp->ops = &exynos_pcie_host_ops; 547 547 548 - spin_lock_init(&pp->conf_lock); 549 548 ret = dw_pcie_host_init(pp); 550 549 if (ret) { 551 550 dev_err(&pdev->dev, "failed to initialize host\n");
-1
drivers/pci/host/pci-imx6.c
··· 507 507 pp->root_bus_nr = -1; 508 508 pp->ops = &imx6_pcie_host_ops; 509 509 510 - spin_lock_init(&pp->conf_lock); 511 510 ret = dw_pcie_host_init(pp); 512 511 if (ret) { 513 512 dev_err(&pdev->dev, "failed to initialize host\n");
+13 -18
drivers/pci/host/pci-mvebu.c
··· 113 113 struct mvebu_pcie_port { 114 114 char *name; 115 115 void __iomem *base; 116 - spinlock_t conf_lock; 117 116 u32 port; 118 117 u32 lane; 119 118 int devfn; ··· 328 329 ret = mvebu_mbus_add_window_remap_by_id(target, attribute, base, 329 330 sz, remap); 330 331 if (ret) { 332 + phys_addr_t end = base + sz - 1; 333 + 331 334 dev_err(&port->pcie->pdev->dev, 332 - "Could not create MBus window at 0x%x, size 0x%x: %d\n", 333 - base, sz, ret); 335 + "Could not create MBus window at [mem %pa-%pa]: %d\n", 336 + &base, &end, ret); 334 337 mvebu_pcie_del_windows(port, base - size_mapped, 335 338 size_mapped); 336 339 return; ··· 614 613 return sys->private_data; 615 614 } 616 615 617 - static struct mvebu_pcie_port * 618 - mvebu_pcie_find_port(struct mvebu_pcie *pcie, struct pci_bus *bus, 619 - int devfn) 616 + static struct mvebu_pcie_port *mvebu_pcie_find_port(struct mvebu_pcie *pcie, 617 + struct pci_bus *bus, 618 + int devfn) 620 619 { 621 620 int i; 622 621 ··· 639 638 { 640 639 struct mvebu_pcie *pcie = sys_to_pcie(bus->sysdata); 641 640 struct mvebu_pcie_port *port; 642 - unsigned long flags; 643 641 int ret; 644 642 645 643 port = mvebu_pcie_find_port(pcie, bus, devfn); ··· 664 664 return PCIBIOS_DEVICE_NOT_FOUND; 665 665 666 666 /* Access the real PCIe interface */ 667 - spin_lock_irqsave(&port->conf_lock, flags); 668 667 ret = mvebu_pcie_hw_wr_conf(port, bus, devfn, 669 668 where, size, val); 670 - spin_unlock_irqrestore(&port->conf_lock, flags); 671 669 672 670 return ret; 673 671 } ··· 676 678 { 677 679 struct mvebu_pcie *pcie = sys_to_pcie(bus->sysdata); 678 680 struct mvebu_pcie_port *port; 679 - unsigned long flags; 680 681 int ret; 681 682 682 683 port = mvebu_pcie_find_port(pcie, bus, devfn); ··· 707 710 } 708 711 709 712 /* Access the real PCIe interface */ 710 - spin_lock_irqsave(&port->conf_lock, flags); 711 713 ret = mvebu_pcie_hw_rd_conf(port, bus, devfn, 712 714 where, size, val); 713 - spin_unlock_irqrestore(&port->conf_lock, flags); 714 715 715 716 return ret; 716 717 } ··· 781 786 } 782 787 783 788 static resource_size_t mvebu_pcie_align_resource(struct pci_dev *dev, 784 - const struct resource *res, 785 - resource_size_t start, 786 - resource_size_t size, 787 - resource_size_t align) 789 + const struct resource *res, 790 + resource_size_t start, 791 + resource_size_t size, 792 + resource_size_t align) 788 793 { 789 794 if (dev->bus->number != 0) 790 795 return start; ··· 834 839 * found, maps it. 835 840 */ 836 841 static void __iomem *mvebu_pcie_map_registers(struct platform_device *pdev, 837 - struct device_node *np, struct mvebu_pcie_port *port) 842 + struct device_node *np, 843 + struct mvebu_pcie_port *port) 838 844 { 839 845 struct resource regs; 840 846 int ret = 0; ··· 1056 1060 mvebu_pcie_set_local_dev_nr(port, 1); 1057 1061 1058 1062 port->dn = child; 1059 - spin_lock_init(&port->conf_lock); 1060 1063 mvebu_sw_pci_bridge_init(port); 1061 1064 i++; 1062 1065 }
-6
drivers/pci/host/pcie-designware.c
··· 643 643 int size, u32 *val) 644 644 { 645 645 struct pcie_port *pp = sys_to_pcie(bus->sysdata); 646 - unsigned long flags; 647 646 int ret; 648 647 649 648 if (!pp) { ··· 655 656 return PCIBIOS_DEVICE_NOT_FOUND; 656 657 } 657 658 658 - spin_lock_irqsave(&pp->conf_lock, flags); 659 659 if (bus->number != pp->root_bus_nr) 660 660 ret = dw_pcie_rd_other_conf(pp, bus, devfn, 661 661 where, size, val); 662 662 else 663 663 ret = dw_pcie_rd_own_conf(pp, where, size, val); 664 - spin_unlock_irqrestore(&pp->conf_lock, flags); 665 664 666 665 return ret; 667 666 } ··· 668 671 int where, int size, u32 val) 669 672 { 670 673 struct pcie_port *pp = sys_to_pcie(bus->sysdata); 671 - unsigned long flags; 672 674 int ret; 673 675 674 676 if (!pp) { ··· 678 682 if (dw_pcie_valid_config(pp, bus, PCI_SLOT(devfn)) == 0) 679 683 return PCIBIOS_DEVICE_NOT_FOUND; 680 684 681 - spin_lock_irqsave(&pp->conf_lock, flags); 682 685 if (bus->number != pp->root_bus_nr) 683 686 ret = dw_pcie_wr_other_conf(pp, bus, devfn, 684 687 where, size, val); 685 688 else 686 689 ret = dw_pcie_wr_own_conf(pp, where, size, val); 687 - spin_unlock_irqrestore(&pp->conf_lock, flags); 688 690 689 691 return ret; 690 692 }
-1
drivers/pci/host/pcie-designware.h
··· 41 41 void __iomem *va_cfg1_base; 42 42 u64 io_base; 43 43 u64 mem_base; 44 - spinlock_t conf_lock; 45 44 struct resource cfg; 46 45 struct resource io; 47 46 struct resource mem;
+4 -6
drivers/pci/host/pcie-rcar.c
··· 277 277 else if (size == 2) 278 278 *val = (*val >> (8 * (where & 2))) & 0xffff; 279 279 280 - dev_dbg(&bus->dev, "pcie-config-read: bus=%3d devfn=0x%04x " 281 - "where=0x%04x size=%d val=0x%08lx\n", bus->number, 282 - devfn, where, size, (unsigned long)*val); 280 + dev_dbg(&bus->dev, "pcie-config-read: bus=%3d devfn=0x%04x where=0x%04x size=%d val=0x%08lx\n", 281 + bus->number, devfn, where, size, (unsigned long)*val); 283 282 284 283 return ret; 285 284 } ··· 301 302 if (ret != PCIBIOS_SUCCESSFUL) 302 303 return ret; 303 304 304 - dev_dbg(&bus->dev, "pcie-config-write: bus=%3d devfn=0x%04x " 305 - "where=0x%04x size=%d val=0x%08lx\n", bus->number, 306 - devfn, where, size, (unsigned long)val); 305 + dev_dbg(&bus->dev, "pcie-config-write: bus=%3d devfn=0x%04x where=0x%04x size=%d val=0x%08lx\n", 306 + bus->number, devfn, where, size, (unsigned long)val); 307 307 308 308 if (size == 1) { 309 309 shift = 8 * (where & 3);
+2 -4
drivers/pci/hotplug/acpiphp_core.c
··· 63 63 MODULE_PARM_DESC(disable, "disable acpiphp driver"); 64 64 module_param_named(disable, acpiphp_disabled, bool, 0444); 65 65 66 - /* export the attention callback registration methods */ 67 - EXPORT_SYMBOL_GPL(acpiphp_register_attention); 68 - EXPORT_SYMBOL_GPL(acpiphp_unregister_attention); 69 - 70 66 static int enable_slot (struct hotplug_slot *slot); 71 67 static int disable_slot (struct hotplug_slot *slot); 72 68 static int set_attention_status (struct hotplug_slot *slot, u8 value); ··· 100 104 } 101 105 return retval; 102 106 } 107 + EXPORT_SYMBOL_GPL(acpiphp_register_attention); 103 108 104 109 105 110 /** ··· 121 124 } 122 125 return retval; 123 126 } 127 + EXPORT_SYMBOL_GPL(acpiphp_unregister_attention); 124 128 125 129 126 130 /**
+2 -4
drivers/pci/hotplug/acpiphp_glue.c
··· 351 351 slot->slot = NULL; 352 352 bridge->nr_slots--; 353 353 if (retval == -EBUSY) 354 - pr_warn("Slot %llu already registered by another " 355 - "hotplug driver\n", sun); 354 + pr_warn("Slot %llu already registered by another hotplug driver\n", sun); 356 355 else 357 - pr_warn("acpiphp_register_hotplug_slot failed " 358 - "(err code = 0x%x)\n", retval); 356 + pr_warn("acpiphp_register_hotplug_slot failed (err code = 0x%x)\n", retval); 359 357 } 360 358 /* Even if the slot registration fails, we can still use it. */ 361 359 }
+9 -9
drivers/pci/hotplug/cpci_hotplug.h
··· 56 56 int (*enable_irq) (void); 57 57 int (*disable_irq) (void); 58 58 int (*check_irq) (void *dev_id); 59 - int (*hardware_test) (struct slot* slot, u32 value); 60 - u8 (*get_power) (struct slot* slot); 61 - int (*set_power) (struct slot* slot, int value); 59 + int (*hardware_test) (struct slot *slot, u32 value); 60 + u8 (*get_power) (struct slot *slot); 61 + int (*set_power) (struct slot *slot, int value); 62 62 }; 63 63 64 64 struct cpci_hp_controller { ··· 89 89 u8 cpci_get_attention_status(struct slot *slot); 90 90 u8 cpci_get_latch_status(struct slot *slot); 91 91 u8 cpci_get_adapter_status(struct slot *slot); 92 - u16 cpci_get_hs_csr(struct slot * slot); 92 + u16 cpci_get_hs_csr(struct slot *slot); 93 93 int cpci_set_attention_status(struct slot *slot, int status); 94 - int cpci_check_and_clear_ins(struct slot * slot); 95 - int cpci_check_ext(struct slot * slot); 96 - int cpci_clear_ext(struct slot * slot); 97 - int cpci_led_on(struct slot * slot); 98 - int cpci_led_off(struct slot * slot); 94 + int cpci_check_and_clear_ins(struct slot *slot); 95 + int cpci_check_ext(struct slot *slot); 96 + int cpci_clear_ext(struct slot *slot); 97 + int cpci_led_on(struct slot *slot); 98 + int cpci_led_off(struct slot *slot); 99 99 int cpci_configure_slot(struct slot *slot); 100 100 int cpci_unconfigure_slot(struct slot *slot); 101 101
+15 -16
drivers/pci/hotplug/cpci_hotplug_core.c
··· 65 65 static int enable_slot(struct hotplug_slot *slot); 66 66 static int disable_slot(struct hotplug_slot *slot); 67 67 static int set_attention_status(struct hotplug_slot *slot, u8 value); 68 - static int get_power_status(struct hotplug_slot *slot, u8 * value); 69 - static int get_attention_status(struct hotplug_slot *slot, u8 * value); 70 - static int get_adapter_status(struct hotplug_slot *slot, u8 * value); 71 - static int get_latch_status(struct hotplug_slot *slot, u8 * value); 68 + static int get_power_status(struct hotplug_slot *slot, u8 *value); 69 + static int get_attention_status(struct hotplug_slot *slot, u8 *value); 70 + static int get_adapter_status(struct hotplug_slot *slot, u8 *value); 71 + static int get_latch_status(struct hotplug_slot *slot, u8 *value); 72 72 73 73 static struct hotplug_slot_ops cpci_hotplug_slot_ops = { 74 74 .enable_slot = enable_slot, ··· 168 168 } 169 169 170 170 static int 171 - get_power_status(struct hotplug_slot *hotplug_slot, u8 * value) 171 + get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) 172 172 { 173 173 struct slot *slot = hotplug_slot->private; 174 174 ··· 177 177 } 178 178 179 179 static int 180 - get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value) 180 + get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) 181 181 { 182 182 struct slot *slot = hotplug_slot->private; 183 183 ··· 192 192 } 193 193 194 194 static int 195 - get_adapter_status(struct hotplug_slot *hotplug_slot, u8 * value) 195 + get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) 196 196 { 197 197 *value = hotplug_slot->info->adapter_status; 198 198 return 0; 199 199 } 200 200 201 201 static int 202 - get_latch_status(struct hotplug_slot *hotplug_slot, u8 * value) 202 + get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) 203 203 { 204 204 *value = hotplug_slot->info->latch_status; 205 205 return 0; ··· 299 299 error: 300 300 return status; 301 301 } 302 + EXPORT_SYMBOL_GPL(cpci_hp_register_bus); 302 303 303 304 int 304 305 cpci_hp_unregister_bus(struct pci_bus *bus) ··· 330 329 up_write(&list_rwsem); 331 330 return status; 332 331 } 332 + EXPORT_SYMBOL_GPL(cpci_hp_unregister_bus); 333 333 334 334 /* This is the interrupt mode interrupt handler */ 335 335 static irqreturn_t ··· 362 360 init_slots(int clear_ins) 363 361 { 364 362 struct slot *slot; 365 - struct pci_dev* dev; 363 + struct pci_dev *dev; 366 364 367 365 dbg("%s - enter", __func__); 368 366 down_read(&list_rwsem); ··· 616 614 controller = new_controller; 617 615 return status; 618 616 } 617 + EXPORT_SYMBOL_GPL(cpci_hp_register_controller); 619 618 620 619 static void 621 620 cleanup_slots(void) ··· 656 653 status = -ENODEV; 657 654 return status; 658 655 } 656 + EXPORT_SYMBOL_GPL(cpci_hp_unregister_controller); 659 657 660 658 int 661 659 cpci_hp_start(void) ··· 694 690 dbg("%s - exit", __func__); 695 691 return 0; 696 692 } 693 + EXPORT_SYMBOL_GPL(cpci_hp_start); 697 694 698 695 int 699 696 cpci_hp_stop(void) ··· 709 704 cpci_stop_thread(); 710 705 return 0; 711 706 } 707 + EXPORT_SYMBOL_GPL(cpci_hp_stop); 712 708 713 709 int __init 714 710 cpci_hotplug_init(int debug) ··· 727 721 cpci_hp_stop(); 728 722 cpci_hp_unregister_controller(controller); 729 723 } 730 - 731 - EXPORT_SYMBOL_GPL(cpci_hp_register_controller); 732 - EXPORT_SYMBOL_GPL(cpci_hp_unregister_controller); 733 - EXPORT_SYMBOL_GPL(cpci_hp_register_bus); 734 - EXPORT_SYMBOL_GPL(cpci_hp_unregister_bus); 735 - EXPORT_SYMBOL_GPL(cpci_hp_start); 736 - EXPORT_SYMBOL_GPL(cpci_hp_stop);
+9 -9
drivers/pci/hotplug/cpci_hotplug_pci.c
··· 46 46 #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME , ## arg) 47 47 48 48 49 - u8 cpci_get_attention_status(struct slot* slot) 49 + u8 cpci_get_attention_status(struct slot *slot) 50 50 { 51 51 int hs_cap; 52 52 u16 hs_csr; ··· 66 66 return hs_csr & 0x0008 ? 1 : 0; 67 67 } 68 68 69 - int cpci_set_attention_status(struct slot* slot, int status) 69 + int cpci_set_attention_status(struct slot *slot, int status) 70 70 { 71 71 int hs_cap; 72 72 u16 hs_csr; ··· 93 93 return 1; 94 94 } 95 95 96 - u16 cpci_get_hs_csr(struct slot* slot) 96 + u16 cpci_get_hs_csr(struct slot *slot) 97 97 { 98 98 int hs_cap; 99 99 u16 hs_csr; ··· 111 111 return hs_csr; 112 112 } 113 113 114 - int cpci_check_and_clear_ins(struct slot* slot) 114 + int cpci_check_and_clear_ins(struct slot *slot) 115 115 { 116 116 int hs_cap; 117 117 u16 hs_csr; ··· 140 140 return ins; 141 141 } 142 142 143 - int cpci_check_ext(struct slot* slot) 143 + int cpci_check_ext(struct slot *slot) 144 144 { 145 145 int hs_cap; 146 146 u16 hs_csr; ··· 161 161 return ext; 162 162 } 163 163 164 - int cpci_clear_ext(struct slot* slot) 164 + int cpci_clear_ext(struct slot *slot) 165 165 { 166 166 int hs_cap; 167 167 u16 hs_csr; ··· 187 187 return 0; 188 188 } 189 189 190 - int cpci_led_on(struct slot* slot) 190 + int cpci_led_on(struct slot *slot) 191 191 { 192 192 int hs_cap; 193 193 u16 hs_csr; ··· 216 216 return 0; 217 217 } 218 218 219 - int cpci_led_off(struct slot* slot) 219 + int cpci_led_off(struct slot *slot) 220 220 { 221 221 int hs_cap; 222 222 u16 hs_csr; ··· 303 303 return ret; 304 304 } 305 305 306 - int cpci_unconfigure_slot(struct slot* slot) 306 + int cpci_unconfigure_slot(struct slot *slot) 307 307 { 308 308 struct pci_dev *dev, *temp; 309 309
+4 -4
drivers/pci/hotplug/cpcihp_generic.c
··· 78 78 79 79 static int __init validate_parameters(void) 80 80 { 81 - char* str; 82 - char* p; 81 + char *str; 82 + char *p; 83 83 unsigned long tmp; 84 84 85 85 if(!bridge) { ··· 142 142 static int __init cpcihp_generic_init(void) 143 143 { 144 144 int status; 145 - struct resource* r; 146 - struct pci_dev* dev; 145 + struct resource *r; 146 + struct pci_dev *dev; 147 147 148 148 info(DRIVER_DESC " version: " DRIVER_VERSION); 149 149 status = validate_parameters();
+1 -1
drivers/pci/hotplug/cpcihp_zt5550.c
··· 295 295 296 296 static int __init zt5550_init(void) 297 297 { 298 - struct resource* r; 298 + struct resource *r; 299 299 int rc; 300 300 301 301 info(DRIVER_DESC " version: " DRIVER_VERSION);
+2 -2
drivers/pci/hotplug/cpqphp.h
··· 255 255 struct pci_resource *io_head; 256 256 struct pci_resource *bus_head; 257 257 struct timer_list *p_task_event; 258 - struct pci_dev* pci_dev; 258 + struct pci_dev *pci_dev; 259 259 }; 260 260 261 261 struct slot { ··· 278 278 }; 279 279 280 280 struct pci_resource { 281 - struct pci_resource * next; 281 + struct pci_resource *next; 282 282 u32 base; 283 283 u32 length; 284 284 };
+5 -7
drivers/pci/hotplug/cpqphp_core.c
··· 94 94 * 95 95 * Returns pointer to the head of the SMBIOS tables (or %NULL). 96 96 */ 97 - static void __iomem * detect_SMBIOS_pointer(void __iomem *begin, void __iomem *end) 97 + static void __iomem *detect_SMBIOS_pointer(void __iomem *begin, void __iomem *end) 98 98 { 99 99 void __iomem *fp; 100 100 void __iomem *endp; ··· 131 131 * 132 132 * For unexpected switch opens 133 133 */ 134 - static int init_SERR(struct controller * ctrl) 134 + static int init_SERR(struct controller *ctrl) 135 135 { 136 136 u32 tempdword; 137 137 u32 number_of_slots; ··· 291 291 kfree(slot); 292 292 } 293 293 294 - static int ctrl_slot_cleanup (struct controller * ctrl) 294 + static int ctrl_slot_cleanup (struct controller *ctrl) 295 295 { 296 296 struct slot *old_slot, *next_slot; 297 297 ··· 706 706 hotplug_slot_info->adapter_status = 707 707 get_presence_status(ctrl, slot); 708 708 709 - dbg("registering bus %d, dev %d, number %d, " 710 - "ctrl->slot_device_offset %d, slot %d\n", 709 + dbg("registering bus %d, dev %d, number %d, ctrl->slot_device_offset %d, slot %d\n", 711 710 slot->bus, slot->device, 712 711 slot->number, ctrl->slot_device_offset, 713 712 slot_number); ··· 836 837 837 838 bus = pdev->subordinate; 838 839 if (!bus) { 839 - dev_notice(&pdev->dev, "the device is not a bridge, " 840 - "skipping\n"); 840 + dev_notice(&pdev->dev, "the device is not a bridge, skipping\n"); 841 841 rc = -ENODEV; 842 842 goto err_disable_device; 843 843 }
+13 -13
drivers/pci/hotplug/cpqphp_ctrl.c
··· 39 39 #include <linux/kthread.h> 40 40 #include "cpqphp.h" 41 41 42 - static u32 configure_new_device(struct controller* ctrl, struct pci_func *func, 42 + static u32 configure_new_device(struct controller *ctrl, struct pci_func *func, 43 43 u8 behind_bridge, struct resource_lists *resources); 44 - static int configure_new_function(struct controller* ctrl, struct pci_func *func, 44 + static int configure_new_function(struct controller *ctrl, struct pci_func *func, 45 45 u8 behind_bridge, struct resource_lists *resources); 46 46 static void interrupt_event_handler(struct controller *ctrl); 47 47 ··· 64 64 65 65 /* FIXME: The following line needs to be somewhere else... */ 66 66 #define WRONG_BUS_FREQUENCY 0x07 67 - static u8 handle_switch_change(u8 change, struct controller * ctrl) 67 + static u8 handle_switch_change(u8 change, struct controller *ctrl) 68 68 { 69 69 int hp_slot; 70 70 u8 rc = 0; ··· 138 138 } 139 139 140 140 141 - static u8 handle_presence_change(u16 change, struct controller * ctrl) 141 + static u8 handle_presence_change(u16 change, struct controller *ctrl) 142 142 { 143 143 int hp_slot; 144 144 u8 rc = 0; ··· 232 232 } 233 233 234 234 235 - static u8 handle_power_fault(u8 change, struct controller * ctrl) 235 + static u8 handle_power_fault(u8 change, struct controller *ctrl) 236 236 { 237 237 int hp_slot; 238 238 u8 rc = 0; ··· 997 997 * 998 998 * Returns %0 if successful, !0 otherwise. 999 999 */ 1000 - static int slot_remove(struct pci_func * old_slot) 1000 + static int slot_remove(struct pci_func *old_slot) 1001 1001 { 1002 1002 struct pci_func *next; 1003 1003 ··· 1109 1109 1110 1110 /* DJZ: I don't think is_bridge will work as is. 1111 1111 * FIXME */ 1112 - static int is_bridge(struct pci_func * func) 1112 + static int is_bridge(struct pci_func *func) 1113 1113 { 1114 1114 /* Check the header type */ 1115 1115 if (((func->config_space[0x03] >> 16) & 0xFF) == 0x01) ··· 1625 1625 * @replace_flag: whether replacing or adding a new device 1626 1626 * @ctrl: target controller 1627 1627 */ 1628 - static u32 remove_board(struct pci_func * func, u32 replace_flag, struct controller * ctrl) 1628 + static u32 remove_board(struct pci_func *func, u32 replace_flag, struct controller *ctrl) 1629 1629 { 1630 1630 int index; 1631 1631 u8 skip = 0; ··· 1742 1742 1743 1743 1744 1744 /* this is the main worker thread */ 1745 - static int event_thread(void* data) 1745 + static int event_thread(void *data) 1746 1746 { 1747 1747 struct controller *ctrl; 1748 1748 ··· 1992 1992 u16 temp_word; 1993 1993 u32 tempdword; 1994 1994 int rc; 1995 - struct slot* p_slot; 1995 + struct slot *p_slot; 1996 1996 int physical_slot = 0; 1997 1997 1998 1998 tempdword = 0; ··· 2088 2088 u8 replace_flag; 2089 2089 u32 rc = 0; 2090 2090 unsigned int devfn; 2091 - struct slot* p_slot; 2091 + struct slot *p_slot; 2092 2092 struct pci_bus *pci_bus = ctrl->pci_bus; 2093 2093 int physical_slot=0; 2094 2094 ··· 2270 2270 * 2271 2271 * Returns 0 if success. 2272 2272 */ 2273 - static u32 configure_new_device(struct controller * ctrl, struct pci_func * func, 2274 - u8 behind_bridge, struct resource_lists * resources) 2273 + static u32 configure_new_device(struct controller *ctrl, struct pci_func *func, 2274 + u8 behind_bridge, struct resource_lists *resources) 2275 2275 { 2276 2276 u8 temp_byte, function, max_functions, stop_it; 2277 2277 int rc;
+16 -16
drivers/pci/hotplug/cpqphp_nvram.c
··· 107 107 */ 108 108 109 109 110 - static u32 add_byte( u32 **p_buffer, u8 value, u32 *used, u32 *avail) 110 + static u32 add_byte(u32 **p_buffer, u8 value, u32 *used, u32 *avail) 111 111 { 112 112 u8 **tByte; 113 113 ··· 122 122 } 123 123 124 124 125 - static u32 add_dword( u32 **p_buffer, u32 value, u32 *used, u32 *avail) 125 + static u32 add_dword(u32 **p_buffer, u32 value, u32 *used, u32 *avail) 126 126 { 127 127 if ((*used + 4) > *avail) 128 128 return(1); ··· 267 267 ctrl = cpqhp_ctrl_list; 268 268 269 269 /* The revision of this structure */ 270 - rc = add_byte( &pFill, 1 + ctrl->push_flag, &usedbytes, &available); 270 + rc = add_byte(&pFill, 1 + ctrl->push_flag, &usedbytes, &available); 271 271 if (rc) 272 272 return(rc); 273 273 274 274 /* The number of controllers */ 275 - rc = add_byte( &pFill, 1, &usedbytes, &available); 275 + rc = add_byte(&pFill, 1, &usedbytes, &available); 276 276 if (rc) 277 277 return(rc); 278 278 ··· 282 282 numCtrl++; 283 283 284 284 /* The bus number */ 285 - rc = add_byte( &pFill, ctrl->bus, &usedbytes, &available); 285 + rc = add_byte(&pFill, ctrl->bus, &usedbytes, &available); 286 286 if (rc) 287 287 return(rc); 288 288 289 289 /* The device Number */ 290 - rc = add_byte( &pFill, PCI_SLOT(ctrl->pci_dev->devfn), &usedbytes, &available); 290 + rc = add_byte(&pFill, PCI_SLOT(ctrl->pci_dev->devfn), &usedbytes, &available); 291 291 if (rc) 292 292 return(rc); 293 293 294 294 /* The function Number */ 295 - rc = add_byte( &pFill, PCI_FUNC(ctrl->pci_dev->devfn), &usedbytes, &available); 295 + rc = add_byte(&pFill, PCI_FUNC(ctrl->pci_dev->devfn), &usedbytes, &available); 296 296 if (rc) 297 297 return(rc); 298 298 299 299 /* Skip the number of available entries */ 300 - rc = add_dword( &pFill, 0, &usedbytes, &available); 300 + rc = add_dword(&pFill, 0, &usedbytes, &available); 301 301 if (rc) 302 302 return(rc); 303 303 ··· 311 311 loop ++; 312 312 313 313 /* base */ 314 - rc = add_dword( &pFill, resNode->base, &usedbytes, &available); 314 + rc = add_dword(&pFill, resNode->base, &usedbytes, &available); 315 315 if (rc) 316 316 return(rc); 317 317 318 318 /* length */ 319 - rc = add_dword( &pFill, resNode->length, &usedbytes, &available); 319 + rc = add_dword(&pFill, resNode->length, &usedbytes, &available); 320 320 if (rc) 321 321 return(rc); 322 322 ··· 336 336 loop ++; 337 337 338 338 /* base */ 339 - rc = add_dword( &pFill, resNode->base, &usedbytes, &available); 339 + rc = add_dword(&pFill, resNode->base, &usedbytes, &available); 340 340 if (rc) 341 341 return(rc); 342 342 343 343 /* length */ 344 - rc = add_dword( &pFill, resNode->length, &usedbytes, &available); 344 + rc = add_dword(&pFill, resNode->length, &usedbytes, &available); 345 345 if (rc) 346 346 return(rc); 347 347 ··· 361 361 loop ++; 362 362 363 363 /* base */ 364 - rc = add_dword( &pFill, resNode->base, &usedbytes, &available); 364 + rc = add_dword(&pFill, resNode->base, &usedbytes, &available); 365 365 if (rc) 366 366 return(rc); 367 367 368 368 /* length */ 369 - rc = add_dword( &pFill, resNode->length, &usedbytes, &available); 369 + rc = add_dword(&pFill, resNode->length, &usedbytes, &available); 370 370 if (rc) 371 371 return(rc); 372 372 ··· 386 386 loop ++; 387 387 388 388 /* base */ 389 - rc = add_dword( &pFill, resNode->base, &usedbytes, &available); 389 + rc = add_dword(&pFill, resNode->base, &usedbytes, &available); 390 390 if (rc) 391 391 return(rc); 392 392 393 393 /* length */ 394 - rc = add_dword( &pFill, resNode->length, &usedbytes, &available); 394 + rc = add_dword(&pFill, resNode->length, &usedbytes, &available); 395 395 if (rc) 396 396 return(rc); 397 397
+13 -13
drivers/pci/hotplug/cpqphp_pci.c
··· 81 81 } 82 82 83 83 84 - int cpqhp_configure_device (struct controller* ctrl, struct pci_func* func) 84 + int cpqhp_configure_device (struct controller *ctrl, struct pci_func *func) 85 85 { 86 86 struct pci_bus *child; 87 87 int num; ··· 121 121 } 122 122 123 123 124 - int cpqhp_unconfigure_device(struct pci_func* func) 124 + int cpqhp_unconfigure_device(struct pci_func *func) 125 125 { 126 126 int j; 127 127 ··· 129 129 130 130 pci_lock_rescan_remove(); 131 131 for (j=0; j<8 ; j++) { 132 - struct pci_dev* temp = pci_get_bus_and_slot(func->bus, PCI_DEVFN(func->device, j)); 132 + struct pci_dev *temp = pci_get_bus_and_slot(func->bus, PCI_DEVFN(func->device, j)); 133 133 if (temp) { 134 134 pci_dev_put(temp); 135 135 pci_stop_and_remove_bus_device(temp); ··· 203 203 } 204 204 205 205 206 - static int PCI_ScanBusForNonBridge(struct controller *ctrl, u8 bus_num, u8 * dev_num) 206 + static int PCI_ScanBusForNonBridge(struct controller *ctrl, u8 bus_num, u8 *dev_num) 207 207 { 208 208 u16 tdevice; 209 209 u32 work; ··· 280 280 } 281 281 282 282 283 - int cpqhp_get_bus_dev (struct controller *ctrl, u8 * bus_num, u8 * dev_num, u8 slot) 283 + int cpqhp_get_bus_dev (struct controller *ctrl, u8 *bus_num, u8 *dev_num, u8 slot) 284 284 { 285 285 /* plain (bridges allowed) */ 286 286 return PCI_GetBusDevHelper(ctrl, bus_num, dev_num, slot, 0); ··· 465 465 * 466 466 * returns 0 if success 467 467 */ 468 - int cpqhp_save_slot_config (struct controller *ctrl, struct pci_func * new_slot) 468 + int cpqhp_save_slot_config (struct controller *ctrl, struct pci_func *new_slot) 469 469 { 470 470 long rc; 471 471 u8 class_code; ··· 549 549 * 550 550 * returns 0 if success 551 551 */ 552 - int cpqhp_save_base_addr_length(struct controller *ctrl, struct pci_func * func) 552 + int cpqhp_save_base_addr_length(struct controller *ctrl, struct pci_func *func) 553 553 { 554 554 u8 cloop; 555 555 u8 header_type; ··· 686 686 * 687 687 * returns 0 if success 688 688 */ 689 - int cpqhp_save_used_resources (struct controller *ctrl, struct pci_func * func) 689 + int cpqhp_save_used_resources (struct controller *ctrl, struct pci_func *func) 690 690 { 691 691 u8 cloop; 692 692 u8 header_type; ··· 949 949 * 950 950 * returns 0 if success 951 951 */ 952 - int cpqhp_configure_board(struct controller *ctrl, struct pci_func * func) 952 + int cpqhp_configure_board(struct controller *ctrl, struct pci_func *func) 953 953 { 954 954 int cloop; 955 955 u8 header_type; ··· 1027 1027 * 1028 1028 * returns 0 if the board is the same nonzero otherwise 1029 1029 */ 1030 - int cpqhp_valid_replace(struct controller *ctrl, struct pci_func * func) 1030 + int cpqhp_valid_replace(struct controller *ctrl, struct pci_func *func) 1031 1031 { 1032 1032 u8 cloop; 1033 1033 u8 header_type; ··· 1419 1419 * 1420 1420 * returns 0 if success 1421 1421 */ 1422 - int cpqhp_return_board_resources(struct pci_func * func, struct resource_lists * resources) 1422 + int cpqhp_return_board_resources(struct pci_func *func, struct resource_lists *resources) 1423 1423 { 1424 1424 int rc = 0; 1425 1425 struct pci_resource *node; ··· 1475 1475 * 1476 1476 * Puts node back in the resource list pointed to by head 1477 1477 */ 1478 - void cpqhp_destroy_resource_list (struct resource_lists * resources) 1478 + void cpqhp_destroy_resource_list (struct resource_lists *resources) 1479 1479 { 1480 1480 struct pci_resource *res, *tres; 1481 1481 ··· 1522 1522 * 1523 1523 * Puts node back in the resource list pointed to by head 1524 1524 */ 1525 - void cpqhp_destroy_board_resources (struct pci_func * func) 1525 + void cpqhp_destroy_board_resources (struct pci_func *func) 1526 1526 { 1527 1527 struct pci_resource *res, *tres; 1528 1528
+1 -1
drivers/pci/hotplug/cpqphp_sysfs.c
··· 79 79 80 80 static int show_dev (struct controller *ctrl, char *buf) 81 81 { 82 - char * out = buf; 82 + char *out = buf; 83 83 int index; 84 84 struct pci_resource *res; 85 85 struct pci_func *new_slot;
+20 -24
drivers/pci/hotplug/ibmphp_core.c
··· 74 74 static inline int get_cur_bus_info(struct slot **sl) 75 75 { 76 76 int rc = 1; 77 - struct slot * slot_cur = *sl; 77 + struct slot *slot_cur = *sl; 78 78 79 79 debug("options = %x\n", slot_cur->ctrl->options); 80 80 debug("revision = %x\n", slot_cur->ctrl->revision); ··· 114 114 115 115 static int __init get_max_slots (void) 116 116 { 117 - struct slot * slot_cur; 118 - struct list_head * tmp; 117 + struct slot *slot_cur; 118 + struct list_head *tmp; 119 119 u8 slot_count = 0; 120 120 121 121 list_for_each(tmp, &ibmphp_slot_head) { ··· 280 280 return rc; 281 281 } 282 282 283 - static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value) 283 + static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) 284 284 { 285 285 int rc = -ENODEV; 286 286 struct slot *pslot; ··· 311 311 return rc; 312 312 } 313 313 314 - static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 * value) 314 + static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) 315 315 { 316 316 int rc = -ENODEV; 317 317 struct slot *pslot; ··· 338 338 } 339 339 340 340 341 - static int get_power_status(struct hotplug_slot *hotplug_slot, u8 * value) 341 + static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) 342 342 { 343 343 int rc = -ENODEV; 344 344 struct slot *pslot; ··· 364 364 return rc; 365 365 } 366 366 367 - static int get_adapter_present(struct hotplug_slot *hotplug_slot, u8 * value) 367 + static int get_adapter_present(struct hotplug_slot *hotplug_slot, u8 *value) 368 368 { 369 369 int rc = -ENODEV; 370 370 struct slot *pslot; ··· 433 433 } 434 434 435 435 /* 436 - static int get_max_adapter_speed_1(struct hotplug_slot *hotplug_slot, u8 * value, u8 flag) 436 + static int get_max_adapter_speed_1(struct hotplug_slot *hotplug_slot, u8 *value, u8 flag) 437 437 { 438 438 int rc = -ENODEV; 439 439 struct slot *pslot; ··· 471 471 return rc; 472 472 } 473 473 474 - static int get_bus_name(struct hotplug_slot *hotplug_slot, char * value) 474 + static int get_bus_name(struct hotplug_slot *hotplug_slot, char *value) 475 475 { 476 476 int rc = -ENODEV; 477 477 struct slot *pslot = NULL; ··· 671 671 { 672 672 struct pci_func *func_cur; 673 673 struct slot *slot_cur; 674 - struct list_head * tmp; 674 + struct list_head *tmp; 675 675 list_for_each(tmp, &ibmphp_slot_head) { 676 676 slot_cur = list_entry(tmp, struct slot, ibm_slot_list); 677 677 if (slot_cur->func) { ··· 696 696 static void free_slots(void) 697 697 { 698 698 struct slot *slot_cur; 699 - struct list_head * tmp; 700 - struct list_head * next; 699 + struct list_head *tmp; 700 + struct list_head *next; 701 701 702 702 debug("%s -- enter\n", __func__); 703 703 ··· 825 825 /******************************************************* 826 826 * Returns whether the bus is empty or not 827 827 *******************************************************/ 828 - static int is_bus_empty(struct slot * slot_cur) 828 + static int is_bus_empty(struct slot *slot_cur) 829 829 { 830 830 int rc; 831 - struct slot * tmp_slot; 831 + struct slot *tmp_slot; 832 832 u8 i = slot_cur->bus_on->slot_min; 833 833 834 834 while (i <= slot_cur->bus_on->slot_max) { ··· 856 856 * Parameters: slot 857 857 * Returns: bus is set (0) or error code 858 858 ***********************************************************/ 859 - static int set_bus(struct slot * slot_cur) 859 + static int set_bus(struct slot *slot_cur) 860 860 { 861 861 int rc; 862 862 u8 speed; ··· 956 956 static int check_limitations(struct slot *slot_cur) 957 957 { 958 958 u8 i; 959 - struct slot * tmp_slot; 959 + struct slot *tmp_slot; 960 960 u8 count = 0; 961 961 u8 limitation = 0; 962 962 ··· 1045 1045 rc = check_limitations(slot_cur); 1046 1046 if (rc) { 1047 1047 err("Adding this card exceeds the limitations of this bus.\n"); 1048 - err("(i.e., >1 133MHz cards running on same bus, or " 1049 - ">2 66 PCI cards running on same bus.\n"); 1048 + err("(i.e., >1 133MHz cards running on same bus, or >2 66 PCI cards running on same bus.\n"); 1050 1049 err("Try hot-adding into another bus\n"); 1051 1050 rc = -EINVAL; 1052 1051 goto error_nopower; ··· 1069 1070 !(SLOT_PWRGD(slot_cur->status))) 1070 1071 err("power fault occurred trying to power up\n"); 1071 1072 else if (SLOT_BUS_SPEED(slot_cur->status)) { 1072 - err("bus speed mismatch occurred. please check " 1073 - "current bus speed and card capability\n"); 1073 + err("bus speed mismatch occurred. please check current bus speed and card capability\n"); 1074 1074 print_card_capability(slot_cur); 1075 1075 } else if (SLOT_BUS_MODE(slot_cur->ext_status)) { 1076 - err("bus mode mismatch occurred. please check " 1077 - "current bus mode and card capability\n"); 1076 + err("bus mode mismatch occurred. please check current bus mode and card capability\n"); 1078 1077 print_card_capability(slot_cur); 1079 1078 } 1080 1079 ibmphp_update_slot_info(slot_cur); ··· 1095 1098 goto error_power; 1096 1099 } 1097 1100 if (SLOT_POWER(slot_cur->status) && (SLOT_BUS_SPEED(slot_cur->status))) { 1098 - err("bus speed mismatch occurred. please check current bus " 1099 - "speed and card capability\n"); 1101 + err("bus speed mismatch occurred. please check current bus speed and card capability\n"); 1100 1102 print_card_capability(slot_cur); 1101 1103 goto error_power; 1102 1104 }
+5 -5
drivers/pci/hotplug/ibmphp_ebda.c
··· 563 563 return rc; 564 564 } 565 565 566 - static struct opt_rio_lo * find_rxe_num (u8 slot_num) 566 + static struct opt_rio_lo *find_rxe_num (u8 slot_num) 567 567 { 568 568 struct opt_rio_lo *opt_lo_ptr; 569 569 ··· 575 575 return NULL; 576 576 } 577 577 578 - static struct opt_rio * find_chassis_num (u8 slot_num) 578 + static struct opt_rio *find_chassis_num (u8 slot_num) 579 579 { 580 580 struct opt_rio *opt_vg_ptr; 581 581 ··· 593 593 static u8 calculate_first_slot (u8 slot_num) 594 594 { 595 595 u8 first_slot = 1; 596 - struct slot * slot_cur; 596 + struct slot *slot_cur; 597 597 598 598 list_for_each_entry(slot_cur, &ibmphp_slot_head, ibm_slot_list) { 599 599 if (slot_cur->ctrl) { ··· 607 607 608 608 #define SLOT_NAME_SIZE 30 609 609 610 - static char *create_file_name (struct slot * slot_cur) 610 + static char *create_file_name (struct slot *slot_cur) 611 611 { 612 612 struct opt_rio *opt_vg_ptr = NULL; 613 613 struct opt_rio_lo *opt_lo_ptr = NULL; ··· 1192 1192 } 1193 1193 return rc; 1194 1194 } 1195 - static int ibmphp_probe (struct pci_dev * dev, const struct pci_device_id *ids) 1195 + static int ibmphp_probe (struct pci_dev *dev, const struct pci_device_id *ids) 1196 1196 { 1197 1197 struct controller *ctrl; 1198 1198
+3 -3
drivers/pci/hotplug/ibmphp_hpc.c
··· 533 533 * 534 534 * Return 0 or error codes 535 535 *---------------------------------------------------------------------*/ 536 - int ibmphp_hpc_readslot (struct slot * pslot, u8 cmd, u8 * pstatus) 536 + int ibmphp_hpc_readslot (struct slot *pslot, u8 cmd, u8 *pstatus) 537 537 { 538 538 void __iomem *wpg_bbar = NULL; 539 539 struct controller *ctlr_ptr; ··· 672 672 * 673 673 * Action: issue a WRITE command to HPC 674 674 *---------------------------------------------------------------------*/ 675 - int ibmphp_hpc_writeslot (struct slot * pslot, u8 cmd) 675 + int ibmphp_hpc_writeslot (struct slot *pslot, u8 cmd) 676 676 { 677 677 void __iomem *wpg_bbar = NULL; 678 678 struct controller *ctlr_ptr; ··· 1102 1102 * Value: 1103 1103 *---------------------------------------------------------------------*/ 1104 1104 static int hpc_wait_ctlr_notworking (int timeout, struct controller *ctlr_ptr, void __iomem *wpg_bbar, 1105 - u8 * pstatus) 1105 + u8 *pstatus) 1106 1106 { 1107 1107 int rc = 0; 1108 1108 u8 done = 0;
+14 -22
drivers/pci/hotplug/ibmphp_pci.c
··· 47 47 * We also assign the same irq numbers for multi function devices. 48 48 * These are PIC mode, so shouldn't matter n.e.ways (hopefully) 49 49 */ 50 - static void assign_alt_irq (struct pci_func * cur_func, u8 class_code) 50 + static void assign_alt_irq (struct pci_func *cur_func, u8 class_code) 51 51 { 52 52 int j; 53 53 for (j = 0; j < 4; j++) { ··· 137 137 "Please choose another device.\n", cur_func->device); 138 138 return -ENODEV; 139 139 } else if (class == PCI_CLASS_DISPLAY_VGA) { 140 - err ("The device %x is not supported for hot plugging. " 141 - "Please choose another device.\n", cur_func->device); 140 + err ("The device %x is not supported for hot plugging. Please choose another device.\n", 141 + cur_func->device); 142 142 return -ENODEV; 143 143 } 144 144 switch (hdr_type) { ··· 179 179 case PCI_HEADER_TYPE_MULTIBRIDGE: 180 180 class >>= 8; 181 181 if (class != PCI_CLASS_BRIDGE_PCI) { 182 - err ("This %x is not PCI-to-PCI bridge, and as is not supported for hot-plugging. " 183 - "Please insert another card.\n", cur_func->device); 182 + err ("This %x is not PCI-to-PCI bridge, and as is not supported for hot-plugging. Please insert another card.\n", 183 + cur_func->device); 184 184 return -ENODEV; 185 185 } 186 186 assign_alt_irq (cur_func, class_code); ··· 247 247 class >>= 8; 248 248 debug ("class now is %x\n", class); 249 249 if (class != PCI_CLASS_BRIDGE_PCI) { 250 - err ("This %x is not PCI-to-PCI bridge, and as is not supported for hot-plugging. " 251 - "Please insert another card.\n", cur_func->device); 250 + err ("This %x is not PCI-to-PCI bridge, and as is not supported for hot-plugging. Please insert another card.\n", 251 + cur_func->device); 252 252 return -ENODEV; 253 253 } 254 254 ··· 1073 1073 * Input: bridge function 1074 1074 * Output: amount of resources needed 1075 1075 *****************************************************************************/ 1076 - static struct res_needed *scan_behind_bridge (struct pci_func * func, u8 busno) 1076 + static struct res_needed *scan_behind_bridge (struct pci_func *func, u8 busno) 1077 1077 { 1078 1078 int count, len[6]; 1079 1079 u16 vendor_id; ··· 1125 1125 1126 1126 class >>= 8; /* to take revision out, class = class.subclass.prog i/f */ 1127 1127 if (class == PCI_CLASS_NOT_DEFINED_VGA) { 1128 - err ("The device %x is VGA compatible and as is not supported for hot plugging. " 1129 - "Please choose another device.\n", device); 1128 + err ("The device %x is VGA compatible and as is not supported for hot plugging. Please choose another device.\n", device); 1130 1129 amount->not_correct = 1; 1131 1130 return amount; 1132 1131 } else if (class == PCI_CLASS_DISPLAY_VGA) { 1133 - err ("The device %x is not supported for hot plugging. " 1134 - "Please choose another device.\n", device); 1132 + err ("The device %x is not supported for hot plugging. Please choose another device.\n", device); 1135 1133 amount->not_correct = 1; 1136 1134 return amount; 1137 1135 } ··· 1481 1483 debug ("hdr_type %x, class %x\n", hdr_type, class); 1482 1484 class >>= 8; /* to take revision out, class = class.subclass.prog i/f */ 1483 1485 if (class == PCI_CLASS_NOT_DEFINED_VGA) { 1484 - err ("The device %x function %x is VGA compatible and is not supported for hot removing. " 1485 - "Please choose another device.\n", device, function); 1486 + err ("The device %x function %x is VGA compatible and is not supported for hot removing. Please choose another device.\n", device, function); 1486 1487 return -ENODEV; 1487 1488 } else if (class == PCI_CLASS_DISPLAY_VGA) { 1488 - err ("The device %x function %x is not supported for hot removing. " 1489 - "Please choose another device.\n", device, function); 1489 + err ("The device %x function %x is not supported for hot removing. Please choose another device.\n", device, function); 1490 1490 return -ENODEV; 1491 1491 } 1492 1492 ··· 1509 1513 case PCI_HEADER_TYPE_BRIDGE: 1510 1514 class >>= 8; 1511 1515 if (class != PCI_CLASS_BRIDGE_PCI) { 1512 - err ("This device %x function %x is not PCI-to-PCI bridge, " 1513 - "and is not supported for hot-removing. " 1514 - "Please try another card.\n", device, function); 1516 + err ("This device %x function %x is not PCI-to-PCI bridge, and is not supported for hot-removing. Please try another card.\n", device, function); 1515 1517 return -ENODEV; 1516 1518 } 1517 1519 rc = unconfigure_boot_bridge (busno, device, function); ··· 1523 1529 case PCI_HEADER_TYPE_MULTIBRIDGE: 1524 1530 class >>= 8; 1525 1531 if (class != PCI_CLASS_BRIDGE_PCI) { 1526 - err ("This device %x function %x is not PCI-to-PCI bridge, " 1527 - "and is not supported for hot-removing. " 1528 - "Please try another card.\n", device, function); 1532 + err ("This device %x function %x is not PCI-to-PCI bridge, and is not supported for hot-removing. Please try another card.\n", device, function); 1529 1533 return -ENODEV; 1530 1534 } 1531 1535 rc = unconfigure_boot_bridge (busno, device, function);
+7 -8
drivers/pci/hotplug/ibmphp_res.c
··· 46 46 47 47 static LIST_HEAD(gbuses); 48 48 49 - static struct bus_node * __init alloc_error_bus (struct ebda_pci_rsrc * curr, u8 busno, int flag) 49 + static struct bus_node * __init alloc_error_bus (struct ebda_pci_rsrc *curr, u8 busno, int flag) 50 50 { 51 - struct bus_node * newbus; 51 + struct bus_node *newbus; 52 52 53 53 if (!(curr) && !(flag)) { 54 54 err ("NULL pointer passed\n"); ··· 69 69 return newbus; 70 70 } 71 71 72 - static struct resource_node * __init alloc_resources (struct ebda_pci_rsrc * curr) 72 + static struct resource_node * __init alloc_resources (struct ebda_pci_rsrc *curr) 73 73 { 74 74 struct resource_node *rs; 75 75 ··· 93 93 94 94 static int __init alloc_bus_range (struct bus_node **new_bus, struct range_node **new_range, struct ebda_pci_rsrc *curr, int flag, u8 first_bus) 95 95 { 96 - struct bus_node * newbus; 96 + struct bus_node *newbus; 97 97 struct range_node *newrange; 98 98 u8 num_ranges = 0; 99 99 ··· 789 789 bus_cur = find_bus_wprev (res->busno, NULL, 0); 790 790 791 791 if (!bus_cur) { 792 - err ("cannot find corresponding bus of the io resource to remove " 793 - "bailing out...\n"); 792 + err ("cannot find corresponding bus of the io resource to remove bailing out...\n"); 794 793 return -ENODEV; 795 794 } 796 795 ··· 933 934 return 0; 934 935 } 935 936 936 - static struct range_node * find_range (struct bus_node *bus_cur, struct resource_node * res) 937 + static struct range_node *find_range (struct bus_node *bus_cur, struct resource_node *res) 937 938 { 938 - struct range_node * range = NULL; 939 + struct range_node *range = NULL; 939 940 940 941 switch (res->type) { 941 942 case IO:
+47 -55
drivers/pci/hotplug/pci_hotplug_core.c
··· 59 59 #define DRIVER_DESC "PCI Hot Plug PCI Core" 60 60 61 61 62 - ////////////////////////////////////////////////////////////////// 63 - 64 62 static LIST_HEAD(pci_hotplug_slot_list); 65 63 static DEFINE_MUTEX(pci_hp_mutex); 66 64 67 65 /* Weee, fun with macros... */ 68 - #define GET_STATUS(name,type) \ 69 - static int get_##name (struct hotplug_slot *slot, type *value) \ 66 + #define GET_STATUS(name, type) \ 67 + static int get_##name(struct hotplug_slot *slot, type *value) \ 70 68 { \ 71 69 struct hotplug_slot_ops *ops = slot->ops; \ 72 70 int retval = 0; \ ··· 90 92 91 93 retval = get_power_status(slot->hotplug, &value); 92 94 if (retval) 93 - goto exit; 94 - retval = sprintf (buf, "%d\n", value); 95 - exit: 96 - return retval; 95 + return retval; 96 + 97 + return sprintf(buf, "%d\n", value); 97 98 } 98 99 99 100 static ssize_t power_write_file(struct pci_slot *pci_slot, const char *buf, 100 - size_t count) 101 + size_t count) 101 102 { 102 103 struct hotplug_slot *slot = pci_slot->hotplug; 103 104 unsigned long lpower; 104 105 u8 power; 105 106 int retval = 0; 106 107 107 - lpower = simple_strtoul (buf, NULL, 10); 108 + lpower = simple_strtoul(buf, NULL, 10); 108 109 power = (u8)(lpower & 0xff); 109 - dbg ("power = %d\n", power); 110 + dbg("power = %d\n", power); 110 111 111 112 if (!try_module_get(slot->ops->owner)) { 112 113 retval = -ENODEV; 113 114 goto exit; 114 115 } 115 116 switch (power) { 116 - case 0: 117 - if (slot->ops->disable_slot) 118 - retval = slot->ops->disable_slot(slot); 119 - break; 117 + case 0: 118 + if (slot->ops->disable_slot) 119 + retval = slot->ops->disable_slot(slot); 120 + break; 120 121 121 - case 1: 122 - if (slot->ops->enable_slot) 123 - retval = slot->ops->enable_slot(slot); 124 - break; 122 + case 1: 123 + if (slot->ops->enable_slot) 124 + retval = slot->ops->enable_slot(slot); 125 + break; 125 126 126 - default: 127 - err ("Illegal value specified for power\n"); 128 - retval = -EINVAL; 127 + default: 128 + err("Illegal value specified for power\n"); 129 + retval = -EINVAL; 129 130 } 130 131 module_put(slot->ops->owner); 131 132 ··· 147 150 148 151 retval = get_attention_status(slot->hotplug, &value); 149 152 if (retval) 150 - goto exit; 151 - retval = sprintf(buf, "%d\n", value); 153 + return retval; 152 154 153 - exit: 154 - return retval; 155 + return sprintf(buf, "%d\n", value); 155 156 } 156 157 157 158 static ssize_t attention_write_file(struct pci_slot *slot, const char *buf, 158 - size_t count) 159 + size_t count) 159 160 { 160 161 struct hotplug_slot_ops *ops = slot->hotplug->ops; 161 162 unsigned long lattention; 162 163 u8 attention; 163 164 int retval = 0; 164 165 165 - lattention = simple_strtoul (buf, NULL, 10); 166 + lattention = simple_strtoul(buf, NULL, 10); 166 167 attention = (u8)(lattention & 0xff); 167 - dbg (" - attention = %d\n", attention); 168 + dbg(" - attention = %d\n", attention); 168 169 169 170 if (!try_module_get(ops->owner)) { 170 171 retval = -ENODEV; ··· 191 196 192 197 retval = get_latch_status(slot->hotplug, &value); 193 198 if (retval) 194 - goto exit; 195 - retval = sprintf (buf, "%d\n", value); 199 + return retval; 196 200 197 - exit: 198 - return retval; 201 + return sprintf(buf, "%d\n", value); 199 202 } 200 203 201 204 static struct pci_slot_attribute hotplug_slot_attr_latch = { ··· 208 215 209 216 retval = get_adapter_status(slot->hotplug, &value); 210 217 if (retval) 211 - goto exit; 212 - retval = sprintf (buf, "%d\n", value); 218 + return retval; 213 219 214 - exit: 215 - return retval; 220 + return sprintf(buf, "%d\n", value); 216 221 } 217 222 218 223 static struct pci_slot_attribute hotplug_slot_attr_presence = { ··· 219 228 }; 220 229 221 230 static ssize_t test_write_file(struct pci_slot *pci_slot, const char *buf, 222 - size_t count) 231 + size_t count) 223 232 { 224 233 struct hotplug_slot *slot = pci_slot->hotplug; 225 234 unsigned long ltest; ··· 228 237 229 238 ltest = simple_strtoul (buf, NULL, 10); 230 239 test = (u32)(ltest & 0xffffffff); 231 - dbg ("test = %d\n", test); 240 + dbg("test = %d\n", test); 232 241 233 242 if (!try_module_get(slot->ops->owner)) { 234 243 retval = -ENODEV; ··· 252 261 static bool has_power_file(struct pci_slot *pci_slot) 253 262 { 254 263 struct hotplug_slot *slot = pci_slot->hotplug; 264 + 255 265 if ((!slot) || (!slot->ops)) 256 266 return false; 257 267 if ((slot->ops->enable_slot) || ··· 265 273 static bool has_attention_file(struct pci_slot *pci_slot) 266 274 { 267 275 struct hotplug_slot *slot = pci_slot->hotplug; 276 + 268 277 if ((!slot) || (!slot->ops)) 269 278 return false; 270 279 if ((slot->ops->set_attention_status) || ··· 277 284 static bool has_latch_file(struct pci_slot *pci_slot) 278 285 { 279 286 struct hotplug_slot *slot = pci_slot->hotplug; 287 + 280 288 if ((!slot) || (!slot->ops)) 281 289 return false; 282 290 if (slot->ops->get_latch_status) ··· 288 294 static bool has_adapter_file(struct pci_slot *pci_slot) 289 295 { 290 296 struct hotplug_slot *slot = pci_slot->hotplug; 297 + 291 298 if ((!slot) || (!slot->ops)) 292 299 return false; 293 300 if (slot->ops->get_adapter_status) ··· 299 304 static bool has_test_file(struct pci_slot *pci_slot) 300 305 { 301 306 struct hotplug_slot *slot = pci_slot->hotplug; 307 + 302 308 if ((!slot) || (!slot->ops)) 303 309 return false; 304 310 if (slot->ops->hardware_test) ··· 393 397 pci_hp_remove_module_link(slot); 394 398 } 395 399 396 - static struct hotplug_slot *get_slot_from_name (const char *name) 400 + static struct hotplug_slot *get_slot_from_name(const char *name) 397 401 { 398 402 struct hotplug_slot *slot; 399 403 struct list_head *tmp; 400 404 401 - list_for_each (tmp, &pci_hotplug_slot_list) { 402 - slot = list_entry (tmp, struct hotplug_slot, slot_list); 405 + list_for_each(tmp, &pci_hotplug_slot_list) { 406 + slot = list_entry(tmp, struct hotplug_slot, slot_list); 403 407 if (strcmp(hotplug_slot_name(slot), name) == 0) 404 408 return slot; 405 409 } ··· 432 436 if ((slot->info == NULL) || (slot->ops == NULL)) 433 437 return -EINVAL; 434 438 if (slot->release == NULL) { 435 - dbg("Why are you trying to register a hotplug slot " 436 - "without a proper release function?\n"); 439 + dbg("Why are you trying to register a hotplug slot without a proper release function?\n"); 437 440 return -EINVAL; 438 441 } 439 442 ··· 463 468 mutex_unlock(&pci_hp_mutex); 464 469 return result; 465 470 } 471 + EXPORT_SYMBOL_GPL(__pci_hp_register); 466 472 467 473 /** 468 474 * pci_hp_deregister - deregister a hotplug_slot with the PCI hotplug subsystem ··· 502 506 503 507 return 0; 504 508 } 509 + EXPORT_SYMBOL_GPL(pci_hp_deregister); 505 510 506 511 /** 507 512 * pci_hp_change_slot_info - changes the slot's information structure in the core ··· 524 527 525 528 return 0; 526 529 } 530 + EXPORT_SYMBOL_GPL(pci_hp_change_slot_info); 527 531 528 - static int __init pci_hotplug_init (void) 532 + static int __init pci_hotplug_init(void) 529 533 { 530 534 int result; 531 535 532 536 result = cpci_hotplug_init(debug); 533 537 if (result) { 534 - err ("cpci_hotplug_init with error %d\n", result); 535 - goto err_cpci; 538 + err("cpci_hotplug_init with error %d\n", result); 539 + return result; 536 540 } 537 541 538 - info (DRIVER_DESC " version: " DRIVER_VERSION "\n"); 539 - 540 - err_cpci: 542 + info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); 541 543 return result; 542 544 } 543 545 544 - static void __exit pci_hotplug_exit (void) 546 + static void __exit pci_hotplug_exit(void) 545 547 { 546 548 cpci_hotplug_exit(); 547 549 } ··· 553 557 MODULE_LICENSE("GPL"); 554 558 module_param(debug, bool, 0644); 555 559 MODULE_PARM_DESC(debug, "Debugging mode enabled or not"); 556 - 557 - EXPORT_SYMBOL_GPL(__pci_hp_register); 558 - EXPORT_SYMBOL_GPL(pci_hp_deregister); 559 - EXPORT_SYMBOL_GPL(pci_hp_change_slot_info);
+2 -2
drivers/pci/hotplug/pciehp_acpi.c
··· 103 103 } 104 104 105 105 static struct pcie_port_service_driver __initdata dummy_driver = { 106 - .name = "pciehp_dummy", 106 + .name = "pciehp_dummy", 107 107 .port_type = PCIE_ANY_PORT, 108 108 .service = PCIE_PORT_SERVICE_HP, 109 - .probe = dummy_probe, 109 + .probe = dummy_probe, 110 110 }; 111 111 112 112 static int __init select_detection_mode(void)
+3 -4
drivers/pci/hotplug/pciehp_core.c
··· 266 266 rc = init_slot(ctrl); 267 267 if (rc) { 268 268 if (rc == -EBUSY) 269 - ctrl_warn(ctrl, "Slot already registered by another " 270 - "hotplug driver\n"); 269 + ctrl_warn(ctrl, "Slot already registered by another hotplug driver\n"); 271 270 else 272 271 ctrl_err(ctrl, "Slot initialization failed\n"); 273 272 goto err_out_release_ctlr; ··· 311 312 } 312 313 313 314 #ifdef CONFIG_PM 314 - static int pciehp_suspend (struct pcie_device *dev) 315 + static int pciehp_suspend(struct pcie_device *dev) 315 316 { 316 317 return 0; 317 318 } 318 319 319 - static int pciehp_resume (struct pcie_device *dev) 320 + static int pciehp_resume(struct pcie_device *dev) 320 321 { 321 322 struct controller *ctrl; 322 323 struct slot *slot;
+7 -9
drivers/pci/hotplug/pciehp_ctrl.c
··· 175 175 hotplug controller logic 176 176 */ 177 177 178 - static void set_slot_off(struct controller *ctrl, struct slot * pslot) 178 + static void set_slot_off(struct controller *ctrl, struct slot *pslot) 179 179 { 180 180 /* turn off slot, turn on Amber LED, turn off Green LED if supported*/ 181 181 if (POWER_CTRL(ctrl)) { ··· 376 376 pciehp_get_power_status(p_slot, &getstatus); 377 377 if (getstatus) { 378 378 p_slot->state = BLINKINGOFF_STATE; 379 - ctrl_info(ctrl, 380 - "PCI slot #%s - powering off due to button " 381 - "press.\n", slot_name(p_slot)); 379 + ctrl_info(ctrl, "PCI slot #%s - powering off due to button press\n", 380 + slot_name(p_slot)); 382 381 } else { 383 382 p_slot->state = BLINKINGON_STATE; 384 - ctrl_info(ctrl, 385 - "PCI slot #%s - powering on due to button " 386 - "press.\n", slot_name(p_slot)); 383 + ctrl_info(ctrl, "PCI slot #%s - powering on due to button press\n", 384 + slot_name(p_slot)); 387 385 } 388 386 /* blink green LED and turn off amber */ 389 387 pciehp_green_led_blink(p_slot); ··· 402 404 else 403 405 pciehp_green_led_off(p_slot); 404 406 pciehp_set_attention_status(p_slot, 0); 405 - ctrl_info(ctrl, "PCI slot #%s - action canceled " 406 - "due to button press\n", slot_name(p_slot)); 407 + ctrl_info(ctrl, "PCI slot #%s - action canceled due to button press\n", 408 + slot_name(p_slot)); 407 409 p_slot->state = STATIC_STATE; 408 410 break; 409 411 case POWEROFF_STATE:
+24 -26
drivers/pci/hotplug/pciehp_hpc.c
··· 174 174 * event even though it supports none of power 175 175 * controller, attention led, power led and EMI. 176 176 */ 177 - ctrl_dbg(ctrl, "Unexpected CMD_COMPLETED. Need to " 178 - "wait for command completed event.\n"); 177 + ctrl_dbg(ctrl, "Unexpected CMD_COMPLETED. Need to wait for command completed event\n"); 179 178 ctrl->no_cmd_complete = 0; 180 179 } else { 181 - ctrl_dbg(ctrl, "Unexpected CMD_COMPLETED. Maybe " 182 - "the controller is broken.\n"); 180 + ctrl_dbg(ctrl, "Unexpected CMD_COMPLETED. Maybe the controller is broken\n"); 183 181 } 184 182 } 185 183 ··· 201 203 if (!(slot_ctrl & PCI_EXP_SLTCTL_HPIE) || 202 204 !(slot_ctrl & PCI_EXP_SLTCTL_CCIE)) 203 205 poll = 1; 204 - pcie_wait_cmd(ctrl, poll); 206 + pcie_wait_cmd(ctrl, poll); 205 207 } 206 208 mutex_unlock(&ctrl->ctrl_lock); 207 209 } ··· 274 276 bool found; 275 277 u16 lnk_status; 276 278 277 - /* 278 - * Data Link Layer Link Active Reporting must be capable for 279 - * hot-plug capable downstream port. But old controller might 280 - * not implement it. In this case, we wait for 1000 ms. 281 - */ 282 - if (ctrl->link_active_reporting) 283 - pcie_wait_link_active(ctrl); 284 - else 285 - msleep(1000); 279 + /* 280 + * Data Link Layer Link Active Reporting must be capable for 281 + * hot-plug capable downstream port. But old controller might 282 + * not implement it. In this case, we wait for 1000 ms. 283 + */ 284 + if (ctrl->link_active_reporting) 285 + pcie_wait_link_active(ctrl); 286 + else 287 + msleep(1000); 286 288 287 289 /* wait 100ms before read pci conf, and try in 1s */ 288 290 msleep(100); ··· 293 295 ctrl_dbg(ctrl, "%s: lnk_status = %x\n", __func__, lnk_status); 294 296 if ((lnk_status & PCI_EXP_LNKSTA_LT) || 295 297 !(lnk_status & PCI_EXP_LNKSTA_NLW)) { 296 - ctrl_err(ctrl, "Link Training Error occurs \n"); 298 + ctrl_err(ctrl, "Link Training Error occurs\n"); 297 299 return -1; 298 300 } 299 301 ··· 412 414 return; 413 415 414 416 switch (value) { 415 - case 0 : /* turn off */ 417 + case 0: /* turn off */ 416 418 slot_cmd = PCI_EXP_SLTCTL_ATTN_IND_OFF; 417 419 break; 418 420 case 1: /* turn on */ ··· 468 470 PCI_EXP_SLTCTL_PWR_IND_BLINK); 469 471 } 470 472 471 - int pciehp_power_on_slot(struct slot * slot) 473 + int pciehp_power_on_slot(struct slot *slot) 472 474 { 473 475 struct controller *ctrl = slot->ctrl; 474 476 struct pci_dev *pdev = ctrl_dev(ctrl); ··· 494 496 return retval; 495 497 } 496 498 497 - void pciehp_power_off_slot(struct slot * slot) 499 + void pciehp_power_off_slot(struct slot *slot) 498 500 { 499 501 struct controller *ctrl = slot->ctrl; 500 502 ··· 754 756 ctrl_info(ctrl, "Slot Control : 0x%04x\n", reg16); 755 757 } 756 758 757 - #define FLAG(x,y) (((x) & (y)) ? '+' : '-') 759 + #define FLAG(x, y) (((x) & (y)) ? '+' : '-') 758 760 759 761 struct controller *pcie_init(struct pcie_device *dev) 760 762 { ··· 781 783 */ 782 784 if (NO_CMD_CMPL(ctrl) || 783 785 !(POWER_CTRL(ctrl) | ATTN_LED(ctrl) | PWR_LED(ctrl) | EMI(ctrl))) 784 - ctrl->no_cmd_complete = 1; 786 + ctrl->no_cmd_complete = 1; 785 787 786 - /* Check if Data Link Layer Link Active Reporting is implemented */ 787 - pcie_capability_read_dword(pdev, PCI_EXP_LNKCAP, &link_cap); 788 - if (link_cap & PCI_EXP_LNKCAP_DLLLARC) { 789 - ctrl_dbg(ctrl, "Link Active Reporting supported\n"); 790 - ctrl->link_active_reporting = 1; 791 - } 788 + /* Check if Data Link Layer Link Active Reporting is implemented */ 789 + pcie_capability_read_dword(pdev, PCI_EXP_LNKCAP, &link_cap); 790 + if (link_cap & PCI_EXP_LNKCAP_DLLLARC) { 791 + ctrl_dbg(ctrl, "Link Active Reporting supported\n"); 792 + ctrl->link_active_reporting = 1; 793 + } 792 794 793 795 /* Clear all remaining event bits in Slot Status register */ 794 796 pcie_capability_write_word(pdev, PCI_EXP_SLTSTA,
+2 -3
drivers/pci/hotplug/pciehp_pci.c
··· 46 46 47 47 dev = pci_get_slot(parent, PCI_DEVFN(0, 0)); 48 48 if (dev) { 49 - ctrl_err(ctrl, "Device %s already exists " 50 - "at %04x:%02x:00, cannot hot-add\n", pci_name(dev), 51 - pci_domain_nr(parent), parent->number); 49 + ctrl_err(ctrl, "Device %s already exists at %04x:%02x:00, cannot hot-add\n", 50 + pci_name(dev), pci_domain_nr(parent), parent->number); 52 51 pci_dev_put(dev); 53 52 ret = -EEXIST; 54 53 goto out;
+18 -18
drivers/pci/hotplug/pcihp_skeleton.c
··· 51 51 #define dbg(format, arg...) \ 52 52 do { \ 53 53 if (debug) \ 54 - printk (KERN_DEBUG "%s: " format "\n", \ 54 + printk(KERN_DEBUG "%s: " format "\n", \ 55 55 MY_NAME , ## arg); \ 56 56 } while (0) 57 57 #define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME , ## arg) ··· 128 128 dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); 129 129 130 130 switch (status) { 131 - case 0: 132 - /* 133 - * Fill in code here to turn light off 134 - */ 135 - break; 131 + case 0: 132 + /* 133 + * Fill in code here to turn light off 134 + */ 135 + break; 136 136 137 - case 1: 138 - default: 139 - /* 140 - * Fill in code here to turn light on 141 - */ 142 - break; 137 + case 1: 138 + default: 139 + /* 140 + * Fill in code here to turn light on 141 + */ 142 + break; 143 143 } 144 144 145 145 return retval; ··· 153 153 dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); 154 154 155 155 switch (value) { 156 - case 0: 157 - /* Specify a test here */ 158 - break; 159 - case 1: 160 - /* Specify another test here */ 161 - break; 156 + case 0: 157 + /* Specify a test here */ 158 + break; 159 + case 1: 160 + /* Specify another test here */ 161 + break; 162 162 } 163 163 164 164 return retval;
+6 -7
drivers/pci/hotplug/rpaphp_core.c
··· 39 39 40 40 bool rpaphp_debug; 41 41 LIST_HEAD(rpaphp_slot_head); 42 + EXPORT_SYMBOL_GPL(rpaphp_slot_head); 42 43 43 44 #define DRIVER_VERSION "0.1" 44 45 #define DRIVER_AUTHOR "Linda Xie <lxie@us.ibm.com>" ··· 89 88 * @hotplug_slot: slot to get status 90 89 * @value: pointer to store status 91 90 */ 92 - static int get_power_status(struct hotplug_slot *hotplug_slot, u8 * value) 91 + static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) 93 92 { 94 93 int retval, level; 95 94 struct slot *slot = (struct slot *)hotplug_slot->private; ··· 105 104 * @hotplug_slot: slot to get status 106 105 * @value: pointer to store status 107 106 */ 108 - static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value) 107 + static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) 109 108 { 110 109 struct slot *slot = (struct slot *)hotplug_slot->private; 111 110 *value = slot->hotplug_slot->info->attention_status; 112 111 return 0; 113 112 } 114 113 115 - static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 * value) 114 + static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) 116 115 { 117 116 struct slot *slot = (struct slot *)hotplug_slot->private; 118 117 int rc, state; ··· 242 241 243 242 return -EINVAL; 244 243 } 244 + EXPORT_SYMBOL_GPL(rpaphp_get_drc_props); 245 245 246 246 static int is_php_type(char *drc_type) 247 247 { ··· 352 350 /* XXX FIXME: reports a failure only if last entry in loop failed */ 353 351 return retval; 354 352 } 353 + EXPORT_SYMBOL_GPL(rpaphp_add_slot); 355 354 356 355 static void __exit cleanup_slots(void) 357 356 { ··· 446 443 447 444 module_init(rpaphp_init); 448 445 module_exit(rpaphp_exit); 449 - 450 - EXPORT_SYMBOL_GPL(rpaphp_add_slot); 451 - EXPORT_SYMBOL_GPL(rpaphp_slot_head); 452 - EXPORT_SYMBOL_GPL(rpaphp_get_drc_props);
+12 -23
drivers/pci/hotplug/sgi_hotplug.c
··· 188 188 return 0; 189 189 } 190 190 191 - static struct hotplug_slot * sn_hp_destroy(void) 191 + static struct hotplug_slot *sn_hp_destroy(void) 192 192 { 193 193 struct slot *slot; 194 194 struct pci_slot *pci_slot; ··· 250 250 } 251 251 252 252 if (rc == PCI_L1_ERR) { 253 - dev_dbg(&slot->pci_bus->self->dev, 254 - "L1 failure %d with message: %s", 253 + dev_dbg(&slot->pci_bus->self->dev, "L1 failure %d with message: %s", 255 254 resp.resp_sub_errno, resp.resp_l1_msg); 256 255 return -EPERM; 257 256 } 258 257 259 258 if (rc) { 260 - dev_dbg(&slot->pci_bus->self->dev, 261 - "insert failed with error %d sub-error %d\n", 259 + dev_dbg(&slot->pci_bus->self->dev, "insert failed with error %d sub-error %d\n", 262 260 rc, resp.resp_sub_errno); 263 261 return -EIO; 264 262 } ··· 286 288 } 287 289 288 290 if ((action == PCI_REQ_SLOT_ELIGIBLE) && (rc == PCI_EMPTY_33MHZ)) { 289 - dev_dbg(&slot->pci_bus->self->dev, 290 - "Cannot remove last 33MHz card\n"); 291 + dev_dbg(&slot->pci_bus->self->dev, "Cannot remove last 33MHz card\n"); 291 292 return -EPERM; 292 293 } 293 294 294 295 if ((action == PCI_REQ_SLOT_ELIGIBLE) && (rc == PCI_L1_ERR)) { 295 - dev_dbg(&slot->pci_bus->self->dev, 296 - "L1 failure %d with message \n%s\n", 296 + dev_dbg(&slot->pci_bus->self->dev, "L1 failure %d with message \n%s\n", 297 297 resp.resp_sub_errno, resp.resp_l1_msg); 298 298 return -EPERM; 299 299 } 300 300 301 301 if ((action == PCI_REQ_SLOT_ELIGIBLE) && rc) { 302 - dev_dbg(&slot->pci_bus->self->dev, 303 - "remove failed with error %d sub-error %d\n", 302 + dev_dbg(&slot->pci_bus->self->dev, "remove failed with error %d sub-error %d\n", 304 303 rc, resp.resp_sub_errno); 305 304 return -EIO; 306 305 } ··· 412 417 phandle = acpi_device_handle(PCI_CONTROLLER(slot->pci_bus)->companion); 413 418 414 419 if (acpi_bus_get_device(phandle, &pdevice)) { 415 - dev_dbg(&slot->pci_bus->self->dev, 416 - "no parent device, assuming NULL\n"); 420 + dev_dbg(&slot->pci_bus->self->dev, "no parent device, assuming NULL\n"); 417 421 pdevice = NULL; 418 422 } 419 423 ··· 441 447 442 448 ret = acpi_bus_scan(chandle); 443 449 if (ACPI_FAILURE(ret)) { 444 - printk(KERN_ERR "%s: acpi_bus_scan " 445 - "failed (0x%x) for slot %d " 446 - "func %d\n", __func__, 447 - ret, (int)(adr>>16), 450 + printk(KERN_ERR "%s: acpi_bus_scan failed (0x%x) for slot %d func %d\n", 451 + __func__, ret, (int)(adr>>16), 448 452 (int)(adr&0xffff)); 449 453 /* try to continue on */ 450 454 } ··· 463 471 mutex_unlock(&sn_hotplug_mutex); 464 472 465 473 if (rc == 0) 466 - dev_dbg(&slot->pci_bus->self->dev, 467 - "insert operation successful\n"); 474 + dev_dbg(&slot->pci_bus->self->dev, "insert operation successful\n"); 468 475 else 469 - dev_dbg(&slot->pci_bus->self->dev, 470 - "insert operation failed rc = %d\n", rc); 476 + dev_dbg(&slot->pci_bus->self->dev, "insert operation failed rc = %d\n", rc); 471 477 472 478 return rc; 473 479 } ··· 551 561 acpi_status ret; 552 562 ret = acpi_unload_table_id(ssdt_id); 553 563 if (ACPI_FAILURE(ret)) { 554 - printk(KERN_ERR "%s: acpi_unload_table_id " 555 - "failed (0x%x) for id %d\n", 564 + printk(KERN_ERR "%s: acpi_unload_table_id failed (0x%x) for id %d\n", 556 565 __func__, ret, ssdt_id); 557 566 /* try to continue on */ 558 567 }
+2 -2
drivers/pci/hotplug/shpchp.h
··· 180 180 int shpchp_unconfigure_device(struct slot *p_slot); 181 181 void cleanup_slots(struct controller *ctrl); 182 182 void shpchp_queue_pushbutton_work(struct work_struct *work); 183 - int shpc_init( struct controller *ctrl, struct pci_dev *pdev); 183 + int shpc_init(struct controller *ctrl, struct pci_dev *pdev); 184 184 185 185 static inline const char *slot_name(struct slot *slot) 186 186 { ··· 295 295 pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, rse_set); 296 296 } 297 297 /* restore MiscII register */ 298 - pci_read_config_dword( p_slot->ctrl->pci_dev, PCIX_MISCII_OFFSET, &pcix_misc2_temp ); 298 + pci_read_config_dword(p_slot->ctrl->pci_dev, PCIX_MISCII_OFFSET, &pcix_misc2_temp ); 299 299 300 300 if (p_slot->ctrl->pcix_misc2_reg & SERRFATALENABLE_MASK) 301 301 pcix_misc2_temp |= SERRFATALENABLE_MASK;
+1 -2
drivers/pci/hotplug/shpchp_core.c
··· 143 143 snprintf(name, SLOT_NAME_SIZE, "%d", slot->number); 144 144 hotplug_slot->ops = &shpchp_hotplug_slot_ops; 145 145 146 - ctrl_dbg(ctrl, "Registering domain:bus:dev=%04x:%02x:%02x " 147 - "hp_slot=%x sun=%x slot_device_offset=%x\n", 146 + ctrl_dbg(ctrl, "Registering domain:bus:dev=%04x:%02x:%02x hp_slot=%x sun=%x slot_device_offset=%x\n", 148 147 pci_domain_nr(ctrl->pci_dev->subordinate), 149 148 slot->bus, slot->device, slot->hp_slot, slot->number, 150 149 ctrl->slot_device_offset);
+17 -19
drivers/pci/hotplug/shpchp_ctrl.c
··· 162 162 163 163 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 164 164 165 - if ( !(p_slot->hpc_ops->query_power_fault(p_slot))) { 165 + if (!(p_slot->hpc_ops->query_power_fault(p_slot))) { 166 166 /* 167 167 * Power fault Cleared 168 168 */ ··· 196 196 197 197 ctrl_dbg(ctrl, "Change speed to %d\n", speed); 198 198 if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, speed))) { 199 - ctrl_err(ctrl, "%s: Issue of set bus speed mode command " 200 - "failed\n", __func__); 199 + ctrl_err(ctrl, "%s: Issue of set bus speed mode command failed\n", 200 + __func__); 201 201 return WRONG_BUS_FREQUENCY; 202 202 } 203 203 return rc; ··· 215 215 */ 216 216 if (flag) { 217 217 if (asp < bsp) { 218 - ctrl_err(ctrl, "Speed of bus %x and adapter %x " 219 - "mismatch\n", bsp, asp); 218 + ctrl_err(ctrl, "Speed of bus %x and adapter %x mismatch\n", 219 + bsp, asp); 220 220 rc = WRONG_BUS_FREQUENCY; 221 221 } 222 222 return rc; ··· 250 250 251 251 hp_slot = p_slot->device - ctrl->slot_device_offset; 252 252 253 - ctrl_dbg(ctrl, 254 - "%s: p_slot->device, slot_offset, hp_slot = %d, %d ,%d\n", 253 + ctrl_dbg(ctrl, "%s: p_slot->device, slot_offset, hp_slot = %d, %d ,%d\n", 255 254 __func__, p_slot->device, ctrl->slot_device_offset, hp_slot); 256 255 257 256 /* Power on slot without connecting to bus */ ··· 262 263 263 264 if ((ctrl->pci_dev->vendor == 0x8086) && (ctrl->pci_dev->device == 0x0332)) { 264 265 if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, PCI_SPEED_33MHz))) { 265 - ctrl_err(ctrl, "%s: Issue of set bus speed mode command" 266 - " failed\n", __func__); 266 + ctrl_err(ctrl, "%s: Issue of set bus speed mode command failed\n", 267 + __func__); 267 268 return WRONG_BUS_FREQUENCY; 268 269 } 269 270 ··· 276 277 277 278 rc = p_slot->hpc_ops->get_adapter_speed(p_slot, &asp); 278 279 if (rc) { 279 - ctrl_err(ctrl, "Can't get adapter speed or " 280 - "bus mode mismatch\n"); 280 + ctrl_err(ctrl, "Can't get adapter speed or bus mode mismatch\n"); 281 281 return WRONG_BUS_FREQUENCY; 282 282 } 283 283 ··· 287 289 if (!list_empty(&ctrl->pci_dev->subordinate->devices)) 288 290 slots_not_empty = 1; 289 291 290 - ctrl_dbg(ctrl, "%s: slots_not_empty %d, adapter_speed %d, bus_speed %d," 291 - " max_bus_speed %d\n", __func__, slots_not_empty, asp, 292 + ctrl_dbg(ctrl, "%s: slots_not_empty %d, adapter_speed %d, bus_speed %d, max_bus_speed %d\n", 293 + __func__, slots_not_empty, asp, 292 294 bsp, msp); 293 295 294 296 rc = fix_bus_speed(ctrl, p_slot, slots_not_empty, asp, bsp, msp); ··· 488 490 p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 489 491 if (getstatus) { 490 492 p_slot->state = BLINKINGOFF_STATE; 491 - ctrl_info(ctrl, "PCI slot #%s - powering off due to " 492 - "button press.\n", slot_name(p_slot)); 493 + ctrl_info(ctrl, "PCI slot #%s - powering off due to button press\n", 494 + slot_name(p_slot)); 493 495 } else { 494 496 p_slot->state = BLINKINGON_STATE; 495 - ctrl_info(ctrl, "PCI slot #%s - powering on due to " 496 - "button press.\n", slot_name(p_slot)); 497 + ctrl_info(ctrl, "PCI slot #%s - powering on due to button press\n", 498 + slot_name(p_slot)); 497 499 } 498 500 /* blink green LED and turn off amber */ 499 501 p_slot->hpc_ops->green_led_blink(p_slot); ··· 516 518 else 517 519 p_slot->hpc_ops->green_led_off(p_slot); 518 520 p_slot->hpc_ops->set_attention_status(p_slot, 0); 519 - ctrl_info(ctrl, "PCI slot #%s - action canceled due to " 520 - "button press\n", slot_name(p_slot)); 521 + ctrl_info(ctrl, "PCI slot #%s - action canceled due to button press\n", 522 + slot_name(p_slot)); 521 523 p_slot->state = STATIC_STATE; 522 524 break; 523 525 case POWEROFF_STATE:
+13 -16
drivers/pci/hotplug/shpchp_hpc.c
··· 341 341 342 342 cmd_status = hpc_check_cmd_status(slot->ctrl); 343 343 if (cmd_status) { 344 - ctrl_err(ctrl, 345 - "Failed to issued command 0x%x (error code = %d)\n", 344 + ctrl_err(ctrl, "Failed to issued command 0x%x (error code = %d)\n", 346 345 cmd, cmd_status); 347 346 retval = -EIO; 348 347 } ··· 403 404 return 0; 404 405 } 405 406 406 - static int hpc_get_power_status(struct slot * slot, u8 *status) 407 + static int hpc_get_power_status(struct slot *slot, u8 *status) 407 408 { 408 409 struct controller *ctrl = slot->ctrl; 409 410 u32 slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot)); ··· 527 528 return retval; 528 529 } 529 530 530 - static int hpc_query_power_fault(struct slot * slot) 531 + static int hpc_query_power_fault(struct slot *slot) 531 532 { 532 533 struct controller *ctrl = slot->ctrl; 533 534 u32 slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot)); ··· 613 614 release_mem_region(ctrl->mmio_base, ctrl->mmio_size); 614 615 } 615 616 616 - static int hpc_power_on_slot(struct slot * slot) 617 + static int hpc_power_on_slot(struct slot *slot) 617 618 { 618 619 int retval; 619 620 ··· 624 625 return retval; 625 626 } 626 627 627 - static int hpc_slot_enable(struct slot * slot) 628 + static int hpc_slot_enable(struct slot *slot) 628 629 { 629 630 int retval; 630 631 ··· 637 638 return retval; 638 639 } 639 640 640 - static int hpc_slot_disable(struct slot * slot) 641 + static int hpc_slot_disable(struct slot *slot) 641 642 { 642 643 int retval; 643 644 ··· 719 720 } 720 721 721 722 722 - static int hpc_set_bus_speed_mode(struct slot * slot, enum pci_bus_speed value) 723 + static int hpc_set_bus_speed_mode(struct slot *slot, enum pci_bus_speed value) 723 724 { 724 725 int retval; 725 726 struct controller *ctrl = slot->ctrl; ··· 973 974 for (i = 0; i < 9 + num_slots; i++) { 974 975 rc = shpc_indirect_read(ctrl, i, &tempdword); 975 976 if (rc) { 976 - ctrl_err(ctrl, 977 - "Cannot read creg (index = %d)\n", i); 977 + ctrl_err(ctrl, "Cannot read creg (index = %d)\n", 978 + i); 978 979 goto abort; 979 980 } 980 981 ctrl_dbg(ctrl, " offset %d: value %x\n", i, tempdword); ··· 1059 1060 /* Installs the interrupt handler */ 1060 1061 rc = pci_enable_msi(pdev); 1061 1062 if (rc) { 1062 - ctrl_info(ctrl, 1063 - "Can't get msi for the hotplug controller\n"); 1064 - ctrl_info(ctrl, 1065 - "Use INTx for the hotplug controller\n"); 1063 + ctrl_info(ctrl, "Can't get msi for the hotplug controller\n"); 1064 + ctrl_info(ctrl, "Use INTx for the hotplug controller\n"); 1066 1065 } 1067 1066 1068 1067 rc = request_irq(ctrl->pci_dev->irq, shpc_isr, IRQF_SHARED, ··· 1068 1071 ctrl_dbg(ctrl, "request_irq %d (returns %d)\n", 1069 1072 ctrl->pci_dev->irq, rc); 1070 1073 if (rc) { 1071 - ctrl_err(ctrl, "Can't get irq %d for the hotplug " 1072 - "controller\n", ctrl->pci_dev->irq); 1074 + ctrl_err(ctrl, "Can't get irq %d for the hotplug controller\n", 1075 + ctrl->pci_dev->irq); 1073 1076 goto abort_iounmap; 1074 1077 } 1075 1078 }
+3 -3
drivers/pci/hotplug/shpchp_pci.c
··· 46 46 47 47 dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, 0)); 48 48 if (dev) { 49 - ctrl_err(ctrl, "Device %s already exists " 50 - "at %04x:%02x:%02x, cannot hot-add\n", pci_name(dev), 51 - pci_domain_nr(parent), p_slot->bus, p_slot->device); 49 + ctrl_err(ctrl, "Device %s already exists at %04x:%02x:%02x, cannot hot-add\n", 50 + pci_name(dev), pci_domain_nr(parent), 51 + p_slot->bus, p_slot->device); 52 52 pci_dev_put(dev); 53 53 ret = -EINVAL; 54 54 goto out;
+1 -1
drivers/pci/hotplug/shpchp_sysfs.c
··· 38 38 static ssize_t show_ctrl (struct device *dev, struct device_attribute *attr, char *buf) 39 39 { 40 40 struct pci_dev *pdev; 41 - char * out = buf; 41 + char *out = buf; 42 42 int index, busnr; 43 43 struct resource *res; 44 44 struct pci_bus *bus;
+3 -4
drivers/pci/htirq.c
··· 102 102 spin_unlock_irqrestore(&ht_irq_lock, flags); 103 103 104 104 max_irq = (data >> 16) & 0xff; 105 - if ( idx > max_irq) 105 + if (idx > max_irq) 106 106 return -EINVAL; 107 107 108 108 cfg = kmalloc(sizeof(*cfg), GFP_KERNEL); ··· 131 131 132 132 return irq; 133 133 } 134 + EXPORT_SYMBOL(__ht_create_irq); 134 135 135 136 /** 136 137 * ht_create_irq - create an irq and attach it to a device. ··· 147 146 { 148 147 return __ht_create_irq(dev, idx, NULL); 149 148 } 149 + EXPORT_SYMBOL(ht_create_irq); 150 150 151 151 /** 152 152 * ht_destroy_irq - destroy an irq created with ht_create_irq ··· 167 165 168 166 kfree(cfg); 169 167 } 170 - 171 - EXPORT_SYMBOL(__ht_create_irq); 172 - EXPORT_SYMBOL(ht_create_irq); 173 168 EXPORT_SYMBOL(ht_destroy_irq);
+2 -3
drivers/pci/msi.c
··· 413 413 if (dev->msi_irq_groups) { 414 414 sysfs_remove_groups(&dev->dev.kobj, dev->msi_irq_groups); 415 415 msi_attrs = dev->msi_irq_groups[0]->attrs; 416 - list_for_each_entry(entry, &dev->msi_list, list) { 416 + while (msi_attrs[count]) { 417 417 dev_attr = container_of(msi_attrs[count], 418 418 struct device_attribute, attr); 419 419 kfree(dev_attr->attr.name); ··· 980 980 981 981 /* Check whether driver already requested for MSI irq */ 982 982 if (dev->msi_enabled) { 983 - dev_info(&dev->dev, "can't enable MSI-X " 984 - "(MSI IRQ already assigned)\n"); 983 + dev_info(&dev->dev, "can't enable MSI-X (MSI IRQ already assigned)\n"); 985 984 return -EINVAL; 986 985 } 987 986 status = msix_capability_init(dev, entries, nvec);
+32 -37
drivers/pci/pci-driver.c
··· 77 77 78 78 return retval; 79 79 } 80 + EXPORT_SYMBOL_GPL(pci_add_dynid); 80 81 81 82 static void pci_free_dynids(struct pci_driver *drv) 82 83 { ··· 99 98 * 100 99 * Allow PCI IDs to be added to an existing driver via sysfs. 101 100 */ 102 - static ssize_t 103 - store_new_id(struct device_driver *driver, const char *buf, size_t count) 101 + static ssize_t store_new_id(struct device_driver *driver, const char *buf, 102 + size_t count) 104 103 { 105 104 struct pci_driver *pdrv = to_pci_driver(driver); 106 105 const struct pci_device_id *ids = pdrv->id_table; 107 - __u32 vendor, device, subvendor=PCI_ANY_ID, 108 - subdevice=PCI_ANY_ID, class=0, class_mask=0; 109 - unsigned long driver_data=0; 110 - int fields=0; 106 + __u32 vendor, device, subvendor = PCI_ANY_ID, 107 + subdevice = PCI_ANY_ID, class = 0, class_mask = 0; 108 + unsigned long driver_data = 0; 109 + int fields = 0; 111 110 int retval = 0; 112 111 113 112 fields = sscanf(buf, "%x %x %x %x %x %x %lx", ··· 167 166 * 168 167 * Removes a dynamic pci device ID to this driver. 169 168 */ 170 - static ssize_t 171 - store_remove_id(struct device_driver *driver, const char *buf, size_t count) 169 + static ssize_t store_remove_id(struct device_driver *driver, const char *buf, 170 + size_t count) 172 171 { 173 172 struct pci_dynid *dynid, *n; 174 173 struct pci_driver *pdrv = to_pci_driver(driver); ··· 236 235 } 237 236 return NULL; 238 237 } 238 + EXPORT_SYMBOL(pci_match_id); 239 239 240 240 static const struct pci_device_id pci_device_id_any = { 241 241 .vendor = PCI_ANY_ID, ··· 374 372 * returns 0 on success, else error. 375 373 * side-effect: pci_dev->driver is set to drv when drv claims pci_dev. 376 374 */ 377 - static int 378 - __pci_device_probe(struct pci_driver *drv, struct pci_dev *pci_dev) 375 + static int __pci_device_probe(struct pci_driver *drv, struct pci_dev *pci_dev) 379 376 { 380 377 const struct pci_device_id *id; 381 378 int error = 0; ··· 391 390 return error; 392 391 } 393 392 394 - static int pci_device_probe(struct device * dev) 393 + static int pci_device_probe(struct device *dev) 395 394 { 396 395 int error = 0; 397 396 struct pci_driver *drv; ··· 407 406 return error; 408 407 } 409 408 410 - static int pci_device_remove(struct device * dev) 409 + static int pci_device_remove(struct device *dev) 411 410 { 412 - struct pci_dev * pci_dev = to_pci_dev(dev); 413 - struct pci_driver * drv = pci_dev->driver; 411 + struct pci_dev *pci_dev = to_pci_dev(dev); 412 + struct pci_driver *drv = pci_dev->driver; 414 413 415 414 if (drv) { 416 415 if (drv->remove) { ··· 538 537 539 538 static int pci_legacy_suspend(struct device *dev, pm_message_t state) 540 539 { 541 - struct pci_dev * pci_dev = to_pci_dev(dev); 542 - struct pci_driver * drv = pci_dev->driver; 540 + struct pci_dev *pci_dev = to_pci_dev(dev); 541 + struct pci_driver *drv = pci_dev->driver; 543 542 544 543 if (drv && drv->suspend) { 545 544 pci_power_t prev = pci_dev->current_state; ··· 565 564 566 565 static int pci_legacy_suspend_late(struct device *dev, pm_message_t state) 567 566 { 568 - struct pci_dev * pci_dev = to_pci_dev(dev); 569 - struct pci_driver * drv = pci_dev->driver; 567 + struct pci_dev *pci_dev = to_pci_dev(dev); 568 + struct pci_driver *drv = pci_dev->driver; 570 569 571 570 if (drv && drv->suspend_late) { 572 571 pci_power_t prev = pci_dev->current_state; ··· 596 595 597 596 static int pci_legacy_resume_early(struct device *dev) 598 597 { 599 - struct pci_dev * pci_dev = to_pci_dev(dev); 600 - struct pci_driver * drv = pci_dev->driver; 598 + struct pci_dev *pci_dev = to_pci_dev(dev); 599 + struct pci_driver *drv = pci_dev->driver; 601 600 602 601 return drv && drv->resume_early ? 603 602 drv->resume_early(pci_dev) : 0; ··· 605 604 606 605 static int pci_legacy_resume(struct device *dev) 607 606 { 608 - struct pci_dev * pci_dev = to_pci_dev(dev); 609 - struct pci_driver * drv = pci_dev->driver; 607 + struct pci_dev *pci_dev = to_pci_dev(dev); 608 + struct pci_driver *drv = pci_dev->driver; 610 609 611 610 pci_fixup_device(pci_fixup_resume, pci_dev); 612 611 ··· 1256 1255 /* register with core */ 1257 1256 return driver_register(&drv->driver); 1258 1257 } 1258 + EXPORT_SYMBOL(__pci_register_driver); 1259 1259 1260 1260 /** 1261 1261 * pci_unregister_driver - unregister a pci driver ··· 1268 1266 * driverless. 1269 1267 */ 1270 1268 1271 - void 1272 - pci_unregister_driver(struct pci_driver *drv) 1269 + void pci_unregister_driver(struct pci_driver *drv) 1273 1270 { 1274 1271 driver_unregister(&drv->driver); 1275 1272 pci_free_dynids(drv); 1276 1273 } 1274 + EXPORT_SYMBOL(pci_unregister_driver); 1277 1275 1278 1276 static struct pci_driver pci_compat_driver = { 1279 1277 .name = "compat" ··· 1286 1284 * Returns the appropriate pci_driver structure or %NULL if there is no 1287 1285 * registered driver for the device. 1288 1286 */ 1289 - struct pci_driver * 1290 - pci_dev_driver(const struct pci_dev *dev) 1287 + struct pci_driver *pci_dev_driver(const struct pci_dev *dev) 1291 1288 { 1292 1289 if (dev->driver) 1293 1290 return dev->driver; 1294 1291 else { 1295 1292 int i; 1296 - for(i=0; i<=PCI_ROM_RESOURCE; i++) 1293 + for (i = 0; i <= PCI_ROM_RESOURCE; i++) 1297 1294 if (dev->resource[i].flags & IORESOURCE_BUSY) 1298 1295 return &pci_compat_driver; 1299 1296 } 1300 1297 return NULL; 1301 1298 } 1299 + EXPORT_SYMBOL(pci_dev_driver); 1302 1300 1303 1301 /** 1304 1302 * pci_bus_match - Tell if a PCI device structure has a matching PCI device id structure ··· 1344 1342 get_device(&dev->dev); 1345 1343 return dev; 1346 1344 } 1345 + EXPORT_SYMBOL(pci_dev_get); 1347 1346 1348 1347 /** 1349 1348 * pci_dev_put - release a use of the pci device structure ··· 1358 1355 if (dev) 1359 1356 put_device(&dev->dev); 1360 1357 } 1358 + EXPORT_SYMBOL(pci_dev_put); 1361 1359 1362 1360 static int pci_uevent(struct device *dev, struct kobj_uevent_env *env) 1363 1361 { ··· 1404 1400 .drv_groups = pci_drv_groups, 1405 1401 .pm = PCI_PM_OPS_PTR, 1406 1402 }; 1403 + EXPORT_SYMBOL(pci_bus_type); 1407 1404 1408 1405 static int __init pci_driver_init(void) 1409 1406 { 1410 1407 return bus_register(&pci_bus_type); 1411 1408 } 1412 - 1413 1409 postcore_initcall(pci_driver_init); 1414 - 1415 - EXPORT_SYMBOL_GPL(pci_add_dynid); 1416 - EXPORT_SYMBOL(pci_match_id); 1417 - EXPORT_SYMBOL(__pci_register_driver); 1418 - EXPORT_SYMBOL(pci_unregister_driver); 1419 - EXPORT_SYMBOL(pci_dev_driver); 1420 - EXPORT_SYMBOL(pci_bus_type); 1421 - EXPORT_SYMBOL(pci_dev_get); 1422 - EXPORT_SYMBOL(pci_dev_put);
+26 -39
drivers/pci/pci-label.c
··· 40 40 SMBIOS_ATTR_INSTANCE_SHOW, 41 41 }; 42 42 43 - static size_t 44 - find_smbios_instance_string(struct pci_dev *pdev, char *buf, 45 - enum smbios_attr_enum attribute) 43 + static size_t find_smbios_instance_string(struct pci_dev *pdev, char *buf, 44 + enum smbios_attr_enum attribute) 46 45 { 47 46 const struct dmi_device *dmi; 48 47 struct dmi_dev_onboard *donboard; ··· 73 74 return 0; 74 75 } 75 76 76 - static umode_t 77 - smbios_instance_string_exist(struct kobject *kobj, struct attribute *attr, 78 - int n) 77 + static umode_t smbios_instance_string_exist(struct kobject *kobj, 78 + struct attribute *attr, int n) 79 79 { 80 80 struct device *dev; 81 81 struct pci_dev *pdev; ··· 86 88 S_IRUGO : 0; 87 89 } 88 90 89 - static ssize_t 90 - smbioslabel_show(struct device *dev, struct device_attribute *attr, char *buf) 91 + static ssize_t smbioslabel_show(struct device *dev, 92 + struct device_attribute *attr, char *buf) 91 93 { 92 94 struct pci_dev *pdev; 93 95 pdev = to_pci_dev(dev); ··· 96 98 SMBIOS_ATTR_LABEL_SHOW); 97 99 } 98 100 99 - static ssize_t 100 - smbiosinstance_show(struct device *dev, 101 - struct device_attribute *attr, char *buf) 101 + static ssize_t smbiosinstance_show(struct device *dev, 102 + struct device_attribute *attr, char *buf) 102 103 { 103 104 struct pci_dev *pdev; 104 105 pdev = to_pci_dev(dev); ··· 127 130 .is_visible = smbios_instance_string_exist, 128 131 }; 129 132 130 - static int 131 - pci_create_smbiosname_file(struct pci_dev *pdev) 133 + static int pci_create_smbiosname_file(struct pci_dev *pdev) 132 134 { 133 135 return sysfs_create_group(&pdev->dev.kobj, &smbios_attr_group); 134 136 } 135 137 136 - static void 137 - pci_remove_smbiosname_file(struct pci_dev *pdev) 138 + static void pci_remove_smbiosname_file(struct pci_dev *pdev) 138 139 { 139 140 sysfs_remove_group(&pdev->dev.kobj, &smbios_attr_group); 140 141 } 141 142 #else 142 - static inline int 143 - pci_create_smbiosname_file(struct pci_dev *pdev) 143 + static inline int pci_create_smbiosname_file(struct pci_dev *pdev) 144 144 { 145 145 return -1; 146 146 } 147 147 148 - static inline void 149 - pci_remove_smbiosname_file(struct pci_dev *pdev) 148 + static inline void pci_remove_smbiosname_file(struct pci_dev *pdev) 150 149 { 151 150 } 152 151 #endif ··· 168 175 buf[len] = '\n'; 169 176 } 170 177 171 - static int 172 - dsm_get_label(struct device *dev, char *buf, enum acpi_attr_enum attr) 178 + static int dsm_get_label(struct device *dev, char *buf, 179 + enum acpi_attr_enum attr) 173 180 { 174 181 acpi_handle handle; 175 182 union acpi_object *obj, *tmp; ··· 205 212 return len; 206 213 } 207 214 208 - static bool 209 - device_has_dsm(struct device *dev) 215 + static bool device_has_dsm(struct device *dev) 210 216 { 211 217 acpi_handle handle; 212 218 ··· 217 225 1 << DEVICE_LABEL_DSM); 218 226 } 219 227 220 - static umode_t 221 - acpi_index_string_exist(struct kobject *kobj, struct attribute *attr, int n) 228 + static umode_t acpi_index_string_exist(struct kobject *kobj, 229 + struct attribute *attr, int n) 222 230 { 223 231 struct device *dev; 224 232 ··· 230 238 return 0; 231 239 } 232 240 233 - static ssize_t 234 - acpilabel_show(struct device *dev, struct device_attribute *attr, char *buf) 241 + static ssize_t acpilabel_show(struct device *dev, 242 + struct device_attribute *attr, char *buf) 235 243 { 236 244 return dsm_get_label(dev, buf, ACPI_ATTR_LABEL_SHOW); 237 245 } 238 246 239 - static ssize_t 240 - acpiindex_show(struct device *dev, struct device_attribute *attr, char *buf) 247 + static ssize_t acpiindex_show(struct device *dev, 248 + struct device_attribute *attr, char *buf) 241 249 { 242 250 return dsm_get_label(dev, buf, ACPI_ATTR_INDEX_SHOW); 243 251 } ··· 263 271 .is_visible = acpi_index_string_exist, 264 272 }; 265 273 266 - static int 267 - pci_create_acpi_index_label_files(struct pci_dev *pdev) 274 + static int pci_create_acpi_index_label_files(struct pci_dev *pdev) 268 275 { 269 276 return sysfs_create_group(&pdev->dev.kobj, &acpi_attr_group); 270 277 } 271 278 272 - static int 273 - pci_remove_acpi_index_label_files(struct pci_dev *pdev) 279 + static int pci_remove_acpi_index_label_files(struct pci_dev *pdev) 274 280 { 275 281 sysfs_remove_group(&pdev->dev.kobj, &acpi_attr_group); 276 282 return 0; 277 283 } 278 284 #else 279 - static inline int 280 - pci_create_acpi_index_label_files(struct pci_dev *pdev) 285 + static inline int pci_create_acpi_index_label_files(struct pci_dev *pdev) 281 286 { 282 287 return -1; 283 288 } 284 289 285 - static inline int 286 - pci_remove_acpi_index_label_files(struct pci_dev *pdev) 290 + static inline int pci_remove_acpi_index_label_files(struct pci_dev *pdev) 287 291 { 288 292 return -1; 289 293 } 290 294 291 - static inline bool 292 - device_has_dsm(struct device *dev) 295 + static inline bool device_has_dsm(struct device *dev) 293 296 { 294 297 return false; 295 298 }
+1 -1
drivers/pci/pci-stub.c
··· 55 55 p = ids; 56 56 while ((id = strsep(&p, ","))) { 57 57 unsigned int vendor, device, subvendor = PCI_ANY_ID, 58 - subdevice = PCI_ANY_ID, class=0, class_mask=0; 58 + subdevice = PCI_ANY_ID, class = 0, class_mask = 0; 59 59 int fields; 60 60 61 61 if (!strlen(id))
+135 -164
drivers/pci/pci-sysfs.c
··· 41 41 { \ 42 42 struct pci_dev *pdev; \ 43 43 \ 44 - pdev = to_pci_dev (dev); \ 45 - return sprintf (buf, format_string, pdev->field); \ 44 + pdev = to_pci_dev(dev); \ 45 + return sprintf(buf, format_string, pdev->field); \ 46 46 } \ 47 47 static DEVICE_ATTR_RO(field) 48 48 ··· 58 58 char *buf) 59 59 { 60 60 struct pci_dev *pdev = to_pci_dev(dev); 61 - return sprintf (buf, "%u\n", pdev->broken_parity_status); 61 + return sprintf(buf, "%u\n", pdev->broken_parity_status); 62 62 } 63 63 64 64 static ssize_t broken_parity_status_store(struct device *dev, ··· 77 77 } 78 78 static DEVICE_ATTR_RW(broken_parity_status); 79 79 80 - static ssize_t pci_dev_show_local_cpu(struct device *dev, 81 - int type, 82 - struct device_attribute *attr, 83 - char *buf) 80 + static ssize_t pci_dev_show_local_cpu(struct device *dev, int type, 81 + struct device_attribute *attr, char *buf) 84 82 { 85 83 const struct cpumask *mask; 86 84 int len; ··· 99 101 } 100 102 101 103 static ssize_t local_cpus_show(struct device *dev, 102 - struct device_attribute *attr, char *buf) 104 + struct device_attribute *attr, char *buf) 103 105 { 104 106 return pci_dev_show_local_cpu(dev, 1, attr, buf); 105 107 } 106 108 static DEVICE_ATTR_RO(local_cpus); 107 109 108 110 static ssize_t local_cpulist_show(struct device *dev, 109 - struct device_attribute *attr, char *buf) 111 + struct device_attribute *attr, char *buf) 110 112 { 111 113 return pci_dev_show_local_cpu(dev, 0, attr, buf); 112 114 } ··· 115 117 /* 116 118 * PCI Bus Class Devices 117 119 */ 118 - static ssize_t pci_bus_show_cpuaffinity(struct device *dev, 119 - int type, 120 + static ssize_t pci_bus_show_cpuaffinity(struct device *dev, int type, 120 121 struct device_attribute *attr, 121 122 char *buf) 122 123 { ··· 146 149 static DEVICE_ATTR_RO(cpulistaffinity); 147 150 148 151 /* show resources */ 149 - static ssize_t 150 - resource_show(struct device * dev, struct device_attribute *attr, char * buf) 152 + static ssize_t resource_show(struct device *dev, struct device_attribute *attr, 153 + char *buf) 151 154 { 152 - struct pci_dev * pci_dev = to_pci_dev(dev); 153 - char * str = buf; 155 + struct pci_dev *pci_dev = to_pci_dev(dev); 156 + char *str = buf; 154 157 int i; 155 158 int max; 156 159 resource_size_t start, end; ··· 163 166 for (i = 0; i < max; i++) { 164 167 struct resource *res = &pci_dev->resource[i]; 165 168 pci_resource_to_user(pci_dev, i, res, &start, &end); 166 - str += sprintf(str,"0x%016llx 0x%016llx 0x%016llx\n", 169 + str += sprintf(str, "0x%016llx 0x%016llx 0x%016llx\n", 167 170 (unsigned long long)start, 168 171 (unsigned long long)end, 169 172 (unsigned long long)res->flags); ··· 172 175 } 173 176 static DEVICE_ATTR_RO(resource); 174 177 175 - static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf) 178 + static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, 179 + char *buf) 176 180 { 177 181 struct pci_dev *pci_dev = to_pci_dev(dev); 178 182 ··· 185 187 } 186 188 static DEVICE_ATTR_RO(modalias); 187 189 188 - static ssize_t enabled_store(struct device *dev, 189 - struct device_attribute *attr, const char *buf, 190 - size_t count) 190 + static ssize_t enabled_store(struct device *dev, struct device_attribute *attr, 191 + const char *buf, size_t count) 191 192 { 192 193 struct pci_dev *pdev = to_pci_dev(dev); 193 194 unsigned long val; ··· 210 213 return result < 0 ? result : count; 211 214 } 212 215 213 - static ssize_t enabled_show(struct device *dev, 214 - struct device_attribute *attr, char *buf) 216 + static ssize_t enabled_show(struct device *dev, struct device_attribute *attr, 217 + char *buf) 215 218 { 216 219 struct pci_dev *pdev; 217 220 218 - pdev = to_pci_dev (dev); 219 - return sprintf (buf, "%u\n", atomic_read(&pdev->enable_cnt)); 221 + pdev = to_pci_dev(dev); 222 + return sprintf(buf, "%u\n", atomic_read(&pdev->enable_cnt)); 220 223 } 221 224 static DEVICE_ATTR_RW(enabled); 222 225 223 226 #ifdef CONFIG_NUMA 224 - static ssize_t 225 - numa_node_show(struct device *dev, struct device_attribute *attr, char *buf) 227 + static ssize_t numa_node_show(struct device *dev, struct device_attribute *attr, 228 + char *buf) 226 229 { 227 - return sprintf (buf, "%d\n", dev->numa_node); 230 + return sprintf(buf, "%d\n", dev->numa_node); 228 231 } 229 232 static DEVICE_ATTR_RO(numa_node); 230 233 #endif 231 234 232 - static ssize_t 233 - dma_mask_bits_show(struct device *dev, struct device_attribute *attr, char *buf) 235 + static ssize_t dma_mask_bits_show(struct device *dev, 236 + struct device_attribute *attr, char *buf) 234 237 { 235 238 struct pci_dev *pdev = to_pci_dev(dev); 236 239 237 - return sprintf (buf, "%d\n", fls64(pdev->dma_mask)); 240 + return sprintf(buf, "%d\n", fls64(pdev->dma_mask)); 238 241 } 239 242 static DEVICE_ATTR_RO(dma_mask_bits); 240 243 241 - static ssize_t 242 - consistent_dma_mask_bits_show(struct device *dev, struct device_attribute *attr, 243 - char *buf) 244 + static ssize_t consistent_dma_mask_bits_show(struct device *dev, 245 + struct device_attribute *attr, 246 + char *buf) 244 247 { 245 - return sprintf (buf, "%d\n", fls64(dev->coherent_dma_mask)); 248 + return sprintf(buf, "%d\n", fls64(dev->coherent_dma_mask)); 246 249 } 247 250 static DEVICE_ATTR_RO(consistent_dma_mask_bits); 248 251 249 - static ssize_t 250 - msi_bus_show(struct device *dev, struct device_attribute *attr, char *buf) 252 + static ssize_t msi_bus_show(struct device *dev, struct device_attribute *attr, 253 + char *buf) 251 254 { 252 255 struct pci_dev *pdev = to_pci_dev(dev); 253 256 254 257 if (!pdev->subordinate) 255 258 return 0; 256 259 257 - return sprintf (buf, "%u\n", 258 - !(pdev->subordinate->bus_flags & PCI_BUS_FLAGS_NO_MSI)); 260 + return sprintf(buf, "%u\n", 261 + !(pdev->subordinate->bus_flags & PCI_BUS_FLAGS_NO_MSI)); 259 262 } 260 263 261 - static ssize_t 262 - msi_bus_store(struct device *dev, struct device_attribute *attr, 263 - const char *buf, size_t count) 264 + static ssize_t msi_bus_store(struct device *dev, struct device_attribute *attr, 265 + const char *buf, size_t count) 264 266 { 265 267 struct pci_dev *pdev = to_pci_dev(dev); 266 268 unsigned long val; ··· 286 290 !!val) { 287 291 pdev->subordinate->bus_flags ^= PCI_BUS_FLAGS_NO_MSI; 288 292 289 - dev_warn(&pdev->dev, "forced subordinate bus to%s support MSI," 290 - " bad things could happen\n", val ? "" : " not"); 293 + dev_warn(&pdev->dev, "forced subordinate bus to%s support MSI, bad things could happen\n", 294 + val ? "" : " not"); 291 295 } 292 296 293 297 return count; ··· 327 331 NULL, 328 332 }; 329 333 330 - static ssize_t 331 - dev_rescan_store(struct device *dev, struct device_attribute *attr, 332 - const char *buf, size_t count) 334 + static ssize_t dev_rescan_store(struct device *dev, 335 + struct device_attribute *attr, const char *buf, 336 + size_t count) 333 337 { 334 338 unsigned long val; 335 339 struct pci_dev *pdev = to_pci_dev(dev); ··· 348 352 (S_IWUSR|S_IWGRP), 349 353 NULL, dev_rescan_store); 350 354 351 - static ssize_t 352 - remove_store(struct device *dev, struct device_attribute *attr, 353 - const char *buf, size_t count) 355 + static ssize_t remove_store(struct device *dev, struct device_attribute *attr, 356 + const char *buf, size_t count) 354 357 { 355 358 unsigned long val; 356 359 ··· 364 369 (S_IWUSR|S_IWGRP), 365 370 NULL, remove_store); 366 371 367 - static ssize_t 368 - dev_bus_rescan_store(struct device *dev, struct device_attribute *attr, 369 - const char *buf, size_t count) 372 + static ssize_t dev_bus_rescan_store(struct device *dev, 373 + struct device_attribute *attr, 374 + const char *buf, size_t count) 370 375 { 371 376 unsigned long val; 372 377 struct pci_bus *bus = to_pci_bus(dev); ··· 407 412 struct device_attribute *attr, char *buf) 408 413 { 409 414 struct pci_dev *pdev = to_pci_dev(dev); 410 - return sprintf (buf, "%u\n", pdev->d3cold_allowed); 415 + return sprintf(buf, "%u\n", pdev->d3cold_allowed); 411 416 } 412 417 static DEVICE_ATTR_RW(d3cold_allowed); 413 418 #endif ··· 602 607 NULL, 603 608 }; 604 609 605 - static ssize_t 606 - boot_vga_show(struct device *dev, struct device_attribute *attr, char *buf) 610 + static ssize_t boot_vga_show(struct device *dev, struct device_attribute *attr, 611 + char *buf) 607 612 { 608 613 struct pci_dev *pdev = to_pci_dev(dev); 609 614 struct pci_dev *vga_dev = vga_default_device(); ··· 617 622 } 618 623 static struct device_attribute vga_attr = __ATTR_RO(boot_vga); 619 624 620 - static ssize_t 621 - pci_read_config(struct file *filp, struct kobject *kobj, 622 - struct bin_attribute *bin_attr, 623 - char *buf, loff_t off, size_t count) 625 + static ssize_t pci_read_config(struct file *filp, struct kobject *kobj, 626 + struct bin_attribute *bin_attr, char *buf, 627 + loff_t off, size_t count) 624 628 { 625 - struct pci_dev *dev = to_pci_dev(container_of(kobj,struct device,kobj)); 629 + struct pci_dev *dev = to_pci_dev(container_of(kobj, struct device, 630 + kobj)); 626 631 unsigned int size = 64; 627 632 loff_t init_off = off; 628 - u8 *data = (u8*) buf; 633 + u8 *data = (u8 *) buf; 629 634 630 635 /* Several chips lock up trying to read undefined config space */ 631 - if (security_capable(filp->f_cred, &init_user_ns, CAP_SYS_ADMIN) == 0) { 636 + if (security_capable(filp->f_cred, &init_user_ns, CAP_SYS_ADMIN) == 0) 632 637 size = dev->cfg_size; 633 - } else if (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) { 638 + else if (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) 634 639 size = 128; 635 - } 636 640 637 641 if (off > size) 638 642 return 0; ··· 694 700 return count; 695 701 } 696 702 697 - static ssize_t 698 - pci_write_config(struct file* filp, struct kobject *kobj, 699 - struct bin_attribute *bin_attr, 700 - char *buf, loff_t off, size_t count) 703 + static ssize_t pci_write_config(struct file *filp, struct kobject *kobj, 704 + struct bin_attribute *bin_attr, char *buf, 705 + loff_t off, size_t count) 701 706 { 702 - struct pci_dev *dev = to_pci_dev(container_of(kobj,struct device,kobj)); 707 + struct pci_dev *dev = to_pci_dev(container_of(kobj, struct device, 708 + kobj)); 703 709 unsigned int size = count; 704 710 loff_t init_off = off; 705 - u8 *data = (u8*) buf; 711 + u8 *data = (u8 *) buf; 706 712 707 713 if (off > dev->cfg_size) 708 714 return 0; ··· 722 728 if ((off & 3) && size > 2) { 723 729 u16 val = data[off - init_off]; 724 730 val |= (u16) data[off - init_off + 1] << 8; 725 - pci_user_write_config_word(dev, off, val); 726 - off += 2; 727 - size -= 2; 728 - } 731 + pci_user_write_config_word(dev, off, val); 732 + off += 2; 733 + size -= 2; 734 + } 729 735 730 736 while (size > 3) { 731 737 u32 val = data[off - init_off]; ··· 756 762 return count; 757 763 } 758 764 759 - static ssize_t 760 - read_vpd_attr(struct file *filp, struct kobject *kobj, 761 - struct bin_attribute *bin_attr, 762 - char *buf, loff_t off, size_t count) 765 + static ssize_t read_vpd_attr(struct file *filp, struct kobject *kobj, 766 + struct bin_attribute *bin_attr, char *buf, 767 + loff_t off, size_t count) 763 768 { 764 769 struct pci_dev *dev = 765 770 to_pci_dev(container_of(kobj, struct device, kobj)); ··· 771 778 return pci_read_vpd(dev, off, count, buf); 772 779 } 773 780 774 - static ssize_t 775 - write_vpd_attr(struct file *filp, struct kobject *kobj, 776 - struct bin_attribute *bin_attr, 777 - char *buf, loff_t off, size_t count) 781 + static ssize_t write_vpd_attr(struct file *filp, struct kobject *kobj, 782 + struct bin_attribute *bin_attr, char *buf, 783 + loff_t off, size_t count) 778 784 { 779 785 struct pci_dev *dev = 780 786 to_pci_dev(container_of(kobj, struct device, kobj)); ··· 799 807 * Reads 1, 2, or 4 bytes from legacy I/O port space using an arch specific 800 808 * callback routine (pci_legacy_read). 801 809 */ 802 - static ssize_t 803 - pci_read_legacy_io(struct file *filp, struct kobject *kobj, 804 - struct bin_attribute *bin_attr, 805 - char *buf, loff_t off, size_t count) 810 + static ssize_t pci_read_legacy_io(struct file *filp, struct kobject *kobj, 811 + struct bin_attribute *bin_attr, char *buf, 812 + loff_t off, size_t count) 806 813 { 807 - struct pci_bus *bus = to_pci_bus(container_of(kobj, 808 - struct device, 814 + struct pci_bus *bus = to_pci_bus(container_of(kobj, struct device, 809 815 kobj)); 810 816 811 - /* Only support 1, 2 or 4 byte accesses */ 812 - if (count != 1 && count != 2 && count != 4) 813 - return -EINVAL; 817 + /* Only support 1, 2 or 4 byte accesses */ 818 + if (count != 1 && count != 2 && count != 4) 819 + return -EINVAL; 814 820 815 - return pci_legacy_read(bus, off, (u32 *)buf, count); 821 + return pci_legacy_read(bus, off, (u32 *)buf, count); 816 822 } 817 823 818 824 /** ··· 825 835 * Writes 1, 2, or 4 bytes from legacy I/O port space using an arch specific 826 836 * callback routine (pci_legacy_write). 827 837 */ 828 - static ssize_t 829 - pci_write_legacy_io(struct file *filp, struct kobject *kobj, 830 - struct bin_attribute *bin_attr, 831 - char *buf, loff_t off, size_t count) 838 + static ssize_t pci_write_legacy_io(struct file *filp, struct kobject *kobj, 839 + struct bin_attribute *bin_attr, char *buf, 840 + loff_t off, size_t count) 832 841 { 833 - struct pci_bus *bus = to_pci_bus(container_of(kobj, 834 - struct device, 842 + struct pci_bus *bus = to_pci_bus(container_of(kobj, struct device, 835 843 kobj)); 836 - /* Only support 1, 2 or 4 byte accesses */ 837 - if (count != 1 && count != 2 && count != 4) 838 - return -EINVAL; 839 844 840 - return pci_legacy_write(bus, off, *(u32 *)buf, count); 845 + /* Only support 1, 2 or 4 byte accesses */ 846 + if (count != 1 && count != 2 && count != 4) 847 + return -EINVAL; 848 + 849 + return pci_legacy_write(bus, off, *(u32 *)buf, count); 841 850 } 842 851 843 852 /** ··· 850 861 * legacy memory space (first meg of bus space) into application virtual 851 862 * memory space. 852 863 */ 853 - static int 854 - pci_mmap_legacy_mem(struct file *filp, struct kobject *kobj, 855 - struct bin_attribute *attr, 856 - struct vm_area_struct *vma) 864 + static int pci_mmap_legacy_mem(struct file *filp, struct kobject *kobj, 865 + struct bin_attribute *attr, 866 + struct vm_area_struct *vma) 857 867 { 858 - struct pci_bus *bus = to_pci_bus(container_of(kobj, 859 - struct device, 868 + struct pci_bus *bus = to_pci_bus(container_of(kobj, struct device, 860 869 kobj)); 861 870 862 - return pci_mmap_legacy_page_range(bus, vma, pci_mmap_mem); 871 + return pci_mmap_legacy_page_range(bus, vma, pci_mmap_mem); 863 872 } 864 873 865 874 /** ··· 871 884 * legacy IO space (first meg of bus space) into application virtual 872 885 * memory space. Returns -ENOSYS if the operation isn't supported 873 886 */ 874 - static int 875 - pci_mmap_legacy_io(struct file *filp, struct kobject *kobj, 876 - struct bin_attribute *attr, 877 - struct vm_area_struct *vma) 887 + static int pci_mmap_legacy_io(struct file *filp, struct kobject *kobj, 888 + struct bin_attribute *attr, 889 + struct vm_area_struct *vma) 878 890 { 879 - struct pci_bus *bus = to_pci_bus(container_of(kobj, 880 - struct device, 891 + struct pci_bus *bus = to_pci_bus(container_of(kobj, struct device, 881 892 kobj)); 882 893 883 - return pci_mmap_legacy_page_range(bus, vma, pci_mmap_io); 894 + return pci_mmap_legacy_page_range(bus, vma, pci_mmap_io); 884 895 } 885 896 886 897 /** ··· 888 903 * 889 904 * Stub implementation. Can be overridden by arch if necessary. 890 905 */ 891 - void __weak 892 - pci_adjust_legacy_attr(struct pci_bus *b, enum pci_mmap_state mmap_type) 906 + void __weak pci_adjust_legacy_attr(struct pci_bus *b, 907 + enum pci_mmap_state mmap_type) 893 908 { 894 - return; 895 909 } 896 910 897 911 /** ··· 945 961 kfree(b->legacy_io); 946 962 b->legacy_io = NULL; 947 963 kzalloc_err: 948 - printk(KERN_WARNING "pci: warning: could not create legacy I/O port " 949 - "and ISA memory resources to sysfs\n"); 964 + printk(KERN_WARNING "pci: warning: could not create legacy I/O port and ISA memory resources to sysfs\n"); 950 965 return; 951 966 } 952 967 ··· 988 1005 * 989 1006 * Use the regular PCI mapping routines to map a PCI resource into userspace. 990 1007 */ 991 - static int 992 - pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr, 993 - struct vm_area_struct *vma, int write_combine) 1008 + static int pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr, 1009 + struct vm_area_struct *vma, int write_combine) 994 1010 { 995 1011 struct pci_dev *pdev = to_pci_dev(container_of(kobj, 996 1012 struct device, kobj)); ··· 1005 1023 return -ENODEV; 1006 1024 1007 1025 if (!pci_mmap_fits(pdev, i, vma, PCI_MMAP_SYSFS)) { 1008 - WARN(1, "process \"%s\" tried to map 0x%08lx bytes " 1009 - "at page 0x%08lx on %s BAR %d (start 0x%16Lx, size 0x%16Lx)\n", 1026 + WARN(1, "process \"%s\" tried to map 0x%08lx bytes at page 0x%08lx on %s BAR %d (start 0x%16Lx, size 0x%16Lx)\n", 1010 1027 current->comm, vma->vm_end-vma->vm_start, vma->vm_pgoff, 1011 1028 pci_name(pdev), i, 1012 1029 (u64)pci_resource_start(pdev, i), ··· 1027 1046 return pci_mmap_page_range(pdev, vma, mmap_type, write_combine); 1028 1047 } 1029 1048 1030 - static int 1031 - pci_mmap_resource_uc(struct file *filp, struct kobject *kobj, 1032 - struct bin_attribute *attr, 1033 - struct vm_area_struct *vma) 1049 + static int pci_mmap_resource_uc(struct file *filp, struct kobject *kobj, 1050 + struct bin_attribute *attr, 1051 + struct vm_area_struct *vma) 1034 1052 { 1035 1053 return pci_mmap_resource(kobj, attr, vma, 0); 1036 1054 } 1037 1055 1038 - static int 1039 - pci_mmap_resource_wc(struct file *filp, struct kobject *kobj, 1040 - struct bin_attribute *attr, 1041 - struct vm_area_struct *vma) 1056 + static int pci_mmap_resource_wc(struct file *filp, struct kobject *kobj, 1057 + struct bin_attribute *attr, 1058 + struct vm_area_struct *vma) 1042 1059 { 1043 1060 return pci_mmap_resource(kobj, attr, vma, 1); 1044 1061 } 1045 1062 1046 - static ssize_t 1047 - pci_resource_io(struct file *filp, struct kobject *kobj, 1048 - struct bin_attribute *attr, char *buf, 1049 - loff_t off, size_t count, bool write) 1063 + static ssize_t pci_resource_io(struct file *filp, struct kobject *kobj, 1064 + struct bin_attribute *attr, char *buf, 1065 + loff_t off, size_t count, bool write) 1050 1066 { 1051 1067 struct pci_dev *pdev = to_pci_dev(container_of(kobj, 1052 1068 struct device, kobj)); ··· 1088 1110 return -EINVAL; 1089 1111 } 1090 1112 1091 - static ssize_t 1092 - pci_read_resource_io(struct file *filp, struct kobject *kobj, 1093 - struct bin_attribute *attr, char *buf, 1094 - loff_t off, size_t count) 1113 + static ssize_t pci_read_resource_io(struct file *filp, struct kobject *kobj, 1114 + struct bin_attribute *attr, char *buf, 1115 + loff_t off, size_t count) 1095 1116 { 1096 1117 return pci_resource_io(filp, kobj, attr, buf, off, count, false); 1097 1118 } 1098 1119 1099 - static ssize_t 1100 - pci_write_resource_io(struct file *filp, struct kobject *kobj, 1101 - struct bin_attribute *attr, char *buf, 1102 - loff_t off, size_t count) 1120 + static ssize_t pci_write_resource_io(struct file *filp, struct kobject *kobj, 1121 + struct bin_attribute *attr, char *buf, 1122 + loff_t off, size_t count) 1103 1123 { 1104 1124 return pci_resource_io(filp, kobj, attr, buf, off, count, true); 1105 1125 } ··· 1109 1133 * If we created resource files for @pdev, remove them from sysfs and 1110 1134 * free their resources. 1111 1135 */ 1112 - static void 1113 - pci_remove_resource_files(struct pci_dev *pdev) 1136 + static void pci_remove_resource_files(struct pci_dev *pdev) 1114 1137 { 1115 1138 int i; 1116 1139 ··· 1212 1237 * 1213 1238 * writing anything except 0 enables it 1214 1239 */ 1215 - static ssize_t 1216 - pci_write_rom(struct file *filp, struct kobject *kobj, 1217 - struct bin_attribute *bin_attr, 1218 - char *buf, loff_t off, size_t count) 1240 + static ssize_t pci_write_rom(struct file *filp, struct kobject *kobj, 1241 + struct bin_attribute *bin_attr, char *buf, 1242 + loff_t off, size_t count) 1219 1243 { 1220 1244 struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj)); 1221 1245 ··· 1238 1264 * Put @count bytes starting at @off into @buf from the ROM in the PCI 1239 1265 * device corresponding to @kobj. 1240 1266 */ 1241 - static ssize_t 1242 - pci_read_rom(struct file *filp, struct kobject *kobj, 1243 - struct bin_attribute *bin_attr, 1244 - char *buf, loff_t off, size_t count) 1267 + static ssize_t pci_read_rom(struct file *filp, struct kobject *kobj, 1268 + struct bin_attribute *bin_attr, char *buf, 1269 + loff_t off, size_t count) 1245 1270 { 1246 1271 struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj)); 1247 1272 void __iomem *rom; ··· 1286 1313 .write = pci_write_config, 1287 1314 }; 1288 1315 1289 - static ssize_t reset_store(struct device *dev, 1290 - struct device_attribute *attr, const char *buf, 1291 - size_t count) 1316 + static ssize_t reset_store(struct device *dev, struct device_attribute *attr, 1317 + const char *buf, size_t count) 1292 1318 { 1293 1319 struct pci_dev *pdev = to_pci_dev(dev); 1294 1320 unsigned long val; ··· 1354 1382 return retval; 1355 1383 } 1356 1384 1357 - int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev) 1385 + int __must_check pci_create_sysfs_dev_files(struct pci_dev *pdev) 1358 1386 { 1359 1387 int retval; 1360 1388 int rom_size = 0; ··· 1492 1520 1493 1521 return 0; 1494 1522 } 1495 - 1496 1523 late_initcall(pci_sysfs_init); 1497 1524 1498 1525 static struct attribute *pci_dev_dev_attrs[] = { ··· 1500 1529 }; 1501 1530 1502 1531 static umode_t pci_dev_attrs_are_visible(struct kobject *kobj, 1503 - struct attribute *a, int n) 1532 + struct attribute *a, int n) 1504 1533 { 1505 1534 struct device *dev = container_of(kobj, struct device, kobj); 1506 1535 struct pci_dev *pdev = to_pci_dev(dev); ··· 1519 1548 }; 1520 1549 1521 1550 static umode_t pci_dev_hp_attrs_are_visible(struct kobject *kobj, 1522 - struct attribute *a, int n) 1551 + struct attribute *a, int n) 1523 1552 { 1524 1553 struct device *dev = container_of(kobj, struct device, kobj); 1525 1554 struct pci_dev *pdev = to_pci_dev(dev); ··· 1543 1572 }; 1544 1573 1545 1574 static umode_t sriov_attrs_are_visible(struct kobject *kobj, 1546 - struct attribute *a, int n) 1575 + struct attribute *a, int n) 1547 1576 { 1548 1577 struct device *dev = container_of(kobj, struct device, kobj); 1549 1578
+85 -110
drivers/pci/pci.c
··· 114 114 max = bus->busn_res.end; 115 115 list_for_each_entry(tmp, &bus->children, node) { 116 116 n = pci_bus_max_busnr(tmp); 117 - if(n > max) 117 + if (n > max) 118 118 max = n; 119 119 } 120 120 return max; ··· 226 226 227 227 return pos; 228 228 } 229 + EXPORT_SYMBOL(pci_find_capability); 229 230 230 231 /** 231 232 * pci_bus_find_capability - query for devices' capabilities ··· 254 253 255 254 return pos; 256 255 } 256 + EXPORT_SYMBOL(pci_bus_find_capability); 257 257 258 258 /** 259 259 * pci_find_next_ext_capability - Find an extended capability ··· 405 403 * For given resource region of given device, return the resource 406 404 * region of parent bus the given region is contained in. 407 405 */ 408 - struct resource * 409 - pci_find_parent_resource(const struct pci_dev *dev, struct resource *res) 406 + struct resource *pci_find_parent_resource(const struct pci_dev *dev, 407 + struct resource *res) 410 408 { 411 409 const struct pci_bus *bus = dev->bus; 412 410 struct resource *r; ··· 438 436 } 439 437 return NULL; 440 438 } 439 + EXPORT_SYMBOL(pci_find_parent_resource); 441 440 442 441 /** 443 442 * pci_wait_for_pending - wait for @mask bit(s) to clear in status word @pos ··· 473 470 * Restore the BAR values for a given device, so as to make it 474 471 * accessible by its driver. 475 472 */ 476 - static void 477 - pci_restore_bars(struct pci_dev *dev) 473 + static void pci_restore_bars(struct pci_dev *dev) 478 474 { 479 475 int i; 480 476 ··· 498 496 } 499 497 500 498 static inline int platform_pci_set_power_state(struct pci_dev *dev, 501 - pci_power_t t) 499 + pci_power_t t) 502 500 { 503 501 return pci_platform_pm ? pci_platform_pm->set_state(dev, t) : -ENOSYS; 504 502 } ··· 555 553 */ 556 554 if (state != PCI_D0 && dev->current_state <= PCI_D3cold 557 555 && dev->current_state > state) { 558 - dev_err(&dev->dev, "invalid power transition " 559 - "(from state %d to %d)\n", dev->current_state, state); 556 + dev_err(&dev->dev, "invalid power transition (from state %d to %d)\n", 557 + dev->current_state, state); 560 558 return -EINVAL; 561 559 } 562 560 ··· 603 601 pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); 604 602 dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK); 605 603 if (dev->current_state != state && printk_ratelimit()) 606 - dev_info(&dev->dev, "Refused to change power state, " 607 - "currently in D%d\n", dev->current_state); 604 + dev_info(&dev->dev, "Refused to change power state, currently in D%d\n", 605 + dev->current_state); 608 606 609 607 /* 610 608 * According to section 5.4.1 of the "PCI BUS POWER MANAGEMENT ··· 848 846 849 847 return error; 850 848 } 849 + EXPORT_SYMBOL(pci_set_power_state); 851 850 852 851 /** 853 852 * pci_choose_state - Choose the power state of a PCI device ··· 887 884 } 888 885 return PCI_D0; 889 886 } 890 - 891 887 EXPORT_SYMBOL(pci_choose_state); 892 888 893 889 #define PCI_EXP_SAVE_REGS 7 894 - 895 890 896 891 static struct pci_cap_saved_state *_pci_find_saved_cap(struct pci_dev *pci_dev, 897 892 u16 cap, bool extended) ··· 1002 1001 * pci_save_state - save the PCI configuration space of a device before suspending 1003 1002 * @dev: - PCI device that we're dealing with 1004 1003 */ 1005 - int 1006 - pci_save_state(struct pci_dev *dev) 1004 + int pci_save_state(struct pci_dev *dev) 1007 1005 { 1008 1006 int i; 1009 1007 /* XXX: 100% dword access ok here? */ ··· 1017 1017 return i; 1018 1018 return 0; 1019 1019 } 1020 + EXPORT_SYMBOL(pci_save_state); 1020 1021 1021 1022 static void pci_restore_config_dword(struct pci_dev *pdev, int offset, 1022 1023 u32 saved_val, int retry) ··· 1029 1028 return; 1030 1029 1031 1030 for (;;) { 1032 - dev_dbg(&pdev->dev, "restoring config space at offset " 1033 - "%#x (was %#x, writing %#x)\n", offset, val, saved_val); 1031 + dev_dbg(&pdev->dev, "restoring config space at offset %#x (was %#x, writing %#x)\n", 1032 + offset, val, saved_val); 1034 1033 pci_write_config_dword(pdev, offset, saved_val); 1035 1034 if (retry-- <= 0) 1036 1035 return; ··· 1088 1087 1089 1088 dev->state_saved = false; 1090 1089 } 1090 + EXPORT_SYMBOL(pci_restore_state); 1091 1091 1092 1092 struct pci_saved_state { 1093 1093 u32 config_space[16]; ··· 1233 1231 return do_pci_enable_device(dev, (1 << PCI_NUM_RESOURCES) - 1); 1234 1232 return 0; 1235 1233 } 1234 + EXPORT_SYMBOL(pci_reenable_device); 1236 1235 1237 1236 static void pci_enable_bridge(struct pci_dev *dev) 1238 1237 { ··· 1308 1305 { 1309 1306 return pci_enable_device_flags(dev, IORESOURCE_IO); 1310 1307 } 1308 + EXPORT_SYMBOL(pci_enable_device_io); 1311 1309 1312 1310 /** 1313 1311 * pci_enable_device_mem - Initialize a device for use with Memory space ··· 1322 1318 { 1323 1319 return pci_enable_device_flags(dev, IORESOURCE_MEM); 1324 1320 } 1321 + EXPORT_SYMBOL(pci_enable_device_mem); 1325 1322 1326 1323 /** 1327 1324 * pci_enable_device - Initialize device before it's used by a driver. ··· 1339 1334 { 1340 1335 return pci_enable_device_flags(dev, IORESOURCE_MEM | IORESOURCE_IO); 1341 1336 } 1337 + EXPORT_SYMBOL(pci_enable_device); 1342 1338 1343 1339 /* 1344 1340 * Managed PCI resources. This manages device on/off, intx/msi/msix ··· 1422 1416 } 1423 1417 return rc; 1424 1418 } 1419 + EXPORT_SYMBOL(pcim_enable_device); 1425 1420 1426 1421 /** 1427 1422 * pcim_pin_device - Pin managed PCI device ··· 1441 1434 if (dr) 1442 1435 dr->pinned = 1; 1443 1436 } 1437 + EXPORT_SYMBOL(pcim_pin_device); 1444 1438 1445 1439 /* 1446 1440 * pcibios_add_device - provide arch specific hooks when adding device dev ··· 1451 1443 * devices are added. This is the default implementation. Architecture 1452 1444 * implementations can override this. 1453 1445 */ 1454 - int __weak pcibios_add_device (struct pci_dev *dev) 1446 + int __weak pcibios_add_device(struct pci_dev *dev) 1455 1447 { 1456 1448 return 0; 1457 1449 } ··· 1523 1515 * Note we don't actually disable the device until all callers of 1524 1516 * pci_enable_device() have called pci_disable_device(). 1525 1517 */ 1526 - void 1527 - pci_disable_device(struct pci_dev *dev) 1518 + void pci_disable_device(struct pci_dev *dev) 1528 1519 { 1529 1520 struct pci_devres *dr; 1530 1521 ··· 1541 1534 1542 1535 dev->is_busmaster = 0; 1543 1536 } 1537 + EXPORT_SYMBOL(pci_disable_device); 1544 1538 1545 1539 /** 1546 1540 * pcibios_set_pcie_reset_state - set reset state for device dev ··· 1570 1562 { 1571 1563 return pcibios_set_pcie_reset_state(dev, state); 1572 1564 } 1565 + EXPORT_SYMBOL_GPL(pci_set_pcie_reset_state); 1573 1566 1574 1567 /** 1575 1568 * pci_check_pme_status - Check if given device has generated PME. ··· 1650 1641 1651 1642 return !!(dev->pme_support & (1 << state)); 1652 1643 } 1644 + EXPORT_SYMBOL(pci_pme_capable); 1653 1645 1654 1646 static void pci_pme_list_scan(struct work_struct *work) 1655 1647 { ··· 1755 1745 1756 1746 dev_dbg(&dev->dev, "PME# %s\n", enable ? "enabled" : "disabled"); 1757 1747 } 1748 + EXPORT_SYMBOL(pci_pme_active); 1758 1749 1759 1750 /** 1760 1751 * __pci_enable_wake - enable PCI device as wakeup event source ··· 1841 1830 pci_enable_wake(dev, PCI_D3cold, enable) : 1842 1831 pci_enable_wake(dev, PCI_D3hot, enable); 1843 1832 } 1833 + EXPORT_SYMBOL(pci_wake_from_d3); 1844 1834 1845 1835 /** 1846 1836 * pci_target_state - find an appropriate low power state for a given PCI dev ··· 1920 1908 1921 1909 return error; 1922 1910 } 1911 + EXPORT_SYMBOL(pci_prepare_to_sleep); 1923 1912 1924 1913 /** 1925 1914 * pci_back_from_sleep - turn PCI device on during system-wide transition into working state ··· 1933 1920 pci_enable_wake(dev, PCI_D0, false); 1934 1921 return pci_set_power_state(dev, PCI_D0); 1935 1922 } 1923 + EXPORT_SYMBOL(pci_back_from_sleep); 1936 1924 1937 1925 /** 1938 1926 * pci_finish_runtime_suspend - Carry out PCI-specific part of runtime suspend. ··· 2429 2415 return (((pin - 1) + slot) % 4) + 1; 2430 2416 } 2431 2417 2432 - int 2433 - pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge) 2418 + int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge) 2434 2419 { 2435 2420 u8 pin; 2436 2421 ··· 2491 2478 if (dr) 2492 2479 dr->region_mask &= ~(1 << bar); 2493 2480 } 2481 + EXPORT_SYMBOL(pci_release_region); 2494 2482 2495 2483 /** 2496 2484 * __pci_request_region - Reserved PCI I/O and memory resource ··· 2512 2498 * Returns 0 on success, or %EBUSY on error. A warning 2513 2499 * message is also printed on failure. 2514 2500 */ 2515 - static int __pci_request_region(struct pci_dev *pdev, int bar, const char *res_name, 2516 - int exclusive) 2501 + static int __pci_request_region(struct pci_dev *pdev, int bar, 2502 + const char *res_name, int exclusive) 2517 2503 { 2518 2504 struct pci_devres *dr; 2519 2505 ··· 2524 2510 if (!request_region(pci_resource_start(pdev, bar), 2525 2511 pci_resource_len(pdev, bar), res_name)) 2526 2512 goto err_out; 2527 - } 2528 - else if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM) { 2513 + } else if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM) { 2529 2514 if (!__request_mem_region(pci_resource_start(pdev, bar), 2530 2515 pci_resource_len(pdev, bar), res_name, 2531 2516 exclusive)) ··· 2561 2548 { 2562 2549 return __pci_request_region(pdev, bar, res_name, 0); 2563 2550 } 2551 + EXPORT_SYMBOL(pci_request_region); 2564 2552 2565 2553 /** 2566 2554 * pci_request_region_exclusive - Reserved PCI I/O and memory resource ··· 2581 2567 * explicitly not allowed to map the resource via /dev/mem or 2582 2568 * sysfs. 2583 2569 */ 2584 - int pci_request_region_exclusive(struct pci_dev *pdev, int bar, const char *res_name) 2570 + int pci_request_region_exclusive(struct pci_dev *pdev, int bar, 2571 + const char *res_name) 2585 2572 { 2586 2573 return __pci_request_region(pdev, bar, res_name, IORESOURCE_EXCLUSIVE); 2587 2574 } 2575 + EXPORT_SYMBOL(pci_request_region_exclusive); 2576 + 2588 2577 /** 2589 2578 * pci_release_selected_regions - Release selected PCI I/O and memory resources 2590 2579 * @pdev: PCI device whose resources were previously reserved ··· 2604 2587 if (bars & (1 << i)) 2605 2588 pci_release_region(pdev, i); 2606 2589 } 2590 + EXPORT_SYMBOL(pci_release_selected_regions); 2607 2591 2608 2592 static int __pci_request_selected_regions(struct pci_dev *pdev, int bars, 2609 - const char *res_name, int excl) 2593 + const char *res_name, int excl) 2610 2594 { 2611 2595 int i; 2612 2596 ··· 2618 2600 return 0; 2619 2601 2620 2602 err_out: 2621 - while(--i >= 0) 2603 + while (--i >= 0) 2622 2604 if (bars & (1 << i)) 2623 2605 pci_release_region(pdev, i); 2624 2606 ··· 2637 2619 { 2638 2620 return __pci_request_selected_regions(pdev, bars, res_name, 0); 2639 2621 } 2622 + EXPORT_SYMBOL(pci_request_selected_regions); 2640 2623 2641 - int pci_request_selected_regions_exclusive(struct pci_dev *pdev, 2642 - int bars, const char *res_name) 2624 + int pci_request_selected_regions_exclusive(struct pci_dev *pdev, int bars, 2625 + const char *res_name) 2643 2626 { 2644 2627 return __pci_request_selected_regions(pdev, bars, res_name, 2645 2628 IORESOURCE_EXCLUSIVE); 2646 2629 } 2630 + EXPORT_SYMBOL(pci_request_selected_regions_exclusive); 2647 2631 2648 2632 /** 2649 2633 * pci_release_regions - Release reserved PCI I/O and memory resources ··· 2660 2640 { 2661 2641 pci_release_selected_regions(pdev, (1 << 6) - 1); 2662 2642 } 2643 + EXPORT_SYMBOL(pci_release_regions); 2663 2644 2664 2645 /** 2665 2646 * pci_request_regions - Reserved PCI I/O and memory resources ··· 2679 2658 { 2680 2659 return pci_request_selected_regions(pdev, ((1 << 6) - 1), res_name); 2681 2660 } 2661 + EXPORT_SYMBOL(pci_request_regions); 2682 2662 2683 2663 /** 2684 2664 * pci_request_regions_exclusive - Reserved PCI I/O and memory resources ··· 2702 2680 return pci_request_selected_regions_exclusive(pdev, 2703 2681 ((1 << 6) - 1), res_name); 2704 2682 } 2683 + EXPORT_SYMBOL(pci_request_regions_exclusive); 2705 2684 2706 2685 static void __pci_set_master(struct pci_dev *dev, bool enable) 2707 2686 { ··· 2772 2749 __pci_set_master(dev, true); 2773 2750 pcibios_set_master(dev); 2774 2751 } 2752 + EXPORT_SYMBOL(pci_set_master); 2775 2753 2776 2754 /** 2777 2755 * pci_clear_master - disables bus-mastering for device dev ··· 2782 2758 { 2783 2759 __pci_set_master(dev, false); 2784 2760 } 2761 + EXPORT_SYMBOL(pci_clear_master); 2785 2762 2786 2763 /** 2787 2764 * pci_set_cacheline_size - ensure the CACHE_LINE_SIZE register is programmed ··· 2815 2790 if (cacheline_size == pci_cache_line_size) 2816 2791 return 0; 2817 2792 2818 - dev_printk(KERN_DEBUG, &dev->dev, "cache line size of %d is not " 2819 - "supported\n", pci_cache_line_size << 2); 2793 + dev_printk(KERN_DEBUG, &dev->dev, "cache line size of %d is not supported\n", 2794 + pci_cache_line_size << 2); 2820 2795 2821 2796 return -EINVAL; 2822 2797 } 2823 2798 EXPORT_SYMBOL_GPL(pci_set_cacheline_size); 2824 - 2825 - #ifdef PCI_DISABLE_MWI 2826 - int pci_set_mwi(struct pci_dev *dev) 2827 - { 2828 - return 0; 2829 - } 2830 - 2831 - int pci_try_set_mwi(struct pci_dev *dev) 2832 - { 2833 - return 0; 2834 - } 2835 - 2836 - void pci_clear_mwi(struct pci_dev *dev) 2837 - { 2838 - } 2839 - 2840 - #else 2841 2799 2842 2800 /** 2843 2801 * pci_set_mwi - enables memory-write-invalidate PCI transaction ··· 2830 2822 * 2831 2823 * RETURNS: An appropriate -ERRNO error value on error, or zero for success. 2832 2824 */ 2833 - int 2834 - pci_set_mwi(struct pci_dev *dev) 2825 + int pci_set_mwi(struct pci_dev *dev) 2835 2826 { 2827 + #ifdef PCI_DISABLE_MWI 2828 + return 0; 2829 + #else 2836 2830 int rc; 2837 2831 u16 cmd; 2838 2832 ··· 2843 2833 return rc; 2844 2834 2845 2835 pci_read_config_word(dev, PCI_COMMAND, &cmd); 2846 - if (! (cmd & PCI_COMMAND_INVALIDATE)) { 2836 + if (!(cmd & PCI_COMMAND_INVALIDATE)) { 2847 2837 dev_dbg(&dev->dev, "enabling Mem-Wr-Inval\n"); 2848 2838 cmd |= PCI_COMMAND_INVALIDATE; 2849 2839 pci_write_config_word(dev, PCI_COMMAND, cmd); 2850 2840 } 2851 - 2852 2841 return 0; 2842 + #endif 2853 2843 } 2844 + EXPORT_SYMBOL(pci_set_mwi); 2854 2845 2855 2846 /** 2856 2847 * pci_try_set_mwi - enables memory-write-invalidate PCI transaction ··· 2864 2853 */ 2865 2854 int pci_try_set_mwi(struct pci_dev *dev) 2866 2855 { 2867 - int rc = pci_set_mwi(dev); 2868 - return rc; 2856 + #ifdef PCI_DISABLE_MWI 2857 + return 0; 2858 + #else 2859 + return pci_set_mwi(dev); 2860 + #endif 2869 2861 } 2862 + EXPORT_SYMBOL(pci_try_set_mwi); 2870 2863 2871 2864 /** 2872 2865 * pci_clear_mwi - disables Memory-Write-Invalidate for device dev ··· 2878 2863 * 2879 2864 * Disables PCI Memory-Write-Invalidate transaction on the device 2880 2865 */ 2881 - void 2882 - pci_clear_mwi(struct pci_dev *dev) 2866 + void pci_clear_mwi(struct pci_dev *dev) 2883 2867 { 2868 + #ifndef PCI_DISABLE_MWI 2884 2869 u16 cmd; 2885 2870 2886 2871 pci_read_config_word(dev, PCI_COMMAND, &cmd); ··· 2888 2873 cmd &= ~PCI_COMMAND_INVALIDATE; 2889 2874 pci_write_config_word(dev, PCI_COMMAND, cmd); 2890 2875 } 2876 + #endif 2891 2877 } 2892 - #endif /* ! PCI_DISABLE_MWI */ 2878 + EXPORT_SYMBOL(pci_clear_mwi); 2893 2879 2894 2880 /** 2895 2881 * pci_intx - enables/disables PCI INTx for device dev ··· 2899 2883 * 2900 2884 * Enables/disables PCI INTx for device dev 2901 2885 */ 2902 - void 2903 - pci_intx(struct pci_dev *pdev, int enable) 2886 + void pci_intx(struct pci_dev *pdev, int enable) 2904 2887 { 2905 2888 u16 pci_command, new; 2906 2889 2907 2890 pci_read_config_word(pdev, PCI_COMMAND, &pci_command); 2908 2891 2909 - if (enable) { 2892 + if (enable) 2910 2893 new = pci_command & ~PCI_COMMAND_INTX_DISABLE; 2911 - } else { 2894 + else 2912 2895 new = pci_command | PCI_COMMAND_INTX_DISABLE; 2913 - } 2914 2896 2915 2897 if (new != pci_command) { 2916 2898 struct pci_devres *dr; ··· 2922 2908 } 2923 2909 } 2924 2910 } 2911 + EXPORT_SYMBOL_GPL(pci_intx); 2925 2912 2926 2913 /** 2927 2914 * pci_intx_mask_supported - probe for INTx masking support ··· 2952 2937 * go ahead and check it. 2953 2938 */ 2954 2939 if ((new ^ orig) & ~PCI_COMMAND_INTX_DISABLE) { 2955 - dev_err(&dev->dev, "Command register changed from " 2956 - "0x%x to 0x%x: driver or hardware bug?\n", orig, new); 2940 + dev_err(&dev->dev, "Command register changed from 0x%x to 0x%x: driver or hardware bug?\n", 2941 + orig, new); 2957 2942 } else if ((new ^ orig) & PCI_COMMAND_INTX_DISABLE) { 2958 2943 mask_supported = true; 2959 2944 pci_write_config_word(dev, PCI_COMMAND, orig); ··· 3139 3124 if (pci_wait_for_pending(dev, pos + PCI_AF_STATUS, PCI_AF_STATUS_TP)) 3140 3125 goto clear; 3141 3126 3142 - dev_err(&dev->dev, "transaction is not cleared; " 3143 - "proceeding with reset anyway\n"); 3127 + dev_err(&dev->dev, "transaction is not cleared; proceeding with reset anyway\n"); 3144 3128 3145 3129 clear: 3146 3130 pci_write_config_byte(dev, pos + PCI_AF_CTRL, PCI_AF_CTRL_FLR); ··· 4114 4100 bars |= (1 << i); 4115 4101 return bars; 4116 4102 } 4103 + EXPORT_SYMBOL(pci_select_bars); 4117 4104 4118 4105 /** 4119 4106 * pci_resource_bar - get position of the BAR associated with a resource ··· 4154 4139 } 4155 4140 4156 4141 static int pci_set_vga_state_arch(struct pci_dev *dev, bool decode, 4157 - unsigned int command_bits, u32 flags) 4142 + unsigned int command_bits, u32 flags) 4158 4143 { 4159 4144 if (arch_set_vga_state) 4160 4145 return arch_set_vga_state(dev, decode, command_bits, ··· 4266 4251 bus == dev->bus->number && 4267 4252 slot == PCI_SLOT(dev->devfn) && 4268 4253 func == PCI_FUNC(dev->devfn)) { 4269 - if (align_order == -1) { 4254 + if (align_order == -1) 4270 4255 align = PAGE_SIZE; 4271 - } else { 4256 + else 4272 4257 align = 1 << align_order; 4273 - } 4274 4258 /* Found */ 4275 4259 break; 4276 4260 } ··· 4387 4373 return bus_create_file(&pci_bus_type, 4388 4374 &bus_attr_resource_alignment); 4389 4375 } 4390 - 4391 4376 late_initcall(pci_resource_alignment_sysfs_init); 4392 4377 4393 4378 static void pci_no_domains(void) ··· 4465 4452 return 0; 4466 4453 } 4467 4454 early_param("pci", pci_setup); 4468 - 4469 - EXPORT_SYMBOL(pci_reenable_device); 4470 - EXPORT_SYMBOL(pci_enable_device_io); 4471 - EXPORT_SYMBOL(pci_enable_device_mem); 4472 - EXPORT_SYMBOL(pci_enable_device); 4473 - EXPORT_SYMBOL(pcim_enable_device); 4474 - EXPORT_SYMBOL(pcim_pin_device); 4475 - EXPORT_SYMBOL(pci_disable_device); 4476 - EXPORT_SYMBOL(pci_find_capability); 4477 - EXPORT_SYMBOL(pci_bus_find_capability); 4478 - EXPORT_SYMBOL(pci_release_regions); 4479 - EXPORT_SYMBOL(pci_request_regions); 4480 - EXPORT_SYMBOL(pci_request_regions_exclusive); 4481 - EXPORT_SYMBOL(pci_release_region); 4482 - EXPORT_SYMBOL(pci_request_region); 4483 - EXPORT_SYMBOL(pci_request_region_exclusive); 4484 - EXPORT_SYMBOL(pci_release_selected_regions); 4485 - EXPORT_SYMBOL(pci_request_selected_regions); 4486 - EXPORT_SYMBOL(pci_request_selected_regions_exclusive); 4487 - EXPORT_SYMBOL(pci_set_master); 4488 - EXPORT_SYMBOL(pci_clear_master); 4489 - EXPORT_SYMBOL(pci_set_mwi); 4490 - EXPORT_SYMBOL(pci_try_set_mwi); 4491 - EXPORT_SYMBOL(pci_clear_mwi); 4492 - EXPORT_SYMBOL_GPL(pci_intx); 4493 - EXPORT_SYMBOL(pci_assign_resource); 4494 - EXPORT_SYMBOL(pci_find_parent_resource); 4495 - EXPORT_SYMBOL(pci_select_bars); 4496 - 4497 - EXPORT_SYMBOL(pci_set_power_state); 4498 - EXPORT_SYMBOL(pci_save_state); 4499 - EXPORT_SYMBOL(pci_restore_state); 4500 - EXPORT_SYMBOL(pci_pme_capable); 4501 - EXPORT_SYMBOL(pci_pme_active); 4502 - EXPORT_SYMBOL(pci_wake_from_d3); 4503 - EXPORT_SYMBOL(pci_prepare_to_sleep); 4504 - EXPORT_SYMBOL(pci_back_from_sleep); 4505 - EXPORT_SYMBOL_GPL(pci_set_pcie_reset_state);
+3 -6
drivers/pci/pcie/aer/aer_inject.c
··· 397 397 if (!aer_mask_override && einj->cor_status && 398 398 !(einj->cor_status & ~cor_mask)) { 399 399 ret = -EINVAL; 400 - printk(KERN_WARNING "The correctable error(s) is masked " 401 - "by device\n"); 400 + printk(KERN_WARNING "The correctable error(s) is masked by device\n"); 402 401 spin_unlock_irqrestore(&inject_lock, flags); 403 402 goto out_put; 404 403 } 405 404 if (!aer_mask_override && einj->uncor_status && 406 405 !(einj->uncor_status & ~uncor_mask)) { 407 406 ret = -EINVAL; 408 - printk(KERN_WARNING "The uncorrectable error(s) is masked " 409 - "by device\n"); 407 + printk(KERN_WARNING "The uncorrectable error(s) is masked by device\n"); 410 408 spin_unlock_irqrestore(&inject_lock, flags); 411 409 goto out_put; 412 410 } ··· 462 464 goto out_put; 463 465 } 464 466 aer_irq(-1, edev); 465 - } 466 - else 467 + } else 467 468 ret = -EINVAL; 468 469 out_put: 469 470 kfree(err_alloc);
+1 -2
drivers/pci/pcie/aer/aerdrv_core.c
··· 542 542 #define AER_RECOVER_RING_ORDER 4 543 543 #define AER_RECOVER_RING_SIZE (1 << AER_RECOVER_RING_ORDER) 544 544 545 - struct aer_recover_entry 546 - { 545 + struct aer_recover_entry { 547 546 u8 bus; 548 547 u8 devfn; 549 548 u16 domain;
+3 -7
drivers/pci/pcie/aer/aerdrv_errprint.c
··· 172 172 int id = ((dev->bus->number << 8) | dev->devfn); 173 173 174 174 if (!info->status) { 175 - dev_err(&dev->dev, 176 - "PCIe Bus Error: severity=%s, type=Unaccessible, " 177 - "id=%04x(Unregistered Agent ID)\n", 175 + dev_err(&dev->dev, "PCIe Bus Error: severity=%s, type=Unaccessible, id=%04x(Unregistered Agent ID)\n", 178 176 aer_error_severity_string[info->severity], id); 179 177 goto out; 180 178 } ··· 180 182 layer = AER_GET_LAYER_ERROR(info->severity, info->status); 181 183 agent = AER_GET_AGENT(info->severity, info->status); 182 184 183 - dev_err(&dev->dev, 184 - "PCIe Bus Error: severity=%s, type=%s, id=%04x(%s)\n", 185 + dev_err(&dev->dev, "PCIe Bus Error: severity=%s, type=%s, id=%04x(%s)\n", 185 186 aer_error_severity_string[info->severity], 186 187 aer_error_layer[layer], id, aer_agent_string[agent]); 187 188 188 - dev_err(&dev->dev, 189 - " device [%04x:%04x] error status/mask=%08x/%08x\n", 189 + dev_err(&dev->dev, " device [%04x:%04x] error status/mask=%08x/%08x\n", 190 190 dev->vendor, dev->device, 191 191 info->status, info->mask); 192 192
+1 -2
drivers/pci/pcie/pme.c
··· 199 199 * assuming that the PME was reported by a PCIe-PCI bridge that 200 200 * used devfn different from zero. 201 201 */ 202 - dev_dbg(&port->dev, "PME interrupt generated for " 203 - "non-existent device %02x:%02x.%d\n", 202 + dev_dbg(&port->dev, "PME interrupt generated for non-existent device %02x:%02x.%d\n", 204 203 busnr, PCI_SLOT(devfn), PCI_FUNC(devfn)); 205 204 found = pcie_pme_from_pci_bridge(bus, 0); 206 205 }
+3 -3
drivers/pci/pcie/portdrv_pci.c
··· 204 204 return -ENODEV; 205 205 206 206 if (!dev->irq && dev->pin) { 207 - dev_warn(&dev->dev, "device [%04x:%04x] has invalid IRQ; " 208 - "check vendor BIOS\n", dev->vendor, dev->device); 207 + dev_warn(&dev->dev, "device [%04x:%04x] has invalid IRQ; check vendor BIOS\n", 208 + dev->vendor, dev->device); 209 209 } 210 210 status = pcie_port_device_register(dev); 211 211 if (status) ··· 397 397 static int __init dmi_pcie_pme_disable_msi(const struct dmi_system_id *d) 398 398 { 399 399 pr_notice("%s detected: will not use MSI for PCIe PME signaling\n", 400 - d->ident); 400 + d->ident); 401 401 pcie_pme_disable_msi(); 402 402 return 0; 403 403 }
+26 -34
drivers/pci/probe.c
··· 168 168 * Returns 1 if the BAR is 64-bit, or 0 if 32-bit. 169 169 */ 170 170 int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, 171 - struct resource *res, unsigned int pos) 171 + struct resource *res, unsigned int pos) 172 172 { 173 173 u32 l, sz, mask; 174 174 u64 l64, sz64, mask64; ··· 433 433 limit |= ((unsigned long) mem_limit_hi) << 32; 434 434 #else 435 435 if (mem_base_hi || mem_limit_hi) { 436 - dev_err(&dev->dev, "can't handle 64-bit " 437 - "address space for bridge\n"); 436 + dev_err(&dev->dev, "can't handle 64-bit address space for bridge\n"); 438 437 return; 439 438 } 440 439 #endif ··· 603 604 return agp_speeds[index]; 604 605 } 605 606 606 - 607 607 static void pci_set_bus_speed(struct pci_bus *bus) 608 608 { 609 609 struct pci_dev *bridge = bus->self; ··· 634 636 } else if (status & PCI_X_SSTATUS_266MHZ) { 635 637 max = PCI_SPEED_133MHz_PCIX_266; 636 638 } else if (status & PCI_X_SSTATUS_133MHZ) { 637 - if ((status & PCI_X_SSTATUS_VERS) == PCI_X_SSTATUS_V2) { 639 + if ((status & PCI_X_SSTATUS_VERS) == PCI_X_SSTATUS_V2) 638 640 max = PCI_SPEED_133MHz_PCIX_ECC; 639 - } else { 641 + else 640 642 max = PCI_SPEED_133MHz_PCIX; 641 - } 642 643 } else { 643 644 max = PCI_SPEED_66MHz_PCIX; 644 645 } ··· 660 663 pcie_update_link_speed(bus, linksta); 661 664 } 662 665 } 663 - 664 666 665 667 static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent, 666 668 struct pci_dev *bridge, int busnr) ··· 725 729 return child; 726 730 } 727 731 728 - struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr) 732 + struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, 733 + int busnr) 729 734 { 730 735 struct pci_bus *child; 731 736 ··· 738 741 } 739 742 return child; 740 743 } 744 + EXPORT_SYMBOL(pci_add_new_bus); 741 745 742 746 /* 743 747 * If it's a bridge, configure it and scan the bus behind it. ··· 885 887 * as cards with a PCI-to-PCI bridge can be 886 888 * inserted later. 887 889 */ 888 - for (i=0; i<CARDBUS_RESERVE_BUSNR; i++) { 890 + for (i = 0; i < CARDBUS_RESERVE_BUSNR; i++) { 889 891 struct pci_bus *parent = bus; 890 892 if (pci_find_bus(pci_domain_nr(bus), 891 893 max+i+1)) ··· 932 934 (child->number > bus->busn_res.end) || 933 935 (child->number < bus->number) || 934 936 (child->busn_res.end < bus->number)) { 935 - dev_info(&child->dev, "%pR %s " 936 - "hidden behind%s bridge %s %pR\n", 937 + dev_info(&child->dev, "%pR %s hidden behind%s bridge %s %pR\n", 937 938 &child->busn_res, 938 939 (bus->number > child->busn_res.end && 939 940 bus->busn_res.end < child->number) ? ··· 949 952 950 953 return max; 951 954 } 955 + EXPORT_SYMBOL(pci_scan_bridge); 952 956 953 957 /* 954 958 * Read interrupt line and base address registers. ··· 989 991 if (reg32 & PCI_EXP_SLTCAP_HPC) 990 992 pdev->is_hotplug_bridge = 1; 991 993 } 992 - 993 994 994 995 /** 995 996 * pci_ext_cfg_is_aliased - is ext config space just an alias of std config? ··· 1222 1225 break; 1223 1226 1224 1227 default: /* unknown header */ 1225 - dev_err(&dev->dev, "unknown header type %02x, " 1226 - "ignoring device\n", dev->hdr_type); 1228 + dev_err(&dev->dev, "unknown header type %02x, ignoring device\n", 1229 + dev->hdr_type); 1227 1230 return -EIO; 1228 1231 1229 1232 bad: 1230 - dev_err(&dev->dev, "ignoring class %#08x (doesn't match header " 1231 - "type %02x)\n", dev->class, dev->hdr_type); 1233 + dev_err(&dev->dev, "ignoring class %#08x (doesn't match header type %02x)\n", 1234 + dev->class, dev->hdr_type); 1232 1235 dev->class = PCI_CLASS_NOT_DEFINED; 1233 1236 } 1234 1237 ··· 1280 1283 EXPORT_SYMBOL(pci_alloc_dev); 1281 1284 1282 1285 bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l, 1283 - int crs_timeout) 1286 + int crs_timeout) 1284 1287 { 1285 1288 int delay = 1; 1286 1289 ··· 1303 1306 return false; 1304 1307 /* Card hasn't responded in 60 seconds? Must be stuck. */ 1305 1308 if (delay > crs_timeout) { 1306 - printk(KERN_WARNING "pci %04x:%02x:%02x.%d: not " 1307 - "responding\n", pci_domain_nr(bus), 1308 - bus->number, PCI_SLOT(devfn), 1309 - PCI_FUNC(devfn)); 1309 + printk(KERN_WARNING "pci %04x:%02x:%02x.%d: not responding\n", 1310 + pci_domain_nr(bus), bus->number, PCI_SLOT(devfn), 1311 + PCI_FUNC(devfn)); 1310 1312 return false; 1311 1313 } 1312 1314 } ··· 1515 1519 1516 1520 return nr; 1517 1521 } 1522 + EXPORT_SYMBOL(pci_scan_slot); 1518 1523 1519 1524 static int pcie_find_smpss(struct pci_dev *dev, void *data) 1520 1525 { ··· 1610 1613 } 1611 1614 1612 1615 if (mrrs < 128) 1613 - dev_err(&dev->dev, "MRRS was unable to be configured with a " 1614 - "safe value. If problems are experienced, try running " 1615 - "with pci=pcie_bus_safe.\n"); 1616 + dev_err(&dev->dev, "MRRS was unable to be configured with a safe value. If problems are experienced, try running with pci=pcie_bus_safe\n"); 1616 1617 } 1617 1618 1618 1619 static void pcie_bus_detect_mps(struct pci_dev *dev) ··· 1647 1652 pcie_write_mps(dev, mps); 1648 1653 pcie_write_mrrs(dev); 1649 1654 1650 - dev_info(&dev->dev, "Max Payload Size set to %4d/%4d (was %4d), " 1651 - "Max Read Rq %4d\n", pcie_get_mps(dev), 128 << dev->pcie_mpss, 1655 + dev_info(&dev->dev, "Max Payload Size set to %4d/%4d (was %4d), Max Read Rq %4d\n", 1656 + pcie_get_mps(dev), 128 << dev->pcie_mpss, 1652 1657 orig_mps, pcie_get_readrq(dev)); 1653 1658 1654 1659 return 0; ··· 1711 1716 bus->is_added = 1; 1712 1717 } 1713 1718 1714 - for (pass=0; pass < 2; pass++) 1719 + for (pass = 0; pass < 2; pass++) 1715 1720 list_for_each_entry(dev, &bus->devices, bus_list) { 1716 1721 if (pci_is_bridge(dev)) 1717 1722 max = pci_scan_bridge(bus, dev, max, pass); ··· 1727 1732 dev_dbg(&bus->dev, "bus scan returning with max=%02x\n", max); 1728 1733 return max; 1729 1734 } 1735 + EXPORT_SYMBOL_GPL(pci_scan_child_bus); 1730 1736 1731 1737 /** 1732 1738 * pcibios_root_bridge_prepare - Platform-specific host bridge setup. ··· 2036 2040 } 2037 2041 EXPORT_SYMBOL_GPL(pci_rescan_bus); 2038 2042 2039 - EXPORT_SYMBOL(pci_add_new_bus); 2040 - EXPORT_SYMBOL(pci_scan_slot); 2041 - EXPORT_SYMBOL(pci_scan_bridge); 2042 - EXPORT_SYMBOL_GPL(pci_scan_child_bus); 2043 - 2044 2043 /* 2045 2044 * pci_rescan_bus(), pci_rescan_bus_bridge_resize() and PCI device removal 2046 2045 * routines should always be executed under this mutex. ··· 2054 2063 } 2055 2064 EXPORT_SYMBOL_GPL(pci_unlock_rescan_remove); 2056 2065 2057 - static int __init pci_sort_bf_cmp(const struct device *d_a, const struct device *d_b) 2066 + static int __init pci_sort_bf_cmp(const struct device *d_a, 2067 + const struct device *d_b) 2058 2068 { 2059 2069 const struct pci_dev *a = to_pci_dev(d_a); 2060 2070 const struct pci_dev *b = to_pci_dev(d_b);
+7 -9
drivers/pci/proc.c
··· 17 17 18 18 static int proc_initialized; /* = 0 */ 19 19 20 - static loff_t 21 - proc_bus_pci_lseek(struct file *file, loff_t off, int whence) 20 + static loff_t proc_bus_pci_lseek(struct file *file, loff_t off, int whence) 22 21 { 23 22 struct pci_dev *dev = PDE_DATA(file_inode(file)); 24 23 return fixed_size_llseek(file, off, whence, dev->cfg_size); 25 24 } 26 25 27 - static ssize_t 28 - proc_bus_pci_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) 26 + static ssize_t proc_bus_pci_read(struct file *file, char __user *buf, 27 + size_t nbytes, loff_t *ppos) 29 28 { 30 29 struct pci_dev *dev = PDE_DATA(file_inode(file)); 31 30 unsigned int pos = *ppos; ··· 107 108 return nbytes; 108 109 } 109 110 110 - static ssize_t 111 - proc_bus_pci_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos) 111 + static ssize_t proc_bus_pci_write(struct file *file, const char __user *buf, 112 + size_t nbytes, loff_t *ppos) 112 113 { 113 114 struct inode *ino = file_inode(file); 114 115 struct pci_dev *dev = PDE_DATA(ino); ··· 412 413 return 0; 413 414 } 414 415 415 - int pci_proc_detach_bus(struct pci_bus* bus) 416 + int pci_proc_detach_bus(struct pci_bus *bus) 416 417 { 417 418 proc_remove(bus->procdir); 418 419 return 0; ··· 422 423 { 423 424 return seq_open(file, &proc_bus_pci_devices_op); 424 425 } 426 + 425 427 static const struct file_operations proc_bus_pci_dev_operations = { 426 428 .owner = THIS_MODULE, 427 429 .open = proc_bus_pci_dev_open, ··· 443 443 444 444 return 0; 445 445 } 446 - 447 446 device_initcall(pci_proc_init); 448 -
+148 -84
drivers/pci/quirks.c
··· 48 48 { 49 49 dev->broken_parity_status = 1; /* This device gives false positives */ 50 50 } 51 - DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX,PCI_DEVICE_ID_MELLANOX_TAVOR,quirk_mellanox_tavor); 52 - DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX,PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE,quirk_mellanox_tavor); 51 + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR, quirk_mellanox_tavor); 52 + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE, quirk_mellanox_tavor); 53 53 54 54 /* Deal with broken BIOSes that neglect to enable passive release, 55 55 which can cause problems in combination with the 82441FX/PPro MTRRs */ ··· 82 82 static void quirk_isa_dma_hangs(struct pci_dev *dev) 83 83 { 84 84 if (!isa_dma_bridge_buggy) { 85 - isa_dma_bridge_buggy=1; 85 + isa_dma_bridge_buggy = 1; 86 86 dev_info(&dev->dev, "Activating ISA DMA hang workarounds\n"); 87 87 } 88 88 } ··· 123 123 */ 124 124 static void quirk_nopcipci(struct pci_dev *dev) 125 125 { 126 - if ((pci_pci_problems & PCIPCI_FAIL)==0) { 126 + if ((pci_pci_problems & PCIPCI_FAIL) == 0) { 127 127 dev_info(&dev->dev, "Disabling direct PCI/PCI transfers\n"); 128 128 pci_pci_problems |= PCIPCI_FAIL; 129 129 } ··· 148 148 */ 149 149 static void quirk_triton(struct pci_dev *dev) 150 150 { 151 - if ((pci_pci_problems&PCIPCI_TRITON)==0) { 151 + if ((pci_pci_problems&PCIPCI_TRITON) == 0) { 152 152 dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n"); 153 153 pci_pci_problems |= PCIPCI_TRITON; 154 154 } ··· 163 163 * Made according to a windows driver based patch by George E. Breese 164 164 * see PCI Latency Adjust on http://www.viahardware.com/download/viatweak.shtm 165 165 * and http://www.georgebreese.com/net/software/#PCI 166 - * Also see http://www.au-ja.org/review-kt133a-1-en.phtml for 167 - * the info on which Mr Breese based his work. 166 + * Also see http://www.au-ja.org/review-kt133a-1-en.phtml for 167 + * the info on which Mr Breese based his work. 168 168 * 169 169 * Updated based on further information from the site and also on 170 170 * information provided by VIA ··· 177 177 a buggy southbridge */ 178 178 179 179 p = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, NULL); 180 - if (p!=NULL) { 180 + if (p != NULL) { 181 181 /* 0x40 - 0x4f == 686B, 0x10 - 0x2f == 686A; thanks Dan Hollis */ 182 182 /* Check for buggy part revisions */ 183 183 if (p->revision < 0x40 || p->revision > 0x42) 184 184 goto exit; 185 185 } else { 186 186 p = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8231, NULL); 187 - if (p==NULL) /* No problem parts */ 187 + if (p == NULL) /* No problem parts */ 188 188 goto exit; 189 189 /* Check for buggy part revisions */ 190 190 if (p->revision < 0x10 || p->revision > 0x12) ··· 227 227 */ 228 228 static void quirk_viaetbf(struct pci_dev *dev) 229 229 { 230 - if ((pci_pci_problems&PCIPCI_VIAETBF)==0) { 230 + if ((pci_pci_problems&PCIPCI_VIAETBF) == 0) { 231 231 dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n"); 232 232 pci_pci_problems |= PCIPCI_VIAETBF; 233 233 } ··· 236 236 237 237 static void quirk_vsfx(struct pci_dev *dev) 238 238 { 239 - if ((pci_pci_problems&PCIPCI_VSFX)==0) { 239 + if ((pci_pci_problems&PCIPCI_VSFX) == 0) { 240 240 dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n"); 241 241 pci_pci_problems |= PCIPCI_VSFX; 242 242 } ··· 251 251 */ 252 252 static void quirk_alimagik(struct pci_dev *dev) 253 253 { 254 - if ((pci_pci_problems&PCIPCI_ALIMAGIK)==0) { 254 + if ((pci_pci_problems&PCIPCI_ALIMAGIK) == 0) { 255 255 dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n"); 256 256 pci_pci_problems |= PCIPCI_ALIMAGIK|PCIPCI_TRITON; 257 257 } ··· 265 265 */ 266 266 static void quirk_natoma(struct pci_dev *dev) 267 267 { 268 - if ((pci_pci_problems&PCIPCI_NATOMA)==0) { 268 + if ((pci_pci_problems&PCIPCI_NATOMA) == 0) { 269 269 dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n"); 270 270 pci_pci_problems |= PCIPCI_NATOMA; 271 271 } ··· 315 315 if (pci_resource_len(dev, 0) != 8) { 316 316 struct resource *res = &dev->resource[0]; 317 317 res->end = res->start + 8 - 1; 318 - dev_info(&dev->dev, "CS5536 ISA bridge bug detected " 319 - "(incorrect header); workaround applied.\n"); 318 + dev_info(&dev->dev, "CS5536 ISA bridge bug detected (incorrect header); workaround applied\n"); 320 319 } 321 320 } 322 321 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA, quirk_cs5536_vsa); ··· 399 400 * let's get enough confirmation reports first. 400 401 */ 401 402 base &= -size; 402 - dev_info(&dev->dev, "%s PIO at %04x-%04x\n", name, base, base + size - 1); 403 + dev_info(&dev->dev, "%s PIO at %04x-%04x\n", name, base, 404 + base + size - 1); 403 405 } 404 406 405 407 static void piix4_mem_quirk(struct pci_dev *dev, const char *name, unsigned int port, unsigned int enable) ··· 425 425 * reserve it, but let's get enough confirmation reports first. 426 426 */ 427 427 base &= -size; 428 - dev_info(&dev->dev, "%s MMIO at %04x-%04x\n", name, base, base + size - 1); 428 + dev_info(&dev->dev, "%s MMIO at %04x-%04x\n", name, base, 429 + base + size - 1); 429 430 } 430 431 431 432 /* ··· 669 668 struct pci_dev *pdev; 670 669 u16 command; 671 670 672 - dev_warn(&dev->dev, "TI XIO2000a quirk detected; " 673 - "secondary bus fast back-to-back transfers disabled\n"); 671 + dev_warn(&dev->dev, "TI XIO2000a quirk detected; secondary bus fast back-to-back transfers disabled\n"); 674 672 list_for_each_entry(pdev, &dev->subordinate->devices, bus_list) { 675 673 pci_read_config_word(pdev, PCI_COMMAND, &command); 676 674 if (command & PCI_COMMAND_FAST_BACK) ··· 703 703 tmp == 0 ? "Disa" : "Ena"); 704 704 705 705 /* Offset 0x58: External APIC IRQ output control */ 706 - pci_write_config_byte (dev, 0x58, tmp); 706 + pci_write_config_byte(dev, 0x58, tmp); 707 707 } 708 708 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_ioapic); 709 709 DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_ioapic); ··· 761 761 static void quirk_amd_8131_mmrbc(struct pci_dev *dev) 762 762 { 763 763 if (dev->subordinate && dev->revision <= 0x12) { 764 - dev_info(&dev->dev, "AMD8131 rev %x detected; " 765 - "disabling PCI-X MMRBC\n", dev->revision); 764 + dev_info(&dev->dev, "AMD8131 rev %x detected; disabling PCI-X MMRBC\n", 765 + dev->revision); 766 766 dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MMRBC; 767 767 } 768 768 } ··· 916 916 { 917 917 u32 pcic; 918 918 pci_read_config_dword(dev, 0x4C, &pcic); 919 - if ((pcic&6)!=6) { 919 + if ((pcic & 6) != 6) { 920 920 pcic |= 6; 921 921 dev_warn(&dev->dev, "BIOS failed to enable PCI standards compliance; fixing this error\n"); 922 922 pci_write_config_dword(dev, 0x4C, pcic); 923 923 pci_read_config_dword(dev, 0x84, &pcic); 924 - pcic |= (1<<23); /* Required in this mode */ 924 + pcic |= (1 << 23); /* Required in this mode */ 925 925 pci_write_config_dword(dev, 0x84, pcic); 926 926 } 927 927 } ··· 937 937 */ 938 938 static void quirk_dunord(struct pci_dev *dev) 939 939 { 940 - struct resource *r = &dev->resource [1]; 940 + struct resource *r = &dev->resource[1]; 941 941 942 942 r->flags |= IORESOURCE_UNSET; 943 943 r->start = 0; ··· 967 967 static void quirk_mediagx_master(struct pci_dev *dev) 968 968 { 969 969 u8 reg; 970 + 970 971 pci_read_config_byte(dev, 0x41, &reg); 971 972 if (reg & 2) { 972 973 reg &= ~2; 973 - dev_info(&dev->dev, "Fixup for MediaGX/Geode Slave Disconnect Boundary (0x41=0x%02x)\n", reg); 974 - pci_write_config_byte(dev, 0x41, reg); 974 + dev_info(&dev->dev, "Fixup for MediaGX/Geode Slave Disconnect Boundary (0x41=0x%02x)\n", 975 + reg); 976 + pci_write_config_byte(dev, 0x41, reg); 975 977 } 976 978 } 977 979 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_PCI_MASTER, quirk_mediagx_master); ··· 1122 1120 { 1123 1121 if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_ASUSTEK)) { 1124 1122 if (dev->device == PCI_DEVICE_ID_INTEL_82845_HB) 1125 - switch(dev->subsystem_device) { 1123 + switch (dev->subsystem_device) { 1126 1124 case 0x8025: /* P4B-LX */ 1127 1125 case 0x8070: /* P4B */ 1128 1126 case 0x8088: /* P4B533 */ ··· 1130 1128 asus_hides_smbus = 1; 1131 1129 } 1132 1130 else if (dev->device == PCI_DEVICE_ID_INTEL_82845G_HB) 1133 - switch(dev->subsystem_device) { 1131 + switch (dev->subsystem_device) { 1134 1132 case 0x80b1: /* P4GE-V */ 1135 1133 case 0x80b2: /* P4PE */ 1136 1134 case 0x8093: /* P4B533-V */ 1137 1135 asus_hides_smbus = 1; 1138 1136 } 1139 1137 else if (dev->device == PCI_DEVICE_ID_INTEL_82850_HB) 1140 - switch(dev->subsystem_device) { 1138 + switch (dev->subsystem_device) { 1141 1139 case 0x8030: /* P4T533 */ 1142 1140 asus_hides_smbus = 1; 1143 1141 } ··· 1177 1175 } 1178 1176 } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_HP)) { 1179 1177 if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB) 1180 - switch(dev->subsystem_device) { 1178 + switch (dev->subsystem_device) { 1181 1179 case 0x088C: /* HP Compaq nc8000 */ 1182 1180 case 0x0890: /* HP Compaq nc6000 */ 1183 1181 asus_hides_smbus = 1; ··· 1194 1192 case 0x12bf: /* HP xw4100 */ 1195 1193 asus_hides_smbus = 1; 1196 1194 } 1197 - } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG)) { 1198 - if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB) 1199 - switch(dev->subsystem_device) { 1200 - case 0xC00C: /* Samsung P35 notebook */ 1201 - asus_hides_smbus = 1; 1202 - } 1195 + } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG)) { 1196 + if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB) 1197 + switch (dev->subsystem_device) { 1198 + case 0xC00C: /* Samsung P35 notebook */ 1199 + asus_hides_smbus = 1; 1200 + } 1203 1201 } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ)) { 1204 1202 if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB) 1205 - switch(dev->subsystem_device) { 1203 + switch (dev->subsystem_device) { 1206 1204 case 0x0058: /* Compaq Evo N620c */ 1207 1205 asus_hides_smbus = 1; 1208 1206 } 1209 1207 else if (dev->device == PCI_DEVICE_ID_INTEL_82810_IG3) 1210 - switch(dev->subsystem_device) { 1208 + switch (dev->subsystem_device) { 1211 1209 case 0xB16C: /* Compaq Deskpro EP 401963-001 (PCA# 010174) */ 1212 1210 /* Motherboard doesn't have Host bridge 1213 1211 * subvendor/subdevice IDs, therefore checking ··· 1215 1213 asus_hides_smbus = 1; 1216 1214 } 1217 1215 else if (dev->device == PCI_DEVICE_ID_INTEL_82801DB_2) 1218 - switch(dev->subsystem_device) { 1216 + switch (dev->subsystem_device) { 1219 1217 case 0x00b8: /* Compaq Evo D510 CMT */ 1220 1218 case 0x00b9: /* Compaq Evo D510 SFF */ 1221 1219 case 0x00ba: /* Compaq Evo D510 USDT */ ··· 1263 1261 pci_write_config_word(dev, 0xF2, val & (~0x8)); 1264 1262 pci_read_config_word(dev, 0xF2, &val); 1265 1263 if (val & 0x8) 1266 - dev_info(&dev->dev, "i801 SMBus device continues to play 'hide and seek'! 0x%x\n", val); 1264 + dev_info(&dev->dev, "i801 SMBus device continues to play 'hide and seek'! 0x%x\n", 1265 + val); 1267 1266 else 1268 1267 dev_info(&dev->dev, "Enabled i801 SMBus device\n"); 1269 1268 } ··· 1412 1409 pci_write_config_byte(dev, 0x50, val & (~0xc0)); 1413 1410 pci_read_config_byte(dev, 0x50, &val); 1414 1411 if (val & 0xc0) 1415 - dev_info(&dev->dev, "Onboard AC97/MC97 devices continue to play 'hide and seek'! 0x%x\n", val); 1412 + dev_info(&dev->dev, "Onboard AC97/MC97 devices continue to play 'hide and seek'! 0x%x\n", 1413 + val); 1416 1414 else 1417 1415 dev_info(&dev->dev, "Enabled onboard AC97/MC97 devices\n"); 1418 1416 } ··· 1518 1514 1519 1515 /* The next five BARs all seem to be rubbish, so just clean 1520 1516 * them out */ 1521 - for (i=1; i < 6; i++) { 1517 + for (i = 1; i < 6; i++) 1522 1518 memset(&pdev->resource[i], 0, sizeof(pdev->resource[i])); 1523 - } 1524 - 1525 1519 } 1526 1520 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EESSC, quirk_alder_ioapic); 1527 1521 #endif ··· 1554 1552 * Some Intel PCI Express chipsets have trouble with downstream 1555 1553 * device power management. 1556 1554 */ 1557 - static void quirk_intel_pcie_pm(struct pci_dev * dev) 1555 + static void quirk_intel_pcie_pm(struct pci_dev *dev) 1558 1556 { 1559 1557 pci_pm_d3_delay = 120; 1560 1558 dev->no_d1d2 = 1; ··· 1723 1721 1724 1722 pci_read_config_word(dev, AMD_8111_PCI_IRQ_ROUTING, &pci_config_word); 1725 1723 if (!pci_config_word) { 1726 - dev_info(&dev->dev, "boot interrupts on device [%04x:%04x] " 1727 - "already disabled\n", dev->vendor, dev->device); 1724 + dev_info(&dev->dev, "boot interrupts on device [%04x:%04x] already disabled\n", 1725 + dev->vendor, dev->device); 1728 1726 return; 1729 1727 } 1730 1728 pci_write_config_word(dev, AMD_8111_PCI_IRQ_ROUTING, 0); ··· 1772 1770 if (pci_resource_len(dev, bar) == 0x80 && 1773 1771 (pci_resource_start(dev, bar) & 0x80)) { 1774 1772 struct resource *r = &dev->resource[bar]; 1775 - dev_info(&dev->dev, 1776 - "Re-allocating PLX PCI 9050 BAR %u to length 256 to avoid bit 7 bug\n", 1773 + dev_info(&dev->dev, "Re-allocating PLX PCI 9050 BAR %u to length 256 to avoid bit 7 bug\n", 1777 1774 bar); 1778 1775 r->flags |= IORESOURCE_UNSET; 1779 1776 r->start = 0; ··· 1819 1818 case PCI_DEVICE_ID_NETMOS_9845: 1820 1819 case PCI_DEVICE_ID_NETMOS_9855: 1821 1820 if (num_parallel) { 1822 - dev_info(&dev->dev, "Netmos %04x (%u parallel, " 1823 - "%u serial); changing class SERIAL to OTHER " 1824 - "(use parport_serial)\n", 1821 + dev_info(&dev->dev, "Netmos %04x (%u parallel, %u serial); changing class SERIAL to OTHER (use parport_serial)\n", 1825 1822 dev->device, num_parallel, num_serial); 1826 1823 dev->class = (PCI_CLASS_COMMUNICATION_OTHER << 8) | 1827 1824 (dev->class & 0xff); ··· 1886 1887 1887 1888 cmd_hi = readb(csr + 3); 1888 1889 if (cmd_hi == 0) { 1889 - dev_warn(&dev->dev, "Firmware left e100 interrupts enabled; " 1890 - "disabling\n"); 1890 + dev_warn(&dev->dev, "Firmware left e100 interrupts enabled; disabling\n"); 1891 1891 writeb(1, csr + 3); 1892 1892 } 1893 1893 ··· 1956 1958 if (pci_read_config_byte(dev, 0xf41, &b) == 0) { 1957 1959 if (!(b & 0x20)) { 1958 1960 pci_write_config_byte(dev, 0xf41, b | 0x20); 1959 - dev_info(&dev->dev, 1960 - "Linking AER extended capability\n"); 1961 + dev_info(&dev->dev, "Linking AER extended capability\n"); 1961 1962 } 1962 1963 } 1963 1964 } ··· 1994 1997 /* Turn off PCI Bus Parking */ 1995 1998 pci_write_config_byte(dev, 0x76, b ^ 0x40); 1996 1999 1997 - dev_info(&dev->dev, 1998 - "Disabling VIA CX700 PCI parking\n"); 2000 + dev_info(&dev->dev, "Disabling VIA CX700 PCI parking\n"); 1999 2001 } 2000 2002 } 2001 2003 ··· 2009 2013 /* Disable "Read FIFO Timer" */ 2010 2014 pci_write_config_byte(dev, 0x77, 0x0); 2011 2015 2012 - dev_info(&dev->dev, 2013 - "Disabling VIA CX700 PCI caching\n"); 2016 + dev_info(&dev->dev, "Disabling VIA CX700 PCI caching\n"); 2014 2017 } 2015 2018 } 2016 2019 } ··· 2144 2149 static void quirk_disable_msi(struct pci_dev *dev) 2145 2150 { 2146 2151 if (dev->subordinate) { 2147 - dev_warn(&dev->dev, "MSI quirk detected; " 2148 - "subordinate MSI disabled\n"); 2152 + dev_warn(&dev->dev, "MSI quirk detected; subordinate MSI disabled\n"); 2149 2153 dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI; 2150 2154 } 2151 2155 } ··· 2183 2189 u8 flags; 2184 2190 2185 2191 if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS, 2186 - &flags) == 0) 2187 - { 2192 + &flags) == 0) { 2188 2193 dev_info(&dev->dev, "Found %s HT MSI Mapping\n", 2189 2194 flags & HT_MSI_FLAGS_ENABLE ? 2190 2195 "enabled" : "disabled"); ··· 2200 2207 static void quirk_msi_ht_cap(struct pci_dev *dev) 2201 2208 { 2202 2209 if (dev->subordinate && !msi_ht_cap_enabled(dev)) { 2203 - dev_warn(&dev->dev, "MSI quirk detected; " 2204 - "subordinate MSI disabled\n"); 2210 + dev_warn(&dev->dev, "MSI quirk detected; subordinate MSI disabled\n"); 2205 2211 dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI; 2206 2212 } 2207 2213 } ··· 2224 2232 if (!pdev) 2225 2233 return; 2226 2234 if (!msi_ht_cap_enabled(dev) && !msi_ht_cap_enabled(pdev)) { 2227 - dev_warn(&dev->dev, "MSI quirk detected; " 2228 - "subordinate MSI disabled\n"); 2235 + dev_warn(&dev->dev, "MSI quirk detected; subordinate MSI disabled\n"); 2229 2236 dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI; 2230 2237 } 2231 2238 pci_dev_put(pdev); ··· 2270 2279 if (board_name && 2271 2280 (strstr(board_name, "P5N32-SLI PREMIUM") || 2272 2281 strstr(board_name, "P5N32-E SLI"))) { 2273 - dev_info(&dev->dev, 2274 - "Disabling msi for MCP55 NIC on P5N32-SLI\n"); 2282 + dev_info(&dev->dev, "Disabling msi for MCP55 NIC on P5N32-SLI\n"); 2275 2283 dev->no_msi = 1; 2276 2284 } 2277 2285 } ··· 2479 2489 */ 2480 2490 host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0)); 2481 2491 if (host_bridge == NULL) { 2482 - dev_warn(&dev->dev, 2483 - "nv_msi_ht_cap_quirk didn't locate host bridge\n"); 2492 + dev_warn(&dev->dev, "nv_msi_ht_cap_quirk didn't locate host bridge\n"); 2484 2493 return; 2485 2494 } 2486 2495 ··· 2806 2817 */ 2807 2818 err = pci_read_config_word(dev, 0x48, &rcc); 2808 2819 if (err) { 2809 - dev_err(&dev->dev, "Error attempting to read the read " 2810 - "completion coalescing register.\n"); 2820 + dev_err(&dev->dev, "Error attempting to read the read completion coalescing register\n"); 2811 2821 return; 2812 2822 } 2813 2823 ··· 2817 2829 2818 2830 err = pci_write_config_word(dev, 0x48, rcc); 2819 2831 if (err) { 2820 - dev_err(&dev->dev, "Error attempting to write the read " 2821 - "completion coalescing register.\n"); 2832 + dev_err(&dev->dev, "Error attempting to write the read completion coalescing register\n"); 2822 2833 return; 2823 2834 } 2824 2835 2825 - pr_info_once("Read completion coalescing disabled due to hardware " 2826 - "errata relating to 256B MPS.\n"); 2836 + pr_info_once("Read completion coalescing disabled due to hardware errata relating to 256B MPS\n"); 2827 2837 } 2828 2838 /* Intel 5000 series memory controllers and ports 2-7 */ 2829 2839 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x25c0, quirk_intel_mc_errata); ··· 2930 2944 2931 2945 /* Check if any interrupt line is still enabled */ 2932 2946 if (readl(regs + I915_DEIER_REG) != 0) { 2933 - dev_warn(&dev->dev, "BIOS left Intel GPU interrupts enabled; " 2934 - "disabling\n"); 2947 + dev_warn(&dev->dev, "BIOS left Intel GPU interrupts enabled; disabling\n"); 2935 2948 2936 2949 writel(0, regs + I915_DEIER_REG); 2937 2950 } ··· 3025 3040 { 3026 3041 struct pci_fixup *start, *end; 3027 3042 3028 - switch(pass) { 3043 + switch (pass) { 3029 3044 case pci_fixup_early: 3030 3045 start = __start_pci_fixups_early; 3031 3046 end = __end_pci_fixups_early; ··· 3097 3112 if (!tmp || cls == tmp) 3098 3113 continue; 3099 3114 3100 - printk(KERN_DEBUG "PCI: CLS mismatch (%u != %u), " 3101 - "using %u bytes\n", cls << 2, tmp << 2, 3115 + printk(KERN_DEBUG "PCI: CLS mismatch (%u != %u), using %u bytes\n", 3116 + cls << 2, tmp << 2, 3102 3117 pci_dfl_cache_line_size << 2); 3103 3118 pci_cache_line_size = pci_dfl_cache_line_size; 3104 3119 } ··· 3326 3341 3327 3342 return -ENOTTY; 3328 3343 } 3344 + 3345 + static void quirk_dma_func0_alias(struct pci_dev *dev) 3346 + { 3347 + if (PCI_FUNC(dev->devfn) != 0) { 3348 + dev->dma_alias_devfn = PCI_DEVFN(PCI_SLOT(dev->devfn), 0); 3349 + dev->dev_flags |= PCI_DEV_FLAGS_DMA_ALIAS_DEVFN; 3350 + } 3351 + } 3352 + 3353 + /* 3354 + * https://bugzilla.redhat.com/show_bug.cgi?id=605888 3355 + * 3356 + * Some Ricoh devices use function 0 as the PCIe requester ID for DMA. 3357 + */ 3358 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe832, quirk_dma_func0_alias); 3359 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe476, quirk_dma_func0_alias); 3360 + 3361 + static void quirk_dma_func1_alias(struct pci_dev *dev) 3362 + { 3363 + if (PCI_FUNC(dev->devfn) != 1) { 3364 + dev->dma_alias_devfn = PCI_DEVFN(PCI_SLOT(dev->devfn), 1); 3365 + dev->dev_flags |= PCI_DEV_FLAGS_DMA_ALIAS_DEVFN; 3366 + } 3367 + } 3368 + 3369 + /* 3370 + * Marvell 88SE9123 uses function 1 as the requester ID for DMA. In some 3371 + * SKUs function 1 is present and is a legacy IDE controller, in other 3372 + * SKUs this function is not present, making this a ghost requester. 3373 + * https://bugzilla.kernel.org/show_bug.cgi?id=42679 3374 + */ 3375 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9123, 3376 + quirk_dma_func1_alias); 3377 + /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c14 */ 3378 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9130, 3379 + quirk_dma_func1_alias); 3380 + /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c47 + c57 */ 3381 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9172, 3382 + quirk_dma_func1_alias); 3383 + /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c59 */ 3384 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x917a, 3385 + quirk_dma_func1_alias); 3386 + /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c46 */ 3387 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x91a0, 3388 + quirk_dma_func1_alias); 3389 + /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c49 */ 3390 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9230, 3391 + quirk_dma_func1_alias); 3392 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TTI, 0x0642, 3393 + quirk_dma_func1_alias); 3394 + /* https://bugs.gentoo.org/show_bug.cgi?id=497630 */ 3395 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_JMICRON, 3396 + PCI_DEVICE_ID_JMICRON_JMB388_ESD, 3397 + quirk_dma_func1_alias); 3398 + 3399 + /* 3400 + * A few PCIe-to-PCI bridges fail to expose a PCIe capability, resulting in 3401 + * using the wrong DMA alias for the device. Some of these devices can be 3402 + * used as either forward or reverse bridges, so we need to test whether the 3403 + * device is operating in the correct mode. We could probably apply this 3404 + * quirk to PCI_ANY_ID, but for now we'll just use known offenders. The test 3405 + * is for a non-root, non-PCIe bridge where the upstream device is PCIe and 3406 + * is not a PCIe-to-PCI bridge, then @pdev is actually a PCIe-to-PCI bridge. 3407 + */ 3408 + static void quirk_use_pcie_bridge_dma_alias(struct pci_dev *pdev) 3409 + { 3410 + if (!pci_is_root_bus(pdev->bus) && 3411 + pdev->hdr_type == PCI_HEADER_TYPE_BRIDGE && 3412 + !pci_is_pcie(pdev) && pci_is_pcie(pdev->bus->self) && 3413 + pci_pcie_type(pdev->bus->self) != PCI_EXP_TYPE_PCI_BRIDGE) 3414 + pdev->dev_flags |= PCI_DEV_FLAG_PCIE_BRIDGE_ALIAS; 3415 + } 3416 + /* ASM1083/1085, https://bugzilla.kernel.org/show_bug.cgi?id=44881#c46 */ 3417 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ASMEDIA, 0x1080, 3418 + quirk_use_pcie_bridge_dma_alias); 3419 + /* Tundra 8113, https://bugzilla.kernel.org/show_bug.cgi?id=44881#c43 */ 3420 + DECLARE_PCI_FIXUP_HEADER(0x10e3, 0x8113, quirk_use_pcie_bridge_dma_alias); 3421 + /* ITE 8892, https://bugzilla.kernel.org/show_bug.cgi?id=73551 */ 3422 + DECLARE_PCI_FIXUP_HEADER(0x1283, 0x8892, quirk_use_pcie_bridge_dma_alias); 3329 3423 3330 3424 static struct pci_dev *pci_func_0_dma_source(struct pci_dev *dev) 3331 3425 {
+6 -7
drivers/pci/rom.c
··· 38 38 pci_write_config_dword(pdev, pdev->rom_base_reg, rom_addr); 39 39 return 0; 40 40 } 41 + EXPORT_SYMBOL_GPL(pci_enable_rom); 41 42 42 43 /** 43 44 * pci_disable_rom - disable ROM decoding for a PCI device ··· 54 53 rom_addr &= ~PCI_ROM_ADDRESS_ENABLE; 55 54 pci_write_config_dword(pdev, pdev->rom_base_reg, rom_addr); 56 55 } 56 + EXPORT_SYMBOL_GPL(pci_disable_rom); 57 57 58 58 /** 59 59 * pci_get_rom_size - obtain the actual size of the ROM image ··· 137 135 } else { 138 136 /* assign the ROM an address if it doesn't have one */ 139 137 if (res->parent == NULL && 140 - pci_assign_resource(pdev,PCI_ROM_RESOURCE)) 138 + pci_assign_resource(pdev, PCI_ROM_RESOURCE)) 141 139 return NULL; 142 140 start = pci_resource_start(pdev, PCI_ROM_RESOURCE); 143 141 *size = pci_resource_len(pdev, PCI_ROM_RESOURCE); ··· 168 166 *size = pci_get_rom_size(pdev, rom, *size); 169 167 return rom; 170 168 } 169 + EXPORT_SYMBOL(pci_map_rom); 171 170 172 171 /** 173 172 * pci_unmap_rom - unmap the ROM from kernel space ··· 190 187 if (!(res->flags & (IORESOURCE_ROM_ENABLE | IORESOURCE_ROM_SHADOW))) 191 188 pci_disable_rom(pdev); 192 189 } 190 + EXPORT_SYMBOL(pci_unmap_rom); 193 191 194 192 /** 195 193 * pci_cleanup_rom - free the ROM copy created by pci_map_rom_copy ··· 203 199 struct resource *res = &pdev->resource[PCI_ROM_RESOURCE]; 204 200 205 201 if (res->flags & IORESOURCE_ROM_COPY) { 206 - kfree((void*)(unsigned long)res->start); 202 + kfree((void *)(unsigned long)res->start); 207 203 res->flags |= IORESOURCE_UNSET; 208 204 res->flags &= ~IORESOURCE_ROM_COPY; 209 205 res->start = 0; ··· 226 222 227 223 return NULL; 228 224 } 229 - 230 - EXPORT_SYMBOL(pci_map_rom); 231 - EXPORT_SYMBOL(pci_unmap_rom); 232 - EXPORT_SYMBOL_GPL(pci_enable_rom); 233 - EXPORT_SYMBOL_GPL(pci_disable_rom); 234 225 EXPORT_SYMBOL(pci_platform_rom);
+100 -18
drivers/pci/search.c
··· 17 17 EXPORT_SYMBOL_GPL(pci_bus_sem); 18 18 19 19 /* 20 + * pci_for_each_dma_alias - Iterate over DMA aliases for a device 21 + * @pdev: starting downstream device 22 + * @fn: function to call for each alias 23 + * @data: opaque data to pass to @fn 24 + * 25 + * Starting @pdev, walk up the bus calling @fn for each possible alias 26 + * of @pdev at the root bus. 27 + */ 28 + int pci_for_each_dma_alias(struct pci_dev *pdev, 29 + int (*fn)(struct pci_dev *pdev, 30 + u16 alias, void *data), void *data) 31 + { 32 + struct pci_bus *bus; 33 + int ret; 34 + 35 + ret = fn(pdev, PCI_DEVID(pdev->bus->number, pdev->devfn), data); 36 + if (ret) 37 + return ret; 38 + 39 + /* 40 + * If the device is broken and uses an alias requester ID for 41 + * DMA, iterate over that too. 42 + */ 43 + if (unlikely(pdev->dev_flags & PCI_DEV_FLAGS_DMA_ALIAS_DEVFN)) { 44 + ret = fn(pdev, PCI_DEVID(pdev->bus->number, 45 + pdev->dma_alias_devfn), data); 46 + if (ret) 47 + return ret; 48 + } 49 + 50 + for (bus = pdev->bus; !pci_is_root_bus(bus); bus = bus->parent) { 51 + struct pci_dev *tmp; 52 + 53 + /* Skip virtual buses */ 54 + if (!bus->self) 55 + continue; 56 + 57 + tmp = bus->self; 58 + 59 + /* 60 + * PCIe-to-PCI/X bridges alias transactions from downstream 61 + * devices using the subordinate bus number (PCI Express to 62 + * PCI/PCI-X Bridge Spec, rev 1.0, sec 2.3). For all cases 63 + * where the upstream bus is PCI/X we alias to the bridge 64 + * (there are various conditions in the previous reference 65 + * where the bridge may take ownership of transactions, even 66 + * when the secondary interface is PCI-X). 67 + */ 68 + if (pci_is_pcie(tmp)) { 69 + switch (pci_pcie_type(tmp)) { 70 + case PCI_EXP_TYPE_ROOT_PORT: 71 + case PCI_EXP_TYPE_UPSTREAM: 72 + case PCI_EXP_TYPE_DOWNSTREAM: 73 + continue; 74 + case PCI_EXP_TYPE_PCI_BRIDGE: 75 + ret = fn(tmp, 76 + PCI_DEVID(tmp->subordinate->number, 77 + PCI_DEVFN(0, 0)), data); 78 + if (ret) 79 + return ret; 80 + continue; 81 + case PCI_EXP_TYPE_PCIE_BRIDGE: 82 + ret = fn(tmp, 83 + PCI_DEVID(tmp->bus->number, 84 + tmp->devfn), data); 85 + if (ret) 86 + return ret; 87 + continue; 88 + } 89 + } else { 90 + if (tmp->dev_flags & PCI_DEV_FLAG_PCIE_BRIDGE_ALIAS) 91 + ret = fn(tmp, 92 + PCI_DEVID(tmp->subordinate->number, 93 + PCI_DEVFN(0, 0)), data); 94 + else 95 + ret = fn(tmp, 96 + PCI_DEVID(tmp->bus->number, 97 + tmp->devfn), data); 98 + if (ret) 99 + return ret; 100 + } 101 + } 102 + 103 + return ret; 104 + } 105 + 106 + /* 20 107 * find the upstream PCIe-to-PCI bridge of a PCI device 21 108 * if the device is PCIE, return NULL 22 109 * if the device isn't connected to a PCIe bridge (that is its parent is a 23 110 * legacy PCI bridge and the bridge is directly connected to bus 0), return its 24 111 * parent 25 112 */ 26 - struct pci_dev * 27 - pci_find_upstream_pcie_bridge(struct pci_dev *pdev) 113 + struct pci_dev *pci_find_upstream_pcie_bridge(struct pci_dev *pdev) 28 114 { 29 115 struct pci_dev *tmp = NULL; 30 116 ··· 142 56 struct pci_bus *child; 143 57 struct pci_bus *tmp; 144 58 145 - if(bus->number == busnr) 59 + if (bus->number == busnr) 146 60 return bus; 147 61 148 62 list_for_each_entry(tmp, &bus->children, node) { 149 63 child = pci_do_find_bus(tmp, busnr); 150 - if(child) 64 + if (child) 151 65 return child; 152 66 } 153 67 return NULL; ··· 162 76 * in the global list of PCI buses. If the bus is found, a pointer to its 163 77 * data structure is returned. If no bus is found, %NULL is returned. 164 78 */ 165 - struct pci_bus * pci_find_bus(int domain, int busnr) 79 + struct pci_bus *pci_find_bus(int domain, int busnr) 166 80 { 167 81 struct pci_bus *bus = NULL; 168 82 struct pci_bus *tmp_bus; ··· 176 90 } 177 91 return NULL; 178 92 } 93 + EXPORT_SYMBOL(pci_find_bus); 179 94 180 95 /** 181 96 * pci_find_next_bus - begin or continue searching for a PCI bus ··· 187 100 * @from is not %NULL, searches continue from next device on the 188 101 * global list. 189 102 */ 190 - struct pci_bus * 191 - pci_find_next_bus(const struct pci_bus *from) 103 + struct pci_bus *pci_find_next_bus(const struct pci_bus *from) 192 104 { 193 105 struct list_head *n; 194 106 struct pci_bus *b = NULL; ··· 200 114 up_read(&pci_bus_sem); 201 115 return b; 202 116 } 117 + EXPORT_SYMBOL(pci_find_next_bus); 203 118 204 119 /** 205 120 * pci_get_slot - locate PCI device for a given PCI slot ··· 234 147 up_read(&pci_bus_sem); 235 148 return dev; 236 149 } 150 + EXPORT_SYMBOL(pci_get_slot); 237 151 238 152 /** 239 153 * pci_get_domain_bus_and_slot - locate PCI device for a given PCI domain (segment), bus, and slot ··· 339 251 340 252 return pci_get_dev_by_id(&id, from); 341 253 } 254 + EXPORT_SYMBOL(pci_get_subsys); 342 255 343 256 /** 344 257 * pci_get_device - begin or continue searching for a PCI device by vendor/device id ··· 355 266 * from next device on the global list. The reference count for @from is 356 267 * always decremented if it is not %NULL. 357 268 */ 358 - struct pci_dev * 359 - pci_get_device(unsigned int vendor, unsigned int device, struct pci_dev *from) 269 + struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device, 270 + struct pci_dev *from) 360 271 { 361 272 return pci_get_subsys(vendor, device, PCI_ANY_ID, PCI_ANY_ID, from); 362 273 } 274 + EXPORT_SYMBOL(pci_get_device); 363 275 364 276 /** 365 277 * pci_get_class - begin or continue searching for a PCI device by class ··· 389 299 390 300 return pci_get_dev_by_id(&id, from); 391 301 } 302 + EXPORT_SYMBOL(pci_get_class); 392 303 393 304 /** 394 305 * pci_dev_present - Returns 1 if device matching the device list is present, 0 if not. ··· 419 328 return 0; 420 329 } 421 330 EXPORT_SYMBOL(pci_dev_present); 422 - 423 - /* For boot time work */ 424 - EXPORT_SYMBOL(pci_find_bus); 425 - EXPORT_SYMBOL(pci_find_next_bus); 426 - /* For everyone */ 427 - EXPORT_SYMBOL(pci_get_device); 428 - EXPORT_SYMBOL(pci_get_subsys); 429 - EXPORT_SYMBOL(pci_get_slot); 430 - EXPORT_SYMBOL(pci_get_class);
+23 -28
drivers/pci/setup-bus.c
··· 68 68 69 69 tmp = kzalloc(sizeof(*tmp), GFP_KERNEL); 70 70 if (!tmp) { 71 - pr_warning("add_to_list: kmalloc() failed!\n"); 71 + pr_warn("add_to_list: kmalloc() failed!\n"); 72 72 return -ENOMEM; 73 73 } 74 74 ··· 148 148 149 149 tmp = kzalloc(sizeof(*tmp), GFP_KERNEL); 150 150 if (!tmp) 151 - panic("pdev_sort_resources(): " 152 - "kmalloc() failed!\n"); 151 + panic("pdev_sort_resources(): kmalloc() failed!\n"); 153 152 tmp->res = r; 154 153 tmp->dev = dev; 155 154 ··· 735 736 { 736 737 if (size < min_size) 737 738 size = min_size; 738 - if (old_size == 1 ) 739 + if (old_size == 1) 739 740 old_size = 0; 740 741 /* To be fixed in 2.5: we should have sort of HAVE_ISA 741 742 flag in the struct pci_bus. */ ··· 756 757 { 757 758 if (size < min_size) 758 759 size = min_size; 759 - if (old_size == 1 ) 760 + if (old_size == 1) 760 761 old_size = 0; 761 762 if (size < old_size) 762 763 size = old_size; ··· 858 859 resource_size(b_res), min_align); 859 860 if (!size0 && !size1) { 860 861 if (b_res->start || b_res->end) 861 - dev_info(&bus->self->dev, "disabling bridge window " 862 - "%pR to %pR (unused)\n", b_res, 863 - &bus->busn_res); 862 + dev_info(&bus->self->dev, "disabling bridge window %pR to %pR (unused)\n", 863 + b_res, &bus->busn_res); 864 864 b_res->flags = 0; 865 865 return; 866 866 } ··· 870 872 if (size1 > size0 && realloc_head) { 871 873 add_to_list(realloc_head, bus->self, b_res, size1-size0, 872 874 min_align); 873 - dev_printk(KERN_DEBUG, &bus->self->dev, "bridge window " 874 - "%pR to %pR add_size %llx\n", b_res, 875 - &bus->busn_res, 876 - (unsigned long long)size1-size0); 875 + dev_printk(KERN_DEBUG, &bus->self->dev, "bridge window %pR to %pR add_size %llx\n", 876 + b_res, &bus->busn_res, 877 + (unsigned long long)size1-size0); 877 878 } 878 879 } 879 880 ··· 971 974 if (order < 0) 972 975 order = 0; 973 976 if (order >= ARRAY_SIZE(aligns)) { 974 - dev_warn(&dev->dev, "disabling BAR %d: %pR " 975 - "(bad alignment %#llx)\n", i, r, 976 - (unsigned long long) align); 977 + dev_warn(&dev->dev, "disabling BAR %d: %pR (bad alignment %#llx)\n", 978 + i, r, (unsigned long long) align); 977 979 r->flags = 0; 978 980 continue; 979 981 } ··· 999 1003 resource_size(b_res), min_align); 1000 1004 if (!size0 && !size1) { 1001 1005 if (b_res->start || b_res->end) 1002 - dev_info(&bus->self->dev, "disabling bridge window " 1003 - "%pR to %pR (unused)\n", b_res, 1004 - &bus->busn_res); 1006 + dev_info(&bus->self->dev, "disabling bridge window %pR to %pR (unused)\n", 1007 + b_res, &bus->busn_res); 1005 1008 b_res->flags = 0; 1006 1009 return 0; 1007 1010 } ··· 1009 1014 b_res->flags |= IORESOURCE_STARTALIGN; 1010 1015 if (size1 > size0 && realloc_head) { 1011 1016 add_to_list(realloc_head, bus->self, b_res, size1-size0, min_align); 1012 - dev_printk(KERN_DEBUG, &bus->self->dev, "bridge window " 1013 - "%pR to %pR add_size %llx\n", b_res, 1014 - &bus->busn_res, (unsigned long long)size1-size0); 1017 + dev_printk(KERN_DEBUG, &bus->self->dev, "bridge window %pR to %pR add_size %llx\n", 1018 + b_res, &bus->busn_res, 1019 + (unsigned long long)size1-size0); 1015 1020 } 1016 1021 return 0; 1017 1022 } ··· 1269 1274 break; 1270 1275 1271 1276 default: 1272 - dev_info(&dev->dev, "not setting up bridge for bus " 1273 - "%04x:%02x\n", pci_domain_nr(b), b->number); 1277 + dev_info(&dev->dev, "not setting up bridge for bus %04x:%02x\n", 1278 + pci_domain_nr(b), b->number); 1274 1279 break; 1275 1280 } 1276 1281 } ··· 1307 1312 break; 1308 1313 1309 1314 default: 1310 - dev_info(&bridge->dev, "not setting up bridge for bus " 1311 - "%04x:%02x\n", pci_domain_nr(b), b->number); 1315 + dev_info(&bridge->dev, "not setting up bridge for bus %04x:%02x\n", 1316 + pci_domain_nr(b), b->number); 1312 1317 break; 1313 1318 } 1314 1319 } ··· 1425 1430 1426 1431 pci_bus_for_each_resource(bus, res, i) { 1427 1432 if (!res || !res->end || !res->flags) 1428 - continue; 1433 + continue; 1429 1434 1430 1435 dev_printk(KERN_DEBUG, &bus->dev, "resource %d %pR\n", i, res); 1431 - } 1436 + } 1432 1437 } 1433 1438 1434 1439 static void pci_bus_dump_resources(struct pci_bus *bus) ··· 1453 1458 int depth = 0; 1454 1459 struct pci_bus *child_bus; 1455 1460 1456 - list_for_each_entry(child_bus, &bus->children, node){ 1461 + list_for_each_entry(child_bus, &bus->children, node) { 1457 1462 int ret; 1458 1463 1459 1464 ret = pci_bus_get_depth(child_bus);
+6 -7
drivers/pci/setup-irq.c
··· 22 22 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); 23 23 } 24 24 25 - static void 26 - pdev_fixup_irq(struct pci_dev *dev, 27 - u8 (*swizzle)(struct pci_dev *, u8 *), 28 - int (*map_irq)(const struct pci_dev *, u8, u8)) 25 + static void pdev_fixup_irq(struct pci_dev *dev, 26 + u8 (*swizzle)(struct pci_dev *, u8 *), 27 + int (*map_irq)(const struct pci_dev *, u8, u8)) 29 28 { 30 29 u8 pin, slot; 31 30 int irq = 0; ··· 57 58 pcibios_update_irq(dev, irq); 58 59 } 59 60 60 - void 61 - pci_fixup_irqs(u8 (*swizzle)(struct pci_dev *, u8 *), 62 - int (*map_irq)(const struct pci_dev *, u8, u8)) 61 + void pci_fixup_irqs(u8 (*swizzle)(struct pci_dev *, u8 *), 62 + int (*map_irq)(const struct pci_dev *, u8, u8)) 63 63 { 64 64 struct pci_dev *dev = NULL; 65 + 65 66 for_each_pci_dev(dev) 66 67 pdev_fixup_irq(dev, swizzle, map_irq); 67 68 }
+7 -6
drivers/pci/setup-res.c
··· 96 96 pci_write_config_dword(dev, reg + 4, new); 97 97 pci_read_config_dword(dev, reg + 4, &check); 98 98 if (check != new) { 99 - dev_err(&dev->dev, "BAR %d: error updating " 100 - "(high %#08x != %#08x)\n", resno, new, check); 99 + dev_err(&dev->dev, "BAR %d: error updating (high %#08x != %#08x)\n", 100 + resno, new, check); 101 101 } 102 102 } 103 103 ··· 289 289 res->flags |= IORESOURCE_UNSET; 290 290 align = pci_resource_alignment(dev, res); 291 291 if (!align) { 292 - dev_info(&dev->dev, "BAR %d: can't assign %pR " 293 - "(bogus alignment)\n", resno, res); 292 + dev_info(&dev->dev, "BAR %d: can't assign %pR (bogus alignment)\n", 293 + resno, res); 294 294 return -EINVAL; 295 295 } 296 296 ··· 314 314 } 315 315 return ret; 316 316 } 317 + EXPORT_SYMBOL(pci_assign_resource); 317 318 318 319 int pci_reassign_resource(struct pci_dev *dev, int resno, resource_size_t addsize, 319 320 resource_size_t min_align) ··· 325 324 326 325 res->flags |= IORESOURCE_UNSET; 327 326 if (!res->parent) { 328 - dev_info(&dev->dev, "BAR %d: can't reassign an unassigned resource %pR " 329 - "\n", resno, res); 327 + dev_info(&dev->dev, "BAR %d: can't reassign an unassigned resource %pR\n", 328 + resno, res); 330 329 return -EINVAL; 331 330 } 332 331
+1 -1
drivers/pci/syscall.c
··· 99 99 if (!dev) 100 100 return -ENODEV; 101 101 102 - switch(len) { 102 + switch (len) { 103 103 case 1: 104 104 err = get_user(byte, (u8 __user *)buf); 105 105 if (err)
+13 -4
include/linux/pci.h
··· 164 164 /* INTX_DISABLE in PCI_COMMAND register disables MSI 165 165 * generation too. 166 166 */ 167 - PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = (__force pci_dev_flags_t) 1, 167 + PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = (__force pci_dev_flags_t) (1 << 0), 168 168 /* Device configuration is irrevocably lost if disabled into D3 */ 169 - PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2, 169 + PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) (1 << 1), 170 170 /* Provide indication device is assigned by a Virtual Machine Manager */ 171 - PCI_DEV_FLAGS_ASSIGNED = (__force pci_dev_flags_t) 4, 171 + PCI_DEV_FLAGS_ASSIGNED = (__force pci_dev_flags_t) (1 << 2), 172 172 /* Flag for quirk use to store if quirk-specific ACS is enabled */ 173 - PCI_DEV_FLAGS_ACS_ENABLED_QUIRK = (__force pci_dev_flags_t) 8, 173 + PCI_DEV_FLAGS_ACS_ENABLED_QUIRK = (__force pci_dev_flags_t) (1 << 3), 174 + /* Flag to indicate the device uses dma_alias_devfn */ 175 + PCI_DEV_FLAGS_DMA_ALIAS_DEVFN = (__force pci_dev_flags_t) (1 << 4), 176 + /* Use a PCIe-to-PCI bridge alias even if !pci_is_pcie */ 177 + PCI_DEV_FLAG_PCIE_BRIDGE_ALIAS = (__force pci_dev_flags_t) (1 << 5), 174 178 }; 175 179 176 180 enum pci_irq_reroute_variant { ··· 272 268 u8 rom_base_reg; /* which config register controls the ROM */ 273 269 u8 pin; /* which interrupt pin this device uses */ 274 270 u16 pcie_flags_reg; /* cached PCIe Capabilities Register */ 271 + u8 dma_alias_devfn;/* devfn of DMA alias, if any */ 275 272 276 273 struct pci_driver *driver; /* which driver has allocated this device */ 277 274 u64 dma_mask; /* Mask of the bits of bus address this ··· 1813 1808 return pdev->dev.archdata.edev; 1814 1809 } 1815 1810 #endif 1811 + 1812 + int pci_for_each_dma_alias(struct pci_dev *pdev, 1813 + int (*fn)(struct pci_dev *pdev, 1814 + u16 alias, void *data), void *data); 1816 1815 1817 1816 /** 1818 1817 * pci_find_upstream_pcie_bridge - find upstream PCIe-to-PCI bridge of a device