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