diff options
author | Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com> | 2008-02-22 17:10:06 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-17 11:40:49 -0400 |
commit | 0067cc996ee7a0dd282d8da5b64fa60aa2066bb2 (patch) | |
tree | bb360924bd5f44f4fdac4dd8c3d0c27154cb5d85 /arch | |
parent | f73920cd63d316008738427a0df2caab6cc88ad7 (diff) |
x86: coding style fixes to arch/x86/kernel/mca_32.c
Before:
total: 42 errors, 3 warnings, 469 lines checked
After:
total: 0 errors, 3 warnings, 479 lines checked
No code changed:
arch/x86/kernel/mca_32.o:
text data bss dec hex filename
1832 288 5 2125 84d mca_32.o.before
1832 288 5 2125 84d mca_32.o.after
md5:
c0e45e2b743ce26349eb07dc53e80b94 mca_32.o.before.asm
c0e45e2b743ce26349eb07dc53e80b94 mca_32.o.after.asm
Signed-off-by: Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/mca_32.c | 96 |
1 files changed, 53 insertions, 43 deletions
diff --git a/arch/x86/kernel/mca_32.c b/arch/x86/kernel/mca_32.c index 9482033ed0fe..2dc183758be3 100644 --- a/arch/x86/kernel/mca_32.c +++ b/arch/x86/kernel/mca_32.c | |||
@@ -53,9 +53,9 @@ | |||
53 | #include <linux/init.h> | 53 | #include <linux/init.h> |
54 | #include <asm/arch_hooks.h> | 54 | #include <asm/arch_hooks.h> |
55 | 55 | ||
56 | static unsigned char which_scsi = 0; | 56 | static unsigned char which_scsi; |
57 | 57 | ||
58 | int MCA_bus = 0; | 58 | int MCA_bus; |
59 | EXPORT_SYMBOL(MCA_bus); | 59 | EXPORT_SYMBOL(MCA_bus); |
60 | 60 | ||
61 | /* | 61 | /* |
@@ -68,15 +68,17 @@ static DEFINE_SPINLOCK(mca_lock); | |||
68 | 68 | ||
69 | /* Build the status info for the adapter */ | 69 | /* Build the status info for the adapter */ |
70 | 70 | ||
71 | static void mca_configure_adapter_status(struct mca_device *mca_dev) { | 71 | static void mca_configure_adapter_status(struct mca_device *mca_dev) |
72 | { | ||
72 | mca_dev->status = MCA_ADAPTER_NONE; | 73 | mca_dev->status = MCA_ADAPTER_NONE; |
73 | 74 | ||
74 | mca_dev->pos_id = mca_dev->pos[0] | 75 | mca_dev->pos_id = mca_dev->pos[0] |
75 | + (mca_dev->pos[1] << 8); | 76 | + (mca_dev->pos[1] << 8); |
76 | 77 | ||
77 | if(!mca_dev->pos_id && mca_dev->slot < MCA_MAX_SLOT_NR) { | 78 | if (!mca_dev->pos_id && mca_dev->slot < MCA_MAX_SLOT_NR) { |
78 | 79 | ||
79 | /* id = 0x0000 usually indicates hardware failure, | 80 | /* |
81 | * id = 0x0000 usually indicates hardware failure, | ||
80 | * however, ZP Gu (zpg@castle.net> reports that his 9556 | 82 | * however, ZP Gu (zpg@castle.net> reports that his 9556 |
81 | * has 0x0000 as id and everything still works. There | 83 | * has 0x0000 as id and everything still works. There |
82 | * also seem to be an adapter with id = 0x0000; the | 84 | * also seem to be an adapter with id = 0x0000; the |
@@ -87,9 +89,10 @@ static void mca_configure_adapter_status(struct mca_device *mca_dev) { | |||
87 | mca_dev->status = MCA_ADAPTER_ERROR; | 89 | mca_dev->status = MCA_ADAPTER_ERROR; |
88 | 90 | ||
89 | return; | 91 | return; |
90 | } else if(mca_dev->pos_id != 0xffff) { | 92 | } else if (mca_dev->pos_id != 0xffff) { |
91 | 93 | ||
92 | /* 0xffff usually indicates that there's no adapter, | 94 | /* |
95 | * 0xffff usually indicates that there's no adapter, | ||
93 | * however, some integrated adapters may have 0xffff as | 96 | * however, some integrated adapters may have 0xffff as |
94 | * their id and still be valid. Examples are on-board | 97 | * their id and still be valid. Examples are on-board |
95 | * VGA of the 55sx, the integrated SCSI of the 56 & 57, | 98 | * VGA of the 55sx, the integrated SCSI of the 56 & 57, |
@@ -99,19 +102,19 @@ static void mca_configure_adapter_status(struct mca_device *mca_dev) { | |||
99 | mca_dev->status = MCA_ADAPTER_NORMAL; | 102 | mca_dev->status = MCA_ADAPTER_NORMAL; |
100 | } | 103 | } |
101 | 104 | ||
102 | if((mca_dev->pos_id == 0xffff || | 105 | if ((mca_dev->pos_id == 0xffff || |
103 | mca_dev->pos_id == 0x0000) && mca_dev->slot >= MCA_MAX_SLOT_NR) { | 106 | mca_dev->pos_id == 0x0000) && mca_dev->slot >= MCA_MAX_SLOT_NR) { |
104 | int j; | 107 | int j; |
105 | 108 | ||
106 | for(j = 2; j < 8; j++) { | 109 | for (j = 2; j < 8; j++) { |
107 | if(mca_dev->pos[j] != 0xff) { | 110 | if (mca_dev->pos[j] != 0xff) { |
108 | mca_dev->status = MCA_ADAPTER_NORMAL; | 111 | mca_dev->status = MCA_ADAPTER_NORMAL; |
109 | break; | 112 | break; |
110 | } | 113 | } |
111 | } | 114 | } |
112 | } | 115 | } |
113 | 116 | ||
114 | if(!(mca_dev->pos[2] & MCA_ENABLED)) { | 117 | if (!(mca_dev->pos[2] & MCA_ENABLED)) { |
115 | 118 | ||
116 | /* enabled bit is in POS 2 */ | 119 | /* enabled bit is in POS 2 */ |
117 | 120 | ||
@@ -133,7 +136,7 @@ static struct resource mca_standard_resources[] = { | |||
133 | 136 | ||
134 | #define MCA_STANDARD_RESOURCES ARRAY_SIZE(mca_standard_resources) | 137 | #define MCA_STANDARD_RESOURCES ARRAY_SIZE(mca_standard_resources) |
135 | 138 | ||
136 | /** | 139 | /* |
137 | * mca_read_and_store_pos - read the POS registers into a memory buffer | 140 | * mca_read_and_store_pos - read the POS registers into a memory buffer |
138 | * @pos: a char pointer to 8 bytes, contains the POS register value on | 141 | * @pos: a char pointer to 8 bytes, contains the POS register value on |
139 | * successful return | 142 | * successful return |
@@ -141,12 +144,14 @@ static struct resource mca_standard_resources[] = { | |||
141 | * Returns 1 if a card actually exists (i.e. the pos isn't | 144 | * Returns 1 if a card actually exists (i.e. the pos isn't |
142 | * all 0xff) or 0 otherwise | 145 | * all 0xff) or 0 otherwise |
143 | */ | 146 | */ |
144 | static int mca_read_and_store_pos(unsigned char *pos) { | 147 | static int mca_read_and_store_pos(unsigned char *pos) |
148 | { | ||
145 | int j; | 149 | int j; |
146 | int found = 0; | 150 | int found = 0; |
147 | 151 | ||
148 | for(j=0; j<8; j++) { | 152 | for (j = 0; j < 8; j++) { |
149 | if((pos[j] = inb_p(MCA_POS_REG(j))) != 0xff) { | 153 | pos[j] = inb_p(MCA_POS_REG(j)); |
154 | if (pos[j] != 0xff) { | ||
150 | /* 0xff all across means no device. 0x00 means | 155 | /* 0xff all across means no device. 0x00 means |
151 | * something's broken, but a device is | 156 | * something's broken, but a device is |
152 | * probably there. However, if you get 0x00 | 157 | * probably there. However, if you get 0x00 |
@@ -167,11 +172,11 @@ static unsigned char mca_pc_read_pos(struct mca_device *mca_dev, int reg) | |||
167 | unsigned char byte; | 172 | unsigned char byte; |
168 | unsigned long flags; | 173 | unsigned long flags; |
169 | 174 | ||
170 | if(reg < 0 || reg >= 8) | 175 | if (reg < 0 || reg >= 8) |
171 | return 0; | 176 | return 0; |
172 | 177 | ||
173 | spin_lock_irqsave(&mca_lock, flags); | 178 | spin_lock_irqsave(&mca_lock, flags); |
174 | if(mca_dev->pos_register) { | 179 | if (mca_dev->pos_register) { |
175 | /* Disable adapter setup, enable motherboard setup */ | 180 | /* Disable adapter setup, enable motherboard setup */ |
176 | 181 | ||
177 | outb_p(0, MCA_ADAPTER_SETUP_REG); | 182 | outb_p(0, MCA_ADAPTER_SETUP_REG); |
@@ -203,7 +208,7 @@ static void mca_pc_write_pos(struct mca_device *mca_dev, int reg, | |||
203 | { | 208 | { |
204 | unsigned long flags; | 209 | unsigned long flags; |
205 | 210 | ||
206 | if(reg < 0 || reg >= 8) | 211 | if (reg < 0 || reg >= 8) |
207 | return; | 212 | return; |
208 | 213 | ||
209 | spin_lock_irqsave(&mca_lock, flags); | 214 | spin_lock_irqsave(&mca_lock, flags); |
@@ -227,17 +232,17 @@ static void mca_pc_write_pos(struct mca_device *mca_dev, int reg, | |||
227 | } | 232 | } |
228 | 233 | ||
229 | /* for the primary MCA bus, we have identity transforms */ | 234 | /* for the primary MCA bus, we have identity transforms */ |
230 | static int mca_dummy_transform_irq(struct mca_device * mca_dev, int irq) | 235 | static int mca_dummy_transform_irq(struct mca_device *mca_dev, int irq) |
231 | { | 236 | { |
232 | return irq; | 237 | return irq; |
233 | } | 238 | } |
234 | 239 | ||
235 | static int mca_dummy_transform_ioport(struct mca_device * mca_dev, int port) | 240 | static int mca_dummy_transform_ioport(struct mca_device *mca_dev, int port) |
236 | { | 241 | { |
237 | return port; | 242 | return port; |
238 | } | 243 | } |
239 | 244 | ||
240 | static void *mca_dummy_transform_memory(struct mca_device * mca_dev, void *mem) | 245 | static void *mca_dummy_transform_memory(struct mca_device *mca_dev, void *mem) |
241 | { | 246 | { |
242 | return mem; | 247 | return mem; |
243 | } | 248 | } |
@@ -251,7 +256,8 @@ static int __init mca_init(void) | |||
251 | short mca_builtin_scsi_ports[] = {0xf7, 0xfd, 0x00}; | 256 | short mca_builtin_scsi_ports[] = {0xf7, 0xfd, 0x00}; |
252 | struct mca_bus *bus; | 257 | struct mca_bus *bus; |
253 | 258 | ||
254 | /* WARNING: Be careful when making changes here. Putting an adapter | 259 | /* |
260 | * WARNING: Be careful when making changes here. Putting an adapter | ||
255 | * and the motherboard simultaneously into setup mode may result in | 261 | * and the motherboard simultaneously into setup mode may result in |
256 | * damage to chips (according to The Indispensible PC Hardware Book | 262 | * damage to chips (according to The Indispensible PC Hardware Book |
257 | * by Hans-Peter Messmer). Also, we disable system interrupts (so | 263 | * by Hans-Peter Messmer). Also, we disable system interrupts (so |
@@ -283,7 +289,7 @@ static int __init mca_init(void) | |||
283 | 289 | ||
284 | /* get the motherboard device */ | 290 | /* get the motherboard device */ |
285 | mca_dev = kzalloc(sizeof(struct mca_device), GFP_KERNEL); | 291 | mca_dev = kzalloc(sizeof(struct mca_device), GFP_KERNEL); |
286 | if(unlikely(!mca_dev)) | 292 | if (unlikely(!mca_dev)) |
287 | goto out_nomem; | 293 | goto out_nomem; |
288 | 294 | ||
289 | /* | 295 | /* |
@@ -309,7 +315,7 @@ static int __init mca_init(void) | |||
309 | mca_register_device(MCA_PRIMARY_BUS, mca_dev); | 315 | mca_register_device(MCA_PRIMARY_BUS, mca_dev); |
310 | 316 | ||
311 | mca_dev = kzalloc(sizeof(struct mca_device), GFP_ATOMIC); | 317 | mca_dev = kzalloc(sizeof(struct mca_device), GFP_ATOMIC); |
312 | if(unlikely(!mca_dev)) | 318 | if (unlikely(!mca_dev)) |
313 | goto out_unlock_nomem; | 319 | goto out_unlock_nomem; |
314 | 320 | ||
315 | /* Put motherboard into video setup mode, read integrated video | 321 | /* Put motherboard into video setup mode, read integrated video |
@@ -326,7 +332,8 @@ static int __init mca_init(void) | |||
326 | mca_dev->slot = MCA_INTEGVIDEO; | 332 | mca_dev->slot = MCA_INTEGVIDEO; |
327 | mca_register_device(MCA_PRIMARY_BUS, mca_dev); | 333 | mca_register_device(MCA_PRIMARY_BUS, mca_dev); |
328 | 334 | ||
329 | /* Put motherboard into scsi setup mode, read integrated scsi | 335 | /* |
336 | * Put motherboard into scsi setup mode, read integrated scsi | ||
330 | * POS registers, and turn motherboard setup off. | 337 | * POS registers, and turn motherboard setup off. |
331 | * | 338 | * |
332 | * It seems there are two possible SCSI registers. Martin says that | 339 | * It seems there are two possible SCSI registers. Martin says that |
@@ -338,18 +345,18 @@ static int __init mca_init(void) | |||
338 | * machine. | 345 | * machine. |
339 | */ | 346 | */ |
340 | 347 | ||
341 | for(i = 0; (which_scsi = mca_builtin_scsi_ports[i]) != 0; i++) { | 348 | for (i = 0; (which_scsi = mca_builtin_scsi_ports[i]) != 0; i++) { |
342 | outb_p(which_scsi, MCA_MOTHERBOARD_SETUP_REG); | 349 | outb_p(which_scsi, MCA_MOTHERBOARD_SETUP_REG); |
343 | if(mca_read_and_store_pos(pos)) | 350 | if (mca_read_and_store_pos(pos)) |
344 | break; | 351 | break; |
345 | } | 352 | } |
346 | if(which_scsi) { | 353 | if (which_scsi) { |
347 | /* found a scsi card */ | 354 | /* found a scsi card */ |
348 | mca_dev = kzalloc(sizeof(struct mca_device), GFP_ATOMIC); | 355 | mca_dev = kzalloc(sizeof(struct mca_device), GFP_ATOMIC); |
349 | if(unlikely(!mca_dev)) | 356 | if (unlikely(!mca_dev)) |
350 | goto out_unlock_nomem; | 357 | goto out_unlock_nomem; |
351 | 358 | ||
352 | for(j = 0; j < 8; j++) | 359 | for (j = 0; j < 8; j++) |
353 | mca_dev->pos[j] = pos[j]; | 360 | mca_dev->pos[j] = pos[j]; |
354 | 361 | ||
355 | mca_configure_adapter_status(mca_dev); | 362 | mca_configure_adapter_status(mca_dev); |
@@ -364,21 +371,22 @@ static int __init mca_init(void) | |||
364 | 371 | ||
365 | outb_p(0xff, MCA_MOTHERBOARD_SETUP_REG); | 372 | outb_p(0xff, MCA_MOTHERBOARD_SETUP_REG); |
366 | 373 | ||
367 | /* Now loop over MCA slots: put each adapter into setup mode, and | 374 | /* |
375 | * Now loop over MCA slots: put each adapter into setup mode, and | ||
368 | * read its POS registers. Then put adapter setup off. | 376 | * read its POS registers. Then put adapter setup off. |
369 | */ | 377 | */ |
370 | 378 | ||
371 | for(i=0; i<MCA_MAX_SLOT_NR; i++) { | 379 | for (i = 0; i < MCA_MAX_SLOT_NR; i++) { |
372 | outb_p(0x8|(i&0xf), MCA_ADAPTER_SETUP_REG); | 380 | outb_p(0x8|(i&0xf), MCA_ADAPTER_SETUP_REG); |
373 | if(!mca_read_and_store_pos(pos)) | 381 | if (!mca_read_and_store_pos(pos)) |
374 | continue; | 382 | continue; |
375 | 383 | ||
376 | mca_dev = kzalloc(sizeof(struct mca_device), GFP_ATOMIC); | 384 | mca_dev = kzalloc(sizeof(struct mca_device), GFP_ATOMIC); |
377 | if(unlikely(!mca_dev)) | 385 | if (unlikely(!mca_dev)) |
378 | goto out_unlock_nomem; | 386 | goto out_unlock_nomem; |
379 | 387 | ||
380 | for(j=0; j<8; j++) | 388 | for (j = 0; j < 8; j++) |
381 | mca_dev->pos[j]=pos[j]; | 389 | mca_dev->pos[j] = pos[j]; |
382 | 390 | ||
383 | mca_dev->driver_loaded = 0; | 391 | mca_dev->driver_loaded = 0; |
384 | mca_dev->slot = i; | 392 | mca_dev->slot = i; |
@@ -414,20 +422,20 @@ mca_handle_nmi_device(struct mca_device *mca_dev, int check_flag) | |||
414 | { | 422 | { |
415 | int slot = mca_dev->slot; | 423 | int slot = mca_dev->slot; |
416 | 424 | ||
417 | if(slot == MCA_INTEGSCSI) { | 425 | if (slot == MCA_INTEGSCSI) { |
418 | printk(KERN_CRIT "NMI: caused by MCA integrated SCSI adapter (%s)\n", | 426 | printk(KERN_CRIT "NMI: caused by MCA integrated SCSI adapter (%s)\n", |
419 | mca_dev->name); | 427 | mca_dev->name); |
420 | } else if(slot == MCA_INTEGVIDEO) { | 428 | } else if (slot == MCA_INTEGVIDEO) { |
421 | printk(KERN_CRIT "NMI: caused by MCA integrated video adapter (%s)\n", | 429 | printk(KERN_CRIT "NMI: caused by MCA integrated video adapter (%s)\n", |
422 | mca_dev->name); | 430 | mca_dev->name); |
423 | } else if(slot == MCA_MOTHERBOARD) { | 431 | } else if (slot == MCA_MOTHERBOARD) { |
424 | printk(KERN_CRIT "NMI: caused by motherboard (%s)\n", | 432 | printk(KERN_CRIT "NMI: caused by motherboard (%s)\n", |
425 | mca_dev->name); | 433 | mca_dev->name); |
426 | } | 434 | } |
427 | 435 | ||
428 | /* More info available in POS 6 and 7? */ | 436 | /* More info available in POS 6 and 7? */ |
429 | 437 | ||
430 | if(check_flag) { | 438 | if (check_flag) { |
431 | unsigned char pos6, pos7; | 439 | unsigned char pos6, pos7; |
432 | 440 | ||
433 | pos6 = mca_device_read_pos(mca_dev, 6); | 441 | pos6 = mca_device_read_pos(mca_dev, 6); |
@@ -447,8 +455,9 @@ static int __kprobes mca_handle_nmi_callback(struct device *dev, void *data) | |||
447 | 455 | ||
448 | pos5 = mca_device_read_pos(mca_dev, 5); | 456 | pos5 = mca_device_read_pos(mca_dev, 5); |
449 | 457 | ||
450 | if(!(pos5 & 0x80)) { | 458 | if (!(pos5 & 0x80)) { |
451 | /* Bit 7 of POS 5 is reset when this adapter has a hardware | 459 | /* |
460 | * Bit 7 of POS 5 is reset when this adapter has a hardware | ||
452 | * error. Bit 7 it reset if there's error information | 461 | * error. Bit 7 it reset if there's error information |
453 | * available in POS 6 and 7. | 462 | * available in POS 6 and 7. |
454 | */ | 463 | */ |
@@ -460,7 +469,8 @@ static int __kprobes mca_handle_nmi_callback(struct device *dev, void *data) | |||
460 | 469 | ||
461 | void __kprobes mca_handle_nmi(void) | 470 | void __kprobes mca_handle_nmi(void) |
462 | { | 471 | { |
463 | /* First try - scan the various adapters and see if a specific | 472 | /* |
473 | * First try - scan the various adapters and see if a specific | ||
464 | * adapter was responsible for the error. | 474 | * adapter was responsible for the error. |
465 | */ | 475 | */ |
466 | bus_for_each_dev(&mca_bus_type, NULL, NULL, mca_handle_nmi_callback); | 476 | bus_for_each_dev(&mca_bus_type, NULL, NULL, mca_handle_nmi_callback); |