Commit e8b33617 authored by Corey Minyard's avatar Corey Minyard Committed by Linus Torvalds

[PATCH] ipmi: style cleanups

Clean up various style issues in the IPMI driver.  Should be no functional
changes.
Signed-off-by: default avatarCorey Minyard <minyard@acm.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 168524d6
...@@ -161,7 +161,8 @@ static int bt_start_transaction(struct si_sm_data *bt, ...@@ -161,7 +161,8 @@ static int bt_start_transaction(struct si_sm_data *bt,
{ {
unsigned int i; unsigned int i;
if ((size < 2) || (size > IPMI_MAX_MSG_LENGTH)) return -1; if ((size < 2) || (size > IPMI_MAX_MSG_LENGTH))
return -1;
if ((bt->state != BT_STATE_IDLE) && (bt->state != BT_STATE_HOSED)) if ((bt->state != BT_STATE_IDLE) && (bt->state != BT_STATE_HOSED))
return -2; return -2;
...@@ -169,7 +170,8 @@ static int bt_start_transaction(struct si_sm_data *bt, ...@@ -169,7 +170,8 @@ static int bt_start_transaction(struct si_sm_data *bt,
if (bt_debug & BT_DEBUG_MSG) { if (bt_debug & BT_DEBUG_MSG) {
printk(KERN_WARNING "+++++++++++++++++++++++++++++++++++++\n"); printk(KERN_WARNING "+++++++++++++++++++++++++++++++++++++\n");
printk(KERN_WARNING "BT: write seq=0x%02X:", bt->seq); printk(KERN_WARNING "BT: write seq=0x%02X:", bt->seq);
for (i = 0; i < size; i ++) printk (" %02x", data[i]); for (i = 0; i < size; i ++)
printk (" %02x", data[i]);
printk("\n"); printk("\n");
} }
bt->write_data[0] = size + 1; /* all data plus seq byte */ 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,15 +210,18 @@ static int bt_get_result(struct si_sm_data *bt,
} else { } else {
data[0] = bt->read_data[1]; data[0] = bt->read_data[1];
data[1] = bt->read_data[3]; data[1] = bt->read_data[3];
if (length < msg_len) bt->truncated = 1; if (length < msg_len)
bt->truncated = 1;
if (bt->truncated) { /* can be set in read_all_bytes() */ if (bt->truncated) { /* can be set in read_all_bytes() */
data[2] = IPMI_ERR_MSG_TRUNCATED; data[2] = IPMI_ERR_MSG_TRUNCATED;
msg_len = 3; msg_len = 3;
} else memcpy(data + 2, bt->read_data + 4, msg_len - 2); } else
memcpy(data + 2, bt->read_data + 4, msg_len - 2);
if (bt_debug & BT_DEBUG_MSG) { if (bt_debug & BT_DEBUG_MSG) {
printk (KERN_WARNING "BT: res (raw)"); printk (KERN_WARNING "BT: res (raw)");
for (i = 0; i < msg_len; i++) printk(" %02x", data[i]); for (i = 0; i < msg_len; i++)
printk(" %02x", data[i]);
printk ("\n"); printk ("\n");
} }
} }
...@@ -229,8 +234,10 @@ static int bt_get_result(struct si_sm_data *bt, ...@@ -229,8 +234,10 @@ static int bt_get_result(struct si_sm_data *bt,
static void reset_flags(struct si_sm_data *bt) static void reset_flags(struct si_sm_data *bt)
{ {
if (BT_STATUS & BT_H_BUSY) BT_CONTROL(BT_H_BUSY); if (BT_STATUS & BT_H_BUSY)
if (BT_STATUS & BT_B_BUSY) BT_CONTROL(BT_B_BUSY); BT_CONTROL(BT_H_BUSY);
if (BT_STATUS & BT_B_BUSY)
BT_CONTROL(BT_B_BUSY);
BT_CONTROL(BT_CLR_WR_PTR); BT_CONTROL(BT_CLR_WR_PTR);
BT_CONTROL(BT_SMS_ATN); BT_CONTROL(BT_SMS_ATN);
#ifdef DEVELOPMENT_ONLY_NOT_FOR_PRODUCTION #ifdef DEVELOPMENT_ONLY_NOT_FOR_PRODUCTION
...@@ -239,7 +246,8 @@ static void reset_flags(struct si_sm_data *bt) ...@@ -239,7 +246,8 @@ static void reset_flags(struct si_sm_data *bt)
BT_CONTROL(BT_H_BUSY); BT_CONTROL(BT_H_BUSY);
BT_CONTROL(BT_B2H_ATN); BT_CONTROL(BT_B2H_ATN);
BT_CONTROL(BT_CLR_RD_PTR); BT_CONTROL(BT_CLR_RD_PTR);
for (i = 0; i < IPMI_MAX_MSG_LENGTH + 2; i++) BMC2HOST; for (i = 0; i < IPMI_MAX_MSG_LENGTH + 2; i++)
BMC2HOST;
BT_CONTROL(BT_H_BUSY); BT_CONTROL(BT_H_BUSY);
} }
#endif #endif
...@@ -256,7 +264,8 @@ static inline void write_all_bytes(struct si_sm_data *bt) ...@@ -256,7 +264,8 @@ static inline void write_all_bytes(struct si_sm_data *bt)
printk (" %02x", bt->write_data[i]); printk (" %02x", bt->write_data[i]);
printk ("\n"); printk ("\n");
} }
for (i = 0; i < bt->write_count; i++) HOST2BMC(bt->write_data[i]); for (i = 0; i < bt->write_count; i++)
HOST2BMC(bt->write_data[i]);
} }
static inline int read_all_bytes(struct si_sm_data *bt) 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,7 +285,8 @@ static inline int read_all_bytes(struct si_sm_data *bt)
bt->truncated = 1; bt->truncated = 1;
return 1; /* let next XACTION START clean it up */ return 1; /* let next XACTION START clean it up */
} }
for (i = 1; i <= bt->read_count; i++) bt->read_data[i] = BMC2HOST; for (i = 1; i <= bt->read_count; i++)
bt->read_data[i] = BMC2HOST;
bt->read_count++; /* account for the length byte */ bt->read_count++; /* account for the length byte */
if (bt_debug & BT_DEBUG_MSG) { if (bt_debug & BT_DEBUG_MSG) {
...@@ -293,7 +303,8 @@ static inline int read_all_bytes(struct si_sm_data *bt) ...@@ -293,7 +303,8 @@ static inline int read_all_bytes(struct si_sm_data *bt)
((bt->read_data[1] & 0xF8) == (bt->write_data[1] & 0xF8))) ((bt->read_data[1] & 0xF8) == (bt->write_data[1] & 0xF8)))
return 1; return 1;
if (bt_debug & BT_DEBUG_MSG) printk(KERN_WARNING "BT: bad packet: " if (bt_debug & BT_DEBUG_MSG)
printk(KERN_WARNING "BT: bad packet: "
"want 0x(%02X, %02X, %02X) got (%02X, %02X, %02X)\n", "want 0x(%02X, %02X, %02X) got (%02X, %02X, %02X)\n",
bt->write_data[1], bt->write_data[2], bt->write_data[3], bt->write_data[1], bt->write_data[2], bt->write_data[3],
bt->read_data[1], bt->read_data[2], bt->read_data[3]); 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,7 +368,8 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time)
time); time);
bt->last_state = bt->state; bt->last_state = bt->state;
if (bt->state == BT_STATE_HOSED) return SI_SM_HOSED; if (bt->state == BT_STATE_HOSED)
return SI_SM_HOSED;
if (bt->state != BT_STATE_IDLE) { /* do timeout test */ if (bt->state != BT_STATE_IDLE) { /* do timeout test */
...@@ -369,7 +381,8 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time) ...@@ -369,7 +381,8 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time)
/* FIXME: bt_event is sometimes called with time > BT_NORMAL_TIMEOUT /* FIXME: bt_event is sometimes called with time > BT_NORMAL_TIMEOUT
(noticed in ipmi_smic_sm.c January 2004) */ (noticed in ipmi_smic_sm.c January 2004) */
if ((time <= 0) || (time >= BT_NORMAL_TIMEOUT)) time = 100; if ((time <= 0) || (time >= BT_NORMAL_TIMEOUT))
time = 100;
bt->timeout -= time; bt->timeout -= time;
if ((bt->timeout < 0) && (bt->state < BT_STATE_RESET1)) { if ((bt->timeout < 0) && (bt->state < BT_STATE_RESET1)) {
error_recovery(bt, "timed out"); error_recovery(bt, "timed out");
...@@ -391,12 +404,14 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time) ...@@ -391,12 +404,14 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time)
BT_CONTROL(BT_H_BUSY); BT_CONTROL(BT_H_BUSY);
break; break;
} }
if (status & BT_B2H_ATN) break; if (status & BT_B2H_ATN)
break;
bt->state = BT_STATE_WRITE_BYTES; bt->state = BT_STATE_WRITE_BYTES;
return SI_SM_CALL_WITHOUT_DELAY; /* for logging */ return SI_SM_CALL_WITHOUT_DELAY; /* for logging */
case BT_STATE_WRITE_BYTES: case BT_STATE_WRITE_BYTES:
if (status & (BT_B_BUSY | BT_H2B_ATN)) break; if (status & (BT_B_BUSY | BT_H2B_ATN))
break;
BT_CONTROL(BT_CLR_WR_PTR); BT_CONTROL(BT_CLR_WR_PTR);
write_all_bytes(bt); write_all_bytes(bt);
BT_CONTROL(BT_H2B_ATN); /* clears too fast to catch? */ 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,7 +419,8 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time)
return SI_SM_CALL_WITHOUT_DELAY; /* it MIGHT sail through */ return SI_SM_CALL_WITHOUT_DELAY; /* it MIGHT sail through */
case BT_STATE_WRITE_CONSUME: /* BMCs usually blow right thru here */ case BT_STATE_WRITE_CONSUME: /* BMCs usually blow right thru here */
if (status & (BT_H2B_ATN | BT_B_BUSY)) break; if (status & (BT_H2B_ATN | BT_B_BUSY))
break;
bt->state = BT_STATE_B2H_WAIT; bt->state = BT_STATE_B2H_WAIT;
/* fall through with status */ /* fall through with status */
...@@ -413,15 +429,18 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time) ...@@ -413,15 +429,18 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time)
generation of B2H_ATN so ALWAYS return CALL_WITH_DELAY. */ generation of B2H_ATN so ALWAYS return CALL_WITH_DELAY. */
case BT_STATE_B2H_WAIT: case BT_STATE_B2H_WAIT:
if (!(status & BT_B2H_ATN)) break; if (!(status & BT_B2H_ATN))
break;
/* Assume ordered, uncached writes: no need to wait */ /* Assume ordered, uncached writes: no need to wait */
if (!(status & BT_H_BUSY)) BT_CONTROL(BT_H_BUSY); /* set */ if (!(status & BT_H_BUSY))
BT_CONTROL(BT_H_BUSY); /* set */
BT_CONTROL(BT_B2H_ATN); /* clear it, ACK to the BMC */ BT_CONTROL(BT_B2H_ATN); /* clear it, ACK to the BMC */
BT_CONTROL(BT_CLR_RD_PTR); /* reset the queue */ BT_CONTROL(BT_CLR_RD_PTR); /* reset the queue */
i = read_all_bytes(bt); i = read_all_bytes(bt);
BT_CONTROL(BT_H_BUSY); /* clear */ BT_CONTROL(BT_H_BUSY); /* clear */
if (!i) break; /* Try this state again */ if (!i) /* Try this state again */
break;
bt->state = BT_STATE_READ_END; bt->state = BT_STATE_READ_END;
return SI_SM_CALL_WITHOUT_DELAY; /* for logging */ return SI_SM_CALL_WITHOUT_DELAY; /* for logging */
...@@ -434,7 +453,8 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time) ...@@ -434,7 +453,8 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time)
#ifdef MAKE_THIS_TRUE_IF_NECESSARY #ifdef MAKE_THIS_TRUE_IF_NECESSARY
if (status & BT_H_BUSY) break; if (status & BT_H_BUSY)
break;
#endif #endif
bt->seq++; bt->seq++;
bt->state = BT_STATE_IDLE; bt->state = BT_STATE_IDLE;
...@@ -457,7 +477,8 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time) ...@@ -457,7 +477,8 @@ static enum si_sm_result bt_event(struct si_sm_data *bt, long time)
break; break;
case BT_STATE_RESET3: case BT_STATE_RESET3:
if (bt->timeout > 0) return SI_SM_CALL_WITH_DELAY; if (bt->timeout > 0)
return SI_SM_CALL_WITH_DELAY;
bt->state = BT_STATE_RESTART; /* printk in debug modes */ bt->state = BT_STATE_RESTART; /* printk in debug modes */
break; break;
...@@ -483,7 +504,8 @@ static int bt_detect(struct si_sm_data *bt) ...@@ -483,7 +504,8 @@ static int bt_detect(struct si_sm_data *bt)
but that's what you get from reading a bogus address, so we but that's what you get from reading a bogus address, so we
test that first. The calling routine uses negative logic. */ test that first. The calling routine uses negative logic. */
if ((BT_STATUS == 0xFF) && (BT_INTMASK_R == 0xFF)) return 1; if ((BT_STATUS == 0xFF) && (BT_INTMASK_R == 0xFF))
return 1;
reset_flags(bt); reset_flags(bt);
return 0; return 0;
} }
......
...@@ -117,7 +117,7 @@ struct seq_table ...@@ -117,7 +117,7 @@ struct seq_table
do { \ do { \
seq = ((msgid >> 26) & 0x3f); \ seq = ((msgid >> 26) & 0x3f); \
seqid = (msgid & 0x3fffff); \ seqid = (msgid & 0x3fffff); \
} while(0) } while (0)
#define NEXT_SEQID(seqid) (((seqid) + 1) & 0x3fffff) #define NEXT_SEQID(seqid) (((seqid) + 1) & 0x3fffff)
...@@ -326,7 +326,7 @@ int ipmi_smi_watcher_register(struct ipmi_smi_watcher *watcher) ...@@ -326,7 +326,7 @@ int ipmi_smi_watcher_register(struct ipmi_smi_watcher *watcher)
down_read(&interfaces_sem); down_read(&interfaces_sem);
down_write(&smi_watchers_sem); down_write(&smi_watchers_sem);
list_add(&(watcher->link), &smi_watchers); list_add(&(watcher->link), &smi_watchers);
for (i=0; i<MAX_IPMI_INTERFACES; i++) { for (i = 0; i < MAX_IPMI_INTERFACES; i++) {
if (ipmi_interfaces[i] != NULL) { if (ipmi_interfaces[i] != NULL) {
watcher->new_smi(i); watcher->new_smi(i);
} }
...@@ -496,9 +496,9 @@ static int intf_next_seq(ipmi_smi_t intf, ...@@ -496,9 +496,9 @@ static int intf_next_seq(ipmi_smi_t intf,
int rv = 0; int rv = 0;
unsigned int i; unsigned int i;
for (i=intf->curr_seq; for (i = intf->curr_seq;
(i+1)%IPMI_IPMB_NUM_SEQ != intf->curr_seq; (i+1)%IPMI_IPMB_NUM_SEQ != intf->curr_seq;
i=(i+1)%IPMI_IPMB_NUM_SEQ) i = (i+1)%IPMI_IPMB_NUM_SEQ)
{ {
if (! intf->seq_table[i].inuse) if (! intf->seq_table[i].inuse)
break; break;
...@@ -733,7 +733,7 @@ static int ipmi_destroy_user_nolock(ipmi_user_t user) ...@@ -733,7 +733,7 @@ static int ipmi_destroy_user_nolock(ipmi_user_t user)
/* Remove the user from the interfaces sequence table. */ /* Remove the user from the interfaces sequence table. */
spin_lock_irqsave(&(user->intf->seq_lock), flags); spin_lock_irqsave(&(user->intf->seq_lock), flags);
for (i=0; i<IPMI_IPMB_NUM_SEQ; i++) { for (i = 0; i < IPMI_IPMB_NUM_SEQ; i++) {
if (user->intf->seq_table[i].inuse if (user->intf->seq_table[i].inuse
&& (user->intf->seq_table[i].recv_msg->user == user)) && (user->intf->seq_table[i].recv_msg->user == user))
{ {
...@@ -1370,7 +1370,7 @@ static inline int i_ipmi_request(ipmi_user_t user, ...@@ -1370,7 +1370,7 @@ static inline int i_ipmi_request(ipmi_user_t user,
#ifdef DEBUG_MSGING #ifdef DEBUG_MSGING
{ {
int m; int m;
for (m=0; m<smi_msg->data_size; m++) for (m = 0; m < smi_msg->data_size; m++)
printk(" %2.2x", smi_msg->data[m]); printk(" %2.2x", smi_msg->data[m]);
printk("\n"); printk("\n");
} }
...@@ -1467,7 +1467,7 @@ static int ipmb_file_read_proc(char *page, char **start, off_t off, ...@@ -1467,7 +1467,7 @@ static int ipmb_file_read_proc(char *page, char **start, off_t off,
int i; int i;
int rv= 0; int rv= 0;
for (i=0; i<IPMI_MAX_CHANNELS; i++) for (i = 0; i < IPMI_MAX_CHANNELS; i++)
rv += sprintf(out+rv, "%x ", intf->channels[i].address); rv += sprintf(out+rv, "%x ", intf->channels[i].address);
out[rv-1] = '\n'; /* Replace the final space with a newline */ out[rv-1] = '\n'; /* Replace the final space with a newline */
out[rv] = '\0'; out[rv] = '\0';
...@@ -1766,12 +1766,12 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers, ...@@ -1766,12 +1766,12 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
rv = -ENOMEM; rv = -ENOMEM;
down_write(&interfaces_sem); down_write(&interfaces_sem);
for (i=0; i<MAX_IPMI_INTERFACES; i++) { for (i = 0; i < MAX_IPMI_INTERFACES; i++) {
if (ipmi_interfaces[i] == NULL) { if (ipmi_interfaces[i] == NULL) {
new_intf->intf_num = i; new_intf->intf_num = i;
new_intf->version_major = version_major; new_intf->version_major = version_major;
new_intf->version_minor = version_minor; new_intf->version_minor = version_minor;
for (j=0; j<IPMI_MAX_CHANNELS; j++) { for (j = 0; j < IPMI_MAX_CHANNELS; j++) {
new_intf->channels[j].address new_intf->channels[j].address
= IPMI_BMC_SLAVE_ADDR; = IPMI_BMC_SLAVE_ADDR;
new_intf->channels[j].lun = 2; new_intf->channels[j].lun = 2;
...@@ -1783,7 +1783,7 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers, ...@@ -1783,7 +1783,7 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
new_intf->handlers = handlers; new_intf->handlers = handlers;
new_intf->send_info = send_info; new_intf->send_info = send_info;
spin_lock_init(&(new_intf->seq_lock)); spin_lock_init(&(new_intf->seq_lock));
for (j=0; j<IPMI_IPMB_NUM_SEQ; j++) { for (j = 0; j < IPMI_IPMB_NUM_SEQ; j++) {
new_intf->seq_table[j].inuse = 0; new_intf->seq_table[j].inuse = 0;
new_intf->seq_table[j].seqid = 0; new_intf->seq_table[j].seqid = 0;
} }
...@@ -1891,7 +1891,7 @@ static void clean_up_interface_data(ipmi_smi_t intf) ...@@ -1891,7 +1891,7 @@ static void clean_up_interface_data(ipmi_smi_t intf)
free_recv_msg_list(&(intf->waiting_events)); free_recv_msg_list(&(intf->waiting_events));
free_cmd_rcvr_list(&(intf->cmd_rcvrs)); free_cmd_rcvr_list(&(intf->cmd_rcvrs));
for (i=0; i<IPMI_IPMB_NUM_SEQ; i++) { for (i = 0; i < IPMI_IPMB_NUM_SEQ; i++) {
if ((intf->seq_table[i].inuse) if ((intf->seq_table[i].inuse)
&& (intf->seq_table[i].recv_msg)) && (intf->seq_table[i].recv_msg))
{ {
...@@ -1910,7 +1910,7 @@ int ipmi_unregister_smi(ipmi_smi_t intf) ...@@ -1910,7 +1910,7 @@ int ipmi_unregister_smi(ipmi_smi_t intf)
down_write(&interfaces_sem); down_write(&interfaces_sem);
if (list_empty(&(intf->users))) if (list_empty(&(intf->users)))
{ {
for (i=0; i<MAX_IPMI_INTERFACES; i++) { for (i = 0; i < MAX_IPMI_INTERFACES; i++) {
if (ipmi_interfaces[i] == intf) { if (ipmi_interfaces[i] == intf) {
remove_proc_entries(intf); remove_proc_entries(intf);
spin_lock_irqsave(&interfaces_lock, flags); spin_lock_irqsave(&interfaces_lock, flags);
...@@ -2074,7 +2074,7 @@ static int handle_ipmb_get_msg_cmd(ipmi_smi_t intf, ...@@ -2074,7 +2074,7 @@ static int handle_ipmb_get_msg_cmd(ipmi_smi_t intf,
{ {
int m; int m;
printk("Invalid command:"); printk("Invalid command:");
for (m=0; m<msg->data_size; m++) for (m = 0; m < msg->data_size; m++)
printk(" %2.2x", msg->data[m]); printk(" %2.2x", msg->data[m]);
printk("\n"); printk("\n");
} }
...@@ -2469,7 +2469,7 @@ static int handle_new_recv_msg(ipmi_smi_t intf, ...@@ -2469,7 +2469,7 @@ static int handle_new_recv_msg(ipmi_smi_t intf,
#ifdef DEBUG_MSGING #ifdef DEBUG_MSGING
int m; int m;
printk("Recv:"); printk("Recv:");
for (m=0; m<msg->rsp_size; m++) for (m = 0; m < msg->rsp_size; m++)
printk(" %2.2x", msg->rsp[m]); printk(" %2.2x", msg->rsp[m]);
printk("\n"); printk("\n");
#endif #endif
...@@ -2703,7 +2703,7 @@ smi_from_recv_msg(ipmi_smi_t intf, struct ipmi_recv_msg *recv_msg, ...@@ -2703,7 +2703,7 @@ smi_from_recv_msg(ipmi_smi_t intf, struct ipmi_recv_msg *recv_msg,
{ {
int m; int m;
printk("Resend: "); printk("Resend: ");
for (m=0; m<smi_msg->data_size; m++) for (m = 0; m < smi_msg->data_size; m++)
printk(" %2.2x", smi_msg->data[m]); printk(" %2.2x", smi_msg->data[m]);
printk("\n"); printk("\n");
} }
...@@ -2724,7 +2724,7 @@ ipmi_timeout_handler(long timeout_period) ...@@ -2724,7 +2724,7 @@ ipmi_timeout_handler(long timeout_period)
INIT_LIST_HEAD(&timeouts); INIT_LIST_HEAD(&timeouts);
spin_lock(&interfaces_lock); spin_lock(&interfaces_lock);
for (i=0; i<MAX_IPMI_INTERFACES; i++) { for (i = 0; i < MAX_IPMI_INTERFACES; i++) {
intf = ipmi_interfaces[i]; intf = ipmi_interfaces[i];
if (intf == NULL) if (intf == NULL)
continue; continue;
...@@ -2749,7 +2749,7 @@ ipmi_timeout_handler(long timeout_period) ...@@ -2749,7 +2749,7 @@ ipmi_timeout_handler(long timeout_period)
have timed out, putting them in the timeouts have timed out, putting them in the timeouts
list. */ list. */
spin_lock_irqsave(&(intf->seq_lock), flags); spin_lock_irqsave(&(intf->seq_lock), flags);
for (j=0; j<IPMI_IPMB_NUM_SEQ; j++) { for (j = 0; j < IPMI_IPMB_NUM_SEQ; j++) {
struct seq_table *ent = &(intf->seq_table[j]); struct seq_table *ent = &(intf->seq_table[j]);
if (!ent->inuse) if (!ent->inuse)
continue; continue;
...@@ -2789,7 +2789,7 @@ ipmi_timeout_handler(long timeout_period) ...@@ -2789,7 +2789,7 @@ ipmi_timeout_handler(long timeout_period)
spin_unlock(&intf->counter_lock); spin_unlock(&intf->counter_lock);
smi_msg = smi_from_recv_msg(intf, smi_msg = smi_from_recv_msg(intf,
ent->recv_msg, j, ent->seqid); ent->recv_msg, j, ent->seqid);
if(!smi_msg) if (! smi_msg)
continue; continue;
spin_unlock_irqrestore(&(intf->seq_lock),flags); spin_unlock_irqrestore(&(intf->seq_lock),flags);
...@@ -2820,7 +2820,7 @@ static void ipmi_request_event(void) ...@@ -2820,7 +2820,7 @@ static void ipmi_request_event(void)
int i; int i;
spin_lock(&interfaces_lock); spin_lock(&interfaces_lock);
for (i=0; i<MAX_IPMI_INTERFACES; i++) { for (i = 0; i < MAX_IPMI_INTERFACES; i++) {
intf = ipmi_interfaces[i]; intf = ipmi_interfaces[i];
if (intf == NULL) if (intf == NULL)
continue; continue;
...@@ -2982,7 +2982,7 @@ static void send_panic_events(char *str) ...@@ -2982,7 +2982,7 @@ static void send_panic_events(char *str)
recv_msg.done = dummy_recv_done_handler; recv_msg.done = dummy_recv_done_handler;
/* For every registered interface, send the event. */ /* For every registered interface, send the event. */
for (i=0; i<MAX_IPMI_INTERFACES; i++) { for (i = 0; i < MAX_IPMI_INTERFACES; i++) {
intf = ipmi_interfaces[i]; intf = ipmi_interfaces[i];
if (intf == NULL) if (intf == NULL)
continue; continue;
...@@ -3009,7 +3009,7 @@ static void send_panic_events(char *str) ...@@ -3009,7 +3009,7 @@ static void send_panic_events(char *str)
if (!str) if (!str)
return; return;
for (i=0; i<MAX_IPMI_INTERFACES; i++) { for (i = 0; i < MAX_IPMI_INTERFACES; i++) {
char *p = str; char *p = str;
struct ipmi_ipmb_addr *ipmb; struct ipmi_ipmb_addr *ipmb;
int j; int j;
...@@ -3149,7 +3149,7 @@ static int panic_event(struct notifier_block *this, ...@@ -3149,7 +3149,7 @@ static int panic_event(struct notifier_block *this,
has_paniced = 1; has_paniced = 1;
/* For every registered interface, set it to run to completion. */ /* For every registered interface, set it to run to completion. */
for (i=0; i<MAX_IPMI_INTERFACES; i++) { for (i = 0; i < MAX_IPMI_INTERFACES; i++) {
intf = ipmi_interfaces[i]; intf = ipmi_interfaces[i];
if (intf == NULL) if (intf == NULL)
continue; continue;
...@@ -3180,7 +3180,7 @@ static int ipmi_init_msghandler(void) ...@@ -3180,7 +3180,7 @@ static int ipmi_init_msghandler(void)
printk(KERN_INFO "ipmi message handler version " printk(KERN_INFO "ipmi message handler version "
IPMI_DRIVER_VERSION "\n"); IPMI_DRIVER_VERSION "\n");
for (i=0; i<MAX_IPMI_INTERFACES; i++) { for (i = 0; i < MAX_IPMI_INTERFACES; i++) {
ipmi_interfaces[i] = NULL; ipmi_interfaces[i] = NULL;
} }
......
...@@ -525,7 +525,7 @@ static void ipmi_po_new_smi(int if_num) ...@@ -525,7 +525,7 @@ static void ipmi_po_new_smi(int if_num)
/* Scan for a poweroff method */ /* Scan for a poweroff method */
for (i=0; i<NUM_PO_FUNCS; i++) { for (i = 0; i < NUM_PO_FUNCS; i++) {
if (poweroff_functions[i].detect(ipmi_user)) if (poweroff_functions[i].detect(ipmi_user))
goto found; goto found;
} }
......
This diff is collapsed.
...@@ -657,19 +657,18 @@ static ssize_t ipmi_read(struct file *file, ...@@ -657,19 +657,18 @@ static ssize_t ipmi_read(struct file *file,
static int ipmi_open(struct inode *ino, struct file *filep) static int ipmi_open(struct inode *ino, struct file *filep)
{ {
switch (iminor(ino)) switch (iminor(ino)) {
{ case WATCHDOG_MINOR:
case WATCHDOG_MINOR: if (test_and_set_bit(0, &ipmi_wdog_open))
if(test_and_set_bit(0, &ipmi_wdog_open))
return -EBUSY; return -EBUSY;
/* Don't start the timer now, let it start on the /* Don't start the timer now, let it start on the
first heartbeat. */ first heartbeat. */
ipmi_start_timer_on_heartbeat = 1; ipmi_start_timer_on_heartbeat = 1;
return nonseekable_open(ino, filep); return nonseekable_open(ino, filep);
default: default:
return (-ENODEV); return (-ENODEV);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment