aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/pci/host/pci-mvebu.c17
-rw-r--r--drivers/pci/hotplug/cpci_hotplug.h18
-rw-r--r--drivers/pci/hotplug/cpci_hotplug_core.c18
-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.c6
-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.c32
-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.c4
-rw-r--r--drivers/pci/hotplug/ibmphp_res.c12
-rw-r--r--drivers/pci/hotplug/pci_hotplug_core.c96
-rw-r--r--drivers/pci/hotplug/pciehp_acpi.c4
-rw-r--r--drivers/pci/hotplug/pciehp_core.c4
-rw-r--r--drivers/pci/hotplug/pciehp_ctrl.c2
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c46
-rw-r--r--drivers/pci/hotplug/pcihp_skeleton.c38
-rw-r--r--drivers/pci/hotplug/rpaphp_core.c6
-rw-r--r--drivers/pci/hotplug/sgi_hotplug.c2
-rw-r--r--drivers/pci/hotplug/shpchp.h4
-rw-r--r--drivers/pci/hotplug/shpchp_ctrl.c2
-rw-r--r--drivers/pci/hotplug/shpchp_hpc.c12
-rw-r--r--drivers/pci/hotplug/shpchp_sysfs.c2
-rw-r--r--drivers/pci/htirq.c2
-rw-r--r--drivers/pci/pci-driver.c51
-rw-r--r--drivers/pci/pci-label.c65
-rw-r--r--drivers/pci/pci-stub.c2
-rw-r--r--drivers/pci/pci-sysfs.c289
-rw-r--r--drivers/pci/pci.c72
-rw-r--r--drivers/pci/pcie/aer/aer_inject.c3
-rw-r--r--drivers/pci/pcie/aer/aerdrv_core.c3
-rw-r--r--drivers/pci/probe.c22
-rw-r--r--drivers/pci/proc.c16
-rw-r--r--drivers/pci/quirks.c74
-rw-r--r--drivers/pci/rom.c4
-rw-r--r--drivers/pci/search.c16
-rw-r--r--drivers/pci/setup-bus.c12
-rw-r--r--drivers/pci/setup-irq.c13
-rw-r--r--drivers/pci/syscall.c2
45 files changed, 517 insertions, 588 deletions
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/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 1bd77fdd5b13..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;
@@ -362,7 +362,7 @@ static int
362init_slots(int clear_ins) 362init_slots(int clear_ins)
363{ 363{
364 struct slot *slot; 364 struct slot *slot;
365 struct pci_dev* dev; 365 struct pci_dev *dev;
366 366
367 dbg("%s - enter", __func__); 367 dbg("%s - enter", __func__);
368 down_read(&list_rwsem); 368 down_read(&list_rwsem);
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..868e62fc869b 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
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..5794057f7ec1 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
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..f53b7c5b9a3f 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++) {
@@ -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;
diff --git a/drivers/pci/hotplug/ibmphp_res.c b/drivers/pci/hotplug/ibmphp_res.c
index a265acb2d518..f62dfc40f753 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
@@ -934,9 +934,9 @@ int ibmphp_remove_resource (struct resource_node *res)
934 return 0; 934 return 0;
935} 935}
936 936
937static struct range_node * find_range (struct bus_node *bus_cur, struct resource_node * res) 937static struct range_node *find_range (struct bus_node *bus_cur, struct resource_node *res)
938{ 938{
939 struct range_node * range = NULL; 939 struct range_node *range = NULL;
940 940
941 switch (res->type) { 941 switch (res->type) {
942 case IO: 942 case IO:
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c
index ef496457f8d0..29caef96a21c 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 }
@@ -531,23 +527,21 @@ int pci_hp_change_slot_info(struct hotplug_slot *hotplug,
531} 527}
532EXPORT_SYMBOL_GPL(pci_hp_change_slot_info); 528EXPORT_SYMBOL_GPL(pci_hp_change_slot_info);
533 529
534static int __init pci_hotplug_init (void) 530static int __init pci_hotplug_init(void)
535{ 531{
536 int result; 532 int result;
537 533
538 result = cpci_hotplug_init(debug); 534 result = cpci_hotplug_init(debug);
539 if (result) { 535 if (result) {
540 err ("cpci_hotplug_init with error %d\n", result); 536 err("cpci_hotplug_init with error %d\n", result);
541 goto err_cpci; 537 return result;
542 } 538 }
543 539
544 info (DRIVER_DESC " version: " DRIVER_VERSION "\n"); 540 info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
545
546err_cpci:
547 return result; 541 return result;
548} 542}
549 543
550static void __exit pci_hotplug_exit (void) 544static void __exit pci_hotplug_exit(void)
551{ 545{
552 cpci_hotplug_exit(); 546 cpci_hotplug_exit();
553} 547}
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..96bb617e4de5 100644
--- a/drivers/pci/hotplug/pciehp_core.c
+++ b/drivers/pci/hotplug/pciehp_core.c
@@ -312,12 +312,12 @@ static void pciehp_remove(struct pcie_device *dev)
312} 312}
313 313
314#ifdef CONFIG_PM 314#ifdef CONFIG_PM
315static int pciehp_suspend (struct pcie_device *dev) 315static int pciehp_suspend(struct pcie_device *dev)
316{ 316{
317 return 0; 317 return 0;
318} 318}
319 319
320static int pciehp_resume (struct pcie_device *dev) 320static int pciehp_resume(struct pcie_device *dev)
321{ 321{
322 struct controller *ctrl; 322 struct controller *ctrl;
323 struct slot *slot; 323 struct slot *slot;
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
index c75e6a678dcc..c57463e1d756 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)) {
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 1463412cf7f8..9334fc76b9d1 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -203,7 +203,7 @@ static void pcie_write_cmd(struct controller *ctrl, u16 cmd, u16 mask)
203 if (!(slot_ctrl & PCI_EXP_SLTCTL_HPIE) || 203 if (!(slot_ctrl & PCI_EXP_SLTCTL_HPIE) ||
204 !(slot_ctrl & PCI_EXP_SLTCTL_CCIE)) 204 !(slot_ctrl & PCI_EXP_SLTCTL_CCIE))
205 poll = 1; 205 poll = 1;
206 pcie_wait_cmd(ctrl, poll); 206 pcie_wait_cmd(ctrl, poll);
207 } 207 }
208 mutex_unlock(&ctrl->ctrl_lock); 208 mutex_unlock(&ctrl->ctrl_lock);
209} 209}
@@ -276,15 +276,15 @@ int pciehp_check_link_status(struct controller *ctrl)
276 bool found; 276 bool found;
277 u16 lnk_status; 277 u16 lnk_status;
278 278
279 /* 279 /*
280 * Data Link Layer Link Active Reporting must be capable for 280 * Data Link Layer Link Active Reporting must be capable for
281 * hot-plug capable downstream port. But old controller might 281 * hot-plug capable downstream port. But old controller might
282 * not implement it. In this case, we wait for 1000 ms. 282 * not implement it. In this case, we wait for 1000 ms.
283 */ 283 */
284 if (ctrl->link_active_reporting) 284 if (ctrl->link_active_reporting)
285 pcie_wait_link_active(ctrl); 285 pcie_wait_link_active(ctrl);
286 else 286 else
287 msleep(1000); 287 msleep(1000);
288 288
289 /* wait 100ms before read pci conf, and try in 1s */ 289 /* wait 100ms before read pci conf, and try in 1s */
290 msleep(100); 290 msleep(100);
@@ -295,7 +295,7 @@ int pciehp_check_link_status(struct controller *ctrl)
295 ctrl_dbg(ctrl, "%s: lnk_status = %x\n", __func__, lnk_status); 295 ctrl_dbg(ctrl, "%s: lnk_status = %x\n", __func__, lnk_status);
296 if ((lnk_status & PCI_EXP_LNKSTA_LT) || 296 if ((lnk_status & PCI_EXP_LNKSTA_LT) ||
297 !(lnk_status & PCI_EXP_LNKSTA_NLW)) { 297 !(lnk_status & PCI_EXP_LNKSTA_NLW)) {
298 ctrl_err(ctrl, "Link Training Error occurs \n"); 298 ctrl_err(ctrl, "Link Training Error occurs\n");
299 return -1; 299 return -1;
300 } 300 }
301 301
@@ -414,7 +414,7 @@ void pciehp_set_attention_status(struct slot *slot, u8 value)
414 return; 414 return;
415 415
416 switch (value) { 416 switch (value) {
417 case 0 : /* turn off */ 417 case 0: /* turn off */
418 slot_cmd = PCI_EXP_SLTCTL_ATTN_IND_OFF; 418 slot_cmd = PCI_EXP_SLTCTL_ATTN_IND_OFF;
419 break; 419 break;
420 case 1: /* turn on */ 420 case 1: /* turn on */
@@ -470,7 +470,7 @@ void pciehp_green_led_blink(struct slot *slot)
470 PCI_EXP_SLTCTL_PWR_IND_BLINK); 470 PCI_EXP_SLTCTL_PWR_IND_BLINK);
471} 471}
472 472
473int pciehp_power_on_slot(struct slot * slot) 473int pciehp_power_on_slot(struct slot *slot)
474{ 474{
475 struct controller *ctrl = slot->ctrl; 475 struct controller *ctrl = slot->ctrl;
476 struct pci_dev *pdev = ctrl_dev(ctrl); 476 struct pci_dev *pdev = ctrl_dev(ctrl);
@@ -496,7 +496,7 @@ int pciehp_power_on_slot(struct slot * slot)
496 return retval; 496 return retval;
497} 497}
498 498
499void pciehp_power_off_slot(struct slot * slot) 499void pciehp_power_off_slot(struct slot *slot)
500{ 500{
501 struct controller *ctrl = slot->ctrl; 501 struct controller *ctrl = slot->ctrl;
502 502
@@ -756,7 +756,7 @@ static inline void dbg_ctrl(struct controller *ctrl)
756 ctrl_info(ctrl, "Slot Control : 0x%04x\n", reg16); 756 ctrl_info(ctrl, "Slot Control : 0x%04x\n", reg16);
757} 757}
758 758
759#define FLAG(x,y) (((x) & (y)) ? '+' : '-') 759#define FLAG(x, y) (((x) & (y)) ? '+' : '-')
760 760
761struct controller *pcie_init(struct pcie_device *dev) 761struct controller *pcie_init(struct pcie_device *dev)
762{ 762{
@@ -783,14 +783,14 @@ struct controller *pcie_init(struct pcie_device *dev)
783 */ 783 */
784 if (NO_CMD_CMPL(ctrl) || 784 if (NO_CMD_CMPL(ctrl) ||
785 !(POWER_CTRL(ctrl) | ATTN_LED(ctrl) | PWR_LED(ctrl) | EMI(ctrl))) 785 !(POWER_CTRL(ctrl) | ATTN_LED(ctrl) | PWR_LED(ctrl) | EMI(ctrl)))
786 ctrl->no_cmd_complete = 1; 786 ctrl->no_cmd_complete = 1;
787 787
788 /* Check if Data Link Layer Link Active Reporting is implemented */ 788 /* Check if Data Link Layer Link Active Reporting is implemented */
789 pcie_capability_read_dword(pdev, PCI_EXP_LNKCAP, &link_cap); 789 pcie_capability_read_dword(pdev, PCI_EXP_LNKCAP, &link_cap);
790 if (link_cap & PCI_EXP_LNKCAP_DLLLARC) { 790 if (link_cap & PCI_EXP_LNKCAP_DLLLARC) {
791 ctrl_dbg(ctrl, "Link Active Reporting supported\n"); 791 ctrl_dbg(ctrl, "Link Active Reporting supported\n");
792 ctrl->link_active_reporting = 1; 792 ctrl->link_active_reporting = 1;
793 } 793 }
794 794
795 /* Clear all remaining event bits in Slot Status register */ 795 /* Clear all remaining event bits in Slot Status register */
796 pcie_capability_write_word(pdev, PCI_EXP_SLTSTA, 796 pcie_capability_write_word(pdev, PCI_EXP_SLTSTA,
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 f2abfc6ec7c8..93aa29f6d39c 100644
--- a/drivers/pci/hotplug/rpaphp_core.c
+++ b/drivers/pci/hotplug/rpaphp_core.c
@@ -89,7 +89,7 @@ static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 value)
89 * @hotplug_slot: slot to get status 89 * @hotplug_slot: slot to get status
90 * @value: pointer to store status 90 * @value: pointer to store status
91 */ 91 */
92static int get_power_status(struct hotplug_slot *hotplug_slot, u8 * value) 92static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
93{ 93{
94 int retval, level; 94 int retval, level;
95 struct slot *slot = (struct slot *)hotplug_slot->private; 95 struct slot *slot = (struct slot *)hotplug_slot->private;
@@ -105,14 +105,14 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 * value)
105 * @hotplug_slot: slot to get status 105 * @hotplug_slot: slot to get status
106 * @value: pointer to store status 106 * @value: pointer to store status
107 */ 107 */
108static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value) 108static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value)
109{ 109{
110 struct slot *slot = (struct slot *)hotplug_slot->private; 110 struct slot *slot = (struct slot *)hotplug_slot->private;
111 *value = slot->hotplug_slot->info->attention_status; 111 *value = slot->hotplug_slot->info->attention_status;
112 return 0; 112 return 0;
113} 113}
114 114
115static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 * value) 115static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
116{ 116{
117 struct slot *slot = (struct slot *)hotplug_slot->private; 117 struct slot *slot = (struct slot *)hotplug_slot->private;
118 int rc, state; 118 int rc, state;
diff --git a/drivers/pci/hotplug/sgi_hotplug.c b/drivers/pci/hotplug/sgi_hotplug.c
index 613043f7576f..0f4c36033ade 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;
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_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
index 58499277903a..90cd75c1a3a7 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 */
diff --git a/drivers/pci/hotplug/shpchp_hpc.c b/drivers/pci/hotplug/shpchp_hpc.c
index 2d7f474ca0ec..12aa9e2b78aa 100644
--- a/drivers/pci/hotplug/shpchp_hpc.c
+++ b/drivers/pci/hotplug/shpchp_hpc.c
@@ -404,7 +404,7 @@ static int hpc_get_attention_status(struct slot *slot, u8 *status)
404 return 0; 404 return 0;
405} 405}
406 406
407static int hpc_get_power_status(struct slot * slot, u8 *status) 407static int hpc_get_power_status(struct slot *slot, u8 *status)
408{ 408{
409 struct controller *ctrl = slot->ctrl; 409 struct controller *ctrl = slot->ctrl;
410 u32 slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot)); 410 u32 slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot));
@@ -528,7 +528,7 @@ static int hpc_get_mode1_ECC_cap(struct slot *slot, u8 *mode)
528 return retval; 528 return retval;
529} 529}
530 530
531static int hpc_query_power_fault(struct slot * slot) 531static int hpc_query_power_fault(struct slot *slot)
532{ 532{
533 struct controller *ctrl = slot->ctrl; 533 struct controller *ctrl = slot->ctrl;
534 u32 slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot)); 534 u32 slot_reg = shpc_readl(ctrl, SLOT_REG(slot->hp_slot));
@@ -614,7 +614,7 @@ static void hpc_release_ctlr(struct controller *ctrl)
614 release_mem_region(ctrl->mmio_base, ctrl->mmio_size); 614 release_mem_region(ctrl->mmio_base, ctrl->mmio_size);
615} 615}
616 616
617static int hpc_power_on_slot(struct slot * slot) 617static int hpc_power_on_slot(struct slot *slot)
618{ 618{
619 int retval; 619 int retval;
620 620
@@ -625,7 +625,7 @@ static int hpc_power_on_slot(struct slot * slot)
625 return retval; 625 return retval;
626} 626}
627 627
628static int hpc_slot_enable(struct slot * slot) 628static int hpc_slot_enable(struct slot *slot)
629{ 629{
630 int retval; 630 int retval;
631 631
@@ -638,7 +638,7 @@ static int hpc_slot_enable(struct slot * slot)
638 return retval; 638 return retval;
639} 639}
640 640
641static int hpc_slot_disable(struct slot * slot) 641static int hpc_slot_disable(struct slot *slot)
642{ 642{
643 int retval; 643 int retval;
644 644
@@ -720,7 +720,7 @@ static int shpc_get_cur_bus_speed(struct controller *ctrl)
720} 720}
721 721
722 722
723static int hpc_set_bus_speed_mode(struct slot * slot, enum pci_bus_speed value) 723static int hpc_set_bus_speed_mode(struct slot *slot, enum pci_bus_speed value)
724{ 724{
725 int retval; 725 int retval;
726 struct controller *ctrl = slot->ctrl; 726 struct controller *ctrl = slot->ctrl;
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 847912c5f4a3..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);
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index b91a17fe425b..3f8e3dbcaa7c 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -99,15 +99,15 @@ static void pci_free_dynids(struct pci_driver *drv)
99 * 99 *
100 * 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.
101 */ 101 */
102static ssize_t 102static ssize_t store_new_id(struct device_driver *driver, const char *buf,
103store_new_id(struct device_driver *driver, const char *buf, size_t count) 103 size_t count)
104{ 104{
105 struct pci_driver *pdrv = to_pci_driver(driver); 105 struct pci_driver *pdrv = to_pci_driver(driver);
106 const struct pci_device_id *ids = pdrv->id_table; 106 const struct pci_device_id *ids = pdrv->id_table;
107 __u32 vendor, device, subvendor=PCI_ANY_ID, 107 __u32 vendor, device, subvendor = PCI_ANY_ID,
108 subdevice=PCI_ANY_ID, class=0, class_mask=0; 108 subdevice = PCI_ANY_ID, class = 0, class_mask = 0;
109 unsigned long driver_data=0; 109 unsigned long driver_data = 0;
110 int fields=0; 110 int fields = 0;
111 int retval = 0; 111 int retval = 0;
112 112
113 fields = sscanf(buf, "%x %x %x %x %x %x %lx", 113 fields = sscanf(buf, "%x %x %x %x %x %x %lx",
@@ -167,8 +167,8 @@ static DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id);
167 * 167 *
168 * Removes a dynamic pci device ID to this driver. 168 * Removes a dynamic pci device ID to this driver.
169 */ 169 */
170static ssize_t 170static ssize_t store_remove_id(struct device_driver *driver, const char *buf,
171store_remove_id(struct device_driver *driver, const char *buf, size_t count) 171 size_t count)
172{ 172{
173 struct pci_dynid *dynid, *n; 173 struct pci_dynid *dynid, *n;
174 struct pci_driver *pdrv = to_pci_driver(driver); 174 struct pci_driver *pdrv = to_pci_driver(driver);
@@ -374,8 +374,7 @@ static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev,
374 * returns 0 on success, else error. 374 * returns 0 on success, else error.
375 * 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.
376 */ 376 */
377static int 377static int __pci_device_probe(struct pci_driver *drv, struct pci_dev *pci_dev)
378__pci_device_probe(struct pci_driver *drv, struct pci_dev *pci_dev)
379{ 378{
380 const struct pci_device_id *id; 379 const struct pci_device_id *id;
381 int error = 0; 380 int error = 0;
@@ -392,7 +391,7 @@ __pci_device_probe(struct pci_driver *drv, struct pci_dev *pci_dev)
392 return error; 391 return error;
393} 392}
394 393
395static int pci_device_probe(struct device * dev) 394static int pci_device_probe(struct device *dev)
396{ 395{
397 int error = 0; 396 int error = 0;
398 struct pci_driver *drv; 397 struct pci_driver *drv;
@@ -408,10 +407,10 @@ static int pci_device_probe(struct device * dev)
408 return error; 407 return error;
409} 408}
410 409
411static int pci_device_remove(struct device * dev) 410static int pci_device_remove(struct device *dev)
412{ 411{
413 struct pci_dev * pci_dev = to_pci_dev(dev); 412 struct pci_dev *pci_dev = to_pci_dev(dev);
414 struct pci_driver * drv = pci_dev->driver; 413 struct pci_driver *drv = pci_dev->driver;
415 414
416 if (drv) { 415 if (drv) {
417 if (drv->remove) { 416 if (drv->remove) {
@@ -539,8 +538,8 @@ static int pci_pm_reenable_device(struct pci_dev *pci_dev)
539 538
540static int pci_legacy_suspend(struct device *dev, pm_message_t state) 539static int pci_legacy_suspend(struct device *dev, pm_message_t state)
541{ 540{
542 struct pci_dev * pci_dev = to_pci_dev(dev); 541 struct pci_dev *pci_dev = to_pci_dev(dev);
543 struct pci_driver * drv = pci_dev->driver; 542 struct pci_driver *drv = pci_dev->driver;
544 543
545 if (drv && drv->suspend) { 544 if (drv && drv->suspend) {
546 pci_power_t prev = pci_dev->current_state; 545 pci_power_t prev = pci_dev->current_state;
@@ -566,8 +565,8 @@ static int pci_legacy_suspend(struct device *dev, pm_message_t state)
566 565
567static 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)
568{ 567{
569 struct pci_dev * pci_dev = to_pci_dev(dev); 568 struct pci_dev *pci_dev = to_pci_dev(dev);
570 struct pci_driver * drv = pci_dev->driver; 569 struct pci_driver *drv = pci_dev->driver;
571 570
572 if (drv && drv->suspend_late) { 571 if (drv && drv->suspend_late) {
573 pci_power_t prev = pci_dev->current_state; 572 pci_power_t prev = pci_dev->current_state;
@@ -597,8 +596,8 @@ static int pci_legacy_suspend_late(struct device *dev, pm_message_t state)
597 596
598static int pci_legacy_resume_early(struct device *dev) 597static int pci_legacy_resume_early(struct device *dev)
599{ 598{
600 struct pci_dev * pci_dev = to_pci_dev(dev); 599 struct pci_dev *pci_dev = to_pci_dev(dev);
601 struct pci_driver * drv = pci_dev->driver; 600 struct pci_driver *drv = pci_dev->driver;
602 601
603 return drv && drv->resume_early ? 602 return drv && drv->resume_early ?
604 drv->resume_early(pci_dev) : 0; 603 drv->resume_early(pci_dev) : 0;
@@ -606,8 +605,8 @@ static int pci_legacy_resume_early(struct device *dev)
606 605
607static int pci_legacy_resume(struct device *dev) 606static int pci_legacy_resume(struct device *dev)
608{ 607{
609 struct pci_dev * pci_dev = to_pci_dev(dev); 608 struct pci_dev *pci_dev = to_pci_dev(dev);
610 struct pci_driver * drv = pci_dev->driver; 609 struct pci_driver *drv = pci_dev->driver;
611 610
612 pci_fixup_device(pci_fixup_resume, pci_dev); 611 pci_fixup_device(pci_fixup_resume, pci_dev);
613 612
@@ -1269,8 +1268,7 @@ EXPORT_SYMBOL(__pci_register_driver);
1269 * driverless. 1268 * driverless.
1270 */ 1269 */
1271 1270
1272void 1271void pci_unregister_driver(struct pci_driver *drv)
1273pci_unregister_driver(struct pci_driver *drv)
1274{ 1272{
1275 driver_unregister(&drv->driver); 1273 driver_unregister(&drv->driver);
1276 pci_free_dynids(drv); 1274 pci_free_dynids(drv);
@@ -1288,14 +1286,13 @@ static struct pci_driver pci_compat_driver = {
1288 * 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
1289 * registered driver for the device. 1287 * registered driver for the device.
1290 */ 1288 */
1291struct pci_driver * 1289struct pci_driver *pci_dev_driver(const struct pci_dev *dev)
1292pci_dev_driver(const struct pci_dev *dev)
1293{ 1290{
1294 if (dev->driver) 1291 if (dev->driver)
1295 return dev->driver; 1292 return dev->driver;
1296 else { 1293 else {
1297 int i; 1294 int i;
1298 for(i=0; i<=PCI_ROM_RESOURCE; i++) 1295 for (i = 0; i <= PCI_ROM_RESOURCE; i++)
1299 if (dev->resource[i].flags & IORESOURCE_BUSY) 1296 if (dev->resource[i].flags & IORESOURCE_BUSY)
1300 return &pci_compat_driver; 1297 return &pci_compat_driver;
1301 } 1298 }
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..41d8d0307347 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;
@@ -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/**
@@ -1005,9 +989,8 @@ int pci_mmap_fits(struct pci_dev *pdev, int resno, struct vm_area_struct *vma,
1005 * 989 *
1006 * Use the regular PCI mapping routines to map a PCI resource into userspace. 990 * Use the regular PCI mapping routines to map a PCI resource into userspace.
1007 */ 991 */
1008static int 992static int pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
1009pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr, 993 struct vm_area_struct *vma, int write_combine)
1010 struct vm_area_struct *vma, int write_combine)
1011{ 994{
1012 struct pci_dev *pdev = to_pci_dev(container_of(kobj, 995 struct pci_dev *pdev = to_pci_dev(container_of(kobj,
1013 struct device, kobj)); 996 struct device, kobj));
@@ -1046,26 +1029,23 @@ pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
1046 return pci_mmap_page_range(pdev, vma, mmap_type, write_combine); 1029 return pci_mmap_page_range(pdev, vma, mmap_type, write_combine);
1047} 1030}
1048 1031
1049static int 1032static int pci_mmap_resource_uc(struct file *filp, struct kobject *kobj,
1050pci_mmap_resource_uc(struct file *filp, struct kobject *kobj, 1033 struct bin_attribute *attr,
1051 struct bin_attribute *attr, 1034 struct vm_area_struct *vma)
1052 struct vm_area_struct *vma)
1053{ 1035{
1054 return pci_mmap_resource(kobj, attr, vma, 0); 1036 return pci_mmap_resource(kobj, attr, vma, 0);
1055} 1037}
1056 1038
1057static int 1039static int pci_mmap_resource_wc(struct file *filp, struct kobject *kobj,
1058pci_mmap_resource_wc(struct file *filp, struct kobject *kobj, 1040 struct bin_attribute *attr,
1059 struct bin_attribute *attr, 1041 struct vm_area_struct *vma)
1060 struct vm_area_struct *vma)
1061{ 1042{
1062 return pci_mmap_resource(kobj, attr, vma, 1); 1043 return pci_mmap_resource(kobj, attr, vma, 1);
1063} 1044}
1064 1045
1065static ssize_t 1046static ssize_t pci_resource_io(struct file *filp, struct kobject *kobj,
1066pci_resource_io(struct file *filp, struct kobject *kobj, 1047 struct bin_attribute *attr, char *buf,
1067 struct bin_attribute *attr, char *buf, 1048 loff_t off, size_t count, bool write)
1068 loff_t off, size_t count, bool write)
1069{ 1049{
1070 struct pci_dev *pdev = to_pci_dev(container_of(kobj, 1050 struct pci_dev *pdev = to_pci_dev(container_of(kobj,
1071 struct device, kobj)); 1051 struct device, kobj));
@@ -1110,18 +1090,16 @@ pci_resource_io(struct file *filp, struct kobject *kobj,
1110 return -EINVAL; 1090 return -EINVAL;
1111} 1091}
1112 1092
1113static ssize_t 1093static ssize_t pci_read_resource_io(struct file *filp, struct kobject *kobj,
1114pci_read_resource_io(struct file *filp, struct kobject *kobj, 1094 struct bin_attribute *attr, char *buf,
1115 struct bin_attribute *attr, char *buf, 1095 loff_t off, size_t count)
1116 loff_t off, size_t count)
1117{ 1096{
1118 return pci_resource_io(filp, kobj, attr, buf, off, count, false); 1097 return pci_resource_io(filp, kobj, attr, buf, off, count, false);
1119} 1098}
1120 1099
1121static ssize_t 1100static ssize_t pci_write_resource_io(struct file *filp, struct kobject *kobj,
1122pci_write_resource_io(struct file *filp, struct kobject *kobj, 1101 struct bin_attribute *attr, char *buf,
1123 struct bin_attribute *attr, char *buf, 1102 loff_t off, size_t count)
1124 loff_t off, size_t count)
1125{ 1103{
1126 return pci_resource_io(filp, kobj, attr, buf, off, count, true); 1104 return pci_resource_io(filp, kobj, attr, buf, off, count, true);
1127} 1105}
@@ -1133,8 +1111,7 @@ pci_write_resource_io(struct file *filp, struct kobject *kobj,
1133 * If we created resource files for @pdev, remove them from sysfs and 1111 * If we created resource files for @pdev, remove them from sysfs and
1134 * free their resources. 1112 * free their resources.
1135 */ 1113 */
1136static void 1114static void pci_remove_resource_files(struct pci_dev *pdev)
1137pci_remove_resource_files(struct pci_dev *pdev)
1138{ 1115{
1139 int i; 1116 int i;
1140 1117
@@ -1237,10 +1214,9 @@ void __weak pci_remove_resource_files(struct pci_dev *dev) { return; }
1237 * 1214 *
1238 * writing anything except 0 enables it 1215 * writing anything except 0 enables it
1239 */ 1216 */
1240static ssize_t 1217static ssize_t pci_write_rom(struct file *filp, struct kobject *kobj,
1241pci_write_rom(struct file *filp, struct kobject *kobj, 1218 struct bin_attribute *bin_attr, char *buf,
1242 struct bin_attribute *bin_attr, 1219 loff_t off, size_t count)
1243 char *buf, loff_t off, size_t count)
1244{ 1220{
1245 struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj)); 1221 struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj));
1246 1222
@@ -1264,10 +1240,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 1240 * Put @count bytes starting at @off into @buf from the ROM in the PCI
1265 * device corresponding to @kobj. 1241 * device corresponding to @kobj.
1266 */ 1242 */
1267static ssize_t 1243static ssize_t pci_read_rom(struct file *filp, struct kobject *kobj,
1268pci_read_rom(struct file *filp, struct kobject *kobj, 1244 struct bin_attribute *bin_attr, char *buf,
1269 struct bin_attribute *bin_attr, 1245 loff_t off, size_t count)
1270 char *buf, loff_t off, size_t count)
1271{ 1246{
1272 struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj)); 1247 struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj));
1273 void __iomem *rom; 1248 void __iomem *rom;
@@ -1313,9 +1288,8 @@ static struct bin_attribute pcie_config_attr = {
1313 .write = pci_write_config, 1288 .write = pci_write_config,
1314}; 1289};
1315 1290
1316static ssize_t reset_store(struct device *dev, 1291static ssize_t reset_store(struct device *dev, struct device_attribute *attr,
1317 struct device_attribute *attr, const char *buf, 1292 const char *buf, size_t count)
1318 size_t count)
1319{ 1293{
1320 struct pci_dev *pdev = to_pci_dev(dev); 1294 struct pci_dev *pdev = to_pci_dev(dev);
1321 unsigned long val; 1295 unsigned long val;
@@ -1382,7 +1356,7 @@ error:
1382 return retval; 1356 return retval;
1383} 1357}
1384 1358
1385int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev) 1359int __must_check pci_create_sysfs_dev_files(struct pci_dev *pdev)
1386{ 1360{
1387 int retval; 1361 int retval;
1388 int rom_size = 0; 1362 int rom_size = 0;
@@ -1520,7 +1494,6 @@ static int __init pci_sysfs_init(void)
1520 1494
1521 return 0; 1495 return 0;
1522} 1496}
1523
1524late_initcall(pci_sysfs_init); 1497late_initcall(pci_sysfs_init);
1525 1498
1526static struct attribute *pci_dev_dev_attrs[] = { 1499static struct attribute *pci_dev_dev_attrs[] = {
@@ -1529,7 +1502,7 @@ static struct attribute *pci_dev_dev_attrs[] = {
1529}; 1502};
1530 1503
1531static umode_t pci_dev_attrs_are_visible(struct kobject *kobj, 1504static umode_t pci_dev_attrs_are_visible(struct kobject *kobj,
1532 struct attribute *a, int n) 1505 struct attribute *a, int n)
1533{ 1506{
1534 struct device *dev = container_of(kobj, struct device, kobj); 1507 struct device *dev = container_of(kobj, struct device, kobj);
1535 struct pci_dev *pdev = to_pci_dev(dev); 1508 struct pci_dev *pdev = to_pci_dev(dev);
@@ -1548,7 +1521,7 @@ static struct attribute *pci_dev_hp_attrs[] = {
1548}; 1521};
1549 1522
1550static umode_t pci_dev_hp_attrs_are_visible(struct kobject *kobj, 1523static umode_t pci_dev_hp_attrs_are_visible(struct kobject *kobj,
1551 struct attribute *a, int n) 1524 struct attribute *a, int n)
1552{ 1525{
1553 struct device *dev = container_of(kobj, struct device, kobj); 1526 struct device *dev = container_of(kobj, struct device, kobj);
1554 struct pci_dev *pdev = to_pci_dev(dev); 1527 struct pci_dev *pdev = to_pci_dev(dev);
@@ -1572,7 +1545,7 @@ static struct attribute *sriov_dev_attrs[] = {
1572}; 1545};
1573 1546
1574static umode_t sriov_attrs_are_visible(struct kobject *kobj, 1547static umode_t sriov_attrs_are_visible(struct kobject *kobj,
1575 struct attribute *a, int n) 1548 struct attribute *a, int n)
1576{ 1549{
1577 struct device *dev = container_of(kobj, struct device, kobj); 1550 struct device *dev = container_of(kobj, struct device, kobj);
1578 1551
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 51ec8b481280..952b4b489d0f 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;
@@ -405,8 +405,8 @@ EXPORT_SYMBOL_GPL(pci_find_ht_capability);
405 * For given resource region of given device, return the resource 405 * For given resource region of given device, return the resource
406 * region of parent bus the given region is contained in. 406 * region of parent bus the given region is contained in.
407 */ 407 */
408struct resource * 408struct resource *pci_find_parent_resource(const struct pci_dev *dev,
409pci_find_parent_resource(const struct pci_dev *dev, struct resource *res) 409 struct resource *res)
410{ 410{
411 const struct pci_bus *bus = dev->bus; 411 const struct pci_bus *bus = dev->bus;
412 struct resource *r; 412 struct resource *r;
@@ -473,8 +473,7 @@ int pci_wait_for_pending(struct pci_dev *dev, int pos, u16 mask)
473 * 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
474 * accessible by its driver. 474 * accessible by its driver.
475 */ 475 */
476static void 476static void pci_restore_bars(struct pci_dev *dev)
477pci_restore_bars(struct pci_dev *dev)
478{ 477{
479 int i; 478 int i;
480 479
@@ -499,7 +498,7 @@ static inline bool platform_pci_power_manageable(struct pci_dev *dev)
499} 498}
500 499
501static inline int platform_pci_set_power_state(struct pci_dev *dev, 500static inline int platform_pci_set_power_state(struct pci_dev *dev,
502 pci_power_t t) 501 pci_power_t t)
503{ 502{
504 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;
505} 504}
@@ -888,12 +887,10 @@ pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state)
888 } 887 }
889 return PCI_D0; 888 return PCI_D0;
890} 889}
891
892EXPORT_SYMBOL(pci_choose_state); 890EXPORT_SYMBOL(pci_choose_state);
893 891
894#define PCI_EXP_SAVE_REGS 7 892#define PCI_EXP_SAVE_REGS 7
895 893
896
897static 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,
898 u16 cap, bool extended) 895 u16 cap, bool extended)
899{ 896{
@@ -1005,8 +1002,7 @@ static void pci_restore_pcix_state(struct pci_dev *dev)
1005 * 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
1006 * @dev: - PCI device that we're dealing with 1003 * @dev: - PCI device that we're dealing with
1007 */ 1004 */
1008int 1005int pci_save_state(struct pci_dev *dev)
1009pci_save_state(struct pci_dev *dev)
1010{ 1006{
1011 int i; 1007 int i;
1012 /* XXX: 100% dword access ok here? */ 1008 /* XXX: 100% dword access ok here? */
@@ -1381,7 +1377,7 @@ static void pcim_release(struct device *gendev, void *res)
1381 pci_disable_device(dev); 1377 pci_disable_device(dev);
1382} 1378}
1383 1379
1384static struct pci_devres * get_pci_dr(struct pci_dev *pdev) 1380static struct pci_devres *get_pci_dr(struct pci_dev *pdev)
1385{ 1381{
1386 struct pci_devres *dr, *new_dr; 1382 struct pci_devres *dr, *new_dr;
1387 1383
@@ -1395,7 +1391,7 @@ static struct pci_devres * get_pci_dr(struct pci_dev *pdev)
1395 return devres_get(&pdev->dev, new_dr, NULL, NULL); 1391 return devres_get(&pdev->dev, new_dr, NULL, NULL);
1396} 1392}
1397 1393
1398static struct pci_devres * find_pci_dr(struct pci_dev *pdev) 1394static struct pci_devres *find_pci_dr(struct pci_dev *pdev)
1399{ 1395{
1400 if (pci_is_managed(pdev)) 1396 if (pci_is_managed(pdev))
1401 return devres_find(&pdev->dev, pcim_release, NULL, NULL); 1397 return devres_find(&pdev->dev, pcim_release, NULL, NULL);
@@ -1455,7 +1451,7 @@ EXPORT_SYMBOL(pcim_pin_device);
1455 * devices are added. This is the default implementation. Architecture 1451 * devices are added. This is the default implementation. Architecture
1456 * implementations can override this. 1452 * implementations can override this.
1457 */ 1453 */
1458int __weak pcibios_add_device (struct pci_dev *dev) 1454int __weak pcibios_add_device(struct pci_dev *dev)
1459{ 1455{
1460 return 0; 1456 return 0;
1461} 1457}
@@ -1527,8 +1523,7 @@ void pci_disable_enabled_device(struct pci_dev *dev)
1527 * 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
1528 * pci_enable_device() have called pci_disable_device(). 1524 * pci_enable_device() have called pci_disable_device().
1529 */ 1525 */
1530void 1526void pci_disable_device(struct pci_dev *dev)
1531pci_disable_device(struct pci_dev *dev)
1532{ 1527{
1533 struct pci_devres *dr; 1528 struct pci_devres *dr;
1534 1529
@@ -2434,8 +2429,7 @@ u8 pci_swizzle_interrupt_pin(const struct pci_dev *dev, u8 pin)
2434 return (((pin - 1) + slot) % 4) + 1; 2429 return (((pin - 1) + slot) % 4) + 1;
2435} 2430}
2436 2431
2437int 2432int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge)
2438pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge)
2439{ 2433{
2440 u8 pin; 2434 u8 pin;
2441 2435
@@ -2518,8 +2512,8 @@ EXPORT_SYMBOL(pci_release_region);
2518 * Returns 0 on success, or %EBUSY on error. A warning 2512 * Returns 0 on success, or %EBUSY on error. A warning
2519 * message is also printed on failure. 2513 * message is also printed on failure.
2520 */ 2514 */
2521static 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,
2522 int exclusive) 2516 const char *res_name, int exclusive)
2523{ 2517{
2524 struct pci_devres *dr; 2518 struct pci_devres *dr;
2525 2519
@@ -2530,8 +2524,7 @@ static int __pci_request_region(struct pci_dev *pdev, int bar, const char *res_n
2530 if (!request_region(pci_resource_start(pdev, bar), 2524 if (!request_region(pci_resource_start(pdev, bar),
2531 pci_resource_len(pdev, bar), res_name)) 2525 pci_resource_len(pdev, bar), res_name))
2532 goto err_out; 2526 goto err_out;
2533 } 2527 } else if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM) {
2534 else if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM) {
2535 if (!__request_mem_region(pci_resource_start(pdev, bar), 2528 if (!__request_mem_region(pci_resource_start(pdev, bar),
2536 pci_resource_len(pdev, bar), res_name, 2529 pci_resource_len(pdev, bar), res_name,
2537 exclusive)) 2530 exclusive))
@@ -2588,7 +2581,8 @@ EXPORT_SYMBOL(pci_request_region);
2588 * explicitly not allowed to map the resource via /dev/mem or 2581 * explicitly not allowed to map the resource via /dev/mem or
2589 * sysfs. 2582 * sysfs.
2590 */ 2583 */
2591int 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)
2592{ 2586{
2593 return __pci_request_region(pdev, bar, res_name, IORESOURCE_EXCLUSIVE); 2587 return __pci_request_region(pdev, bar, res_name, IORESOURCE_EXCLUSIVE);
2594} 2588}
@@ -2613,7 +2607,7 @@ void pci_release_selected_regions(struct pci_dev *pdev, int bars)
2613EXPORT_SYMBOL(pci_release_selected_regions); 2607EXPORT_SYMBOL(pci_release_selected_regions);
2614 2608
2615static int __pci_request_selected_regions(struct pci_dev *pdev, int bars, 2609static int __pci_request_selected_regions(struct pci_dev *pdev, int bars,
2616 const char *res_name, int excl) 2610 const char *res_name, int excl)
2617{ 2611{
2618 int i; 2612 int i;
2619 2613
@@ -2624,7 +2618,7 @@ static int __pci_request_selected_regions(struct pci_dev *pdev, int bars,
2624 return 0; 2618 return 0;
2625 2619
2626err_out: 2620err_out:
2627 while(--i >= 0) 2621 while (--i >= 0)
2628 if (bars & (1 << i)) 2622 if (bars & (1 << i))
2629 pci_release_region(pdev, i); 2623 pci_release_region(pdev, i);
2630 2624
@@ -2645,8 +2639,8 @@ int pci_request_selected_regions(struct pci_dev *pdev, int bars,
2645} 2639}
2646EXPORT_SYMBOL(pci_request_selected_regions); 2640EXPORT_SYMBOL(pci_request_selected_regions);
2647 2641
2648int pci_request_selected_regions_exclusive(struct pci_dev *pdev, 2642int pci_request_selected_regions_exclusive(struct pci_dev *pdev, int bars,
2649 int bars, const char *res_name) 2643 const char *res_name)
2650{ 2644{
2651 return __pci_request_selected_regions(pdev, bars, res_name, 2645 return __pci_request_selected_regions(pdev, bars, res_name,
2652 IORESOURCE_EXCLUSIVE); 2646 IORESOURCE_EXCLUSIVE);
@@ -2836,8 +2830,7 @@ EXPORT_SYMBOL_GPL(pci_set_cacheline_size);
2836 * 2830 *
2837 * 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.
2838 */ 2832 */
2839int 2833int pci_set_mwi(struct pci_dev *dev)
2840pci_set_mwi(struct pci_dev *dev)
2841{ 2834{
2842#ifdef PCI_DISABLE_MWI 2835#ifdef PCI_DISABLE_MWI
2843 return 0; 2836 return 0;
@@ -2850,7 +2843,7 @@ pci_set_mwi(struct pci_dev *dev)
2850 return rc; 2843 return rc;
2851 2844
2852 pci_read_config_word(dev, PCI_COMMAND, &cmd); 2845 pci_read_config_word(dev, PCI_COMMAND, &cmd);
2853 if (! (cmd & PCI_COMMAND_INVALIDATE)) { 2846 if (!(cmd & PCI_COMMAND_INVALIDATE)) {
2854 dev_dbg(&dev->dev, "enabling Mem-Wr-Inval\n"); 2847 dev_dbg(&dev->dev, "enabling Mem-Wr-Inval\n");
2855 cmd |= PCI_COMMAND_INVALIDATE; 2848 cmd |= PCI_COMMAND_INVALIDATE;
2856 pci_write_config_word(dev, PCI_COMMAND, cmd); 2849 pci_write_config_word(dev, PCI_COMMAND, cmd);
@@ -2885,8 +2878,7 @@ EXPORT_SYMBOL(pci_try_set_mwi);
2885 * 2878 *
2886 * Disables PCI Memory-Write-Invalidate transaction on the device 2879 * Disables PCI Memory-Write-Invalidate transaction on the device
2887 */ 2880 */
2888void 2881void pci_clear_mwi(struct pci_dev *dev)
2889pci_clear_mwi(struct pci_dev *dev)
2890{ 2882{
2891#ifndef PCI_DISABLE_MWI 2883#ifndef PCI_DISABLE_MWI
2892 u16 cmd; 2884 u16 cmd;
@@ -2907,18 +2899,16 @@ EXPORT_SYMBOL(pci_clear_mwi);
2907 * 2899 *
2908 * Enables/disables PCI INTx for device dev 2900 * Enables/disables PCI INTx for device dev
2909 */ 2901 */
2910void 2902void pci_intx(struct pci_dev *pdev, int enable)
2911pci_intx(struct pci_dev *pdev, int enable)
2912{ 2903{
2913 u16 pci_command, new; 2904 u16 pci_command, new;
2914 2905
2915 pci_read_config_word(pdev, PCI_COMMAND, &pci_command); 2906 pci_read_config_word(pdev, PCI_COMMAND, &pci_command);
2916 2907
2917 if (enable) { 2908 if (enable)
2918 new = pci_command & ~PCI_COMMAND_INTX_DISABLE; 2909 new = pci_command & ~PCI_COMMAND_INTX_DISABLE;
2919 } else { 2910 else
2920 new = pci_command | PCI_COMMAND_INTX_DISABLE; 2911 new = pci_command | PCI_COMMAND_INTX_DISABLE;
2921 }
2922 2912
2923 if (new != pci_command) { 2913 if (new != pci_command) {
2924 struct pci_devres *dr; 2914 struct pci_devres *dr;
@@ -4159,7 +4149,7 @@ void __init pci_register_set_vga_state(arch_set_vga_state_t func)
4159} 4149}
4160 4150
4161static int pci_set_vga_state_arch(struct pci_dev *dev, bool decode, 4151static int pci_set_vga_state_arch(struct pci_dev *dev, bool decode,
4162 unsigned int command_bits, u32 flags) 4152 unsigned int command_bits, u32 flags)
4163{ 4153{
4164 if (arch_set_vga_state) 4154 if (arch_set_vga_state)
4165 return arch_set_vga_state(dev, decode, command_bits, 4155 return arch_set_vga_state(dev, decode, command_bits,
@@ -4271,11 +4261,10 @@ static resource_size_t pci_specified_resource_alignment(struct pci_dev *dev)
4271 bus == dev->bus->number && 4261 bus == dev->bus->number &&
4272 slot == PCI_SLOT(dev->devfn) && 4262 slot == PCI_SLOT(dev->devfn) &&
4273 func == PCI_FUNC(dev->devfn)) { 4263 func == PCI_FUNC(dev->devfn)) {
4274 if (align_order == -1) { 4264 if (align_order == -1)
4275 align = PAGE_SIZE; 4265 align = PAGE_SIZE;
4276 } else { 4266 else
4277 align = 1 << align_order; 4267 align = 1 << align_order;
4278 }
4279 /* Found */ 4268 /* Found */
4280 break; 4269 break;
4281 } 4270 }
@@ -4393,7 +4382,6 @@ static int __init pci_resource_alignment_sysfs_init(void)
4393 return bus_create_file(&pci_bus_type, 4382 return bus_create_file(&pci_bus_type,
4394 &bus_attr_resource_alignment); 4383 &bus_attr_resource_alignment);
4395} 4384}
4396
4397late_initcall(pci_resource_alignment_sysfs_init); 4385late_initcall(pci_resource_alignment_sysfs_init);
4398 4386
4399static void pci_no_domains(void) 4387static void pci_no_domains(void)
diff --git a/drivers/pci/pcie/aer/aer_inject.c b/drivers/pci/pcie/aer/aer_inject.c
index 587e7e853107..d82cb8fd452e 100644
--- a/drivers/pci/pcie/aer/aer_inject.c
+++ b/drivers/pci/pcie/aer/aer_inject.c
@@ -464,8 +464,7 @@ static int aer_inject(struct aer_error_inj *einj)
464 goto out_put; 464 goto out_put;
465 } 465 }
466 aer_irq(-1, edev); 466 aer_irq(-1, edev);
467 } 467 } else
468 else
469 ret = -EINVAL; 468 ret = -EINVAL;
470out_put: 469out_put:
471 kfree(err_alloc); 470 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/probe.c b/drivers/pci/probe.c
index 96b954f55d0d..468a6505bef1 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;
@@ -604,7 +604,6 @@ static enum pci_bus_speed agp_speed(int agp3, int agpstat)
604 return agp_speeds[index]; 604 return agp_speeds[index];
605} 605}
606 606
607
608static void pci_set_bus_speed(struct pci_bus *bus) 607static void pci_set_bus_speed(struct pci_bus *bus)
609{ 608{
610 struct pci_dev *bridge = bus->self; 609 struct pci_dev *bridge = bus->self;
@@ -636,11 +635,10 @@ static void pci_set_bus_speed(struct pci_bus *bus)
636 } else if (status & PCI_X_SSTATUS_266MHZ) { 635 } else if (status & PCI_X_SSTATUS_266MHZ) {
637 max = PCI_SPEED_133MHz_PCIX_266; 636 max = PCI_SPEED_133MHz_PCIX_266;
638 } else if (status & PCI_X_SSTATUS_133MHZ) { 637 } else if (status & PCI_X_SSTATUS_133MHZ) {
639 if ((status & PCI_X_SSTATUS_VERS) == PCI_X_SSTATUS_V2) { 638 if ((status & PCI_X_SSTATUS_VERS) == PCI_X_SSTATUS_V2)
640 max = PCI_SPEED_133MHz_PCIX_ECC; 639 max = PCI_SPEED_133MHz_PCIX_ECC;
641 } else { 640 else
642 max = PCI_SPEED_133MHz_PCIX; 641 max = PCI_SPEED_133MHz_PCIX;
643 }
644 } else { 642 } else {
645 max = PCI_SPEED_66MHz_PCIX; 643 max = PCI_SPEED_66MHz_PCIX;
646 } 644 }
@@ -664,7 +662,6 @@ static void pci_set_bus_speed(struct pci_bus *bus)
664 } 662 }
665} 663}
666 664
667
668static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent, 665static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,
669 struct pci_dev *bridge, int busnr) 666 struct pci_dev *bridge, int busnr)
670{ 667{
@@ -729,7 +726,8 @@ add_dev:
729 return child; 726 return child;
730} 727}
731 728
732struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr) 729struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
730 int busnr)
733{ 731{
734 struct pci_bus *child; 732 struct pci_bus *child;
735 733
@@ -888,7 +886,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass)
888 * as cards with a PCI-to-PCI bridge can be 886 * as cards with a PCI-to-PCI bridge can be
889 * inserted later. 887 * inserted later.
890 */ 888 */
891 for (i=0; i<CARDBUS_RESERVE_BUSNR; i++) { 889 for (i = 0; i < CARDBUS_RESERVE_BUSNR; i++) {
892 struct pci_bus *parent = bus; 890 struct pci_bus *parent = bus;
893 if (pci_find_bus(pci_domain_nr(bus), 891 if (pci_find_bus(pci_domain_nr(bus),
894 max+i+1)) 892 max+i+1))
@@ -994,7 +992,6 @@ void set_pcie_hotplug_bridge(struct pci_dev *pdev)
994 pdev->is_hotplug_bridge = 1; 992 pdev->is_hotplug_bridge = 1;
995} 993}
996 994
997
998/** 995/**
999 * pci_ext_cfg_is_aliased - is ext config space just an alias of std config? 996 * pci_ext_cfg_is_aliased - is ext config space just an alias of std config?
1000 * @dev: PCI device 997 * @dev: PCI device
@@ -1285,7 +1282,7 @@ struct pci_dev *pci_alloc_dev(struct pci_bus *bus)
1285EXPORT_SYMBOL(pci_alloc_dev); 1282EXPORT_SYMBOL(pci_alloc_dev);
1286 1283
1287bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l, 1284bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l,
1288 int crs_timeout) 1285 int crs_timeout)
1289{ 1286{
1290 int delay = 1; 1287 int delay = 1;
1291 1288
@@ -1719,7 +1716,7 @@ unsigned int pci_scan_child_bus(struct pci_bus *bus)
1719 bus->is_added = 1; 1716 bus->is_added = 1;
1720 } 1717 }
1721 1718
1722 for (pass=0; pass < 2; pass++) 1719 for (pass = 0; pass < 2; pass++)
1723 list_for_each_entry(dev, &bus->devices, bus_list) { 1720 list_for_each_entry(dev, &bus->devices, bus_list) {
1724 if (pci_is_bridge(dev)) 1721 if (pci_is_bridge(dev))
1725 max = pci_scan_bridge(bus, dev, max, pass); 1722 max = pci_scan_bridge(bus, dev, max, pass);
@@ -2062,7 +2059,8 @@ void pci_unlock_rescan_remove(void)
2062} 2059}
2063EXPORT_SYMBOL_GPL(pci_unlock_rescan_remove); 2060EXPORT_SYMBOL_GPL(pci_unlock_rescan_remove);
2064 2061
2065static int __init pci_sort_bf_cmp(const struct device *d_a, const struct device *d_b) 2062static int __init pci_sort_bf_cmp(const struct device *d_a,
2063 const struct device *d_b)
2066{ 2064{
2067 const struct pci_dev *a = to_pci_dev(d_a); 2065 const struct pci_dev *a = to_pci_dev(d_a);
2068 const struct pci_dev *b = to_pci_dev(d_b); 2066 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..e0d78d23483a 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 }
@@ -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);
@@ -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,12 @@ 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", reg);
974 pci_write_config_byte(dev, 0x41, reg); 975 pci_write_config_byte(dev, 0x41, reg);
975 } 976 }
976} 977}
977DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_PCI_MASTER, quirk_mediagx_master); 978DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_PCI_MASTER, quirk_mediagx_master);
@@ -1120,7 +1121,7 @@ static void asus_hides_smbus_hostbridge(struct pci_dev *dev)
1120{ 1121{
1121 if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_ASUSTEK)) { 1122 if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_ASUSTEK)) {
1122 if (dev->device == PCI_DEVICE_ID_INTEL_82845_HB) 1123 if (dev->device == PCI_DEVICE_ID_INTEL_82845_HB)
1123 switch(dev->subsystem_device) { 1124 switch (dev->subsystem_device) {
1124 case 0x8025: /* P4B-LX */ 1125 case 0x8025: /* P4B-LX */
1125 case 0x8070: /* P4B */ 1126 case 0x8070: /* P4B */
1126 case 0x8088: /* P4B533 */ 1127 case 0x8088: /* P4B533 */
@@ -1128,14 +1129,14 @@ static void asus_hides_smbus_hostbridge(struct pci_dev *dev)
1128 asus_hides_smbus = 1; 1129 asus_hides_smbus = 1;
1129 } 1130 }
1130 else if (dev->device == PCI_DEVICE_ID_INTEL_82845G_HB) 1131 else if (dev->device == PCI_DEVICE_ID_INTEL_82845G_HB)
1131 switch(dev->subsystem_device) { 1132 switch (dev->subsystem_device) {
1132 case 0x80b1: /* P4GE-V */ 1133 case 0x80b1: /* P4GE-V */
1133 case 0x80b2: /* P4PE */ 1134 case 0x80b2: /* P4PE */
1134 case 0x8093: /* P4B533-V */ 1135 case 0x8093: /* P4B533-V */
1135 asus_hides_smbus = 1; 1136 asus_hides_smbus = 1;
1136 } 1137 }
1137 else if (dev->device == PCI_DEVICE_ID_INTEL_82850_HB) 1138 else if (dev->device == PCI_DEVICE_ID_INTEL_82850_HB)
1138 switch(dev->subsystem_device) { 1139 switch (dev->subsystem_device) {
1139 case 0x8030: /* P4T533 */ 1140 case 0x8030: /* P4T533 */
1140 asus_hides_smbus = 1; 1141 asus_hides_smbus = 1;
1141 } 1142 }
@@ -1175,7 +1176,7 @@ static void asus_hides_smbus_hostbridge(struct pci_dev *dev)
1175 } 1176 }
1176 } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_HP)) { 1177 } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_HP)) {
1177 if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB) 1178 if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
1178 switch(dev->subsystem_device) { 1179 switch (dev->subsystem_device) {
1179 case 0x088C: /* HP Compaq nc8000 */ 1180 case 0x088C: /* HP Compaq nc8000 */
1180 case 0x0890: /* HP Compaq nc6000 */ 1181 case 0x0890: /* HP Compaq nc6000 */
1181 asus_hides_smbus = 1; 1182 asus_hides_smbus = 1;
@@ -1192,20 +1193,20 @@ static void asus_hides_smbus_hostbridge(struct pci_dev *dev)
1192 case 0x12bf: /* HP xw4100 */ 1193 case 0x12bf: /* HP xw4100 */
1193 asus_hides_smbus = 1; 1194 asus_hides_smbus = 1;
1194 } 1195 }
1195 } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG)) { 1196 } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG)) {
1196 if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB) 1197 if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
1197 switch(dev->subsystem_device) { 1198 switch (dev->subsystem_device) {
1198 case 0xC00C: /* Samsung P35 notebook */ 1199 case 0xC00C: /* Samsung P35 notebook */
1199 asus_hides_smbus = 1; 1200 asus_hides_smbus = 1;
1200 } 1201 }
1201 } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ)) { 1202 } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ)) {
1202 if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB) 1203 if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
1203 switch(dev->subsystem_device) { 1204 switch (dev->subsystem_device) {
1204 case 0x0058: /* Compaq Evo N620c */ 1205 case 0x0058: /* Compaq Evo N620c */
1205 asus_hides_smbus = 1; 1206 asus_hides_smbus = 1;
1206 } 1207 }
1207 else if (dev->device == PCI_DEVICE_ID_INTEL_82810_IG3) 1208 else if (dev->device == PCI_DEVICE_ID_INTEL_82810_IG3)
1208 switch(dev->subsystem_device) { 1209 switch (dev->subsystem_device) {
1209 case 0xB16C: /* Compaq Deskpro EP 401963-001 (PCA# 010174) */ 1210 case 0xB16C: /* Compaq Deskpro EP 401963-001 (PCA# 010174) */
1210 /* Motherboard doesn't have Host bridge 1211 /* Motherboard doesn't have Host bridge
1211 * subvendor/subdevice IDs, therefore checking 1212 * subvendor/subdevice IDs, therefore checking
@@ -1213,7 +1214,7 @@ static void asus_hides_smbus_hostbridge(struct pci_dev *dev)
1213 asus_hides_smbus = 1; 1214 asus_hides_smbus = 1;
1214 } 1215 }
1215 else if (dev->device == PCI_DEVICE_ID_INTEL_82801DB_2) 1216 else if (dev->device == PCI_DEVICE_ID_INTEL_82801DB_2)
1216 switch(dev->subsystem_device) { 1217 switch (dev->subsystem_device) {
1217 case 0x00b8: /* Compaq Evo D510 CMT */ 1218 case 0x00b8: /* Compaq Evo D510 CMT */
1218 case 0x00b9: /* Compaq Evo D510 SFF */ 1219 case 0x00b9: /* Compaq Evo D510 SFF */
1219 case 0x00ba: /* Compaq Evo D510 USDT */ 1220 case 0x00ba: /* Compaq Evo D510 USDT */
@@ -1514,10 +1515,8 @@ static void quirk_alder_ioapic(struct pci_dev *pdev)
1514 1515
1515 /* The next five BARs all seem to be rubbish, so just clean 1516 /* The next five BARs all seem to be rubbish, so just clean
1516 * them out */ 1517 * them out */
1517 for (i=1; i < 6; i++) { 1518 for (i = 1; i < 6; i++)
1518 memset(&pdev->resource[i], 0, sizeof(pdev->resource[i])); 1519 memset(&pdev->resource[i], 0, sizeof(pdev->resource[i]));
1519 }
1520
1521} 1520}
1522DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EESSC, quirk_alder_ioapic); 1521DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EESSC, quirk_alder_ioapic);
1523#endif 1522#endif
@@ -1552,7 +1551,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 1551 * Some Intel PCI Express chipsets have trouble with downstream
1553 * device power management. 1552 * device power management.
1554 */ 1553 */
1555static void quirk_intel_pcie_pm(struct pci_dev * dev) 1554static void quirk_intel_pcie_pm(struct pci_dev *dev)
1556{ 1555{
1557 pci_pm_d3_delay = 120; 1556 pci_pm_d3_delay = 120;
1558 dev->no_d1d2 = 1; 1557 dev->no_d1d2 = 1;
@@ -2189,8 +2188,7 @@ static int msi_ht_cap_enabled(struct pci_dev *dev)
2189 u8 flags; 2188 u8 flags;
2190 2189
2191 if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS, 2190 if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS,
2192 &flags) == 0) 2191 &flags) == 0) {
2193 {
2194 dev_info(&dev->dev, "Found %s HT MSI Mapping\n", 2192 dev_info(&dev->dev, "Found %s HT MSI Mapping\n",
2195 flags & HT_MSI_FLAGS_ENABLE ? 2193 flags & HT_MSI_FLAGS_ENABLE ?
2196 "enabled" : "disabled"); 2194 "enabled" : "disabled");
@@ -3040,7 +3038,7 @@ void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev)
3040{ 3038{
3041 struct pci_fixup *start, *end; 3039 struct pci_fixup *start, *end;
3042 3040
3043 switch(pass) { 3041 switch (pass) {
3044 case pci_fixup_early: 3042 case pci_fixup_early:
3045 start = __start_pci_fixups_early; 3043 start = __start_pci_fixups_early;
3046 end = __end_pci_fixups_early; 3044 end = __end_pci_fixups_early;
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
index 7fdd2200c9cb..f955edb9bea7 100644
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -137,7 +137,7 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
137 } else { 137 } else {
138 /* assign the ROM an address if it doesn't have one */ 138 /* assign the ROM an address if it doesn't have one */
139 if (res->parent == NULL && 139 if (res->parent == NULL &&
140 pci_assign_resource(pdev,PCI_ROM_RESOURCE)) 140 pci_assign_resource(pdev, PCI_ROM_RESOURCE))
141 return NULL; 141 return NULL;
142 start = pci_resource_start(pdev, PCI_ROM_RESOURCE); 142 start = pci_resource_start(pdev, PCI_ROM_RESOURCE);
143 *size = pci_resource_len(pdev, PCI_ROM_RESOURCE); 143 *size = pci_resource_len(pdev, PCI_ROM_RESOURCE);
@@ -203,7 +203,7 @@ void pci_cleanup_rom(struct pci_dev *pdev)
203 struct resource *res = &pdev->resource[PCI_ROM_RESOURCE]; 203 struct resource *res = &pdev->resource[PCI_ROM_RESOURCE];
204 204
205 if (res->flags & IORESOURCE_ROM_COPY) { 205 if (res->flags & IORESOURCE_ROM_COPY) {
206 kfree((void*)(unsigned long)res->start); 206 kfree((void *)(unsigned long)res->start);
207 res->flags |= IORESOURCE_UNSET; 207 res->flags |= IORESOURCE_UNSET;
208 res->flags &= ~IORESOURCE_ROM_COPY; 208 res->flags &= ~IORESOURCE_ROM_COPY;
209 res->start = 0; 209 res->start = 0;
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index a66ed7525841..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;
@@ -188,8 +187,7 @@ EXPORT_SYMBOL(pci_find_bus);
188 * @from is not %NULL, searches continue from next device on the 187 * @from is not %NULL, searches continue from next device on the
189 * global list. 188 * global list.
190 */ 189 */
191struct pci_bus * 190struct pci_bus *pci_find_next_bus(const struct pci_bus *from)
192pci_find_next_bus(const struct pci_bus *from)
193{ 191{
194 struct list_head *n; 192 struct list_head *n;
195 struct pci_bus *b = NULL; 193 struct pci_bus *b = NULL;
@@ -357,8 +355,8 @@ EXPORT_SYMBOL(pci_get_subsys);
357 * 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
358 * always decremented if it is not %NULL. 356 * always decremented if it is not %NULL.
359 */ 357 */
360struct pci_dev * 358struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device,
361pci_get_device(unsigned int vendor, unsigned int device, struct pci_dev *from) 359 struct pci_dev *from)
362{ 360{
363 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);
364} 362}
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index fd9b545c3cf5..2f053922dd5c 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
@@ -736,7 +736,7 @@ static resource_size_t calculate_iosize(resource_size_t size,
736{ 736{
737 if (size < min_size) 737 if (size < min_size)
738 size = min_size; 738 size = min_size;
739 if (old_size == 1 ) 739 if (old_size == 1)
740 old_size = 0; 740 old_size = 0;
741 /* To be fixed in 2.5: we should have sort of HAVE_ISA 741 /* To be fixed in 2.5: we should have sort of HAVE_ISA
742 flag in the struct pci_bus. */ 742 flag in the struct pci_bus. */
@@ -757,7 +757,7 @@ static resource_size_t calculate_memsize(resource_size_t size,
757{ 757{
758 if (size < min_size) 758 if (size < min_size)
759 size = min_size; 759 size = min_size;
760 if (old_size == 1 ) 760 if (old_size == 1)
761 old_size = 0; 761 old_size = 0;
762 if (size < old_size) 762 if (size < old_size)
763 size = old_size; 763 size = old_size;
@@ -1430,10 +1430,10 @@ static void pci_bus_dump_res(struct pci_bus *bus)
1430 1430
1431 pci_bus_for_each_resource(bus, res, i) { 1431 pci_bus_for_each_resource(bus, res, i) {
1432 if (!res || !res->end || !res->flags) 1432 if (!res || !res->end || !res->flags)
1433 continue; 1433 continue;
1434 1434
1435 dev_printk(KERN_DEBUG, &bus->dev, "resource %d %pR\n", i, res); 1435 dev_printk(KERN_DEBUG, &bus->dev, "resource %d %pR\n", i, res);
1436 } 1436 }
1437} 1437}
1438 1438
1439static void pci_bus_dump_resources(struct pci_bus *bus) 1439static void pci_bus_dump_resources(struct pci_bus *bus)
@@ -1458,7 +1458,7 @@ static int pci_bus_get_depth(struct pci_bus *bus)
1458 int depth = 0; 1458 int depth = 0;
1459 struct pci_bus *child_bus; 1459 struct pci_bus *child_bus;
1460 1460
1461 list_for_each_entry(child_bus, &bus->children, node){ 1461 list_for_each_entry(child_bus, &bus->children, node) {
1462 int ret; 1462 int ret;
1463 1463
1464 ret = pci_bus_get_depth(child_bus); 1464 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/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)