1
0
Fork 0

[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>
hifive-unleashed-5.1
Corey Minyard 2005-09-06 15:18:45 -07:00 committed by Linus Torvalds
parent 168524d673
commit e8b336173b
5 changed files with 146 additions and 128 deletions

View File

@ -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,
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,
} 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,
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)
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)
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)
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)
((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)
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)
/* 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)
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)
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)
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)
#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)
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)
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;
} }

View File

@ -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)
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,
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)
/* 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,
#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,
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,
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,
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)
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)
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,
{ {
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,
#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,
{ {
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)
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)
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)
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)
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)
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)
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,
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)
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;
} }

View File

@ -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;
} }

View File

@ -267,7 +267,7 @@ static enum si_sm_result start_next_msg(struct smi_info *smi_info)
entry = smi_info->xmit_msgs.next; entry = smi_info->xmit_msgs.next;
} }
if (!entry) { if (! entry) {
smi_info->curr_msg = NULL; smi_info->curr_msg = NULL;
rv = SI_SM_IDLE; rv = SI_SM_IDLE;
} else { } else {
@ -328,7 +328,7 @@ static void start_clear_flags(struct smi_info *smi_info)
memory, we will re-enable the interrupt. */ memory, we will re-enable the interrupt. */
static inline void disable_si_irq(struct smi_info *smi_info) static inline void disable_si_irq(struct smi_info *smi_info)
{ {
if ((smi_info->irq) && (!smi_info->interrupt_disabled)) { if ((smi_info->irq) && (! smi_info->interrupt_disabled)) {
disable_irq_nosync(smi_info->irq); disable_irq_nosync(smi_info->irq);
smi_info->interrupt_disabled = 1; smi_info->interrupt_disabled = 1;
} }
@ -359,7 +359,7 @@ static void handle_flags(struct smi_info *smi_info)
} else if (smi_info->msg_flags & RECEIVE_MSG_AVAIL) { } else if (smi_info->msg_flags & RECEIVE_MSG_AVAIL) {
/* Messages available. */ /* Messages available. */
smi_info->curr_msg = ipmi_alloc_smi_msg(); smi_info->curr_msg = ipmi_alloc_smi_msg();
if (!smi_info->curr_msg) { if (! smi_info->curr_msg) {
disable_si_irq(smi_info); disable_si_irq(smi_info);
smi_info->si_state = SI_NORMAL; smi_info->si_state = SI_NORMAL;
return; return;
@ -378,7 +378,7 @@ static void handle_flags(struct smi_info *smi_info)
} else if (smi_info->msg_flags & EVENT_MSG_BUFFER_FULL) { } else if (smi_info->msg_flags & EVENT_MSG_BUFFER_FULL) {
/* Events available. */ /* Events available. */
smi_info->curr_msg = ipmi_alloc_smi_msg(); smi_info->curr_msg = ipmi_alloc_smi_msg();
if (!smi_info->curr_msg) { if (! smi_info->curr_msg) {
disable_si_irq(smi_info); disable_si_irq(smi_info);
smi_info->si_state = SI_NORMAL; smi_info->si_state = SI_NORMAL;
return; return;
@ -414,7 +414,7 @@ static void handle_transaction_done(struct smi_info *smi_info)
#endif #endif
switch (smi_info->si_state) { switch (smi_info->si_state) {
case SI_NORMAL: case SI_NORMAL:
if (!smi_info->curr_msg) if (! smi_info->curr_msg)
break; break;
smi_info->curr_msg->rsp_size smi_info->curr_msg->rsp_size
@ -1047,7 +1047,7 @@ static int std_irq_setup(struct smi_info *info)
{ {
int rv; int rv;
if (!info->irq) if (! info->irq)
return 0; return 0;
if (info->si_type == SI_BT) { if (info->si_type == SI_BT) {
@ -1056,7 +1056,7 @@ static int std_irq_setup(struct smi_info *info)
SA_INTERRUPT, SA_INTERRUPT,
DEVICE_NAME, DEVICE_NAME,
info); info);
if (!rv) if (! rv)
/* Enable the interrupt in the BT interface. */ /* Enable the interrupt in the BT interface. */
info->io.outputb(&info->io, IPMI_BT_INTMASK_REG, info->io.outputb(&info->io, IPMI_BT_INTMASK_REG,
IPMI_BT_INTMASK_ENABLE_IRQ_BIT); IPMI_BT_INTMASK_ENABLE_IRQ_BIT);
@ -1081,7 +1081,7 @@ static int std_irq_setup(struct smi_info *info)
static void std_irq_cleanup(struct smi_info *info) static void std_irq_cleanup(struct smi_info *info)
{ {
if (!info->irq) if (! info->irq)
return; return;
if (info->si_type == SI_BT) if (info->si_type == SI_BT)
@ -1154,7 +1154,7 @@ static int port_setup(struct smi_info *info)
unsigned int *addr = info->io.info; unsigned int *addr = info->io.info;
int mapsize; int mapsize;
if (!addr || (!*addr)) if (! addr || (! *addr))
return -ENODEV; return -ENODEV;
info->io_cleanup = port_cleanup; info->io_cleanup = port_cleanup;
@ -1197,15 +1197,15 @@ static int try_init_port(int intf_num, struct smi_info **new_info)
{ {
struct smi_info *info; struct smi_info *info;
if (!ports[intf_num]) if (! ports[intf_num])
return -ENODEV; return -ENODEV;
if (!is_new_interface(intf_num, IPMI_IO_ADDR_SPACE, if (! is_new_interface(intf_num, IPMI_IO_ADDR_SPACE,
ports[intf_num])) ports[intf_num]))
return -ENODEV; return -ENODEV;
info = kmalloc(sizeof(*info), GFP_KERNEL); info = kmalloc(sizeof(*info), GFP_KERNEL);
if (!info) { if (! info) {
printk(KERN_ERR "ipmi_si: Could not allocate SI data (1)\n"); printk(KERN_ERR "ipmi_si: Could not allocate SI data (1)\n");
return -ENOMEM; return -ENOMEM;
} }
@ -1215,10 +1215,10 @@ static int try_init_port(int intf_num, struct smi_info **new_info)
info->io.info = &(ports[intf_num]); info->io.info = &(ports[intf_num]);
info->io.addr = NULL; info->io.addr = NULL;
info->io.regspacing = regspacings[intf_num]; info->io.regspacing = regspacings[intf_num];
if (!info->io.regspacing) if (! info->io.regspacing)
info->io.regspacing = DEFAULT_REGSPACING; info->io.regspacing = DEFAULT_REGSPACING;
info->io.regsize = regsizes[intf_num]; info->io.regsize = regsizes[intf_num];
if (!info->io.regsize) if (! info->io.regsize)
info->io.regsize = DEFAULT_REGSPACING; info->io.regsize = DEFAULT_REGSPACING;
info->io.regshift = regshifts[intf_num]; info->io.regshift = regshifts[intf_num];
info->irq = 0; info->irq = 0;
@ -1303,7 +1303,7 @@ static int mem_setup(struct smi_info *info)
unsigned long *addr = info->io.info; unsigned long *addr = info->io.info;
int mapsize; int mapsize;
if (!addr || (!*addr)) if (! addr || (! *addr))
return -ENODEV; return -ENODEV;
info->io_cleanup = mem_cleanup; info->io_cleanup = mem_cleanup;
@ -1358,15 +1358,15 @@ static int try_init_mem(int intf_num, struct smi_info **new_info)
{ {
struct smi_info *info; struct smi_info *info;
if (!addrs[intf_num]) if (! addrs[intf_num])
return -ENODEV; return -ENODEV;
if (!is_new_interface(intf_num, IPMI_MEM_ADDR_SPACE, if (! is_new_interface(intf_num, IPMI_MEM_ADDR_SPACE,
addrs[intf_num])) addrs[intf_num]))
return -ENODEV; return -ENODEV;
info = kmalloc(sizeof(*info), GFP_KERNEL); info = kmalloc(sizeof(*info), GFP_KERNEL);
if (!info) { if (! info) {
printk(KERN_ERR "ipmi_si: Could not allocate SI data (2)\n"); printk(KERN_ERR "ipmi_si: Could not allocate SI data (2)\n");
return -ENOMEM; return -ENOMEM;
} }
@ -1376,10 +1376,10 @@ static int try_init_mem(int intf_num, struct smi_info **new_info)
info->io.info = &addrs[intf_num]; info->io.info = &addrs[intf_num];
info->io.addr = NULL; info->io.addr = NULL;
info->io.regspacing = regspacings[intf_num]; info->io.regspacing = regspacings[intf_num];
if (!info->io.regspacing) if (! info->io.regspacing)
info->io.regspacing = DEFAULT_REGSPACING; info->io.regspacing = DEFAULT_REGSPACING;
info->io.regsize = regsizes[intf_num]; info->io.regsize = regsizes[intf_num];
if (!info->io.regsize) if (! info->io.regsize)
info->io.regsize = DEFAULT_REGSPACING; info->io.regsize = DEFAULT_REGSPACING;
info->io.regshift = regshifts[intf_num]; info->io.regshift = regshifts[intf_num];
info->irq = 0; info->irq = 0;
@ -1437,7 +1437,7 @@ static int acpi_gpe_irq_setup(struct smi_info *info)
{ {
acpi_status status; acpi_status status;
if (!info->irq) if (! info->irq)
return 0; return 0;
/* FIXME - is level triggered right? */ /* FIXME - is level triggered right? */
@ -1461,7 +1461,7 @@ static int acpi_gpe_irq_setup(struct smi_info *info)
static void acpi_gpe_irq_cleanup(struct smi_info *info) static void acpi_gpe_irq_cleanup(struct smi_info *info)
{ {
if (!info->irq) if (! info->irq)
return; return;
acpi_remove_gpe_handler(NULL, info->irq, &ipmi_acpi_gpe); 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)
addr_space = IPMI_MEM_ADDR_SPACE; addr_space = IPMI_MEM_ADDR_SPACE;
else else
addr_space = IPMI_IO_ADDR_SPACE; addr_space = IPMI_IO_ADDR_SPACE;
if (!is_new_interface(-1, addr_space, spmi->addr.address)) if (! is_new_interface(-1, addr_space, spmi->addr.address))
return -ENODEV; return -ENODEV;
if (!spmi->addr.register_bit_width) { if (! spmi->addr.register_bit_width) {
acpi_failure = 1; acpi_failure = 1;
return -ENODEV; return -ENODEV;
} }
@ -1567,7 +1567,7 @@ static int try_init_acpi(int intf_num, struct smi_info **new_info)
} }
info = kmalloc(sizeof(*info), GFP_KERNEL); info = kmalloc(sizeof(*info), GFP_KERNEL);
if (!info) { if (! info) {
printk(KERN_ERR "ipmi_si: Could not allocate SI data (3)\n"); printk(KERN_ERR "ipmi_si: Could not allocate SI data (3)\n");
return -ENOMEM; return -ENOMEM;
} }
@ -1645,7 +1645,7 @@ static int dmi_data_entries;
static int __init decode_dmi(struct dmi_header *dm, int intf_num) static int __init decode_dmi(struct dmi_header *dm, int intf_num)
{ {
u8 *data = (u8 *)dm; u8 *data = (u8 *)dm;
unsigned long base_addr; unsigned long base_addr;
u8 reg_spacing; u8 reg_spacing;
u8 len = dm->length; u8 len = dm->length;
@ -1714,7 +1714,7 @@ static int __init decode_dmi(struct dmi_header *dm, int intf_num)
static void __init dmi_find_bmc(void) static void __init dmi_find_bmc(void)
{ {
struct dmi_device *dev = NULL; struct dmi_device *dev = NULL;
int intf_num = 0; int intf_num = 0;
while ((dev = dmi_find_device(DMI_DEV_TYPE_IPMI, NULL, dev))) { while ((dev = dmi_find_device(DMI_DEV_TYPE_IPMI, NULL, dev))) {
if (intf_num >= SI_MAX_DRIVERS) if (intf_num >= SI_MAX_DRIVERS)
@ -1726,14 +1726,14 @@ static void __init dmi_find_bmc(void)
static int try_init_smbios(int intf_num, struct smi_info **new_info) static int try_init_smbios(int intf_num, struct smi_info **new_info)
{ {
struct smi_info *info; struct smi_info *info;
dmi_ipmi_data_t *ipmi_data = dmi_data+intf_num; dmi_ipmi_data_t *ipmi_data = dmi_data+intf_num;
char *io_type; char *io_type;
if (intf_num >= dmi_data_entries) if (intf_num >= dmi_data_entries)
return -ENODEV; return -ENODEV;
switch(ipmi_data->type) { switch (ipmi_data->type) {
case 0x01: /* KCS */ case 0x01: /* KCS */
si_type[intf_num] = "kcs"; si_type[intf_num] = "kcs";
break; break;
@ -1748,7 +1748,7 @@ static int try_init_smbios(int intf_num, struct smi_info **new_info)
} }
info = kmalloc(sizeof(*info), GFP_KERNEL); info = kmalloc(sizeof(*info), GFP_KERNEL);
if (!info) { if (! info) {
printk(KERN_ERR "ipmi_si: Could not allocate SI data (4)\n"); printk(KERN_ERR "ipmi_si: Could not allocate SI data (4)\n");
return -ENOMEM; return -ENOMEM;
} }
@ -1772,7 +1772,7 @@ static int try_init_smbios(int intf_num, struct smi_info **new_info)
regspacings[intf_num] = ipmi_data->offset; regspacings[intf_num] = ipmi_data->offset;
info->io.regspacing = regspacings[intf_num]; info->io.regspacing = regspacings[intf_num];
if (!info->io.regspacing) if (! info->io.regspacing)
info->io.regspacing = DEFAULT_REGSPACING; info->io.regspacing = DEFAULT_REGSPACING;
info->io.regsize = DEFAULT_REGSPACING; info->io.regsize = DEFAULT_REGSPACING;
info->io.regshift = regshifts[intf_num]; info->io.regshift = regshifts[intf_num];
@ -1814,14 +1814,14 @@ static int find_pci_smic(int intf_num, struct smi_info **new_info)
pci_smic_checked = 1; pci_smic_checked = 1;
if ((pci_dev = pci_get_device(PCI_HP_VENDOR_ID, PCI_MMC_DEVICE_ID, pci_dev = pci_get_device(PCI_HP_VENDOR_ID, PCI_MMC_DEVICE_ID, NULL);
NULL))) if (! pci_dev) {
; pci_dev = pci_get_class(PCI_ERMC_CLASSCODE, NULL);
else if ((pci_dev = pci_get_class(PCI_ERMC_CLASSCODE, NULL)) && if (pci_dev && (pci_dev->subsystem_vendor == PCI_HP_VENDOR_ID))
pci_dev->subsystem_vendor == PCI_HP_VENDOR_ID) fe_rmc = 1;
fe_rmc = 1; else
else return -ENODEV;
return -ENODEV; }
error = pci_read_config_word(pci_dev, PCI_MMC_ADDR_CW, &base_addr); error = pci_read_config_word(pci_dev, PCI_MMC_ADDR_CW, &base_addr);
if (error) if (error)
@ -1834,7 +1834,7 @@ static int find_pci_smic(int intf_num, struct smi_info **new_info)
} }
/* Bit 0: 1 specifies programmed I/O, 0 specifies memory mapped I/O */ /* Bit 0: 1 specifies programmed I/O, 0 specifies memory mapped I/O */
if (!(base_addr & 0x0001)) if (! (base_addr & 0x0001))
{ {
pci_dev_put(pci_dev); pci_dev_put(pci_dev);
printk(KERN_ERR printk(KERN_ERR
@ -1844,17 +1844,17 @@ static int find_pci_smic(int intf_num, struct smi_info **new_info)
} }
base_addr &= 0xFFFE; base_addr &= 0xFFFE;
if (!fe_rmc) if (! fe_rmc)
/* Data register starts at base address + 1 in eRMC */ /* Data register starts at base address + 1 in eRMC */
++base_addr; ++base_addr;
if (!is_new_interface(-1, IPMI_IO_ADDR_SPACE, base_addr)) { if (! is_new_interface(-1, IPMI_IO_ADDR_SPACE, base_addr)) {
pci_dev_put(pci_dev); pci_dev_put(pci_dev);
return -ENODEV; return -ENODEV;
} }
info = kmalloc(sizeof(*info), GFP_KERNEL); info = kmalloc(sizeof(*info), GFP_KERNEL);
if (!info) { if (! info) {
pci_dev_put(pci_dev); pci_dev_put(pci_dev);
printk(KERN_ERR "ipmi_si: Could not allocate SI data (5)\n"); printk(KERN_ERR "ipmi_si: Could not allocate SI data (5)\n");
return -ENOMEM; return -ENOMEM;
@ -1865,7 +1865,7 @@ static int find_pci_smic(int intf_num, struct smi_info **new_info)
ports[intf_num] = base_addr; ports[intf_num] = base_addr;
info->io.info = &(ports[intf_num]); info->io.info = &(ports[intf_num]);
info->io.regspacing = regspacings[intf_num]; info->io.regspacing = regspacings[intf_num];
if (!info->io.regspacing) if (! info->io.regspacing)
info->io.regspacing = DEFAULT_REGSPACING; info->io.regspacing = DEFAULT_REGSPACING;
info->io.regsize = DEFAULT_REGSPACING; info->io.regsize = DEFAULT_REGSPACING;
info->io.regshift = regshifts[intf_num]; info->io.regshift = regshifts[intf_num];
@ -1886,7 +1886,7 @@ static int find_pci_smic(int intf_num, struct smi_info **new_info)
static int try_init_plug_and_play(int intf_num, struct smi_info **new_info) static int try_init_plug_and_play(int intf_num, struct smi_info **new_info)
{ {
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
if (find_pci_smic(intf_num, new_info)==0) if (find_pci_smic(intf_num, new_info) == 0)
return 0; return 0;
#endif #endif
/* Include other methods here. */ /* Include other methods here. */
@ -1904,7 +1904,7 @@ static int try_get_dev_id(struct smi_info *smi_info)
int rv = 0; int rv = 0;
resp = kmalloc(IPMI_MAX_MSG_LENGTH, GFP_KERNEL); resp = kmalloc(IPMI_MAX_MSG_LENGTH, GFP_KERNEL);
if (!resp) if (! resp)
return -ENOMEM; return -ENOMEM;
/* Do a Get Device ID command, since it comes back with some /* 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,
struct smi_info *smi = data; struct smi_info *smi = data;
out += sprintf(out, "interrupts_enabled: %d\n", out += sprintf(out, "interrupts_enabled: %d\n",
smi->irq && !smi->interrupt_disabled); smi->irq && ! smi->interrupt_disabled);
out += sprintf(out, "short_timeouts: %ld\n", out += sprintf(out, "short_timeouts: %ld\n",
smi->short_timeouts); smi->short_timeouts);
out += sprintf(out, "long_timeouts: %ld\n", out += sprintf(out, "long_timeouts: %ld\n",
@ -2024,8 +2024,8 @@ static int stat_file_read_proc(char *page, char **start, off_t off,
*/ */
static int oem_data_avail_to_receive_msg_avail(struct smi_info *smi_info) static int oem_data_avail_to_receive_msg_avail(struct smi_info *smi_info)
{ {
smi_info->msg_flags = (smi_info->msg_flags & ~OEM_DATA_AVAIL) | smi_info->msg_flags = ((smi_info->msg_flags & ~OEM_DATA_AVAIL) |
RECEIVE_MSG_AVAIL; RECEIVE_MSG_AVAIL);
return 1; return 1;
} }
@ -2059,10 +2059,11 @@ static void setup_dell_poweredge_oem_data_handler(struct smi_info *smi_info)
{ {
struct ipmi_device_id *id = &smi_info->device_id; struct ipmi_device_id *id = &smi_info->device_id;
const char mfr[3]=DELL_IANA_MFR_ID; const char mfr[3]=DELL_IANA_MFR_ID;
if (!memcmp(mfr, id->manufacturer_id, sizeof(mfr)) && if (! memcmp(mfr, id->manufacturer_id, sizeof(mfr))
id->device_id == DELL_POWEREDGE_8G_BMC_DEVICE_ID && && (id->device_id == DELL_POWEREDGE_8G_BMC_DEVICE_ID)
id->device_revision == DELL_POWEREDGE_8G_BMC_DEVICE_REV && && (id->device_revision == DELL_POWEREDGE_8G_BMC_DEVICE_REV)
id->ipmi_version == DELL_POWEREDGE_8G_BMC_IPMI_VERSION) { && (id->ipmi_version == DELL_POWEREDGE_8G_BMC_IPMI_VERSION))
{
smi_info->oem_data_avail_handler = smi_info->oem_data_avail_handler =
oem_data_avail_to_receive_msg_avail; oem_data_avail_to_receive_msg_avail;
} }
@ -2092,19 +2093,15 @@ static int init_one_smi(int intf_num, struct smi_info **smi)
if (rv) if (rv)
rv = try_init_port(intf_num, &new_smi); rv = try_init_port(intf_num, &new_smi);
#ifdef CONFIG_ACPI_INTERPRETER #ifdef CONFIG_ACPI_INTERPRETER
if ((rv) && (si_trydefaults)) { if (rv && si_trydefaults)
rv = try_init_acpi(intf_num, &new_smi); rv = try_init_acpi(intf_num, &new_smi);
}
#endif #endif
#ifdef CONFIG_X86 #ifdef CONFIG_X86
if ((rv) && (si_trydefaults)) { if (rv && si_trydefaults)
rv = try_init_smbios(intf_num, &new_smi); rv = try_init_smbios(intf_num, &new_smi);
}
#endif #endif
if ((rv) && (si_trydefaults)) { if (rv && si_trydefaults)
rv = try_init_plug_and_play(intf_num, &new_smi); rv = try_init_plug_and_play(intf_num, &new_smi);
}
if (rv) if (rv)
return rv; return rv;
@ -2114,7 +2111,7 @@ static int init_one_smi(int intf_num, struct smi_info **smi)
new_smi->si_sm = NULL; new_smi->si_sm = NULL;
new_smi->handlers = NULL; new_smi->handlers = NULL;
if (!new_smi->irq_setup) { if (! new_smi->irq_setup) {
new_smi->irq = irqs[intf_num]; new_smi->irq = irqs[intf_num];
new_smi->irq_setup = std_irq_setup; new_smi->irq_setup = std_irq_setup;
new_smi->irq_cleanup = std_irq_cleanup; new_smi->irq_cleanup = std_irq_cleanup;
@ -2148,7 +2145,7 @@ static int init_one_smi(int intf_num, struct smi_info **smi)
/* Allocate the state machine's data and initialize it. */ /* Allocate the state machine's data and initialize it. */
new_smi->si_sm = kmalloc(new_smi->handlers->size(), GFP_KERNEL); new_smi->si_sm = kmalloc(new_smi->handlers->size(), GFP_KERNEL);
if (!new_smi->si_sm) { if (! new_smi->si_sm) {
printk(" Could not allocate state machine memory\n"); printk(" Could not allocate state machine memory\n");
rv = -ENOMEM; rv = -ENOMEM;
goto out_err; goto out_err;
@ -2256,7 +2253,7 @@ static int init_one_smi(int intf_num, struct smi_info **smi)
/* Wait for the timer to stop. This avoids problems with race /* Wait for the timer to stop. This avoids problems with race
conditions removing the timer here. */ conditions removing the timer here. */
while (!new_smi->timer_stopped) { while (! new_smi->timer_stopped) {
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(1); schedule_timeout(1);
} }
@ -2296,7 +2293,7 @@ static __init int init_ipmi_si(void)
/* Parse out the si_type string into its components. */ /* Parse out the si_type string into its components. */
str = si_type_str; str = si_type_str;
if (*str != '\0') { if (*str != '\0') {
for (i=0; (i<SI_MAX_PARMS) && (*str != '\0'); i++) { for (i = 0; (i < SI_MAX_PARMS) && (*str != '\0'); i++) {
si_type[i] = str; si_type[i] = str;
str = strchr(str, ','); str = strchr(str, ',');
if (str) { if (str) {
@ -2315,7 +2312,7 @@ static __init int init_ipmi_si(void)
#endif #endif
rv = init_one_smi(0, &(smi_infos[pos])); rv = init_one_smi(0, &(smi_infos[pos]));
if (rv && !ports[0] && si_trydefaults) { if (rv && ! ports[0] && si_trydefaults) {
/* If we are trying defaults and the initial port is /* If we are trying defaults and the initial port is
not set, then set it. */ not set, then set it. */
si_type[0] = "kcs"; si_type[0] = "kcs";
@ -2337,7 +2334,7 @@ static __init int init_ipmi_si(void)
if (rv == 0) if (rv == 0)
pos++; pos++;
for (i=1; i < SI_MAX_PARMS; i++) { for (i = 1; i < SI_MAX_PARMS; i++) {
rv = init_one_smi(i, &(smi_infos[pos])); rv = init_one_smi(i, &(smi_infos[pos]));
if (rv == 0) if (rv == 0)
pos++; pos++;
@ -2379,14 +2376,14 @@ static void __exit cleanup_one_si(struct smi_info *to_clean)
/* Wait for the timer to stop. This avoids problems with race /* Wait for the timer to stop. This avoids problems with race
conditions removing the timer here. */ conditions removing the timer here. */
while (!to_clean->timer_stopped) { while (! to_clean->timer_stopped) {
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(1); schedule_timeout(1);
} }
/* Interrupts and timeouts are stopped, now make sure the /* Interrupts and timeouts are stopped, now make sure the
interface is in a clean state. */ interface is in a clean state. */
while ((to_clean->curr_msg) || (to_clean->si_state != SI_NORMAL)) { while (to_clean->curr_msg || (to_clean->si_state != SI_NORMAL)) {
poll(to_clean); poll(to_clean);
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(1); schedule_timeout(1);
@ -2410,10 +2407,10 @@ static __exit void cleanup_ipmi_si(void)
{ {
int i; int i;
if (!initialized) if (! initialized)
return; return;
for (i=0; i<SI_MAX_DRIVERS; i++) { for (i = 0; i < SI_MAX_DRIVERS; i++) {
cleanup_one_si(smi_infos[i]); cleanup_one_si(smi_infos[i]);
} }
} }

View 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);
} }
} }