提交 8a3628d5 编写于 作者: C Corey Minyard 提交者: Linus Torvalds

[PATCH] IPMI: tidy up various things

Tidy up various coding standard things, mostly removing the space after !,
but also break some long lines and fix a few other spacing inconsistencies.
Also fixes some bad error reporting when deleting an IPMI user.
Signed-off-by: NCorey Minyard <minyard@acm.org>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 453823ba
...@@ -227,7 +227,7 @@ static inline int check_ibf(struct si_sm_data *kcs, unsigned char status, ...@@ -227,7 +227,7 @@ static inline int check_ibf(struct si_sm_data *kcs, unsigned char status,
static inline int check_obf(struct si_sm_data *kcs, unsigned char status, static inline int check_obf(struct si_sm_data *kcs, unsigned char status,
long time) long time)
{ {
if (! GET_STATUS_OBF(status)) { if (!GET_STATUS_OBF(status)) {
kcs->obf_timeout -= time; kcs->obf_timeout -= time;
if (kcs->obf_timeout < 0) { if (kcs->obf_timeout < 0) {
start_error_recovery(kcs, "OBF not ready in time"); start_error_recovery(kcs, "OBF not ready in time");
...@@ -407,7 +407,7 @@ static enum si_sm_result kcs_event(struct si_sm_data *kcs, long time) ...@@ -407,7 +407,7 @@ static enum si_sm_result kcs_event(struct si_sm_data *kcs, long time)
} }
if (state == KCS_READ_STATE) { if (state == KCS_READ_STATE) {
if (! check_obf(kcs, status, time)) if (!check_obf(kcs, status, time))
return SI_SM_CALL_WITH_DELAY; return SI_SM_CALL_WITH_DELAY;
read_next_byte(kcs); read_next_byte(kcs);
} else { } else {
...@@ -447,7 +447,7 @@ static enum si_sm_result kcs_event(struct si_sm_data *kcs, long time) ...@@ -447,7 +447,7 @@ static enum si_sm_result kcs_event(struct si_sm_data *kcs, long time)
"Not in read state for error2"); "Not in read state for error2");
break; break;
} }
if (! check_obf(kcs, status, time)) if (!check_obf(kcs, status, time))
return SI_SM_CALL_WITH_DELAY; return SI_SM_CALL_WITH_DELAY;
clear_obf(kcs, status); clear_obf(kcs, status);
...@@ -462,7 +462,7 @@ static enum si_sm_result kcs_event(struct si_sm_data *kcs, long time) ...@@ -462,7 +462,7 @@ static enum si_sm_result kcs_event(struct si_sm_data *kcs, long time)
break; break;
} }
if (! check_obf(kcs, status, time)) if (!check_obf(kcs, status, time))
return SI_SM_CALL_WITH_DELAY; return SI_SM_CALL_WITH_DELAY;
clear_obf(kcs, status); clear_obf(kcs, status);
......
...@@ -557,7 +557,7 @@ unsigned int ipmi_addr_length(int addr_type) ...@@ -557,7 +557,7 @@ unsigned int ipmi_addr_length(int addr_type)
static void deliver_response(struct ipmi_recv_msg *msg) static void deliver_response(struct ipmi_recv_msg *msg)
{ {
if (! msg->user) { if (!msg->user) {
ipmi_smi_t intf = msg->user_msg_data; ipmi_smi_t intf = msg->user_msg_data;
unsigned long flags; unsigned long flags;
...@@ -598,11 +598,11 @@ static int intf_next_seq(ipmi_smi_t intf, ...@@ -598,11 +598,11 @@ static int intf_next_seq(ipmi_smi_t intf,
(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;
} }
if (! intf->seq_table[i].inuse) { if (!intf->seq_table[i].inuse) {
intf->seq_table[i].recv_msg = recv_msg; intf->seq_table[i].recv_msg = recv_msg;
/* Start with the maximum timeout, when the send response /* Start with the maximum timeout, when the send response
...@@ -763,7 +763,7 @@ int ipmi_create_user(unsigned int if_num, ...@@ -763,7 +763,7 @@ int ipmi_create_user(unsigned int if_num,
} }
new_user = kmalloc(sizeof(*new_user), GFP_KERNEL); new_user = kmalloc(sizeof(*new_user), GFP_KERNEL);
if (! new_user) if (!new_user)
return -ENOMEM; return -ENOMEM;
spin_lock_irqsave(&interfaces_lock, flags); spin_lock_irqsave(&interfaces_lock, flags);
...@@ -819,14 +819,13 @@ static void free_user(struct kref *ref) ...@@ -819,14 +819,13 @@ static void free_user(struct kref *ref)
int ipmi_destroy_user(ipmi_user_t user) int ipmi_destroy_user(ipmi_user_t user)
{ {
int rv = -ENODEV;
ipmi_smi_t intf = user->intf; ipmi_smi_t intf = user->intf;
int i; int i;
unsigned long flags; unsigned long flags;
struct cmd_rcvr *rcvr; struct cmd_rcvr *rcvr;
struct cmd_rcvr *rcvrs = NULL; struct cmd_rcvr *rcvrs = NULL;
user->valid = 1; user->valid = 0;
/* Remove the user from the interface's sequence table. */ /* Remove the user from the interface's sequence table. */
spin_lock_irqsave(&intf->seq_lock, flags); spin_lock_irqsave(&intf->seq_lock, flags);
...@@ -871,7 +870,7 @@ int ipmi_destroy_user(ipmi_user_t user) ...@@ -871,7 +870,7 @@ int ipmi_destroy_user(ipmi_user_t user)
kref_put(&user->refcount, free_user); kref_put(&user->refcount, free_user);
return rv; return 0;
} }
void ipmi_get_version(ipmi_user_t user, void ipmi_get_version(ipmi_user_t user,
...@@ -936,7 +935,8 @@ int ipmi_set_gets_events(ipmi_user_t user, int val) ...@@ -936,7 +935,8 @@ int ipmi_set_gets_events(ipmi_user_t user, int val)
if (val) { if (val) {
/* Deliver any queued events. */ /* Deliver any queued events. */
list_for_each_entry_safe(msg, msg2, &intf->waiting_events, link) { list_for_each_entry_safe(msg, msg2, &intf->waiting_events,
link) {
list_del(&msg->link); list_del(&msg->link);
list_add_tail(&msg->link, &msgs); list_add_tail(&msg->link, &msgs);
} }
...@@ -978,7 +978,7 @@ int ipmi_register_for_cmd(ipmi_user_t user, ...@@ -978,7 +978,7 @@ int ipmi_register_for_cmd(ipmi_user_t user,
rcvr = kmalloc(sizeof(*rcvr), GFP_KERNEL); rcvr = kmalloc(sizeof(*rcvr), GFP_KERNEL);
if (! rcvr) if (!rcvr)
return -ENOMEM; return -ENOMEM;
rcvr->cmd = cmd; rcvr->cmd = cmd;
rcvr->netfn = netfn; rcvr->netfn = netfn;
...@@ -1514,7 +1514,7 @@ int ipmi_request_settime(ipmi_user_t user, ...@@ -1514,7 +1514,7 @@ int ipmi_request_settime(ipmi_user_t user,
unsigned char saddr, lun; unsigned char saddr, lun;
int rv; int rv;
if (! user) if (!user)
return -EINVAL; return -EINVAL;
rv = check_addr(user->intf, addr, &saddr, &lun); rv = check_addr(user->intf, addr, &saddr, &lun);
if (rv) if (rv)
...@@ -1545,7 +1545,7 @@ int ipmi_request_supply_msgs(ipmi_user_t user, ...@@ -1545,7 +1545,7 @@ int ipmi_request_supply_msgs(ipmi_user_t user,
unsigned char saddr, lun; unsigned char saddr, lun;
int rv; int rv;
if (! user) if (!user)
return -EINVAL; return -EINVAL;
rv = check_addr(user->intf, addr, &saddr, &lun); rv = check_addr(user->intf, addr, &saddr, &lun);
if (rv) if (rv)
...@@ -1570,7 +1570,7 @@ static int ipmb_file_read_proc(char *page, char **start, off_t off, ...@@ -1570,7 +1570,7 @@ static int ipmb_file_read_proc(char *page, char **start, off_t off,
char *out = (char *) page; char *out = (char *) page;
ipmi_smi_t intf = data; ipmi_smi_t intf = data;
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);
...@@ -1989,7 +1989,7 @@ static int ipmi_bmc_register(ipmi_smi_t intf) ...@@ -1989,7 +1989,7 @@ static int ipmi_bmc_register(ipmi_smi_t intf)
} else { } else {
bmc->dev = platform_device_alloc("ipmi_bmc", bmc->dev = platform_device_alloc("ipmi_bmc",
bmc->id.device_id); bmc->id.device_id);
if (! bmc->dev) { if (!bmc->dev) {
printk(KERN_ERR printk(KERN_ERR
"ipmi_msghandler:" "ipmi_msghandler:"
" Unable to allocate platform device\n"); " Unable to allocate platform device\n");
...@@ -2621,7 +2621,7 @@ static int handle_ipmb_get_msg_cmd(ipmi_smi_t intf, ...@@ -2621,7 +2621,7 @@ static int handle_ipmb_get_msg_cmd(ipmi_smi_t intf,
spin_unlock_irqrestore(&intf->counter_lock, flags); spin_unlock_irqrestore(&intf->counter_lock, flags);
recv_msg = ipmi_alloc_recv_msg(); recv_msg = ipmi_alloc_recv_msg();
if (! recv_msg) { if (!recv_msg) {
/* We couldn't allocate memory for the /* We couldn't allocate memory for the
message, so requeue it for handling message, so requeue it for handling
later. */ later. */
...@@ -2776,7 +2776,7 @@ static int handle_lan_get_msg_cmd(ipmi_smi_t intf, ...@@ -2776,7 +2776,7 @@ static int handle_lan_get_msg_cmd(ipmi_smi_t intf,
spin_unlock_irqrestore(&intf->counter_lock, flags); spin_unlock_irqrestore(&intf->counter_lock, flags);
recv_msg = ipmi_alloc_recv_msg(); recv_msg = ipmi_alloc_recv_msg();
if (! recv_msg) { if (!recv_msg) {
/* We couldn't allocate memory for the /* We couldn't allocate memory for the
message, so requeue it for handling message, so requeue it for handling
later. */ later. */
...@@ -2868,13 +2868,14 @@ static int handle_read_event_rsp(ipmi_smi_t intf, ...@@ -2868,13 +2868,14 @@ static int handle_read_event_rsp(ipmi_smi_t intf,
events. */ events. */
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(user, &intf->users, link) { list_for_each_entry_rcu(user, &intf->users, link) {
if (! user->gets_events) if (!user->gets_events)
continue; continue;
recv_msg = ipmi_alloc_recv_msg(); recv_msg = ipmi_alloc_recv_msg();
if (! recv_msg) { if (!recv_msg) {
rcu_read_unlock(); rcu_read_unlock();
list_for_each_entry_safe(recv_msg, recv_msg2, &msgs, link) { list_for_each_entry_safe(recv_msg, recv_msg2, &msgs,
link) {
list_del(&recv_msg->link); list_del(&recv_msg->link);
ipmi_free_recv_msg(recv_msg); ipmi_free_recv_msg(recv_msg);
} }
...@@ -2904,7 +2905,7 @@ static int handle_read_event_rsp(ipmi_smi_t intf, ...@@ -2904,7 +2905,7 @@ static int handle_read_event_rsp(ipmi_smi_t intf,
/* No one to receive the message, put it in queue if there's /* No one to receive the message, put it in queue if there's
not already too many things in the queue. */ not already too many things in the queue. */
recv_msg = ipmi_alloc_recv_msg(); recv_msg = ipmi_alloc_recv_msg();
if (! recv_msg) { if (!recv_msg) {
/* We couldn't allocate memory for the /* We couldn't allocate memory for the
message, so requeue it for handling message, so requeue it for handling
later. */ later. */
...@@ -3189,7 +3190,7 @@ void ipmi_smi_watchdog_pretimeout(ipmi_smi_t intf) ...@@ -3189,7 +3190,7 @@ void ipmi_smi_watchdog_pretimeout(ipmi_smi_t intf)
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(user, &intf->users, link) { list_for_each_entry_rcu(user, &intf->users, link) {
if (! user->handler->ipmi_watchdog_pretimeout) if (!user->handler->ipmi_watchdog_pretimeout)
continue; continue;
user->handler->ipmi_watchdog_pretimeout(user->handler_data); user->handler->ipmi_watchdog_pretimeout(user->handler_data);
...@@ -3277,7 +3278,7 @@ static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent, ...@@ -3277,7 +3278,7 @@ static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent,
smi_msg = smi_from_recv_msg(intf, ent->recv_msg, slot, smi_msg = smi_from_recv_msg(intf, ent->recv_msg, slot,
ent->seqid); ent->seqid);
if (! smi_msg) if (!smi_msg)
return; return;
spin_unlock_irqrestore(&intf->seq_lock, *flags); spin_unlock_irqrestore(&intf->seq_lock, *flags);
...@@ -3313,8 +3314,9 @@ static void ipmi_timeout_handler(long timeout_period) ...@@ -3313,8 +3314,9 @@ static void ipmi_timeout_handler(long timeout_period)
/* See if any waiting messages need to be processed. */ /* See if any waiting messages need to be processed. */
spin_lock_irqsave(&intf->waiting_msgs_lock, flags); spin_lock_irqsave(&intf->waiting_msgs_lock, flags);
list_for_each_entry_safe(smi_msg, smi_msg2, &intf->waiting_msgs, link) { list_for_each_entry_safe(smi_msg, smi_msg2,
if (! handle_new_recv_msg(intf, smi_msg)) { &intf->waiting_msgs, link) {
if (!handle_new_recv_msg(intf, smi_msg)) {
list_del(&smi_msg->link); list_del(&smi_msg->link);
ipmi_free_smi_msg(smi_msg); ipmi_free_smi_msg(smi_msg);
} else { } else {
......
...@@ -346,7 +346,7 @@ static int ipmi_dell_chassis_detect (ipmi_user_t user) ...@@ -346,7 +346,7 @@ static int ipmi_dell_chassis_detect (ipmi_user_t user)
{ {
const char ipmi_version_major = ipmi_version & 0xF; const char ipmi_version_major = ipmi_version & 0xF;
const char ipmi_version_minor = (ipmi_version >> 4) & 0xF; const char ipmi_version_minor = (ipmi_version >> 4) & 0xF;
const char mfr[3]=DELL_IANA_MFR_ID; const char mfr[3] = DELL_IANA_MFR_ID;
if (!memcmp(mfr, &mfg_id, sizeof(mfr)) && if (!memcmp(mfr, &mfg_id, sizeof(mfr)) &&
ipmi_version_major <= 1 && ipmi_version_major <= 1 &&
ipmi_version_minor < 5) ipmi_version_minor < 5)
......
...@@ -803,7 +803,7 @@ static int ipmi_thread(void *data) ...@@ -803,7 +803,7 @@ static int ipmi_thread(void *data)
set_user_nice(current, 19); set_user_nice(current, 19);
while (!kthread_should_stop()) { while (!kthread_should_stop()) {
spin_lock_irqsave(&(smi_info->si_lock), flags); spin_lock_irqsave(&(smi_info->si_lock), flags);
smi_result=smi_event_handler(smi_info, 0); smi_result = smi_event_handler(smi_info, 0);
spin_unlock_irqrestore(&(smi_info->si_lock), flags); spin_unlock_irqrestore(&(smi_info->si_lock), flags);
if (smi_result == SI_SM_CALL_WITHOUT_DELAY) { if (smi_result == SI_SM_CALL_WITHOUT_DELAY) {
/* do nothing */ /* do nothing */
......
...@@ -589,7 +589,7 @@ static void panic_halt_ipmi_heartbeat(void) ...@@ -589,7 +589,7 @@ static void panic_halt_ipmi_heartbeat(void)
1); 1);
} }
static struct watchdog_info ident= static struct watchdog_info ident =
{ {
.options = 0, /* WDIOF_SETTIMEOUT, */ .options = 0, /* WDIOF_SETTIMEOUT, */
.firmware_version = 1, .firmware_version = 1,
...@@ -790,13 +790,13 @@ static int ipmi_fasync(int fd, struct file *file, int on) ...@@ -790,13 +790,13 @@ static int ipmi_fasync(int fd, struct file *file, int on)
static int ipmi_close(struct inode *ino, struct file *filep) static int ipmi_close(struct inode *ino, struct file *filep)
{ {
if (iminor(ino)==WATCHDOG_MINOR) if (iminor(ino) == WATCHDOG_MINOR) {
{
if (expect_close == 42) { if (expect_close == 42) {
ipmi_watchdog_state = WDOG_TIMEOUT_NONE; ipmi_watchdog_state = WDOG_TIMEOUT_NONE;
ipmi_set_timeout(IPMI_SET_TIMEOUT_NO_HB); ipmi_set_timeout(IPMI_SET_TIMEOUT_NO_HB);
} else { } else {
printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n"); printk(KERN_CRIT PFX
"Unexpected close, not stopping watchdog!\n");
ipmi_heartbeat(); ipmi_heartbeat();
} }
clear_bit(0, &ipmi_wdog_open); clear_bit(0, &ipmi_wdog_open);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册