diff options
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/hvcs.c | 2 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_devintf.c | 18 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_kcs_sm.c | 8 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_msghandler.c | 80 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_poweroff.c | 2 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_si_intf.c | 85 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_watchdog.c | 61 | ||||
-rw-r--r-- | drivers/char/istallion.c | 32 | ||||
-rw-r--r-- | drivers/char/keyboard.c | 118 | ||||
-rw-r--r-- | drivers/char/stallion.c | 46 | ||||
-rw-r--r-- | drivers/char/tty_io.c | 2 | ||||
-rw-r--r-- | drivers/char/vt.c | 4 |
12 files changed, 270 insertions, 188 deletions
diff --git a/drivers/char/hvcs.c b/drivers/char/hvcs.c index 327b00c3c45e..8d97b3911293 100644 --- a/drivers/char/hvcs.c +++ b/drivers/char/hvcs.c | |||
@@ -904,7 +904,7 @@ static int hvcs_enable_device(struct hvcs_struct *hvcsd, uint32_t unit_address, | |||
904 | * It is possible the vty-server was removed after the irq was | 904 | * It is possible the vty-server was removed after the irq was |
905 | * requested but before we have time to enable interrupts. | 905 | * requested but before we have time to enable interrupts. |
906 | */ | 906 | */ |
907 | if (vio_enable_interrupts(vdev) == H_Success) | 907 | if (vio_enable_interrupts(vdev) == H_SUCCESS) |
908 | return 0; | 908 | return 0; |
909 | else { | 909 | else { |
910 | printk(KERN_ERR "HVCS: int enable failed for" | 910 | printk(KERN_ERR "HVCS: int enable failed for" |
diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c index 932feedda262..e1c95374984c 100644 --- a/drivers/char/ipmi/ipmi_devintf.c +++ b/drivers/char/ipmi/ipmi_devintf.c | |||
@@ -42,7 +42,7 @@ | |||
42 | #include <linux/slab.h> | 42 | #include <linux/slab.h> |
43 | #include <linux/devfs_fs_kernel.h> | 43 | #include <linux/devfs_fs_kernel.h> |
44 | #include <linux/ipmi.h> | 44 | #include <linux/ipmi.h> |
45 | #include <asm/semaphore.h> | 45 | #include <linux/mutex.h> |
46 | #include <linux/init.h> | 46 | #include <linux/init.h> |
47 | #include <linux/device.h> | 47 | #include <linux/device.h> |
48 | #include <linux/compat.h> | 48 | #include <linux/compat.h> |
@@ -55,7 +55,7 @@ struct ipmi_file_private | |||
55 | struct file *file; | 55 | struct file *file; |
56 | struct fasync_struct *fasync_queue; | 56 | struct fasync_struct *fasync_queue; |
57 | wait_queue_head_t wait; | 57 | wait_queue_head_t wait; |
58 | struct semaphore recv_sem; | 58 | struct mutex recv_mutex; |
59 | int default_retries; | 59 | int default_retries; |
60 | unsigned int default_retry_time_ms; | 60 | unsigned int default_retry_time_ms; |
61 | }; | 61 | }; |
@@ -141,7 +141,7 @@ static int ipmi_open(struct inode *inode, struct file *file) | |||
141 | INIT_LIST_HEAD(&(priv->recv_msgs)); | 141 | INIT_LIST_HEAD(&(priv->recv_msgs)); |
142 | init_waitqueue_head(&priv->wait); | 142 | init_waitqueue_head(&priv->wait); |
143 | priv->fasync_queue = NULL; | 143 | priv->fasync_queue = NULL; |
144 | sema_init(&(priv->recv_sem), 1); | 144 | mutex_init(&priv->recv_mutex); |
145 | 145 | ||
146 | /* Use the low-level defaults. */ | 146 | /* Use the low-level defaults. */ |
147 | priv->default_retries = -1; | 147 | priv->default_retries = -1; |
@@ -285,15 +285,15 @@ static int ipmi_ioctl(struct inode *inode, | |||
285 | break; | 285 | break; |
286 | } | 286 | } |
287 | 287 | ||
288 | /* We claim a semaphore because we don't want two | 288 | /* We claim a mutex because we don't want two |
289 | users getting something from the queue at a time. | 289 | users getting something from the queue at a time. |
290 | Since we have to release the spinlock before we can | 290 | Since we have to release the spinlock before we can |
291 | copy the data to the user, it's possible another | 291 | copy the data to the user, it's possible another |
292 | user will grab something from the queue, too. Then | 292 | user will grab something from the queue, too. Then |
293 | the messages might get out of order if something | 293 | the messages might get out of order if something |
294 | fails and the message gets put back onto the | 294 | fails and the message gets put back onto the |
295 | queue. This semaphore prevents that problem. */ | 295 | queue. This mutex prevents that problem. */ |
296 | down(&(priv->recv_sem)); | 296 | mutex_lock(&priv->recv_mutex); |
297 | 297 | ||
298 | /* Grab the message off the list. */ | 298 | /* Grab the message off the list. */ |
299 | spin_lock_irqsave(&(priv->recv_msg_lock), flags); | 299 | spin_lock_irqsave(&(priv->recv_msg_lock), flags); |
@@ -352,7 +352,7 @@ static int ipmi_ioctl(struct inode *inode, | |||
352 | goto recv_putback_on_err; | 352 | goto recv_putback_on_err; |
353 | } | 353 | } |
354 | 354 | ||
355 | up(&(priv->recv_sem)); | 355 | mutex_unlock(&priv->recv_mutex); |
356 | ipmi_free_recv_msg(msg); | 356 | ipmi_free_recv_msg(msg); |
357 | break; | 357 | break; |
358 | 358 | ||
@@ -362,11 +362,11 @@ static int ipmi_ioctl(struct inode *inode, | |||
362 | spin_lock_irqsave(&(priv->recv_msg_lock), flags); | 362 | spin_lock_irqsave(&(priv->recv_msg_lock), flags); |
363 | list_add(entry, &(priv->recv_msgs)); | 363 | list_add(entry, &(priv->recv_msgs)); |
364 | spin_unlock_irqrestore(&(priv->recv_msg_lock), flags); | 364 | spin_unlock_irqrestore(&(priv->recv_msg_lock), flags); |
365 | up(&(priv->recv_sem)); | 365 | mutex_unlock(&priv->recv_mutex); |
366 | break; | 366 | break; |
367 | 367 | ||
368 | recv_err: | 368 | recv_err: |
369 | up(&(priv->recv_sem)); | 369 | mutex_unlock(&priv->recv_mutex); |
370 | break; | 370 | break; |
371 | } | 371 | } |
372 | 372 | ||
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, | |||
227 | static inline int check_obf(struct si_sm_data *kcs, unsigned char status, | 227 | static 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 40eb005b9d77..0ded046d5aa8 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/sched.h> | 38 | #include <linux/sched.h> |
39 | #include <linux/poll.h> | 39 | #include <linux/poll.h> |
40 | #include <linux/spinlock.h> | 40 | #include <linux/spinlock.h> |
41 | #include <linux/mutex.h> | ||
41 | #include <linux/slab.h> | 42 | #include <linux/slab.h> |
42 | #include <linux/ipmi.h> | 43 | #include <linux/ipmi.h> |
43 | #include <linux/ipmi_smi.h> | 44 | #include <linux/ipmi_smi.h> |
@@ -234,7 +235,7 @@ struct ipmi_smi | |||
234 | 235 | ||
235 | /* The list of command receivers that are registered for commands | 236 | /* The list of command receivers that are registered for commands |
236 | on this interface. */ | 237 | on this interface. */ |
237 | struct semaphore cmd_rcvrs_lock; | 238 | struct mutex cmd_rcvrs_mutex; |
238 | struct list_head cmd_rcvrs; | 239 | struct list_head cmd_rcvrs; |
239 | 240 | ||
240 | /* Events that were queues because no one was there to receive | 241 | /* Events that were queues because no one was there to receive |
@@ -387,10 +388,10 @@ static void clean_up_interface_data(ipmi_smi_t intf) | |||
387 | 388 | ||
388 | /* Wholesale remove all the entries from the list in the | 389 | /* Wholesale remove all the entries from the list in the |
389 | * interface and wait for RCU to know that none are in use. */ | 390 | * interface and wait for RCU to know that none are in use. */ |
390 | down(&intf->cmd_rcvrs_lock); | 391 | mutex_lock(&intf->cmd_rcvrs_mutex); |
391 | list_add_rcu(&list, &intf->cmd_rcvrs); | 392 | list_add_rcu(&list, &intf->cmd_rcvrs); |
392 | list_del_rcu(&intf->cmd_rcvrs); | 393 | list_del_rcu(&intf->cmd_rcvrs); |
393 | up(&intf->cmd_rcvrs_lock); | 394 | mutex_unlock(&intf->cmd_rcvrs_mutex); |
394 | synchronize_rcu(); | 395 | synchronize_rcu(); |
395 | 396 | ||
396 | list_for_each_entry_safe(rcvr, rcvr2, &list, link) | 397 | list_for_each_entry_safe(rcvr, rcvr2, &list, link) |
@@ -557,7 +558,7 @@ unsigned int ipmi_addr_length(int addr_type) | |||
557 | 558 | ||
558 | static void deliver_response(struct ipmi_recv_msg *msg) | 559 | static void deliver_response(struct ipmi_recv_msg *msg) |
559 | { | 560 | { |
560 | if (! msg->user) { | 561 | if (!msg->user) { |
561 | ipmi_smi_t intf = msg->user_msg_data; | 562 | ipmi_smi_t intf = msg->user_msg_data; |
562 | unsigned long flags; | 563 | unsigned long flags; |
563 | 564 | ||
@@ -598,11 +599,11 @@ static int intf_next_seq(ipmi_smi_t intf, | |||
598 | (i+1)%IPMI_IPMB_NUM_SEQ != intf->curr_seq; | 599 | (i+1)%IPMI_IPMB_NUM_SEQ != intf->curr_seq; |
599 | i = (i+1)%IPMI_IPMB_NUM_SEQ) | 600 | i = (i+1)%IPMI_IPMB_NUM_SEQ) |
600 | { | 601 | { |
601 | if (! intf->seq_table[i].inuse) | 602 | if (!intf->seq_table[i].inuse) |
602 | break; | 603 | break; |
603 | } | 604 | } |
604 | 605 | ||
605 | if (! intf->seq_table[i].inuse) { | 606 | if (!intf->seq_table[i].inuse) { |
606 | intf->seq_table[i].recv_msg = recv_msg; | 607 | intf->seq_table[i].recv_msg = recv_msg; |
607 | 608 | ||
608 | /* Start with the maximum timeout, when the send response | 609 | /* Start with the maximum timeout, when the send response |
@@ -763,7 +764,7 @@ int ipmi_create_user(unsigned int if_num, | |||
763 | } | 764 | } |
764 | 765 | ||
765 | new_user = kmalloc(sizeof(*new_user), GFP_KERNEL); | 766 | new_user = kmalloc(sizeof(*new_user), GFP_KERNEL); |
766 | if (! new_user) | 767 | if (!new_user) |
767 | return -ENOMEM; | 768 | return -ENOMEM; |
768 | 769 | ||
769 | spin_lock_irqsave(&interfaces_lock, flags); | 770 | spin_lock_irqsave(&interfaces_lock, flags); |
@@ -819,14 +820,13 @@ static void free_user(struct kref *ref) | |||
819 | 820 | ||
820 | int ipmi_destroy_user(ipmi_user_t user) | 821 | int ipmi_destroy_user(ipmi_user_t user) |
821 | { | 822 | { |
822 | int rv = -ENODEV; | ||
823 | ipmi_smi_t intf = user->intf; | 823 | ipmi_smi_t intf = user->intf; |
824 | int i; | 824 | int i; |
825 | unsigned long flags; | 825 | unsigned long flags; |
826 | struct cmd_rcvr *rcvr; | 826 | struct cmd_rcvr *rcvr; |
827 | struct cmd_rcvr *rcvrs = NULL; | 827 | struct cmd_rcvr *rcvrs = NULL; |
828 | 828 | ||
829 | user->valid = 1; | 829 | user->valid = 0; |
830 | 830 | ||
831 | /* Remove the user from the interface's sequence table. */ | 831 | /* Remove the user from the interface's sequence table. */ |
832 | spin_lock_irqsave(&intf->seq_lock, flags); | 832 | spin_lock_irqsave(&intf->seq_lock, flags); |
@@ -847,7 +847,7 @@ int ipmi_destroy_user(ipmi_user_t user) | |||
847 | * since other things may be using it till we do | 847 | * since other things may be using it till we do |
848 | * synchronize_rcu()) then free everything in that list. | 848 | * synchronize_rcu()) then free everything in that list. |
849 | */ | 849 | */ |
850 | down(&intf->cmd_rcvrs_lock); | 850 | mutex_lock(&intf->cmd_rcvrs_mutex); |
851 | list_for_each_entry_rcu(rcvr, &intf->cmd_rcvrs, link) { | 851 | list_for_each_entry_rcu(rcvr, &intf->cmd_rcvrs, link) { |
852 | if (rcvr->user == user) { | 852 | if (rcvr->user == user) { |
853 | list_del_rcu(&rcvr->link); | 853 | list_del_rcu(&rcvr->link); |
@@ -855,7 +855,7 @@ int ipmi_destroy_user(ipmi_user_t user) | |||
855 | rcvrs = rcvr; | 855 | rcvrs = rcvr; |
856 | } | 856 | } |
857 | } | 857 | } |
858 | up(&intf->cmd_rcvrs_lock); | 858 | mutex_unlock(&intf->cmd_rcvrs_mutex); |
859 | synchronize_rcu(); | 859 | synchronize_rcu(); |
860 | while (rcvrs) { | 860 | while (rcvrs) { |
861 | rcvr = rcvrs; | 861 | rcvr = rcvrs; |
@@ -871,7 +871,7 @@ int ipmi_destroy_user(ipmi_user_t user) | |||
871 | 871 | ||
872 | kref_put(&user->refcount, free_user); | 872 | kref_put(&user->refcount, free_user); |
873 | 873 | ||
874 | return rv; | 874 | return 0; |
875 | } | 875 | } |
876 | 876 | ||
877 | void ipmi_get_version(ipmi_user_t user, | 877 | void ipmi_get_version(ipmi_user_t user, |
@@ -936,7 +936,8 @@ int ipmi_set_gets_events(ipmi_user_t user, int val) | |||
936 | 936 | ||
937 | if (val) { | 937 | if (val) { |
938 | /* Deliver any queued events. */ | 938 | /* Deliver any queued events. */ |
939 | list_for_each_entry_safe(msg, msg2, &intf->waiting_events, link) { | 939 | list_for_each_entry_safe(msg, msg2, &intf->waiting_events, |
940 | link) { | ||
940 | list_del(&msg->link); | 941 | list_del(&msg->link); |
941 | list_add_tail(&msg->link, &msgs); | 942 | list_add_tail(&msg->link, &msgs); |
942 | } | 943 | } |
@@ -978,13 +979,13 @@ int ipmi_register_for_cmd(ipmi_user_t user, | |||
978 | 979 | ||
979 | 980 | ||
980 | rcvr = kmalloc(sizeof(*rcvr), GFP_KERNEL); | 981 | rcvr = kmalloc(sizeof(*rcvr), GFP_KERNEL); |
981 | if (! rcvr) | 982 | if (!rcvr) |
982 | return -ENOMEM; | 983 | return -ENOMEM; |
983 | rcvr->cmd = cmd; | 984 | rcvr->cmd = cmd; |
984 | rcvr->netfn = netfn; | 985 | rcvr->netfn = netfn; |
985 | rcvr->user = user; | 986 | rcvr->user = user; |
986 | 987 | ||
987 | down(&intf->cmd_rcvrs_lock); | 988 | mutex_lock(&intf->cmd_rcvrs_mutex); |
988 | /* Make sure the command/netfn is not already registered. */ | 989 | /* Make sure the command/netfn is not already registered. */ |
989 | entry = find_cmd_rcvr(intf, netfn, cmd); | 990 | entry = find_cmd_rcvr(intf, netfn, cmd); |
990 | if (entry) { | 991 | if (entry) { |
@@ -995,7 +996,7 @@ int ipmi_register_for_cmd(ipmi_user_t user, | |||
995 | list_add_rcu(&rcvr->link, &intf->cmd_rcvrs); | 996 | list_add_rcu(&rcvr->link, &intf->cmd_rcvrs); |
996 | 997 | ||
997 | out_unlock: | 998 | out_unlock: |
998 | up(&intf->cmd_rcvrs_lock); | 999 | mutex_unlock(&intf->cmd_rcvrs_mutex); |
999 | if (rv) | 1000 | if (rv) |
1000 | kfree(rcvr); | 1001 | kfree(rcvr); |
1001 | 1002 | ||
@@ -1009,17 +1010,17 @@ int ipmi_unregister_for_cmd(ipmi_user_t user, | |||
1009 | ipmi_smi_t intf = user->intf; | 1010 | ipmi_smi_t intf = user->intf; |
1010 | struct cmd_rcvr *rcvr; | 1011 | struct cmd_rcvr *rcvr; |
1011 | 1012 | ||
1012 | down(&intf->cmd_rcvrs_lock); | 1013 | mutex_lock(&intf->cmd_rcvrs_mutex); |
1013 | /* Make sure the command/netfn is not already registered. */ | 1014 | /* Make sure the command/netfn is not already registered. */ |
1014 | rcvr = find_cmd_rcvr(intf, netfn, cmd); | 1015 | rcvr = find_cmd_rcvr(intf, netfn, cmd); |
1015 | if ((rcvr) && (rcvr->user == user)) { | 1016 | if ((rcvr) && (rcvr->user == user)) { |
1016 | list_del_rcu(&rcvr->link); | 1017 | list_del_rcu(&rcvr->link); |
1017 | up(&intf->cmd_rcvrs_lock); | 1018 | mutex_unlock(&intf->cmd_rcvrs_mutex); |
1018 | synchronize_rcu(); | 1019 | synchronize_rcu(); |
1019 | kfree(rcvr); | 1020 | kfree(rcvr); |
1020 | return 0; | 1021 | return 0; |
1021 | } else { | 1022 | } else { |
1022 | up(&intf->cmd_rcvrs_lock); | 1023 | mutex_unlock(&intf->cmd_rcvrs_mutex); |
1023 | return -ENOENT; | 1024 | return -ENOENT; |
1024 | } | 1025 | } |
1025 | } | 1026 | } |
@@ -1514,7 +1515,7 @@ int ipmi_request_settime(ipmi_user_t user, | |||
1514 | unsigned char saddr, lun; | 1515 | unsigned char saddr, lun; |
1515 | int rv; | 1516 | int rv; |
1516 | 1517 | ||
1517 | if (! user) | 1518 | if (!user) |
1518 | return -EINVAL; | 1519 | return -EINVAL; |
1519 | rv = check_addr(user->intf, addr, &saddr, &lun); | 1520 | rv = check_addr(user->intf, addr, &saddr, &lun); |
1520 | if (rv) | 1521 | if (rv) |
@@ -1545,7 +1546,7 @@ int ipmi_request_supply_msgs(ipmi_user_t user, | |||
1545 | unsigned char saddr, lun; | 1546 | unsigned char saddr, lun; |
1546 | int rv; | 1547 | int rv; |
1547 | 1548 | ||
1548 | if (! user) | 1549 | if (!user) |
1549 | return -EINVAL; | 1550 | return -EINVAL; |
1550 | rv = check_addr(user->intf, addr, &saddr, &lun); | 1551 | rv = check_addr(user->intf, addr, &saddr, &lun); |
1551 | if (rv) | 1552 | if (rv) |
@@ -1570,7 +1571,7 @@ static int ipmb_file_read_proc(char *page, char **start, off_t off, | |||
1570 | char *out = (char *) page; | 1571 | char *out = (char *) page; |
1571 | ipmi_smi_t intf = data; | 1572 | ipmi_smi_t intf = data; |
1572 | int i; | 1573 | int i; |
1573 | int rv= 0; | 1574 | int rv = 0; |
1574 | 1575 | ||
1575 | for (i = 0; i < IPMI_MAX_CHANNELS; i++) | 1576 | for (i = 0; i < IPMI_MAX_CHANNELS; i++) |
1576 | rv += sprintf(out+rv, "%x ", intf->channels[i].address); | 1577 | rv += sprintf(out+rv, "%x ", intf->channels[i].address); |
@@ -1989,7 +1990,7 @@ static int ipmi_bmc_register(ipmi_smi_t intf) | |||
1989 | } else { | 1990 | } else { |
1990 | bmc->dev = platform_device_alloc("ipmi_bmc", | 1991 | bmc->dev = platform_device_alloc("ipmi_bmc", |
1991 | bmc->id.device_id); | 1992 | bmc->id.device_id); |
1992 | if (! bmc->dev) { | 1993 | if (!bmc->dev) { |
1993 | printk(KERN_ERR | 1994 | printk(KERN_ERR |
1994 | "ipmi_msghandler:" | 1995 | "ipmi_msghandler:" |
1995 | " Unable to allocate platform device\n"); | 1996 | " Unable to allocate platform device\n"); |
@@ -2305,8 +2306,7 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers, | |||
2305 | void *send_info, | 2306 | void *send_info, |
2306 | struct ipmi_device_id *device_id, | 2307 | struct ipmi_device_id *device_id, |
2307 | struct device *si_dev, | 2308 | struct device *si_dev, |
2308 | unsigned char slave_addr, | 2309 | unsigned char slave_addr) |
2309 | ipmi_smi_t *new_intf) | ||
2310 | { | 2310 | { |
2311 | int i, j; | 2311 | int i, j; |
2312 | int rv; | 2312 | int rv; |
@@ -2366,7 +2366,7 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers, | |||
2366 | spin_lock_init(&intf->events_lock); | 2366 | spin_lock_init(&intf->events_lock); |
2367 | INIT_LIST_HEAD(&intf->waiting_events); | 2367 | INIT_LIST_HEAD(&intf->waiting_events); |
2368 | intf->waiting_events_count = 0; | 2368 | intf->waiting_events_count = 0; |
2369 | init_MUTEX(&intf->cmd_rcvrs_lock); | 2369 | mutex_init(&intf->cmd_rcvrs_mutex); |
2370 | INIT_LIST_HEAD(&intf->cmd_rcvrs); | 2370 | INIT_LIST_HEAD(&intf->cmd_rcvrs); |
2371 | init_waitqueue_head(&intf->waitq); | 2371 | init_waitqueue_head(&intf->waitq); |
2372 | 2372 | ||
@@ -2388,9 +2388,9 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers, | |||
2388 | if (rv) | 2388 | if (rv) |
2389 | goto out; | 2389 | goto out; |
2390 | 2390 | ||
2391 | /* FIXME - this is an ugly kludge, this sets the intf for the | 2391 | rv = handlers->start_processing(send_info, intf); |
2392 | caller before sending any messages with it. */ | 2392 | if (rv) |
2393 | *new_intf = intf; | 2393 | goto out; |
2394 | 2394 | ||
2395 | get_guid(intf); | 2395 | get_guid(intf); |
2396 | 2396 | ||
@@ -2622,7 +2622,7 @@ static int handle_ipmb_get_msg_cmd(ipmi_smi_t intf, | |||
2622 | spin_unlock_irqrestore(&intf->counter_lock, flags); | 2622 | spin_unlock_irqrestore(&intf->counter_lock, flags); |
2623 | 2623 | ||
2624 | recv_msg = ipmi_alloc_recv_msg(); | 2624 | recv_msg = ipmi_alloc_recv_msg(); |
2625 | if (! recv_msg) { | 2625 | if (!recv_msg) { |
2626 | /* We couldn't allocate memory for the | 2626 | /* We couldn't allocate memory for the |
2627 | message, so requeue it for handling | 2627 | message, so requeue it for handling |
2628 | later. */ | 2628 | later. */ |
@@ -2777,7 +2777,7 @@ static int handle_lan_get_msg_cmd(ipmi_smi_t intf, | |||
2777 | spin_unlock_irqrestore(&intf->counter_lock, flags); | 2777 | spin_unlock_irqrestore(&intf->counter_lock, flags); |
2778 | 2778 | ||
2779 | recv_msg = ipmi_alloc_recv_msg(); | 2779 | recv_msg = ipmi_alloc_recv_msg(); |
2780 | if (! recv_msg) { | 2780 | if (!recv_msg) { |
2781 | /* We couldn't allocate memory for the | 2781 | /* We couldn't allocate memory for the |
2782 | message, so requeue it for handling | 2782 | message, so requeue it for handling |
2783 | later. */ | 2783 | later. */ |
@@ -2869,13 +2869,14 @@ static int handle_read_event_rsp(ipmi_smi_t intf, | |||
2869 | events. */ | 2869 | events. */ |
2870 | rcu_read_lock(); | 2870 | rcu_read_lock(); |
2871 | list_for_each_entry_rcu(user, &intf->users, link) { | 2871 | list_for_each_entry_rcu(user, &intf->users, link) { |
2872 | if (! user->gets_events) | 2872 | if (!user->gets_events) |
2873 | continue; | 2873 | continue; |
2874 | 2874 | ||
2875 | recv_msg = ipmi_alloc_recv_msg(); | 2875 | recv_msg = ipmi_alloc_recv_msg(); |
2876 | if (! recv_msg) { | 2876 | if (!recv_msg) { |
2877 | rcu_read_unlock(); | 2877 | rcu_read_unlock(); |
2878 | list_for_each_entry_safe(recv_msg, recv_msg2, &msgs, link) { | 2878 | list_for_each_entry_safe(recv_msg, recv_msg2, &msgs, |
2879 | link) { | ||
2879 | list_del(&recv_msg->link); | 2880 | list_del(&recv_msg->link); |
2880 | ipmi_free_recv_msg(recv_msg); | 2881 | ipmi_free_recv_msg(recv_msg); |
2881 | } | 2882 | } |
@@ -2905,7 +2906,7 @@ static int handle_read_event_rsp(ipmi_smi_t intf, | |||
2905 | /* No one to receive the message, put it in queue if there's | 2906 | /* No one to receive the message, put it in queue if there's |
2906 | not already too many things in the queue. */ | 2907 | not already too many things in the queue. */ |
2907 | recv_msg = ipmi_alloc_recv_msg(); | 2908 | recv_msg = ipmi_alloc_recv_msg(); |
2908 | if (! recv_msg) { | 2909 | if (!recv_msg) { |
2909 | /* We couldn't allocate memory for the | 2910 | /* We couldn't allocate memory for the |
2910 | message, so requeue it for handling | 2911 | message, so requeue it for handling |
2911 | later. */ | 2912 | later. */ |
@@ -3190,7 +3191,7 @@ void ipmi_smi_watchdog_pretimeout(ipmi_smi_t intf) | |||
3190 | 3191 | ||
3191 | rcu_read_lock(); | 3192 | rcu_read_lock(); |
3192 | list_for_each_entry_rcu(user, &intf->users, link) { | 3193 | list_for_each_entry_rcu(user, &intf->users, link) { |
3193 | if (! user->handler->ipmi_watchdog_pretimeout) | 3194 | if (!user->handler->ipmi_watchdog_pretimeout) |
3194 | continue; | 3195 | continue; |
3195 | 3196 | ||
3196 | user->handler->ipmi_watchdog_pretimeout(user->handler_data); | 3197 | user->handler->ipmi_watchdog_pretimeout(user->handler_data); |
@@ -3278,7 +3279,7 @@ static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent, | |||
3278 | 3279 | ||
3279 | smi_msg = smi_from_recv_msg(intf, ent->recv_msg, slot, | 3280 | smi_msg = smi_from_recv_msg(intf, ent->recv_msg, slot, |
3280 | ent->seqid); | 3281 | ent->seqid); |
3281 | if (! smi_msg) | 3282 | if (!smi_msg) |
3282 | return; | 3283 | return; |
3283 | 3284 | ||
3284 | spin_unlock_irqrestore(&intf->seq_lock, *flags); | 3285 | spin_unlock_irqrestore(&intf->seq_lock, *flags); |
@@ -3314,8 +3315,9 @@ static void ipmi_timeout_handler(long timeout_period) | |||
3314 | 3315 | ||
3315 | /* See if any waiting messages need to be processed. */ | 3316 | /* See if any waiting messages need to be processed. */ |
3316 | spin_lock_irqsave(&intf->waiting_msgs_lock, flags); | 3317 | spin_lock_irqsave(&intf->waiting_msgs_lock, flags); |
3317 | list_for_each_entry_safe(smi_msg, smi_msg2, &intf->waiting_msgs, link) { | 3318 | list_for_each_entry_safe(smi_msg, smi_msg2, |
3318 | if (! handle_new_recv_msg(intf, smi_msg)) { | 3319 | &intf->waiting_msgs, link) { |
3320 | if (!handle_new_recv_msg(intf, smi_msg)) { | ||
3319 | list_del(&smi_msg->link); | 3321 | list_del(&smi_msg->link); |
3320 | ipmi_free_smi_msg(smi_msg); | 3322 | ipmi_free_smi_msg(smi_msg); |
3321 | } else { | 3323 | } 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 35fbd4d8ed4b..a86c0f29953e 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 */ |
@@ -972,10 +972,37 @@ static irqreturn_t si_bt_irq_handler(int irq, void *data, struct pt_regs *regs) | |||
972 | return si_irq_handler(irq, data, regs); | 972 | return si_irq_handler(irq, data, regs); |
973 | } | 973 | } |
974 | 974 | ||
975 | static int smi_start_processing(void *send_info, | ||
976 | ipmi_smi_t intf) | ||
977 | { | ||
978 | struct smi_info *new_smi = send_info; | ||
979 | |||
980 | new_smi->intf = intf; | ||
981 | |||
982 | /* Set up the timer that drives the interface. */ | ||
983 | setup_timer(&new_smi->si_timer, smi_timeout, (long)new_smi); | ||
984 | new_smi->last_timeout_jiffies = jiffies; | ||
985 | mod_timer(&new_smi->si_timer, jiffies + SI_TIMEOUT_JIFFIES); | ||
986 | |||
987 | if (new_smi->si_type != SI_BT) { | ||
988 | new_smi->thread = kthread_run(ipmi_thread, new_smi, | ||
989 | "kipmi%d", new_smi->intf_num); | ||
990 | if (IS_ERR(new_smi->thread)) { | ||
991 | printk(KERN_NOTICE "ipmi_si_intf: Could not start" | ||
992 | " kernel thread due to error %ld, only using" | ||
993 | " timers to drive the interface\n", | ||
994 | PTR_ERR(new_smi->thread)); | ||
995 | new_smi->thread = NULL; | ||
996 | } | ||
997 | } | ||
998 | |||
999 | return 0; | ||
1000 | } | ||
975 | 1001 | ||
976 | static struct ipmi_smi_handlers handlers = | 1002 | static struct ipmi_smi_handlers handlers = |
977 | { | 1003 | { |
978 | .owner = THIS_MODULE, | 1004 | .owner = THIS_MODULE, |
1005 | .start_processing = smi_start_processing, | ||
979 | .sender = sender, | 1006 | .sender = sender, |
980 | .request_events = request_events, | 1007 | .request_events = request_events, |
981 | .set_run_to_completion = set_run_to_completion, | 1008 | .set_run_to_completion = set_run_to_completion, |
@@ -987,7 +1014,7 @@ static struct ipmi_smi_handlers handlers = | |||
987 | 1014 | ||
988 | #define SI_MAX_PARMS 4 | 1015 | #define SI_MAX_PARMS 4 |
989 | static LIST_HEAD(smi_infos); | 1016 | static LIST_HEAD(smi_infos); |
990 | static DECLARE_MUTEX(smi_infos_lock); | 1017 | static DEFINE_MUTEX(smi_infos_lock); |
991 | static int smi_num; /* Used to sequence the SMIs */ | 1018 | static int smi_num; /* Used to sequence the SMIs */ |
992 | 1019 | ||
993 | #define DEFAULT_REGSPACING 1 | 1020 | #define DEFAULT_REGSPACING 1 |
@@ -2162,9 +2189,13 @@ static void setup_xaction_handlers(struct smi_info *smi_info) | |||
2162 | 2189 | ||
2163 | static inline void wait_for_timer_and_thread(struct smi_info *smi_info) | 2190 | static inline void wait_for_timer_and_thread(struct smi_info *smi_info) |
2164 | { | 2191 | { |
2165 | if (smi_info->thread != NULL && smi_info->thread != ERR_PTR(-ENOMEM)) | 2192 | if (smi_info->intf) { |
2166 | kthread_stop(smi_info->thread); | 2193 | /* The timer and thread are only running if the |
2167 | del_timer_sync(&smi_info->si_timer); | 2194 | interface has been started up and registered. */ |
2195 | if (smi_info->thread != NULL) | ||
2196 | kthread_stop(smi_info->thread); | ||
2197 | del_timer_sync(&smi_info->si_timer); | ||
2198 | } | ||
2168 | } | 2199 | } |
2169 | 2200 | ||
2170 | static struct ipmi_default_vals | 2201 | static struct ipmi_default_vals |
@@ -2245,7 +2276,7 @@ static int try_smi_init(struct smi_info *new_smi) | |||
2245 | new_smi->slave_addr, new_smi->irq); | 2276 | new_smi->slave_addr, new_smi->irq); |
2246 | } | 2277 | } |
2247 | 2278 | ||
2248 | down(&smi_infos_lock); | 2279 | mutex_lock(&smi_infos_lock); |
2249 | if (!is_new_interface(new_smi)) { | 2280 | if (!is_new_interface(new_smi)) { |
2250 | printk(KERN_WARNING "ipmi_si: duplicate interface\n"); | 2281 | printk(KERN_WARNING "ipmi_si: duplicate interface\n"); |
2251 | rv = -EBUSY; | 2282 | rv = -EBUSY; |
@@ -2341,21 +2372,6 @@ static int try_smi_init(struct smi_info *new_smi) | |||
2341 | if (new_smi->irq) | 2372 | if (new_smi->irq) |
2342 | new_smi->si_state = SI_CLEARING_FLAGS_THEN_SET_IRQ; | 2373 | new_smi->si_state = SI_CLEARING_FLAGS_THEN_SET_IRQ; |
2343 | 2374 | ||
2344 | /* The ipmi_register_smi() code does some operations to | ||
2345 | determine the channel information, so we must be ready to | ||
2346 | handle operations before it is called. This means we have | ||
2347 | to stop the timer if we get an error after this point. */ | ||
2348 | init_timer(&(new_smi->si_timer)); | ||
2349 | new_smi->si_timer.data = (long) new_smi; | ||
2350 | new_smi->si_timer.function = smi_timeout; | ||
2351 | new_smi->last_timeout_jiffies = jiffies; | ||
2352 | new_smi->si_timer.expires = jiffies + SI_TIMEOUT_JIFFIES; | ||
2353 | |||
2354 | add_timer(&(new_smi->si_timer)); | ||
2355 | if (new_smi->si_type != SI_BT) | ||
2356 | new_smi->thread = kthread_run(ipmi_thread, new_smi, | ||
2357 | "kipmi%d", new_smi->intf_num); | ||
2358 | |||
2359 | if (!new_smi->dev) { | 2375 | if (!new_smi->dev) { |
2360 | /* If we don't already have a device from something | 2376 | /* If we don't already have a device from something |
2361 | * else (like PCI), then register a new one. */ | 2377 | * else (like PCI), then register a new one. */ |
@@ -2365,7 +2381,7 @@ static int try_smi_init(struct smi_info *new_smi) | |||
2365 | printk(KERN_ERR | 2381 | printk(KERN_ERR |
2366 | "ipmi_si_intf:" | 2382 | "ipmi_si_intf:" |
2367 | " Unable to allocate platform device\n"); | 2383 | " Unable to allocate platform device\n"); |
2368 | goto out_err_stop_timer; | 2384 | goto out_err; |
2369 | } | 2385 | } |
2370 | new_smi->dev = &new_smi->pdev->dev; | 2386 | new_smi->dev = &new_smi->pdev->dev; |
2371 | new_smi->dev->driver = &ipmi_driver; | 2387 | new_smi->dev->driver = &ipmi_driver; |
@@ -2377,7 +2393,7 @@ static int try_smi_init(struct smi_info *new_smi) | |||
2377 | " Unable to register system interface device:" | 2393 | " Unable to register system interface device:" |
2378 | " %d\n", | 2394 | " %d\n", |
2379 | rv); | 2395 | rv); |
2380 | goto out_err_stop_timer; | 2396 | goto out_err; |
2381 | } | 2397 | } |
2382 | new_smi->dev_registered = 1; | 2398 | new_smi->dev_registered = 1; |
2383 | } | 2399 | } |
@@ -2386,8 +2402,7 @@ static int try_smi_init(struct smi_info *new_smi) | |||
2386 | new_smi, | 2402 | new_smi, |
2387 | &new_smi->device_id, | 2403 | &new_smi->device_id, |
2388 | new_smi->dev, | 2404 | new_smi->dev, |
2389 | new_smi->slave_addr, | 2405 | new_smi->slave_addr); |
2390 | &(new_smi->intf)); | ||
2391 | if (rv) { | 2406 | if (rv) { |
2392 | printk(KERN_ERR | 2407 | printk(KERN_ERR |
2393 | "ipmi_si: Unable to register device: error %d\n", | 2408 | "ipmi_si: Unable to register device: error %d\n", |
@@ -2417,7 +2432,7 @@ static int try_smi_init(struct smi_info *new_smi) | |||
2417 | 2432 | ||
2418 | list_add_tail(&new_smi->link, &smi_infos); | 2433 | list_add_tail(&new_smi->link, &smi_infos); |
2419 | 2434 | ||
2420 | up(&smi_infos_lock); | 2435 | mutex_unlock(&smi_infos_lock); |
2421 | 2436 | ||
2422 | printk(" IPMI %s interface initialized\n",si_to_str[new_smi->si_type]); | 2437 | printk(" IPMI %s interface initialized\n",si_to_str[new_smi->si_type]); |
2423 | 2438 | ||
@@ -2454,7 +2469,7 @@ static int try_smi_init(struct smi_info *new_smi) | |||
2454 | 2469 | ||
2455 | kfree(new_smi); | 2470 | kfree(new_smi); |
2456 | 2471 | ||
2457 | up(&smi_infos_lock); | 2472 | mutex_unlock(&smi_infos_lock); |
2458 | 2473 | ||
2459 | return rv; | 2474 | return rv; |
2460 | } | 2475 | } |
@@ -2512,26 +2527,26 @@ static __devinit int init_ipmi_si(void) | |||
2512 | #endif | 2527 | #endif |
2513 | 2528 | ||
2514 | if (si_trydefaults) { | 2529 | if (si_trydefaults) { |
2515 | down(&smi_infos_lock); | 2530 | mutex_lock(&smi_infos_lock); |
2516 | if (list_empty(&smi_infos)) { | 2531 | if (list_empty(&smi_infos)) { |
2517 | /* No BMC was found, try defaults. */ | 2532 | /* No BMC was found, try defaults. */ |
2518 | up(&smi_infos_lock); | 2533 | mutex_unlock(&smi_infos_lock); |
2519 | default_find_bmc(); | 2534 | default_find_bmc(); |
2520 | } else { | 2535 | } else { |
2521 | up(&smi_infos_lock); | 2536 | mutex_unlock(&smi_infos_lock); |
2522 | } | 2537 | } |
2523 | } | 2538 | } |
2524 | 2539 | ||
2525 | down(&smi_infos_lock); | 2540 | mutex_lock(&smi_infos_lock); |
2526 | if (list_empty(&smi_infos)) { | 2541 | if (list_empty(&smi_infos)) { |
2527 | up(&smi_infos_lock); | 2542 | mutex_unlock(&smi_infos_lock); |
2528 | #ifdef CONFIG_PCI | 2543 | #ifdef CONFIG_PCI |
2529 | pci_unregister_driver(&ipmi_pci_driver); | 2544 | pci_unregister_driver(&ipmi_pci_driver); |
2530 | #endif | 2545 | #endif |
2531 | printk("ipmi_si: Unable to find any System Interface(s)\n"); | 2546 | printk("ipmi_si: Unable to find any System Interface(s)\n"); |
2532 | return -ENODEV; | 2547 | return -ENODEV; |
2533 | } else { | 2548 | } else { |
2534 | up(&smi_infos_lock); | 2549 | mutex_unlock(&smi_infos_lock); |
2535 | return 0; | 2550 | return 0; |
2536 | } | 2551 | } |
2537 | } | 2552 | } |
@@ -2607,10 +2622,10 @@ static __exit void cleanup_ipmi_si(void) | |||
2607 | pci_unregister_driver(&ipmi_pci_driver); | 2622 | pci_unregister_driver(&ipmi_pci_driver); |
2608 | #endif | 2623 | #endif |
2609 | 2624 | ||
2610 | down(&smi_infos_lock); | 2625 | mutex_lock(&smi_infos_lock); |
2611 | list_for_each_entry_safe(e, tmp_e, &smi_infos, link) | 2626 | list_for_each_entry_safe(e, tmp_e, &smi_infos, link) |
2612 | cleanup_one_si(e); | 2627 | cleanup_one_si(e); |
2613 | up(&smi_infos_lock); | 2628 | mutex_unlock(&smi_infos_lock); |
2614 | 2629 | ||
2615 | driver_unregister(&ipmi_driver); | 2630 | driver_unregister(&ipmi_driver); |
2616 | } | 2631 | } |
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c index 7ece9f3c8f70..2d11ddd99e55 100644 --- a/drivers/char/ipmi/ipmi_watchdog.c +++ b/drivers/char/ipmi/ipmi_watchdog.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/watchdog.h> | 39 | #include <linux/watchdog.h> |
40 | #include <linux/miscdevice.h> | 40 | #include <linux/miscdevice.h> |
41 | #include <linux/init.h> | 41 | #include <linux/init.h> |
42 | #include <linux/completion.h> | ||
42 | #include <linux/rwsem.h> | 43 | #include <linux/rwsem.h> |
43 | #include <linux/errno.h> | 44 | #include <linux/errno.h> |
44 | #include <asm/uaccess.h> | 45 | #include <asm/uaccess.h> |
@@ -303,21 +304,22 @@ static int ipmi_heartbeat(void); | |||
303 | static void panic_halt_ipmi_heartbeat(void); | 304 | static void panic_halt_ipmi_heartbeat(void); |
304 | 305 | ||
305 | 306 | ||
306 | /* We use a semaphore to make sure that only one thing can send a set | 307 | /* We use a mutex to make sure that only one thing can send a set |
307 | timeout at one time, because we only have one copy of the data. | 308 | timeout at one time, because we only have one copy of the data. |
308 | The semaphore is claimed when the set_timeout is sent and freed | 309 | The mutex is claimed when the set_timeout is sent and freed |
309 | when both messages are free. */ | 310 | when both messages are free. */ |
310 | static atomic_t set_timeout_tofree = ATOMIC_INIT(0); | 311 | static atomic_t set_timeout_tofree = ATOMIC_INIT(0); |
311 | static DECLARE_MUTEX(set_timeout_lock); | 312 | static DEFINE_MUTEX(set_timeout_lock); |
313 | static DECLARE_COMPLETION(set_timeout_wait); | ||
312 | static void set_timeout_free_smi(struct ipmi_smi_msg *msg) | 314 | static void set_timeout_free_smi(struct ipmi_smi_msg *msg) |
313 | { | 315 | { |
314 | if (atomic_dec_and_test(&set_timeout_tofree)) | 316 | if (atomic_dec_and_test(&set_timeout_tofree)) |
315 | up(&set_timeout_lock); | 317 | complete(&set_timeout_wait); |
316 | } | 318 | } |
317 | static void set_timeout_free_recv(struct ipmi_recv_msg *msg) | 319 | static void set_timeout_free_recv(struct ipmi_recv_msg *msg) |
318 | { | 320 | { |
319 | if (atomic_dec_and_test(&set_timeout_tofree)) | 321 | if (atomic_dec_and_test(&set_timeout_tofree)) |
320 | up(&set_timeout_lock); | 322 | complete(&set_timeout_wait); |
321 | } | 323 | } |
322 | static struct ipmi_smi_msg set_timeout_smi_msg = | 324 | static struct ipmi_smi_msg set_timeout_smi_msg = |
323 | { | 325 | { |
@@ -399,7 +401,7 @@ static int ipmi_set_timeout(int do_heartbeat) | |||
399 | 401 | ||
400 | 402 | ||
401 | /* We can only send one of these at a time. */ | 403 | /* We can only send one of these at a time. */ |
402 | down(&set_timeout_lock); | 404 | mutex_lock(&set_timeout_lock); |
403 | 405 | ||
404 | atomic_set(&set_timeout_tofree, 2); | 406 | atomic_set(&set_timeout_tofree, 2); |
405 | 407 | ||
@@ -407,16 +409,21 @@ static int ipmi_set_timeout(int do_heartbeat) | |||
407 | &set_timeout_recv_msg, | 409 | &set_timeout_recv_msg, |
408 | &send_heartbeat_now); | 410 | &send_heartbeat_now); |
409 | if (rv) { | 411 | if (rv) { |
410 | up(&set_timeout_lock); | 412 | mutex_unlock(&set_timeout_lock); |
411 | } else { | 413 | goto out; |
412 | if ((do_heartbeat == IPMI_SET_TIMEOUT_FORCE_HB) | ||
413 | || ((send_heartbeat_now) | ||
414 | && (do_heartbeat == IPMI_SET_TIMEOUT_HB_IF_NECESSARY))) | ||
415 | { | ||
416 | rv = ipmi_heartbeat(); | ||
417 | } | ||
418 | } | 414 | } |
419 | 415 | ||
416 | wait_for_completion(&set_timeout_wait); | ||
417 | |||
418 | if ((do_heartbeat == IPMI_SET_TIMEOUT_FORCE_HB) | ||
419 | || ((send_heartbeat_now) | ||
420 | && (do_heartbeat == IPMI_SET_TIMEOUT_HB_IF_NECESSARY))) | ||
421 | { | ||
422 | rv = ipmi_heartbeat(); | ||
423 | } | ||
424 | mutex_unlock(&set_timeout_lock); | ||
425 | |||
426 | out: | ||
420 | return rv; | 427 | return rv; |
421 | } | 428 | } |
422 | 429 | ||
@@ -458,17 +465,17 @@ static void panic_halt_ipmi_set_timeout(void) | |||
458 | The semaphore is claimed when the set_timeout is sent and freed | 465 | The semaphore is claimed when the set_timeout is sent and freed |
459 | when both messages are free. */ | 466 | when both messages are free. */ |
460 | static atomic_t heartbeat_tofree = ATOMIC_INIT(0); | 467 | static atomic_t heartbeat_tofree = ATOMIC_INIT(0); |
461 | static DECLARE_MUTEX(heartbeat_lock); | 468 | static DEFINE_MUTEX(heartbeat_lock); |
462 | static DECLARE_MUTEX_LOCKED(heartbeat_wait_lock); | 469 | static DECLARE_COMPLETION(heartbeat_wait); |
463 | static void heartbeat_free_smi(struct ipmi_smi_msg *msg) | 470 | static void heartbeat_free_smi(struct ipmi_smi_msg *msg) |
464 | { | 471 | { |
465 | if (atomic_dec_and_test(&heartbeat_tofree)) | 472 | if (atomic_dec_and_test(&heartbeat_tofree)) |
466 | up(&heartbeat_wait_lock); | 473 | complete(&heartbeat_wait); |
467 | } | 474 | } |
468 | static void heartbeat_free_recv(struct ipmi_recv_msg *msg) | 475 | static void heartbeat_free_recv(struct ipmi_recv_msg *msg) |
469 | { | 476 | { |
470 | if (atomic_dec_and_test(&heartbeat_tofree)) | 477 | if (atomic_dec_and_test(&heartbeat_tofree)) |
471 | up(&heartbeat_wait_lock); | 478 | complete(&heartbeat_wait); |
472 | } | 479 | } |
473 | static struct ipmi_smi_msg heartbeat_smi_msg = | 480 | static struct ipmi_smi_msg heartbeat_smi_msg = |
474 | { | 481 | { |
@@ -511,14 +518,14 @@ static int ipmi_heartbeat(void) | |||
511 | return ipmi_set_timeout(IPMI_SET_TIMEOUT_HB_IF_NECESSARY); | 518 | return ipmi_set_timeout(IPMI_SET_TIMEOUT_HB_IF_NECESSARY); |
512 | } | 519 | } |
513 | 520 | ||
514 | down(&heartbeat_lock); | 521 | mutex_lock(&heartbeat_lock); |
515 | 522 | ||
516 | atomic_set(&heartbeat_tofree, 2); | 523 | atomic_set(&heartbeat_tofree, 2); |
517 | 524 | ||
518 | /* Don't reset the timer if we have the timer turned off, that | 525 | /* Don't reset the timer if we have the timer turned off, that |
519 | re-enables the watchdog. */ | 526 | re-enables the watchdog. */ |
520 | if (ipmi_watchdog_state == WDOG_TIMEOUT_NONE) { | 527 | if (ipmi_watchdog_state == WDOG_TIMEOUT_NONE) { |
521 | up(&heartbeat_lock); | 528 | mutex_unlock(&heartbeat_lock); |
522 | return 0; | 529 | return 0; |
523 | } | 530 | } |
524 | 531 | ||
@@ -539,14 +546,14 @@ static int ipmi_heartbeat(void) | |||
539 | &heartbeat_recv_msg, | 546 | &heartbeat_recv_msg, |
540 | 1); | 547 | 1); |
541 | if (rv) { | 548 | if (rv) { |
542 | up(&heartbeat_lock); | 549 | mutex_unlock(&heartbeat_lock); |
543 | printk(KERN_WARNING PFX "heartbeat failure: %d\n", | 550 | printk(KERN_WARNING PFX "heartbeat failure: %d\n", |
544 | rv); | 551 | rv); |
545 | return rv; | 552 | return rv; |
546 | } | 553 | } |
547 | 554 | ||
548 | /* Wait for the heartbeat to be sent. */ | 555 | /* Wait for the heartbeat to be sent. */ |
549 | down(&heartbeat_wait_lock); | 556 | wait_for_completion(&heartbeat_wait); |
550 | 557 | ||
551 | if (heartbeat_recv_msg.msg.data[0] != 0) { | 558 | if (heartbeat_recv_msg.msg.data[0] != 0) { |
552 | /* Got an error in the heartbeat response. It was already | 559 | /* Got an error in the heartbeat response. It was already |
@@ -555,7 +562,7 @@ static int ipmi_heartbeat(void) | |||
555 | rv = -EINVAL; | 562 | rv = -EINVAL; |
556 | } | 563 | } |
557 | 564 | ||
558 | up(&heartbeat_lock); | 565 | mutex_unlock(&heartbeat_lock); |
559 | 566 | ||
560 | return rv; | 567 | return rv; |
561 | } | 568 | } |
@@ -589,7 +596,7 @@ static void panic_halt_ipmi_heartbeat(void) | |||
589 | 1); | 596 | 1); |
590 | } | 597 | } |
591 | 598 | ||
592 | static struct watchdog_info ident= | 599 | static struct watchdog_info ident = |
593 | { | 600 | { |
594 | .options = 0, /* WDIOF_SETTIMEOUT, */ | 601 | .options = 0, /* WDIOF_SETTIMEOUT, */ |
595 | .firmware_version = 1, | 602 | .firmware_version = 1, |
@@ -790,13 +797,13 @@ static int ipmi_fasync(int fd, struct file *file, int on) | |||
790 | 797 | ||
791 | static int ipmi_close(struct inode *ino, struct file *filep) | 798 | static int ipmi_close(struct inode *ino, struct file *filep) |
792 | { | 799 | { |
793 | if (iminor(ino)==WATCHDOG_MINOR) | 800 | if (iminor(ino) == WATCHDOG_MINOR) { |
794 | { | ||
795 | if (expect_close == 42) { | 801 | if (expect_close == 42) { |
796 | ipmi_watchdog_state = WDOG_TIMEOUT_NONE; | 802 | ipmi_watchdog_state = WDOG_TIMEOUT_NONE; |
797 | ipmi_set_timeout(IPMI_SET_TIMEOUT_NO_HB); | 803 | ipmi_set_timeout(IPMI_SET_TIMEOUT_NO_HB); |
798 | } else { | 804 | } else { |
799 | printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n"); | 805 | printk(KERN_CRIT PFX |
806 | "Unexpected close, not stopping watchdog!\n"); | ||
800 | ipmi_heartbeat(); | 807 | ipmi_heartbeat(); |
801 | } | 808 | } |
802 | clear_bit(0, &ipmi_wdog_open); | 809 | clear_bit(0, &ipmi_wdog_open); |
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index e5247f85a446..ef20c1fc9c4c 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c | |||
@@ -706,7 +706,6 @@ static int stli_portcmdstats(stliport_t *portp); | |||
706 | static int stli_clrportstats(stliport_t *portp, comstats_t __user *cp); | 706 | static int stli_clrportstats(stliport_t *portp, comstats_t __user *cp); |
707 | static int stli_getportstruct(stliport_t __user *arg); | 707 | static int stli_getportstruct(stliport_t __user *arg); |
708 | static int stli_getbrdstruct(stlibrd_t __user *arg); | 708 | static int stli_getbrdstruct(stlibrd_t __user *arg); |
709 | static void *stli_memalloc(int len); | ||
710 | static stlibrd_t *stli_allocbrd(void); | 709 | static stlibrd_t *stli_allocbrd(void); |
711 | 710 | ||
712 | static void stli_ecpinit(stlibrd_t *brdp); | 711 | static void stli_ecpinit(stlibrd_t *brdp); |
@@ -997,17 +996,6 @@ static int stli_parsebrd(stlconf_t *confp, char **argp) | |||
997 | 996 | ||
998 | /*****************************************************************************/ | 997 | /*****************************************************************************/ |
999 | 998 | ||
1000 | /* | ||
1001 | * Local driver kernel malloc routine. | ||
1002 | */ | ||
1003 | |||
1004 | static void *stli_memalloc(int len) | ||
1005 | { | ||
1006 | return((void *) kmalloc(len, GFP_KERNEL)); | ||
1007 | } | ||
1008 | |||
1009 | /*****************************************************************************/ | ||
1010 | |||
1011 | static int stli_open(struct tty_struct *tty, struct file *filp) | 999 | static int stli_open(struct tty_struct *tty, struct file *filp) |
1012 | { | 1000 | { |
1013 | stlibrd_t *brdp; | 1001 | stlibrd_t *brdp; |
@@ -3227,13 +3215,12 @@ static int stli_initports(stlibrd_t *brdp) | |||
3227 | #endif | 3215 | #endif |
3228 | 3216 | ||
3229 | for (i = 0, panelnr = 0, panelport = 0; (i < brdp->nrports); i++) { | 3217 | for (i = 0, panelnr = 0, panelport = 0; (i < brdp->nrports); i++) { |
3230 | portp = (stliport_t *) stli_memalloc(sizeof(stliport_t)); | 3218 | portp = kzalloc(sizeof(stliport_t), GFP_KERNEL); |
3231 | if (portp == (stliport_t *) NULL) { | 3219 | if (!portp) { |
3232 | printk("STALLION: failed to allocate port structure\n"); | 3220 | printk("STALLION: failed to allocate port structure\n"); |
3233 | continue; | 3221 | continue; |
3234 | } | 3222 | } |
3235 | 3223 | ||
3236 | memset(portp, 0, sizeof(stliport_t)); | ||
3237 | portp->magic = STLI_PORTMAGIC; | 3224 | portp->magic = STLI_PORTMAGIC; |
3238 | portp->portnr = i; | 3225 | portp->portnr = i; |
3239 | portp->brdnr = brdp->brdnr; | 3226 | portp->brdnr = brdp->brdnr; |
@@ -4610,14 +4597,13 @@ static stlibrd_t *stli_allocbrd(void) | |||
4610 | { | 4597 | { |
4611 | stlibrd_t *brdp; | 4598 | stlibrd_t *brdp; |
4612 | 4599 | ||
4613 | brdp = (stlibrd_t *) stli_memalloc(sizeof(stlibrd_t)); | 4600 | brdp = kzalloc(sizeof(stlibrd_t), GFP_KERNEL); |
4614 | if (brdp == (stlibrd_t *) NULL) { | 4601 | if (!brdp) { |
4615 | printk(KERN_ERR "STALLION: failed to allocate memory " | 4602 | printk(KERN_ERR "STALLION: failed to allocate memory " |
4616 | "(size=%d)\n", sizeof(stlibrd_t)); | 4603 | "(size=%d)\n", sizeof(stlibrd_t)); |
4617 | return((stlibrd_t *) NULL); | 4604 | return NULL; |
4618 | } | 4605 | } |
4619 | 4606 | ||
4620 | memset(brdp, 0, sizeof(stlibrd_t)); | ||
4621 | brdp->magic = STLI_BOARDMAGIC; | 4607 | brdp->magic = STLI_BOARDMAGIC; |
4622 | return(brdp); | 4608 | return(brdp); |
4623 | } | 4609 | } |
@@ -5210,12 +5196,12 @@ int __init stli_init(void) | |||
5210 | /* | 5196 | /* |
5211 | * Allocate a temporary write buffer. | 5197 | * Allocate a temporary write buffer. |
5212 | */ | 5198 | */ |
5213 | stli_tmpwritebuf = (char *) stli_memalloc(STLI_TXBUFSIZE); | 5199 | stli_tmpwritebuf = kmalloc(STLI_TXBUFSIZE, GFP_KERNEL); |
5214 | if (stli_tmpwritebuf == (char *) NULL) | 5200 | if (!stli_tmpwritebuf) |
5215 | printk(KERN_ERR "STALLION: failed to allocate memory " | 5201 | printk(KERN_ERR "STALLION: failed to allocate memory " |
5216 | "(size=%d)\n", STLI_TXBUFSIZE); | 5202 | "(size=%d)\n", STLI_TXBUFSIZE); |
5217 | stli_txcookbuf = stli_memalloc(STLI_TXBUFSIZE); | 5203 | stli_txcookbuf = kmalloc(STLI_TXBUFSIZE, GFP_KERNEL); |
5218 | if (stli_txcookbuf == (char *) NULL) | 5204 | if (!stli_txcookbuf) |
5219 | printk(KERN_ERR "STALLION: failed to allocate memory " | 5205 | printk(KERN_ERR "STALLION: failed to allocate memory " |
5220 | "(size=%d)\n", STLI_TXBUFSIZE); | 5206 | "(size=%d)\n", STLI_TXBUFSIZE); |
5221 | 5207 | ||
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c index 8b603b2d1c42..935670a3cd98 100644 --- a/drivers/char/keyboard.c +++ b/drivers/char/keyboard.c | |||
@@ -74,7 +74,7 @@ void compute_shiftstate(void); | |||
74 | k_self, k_fn, k_spec, k_pad,\ | 74 | k_self, k_fn, k_spec, k_pad,\ |
75 | k_dead, k_cons, k_cur, k_shift,\ | 75 | k_dead, k_cons, k_cur, k_shift,\ |
76 | k_meta, k_ascii, k_lock, k_lowercase,\ | 76 | k_meta, k_ascii, k_lock, k_lowercase,\ |
77 | k_slock, k_dead2, k_ignore, k_ignore | 77 | k_slock, k_dead2, k_brl, k_ignore |
78 | 78 | ||
79 | typedef void (k_handler_fn)(struct vc_data *vc, unsigned char value, | 79 | typedef void (k_handler_fn)(struct vc_data *vc, unsigned char value, |
80 | char up_flag, struct pt_regs *regs); | 80 | char up_flag, struct pt_regs *regs); |
@@ -100,7 +100,7 @@ static fn_handler_fn *fn_handler[] = { FN_HANDLERS }; | |||
100 | const int max_vals[] = { | 100 | const int max_vals[] = { |
101 | 255, ARRAY_SIZE(func_table) - 1, ARRAY_SIZE(fn_handler) - 1, NR_PAD - 1, | 101 | 255, ARRAY_SIZE(func_table) - 1, ARRAY_SIZE(fn_handler) - 1, NR_PAD - 1, |
102 | NR_DEAD - 1, 255, 3, NR_SHIFT - 1, 255, NR_ASCII - 1, NR_LOCK - 1, | 102 | NR_DEAD - 1, 255, 3, NR_SHIFT - 1, 255, NR_ASCII - 1, NR_LOCK - 1, |
103 | 255, NR_LOCK - 1, 255 | 103 | 255, NR_LOCK - 1, 255, NR_BRL - 1 |
104 | }; | 104 | }; |
105 | 105 | ||
106 | const int NR_TYPES = ARRAY_SIZE(max_vals); | 106 | const int NR_TYPES = ARRAY_SIZE(max_vals); |
@@ -126,7 +126,7 @@ static unsigned long key_down[NBITS(KEY_MAX)]; /* keyboard key bitmap */ | |||
126 | static unsigned char shift_down[NR_SHIFT]; /* shift state counters.. */ | 126 | static unsigned char shift_down[NR_SHIFT]; /* shift state counters.. */ |
127 | static int dead_key_next; | 127 | static int dead_key_next; |
128 | static int npadch = -1; /* -1 or number assembled on pad */ | 128 | static int npadch = -1; /* -1 or number assembled on pad */ |
129 | static unsigned char diacr; | 129 | static unsigned int diacr; |
130 | static char rep; /* flag telling character repeat */ | 130 | static char rep; /* flag telling character repeat */ |
131 | 131 | ||
132 | static unsigned char ledstate = 0xff; /* undefined */ | 132 | static unsigned char ledstate = 0xff; /* undefined */ |
@@ -394,22 +394,30 @@ void compute_shiftstate(void) | |||
394 | * Otherwise, conclude that DIACR was not combining after all, | 394 | * Otherwise, conclude that DIACR was not combining after all, |
395 | * queue it and return CH. | 395 | * queue it and return CH. |
396 | */ | 396 | */ |
397 | static unsigned char handle_diacr(struct vc_data *vc, unsigned char ch) | 397 | static unsigned int handle_diacr(struct vc_data *vc, unsigned int ch) |
398 | { | 398 | { |
399 | int d = diacr; | 399 | unsigned int d = diacr; |
400 | unsigned int i; | 400 | unsigned int i; |
401 | 401 | ||
402 | diacr = 0; | 402 | diacr = 0; |
403 | 403 | ||
404 | for (i = 0; i < accent_table_size; i++) { | 404 | if ((d & ~0xff) == BRL_UC_ROW) { |
405 | if (accent_table[i].diacr == d && accent_table[i].base == ch) | 405 | if ((ch & ~0xff) == BRL_UC_ROW) |
406 | return accent_table[i].result; | 406 | return d | ch; |
407 | } else { | ||
408 | for (i = 0; i < accent_table_size; i++) | ||
409 | if (accent_table[i].diacr == d && accent_table[i].base == ch) | ||
410 | return accent_table[i].result; | ||
407 | } | 411 | } |
408 | 412 | ||
409 | if (ch == ' ' || ch == d) | 413 | if (ch == ' ' || ch == (BRL_UC_ROW|0) || ch == d) |
410 | return d; | 414 | return d; |
411 | 415 | ||
412 | put_queue(vc, d); | 416 | if (kbd->kbdmode == VC_UNICODE) |
417 | to_utf8(vc, d); | ||
418 | else if (d < 0x100) | ||
419 | put_queue(vc, d); | ||
420 | |||
413 | return ch; | 421 | return ch; |
414 | } | 422 | } |
415 | 423 | ||
@@ -419,7 +427,10 @@ static unsigned char handle_diacr(struct vc_data *vc, unsigned char ch) | |||
419 | static void fn_enter(struct vc_data *vc, struct pt_regs *regs) | 427 | static void fn_enter(struct vc_data *vc, struct pt_regs *regs) |
420 | { | 428 | { |
421 | if (diacr) { | 429 | if (diacr) { |
422 | put_queue(vc, diacr); | 430 | if (kbd->kbdmode == VC_UNICODE) |
431 | to_utf8(vc, diacr); | ||
432 | else if (diacr < 0x100) | ||
433 | put_queue(vc, diacr); | ||
423 | diacr = 0; | 434 | diacr = 0; |
424 | } | 435 | } |
425 | put_queue(vc, 13); | 436 | put_queue(vc, 13); |
@@ -615,7 +626,7 @@ static void k_lowercase(struct vc_data *vc, unsigned char value, char up_flag, s | |||
615 | printk(KERN_ERR "keyboard.c: k_lowercase was called - impossible\n"); | 626 | printk(KERN_ERR "keyboard.c: k_lowercase was called - impossible\n"); |
616 | } | 627 | } |
617 | 628 | ||
618 | static void k_self(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) | 629 | static void k_unicode(struct vc_data *vc, unsigned int value, char up_flag, struct pt_regs *regs) |
619 | { | 630 | { |
620 | if (up_flag) | 631 | if (up_flag) |
621 | return; /* no action, if this is a key release */ | 632 | return; /* no action, if this is a key release */ |
@@ -628,7 +639,10 @@ static void k_self(struct vc_data *vc, unsigned char value, char up_flag, struct | |||
628 | diacr = value; | 639 | diacr = value; |
629 | return; | 640 | return; |
630 | } | 641 | } |
631 | put_queue(vc, value); | 642 | if (kbd->kbdmode == VC_UNICODE) |
643 | to_utf8(vc, value); | ||
644 | else if (value < 0x100) | ||
645 | put_queue(vc, value); | ||
632 | } | 646 | } |
633 | 647 | ||
634 | /* | 648 | /* |
@@ -636,13 +650,23 @@ static void k_self(struct vc_data *vc, unsigned char value, char up_flag, struct | |||
636 | * dead keys modifying the same character. Very useful | 650 | * dead keys modifying the same character. Very useful |
637 | * for Vietnamese. | 651 | * for Vietnamese. |
638 | */ | 652 | */ |
639 | static void k_dead2(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) | 653 | static void k_deadunicode(struct vc_data *vc, unsigned int value, char up_flag, struct pt_regs *regs) |
640 | { | 654 | { |
641 | if (up_flag) | 655 | if (up_flag) |
642 | return; | 656 | return; |
643 | diacr = (diacr ? handle_diacr(vc, value) : value); | 657 | diacr = (diacr ? handle_diacr(vc, value) : value); |
644 | } | 658 | } |
645 | 659 | ||
660 | static void k_self(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) | ||
661 | { | ||
662 | k_unicode(vc, value, up_flag, regs); | ||
663 | } | ||
664 | |||
665 | static void k_dead2(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) | ||
666 | { | ||
667 | k_deadunicode(vc, value, up_flag, regs); | ||
668 | } | ||
669 | |||
646 | /* | 670 | /* |
647 | * Obsolete - for backwards compatibility only | 671 | * Obsolete - for backwards compatibility only |
648 | */ | 672 | */ |
@@ -650,7 +674,7 @@ static void k_dead(struct vc_data *vc, unsigned char value, char up_flag, struct | |||
650 | { | 674 | { |
651 | static unsigned char ret_diacr[NR_DEAD] = {'`', '\'', '^', '~', '"', ',' }; | 675 | static unsigned char ret_diacr[NR_DEAD] = {'`', '\'', '^', '~', '"', ',' }; |
652 | value = ret_diacr[value]; | 676 | value = ret_diacr[value]; |
653 | k_dead2(vc, value, up_flag, regs); | 677 | k_deadunicode(vc, value, up_flag, regs); |
654 | } | 678 | } |
655 | 679 | ||
656 | static void k_cons(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) | 680 | static void k_cons(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) |
@@ -835,6 +859,62 @@ static void k_slock(struct vc_data *vc, unsigned char value, char up_flag, struc | |||
835 | } | 859 | } |
836 | } | 860 | } |
837 | 861 | ||
862 | /* by default, 300ms interval for combination release */ | ||
863 | static long brl_timeout = 300; | ||
864 | MODULE_PARM_DESC(brl_timeout, "Braille keys release delay in ms (0 for combination on first release, < 0 for dead characters)"); | ||
865 | module_param(brl_timeout, long, 0644); | ||
866 | static void k_brl(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) | ||
867 | { | ||
868 | static unsigned pressed,committing; | ||
869 | static unsigned long releasestart; | ||
870 | |||
871 | if (kbd->kbdmode != VC_UNICODE) { | ||
872 | if (!up_flag) | ||
873 | printk("keyboard mode must be unicode for braille patterns\n"); | ||
874 | return; | ||
875 | } | ||
876 | |||
877 | if (!value) { | ||
878 | k_unicode(vc, BRL_UC_ROW, up_flag, regs); | ||
879 | return; | ||
880 | } | ||
881 | |||
882 | if (value > 8) | ||
883 | return; | ||
884 | |||
885 | if (brl_timeout < 0) { | ||
886 | k_deadunicode(vc, BRL_UC_ROW | (1 << (value - 1)), up_flag, regs); | ||
887 | return; | ||
888 | } | ||
889 | |||
890 | if (up_flag) { | ||
891 | if (brl_timeout) { | ||
892 | if (!committing || | ||
893 | jiffies - releasestart > (brl_timeout * HZ) / 1000) { | ||
894 | committing = pressed; | ||
895 | releasestart = jiffies; | ||
896 | } | ||
897 | pressed &= ~(1 << (value - 1)); | ||
898 | if (!pressed) { | ||
899 | if (committing) { | ||
900 | k_unicode(vc, BRL_UC_ROW | committing, 0, regs); | ||
901 | committing = 0; | ||
902 | } | ||
903 | } | ||
904 | } else { | ||
905 | if (committing) { | ||
906 | k_unicode(vc, BRL_UC_ROW | committing, 0, regs); | ||
907 | committing = 0; | ||
908 | } | ||
909 | pressed &= ~(1 << (value - 1)); | ||
910 | } | ||
911 | } else { | ||
912 | pressed |= 1 << (value - 1); | ||
913 | if (!brl_timeout) | ||
914 | committing = pressed; | ||
915 | } | ||
916 | } | ||
917 | |||
838 | /* | 918 | /* |
839 | * The leds display either (i) the status of NumLock, CapsLock, ScrollLock, | 919 | * The leds display either (i) the status of NumLock, CapsLock, ScrollLock, |
840 | * or (ii) whatever pattern of lights people want to show using KDSETLED, | 920 | * or (ii) whatever pattern of lights people want to show using KDSETLED, |
@@ -1125,9 +1205,13 @@ static void kbd_keycode(unsigned int keycode, int down, | |||
1125 | } | 1205 | } |
1126 | 1206 | ||
1127 | if (keycode > NR_KEYS) | 1207 | if (keycode > NR_KEYS) |
1128 | return; | 1208 | if (keycode >= KEY_BRL_DOT1 && keycode <= KEY_BRL_DOT8) |
1209 | keysym = K(KT_BRL, keycode - KEY_BRL_DOT1 + 1); | ||
1210 | else | ||
1211 | return; | ||
1212 | else | ||
1213 | keysym = key_map[keycode]; | ||
1129 | 1214 | ||
1130 | keysym = key_map[keycode]; | ||
1131 | type = KTYP(keysym); | 1215 | type = KTYP(keysym); |
1132 | 1216 | ||
1133 | if (type < 0xf0) { | 1217 | if (type < 0xf0) { |
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c index 3f5d6077f39c..a9c5a7230f89 100644 --- a/drivers/char/stallion.c +++ b/drivers/char/stallion.c | |||
@@ -504,7 +504,6 @@ static int stl_echmcaintr(stlbrd_t *brdp); | |||
504 | static int stl_echpciintr(stlbrd_t *brdp); | 504 | static int stl_echpciintr(stlbrd_t *brdp); |
505 | static int stl_echpci64intr(stlbrd_t *brdp); | 505 | static int stl_echpci64intr(stlbrd_t *brdp); |
506 | static void stl_offintr(void *private); | 506 | static void stl_offintr(void *private); |
507 | static void *stl_memalloc(int len); | ||
508 | static stlbrd_t *stl_allocbrd(void); | 507 | static stlbrd_t *stl_allocbrd(void); |
509 | static stlport_t *stl_getport(int brdnr, int panelnr, int portnr); | 508 | static stlport_t *stl_getport(int brdnr, int panelnr, int portnr); |
510 | 509 | ||
@@ -940,17 +939,6 @@ static int stl_parsebrd(stlconf_t *confp, char **argp) | |||
940 | /*****************************************************************************/ | 939 | /*****************************************************************************/ |
941 | 940 | ||
942 | /* | 941 | /* |
943 | * Local driver kernel memory allocation routine. | ||
944 | */ | ||
945 | |||
946 | static void *stl_memalloc(int len) | ||
947 | { | ||
948 | return (void *) kmalloc(len, GFP_KERNEL); | ||
949 | } | ||
950 | |||
951 | /*****************************************************************************/ | ||
952 | |||
953 | /* | ||
954 | * Allocate a new board structure. Fill out the basic info in it. | 942 | * Allocate a new board structure. Fill out the basic info in it. |
955 | */ | 943 | */ |
956 | 944 | ||
@@ -958,14 +946,13 @@ static stlbrd_t *stl_allocbrd(void) | |||
958 | { | 946 | { |
959 | stlbrd_t *brdp; | 947 | stlbrd_t *brdp; |
960 | 948 | ||
961 | brdp = (stlbrd_t *) stl_memalloc(sizeof(stlbrd_t)); | 949 | brdp = kzalloc(sizeof(stlbrd_t), GFP_KERNEL); |
962 | if (brdp == (stlbrd_t *) NULL) { | 950 | if (!brdp) { |
963 | printk("STALLION: failed to allocate memory (size=%d)\n", | 951 | printk("STALLION: failed to allocate memory (size=%d)\n", |
964 | sizeof(stlbrd_t)); | 952 | sizeof(stlbrd_t)); |
965 | return (stlbrd_t *) NULL; | 953 | return NULL; |
966 | } | 954 | } |
967 | 955 | ||
968 | memset(brdp, 0, sizeof(stlbrd_t)); | ||
969 | brdp->magic = STL_BOARDMAGIC; | 956 | brdp->magic = STL_BOARDMAGIC; |
970 | return brdp; | 957 | return brdp; |
971 | } | 958 | } |
@@ -1017,9 +1004,9 @@ static int stl_open(struct tty_struct *tty, struct file *filp) | |||
1017 | portp->refcount++; | 1004 | portp->refcount++; |
1018 | 1005 | ||
1019 | if ((portp->flags & ASYNC_INITIALIZED) == 0) { | 1006 | if ((portp->flags & ASYNC_INITIALIZED) == 0) { |
1020 | if (portp->tx.buf == (char *) NULL) { | 1007 | if (!portp->tx.buf) { |
1021 | portp->tx.buf = (char *) stl_memalloc(STL_TXBUFSIZE); | 1008 | portp->tx.buf = kmalloc(STL_TXBUFSIZE, GFP_KERNEL); |
1022 | if (portp->tx.buf == (char *) NULL) | 1009 | if (!portp->tx.buf) |
1023 | return -ENOMEM; | 1010 | return -ENOMEM; |
1024 | portp->tx.head = portp->tx.buf; | 1011 | portp->tx.head = portp->tx.buf; |
1025 | portp->tx.tail = portp->tx.buf; | 1012 | portp->tx.tail = portp->tx.buf; |
@@ -2178,13 +2165,12 @@ static int __init stl_initports(stlbrd_t *brdp, stlpanel_t *panelp) | |||
2178 | * each ports data structures. | 2165 | * each ports data structures. |
2179 | */ | 2166 | */ |
2180 | for (i = 0; (i < panelp->nrports); i++) { | 2167 | for (i = 0; (i < panelp->nrports); i++) { |
2181 | portp = (stlport_t *) stl_memalloc(sizeof(stlport_t)); | 2168 | portp = kzalloc(sizeof(stlport_t), GFP_KERNEL); |
2182 | if (portp == (stlport_t *) NULL) { | 2169 | if (!portp) { |
2183 | printk("STALLION: failed to allocate memory " | 2170 | printk("STALLION: failed to allocate memory " |
2184 | "(size=%d)\n", sizeof(stlport_t)); | 2171 | "(size=%d)\n", sizeof(stlport_t)); |
2185 | break; | 2172 | break; |
2186 | } | 2173 | } |
2187 | memset(portp, 0, sizeof(stlport_t)); | ||
2188 | 2174 | ||
2189 | portp->magic = STL_PORTMAGIC; | 2175 | portp->magic = STL_PORTMAGIC; |
2190 | portp->portnr = i; | 2176 | portp->portnr = i; |
@@ -2315,13 +2301,12 @@ static inline int stl_initeio(stlbrd_t *brdp) | |||
2315 | * can complete the setup. | 2301 | * can complete the setup. |
2316 | */ | 2302 | */ |
2317 | 2303 | ||
2318 | panelp = (stlpanel_t *) stl_memalloc(sizeof(stlpanel_t)); | 2304 | panelp = kzalloc(sizeof(stlpanel_t), GFP_KERNEL); |
2319 | if (panelp == (stlpanel_t *) NULL) { | 2305 | if (!panelp) { |
2320 | printk(KERN_WARNING "STALLION: failed to allocate memory " | 2306 | printk(KERN_WARNING "STALLION: failed to allocate memory " |
2321 | "(size=%d)\n", sizeof(stlpanel_t)); | 2307 | "(size=%d)\n", sizeof(stlpanel_t)); |
2322 | return(-ENOMEM); | 2308 | return -ENOMEM; |
2323 | } | 2309 | } |
2324 | memset(panelp, 0, sizeof(stlpanel_t)); | ||
2325 | 2310 | ||
2326 | panelp->magic = STL_PANELMAGIC; | 2311 | panelp->magic = STL_PANELMAGIC; |
2327 | panelp->brdnr = brdp->brdnr; | 2312 | panelp->brdnr = brdp->brdnr; |
@@ -2490,13 +2475,12 @@ static inline int stl_initech(stlbrd_t *brdp) | |||
2490 | status = inb(ioaddr + ECH_PNLSTATUS); | 2475 | status = inb(ioaddr + ECH_PNLSTATUS); |
2491 | if ((status & ECH_PNLIDMASK) != nxtid) | 2476 | if ((status & ECH_PNLIDMASK) != nxtid) |
2492 | break; | 2477 | break; |
2493 | panelp = (stlpanel_t *) stl_memalloc(sizeof(stlpanel_t)); | 2478 | panelp = kzalloc(sizeof(stlpanel_t), GFP_KERNEL); |
2494 | if (panelp == (stlpanel_t *) NULL) { | 2479 | if (!panelp) { |
2495 | printk("STALLION: failed to allocate memory " | 2480 | printk("STALLION: failed to allocate memory " |
2496 | "(size=%d)\n", sizeof(stlpanel_t)); | 2481 | "(size=%d)\n", sizeof(stlpanel_t)); |
2497 | break; | 2482 | break; |
2498 | } | 2483 | } |
2499 | memset(panelp, 0, sizeof(stlpanel_t)); | ||
2500 | panelp->magic = STL_PANELMAGIC; | 2484 | panelp->magic = STL_PANELMAGIC; |
2501 | panelp->brdnr = brdp->brdnr; | 2485 | panelp->brdnr = brdp->brdnr; |
2502 | panelp->panelnr = panelnr; | 2486 | panelp->panelnr = panelnr; |
@@ -3074,8 +3058,8 @@ static int __init stl_init(void) | |||
3074 | /* | 3058 | /* |
3075 | * Allocate a temporary write buffer. | 3059 | * Allocate a temporary write buffer. |
3076 | */ | 3060 | */ |
3077 | stl_tmpwritebuf = (char *) stl_memalloc(STL_TXBUFSIZE); | 3061 | stl_tmpwritebuf = kmalloc(STL_TXBUFSIZE, GFP_KERNEL); |
3078 | if (stl_tmpwritebuf == (char *) NULL) | 3062 | if (!stl_tmpwritebuf) |
3079 | printk("STALLION: failed to allocate memory (size=%d)\n", | 3063 | printk("STALLION: failed to allocate memory (size=%d)\n", |
3080 | STL_TXBUFSIZE); | 3064 | STL_TXBUFSIZE); |
3081 | 3065 | ||
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 0bfd1b63662e..98b126c2ded8 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -376,7 +376,7 @@ int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, s | |||
376 | return copied; | 376 | return copied; |
377 | } | 377 | } |
378 | 378 | ||
379 | EXPORT_SYMBOL_GPL(tty_insert_flip_string); | 379 | EXPORT_SYMBOL(tty_insert_flip_string); |
380 | 380 | ||
381 | int tty_insert_flip_string_flags(struct tty_struct *tty, const unsigned char *chars, const char *flags, size_t size) | 381 | int tty_insert_flip_string_flags(struct tty_struct *tty, const unsigned char *chars, const char *flags, size_t size) |
382 | { | 382 | { |
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index ca4844c527da..acc5d47844eb 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
@@ -2328,6 +2328,10 @@ int tioclinux(struct tty_struct *tty, unsigned long arg) | |||
2328 | case TIOCL_SETVESABLANK: | 2328 | case TIOCL_SETVESABLANK: |
2329 | set_vesa_blanking(p); | 2329 | set_vesa_blanking(p); |
2330 | break; | 2330 | break; |
2331 | case TIOCL_GETKMSGREDIRECT: | ||
2332 | data = kmsg_redirect; | ||
2333 | ret = __put_user(data, p); | ||
2334 | break; | ||
2331 | case TIOCL_SETKMSGREDIRECT: | 2335 | case TIOCL_SETKMSGREDIRECT: |
2332 | if (!capable(CAP_SYS_ADMIN)) { | 2336 | if (!capable(CAP_SYS_ADMIN)) { |
2333 | ret = -EPERM; | 2337 | ret = -EPERM; |