aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/ipmi
diff options
context:
space:
mode:
authorCorey Minyard <minyard@acm.org>2006-03-31 05:30:40 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-31 15:18:54 -0500
commit8a3628d53fe5eb1d1401dd1ce16655182c1c5ffc (patch)
tree6b196decb7403095270bbc7a7d5cbe4fe39945da /drivers/char/ipmi
parent453823ba08ba762b3d58934b6dce75edce37169e (diff)
[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: 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/ipmi')
-rw-r--r--drivers/char/ipmi/ipmi_kcs_sm.c8
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c48
-rw-r--r--drivers/char/ipmi/ipmi_poweroff.c2
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c2
-rw-r--r--drivers/char/ipmi/ipmi_watchdog.c8
5 files changed, 35 insertions, 33 deletions
diff --git a/drivers/char/ipmi/ipmi_kcs_sm.c b/drivers/char/ipmi/ipmi_kcs_sm.c
index da1554194d3d..2062675f9e99 100644
--- a/drivers/char/ipmi/ipmi_kcs_sm.c
+++ b/drivers/char/ipmi/ipmi_kcs_sm.c
@@ -227,7 +227,7 @@ static inline int check_ibf(struct si_sm_data *kcs, unsigned char status,
227static inline int check_obf(struct si_sm_data *kcs, unsigned char status, 227static inline int check_obf(struct si_sm_data *kcs, unsigned char status,
228 long time) 228 long time)
229{ 229{
230 if (! GET_STATUS_OBF(status)) { 230 if (!GET_STATUS_OBF(status)) {
231 kcs->obf_timeout -= time; 231 kcs->obf_timeout -= time;
232 if (kcs->obf_timeout < 0) { 232 if (kcs->obf_timeout < 0) {
233 start_error_recovery(kcs, "OBF not ready in time"); 233 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 } 407 }
408 408
409 if (state == KCS_READ_STATE) { 409 if (state == KCS_READ_STATE) {
410 if (! check_obf(kcs, status, time)) 410 if (!check_obf(kcs, status, time))
411 return SI_SM_CALL_WITH_DELAY; 411 return SI_SM_CALL_WITH_DELAY;
412 read_next_byte(kcs); 412 read_next_byte(kcs);
413 } else { 413 } else {
@@ -447,7 +447,7 @@ static enum si_sm_result kcs_event(struct si_sm_data *kcs, long time)
447 "Not in read state for error2"); 447 "Not in read state for error2");
448 break; 448 break;
449 } 449 }
450 if (! check_obf(kcs, status, time)) 450 if (!check_obf(kcs, status, time))
451 return SI_SM_CALL_WITH_DELAY; 451 return SI_SM_CALL_WITH_DELAY;
452 452
453 clear_obf(kcs, status); 453 clear_obf(kcs, status);
@@ -462,7 +462,7 @@ static enum si_sm_result kcs_event(struct si_sm_data *kcs, long time)
462 break; 462 break;
463 } 463 }
464 464
465 if (! check_obf(kcs, status, time)) 465 if (!check_obf(kcs, status, time))
466 return SI_SM_CALL_WITH_DELAY; 466 return SI_SM_CALL_WITH_DELAY;
467 467
468 clear_obf(kcs, status); 468 clear_obf(kcs, status);
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index a0b6f797d97d..c0c862cce1c3 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -557,7 +557,7 @@ unsigned int ipmi_addr_length(int addr_type)
557 557
558static void deliver_response(struct ipmi_recv_msg *msg) 558static void deliver_response(struct ipmi_recv_msg *msg)
559{ 559{
560 if (! msg->user) { 560 if (!msg->user) {
561 ipmi_smi_t intf = msg->user_msg_data; 561 ipmi_smi_t intf = msg->user_msg_data;
562 unsigned long flags; 562 unsigned long flags;
563 563
@@ -598,11 +598,11 @@ static int intf_next_seq(ipmi_smi_t intf,
598 (i+1)%IPMI_IPMB_NUM_SEQ != intf->curr_seq; 598 (i+1)%IPMI_IPMB_NUM_SEQ != intf->curr_seq;
599 i = (i+1)%IPMI_IPMB_NUM_SEQ) 599 i = (i+1)%IPMI_IPMB_NUM_SEQ)
600 { 600 {
601 if (! intf->seq_table[i].inuse) 601 if (!intf->seq_table[i].inuse)
602 break; 602 break;
603 } 603 }
604 604
605 if (! intf->seq_table[i].inuse) { 605 if (!intf->seq_table[i].inuse) {
606 intf->seq_table[i].recv_msg = recv_msg; 606 intf->seq_table[i].recv_msg = recv_msg;
607 607
608 /* Start with the maximum timeout, when the send response 608 /* Start with the maximum timeout, when the send response
@@ -763,7 +763,7 @@ int ipmi_create_user(unsigned int if_num,
763 } 763 }
764 764
765 new_user = kmalloc(sizeof(*new_user), GFP_KERNEL); 765 new_user = kmalloc(sizeof(*new_user), GFP_KERNEL);
766 if (! new_user) 766 if (!new_user)
767 return -ENOMEM; 767 return -ENOMEM;
768 768
769 spin_lock_irqsave(&interfaces_lock, flags); 769 spin_lock_irqsave(&interfaces_lock, flags);
@@ -819,14 +819,13 @@ static void free_user(struct kref *ref)
819 819
820int ipmi_destroy_user(ipmi_user_t user) 820int ipmi_destroy_user(ipmi_user_t user)
821{ 821{
822 int rv = -ENODEV;
823 ipmi_smi_t intf = user->intf; 822 ipmi_smi_t intf = user->intf;
824 int i; 823 int i;
825 unsigned long flags; 824 unsigned long flags;
826 struct cmd_rcvr *rcvr; 825 struct cmd_rcvr *rcvr;
827 struct cmd_rcvr *rcvrs = NULL; 826 struct cmd_rcvr *rcvrs = NULL;
828 827
829 user->valid = 1; 828 user->valid = 0;
830 829
831 /* Remove the user from the interface's sequence table. */ 830 /* Remove the user from the interface's sequence table. */
832 spin_lock_irqsave(&intf->seq_lock, flags); 831 spin_lock_irqsave(&intf->seq_lock, flags);
@@ -871,7 +870,7 @@ int ipmi_destroy_user(ipmi_user_t user)
871 870
872 kref_put(&user->refcount, free_user); 871 kref_put(&user->refcount, free_user);
873 872
874 return rv; 873 return 0;
875} 874}
876 875
877void ipmi_get_version(ipmi_user_t user, 876void ipmi_get_version(ipmi_user_t user,
@@ -936,7 +935,8 @@ int ipmi_set_gets_events(ipmi_user_t user, int val)
936 935
937 if (val) { 936 if (val) {
938 /* Deliver any queued events. */ 937 /* Deliver any queued events. */
939 list_for_each_entry_safe(msg, msg2, &intf->waiting_events, link) { 938 list_for_each_entry_safe(msg, msg2, &intf->waiting_events,
939 link) {
940 list_del(&msg->link); 940 list_del(&msg->link);
941 list_add_tail(&msg->link, &msgs); 941 list_add_tail(&msg->link, &msgs);
942 } 942 }
@@ -978,7 +978,7 @@ int ipmi_register_for_cmd(ipmi_user_t user,
978 978
979 979
980 rcvr = kmalloc(sizeof(*rcvr), GFP_KERNEL); 980 rcvr = kmalloc(sizeof(*rcvr), GFP_KERNEL);
981 if (! rcvr) 981 if (!rcvr)
982 return -ENOMEM; 982 return -ENOMEM;
983 rcvr->cmd = cmd; 983 rcvr->cmd = cmd;
984 rcvr->netfn = netfn; 984 rcvr->netfn = netfn;
@@ -1514,7 +1514,7 @@ int ipmi_request_settime(ipmi_user_t user,
1514 unsigned char saddr, lun; 1514 unsigned char saddr, lun;
1515 int rv; 1515 int rv;
1516 1516
1517 if (! user) 1517 if (!user)
1518 return -EINVAL; 1518 return -EINVAL;
1519 rv = check_addr(user->intf, addr, &saddr, &lun); 1519 rv = check_addr(user->intf, addr, &saddr, &lun);
1520 if (rv) 1520 if (rv)
@@ -1545,7 +1545,7 @@ int ipmi_request_supply_msgs(ipmi_user_t user,
1545 unsigned char saddr, lun; 1545 unsigned char saddr, lun;
1546 int rv; 1546 int rv;
1547 1547
1548 if (! user) 1548 if (!user)
1549 return -EINVAL; 1549 return -EINVAL;
1550 rv = check_addr(user->intf, addr, &saddr, &lun); 1550 rv = check_addr(user->intf, addr, &saddr, &lun);
1551 if (rv) 1551 if (rv)
@@ -1570,7 +1570,7 @@ static int ipmb_file_read_proc(char *page, char **start, off_t off,
1570 char *out = (char *) page; 1570 char *out = (char *) page;
1571 ipmi_smi_t intf = data; 1571 ipmi_smi_t intf = data;
1572 int i; 1572 int i;
1573 int rv= 0; 1573 int rv = 0;
1574 1574
1575 for (i = 0; i < IPMI_MAX_CHANNELS; i++) 1575 for (i = 0; i < IPMI_MAX_CHANNELS; i++)
1576 rv += sprintf(out+rv, "%x ", intf->channels[i].address); 1576 rv += sprintf(out+rv, "%x ", intf->channels[i].address);
@@ -1989,7 +1989,7 @@ static int ipmi_bmc_register(ipmi_smi_t intf)
1989 } else { 1989 } else {
1990 bmc->dev = platform_device_alloc("ipmi_bmc", 1990 bmc->dev = platform_device_alloc("ipmi_bmc",
1991 bmc->id.device_id); 1991 bmc->id.device_id);
1992 if (! bmc->dev) { 1992 if (!bmc->dev) {
1993 printk(KERN_ERR 1993 printk(KERN_ERR
1994 "ipmi_msghandler:" 1994 "ipmi_msghandler:"
1995 " Unable to allocate platform device\n"); 1995 " Unable to allocate platform device\n");
@@ -2621,7 +2621,7 @@ static int handle_ipmb_get_msg_cmd(ipmi_smi_t intf,
2621 spin_unlock_irqrestore(&intf->counter_lock, flags); 2621 spin_unlock_irqrestore(&intf->counter_lock, flags);
2622 2622
2623 recv_msg = ipmi_alloc_recv_msg(); 2623 recv_msg = ipmi_alloc_recv_msg();
2624 if (! recv_msg) { 2624 if (!recv_msg) {
2625 /* We couldn't allocate memory for the 2625 /* We couldn't allocate memory for the
2626 message, so requeue it for handling 2626 message, so requeue it for handling
2627 later. */ 2627 later. */
@@ -2776,7 +2776,7 @@ static int handle_lan_get_msg_cmd(ipmi_smi_t intf,
2776 spin_unlock_irqrestore(&intf->counter_lock, flags); 2776 spin_unlock_irqrestore(&intf->counter_lock, flags);
2777 2777
2778 recv_msg = ipmi_alloc_recv_msg(); 2778 recv_msg = ipmi_alloc_recv_msg();
2779 if (! recv_msg) { 2779 if (!recv_msg) {
2780 /* We couldn't allocate memory for the 2780 /* We couldn't allocate memory for the
2781 message, so requeue it for handling 2781 message, so requeue it for handling
2782 later. */ 2782 later. */
@@ -2868,13 +2868,14 @@ static int handle_read_event_rsp(ipmi_smi_t intf,
2868 events. */ 2868 events. */
2869 rcu_read_lock(); 2869 rcu_read_lock();
2870 list_for_each_entry_rcu(user, &intf->users, link) { 2870 list_for_each_entry_rcu(user, &intf->users, link) {
2871 if (! user->gets_events) 2871 if (!user->gets_events)
2872 continue; 2872 continue;
2873 2873
2874 recv_msg = ipmi_alloc_recv_msg(); 2874 recv_msg = ipmi_alloc_recv_msg();
2875 if (! recv_msg) { 2875 if (!recv_msg) {
2876 rcu_read_unlock(); 2876 rcu_read_unlock();
2877 list_for_each_entry_safe(recv_msg, recv_msg2, &msgs, link) { 2877 list_for_each_entry_safe(recv_msg, recv_msg2, &msgs,
2878 link) {
2878 list_del(&recv_msg->link); 2879 list_del(&recv_msg->link);
2879 ipmi_free_recv_msg(recv_msg); 2880 ipmi_free_recv_msg(recv_msg);
2880 } 2881 }
@@ -2904,7 +2905,7 @@ static int handle_read_event_rsp(ipmi_smi_t intf,
2904 /* No one to receive the message, put it in queue if there's 2905 /* No one to receive the message, put it in queue if there's
2905 not already too many things in the queue. */ 2906 not already too many things in the queue. */
2906 recv_msg = ipmi_alloc_recv_msg(); 2907 recv_msg = ipmi_alloc_recv_msg();
2907 if (! recv_msg) { 2908 if (!recv_msg) {
2908 /* We couldn't allocate memory for the 2909 /* We couldn't allocate memory for the
2909 message, so requeue it for handling 2910 message, so requeue it for handling
2910 later. */ 2911 later. */
@@ -3189,7 +3190,7 @@ void ipmi_smi_watchdog_pretimeout(ipmi_smi_t intf)
3189 3190
3190 rcu_read_lock(); 3191 rcu_read_lock();
3191 list_for_each_entry_rcu(user, &intf->users, link) { 3192 list_for_each_entry_rcu(user, &intf->users, link) {
3192 if (! user->handler->ipmi_watchdog_pretimeout) 3193 if (!user->handler->ipmi_watchdog_pretimeout)
3193 continue; 3194 continue;
3194 3195
3195 user->handler->ipmi_watchdog_pretimeout(user->handler_data); 3196 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 3278
3278 smi_msg = smi_from_recv_msg(intf, ent->recv_msg, slot, 3279 smi_msg = smi_from_recv_msg(intf, ent->recv_msg, slot,
3279 ent->seqid); 3280 ent->seqid);
3280 if (! smi_msg) 3281 if (!smi_msg)
3281 return; 3282 return;
3282 3283
3283 spin_unlock_irqrestore(&intf->seq_lock, *flags); 3284 spin_unlock_irqrestore(&intf->seq_lock, *flags);
@@ -3313,8 +3314,9 @@ static void ipmi_timeout_handler(long timeout_period)
3313 3314
3314 /* See if any waiting messages need to be processed. */ 3315 /* See if any waiting messages need to be processed. */
3315 spin_lock_irqsave(&intf->waiting_msgs_lock, flags); 3316 spin_lock_irqsave(&intf->waiting_msgs_lock, flags);
3316 list_for_each_entry_safe(smi_msg, smi_msg2, &intf->waiting_msgs, link) { 3317 list_for_each_entry_safe(smi_msg, smi_msg2,
3317 if (! handle_new_recv_msg(intf, smi_msg)) { 3318 &intf->waiting_msgs, link) {
3319 if (!handle_new_recv_msg(intf, smi_msg)) {
3318 list_del(&smi_msg->link); 3320 list_del(&smi_msg->link);
3319 ipmi_free_smi_msg(smi_msg); 3321 ipmi_free_smi_msg(smi_msg);
3320 } else { 3322 } else {
diff --git a/drivers/char/ipmi/ipmi_poweroff.c b/drivers/char/ipmi/ipmi_poweroff.c
index 786a2802ca34..d0b5c08e7b4e 100644
--- a/drivers/char/ipmi/ipmi_poweroff.c
+++ b/drivers/char/ipmi/ipmi_poweroff.c
@@ -346,7 +346,7 @@ static int ipmi_dell_chassis_detect (ipmi_user_t user)
346{ 346{
347 const char ipmi_version_major = ipmi_version & 0xF; 347 const char ipmi_version_major = ipmi_version & 0xF;
348 const char ipmi_version_minor = (ipmi_version >> 4) & 0xF; 348 const char ipmi_version_minor = (ipmi_version >> 4) & 0xF;
349 const char mfr[3]=DELL_IANA_MFR_ID; 349 const char mfr[3] = DELL_IANA_MFR_ID;
350 if (!memcmp(mfr, &mfg_id, sizeof(mfr)) && 350 if (!memcmp(mfr, &mfg_id, sizeof(mfr)) &&
351 ipmi_version_major <= 1 && 351 ipmi_version_major <= 1 &&
352 ipmi_version_minor < 5) 352 ipmi_version_minor < 5)
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index d48d86bd2c2b..2da5845a383a 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -803,7 +803,7 @@ static int ipmi_thread(void *data)
803 set_user_nice(current, 19); 803 set_user_nice(current, 19);
804 while (!kthread_should_stop()) { 804 while (!kthread_should_stop()) {
805 spin_lock_irqsave(&(smi_info->si_lock), flags); 805 spin_lock_irqsave(&(smi_info->si_lock), flags);
806 smi_result=smi_event_handler(smi_info, 0); 806 smi_result = smi_event_handler(smi_info, 0);
807 spin_unlock_irqrestore(&(smi_info->si_lock), flags); 807 spin_unlock_irqrestore(&(smi_info->si_lock), flags);
808 if (smi_result == SI_SM_CALL_WITHOUT_DELAY) { 808 if (smi_result == SI_SM_CALL_WITHOUT_DELAY) {
809 /* do nothing */ 809 /* do nothing */
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c
index 7ece9f3c8f70..2872c9575528 100644
--- a/drivers/char/ipmi/ipmi_watchdog.c
+++ b/drivers/char/ipmi/ipmi_watchdog.c
@@ -589,7 +589,7 @@ static void panic_halt_ipmi_heartbeat(void)
589 1); 589 1);
590} 590}
591 591
592static struct watchdog_info ident= 592static struct watchdog_info ident =
593{ 593{
594 .options = 0, /* WDIOF_SETTIMEOUT, */ 594 .options = 0, /* WDIOF_SETTIMEOUT, */
595 .firmware_version = 1, 595 .firmware_version = 1,
@@ -790,13 +790,13 @@ static int ipmi_fasync(int fd, struct file *file, int on)
790 790
791static int ipmi_close(struct inode *ino, struct file *filep) 791static int ipmi_close(struct inode *ino, struct file *filep)
792{ 792{
793 if (iminor(ino)==WATCHDOG_MINOR) 793 if (iminor(ino) == WATCHDOG_MINOR) {
794 {
795 if (expect_close == 42) { 794 if (expect_close == 42) {
796 ipmi_watchdog_state = WDOG_TIMEOUT_NONE; 795 ipmi_watchdog_state = WDOG_TIMEOUT_NONE;
797 ipmi_set_timeout(IPMI_SET_TIMEOUT_NO_HB); 796 ipmi_set_timeout(IPMI_SET_TIMEOUT_NO_HB);
798 } else { 797 } else {
799 printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n"); 798 printk(KERN_CRIT PFX
799 "Unexpected close, not stopping watchdog!\n");
800 ipmi_heartbeat(); 800 ipmi_heartbeat();
801 } 801 }
802 clear_bit(0, &ipmi_wdog_open); 802 clear_bit(0, &ipmi_wdog_open);