diff options
author | Corey Minyard <minyard@acm.org> | 2005-09-06 18:18:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-07 19:57:49 -0400 |
commit | e8b336173b86c5db5dd5ae5ad33f3f8605878d0d (patch) | |
tree | 8f48cd879728ab6e625574e21be0d46eab5c632a /drivers/char | |
parent | 168524d673f99550d75af49eb3f5d2850420eb66 (diff) |
[PATCH] ipmi: style cleanups
Clean up various style issues in the IPMI driver. Should be no functional
changes.
Signed-off-by: Corey Minyard <minyard@acm.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/ipmi/ipmi_bt_sm.c | 66 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_msghandler.c | 46 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_poweroff.c | 2 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_si_intf.c | 141 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_watchdog.c | 19 |
5 files changed, 146 insertions, 128 deletions
diff --git a/drivers/char/ipmi/ipmi_bt_sm.c b/drivers/char/ipmi/ipmi_bt_sm.c index 64c9afa50c13..33862670e285 100644 --- a/drivers/char/ipmi/ipmi_bt_sm.c +++ b/drivers/char/ipmi/ipmi_bt_sm.c | |||
@@ -161,7 +161,8 @@ static int bt_start_transaction(struct si_sm_data *bt, | |||
161 | { | 161 | { |
162 | unsigned int i; | 162 | unsigned int i; |
163 | 163 | ||
164 | if ((size < 2) || (size > IPMI_MAX_MSG_LENGTH)) return -1; | 164 | if ((size < 2) || (size > IPMI_MAX_MSG_LENGTH)) |
165 | return -1; | ||
165 | 166 | ||
166 | if ((bt->state != BT_STATE_IDLE) && (bt->state != BT_STATE_HOSED)) | 167 | if ((bt->state != BT_STATE_IDLE) && (bt->state != BT_STATE_HOSED)) |
167 | return -2; | 168 | return -2; |
@@ -169,7 +170,8 @@ static int bt_start_transaction(struct si_sm_data *bt, | |||
169 | if (bt_debug & BT_DEBUG_MSG) { | 170 | if (bt_debug & BT_DEBUG_MSG) { |
170 | printk(KERN_WARNING "+++++++++++++++++++++++++++++++++++++\n"); | 171 | printk(KERN_WARNING "+++++++++++++++++++++++++++++++++++++\n"); |
171 | printk(KERN_WARNING "BT: write seq=0x%02X:", bt->seq); | 172 | printk(KERN_WARNING "BT: write seq=0x%02X:", bt->seq); |
172 | for (i = 0; i < size; i ++) printk (" %02x", data[i]); | 173 | for (i = 0; i < size; i ++) |
174 | printk (" %02x", data[i]); | ||
173 | printk("\n"); | 175 | printk("\n"); |
174 | } | 176 | } |
175 | bt->write_data[0] = size + 1; /* all data plus seq byte */ | 177 | bt->write_data[0] = size + 1; /* all data plus seq byte */ |
@@ -208,15 +210,18 @@ static int bt_get_result(struct si_sm_data *bt, | |||
208 | } else { | 210 | } else { |
209 | data[0] = bt->read_data[1]; | 211 | data[0] = bt->read_data[1]; |
210 | data[1] = bt->read_data[3]; | 212 | data[1] = bt->read_data[3]; |
211 | if (length < msg_len) bt->truncated = 1; | 213 | if (length < msg_len) |
214 | bt->truncated = 1; | ||
212 | if (bt->truncated) { /* can be set in read_all_bytes() */ | 215 | if (bt->truncated) { /* can be set in read_all_bytes() */ |
213 | data[2] = IPMI_ERR_MSG_TRUNCATED; | 216 | data[2] = IPMI_ERR_MSG_TRUNCATED; |
214 | msg_len = 3; | 217 | msg_len = 3; |
215 | } else memcpy(data + 2, bt->read_data + 4, msg_len - 2); | 218 | } else |
219 | memcpy(data + 2, bt->read_data + 4, msg_len - 2); | ||
216 | 220 | ||
217 | if (bt_debug & BT_DEBUG_MSG) { | 221 | if (bt_debug & BT_DEBUG_MSG) { |
218 | printk (KERN_WARNING "BT: res (raw)"); | 222 | printk (KERN_WARNING "BT: res (raw)"); |
219 | for (i = 0; i < msg_len; i++) printk(" %02x", data[i]); | 223 | for (i = 0; i < msg_len; i++) |
224 | printk(" %02x", data[i]); | ||
220 | printk ("\n"); | 225 | printk ("\n"); |
221 | } | 226 | } |
222 | } | 227 | } |
@@ -229,8 +234,10 @@ static int bt_get_result(struct si_sm_data *bt, | |||
229 | 234 | ||
230 | static void reset_flags(struct si_sm_data *bt) | 235 | static void reset_flags(struct si_sm_data *bt) |
231 | { | 236 | { |
232 | if (BT_STATUS & BT_H_BUSY) BT_CONTROL(BT_H_BUSY); | 237 | if (BT_STATUS & BT_H_BUSY) |
233 | if (BT_STATUS & BT_B_BUSY) BT_CONTROL(BT_B_BUSY); | 238 | BT_CONTROL(BT_H_BUSY); |
239 | if (BT_STATUS & BT_B_BUSY) | ||
240 | BT_CONTROL(BT_B_BUSY); | ||
234 | BT_CONTROL(BT_CLR_WR_PTR); | 241 | BT_CONTROL(BT_CLR_WR_PTR); |
235 | BT_CONTROL(BT_SMS_ATN); | 242 | BT_CONTROL(BT_SMS_ATN); |
236 | #ifdef DEVELOPMENT_ONLY_NOT_FOR_PRODUCTION | 243 | #ifdef DEVELOPMENT_ONLY_NOT_FOR_PRODUCTION |
@@ -239,7 +246,8 @@ static void reset_flags(struct si_sm_data *bt) | |||
239 | BT_CONTROL(BT_H_BUSY); | 246 | BT_CONTROL(BT_H_BUSY); |
240 | BT_CONTROL(BT_B2H_ATN); | 247 | BT_CONTROL(BT_B2H_ATN); |
241 | BT_CONTROL(BT_CLR_RD_PTR); | 248 | BT_CONTROL(BT_CLR_RD_PTR); |
242 | for (i = 0; i < IPMI_MAX_MSG_LENGTH + 2; i++) BMC2HOST; | 249 | for (i = 0; i < IPMI_MAX_MSG_LENGTH + 2; i++) |
250 | BMC2HOST; | ||
243 | BT_CONTROL(BT_H_BUSY); | 251 | BT_CONTROL(BT_H_BUSY); |
244 | } | 252 | } |
245 | #endif | 253 | #endif |
@@ -256,7 +264,8 @@ static inline void write_all_bytes(struct si_sm_data *bt) | |||
256 | printk (" %02x", bt->write_data[i]); | 264 | printk (" %02x", bt->write_data[i]); |
257 | printk ("\n"); | 265 | printk ("\n"); |
258 | } | 266 | } |
259 | for (i = 0; i < bt->write_count; i++) HOST2BMC(bt->write_data[i]); | 267 | for (i = 0; i < bt->write_count; i++) |
268 | HOST2BMC(bt->write_data[i]); | ||
260 | } | 269 | } |
261 | 270 | ||
262 | static inline int read_all_bytes(struct si_sm_data *bt) | 271 | static inline int read_all_bytes(struct si_sm_data *bt) |
@@ -276,7 +285,8 @@ static inline int read_all_bytes(struct si_sm_data *bt) | |||
276 | bt->truncated = 1; | 285 | bt->truncated = 1; |
277 | return 1; /* let next XACTION START clean it up */ | 286 | return 1; /* let next XACTION START clean it up */ |
278 | } | 287 | } |
279 | for (i = 1; i <= bt->read_count; i++) bt->read_data[i] = BMC2HOST; | 288 | for (i = 1; i <= bt->read_count; i++) |
289 | bt->read_data[i] = BMC2HOST; | ||
280 | bt->read_count++; /* account for the length byte */ | 290 | bt->read_count++; /* account for the length byte */ |
281 | 291 | ||
282 | if (bt_debug & BT_DEBUG_MSG) { | 292 | if (bt_debug & BT_DEBUG_MSG) { |
@@ -293,7 +303,8 @@ static inline int read_all_bytes(struct si_sm_data *bt) | |||
293 | ((bt->read_data[1] & 0xF8) == (bt->write_data[1] & 0xF8))) | 303 | ((bt->read_data[1] & 0xF8) == (bt->write_data[1] & 0xF8))) |
294 | return 1; | 304 | return 1; |
295 | 305 | ||
296 | if (bt_debug & BT_DEBUG_MSG) printk(KERN_WARNING "BT: bad packet: " | 306 | if (bt_debug & BT_DEBUG_MSG) |
307 | printk(KERN_WARNING "BT: bad packet: " | ||
297 | "want 0x(%02X, %02X, %02X) got (%02X, %02X, %02X)\n", | 308 | "want 0x(%02X, %02X, %02X) got (%02X, %02X, %02X)\n", |
298 | bt->write_data[1], bt->write_data[2], bt->write_data[3], | 309 | bt->write_data[1], bt->write_data[2], bt->write_data[3], |
299 | bt->read_data[1], bt->read_data[2], bt->read_data[3]); | 310 | bt->read_data[1], bt->read_data[2], bt->read_data[3]); |
@@ -357,7 +368,8 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time) | |||
357 | time); | 368 | time); |
358 | bt->last_state = bt->state; | 369 | bt->last_state = bt->state; |
359 | 370 | ||
360 | if (bt->state == BT_STATE_HOSED) return SI_SM_HOSED; | 371 | if (bt->state == BT_STATE_HOSED) |
372 | return SI_SM_HOSED; | ||
361 | 373 | ||
362 | if (bt->state != BT_STATE_IDLE) { /* do timeout test */ | 374 | if (bt->state != BT_STATE_IDLE) { /* do timeout test */ |
363 | 375 | ||
@@ -369,7 +381,8 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time) | |||
369 | /* FIXME: bt_event is sometimes called with time > BT_NORMAL_TIMEOUT | 381 | /* FIXME: bt_event is sometimes called with time > BT_NORMAL_TIMEOUT |
370 | (noticed in ipmi_smic_sm.c January 2004) */ | 382 | (noticed in ipmi_smic_sm.c January 2004) */ |
371 | 383 | ||
372 | if ((time <= 0) || (time >= BT_NORMAL_TIMEOUT)) time = 100; | 384 | if ((time <= 0) || (time >= BT_NORMAL_TIMEOUT)) |
385 | time = 100; | ||
373 | bt->timeout -= time; | 386 | bt->timeout -= time; |
374 | if ((bt->timeout < 0) && (bt->state < BT_STATE_RESET1)) { | 387 | if ((bt->timeout < 0) && (bt->state < BT_STATE_RESET1)) { |
375 | error_recovery(bt, "timed out"); | 388 | error_recovery(bt, "timed out"); |
@@ -391,12 +404,14 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time) | |||
391 | BT_CONTROL(BT_H_BUSY); | 404 | BT_CONTROL(BT_H_BUSY); |
392 | break; | 405 | break; |
393 | } | 406 | } |
394 | if (status & BT_B2H_ATN) break; | 407 | if (status & BT_B2H_ATN) |
408 | break; | ||
395 | bt->state = BT_STATE_WRITE_BYTES; | 409 | bt->state = BT_STATE_WRITE_BYTES; |
396 | return SI_SM_CALL_WITHOUT_DELAY; /* for logging */ | 410 | return SI_SM_CALL_WITHOUT_DELAY; /* for logging */ |
397 | 411 | ||
398 | case BT_STATE_WRITE_BYTES: | 412 | case BT_STATE_WRITE_BYTES: |
399 | if (status & (BT_B_BUSY | BT_H2B_ATN)) break; | 413 | if (status & (BT_B_BUSY | BT_H2B_ATN)) |
414 | break; | ||
400 | BT_CONTROL(BT_CLR_WR_PTR); | 415 | BT_CONTROL(BT_CLR_WR_PTR); |
401 | write_all_bytes(bt); | 416 | write_all_bytes(bt); |
402 | BT_CONTROL(BT_H2B_ATN); /* clears too fast to catch? */ | 417 | BT_CONTROL(BT_H2B_ATN); /* clears too fast to catch? */ |
@@ -404,7 +419,8 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time) | |||
404 | return SI_SM_CALL_WITHOUT_DELAY; /* it MIGHT sail through */ | 419 | return SI_SM_CALL_WITHOUT_DELAY; /* it MIGHT sail through */ |
405 | 420 | ||
406 | case BT_STATE_WRITE_CONSUME: /* BMCs usually blow right thru here */ | 421 | case BT_STATE_WRITE_CONSUME: /* BMCs usually blow right thru here */ |
407 | if (status & (BT_H2B_ATN | BT_B_BUSY)) break; | 422 | if (status & (BT_H2B_ATN | BT_B_BUSY)) |
423 | break; | ||
408 | bt->state = BT_STATE_B2H_WAIT; | 424 | bt->state = BT_STATE_B2H_WAIT; |
409 | /* fall through with status */ | 425 | /* fall through with status */ |
410 | 426 | ||
@@ -413,15 +429,18 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time) | |||
413 | generation of B2H_ATN so ALWAYS return CALL_WITH_DELAY. */ | 429 | generation of B2H_ATN so ALWAYS return CALL_WITH_DELAY. */ |
414 | 430 | ||
415 | case BT_STATE_B2H_WAIT: | 431 | case BT_STATE_B2H_WAIT: |
416 | if (!(status & BT_B2H_ATN)) break; | 432 | if (!(status & BT_B2H_ATN)) |
433 | break; | ||
417 | 434 | ||
418 | /* Assume ordered, uncached writes: no need to wait */ | 435 | /* Assume ordered, uncached writes: no need to wait */ |
419 | if (!(status & BT_H_BUSY)) BT_CONTROL(BT_H_BUSY); /* set */ | 436 | if (!(status & BT_H_BUSY)) |
437 | BT_CONTROL(BT_H_BUSY); /* set */ | ||
420 | BT_CONTROL(BT_B2H_ATN); /* clear it, ACK to the BMC */ | 438 | BT_CONTROL(BT_B2H_ATN); /* clear it, ACK to the BMC */ |
421 | BT_CONTROL(BT_CLR_RD_PTR); /* reset the queue */ | 439 | BT_CONTROL(BT_CLR_RD_PTR); /* reset the queue */ |
422 | i = read_all_bytes(bt); | 440 | i = read_all_bytes(bt); |
423 | BT_CONTROL(BT_H_BUSY); /* clear */ | 441 | BT_CONTROL(BT_H_BUSY); /* clear */ |
424 | if (!i) break; /* Try this state again */ | 442 | if (!i) /* Try this state again */ |
443 | break; | ||
425 | bt->state = BT_STATE_READ_END; | 444 | bt->state = BT_STATE_READ_END; |
426 | return SI_SM_CALL_WITHOUT_DELAY; /* for logging */ | 445 | return SI_SM_CALL_WITHOUT_DELAY; /* for logging */ |
427 | 446 | ||
@@ -434,7 +453,8 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time) | |||
434 | 453 | ||
435 | #ifdef MAKE_THIS_TRUE_IF_NECESSARY | 454 | #ifdef MAKE_THIS_TRUE_IF_NECESSARY |
436 | 455 | ||
437 | if (status & BT_H_BUSY) break; | 456 | if (status & BT_H_BUSY) |
457 | break; | ||
438 | #endif | 458 | #endif |
439 | bt->seq++; | 459 | bt->seq++; |
440 | bt->state = BT_STATE_IDLE; | 460 | bt->state = BT_STATE_IDLE; |
@@ -457,7 +477,8 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time) | |||
457 | break; | 477 | break; |
458 | 478 | ||
459 | case BT_STATE_RESET3: | 479 | case BT_STATE_RESET3: |
460 | if (bt->timeout > 0) return SI_SM_CALL_WITH_DELAY; | 480 | if (bt->timeout > 0) |
481 | return SI_SM_CALL_WITH_DELAY; | ||
461 | bt->state = BT_STATE_RESTART; /* printk in debug modes */ | 482 | bt->state = BT_STATE_RESTART; /* printk in debug modes */ |
462 | break; | 483 | break; |
463 | 484 | ||
@@ -483,7 +504,8 @@ static int bt_detect(struct si_sm_data *bt) | |||
483 | but that's what you get from reading a bogus address, so we | 504 | but that's what you get from reading a bogus address, so we |
484 | test that first. The calling routine uses negative logic. */ | 505 | test that first. The calling routine uses negative logic. */ |
485 | 506 | ||
486 | if ((BT_STATUS == 0xFF) && (BT_INTMASK_R == 0xFF)) return 1; | 507 | if ((BT_STATUS == 0xFF) && (BT_INTMASK_R == 0xFF)) |
508 | return 1; | ||
487 | reset_flags(bt); | 509 | reset_flags(bt); |
488 | return 0; | 510 | return 0; |
489 | } | 511 | } |
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index d0ed25278cbb..792f4c282291 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -117,7 +117,7 @@ struct seq_table | |||
117 | do { \ | 117 | do { \ |
118 | seq = ((msgid >> 26) & 0x3f); \ | 118 | seq = ((msgid >> 26) & 0x3f); \ |
119 | seqid = (msgid & 0x3fffff); \ | 119 | seqid = (msgid & 0x3fffff); \ |
120 | } while(0) | 120 | } while (0) |
121 | 121 | ||
122 | #define NEXT_SEQID(seqid) (((seqid) + 1) & 0x3fffff) | 122 | #define NEXT_SEQID(seqid) (((seqid) + 1) & 0x3fffff) |
123 | 123 | ||
@@ -326,7 +326,7 @@ int ipmi_smi_watcher_register(struct ipmi_smi_watcher *watcher) | |||
326 | down_read(&interfaces_sem); | 326 | down_read(&interfaces_sem); |
327 | down_write(&smi_watchers_sem); | 327 | down_write(&smi_watchers_sem); |
328 | list_add(&(watcher->link), &smi_watchers); | 328 | list_add(&(watcher->link), &smi_watchers); |
329 | for (i=0; i<MAX_IPMI_INTERFACES; i++) { | 329 | for (i = 0; i < MAX_IPMI_INTERFACES; i++) { |
330 | if (ipmi_interfaces[i] != NULL) { | 330 | if (ipmi_interfaces[i] != NULL) { |
331 | watcher->new_smi(i); | 331 | watcher->new_smi(i); |
332 | } | 332 | } |
@@ -496,9 +496,9 @@ static int intf_next_seq(ipmi_smi_t intf, | |||
496 | int rv = 0; | 496 | int rv = 0; |
497 | unsigned int i; | 497 | unsigned int i; |
498 | 498 | ||
499 | for (i=intf->curr_seq; | 499 | for (i = intf->curr_seq; |
500 | (i+1)%IPMI_IPMB_NUM_SEQ != intf->curr_seq; | 500 | (i+1)%IPMI_IPMB_NUM_SEQ != intf->curr_seq; |
501 | i=(i+1)%IPMI_IPMB_NUM_SEQ) | 501 | i = (i+1)%IPMI_IPMB_NUM_SEQ) |
502 | { | 502 | { |
503 | if (! intf->seq_table[i].inuse) | 503 | if (! intf->seq_table[i].inuse) |
504 | break; | 504 | break; |
@@ -733,7 +733,7 @@ static int ipmi_destroy_user_nolock(ipmi_user_t user) | |||
733 | 733 | ||
734 | /* Remove the user from the interfaces sequence table. */ | 734 | /* Remove the user from the interfaces sequence table. */ |
735 | spin_lock_irqsave(&(user->intf->seq_lock), flags); | 735 | spin_lock_irqsave(&(user->intf->seq_lock), flags); |
736 | for (i=0; i<IPMI_IPMB_NUM_SEQ; i++) { | 736 | for (i = 0; i < IPMI_IPMB_NUM_SEQ; i++) { |
737 | if (user->intf->seq_table[i].inuse | 737 | if (user->intf->seq_table[i].inuse |
738 | && (user->intf->seq_table[i].recv_msg->user == user)) | 738 | && (user->intf->seq_table[i].recv_msg->user == user)) |
739 | { | 739 | { |
@@ -1370,7 +1370,7 @@ static inline int i_ipmi_request(ipmi_user_t user, | |||
1370 | #ifdef DEBUG_MSGING | 1370 | #ifdef DEBUG_MSGING |
1371 | { | 1371 | { |
1372 | int m; | 1372 | int m; |
1373 | for (m=0; m<smi_msg->data_size; m++) | 1373 | for (m = 0; m < smi_msg->data_size; m++) |
1374 | printk(" %2.2x", smi_msg->data[m]); | 1374 | printk(" %2.2x", smi_msg->data[m]); |
1375 | printk("\n"); | 1375 | printk("\n"); |
1376 | } | 1376 | } |
@@ -1467,7 +1467,7 @@ static int ipmb_file_read_proc(char *page, char **start, off_t off, | |||
1467 | int i; | 1467 | int i; |
1468 | int rv= 0; | 1468 | int rv= 0; |
1469 | 1469 | ||
1470 | for (i=0; i<IPMI_MAX_CHANNELS; i++) | 1470 | for (i = 0; i < IPMI_MAX_CHANNELS; i++) |
1471 | rv += sprintf(out+rv, "%x ", intf->channels[i].address); | 1471 | rv += sprintf(out+rv, "%x ", intf->channels[i].address); |
1472 | out[rv-1] = '\n'; /* Replace the final space with a newline */ | 1472 | out[rv-1] = '\n'; /* Replace the final space with a newline */ |
1473 | out[rv] = '\0'; | 1473 | out[rv] = '\0'; |
@@ -1766,12 +1766,12 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers, | |||
1766 | rv = -ENOMEM; | 1766 | rv = -ENOMEM; |
1767 | 1767 | ||
1768 | down_write(&interfaces_sem); | 1768 | down_write(&interfaces_sem); |
1769 | for (i=0; i<MAX_IPMI_INTERFACES; i++) { | 1769 | for (i = 0; i < MAX_IPMI_INTERFACES; i++) { |
1770 | if (ipmi_interfaces[i] == NULL) { | 1770 | if (ipmi_interfaces[i] == NULL) { |
1771 | new_intf->intf_num = i; | 1771 | new_intf->intf_num = i; |
1772 | new_intf->version_major = version_major; | 1772 | new_intf->version_major = version_major; |
1773 | new_intf->version_minor = version_minor; | 1773 | new_intf->version_minor = version_minor; |
1774 | for (j=0; j<IPMI_MAX_CHANNELS; j++) { | 1774 | for (j = 0; j < IPMI_MAX_CHANNELS; j++) { |
1775 | new_intf->channels[j].address | 1775 | new_intf->channels[j].address |
1776 | = IPMI_BMC_SLAVE_ADDR; | 1776 | = IPMI_BMC_SLAVE_ADDR; |
1777 | new_intf->channels[j].lun = 2; | 1777 | new_intf->channels[j].lun = 2; |
@@ -1783,7 +1783,7 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers, | |||
1783 | new_intf->handlers = handlers; | 1783 | new_intf->handlers = handlers; |
1784 | new_intf->send_info = send_info; | 1784 | new_intf->send_info = send_info; |
1785 | spin_lock_init(&(new_intf->seq_lock)); | 1785 | spin_lock_init(&(new_intf->seq_lock)); |
1786 | for (j=0; j<IPMI_IPMB_NUM_SEQ; j++) { | 1786 | for (j = 0; j < IPMI_IPMB_NUM_SEQ; j++) { |
1787 | new_intf->seq_table[j].inuse = 0; | 1787 | new_intf->seq_table[j].inuse = 0; |
1788 | new_intf->seq_table[j].seqid = 0; | 1788 | new_intf->seq_table[j].seqid = 0; |
1789 | } | 1789 | } |
@@ -1891,7 +1891,7 @@ static void clean_up_interface_data(ipmi_smi_t intf) | |||
1891 | free_recv_msg_list(&(intf->waiting_events)); | 1891 | free_recv_msg_list(&(intf->waiting_events)); |
1892 | free_cmd_rcvr_list(&(intf->cmd_rcvrs)); | 1892 | free_cmd_rcvr_list(&(intf->cmd_rcvrs)); |
1893 | 1893 | ||
1894 | for (i=0; i<IPMI_IPMB_NUM_SEQ; i++) { | 1894 | for (i = 0; i < IPMI_IPMB_NUM_SEQ; i++) { |
1895 | if ((intf->seq_table[i].inuse) | 1895 | if ((intf->seq_table[i].inuse) |
1896 | && (intf->seq_table[i].recv_msg)) | 1896 | && (intf->seq_table[i].recv_msg)) |
1897 | { | 1897 | { |
@@ -1910,7 +1910,7 @@ int ipmi_unregister_smi(ipmi_smi_t intf) | |||
1910 | down_write(&interfaces_sem); | 1910 | down_write(&interfaces_sem); |
1911 | if (list_empty(&(intf->users))) | 1911 | if (list_empty(&(intf->users))) |
1912 | { | 1912 | { |
1913 | for (i=0; i<MAX_IPMI_INTERFACES; i++) { | 1913 | for (i = 0; i < MAX_IPMI_INTERFACES; i++) { |
1914 | if (ipmi_interfaces[i] == intf) { | 1914 | if (ipmi_interfaces[i] == intf) { |
1915 | remove_proc_entries(intf); | 1915 | remove_proc_entries(intf); |
1916 | spin_lock_irqsave(&interfaces_lock, flags); | 1916 | spin_lock_irqsave(&interfaces_lock, flags); |
@@ -2074,7 +2074,7 @@ static int handle_ipmb_get_msg_cmd(ipmi_smi_t intf, | |||
2074 | { | 2074 | { |
2075 | int m; | 2075 | int m; |
2076 | printk("Invalid command:"); | 2076 | printk("Invalid command:"); |
2077 | for (m=0; m<msg->data_size; m++) | 2077 | for (m = 0; m < msg->data_size; m++) |
2078 | printk(" %2.2x", msg->data[m]); | 2078 | printk(" %2.2x", msg->data[m]); |
2079 | printk("\n"); | 2079 | printk("\n"); |
2080 | } | 2080 | } |
@@ -2469,7 +2469,7 @@ static int handle_new_recv_msg(ipmi_smi_t intf, | |||
2469 | #ifdef DEBUG_MSGING | 2469 | #ifdef DEBUG_MSGING |
2470 | int m; | 2470 | int m; |
2471 | printk("Recv:"); | 2471 | printk("Recv:"); |
2472 | for (m=0; m<msg->rsp_size; m++) | 2472 | for (m = 0; m < msg->rsp_size; m++) |
2473 | printk(" %2.2x", msg->rsp[m]); | 2473 | printk(" %2.2x", msg->rsp[m]); |
2474 | printk("\n"); | 2474 | printk("\n"); |
2475 | #endif | 2475 | #endif |
@@ -2703,7 +2703,7 @@ smi_from_recv_msg(ipmi_smi_t intf, struct ipmi_recv_msg *recv_msg, | |||
2703 | { | 2703 | { |
2704 | int m; | 2704 | int m; |
2705 | printk("Resend: "); | 2705 | printk("Resend: "); |
2706 | for (m=0; m<smi_msg->data_size; m++) | 2706 | for (m = 0; m < smi_msg->data_size; m++) |
2707 | printk(" %2.2x", smi_msg->data[m]); | 2707 | printk(" %2.2x", smi_msg->data[m]); |
2708 | printk("\n"); | 2708 | printk("\n"); |
2709 | } | 2709 | } |
@@ -2724,7 +2724,7 @@ ipmi_timeout_handler(long timeout_period) | |||
2724 | INIT_LIST_HEAD(&timeouts); | 2724 | INIT_LIST_HEAD(&timeouts); |
2725 | 2725 | ||
2726 | spin_lock(&interfaces_lock); | 2726 | spin_lock(&interfaces_lock); |
2727 | for (i=0; i<MAX_IPMI_INTERFACES; i++) { | 2727 | for (i = 0; i < MAX_IPMI_INTERFACES; i++) { |
2728 | intf = ipmi_interfaces[i]; | 2728 | intf = ipmi_interfaces[i]; |
2729 | if (intf == NULL) | 2729 | if (intf == NULL) |
2730 | continue; | 2730 | continue; |
@@ -2749,7 +2749,7 @@ ipmi_timeout_handler(long timeout_period) | |||
2749 | have timed out, putting them in the timeouts | 2749 | have timed out, putting them in the timeouts |
2750 | list. */ | 2750 | list. */ |
2751 | spin_lock_irqsave(&(intf->seq_lock), flags); | 2751 | spin_lock_irqsave(&(intf->seq_lock), flags); |
2752 | for (j=0; j<IPMI_IPMB_NUM_SEQ; j++) { | 2752 | for (j = 0; j < IPMI_IPMB_NUM_SEQ; j++) { |
2753 | struct seq_table *ent = &(intf->seq_table[j]); | 2753 | struct seq_table *ent = &(intf->seq_table[j]); |
2754 | if (!ent->inuse) | 2754 | if (!ent->inuse) |
2755 | continue; | 2755 | continue; |
@@ -2789,7 +2789,7 @@ ipmi_timeout_handler(long timeout_period) | |||
2789 | spin_unlock(&intf->counter_lock); | 2789 | spin_unlock(&intf->counter_lock); |
2790 | smi_msg = smi_from_recv_msg(intf, | 2790 | smi_msg = smi_from_recv_msg(intf, |
2791 | ent->recv_msg, j, ent->seqid); | 2791 | ent->recv_msg, j, ent->seqid); |
2792 | if(!smi_msg) | 2792 | if (! smi_msg) |
2793 | continue; | 2793 | continue; |
2794 | 2794 | ||
2795 | spin_unlock_irqrestore(&(intf->seq_lock),flags); | 2795 | spin_unlock_irqrestore(&(intf->seq_lock),flags); |
@@ -2820,7 +2820,7 @@ static void ipmi_request_event(void) | |||
2820 | int i; | 2820 | int i; |
2821 | 2821 | ||
2822 | spin_lock(&interfaces_lock); | 2822 | spin_lock(&interfaces_lock); |
2823 | for (i=0; i<MAX_IPMI_INTERFACES; i++) { | 2823 | for (i = 0; i < MAX_IPMI_INTERFACES; i++) { |
2824 | intf = ipmi_interfaces[i]; | 2824 | intf = ipmi_interfaces[i]; |
2825 | if (intf == NULL) | 2825 | if (intf == NULL) |
2826 | continue; | 2826 | continue; |
@@ -2982,7 +2982,7 @@ static void send_panic_events(char *str) | |||
2982 | recv_msg.done = dummy_recv_done_handler; | 2982 | recv_msg.done = dummy_recv_done_handler; |
2983 | 2983 | ||
2984 | /* For every registered interface, send the event. */ | 2984 | /* For every registered interface, send the event. */ |
2985 | for (i=0; i<MAX_IPMI_INTERFACES; i++) { | 2985 | for (i = 0; i < MAX_IPMI_INTERFACES; i++) { |
2986 | intf = ipmi_interfaces[i]; | 2986 | intf = ipmi_interfaces[i]; |
2987 | if (intf == NULL) | 2987 | if (intf == NULL) |
2988 | continue; | 2988 | continue; |
@@ -3009,7 +3009,7 @@ static void send_panic_events(char *str) | |||
3009 | if (!str) | 3009 | if (!str) |
3010 | return; | 3010 | return; |
3011 | 3011 | ||
3012 | for (i=0; i<MAX_IPMI_INTERFACES; i++) { | 3012 | for (i = 0; i < MAX_IPMI_INTERFACES; i++) { |
3013 | char *p = str; | 3013 | char *p = str; |
3014 | struct ipmi_ipmb_addr *ipmb; | 3014 | struct ipmi_ipmb_addr *ipmb; |
3015 | int j; | 3015 | int j; |
@@ -3149,7 +3149,7 @@ static int panic_event(struct notifier_block *this, | |||
3149 | has_paniced = 1; | 3149 | has_paniced = 1; |
3150 | 3150 | ||
3151 | /* For every registered interface, set it to run to completion. */ | 3151 | /* For every registered interface, set it to run to completion. */ |
3152 | for (i=0; i<MAX_IPMI_INTERFACES; i++) { | 3152 | for (i = 0; i < MAX_IPMI_INTERFACES; i++) { |
3153 | intf = ipmi_interfaces[i]; | 3153 | intf = ipmi_interfaces[i]; |
3154 | if (intf == NULL) | 3154 | if (intf == NULL) |
3155 | continue; | 3155 | continue; |
@@ -3180,7 +3180,7 @@ static int ipmi_init_msghandler(void) | |||
3180 | printk(KERN_INFO "ipmi message handler version " | 3180 | printk(KERN_INFO "ipmi message handler version " |
3181 | IPMI_DRIVER_VERSION "\n"); | 3181 | IPMI_DRIVER_VERSION "\n"); |
3182 | 3182 | ||
3183 | for (i=0; i<MAX_IPMI_INTERFACES; i++) { | 3183 | for (i = 0; i < MAX_IPMI_INTERFACES; i++) { |
3184 | ipmi_interfaces[i] = NULL; | 3184 | ipmi_interfaces[i] = NULL; |
3185 | } | 3185 | } |
3186 | 3186 | ||
diff --git a/drivers/char/ipmi/ipmi_poweroff.c b/drivers/char/ipmi/ipmi_poweroff.c index 170590153df6..42ea9843b394 100644 --- a/drivers/char/ipmi/ipmi_poweroff.c +++ b/drivers/char/ipmi/ipmi_poweroff.c | |||
@@ -525,7 +525,7 @@ static void ipmi_po_new_smi(int if_num) | |||
525 | 525 | ||
526 | 526 | ||
527 | /* Scan for a poweroff method */ | 527 | /* Scan for a poweroff method */ |
528 | for (i=0; i<NUM_PO_FUNCS; i++) { | 528 | for (i = 0; i < NUM_PO_FUNCS; i++) { |
529 | if (poweroff_functions[i].detect(ipmi_user)) | 529 | if (poweroff_functions[i].detect(ipmi_user)) |
530 | goto found; | 530 | goto found; |
531 | } | 531 | } |
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index b43172aee4c6..1abec687865c 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -267,7 +267,7 @@ static enum si_sm_result start_next_msg(struct smi_info *smi_info) | |||
267 | entry = smi_info->xmit_msgs.next; | 267 | entry = smi_info->xmit_msgs.next; |
268 | } | 268 | } |
269 | 269 | ||
270 | if (!entry) { | 270 | if (! entry) { |
271 | smi_info->curr_msg = NULL; | 271 | smi_info->curr_msg = NULL; |
272 | rv = SI_SM_IDLE; | 272 | rv = SI_SM_IDLE; |
273 | } else { | 273 | } else { |
@@ -328,7 +328,7 @@ static void start_clear_flags(struct smi_info *smi_info) | |||
328 | memory, we will re-enable the interrupt. */ | 328 | memory, we will re-enable the interrupt. */ |
329 | static inline void disable_si_irq(struct smi_info *smi_info) | 329 | static inline void disable_si_irq(struct smi_info *smi_info) |
330 | { | 330 | { |
331 | if ((smi_info->irq) && (!smi_info->interrupt_disabled)) { | 331 | if ((smi_info->irq) && (! smi_info->interrupt_disabled)) { |
332 | disable_irq_nosync(smi_info->irq); | 332 | disable_irq_nosync(smi_info->irq); |
333 | smi_info->interrupt_disabled = 1; | 333 | smi_info->interrupt_disabled = 1; |
334 | } | 334 | } |
@@ -359,7 +359,7 @@ static void handle_flags(struct smi_info *smi_info) | |||
359 | } else if (smi_info->msg_flags & RECEIVE_MSG_AVAIL) { | 359 | } else if (smi_info->msg_flags & RECEIVE_MSG_AVAIL) { |
360 | /* Messages available. */ | 360 | /* Messages available. */ |
361 | smi_info->curr_msg = ipmi_alloc_smi_msg(); | 361 | smi_info->curr_msg = ipmi_alloc_smi_msg(); |
362 | if (!smi_info->curr_msg) { | 362 | if (! smi_info->curr_msg) { |
363 | disable_si_irq(smi_info); | 363 | disable_si_irq(smi_info); |
364 | smi_info->si_state = SI_NORMAL; | 364 | smi_info->si_state = SI_NORMAL; |
365 | return; | 365 | return; |
@@ -378,7 +378,7 @@ static void handle_flags(struct smi_info *smi_info) | |||
378 | } else if (smi_info->msg_flags & EVENT_MSG_BUFFER_FULL) { | 378 | } else if (smi_info->msg_flags & EVENT_MSG_BUFFER_FULL) { |
379 | /* Events available. */ | 379 | /* Events available. */ |
380 | smi_info->curr_msg = ipmi_alloc_smi_msg(); | 380 | smi_info->curr_msg = ipmi_alloc_smi_msg(); |
381 | if (!smi_info->curr_msg) { | 381 | if (! smi_info->curr_msg) { |
382 | disable_si_irq(smi_info); | 382 | disable_si_irq(smi_info); |
383 | smi_info->si_state = SI_NORMAL; | 383 | smi_info->si_state = SI_NORMAL; |
384 | return; | 384 | return; |
@@ -414,7 +414,7 @@ static void handle_transaction_done(struct smi_info *smi_info) | |||
414 | #endif | 414 | #endif |
415 | switch (smi_info->si_state) { | 415 | switch (smi_info->si_state) { |
416 | case SI_NORMAL: | 416 | case SI_NORMAL: |
417 | if (!smi_info->curr_msg) | 417 | if (! smi_info->curr_msg) |
418 | break; | 418 | break; |
419 | 419 | ||
420 | smi_info->curr_msg->rsp_size | 420 | smi_info->curr_msg->rsp_size |
@@ -1047,7 +1047,7 @@ static int std_irq_setup(struct smi_info *info) | |||
1047 | { | 1047 | { |
1048 | int rv; | 1048 | int rv; |
1049 | 1049 | ||
1050 | if (!info->irq) | 1050 | if (! info->irq) |
1051 | return 0; | 1051 | return 0; |
1052 | 1052 | ||
1053 | if (info->si_type == SI_BT) { | 1053 | if (info->si_type == SI_BT) { |
@@ -1056,7 +1056,7 @@ static int std_irq_setup(struct smi_info *info) | |||
1056 | SA_INTERRUPT, | 1056 | SA_INTERRUPT, |
1057 | DEVICE_NAME, | 1057 | DEVICE_NAME, |
1058 | info); | 1058 | info); |
1059 | if (!rv) | 1059 | if (! rv) |
1060 | /* Enable the interrupt in the BT interface. */ | 1060 | /* Enable the interrupt in the BT interface. */ |
1061 | info->io.outputb(&info->io, IPMI_BT_INTMASK_REG, | 1061 | info->io.outputb(&info->io, IPMI_BT_INTMASK_REG, |
1062 | IPMI_BT_INTMASK_ENABLE_IRQ_BIT); | 1062 | IPMI_BT_INTMASK_ENABLE_IRQ_BIT); |
@@ -1081,7 +1081,7 @@ static int std_irq_setup(struct smi_info *info) | |||
1081 | 1081 | ||
1082 | static void std_irq_cleanup(struct smi_info *info) | 1082 | static void std_irq_cleanup(struct smi_info *info) |
1083 | { | 1083 | { |
1084 | if (!info->irq) | 1084 | if (! info->irq) |
1085 | return; | 1085 | return; |
1086 | 1086 | ||
1087 | if (info->si_type == SI_BT) | 1087 | if (info->si_type == SI_BT) |
@@ -1154,7 +1154,7 @@ static int port_setup(struct smi_info *info) | |||
1154 | unsigned int *addr = info->io.info; | 1154 | unsigned int *addr = info->io.info; |
1155 | int mapsize; | 1155 | int mapsize; |
1156 | 1156 | ||
1157 | if (!addr || (!*addr)) | 1157 | if (! addr || (! *addr)) |
1158 | return -ENODEV; | 1158 | return -ENODEV; |
1159 | 1159 | ||
1160 | info->io_cleanup = port_cleanup; | 1160 | info->io_cleanup = port_cleanup; |
@@ -1197,15 +1197,15 @@ static int try_init_port(int intf_num, struct smi_info **new_info) | |||
1197 | { | 1197 | { |
1198 | struct smi_info *info; | 1198 | struct smi_info *info; |
1199 | 1199 | ||
1200 | if (!ports[intf_num]) | 1200 | if (! ports[intf_num]) |
1201 | return -ENODEV; | 1201 | return -ENODEV; |
1202 | 1202 | ||
1203 | if (!is_new_interface(intf_num, IPMI_IO_ADDR_SPACE, | 1203 | if (! is_new_interface(intf_num, IPMI_IO_ADDR_SPACE, |
1204 | ports[intf_num])) | 1204 | ports[intf_num])) |
1205 | return -ENODEV; | 1205 | return -ENODEV; |
1206 | 1206 | ||
1207 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 1207 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
1208 | if (!info) { | 1208 | if (! info) { |
1209 | printk(KERN_ERR "ipmi_si: Could not allocate SI data (1)\n"); | 1209 | printk(KERN_ERR "ipmi_si: Could not allocate SI data (1)\n"); |
1210 | return -ENOMEM; | 1210 | return -ENOMEM; |
1211 | } | 1211 | } |
@@ -1215,10 +1215,10 @@ static int try_init_port(int intf_num, struct smi_info **new_info) | |||
1215 | info->io.info = &(ports[intf_num]); | 1215 | info->io.info = &(ports[intf_num]); |
1216 | info->io.addr = NULL; | 1216 | info->io.addr = NULL; |
1217 | info->io.regspacing = regspacings[intf_num]; | 1217 | info->io.regspacing = regspacings[intf_num]; |
1218 | if (!info->io.regspacing) | 1218 | if (! info->io.regspacing) |
1219 | info->io.regspacing = DEFAULT_REGSPACING; | 1219 | info->io.regspacing = DEFAULT_REGSPACING; |
1220 | info->io.regsize = regsizes[intf_num]; | 1220 | info->io.regsize = regsizes[intf_num]; |
1221 | if (!info->io.regsize) | 1221 | if (! info->io.regsize) |
1222 | info->io.regsize = DEFAULT_REGSPACING; | 1222 | info->io.regsize = DEFAULT_REGSPACING; |
1223 | info->io.regshift = regshifts[intf_num]; | 1223 | info->io.regshift = regshifts[intf_num]; |
1224 | info->irq = 0; | 1224 | info->irq = 0; |
@@ -1303,7 +1303,7 @@ static int mem_setup(struct smi_info *info) | |||
1303 | unsigned long *addr = info->io.info; | 1303 | unsigned long *addr = info->io.info; |
1304 | int mapsize; | 1304 | int mapsize; |
1305 | 1305 | ||
1306 | if (!addr || (!*addr)) | 1306 | if (! addr || (! *addr)) |
1307 | return -ENODEV; | 1307 | return -ENODEV; |
1308 | 1308 | ||
1309 | info->io_cleanup = mem_cleanup; | 1309 | info->io_cleanup = mem_cleanup; |
@@ -1358,15 +1358,15 @@ static int try_init_mem(int intf_num, struct smi_info **new_info) | |||
1358 | { | 1358 | { |
1359 | struct smi_info *info; | 1359 | struct smi_info *info; |
1360 | 1360 | ||
1361 | if (!addrs[intf_num]) | 1361 | if (! addrs[intf_num]) |
1362 | return -ENODEV; | 1362 | return -ENODEV; |
1363 | 1363 | ||
1364 | if (!is_new_interface(intf_num, IPMI_MEM_ADDR_SPACE, | 1364 | if (! is_new_interface(intf_num, IPMI_MEM_ADDR_SPACE, |
1365 | addrs[intf_num])) | 1365 | addrs[intf_num])) |
1366 | return -ENODEV; | 1366 | return -ENODEV; |
1367 | 1367 | ||
1368 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 1368 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
1369 | if (!info) { | 1369 | if (! info) { |
1370 | printk(KERN_ERR "ipmi_si: Could not allocate SI data (2)\n"); | 1370 | printk(KERN_ERR "ipmi_si: Could not allocate SI data (2)\n"); |
1371 | return -ENOMEM; | 1371 | return -ENOMEM; |
1372 | } | 1372 | } |
@@ -1376,10 +1376,10 @@ static int try_init_mem(int intf_num, struct smi_info **new_info) | |||
1376 | info->io.info = &addrs[intf_num]; | 1376 | info->io.info = &addrs[intf_num]; |
1377 | info->io.addr = NULL; | 1377 | info->io.addr = NULL; |
1378 | info->io.regspacing = regspacings[intf_num]; | 1378 | info->io.regspacing = regspacings[intf_num]; |
1379 | if (!info->io.regspacing) | 1379 | if (! info->io.regspacing) |
1380 | info->io.regspacing = DEFAULT_REGSPACING; | 1380 | info->io.regspacing = DEFAULT_REGSPACING; |
1381 | info->io.regsize = regsizes[intf_num]; | 1381 | info->io.regsize = regsizes[intf_num]; |
1382 | if (!info->io.regsize) | 1382 | if (! info->io.regsize) |
1383 | info->io.regsize = DEFAULT_REGSPACING; | 1383 | info->io.regsize = DEFAULT_REGSPACING; |
1384 | info->io.regshift = regshifts[intf_num]; | 1384 | info->io.regshift = regshifts[intf_num]; |
1385 | info->irq = 0; | 1385 | info->irq = 0; |
@@ -1437,7 +1437,7 @@ static int acpi_gpe_irq_setup(struct smi_info *info) | |||
1437 | { | 1437 | { |
1438 | acpi_status status; | 1438 | acpi_status status; |
1439 | 1439 | ||
1440 | if (!info->irq) | 1440 | if (! info->irq) |
1441 | return 0; | 1441 | return 0; |
1442 | 1442 | ||
1443 | /* FIXME - is level triggered right? */ | 1443 | /* FIXME - is level triggered right? */ |
@@ -1461,7 +1461,7 @@ static int acpi_gpe_irq_setup(struct smi_info *info) | |||
1461 | 1461 | ||
1462 | static void acpi_gpe_irq_cleanup(struct smi_info *info) | 1462 | static void acpi_gpe_irq_cleanup(struct smi_info *info) |
1463 | { | 1463 | { |
1464 | if (!info->irq) | 1464 | if (! info->irq) |
1465 | return; | 1465 | return; |
1466 | 1466 | ||
1467 | acpi_remove_gpe_handler(NULL, info->irq, &ipmi_acpi_gpe); | 1467 | acpi_remove_gpe_handler(NULL, info->irq, &ipmi_acpi_gpe); |
@@ -1537,10 +1537,10 @@ static int try_init_acpi(int intf_num, struct smi_info **new_info) | |||
1537 | addr_space = IPMI_MEM_ADDR_SPACE; | 1537 | addr_space = IPMI_MEM_ADDR_SPACE; |
1538 | else | 1538 | else |
1539 | addr_space = IPMI_IO_ADDR_SPACE; | 1539 | addr_space = IPMI_IO_ADDR_SPACE; |
1540 | if (!is_new_interface(-1, addr_space, spmi->addr.address)) | 1540 | if (! is_new_interface(-1, addr_space, spmi->addr.address)) |
1541 | return -ENODEV; | 1541 | return -ENODEV; |
1542 | 1542 | ||
1543 | if (!spmi->addr.register_bit_width) { | 1543 | if (! spmi->addr.register_bit_width) { |
1544 | acpi_failure = 1; | 1544 | acpi_failure = 1; |
1545 | return -ENODEV; | 1545 | return -ENODEV; |
1546 | } | 1546 | } |
@@ -1567,7 +1567,7 @@ static int try_init_acpi(int intf_num, struct smi_info **new_info) | |||
1567 | } | 1567 | } |
1568 | 1568 | ||
1569 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 1569 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
1570 | if (!info) { | 1570 | if (! info) { |
1571 | printk(KERN_ERR "ipmi_si: Could not allocate SI data (3)\n"); | 1571 | printk(KERN_ERR "ipmi_si: Could not allocate SI data (3)\n"); |
1572 | return -ENOMEM; | 1572 | return -ENOMEM; |
1573 | } | 1573 | } |
@@ -1645,7 +1645,7 @@ static int dmi_data_entries; | |||
1645 | 1645 | ||
1646 | static int __init decode_dmi(struct dmi_header *dm, int intf_num) | 1646 | static int __init decode_dmi(struct dmi_header *dm, int intf_num) |
1647 | { | 1647 | { |
1648 | u8 *data = (u8 *)dm; | 1648 | u8 *data = (u8 *)dm; |
1649 | unsigned long base_addr; | 1649 | unsigned long base_addr; |
1650 | u8 reg_spacing; | 1650 | u8 reg_spacing; |
1651 | u8 len = dm->length; | 1651 | u8 len = dm->length; |
@@ -1714,7 +1714,7 @@ static int __init decode_dmi(struct dmi_header *dm, int intf_num) | |||
1714 | static void __init dmi_find_bmc(void) | 1714 | static void __init dmi_find_bmc(void) |
1715 | { | 1715 | { |
1716 | struct dmi_device *dev = NULL; | 1716 | struct dmi_device *dev = NULL; |
1717 | int intf_num = 0; | 1717 | int intf_num = 0; |
1718 | 1718 | ||
1719 | while ((dev = dmi_find_device(DMI_DEV_TYPE_IPMI, NULL, dev))) { | 1719 | while ((dev = dmi_find_device(DMI_DEV_TYPE_IPMI, NULL, dev))) { |
1720 | if (intf_num >= SI_MAX_DRIVERS) | 1720 | if (intf_num >= SI_MAX_DRIVERS) |
@@ -1726,14 +1726,14 @@ static void __init dmi_find_bmc(void) | |||
1726 | 1726 | ||
1727 | static int try_init_smbios(int intf_num, struct smi_info **new_info) | 1727 | static int try_init_smbios(int intf_num, struct smi_info **new_info) |
1728 | { | 1728 | { |
1729 | struct smi_info *info; | 1729 | struct smi_info *info; |
1730 | dmi_ipmi_data_t *ipmi_data = dmi_data+intf_num; | 1730 | dmi_ipmi_data_t *ipmi_data = dmi_data+intf_num; |
1731 | char *io_type; | 1731 | char *io_type; |
1732 | 1732 | ||
1733 | if (intf_num >= dmi_data_entries) | 1733 | if (intf_num >= dmi_data_entries) |
1734 | return -ENODEV; | 1734 | return -ENODEV; |
1735 | 1735 | ||
1736 | switch(ipmi_data->type) { | 1736 | switch (ipmi_data->type) { |
1737 | case 0x01: /* KCS */ | 1737 | case 0x01: /* KCS */ |
1738 | si_type[intf_num] = "kcs"; | 1738 | si_type[intf_num] = "kcs"; |
1739 | break; | 1739 | break; |
@@ -1748,7 +1748,7 @@ static int try_init_smbios(int intf_num, struct smi_info **new_info) | |||
1748 | } | 1748 | } |
1749 | 1749 | ||
1750 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 1750 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
1751 | if (!info) { | 1751 | if (! info) { |
1752 | printk(KERN_ERR "ipmi_si: Could not allocate SI data (4)\n"); | 1752 | printk(KERN_ERR "ipmi_si: Could not allocate SI data (4)\n"); |
1753 | return -ENOMEM; | 1753 | return -ENOMEM; |
1754 | } | 1754 | } |
@@ -1772,7 +1772,7 @@ static int try_init_smbios(int intf_num, struct smi_info **new_info) | |||
1772 | 1772 | ||
1773 | regspacings[intf_num] = ipmi_data->offset; | 1773 | regspacings[intf_num] = ipmi_data->offset; |
1774 | info->io.regspacing = regspacings[intf_num]; | 1774 | info->io.regspacing = regspacings[intf_num]; |
1775 | if (!info->io.regspacing) | 1775 | if (! info->io.regspacing) |
1776 | info->io.regspacing = DEFAULT_REGSPACING; | 1776 | info->io.regspacing = DEFAULT_REGSPACING; |
1777 | info->io.regsize = DEFAULT_REGSPACING; | 1777 | info->io.regsize = DEFAULT_REGSPACING; |
1778 | info->io.regshift = regshifts[intf_num]; | 1778 | info->io.regshift = regshifts[intf_num]; |
@@ -1814,14 +1814,14 @@ static int find_pci_smic(int intf_num, struct smi_info **new_info) | |||
1814 | 1814 | ||
1815 | pci_smic_checked = 1; | 1815 | pci_smic_checked = 1; |
1816 | 1816 | ||
1817 | if ((pci_dev = pci_get_device(PCI_HP_VENDOR_ID, PCI_MMC_DEVICE_ID, | 1817 | pci_dev = pci_get_device(PCI_HP_VENDOR_ID, PCI_MMC_DEVICE_ID, NULL); |
1818 | NULL))) | 1818 | if (! pci_dev) { |
1819 | ; | 1819 | pci_dev = pci_get_class(PCI_ERMC_CLASSCODE, NULL); |
1820 | else if ((pci_dev = pci_get_class(PCI_ERMC_CLASSCODE, NULL)) && | 1820 | if (pci_dev && (pci_dev->subsystem_vendor == PCI_HP_VENDOR_ID)) |
1821 | pci_dev->subsystem_vendor == PCI_HP_VENDOR_ID) | 1821 | fe_rmc = 1; |
1822 | fe_rmc = 1; | 1822 | else |
1823 | else | 1823 | return -ENODEV; |
1824 | return -ENODEV; | 1824 | } |
1825 | 1825 | ||
1826 | error = pci_read_config_word(pci_dev, PCI_MMC_ADDR_CW, &base_addr); | 1826 | error = pci_read_config_word(pci_dev, PCI_MMC_ADDR_CW, &base_addr); |
1827 | if (error) | 1827 | if (error) |
@@ -1834,7 +1834,7 @@ static int find_pci_smic(int intf_num, struct smi_info **new_info) | |||
1834 | } | 1834 | } |
1835 | 1835 | ||
1836 | /* Bit 0: 1 specifies programmed I/O, 0 specifies memory mapped I/O */ | 1836 | /* Bit 0: 1 specifies programmed I/O, 0 specifies memory mapped I/O */ |
1837 | if (!(base_addr & 0x0001)) | 1837 | if (! (base_addr & 0x0001)) |
1838 | { | 1838 | { |
1839 | pci_dev_put(pci_dev); | 1839 | pci_dev_put(pci_dev); |
1840 | printk(KERN_ERR | 1840 | printk(KERN_ERR |
@@ -1844,17 +1844,17 @@ static int find_pci_smic(int intf_num, struct smi_info **new_info) | |||
1844 | } | 1844 | } |
1845 | 1845 | ||
1846 | base_addr &= 0xFFFE; | 1846 | base_addr &= 0xFFFE; |
1847 | if (!fe_rmc) | 1847 | if (! fe_rmc) |
1848 | /* Data register starts at base address + 1 in eRMC */ | 1848 | /* Data register starts at base address + 1 in eRMC */ |
1849 | ++base_addr; | 1849 | ++base_addr; |
1850 | 1850 | ||
1851 | if (!is_new_interface(-1, IPMI_IO_ADDR_SPACE, base_addr)) { | 1851 | if (! is_new_interface(-1, IPMI_IO_ADDR_SPACE, base_addr)) { |
1852 | pci_dev_put(pci_dev); | 1852 | pci_dev_put(pci_dev); |
1853 | return -ENODEV; | 1853 | return -ENODEV; |
1854 | } | 1854 | } |
1855 | 1855 | ||
1856 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 1856 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
1857 | if (!info) { | 1857 | if (! info) { |
1858 | pci_dev_put(pci_dev); | 1858 | pci_dev_put(pci_dev); |
1859 | printk(KERN_ERR "ipmi_si: Could not allocate SI data (5)\n"); | 1859 | printk(KERN_ERR "ipmi_si: Could not allocate SI data (5)\n"); |
1860 | return -ENOMEM; | 1860 | return -ENOMEM; |
@@ -1865,7 +1865,7 @@ static int find_pci_smic(int intf_num, struct smi_info **new_info) | |||
1865 | ports[intf_num] = base_addr; | 1865 | ports[intf_num] = base_addr; |
1866 | info->io.info = &(ports[intf_num]); | 1866 | info->io.info = &(ports[intf_num]); |
1867 | info->io.regspacing = regspacings[intf_num]; | 1867 | info->io.regspacing = regspacings[intf_num]; |
1868 | if (!info->io.regspacing) | 1868 | if (! info->io.regspacing) |
1869 | info->io.regspacing = DEFAULT_REGSPACING; | 1869 | info->io.regspacing = DEFAULT_REGSPACING; |
1870 | info->io.regsize = DEFAULT_REGSPACING; | 1870 | info->io.regsize = DEFAULT_REGSPACING; |
1871 | info->io.regshift = regshifts[intf_num]; | 1871 | info->io.regshift = regshifts[intf_num]; |
@@ -1886,7 +1886,7 @@ static int find_pci_smic(int intf_num, struct smi_info **new_info) | |||
1886 | static int try_init_plug_and_play(int intf_num, struct smi_info **new_info) | 1886 | static int try_init_plug_and_play(int intf_num, struct smi_info **new_info) |
1887 | { | 1887 | { |
1888 | #ifdef CONFIG_PCI | 1888 | #ifdef CONFIG_PCI |
1889 | if (find_pci_smic(intf_num, new_info)==0) | 1889 | if (find_pci_smic(intf_num, new_info) == 0) |
1890 | return 0; | 1890 | return 0; |
1891 | #endif | 1891 | #endif |
1892 | /* Include other methods here. */ | 1892 | /* Include other methods here. */ |
@@ -1904,7 +1904,7 @@ static int try_get_dev_id(struct smi_info *smi_info) | |||
1904 | int rv = 0; | 1904 | int rv = 0; |
1905 | 1905 | ||
1906 | resp = kmalloc(IPMI_MAX_MSG_LENGTH, GFP_KERNEL); | 1906 | resp = kmalloc(IPMI_MAX_MSG_LENGTH, GFP_KERNEL); |
1907 | if (!resp) | 1907 | if (! resp) |
1908 | return -ENOMEM; | 1908 | return -ENOMEM; |
1909 | 1909 | ||
1910 | /* Do a Get Device ID command, since it comes back with some | 1910 | /* Do a Get Device ID command, since it comes back with some |
@@ -1986,7 +1986,7 @@ static int stat_file_read_proc(char *page, char **start, off_t off, | |||
1986 | struct smi_info *smi = data; | 1986 | struct smi_info *smi = data; |
1987 | 1987 | ||
1988 | out += sprintf(out, "interrupts_enabled: %d\n", | 1988 | out += sprintf(out, "interrupts_enabled: %d\n", |
1989 | smi->irq && !smi->interrupt_disabled); | 1989 | smi->irq && ! smi->interrupt_disabled); |
1990 | out += sprintf(out, "short_timeouts: %ld\n", | 1990 | out += sprintf(out, "short_timeouts: %ld\n", |
1991 | smi->short_timeouts); | 1991 | smi->short_timeouts); |
1992 | out += sprintf(out, "long_timeouts: %ld\n", | 1992 | out += sprintf(out, "long_timeouts: %ld\n", |
@@ -2024,8 +2024,8 @@ static int stat_file_read_proc(char *page, char **start, off_t off, | |||
2024 | */ | 2024 | */ |
2025 | static int oem_data_avail_to_receive_msg_avail(struct smi_info *smi_info) | 2025 | static int oem_data_avail_to_receive_msg_avail(struct smi_info *smi_info) |
2026 | { | 2026 | { |
2027 | smi_info->msg_flags = (smi_info->msg_flags & ~OEM_DATA_AVAIL) | | 2027 | smi_info->msg_flags = ((smi_info->msg_flags & ~OEM_DATA_AVAIL) | |
2028 | RECEIVE_MSG_AVAIL; | 2028 | RECEIVE_MSG_AVAIL); |
2029 | return 1; | 2029 | return 1; |
2030 | } | 2030 | } |
2031 | 2031 | ||
@@ -2059,10 +2059,11 @@ static void setup_dell_poweredge_oem_data_handler(struct smi_info *smi_info) | |||
2059 | { | 2059 | { |
2060 | struct ipmi_device_id *id = &smi_info->device_id; | 2060 | struct ipmi_device_id *id = &smi_info->device_id; |
2061 | const char mfr[3]=DELL_IANA_MFR_ID; | 2061 | const char mfr[3]=DELL_IANA_MFR_ID; |
2062 | if (!memcmp(mfr, id->manufacturer_id, sizeof(mfr)) && | 2062 | if (! memcmp(mfr, id->manufacturer_id, sizeof(mfr)) |
2063 | id->device_id == DELL_POWEREDGE_8G_BMC_DEVICE_ID && | 2063 | && (id->device_id == DELL_POWEREDGE_8G_BMC_DEVICE_ID) |
2064 | id->device_revision == DELL_POWEREDGE_8G_BMC_DEVICE_REV && | 2064 | && (id->device_revision == DELL_POWEREDGE_8G_BMC_DEVICE_REV) |
2065 | id->ipmi_version == DELL_POWEREDGE_8G_BMC_IPMI_VERSION) { | 2065 | && (id->ipmi_version == DELL_POWEREDGE_8G_BMC_IPMI_VERSION)) |
2066 | { | ||
2066 | smi_info->oem_data_avail_handler = | 2067 | smi_info->oem_data_avail_handler = |
2067 | oem_data_avail_to_receive_msg_avail; | 2068 | oem_data_avail_to_receive_msg_avail; |
2068 | } | 2069 | } |
@@ -2092,19 +2093,15 @@ static int init_one_smi(int intf_num, struct smi_info **smi) | |||
2092 | if (rv) | 2093 | if (rv) |
2093 | rv = try_init_port(intf_num, &new_smi); | 2094 | rv = try_init_port(intf_num, &new_smi); |
2094 | #ifdef CONFIG_ACPI_INTERPRETER | 2095 | #ifdef CONFIG_ACPI_INTERPRETER |
2095 | if ((rv) && (si_trydefaults)) { | 2096 | if (rv && si_trydefaults) |
2096 | rv = try_init_acpi(intf_num, &new_smi); | 2097 | rv = try_init_acpi(intf_num, &new_smi); |
2097 | } | ||
2098 | #endif | 2098 | #endif |
2099 | #ifdef CONFIG_X86 | 2099 | #ifdef CONFIG_X86 |
2100 | if ((rv) && (si_trydefaults)) { | 2100 | if (rv && si_trydefaults) |
2101 | rv = try_init_smbios(intf_num, &new_smi); | 2101 | rv = try_init_smbios(intf_num, &new_smi); |
2102 | } | ||
2103 | #endif | 2102 | #endif |
2104 | if ((rv) && (si_trydefaults)) { | 2103 | if (rv && si_trydefaults) |
2105 | rv = try_init_plug_and_play(intf_num, &new_smi); | 2104 | rv = try_init_plug_and_play(intf_num, &new_smi); |
2106 | } | ||
2107 | |||
2108 | 2105 | ||
2109 | if (rv) | 2106 | if (rv) |
2110 | return rv; | 2107 | return rv; |
@@ -2114,7 +2111,7 @@ static int init_one_smi(int intf_num, struct smi_info **smi) | |||
2114 | new_smi->si_sm = NULL; | 2111 | new_smi->si_sm = NULL; |
2115 | new_smi->handlers = NULL; | 2112 | new_smi->handlers = NULL; |
2116 | 2113 | ||
2117 | if (!new_smi->irq_setup) { | 2114 | if (! new_smi->irq_setup) { |
2118 | new_smi->irq = irqs[intf_num]; | 2115 | new_smi->irq = irqs[intf_num]; |
2119 | new_smi->irq_setup = std_irq_setup; | 2116 | new_smi->irq_setup = std_irq_setup; |
2120 | new_smi->irq_cleanup = std_irq_cleanup; | 2117 | new_smi->irq_cleanup = std_irq_cleanup; |
@@ -2148,7 +2145,7 @@ static int init_one_smi(int intf_num, struct smi_info **smi) | |||
2148 | 2145 | ||
2149 | /* Allocate the state machine's data and initialize it. */ | 2146 | /* Allocate the state machine's data and initialize it. */ |
2150 | new_smi->si_sm = kmalloc(new_smi->handlers->size(), GFP_KERNEL); | 2147 | new_smi->si_sm = kmalloc(new_smi->handlers->size(), GFP_KERNEL); |
2151 | if (!new_smi->si_sm) { | 2148 | if (! new_smi->si_sm) { |
2152 | printk(" Could not allocate state machine memory\n"); | 2149 | printk(" Could not allocate state machine memory\n"); |
2153 | rv = -ENOMEM; | 2150 | rv = -ENOMEM; |
2154 | goto out_err; | 2151 | goto out_err; |
@@ -2256,7 +2253,7 @@ static int init_one_smi(int intf_num, struct smi_info **smi) | |||
2256 | 2253 | ||
2257 | /* Wait for the timer to stop. This avoids problems with race | 2254 | /* Wait for the timer to stop. This avoids problems with race |
2258 | conditions removing the timer here. */ | 2255 | conditions removing the timer here. */ |
2259 | while (!new_smi->timer_stopped) { | 2256 | while (! new_smi->timer_stopped) { |
2260 | set_current_state(TASK_UNINTERRUPTIBLE); | 2257 | set_current_state(TASK_UNINTERRUPTIBLE); |
2261 | schedule_timeout(1); | 2258 | schedule_timeout(1); |
2262 | } | 2259 | } |
@@ -2296,7 +2293,7 @@ static __init int init_ipmi_si(void) | |||
2296 | /* Parse out the si_type string into its components. */ | 2293 | /* Parse out the si_type string into its components. */ |
2297 | str = si_type_str; | 2294 | str = si_type_str; |
2298 | if (*str != '\0') { | 2295 | if (*str != '\0') { |
2299 | for (i=0; (i<SI_MAX_PARMS) && (*str != '\0'); i++) { | 2296 | for (i = 0; (i < SI_MAX_PARMS) && (*str != '\0'); i++) { |
2300 | si_type[i] = str; | 2297 | si_type[i] = str; |
2301 | str = strchr(str, ','); | 2298 | str = strchr(str, ','); |
2302 | if (str) { | 2299 | if (str) { |
@@ -2315,7 +2312,7 @@ static __init int init_ipmi_si(void) | |||
2315 | #endif | 2312 | #endif |
2316 | 2313 | ||
2317 | rv = init_one_smi(0, &(smi_infos[pos])); | 2314 | rv = init_one_smi(0, &(smi_infos[pos])); |
2318 | if (rv && !ports[0] && si_trydefaults) { | 2315 | if (rv && ! ports[0] && si_trydefaults) { |
2319 | /* If we are trying defaults and the initial port is | 2316 | /* If we are trying defaults and the initial port is |
2320 | not set, then set it. */ | 2317 | not set, then set it. */ |
2321 | si_type[0] = "kcs"; | 2318 | si_type[0] = "kcs"; |
@@ -2337,7 +2334,7 @@ static __init int init_ipmi_si(void) | |||
2337 | if (rv == 0) | 2334 | if (rv == 0) |
2338 | pos++; | 2335 | pos++; |
2339 | 2336 | ||
2340 | for (i=1; i < SI_MAX_PARMS; i++) { | 2337 | for (i = 1; i < SI_MAX_PARMS; i++) { |
2341 | rv = init_one_smi(i, &(smi_infos[pos])); | 2338 | rv = init_one_smi(i, &(smi_infos[pos])); |
2342 | if (rv == 0) | 2339 | if (rv == 0) |
2343 | pos++; | 2340 | pos++; |
@@ -2379,14 +2376,14 @@ static void __exit cleanup_one_si(struct smi_info *to_clean) | |||
2379 | 2376 | ||
2380 | /* Wait for the timer to stop. This avoids problems with race | 2377 | /* Wait for the timer to stop. This avoids problems with race |
2381 | conditions removing the timer here. */ | 2378 | conditions removing the timer here. */ |
2382 | while (!to_clean->timer_stopped) { | 2379 | while (! to_clean->timer_stopped) { |
2383 | set_current_state(TASK_UNINTERRUPTIBLE); | 2380 | set_current_state(TASK_UNINTERRUPTIBLE); |
2384 | schedule_timeout(1); | 2381 | schedule_timeout(1); |
2385 | } | 2382 | } |
2386 | 2383 | ||
2387 | /* Interrupts and timeouts are stopped, now make sure the | 2384 | /* Interrupts and timeouts are stopped, now make sure the |
2388 | interface is in a clean state. */ | 2385 | interface is in a clean state. */ |
2389 | while ((to_clean->curr_msg) || (to_clean->si_state != SI_NORMAL)) { | 2386 | while (to_clean->curr_msg || (to_clean->si_state != SI_NORMAL)) { |
2390 | poll(to_clean); | 2387 | poll(to_clean); |
2391 | set_current_state(TASK_UNINTERRUPTIBLE); | 2388 | set_current_state(TASK_UNINTERRUPTIBLE); |
2392 | schedule_timeout(1); | 2389 | schedule_timeout(1); |
@@ -2410,10 +2407,10 @@ static __exit void cleanup_ipmi_si(void) | |||
2410 | { | 2407 | { |
2411 | int i; | 2408 | int i; |
2412 | 2409 | ||
2413 | if (!initialized) | 2410 | if (! initialized) |
2414 | return; | 2411 | return; |
2415 | 2412 | ||
2416 | for (i=0; i<SI_MAX_DRIVERS; i++) { | 2413 | for (i = 0; i < SI_MAX_DRIVERS; i++) { |
2417 | cleanup_one_si(smi_infos[i]); | 2414 | cleanup_one_si(smi_infos[i]); |
2418 | } | 2415 | } |
2419 | } | 2416 | } |
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c index 77ece1f218cd..e71aaae855ad 100644 --- a/drivers/char/ipmi/ipmi_watchdog.c +++ b/drivers/char/ipmi/ipmi_watchdog.c | |||
@@ -657,19 +657,18 @@ static ssize_t ipmi_read(struct file *file, | |||
657 | 657 | ||
658 | static int ipmi_open(struct inode *ino, struct file *filep) | 658 | static int ipmi_open(struct inode *ino, struct file *filep) |
659 | { | 659 | { |
660 | switch (iminor(ino)) | 660 | switch (iminor(ino)) { |
661 | { | 661 | case WATCHDOG_MINOR: |
662 | case WATCHDOG_MINOR: | 662 | if (test_and_set_bit(0, &ipmi_wdog_open)) |
663 | if(test_and_set_bit(0, &ipmi_wdog_open)) | ||
664 | return -EBUSY; | 663 | return -EBUSY; |
665 | 664 | ||
666 | /* Don't start the timer now, let it start on the | 665 | /* Don't start the timer now, let it start on the |
667 | first heartbeat. */ | 666 | first heartbeat. */ |
668 | ipmi_start_timer_on_heartbeat = 1; | 667 | ipmi_start_timer_on_heartbeat = 1; |
669 | return nonseekable_open(ino, filep); | 668 | return nonseekable_open(ino, filep); |
670 | 669 | ||
671 | default: | 670 | default: |
672 | return (-ENODEV); | 671 | return (-ENODEV); |
673 | } | 672 | } |
674 | } | 673 | } |
675 | 674 | ||