aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/Kconfig9
-rw-r--r--drivers/char/applicom.c2
-rw-r--r--drivers/char/ds1286.c4
-rw-r--r--drivers/char/hvc_console.c10
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c2
-rw-r--r--drivers/char/moxa.c2
-rw-r--r--drivers/char/random.c2
-rw-r--r--drivers/char/rtc.c2
-rw-r--r--drivers/char/sysrq.c31
-rw-r--r--drivers/char/tpm/tpm.c36
-rw-r--r--drivers/char/tty_io.c5
-rw-r--r--drivers/char/vt.c7
12 files changed, 70 insertions, 42 deletions
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 700ff9679457..122254155ae1 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -1043,15 +1043,6 @@ config HPET
1043 open selects one of the timers supported by the HPET. The timers are 1043 open selects one of the timers supported by the HPET. The timers are
1044 non-periodic and/or periodic. 1044 non-periodic and/or periodic.
1045 1045
1046config HPET_RTC_IRQ
1047 bool
1048 default HPET_EMULATE_RTC
1049 depends on RTC && HPET
1050 help
1051 If you say Y here, you will disable RTC_IRQ in drivers/char/rtc.c. It
1052 is assumed the platform called hpet_alloc with the RTC IRQ values for
1053 the HPET timers.
1054
1055config HPET_MMAP 1046config HPET_MMAP
1056 bool "Allow mmap of HPET" 1047 bool "Allow mmap of HPET"
1057 default y 1048 default y
diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c
index b899d9182c7d..05674febb0c6 100644
--- a/drivers/char/applicom.c
+++ b/drivers/char/applicom.c
@@ -478,7 +478,7 @@ static int do_ac_read(int IndexCard, char __user *buf,
478 struct st_ram_io *st_loc, struct mailbox *mailbox) 478 struct st_ram_io *st_loc, struct mailbox *mailbox)
479{ 479{
480 void __iomem *from = apbs[IndexCard].RamIO + RAM_TO_PC; 480 void __iomem *from = apbs[IndexCard].RamIO + RAM_TO_PC;
481 unsigned char *to = (unsigned char *)&mailbox; 481 unsigned char *to = (unsigned char *)mailbox;
482#ifdef DEBUG 482#ifdef DEBUG
483 int c; 483 int c;
484#endif 484#endif
diff --git a/drivers/char/ds1286.c b/drivers/char/ds1286.c
index fb584938c9c3..5329d482b582 100644
--- a/drivers/char/ds1286.c
+++ b/drivers/char/ds1286.c
@@ -443,7 +443,6 @@ static void ds1286_get_time(struct rtc_time *rtc_tm)
443{ 443{
444 unsigned char save_control; 444 unsigned char save_control;
445 unsigned long flags; 445 unsigned long flags;
446 unsigned long uip_watchdog = jiffies;
447 446
448 /* 447 /*
449 * read RTC once any update in progress is done. The update 448 * read RTC once any update in progress is done. The update
@@ -456,8 +455,7 @@ static void ds1286_get_time(struct rtc_time *rtc_tm)
456 */ 455 */
457 456
458 if (ds1286_is_updating() != 0) 457 if (ds1286_is_updating() != 0)
459 while (time_before(jiffies, uip_watchdog + 2*HZ/100)) 458 msleep(20);
460 barrier();
461 459
462 /* 460 /*
463 * Only the values that we read from the RTC are set. We leave 461 * Only the values that we read from the RTC are set. We leave
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c
index ec7aded0a2df..bf70450a49cc 100644
--- a/drivers/char/hvc_console.c
+++ b/drivers/char/hvc_console.c
@@ -367,13 +367,13 @@ static void hvc_close(struct tty_struct *tty, struct file * filp)
367 spin_lock_irqsave(&hp->lock, flags); 367 spin_lock_irqsave(&hp->lock, flags);
368 368
369 if (--hp->count == 0) { 369 if (--hp->count == 0) {
370 if (hp->ops->notifier_del)
371 hp->ops->notifier_del(hp, hp->data);
372
373 /* We are done with the tty pointer now. */ 370 /* We are done with the tty pointer now. */
374 hp->tty = NULL; 371 hp->tty = NULL;
375 spin_unlock_irqrestore(&hp->lock, flags); 372 spin_unlock_irqrestore(&hp->lock, flags);
376 373
374 if (hp->ops->notifier_del)
375 hp->ops->notifier_del(hp, hp->data);
376
377 /* 377 /*
378 * Chain calls chars_in_buffer() and returns immediately if 378 * Chain calls chars_in_buffer() and returns immediately if
379 * there is no buffered data otherwise sleeps on a wait queue 379 * there is no buffered data otherwise sleeps on a wait queue
@@ -416,11 +416,11 @@ static void hvc_hangup(struct tty_struct *tty)
416 hp->n_outbuf = 0; 416 hp->n_outbuf = 0;
417 hp->tty = NULL; 417 hp->tty = NULL;
418 418
419 spin_unlock_irqrestore(&hp->lock, flags);
420
419 if (hp->ops->notifier_del) 421 if (hp->ops->notifier_del)
420 hp->ops->notifier_del(hp, hp->data); 422 hp->ops->notifier_del(hp, hp->data);
421 423
422 spin_unlock_irqrestore(&hp->lock, flags);
423
424 while(temp_open_count) { 424 while(temp_open_count) {
425 --temp_open_count; 425 --temp_open_count;
426 kref_put(&hp->kref, destroy_hvc_struct); 426 kref_put(&hp->kref, destroy_hvc_struct);
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 8e8afb6141f9..3123bf57ad91 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2695,7 +2695,7 @@ static __devinit void default_find_bmc(void)
2695 for (i = 0; ; i++) { 2695 for (i = 0; ; i++) {
2696 if (!ipmi_defaults[i].port) 2696 if (!ipmi_defaults[i].port)
2697 break; 2697 break;
2698#ifdef CONFIG_PPC_MERGE 2698#ifdef CONFIG_PPC
2699 if (check_legacy_ioport(ipmi_defaults[i].port)) 2699 if (check_legacy_ioport(ipmi_defaults[i].port))
2700 continue; 2700 continue;
2701#endif 2701#endif
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c
index 5df4003ad873..12d327a2c9ba 100644
--- a/drivers/char/moxa.c
+++ b/drivers/char/moxa.c
@@ -513,7 +513,7 @@ static int moxa_real_load_code(struct moxa_board_conf *brd, const void *ptr,
513 size_t len) 513 size_t len)
514{ 514{
515 void __iomem *baseAddr = brd->basemem; 515 void __iomem *baseAddr = brd->basemem;
516 const u16 *uptr = ptr; 516 const __le16 *uptr = ptr;
517 size_t wlen, len2, j; 517 size_t wlen, len2, j;
518 unsigned long key, loadbuf, loadlen, checksum, checksum_ok; 518 unsigned long key, loadbuf, loadlen, checksum, checksum_ok;
519 unsigned int i, retry; 519 unsigned int i, retry;
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 6af435b89867..c8752eaad483 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1205,7 +1205,7 @@ static int proc_do_uuid(ctl_table *table, int write, struct file *filp,
1205 return proc_dostring(&fake_table, write, filp, buffer, lenp, ppos); 1205 return proc_dostring(&fake_table, write, filp, buffer, lenp, ppos);
1206} 1206}
1207 1207
1208static int uuid_strategy(ctl_table *table, int __user *name, int nlen, 1208static int uuid_strategy(ctl_table *table,
1209 void __user *oldval, size_t __user *oldlenp, 1209 void __user *oldval, size_t __user *oldlenp,
1210 void __user *newval, size_t newlen) 1210 void __user *newval, size_t newlen)
1211{ 1211{
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index b47710c17885..17683de95717 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -96,7 +96,7 @@ static unsigned long rtc_port;
96static int rtc_irq; 96static int rtc_irq;
97#endif 97#endif
98 98
99#ifdef CONFIG_HPET_RTC_IRQ 99#ifdef CONFIG_HPET_EMULATE_RTC
100#undef RTC_IRQ 100#undef RTC_IRQ
101#endif 101#endif
102 102
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c
index 8fdfe9c871e3..dce4cc0e6953 100644
--- a/drivers/char/sysrq.c
+++ b/drivers/char/sysrq.c
@@ -23,6 +23,7 @@
23#include <linux/reboot.h> 23#include <linux/reboot.h>
24#include <linux/sysrq.h> 24#include <linux/sysrq.h>
25#include <linux/kbd_kern.h> 25#include <linux/kbd_kern.h>
26#include <linux/proc_fs.h>
26#include <linux/quotaops.h> 27#include <linux/quotaops.h>
27#include <linux/kernel.h> 28#include <linux/kernel.h>
28#include <linux/module.h> 29#include <linux/module.h>
@@ -326,6 +327,7 @@ static struct sysrq_key_op sysrq_moom_op = {
326 .handler = sysrq_handle_moom, 327 .handler = sysrq_handle_moom,
327 .help_msg = "Full", 328 .help_msg = "Full",
328 .action_msg = "Manual OOM execution", 329 .action_msg = "Manual OOM execution",
330 .enable_mask = SYSRQ_ENABLE_SIGNAL,
329}; 331};
330 332
331static void sysrq_handle_kill(int key, struct tty_struct *tty) 333static void sysrq_handle_kill(int key, struct tty_struct *tty)
@@ -533,3 +535,32 @@ int unregister_sysrq_key(int key, struct sysrq_key_op *op_p)
533 return __sysrq_swap_key_ops(key, NULL, op_p); 535 return __sysrq_swap_key_ops(key, NULL, op_p);
534} 536}
535EXPORT_SYMBOL(unregister_sysrq_key); 537EXPORT_SYMBOL(unregister_sysrq_key);
538
539#ifdef CONFIG_PROC_FS
540/*
541 * writing 'C' to /proc/sysrq-trigger is like sysrq-C
542 */
543static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf,
544 size_t count, loff_t *ppos)
545{
546 if (count) {
547 char c;
548
549 if (get_user(c, buf))
550 return -EFAULT;
551 __handle_sysrq(c, NULL, 0);
552 }
553 return count;
554}
555
556static const struct file_operations proc_sysrq_trigger_operations = {
557 .write = write_sysrq_trigger,
558};
559
560static int __init sysrq_init(void)
561{
562 proc_create("sysrq-trigger", S_IWUSR, NULL, &proc_sysrq_trigger_operations);
563 return 0;
564}
565module_init(sysrq_init);
566#endif
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 1fee7034a386..e70d13defde4 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -525,19 +525,19 @@ void tpm_get_timeouts(struct tpm_chip *chip)
525 timeout = 525 timeout =
526 be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_1_IDX))); 526 be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_1_IDX)));
527 if (timeout) 527 if (timeout)
528 chip->vendor.timeout_a = msecs_to_jiffies(timeout); 528 chip->vendor.timeout_a = usecs_to_jiffies(timeout);
529 timeout = 529 timeout =
530 be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_2_IDX))); 530 be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_2_IDX)));
531 if (timeout) 531 if (timeout)
532 chip->vendor.timeout_b = msecs_to_jiffies(timeout); 532 chip->vendor.timeout_b = usecs_to_jiffies(timeout);
533 timeout = 533 timeout =
534 be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_3_IDX))); 534 be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_3_IDX)));
535 if (timeout) 535 if (timeout)
536 chip->vendor.timeout_c = msecs_to_jiffies(timeout); 536 chip->vendor.timeout_c = usecs_to_jiffies(timeout);
537 timeout = 537 timeout =
538 be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_4_IDX))); 538 be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_4_IDX)));
539 if (timeout) 539 if (timeout)
540 chip->vendor.timeout_d = msecs_to_jiffies(timeout); 540 chip->vendor.timeout_d = usecs_to_jiffies(timeout);
541 541
542duration: 542duration:
543 memcpy(data, tpm_cap, sizeof(tpm_cap)); 543 memcpy(data, tpm_cap, sizeof(tpm_cap));
@@ -554,15 +554,22 @@ duration:
554 return; 554 return;
555 555
556 chip->vendor.duration[TPM_SHORT] = 556 chip->vendor.duration[TPM_SHORT] =
557 msecs_to_jiffies(be32_to_cpu 557 usecs_to_jiffies(be32_to_cpu
558 (*((__be32 *) (data + 558 (*((__be32 *) (data +
559 TPM_GET_CAP_RET_UINT32_1_IDX)))); 559 TPM_GET_CAP_RET_UINT32_1_IDX))));
560 /* The Broadcom BCM0102 chipset in a Dell Latitude D820 gets the above
561 * value wrong and apparently reports msecs rather than usecs. So we
562 * fix up the resulting too-small TPM_SHORT value to make things work.
563 */
564 if (chip->vendor.duration[TPM_SHORT] < (HZ/100))
565 chip->vendor.duration[TPM_SHORT] = HZ;
566
560 chip->vendor.duration[TPM_MEDIUM] = 567 chip->vendor.duration[TPM_MEDIUM] =
561 msecs_to_jiffies(be32_to_cpu 568 usecs_to_jiffies(be32_to_cpu
562 (*((__be32 *) (data + 569 (*((__be32 *) (data +
563 TPM_GET_CAP_RET_UINT32_2_IDX)))); 570 TPM_GET_CAP_RET_UINT32_2_IDX))));
564 chip->vendor.duration[TPM_LONG] = 571 chip->vendor.duration[TPM_LONG] =
565 msecs_to_jiffies(be32_to_cpu 572 usecs_to_jiffies(be32_to_cpu
566 (*((__be32 *) (data + 573 (*((__be32 *) (data +
567 TPM_GET_CAP_RET_UINT32_3_IDX)))); 574 TPM_GET_CAP_RET_UINT32_3_IDX))));
568} 575}
@@ -1180,11 +1187,8 @@ struct tpm_chip *tpm_register_hardware(struct device *dev,
1180 chip = kzalloc(sizeof(*chip), GFP_KERNEL); 1187 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1181 devname = kmalloc(DEVNAME_SIZE, GFP_KERNEL); 1188 devname = kmalloc(DEVNAME_SIZE, GFP_KERNEL);
1182 1189
1183 if (chip == NULL || devname == NULL) { 1190 if (chip == NULL || devname == NULL)
1184 kfree(chip); 1191 goto out_free;
1185 kfree(devname);
1186 return NULL;
1187 }
1188 1192
1189 mutex_init(&chip->buffer_mutex); 1193 mutex_init(&chip->buffer_mutex);
1190 mutex_init(&chip->tpm_mutex); 1194 mutex_init(&chip->tpm_mutex);
@@ -1201,8 +1205,7 @@ struct tpm_chip *tpm_register_hardware(struct device *dev,
1201 1205
1202 if (chip->dev_num >= TPM_NUM_DEVICES) { 1206 if (chip->dev_num >= TPM_NUM_DEVICES) {
1203 dev_err(dev, "No available tpm device numbers\n"); 1207 dev_err(dev, "No available tpm device numbers\n");
1204 kfree(chip); 1208 goto out_free;
1205 return NULL;
1206 } else if (chip->dev_num == 0) 1209 } else if (chip->dev_num == 0)
1207 chip->vendor.miscdev.minor = TPM_MINOR; 1210 chip->vendor.miscdev.minor = TPM_MINOR;
1208 else 1211 else
@@ -1243,6 +1246,11 @@ struct tpm_chip *tpm_register_hardware(struct device *dev,
1243 spin_unlock(&driver_lock); 1246 spin_unlock(&driver_lock);
1244 1247
1245 return chip; 1248 return chip;
1249
1250out_free:
1251 kfree(chip);
1252 kfree(devname);
1253 return NULL;
1246} 1254}
1247EXPORT_SYMBOL_GPL(tpm_register_hardware); 1255EXPORT_SYMBOL_GPL(tpm_register_hardware);
1248 1256
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 7053d6333692..3f48d88cffc0 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -3032,11 +3032,12 @@ EXPORT_SYMBOL(tty_devnum);
3032 3032
3033void proc_clear_tty(struct task_struct *p) 3033void proc_clear_tty(struct task_struct *p)
3034{ 3034{
3035 unsigned long flags;
3035 struct tty_struct *tty; 3036 struct tty_struct *tty;
3036 spin_lock_irq(&p->sighand->siglock); 3037 spin_lock_irqsave(&p->sighand->siglock, flags);
3037 tty = p->signal->tty; 3038 tty = p->signal->tty;
3038 p->signal->tty = NULL; 3039 p->signal->tty = NULL;
3039 spin_unlock_irq(&p->sighand->siglock); 3040 spin_unlock_irqrestore(&p->sighand->siglock, flags);
3040 tty_kref_put(tty); 3041 tty_kref_put(tty);
3041} 3042}
3042 3043
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index 57029fefd64a..d8f83e26e4a4 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -59,7 +59,7 @@
59 * by Martin Mares <mj@atrey.karlin.mff.cuni.cz>, July 1998 59 * by Martin Mares <mj@atrey.karlin.mff.cuni.cz>, July 1998
60 * 60 *
61 * Removed old-style timers, introduced console_timer, made timer 61 * Removed old-style timers, introduced console_timer, made timer
62 * deletion SMP-safe. 17Jun00, Andrew Morton <andrewm@uow.edu.au> 62 * deletion SMP-safe. 17Jun00, Andrew Morton
63 * 63 *
64 * Removed console_lock, enabled interrupts across all console operations 64 * Removed console_lock, enabled interrupts across all console operations
65 * 13 March 2001, Andrew Morton 65 * 13 March 2001, Andrew Morton
@@ -301,7 +301,7 @@ static void scrup(struct vc_data *vc, unsigned int t, unsigned int b, int nr)
301 d = (unsigned short *)(vc->vc_origin + vc->vc_size_row * t); 301 d = (unsigned short *)(vc->vc_origin + vc->vc_size_row * t);
302 s = (unsigned short *)(vc->vc_origin + vc->vc_size_row * (t + nr)); 302 s = (unsigned short *)(vc->vc_origin + vc->vc_size_row * (t + nr));
303 scr_memmovew(d, s, (b - t - nr) * vc->vc_size_row); 303 scr_memmovew(d, s, (b - t - nr) * vc->vc_size_row);
304 scr_memsetw(d + (b - t - nr) * vc->vc_cols, vc->vc_scrl_erase_char, 304 scr_memsetw(d + (b - t - nr) * vc->vc_cols, vc->vc_video_erase_char,
305 vc->vc_size_row * nr); 305 vc->vc_size_row * nr);
306} 306}
307 307
@@ -319,7 +319,7 @@ static void scrdown(struct vc_data *vc, unsigned int t, unsigned int b, int nr)
319 s = (unsigned short *)(vc->vc_origin + vc->vc_size_row * t); 319 s = (unsigned short *)(vc->vc_origin + vc->vc_size_row * t);
320 step = vc->vc_cols * nr; 320 step = vc->vc_cols * nr;
321 scr_memmovew(s + step, s, (b - t - nr) * vc->vc_size_row); 321 scr_memmovew(s + step, s, (b - t - nr) * vc->vc_size_row);
322 scr_memsetw(s, vc->vc_scrl_erase_char, 2 * step); 322 scr_memsetw(s, vc->vc_video_erase_char, 2 * step);
323} 323}
324 324
325static void do_update_region(struct vc_data *vc, unsigned long start, int count) 325static void do_update_region(struct vc_data *vc, unsigned long start, int count)
@@ -434,7 +434,6 @@ static void update_attr(struct vc_data *vc)
434 vc->vc_blink, vc->vc_underline, 434 vc->vc_blink, vc->vc_underline,
435 vc->vc_reverse ^ vc->vc_decscnm, vc->vc_italic); 435 vc->vc_reverse ^ vc->vc_decscnm, vc->vc_italic);
436 vc->vc_video_erase_char = (build_attr(vc, vc->vc_color, 1, vc->vc_blink, 0, vc->vc_decscnm, 0) << 8) | ' '; 436 vc->vc_video_erase_char = (build_attr(vc, vc->vc_color, 1, vc->vc_blink, 0, vc->vc_decscnm, 0) << 8) | ' ';
437 vc->vc_scrl_erase_char = (build_attr(vc, vc->vc_def_color, 1, false, false, vc->vc_decscnm, false) << 8) | ' ';
438} 437}
439 438
440/* Note: inverting the screen twice should revert to the original state */ 439/* Note: inverting the screen twice should revert to the original state */