diff options
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/Kconfig | 9 | ||||
-rw-r--r-- | drivers/char/applicom.c | 2 | ||||
-rw-r--r-- | drivers/char/ds1286.c | 4 | ||||
-rw-r--r-- | drivers/char/hw_random/omap-rng.c | 33 | ||||
-rw-r--r-- | drivers/char/keyboard.c | 2 | ||||
-rw-r--r-- | drivers/char/moxa.c | 2 | ||||
-rw-r--r-- | drivers/char/random.c | 2 | ||||
-rw-r--r-- | drivers/char/rtc.c | 2 | ||||
-rw-r--r-- | drivers/char/sysrq.c | 31 | ||||
-rw-r--r-- | drivers/char/tpm/tpm.c | 36 | ||||
-rw-r--r-- | drivers/char/vt.c | 2 |
11 files changed, 85 insertions, 40 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 | ||
1046 | config 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 | |||
1055 | config HPET_MMAP | 1046 | config 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/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c index 51738bdd834e..d4e7dca06e4f 100644 --- a/drivers/char/hw_random/omap-rng.c +++ b/drivers/char/hw_random/omap-rng.c | |||
@@ -118,18 +118,21 @@ static int __init omap_rng_probe(struct platform_device *pdev) | |||
118 | 118 | ||
119 | mem = request_mem_region(res->start, res->end - res->start + 1, | 119 | mem = request_mem_region(res->start, res->end - res->start + 1, |
120 | pdev->name); | 120 | pdev->name); |
121 | if (mem == NULL) | 121 | if (mem == NULL) { |
122 | return -EBUSY; | 122 | ret = -EBUSY; |
123 | goto err_region; | ||
124 | } | ||
123 | 125 | ||
124 | dev_set_drvdata(&pdev->dev, mem); | 126 | dev_set_drvdata(&pdev->dev, mem); |
125 | rng_base = (u32 __force __iomem *)io_p2v(res->start); | 127 | rng_base = ioremap(res->start, res->end - res->start + 1); |
128 | if (!rng_base) { | ||
129 | ret = -ENOMEM; | ||
130 | goto err_ioremap; | ||
131 | } | ||
126 | 132 | ||
127 | ret = hwrng_register(&omap_rng_ops); | 133 | ret = hwrng_register(&omap_rng_ops); |
128 | if (ret) { | 134 | if (ret) |
129 | release_resource(mem); | 135 | goto err_register; |
130 | rng_base = NULL; | ||
131 | return ret; | ||
132 | } | ||
133 | 136 | ||
134 | dev_info(&pdev->dev, "OMAP Random Number Generator ver. %02x\n", | 137 | dev_info(&pdev->dev, "OMAP Random Number Generator ver. %02x\n", |
135 | omap_rng_read_reg(RNG_REV_REG)); | 138 | omap_rng_read_reg(RNG_REV_REG)); |
@@ -138,6 +141,18 @@ static int __init omap_rng_probe(struct platform_device *pdev) | |||
138 | rng_dev = pdev; | 141 | rng_dev = pdev; |
139 | 142 | ||
140 | return 0; | 143 | return 0; |
144 | |||
145 | err_register: | ||
146 | iounmap(rng_base); | ||
147 | rng_base = NULL; | ||
148 | err_ioremap: | ||
149 | release_resource(mem); | ||
150 | err_region: | ||
151 | if (cpu_is_omap24xx()) { | ||
152 | clk_disable(rng_ick); | ||
153 | clk_put(rng_ick); | ||
154 | } | ||
155 | return ret; | ||
141 | } | 156 | } |
142 | 157 | ||
143 | static int __exit omap_rng_remove(struct platform_device *pdev) | 158 | static int __exit omap_rng_remove(struct platform_device *pdev) |
@@ -148,6 +163,8 @@ static int __exit omap_rng_remove(struct platform_device *pdev) | |||
148 | 163 | ||
149 | omap_rng_write_reg(RNG_MASK_REG, 0x0); | 164 | omap_rng_write_reg(RNG_MASK_REG, 0x0); |
150 | 165 | ||
166 | iounmap(rng_base); | ||
167 | |||
151 | if (cpu_is_omap24xx()) { | 168 | if (cpu_is_omap24xx()) { |
152 | clk_disable(rng_ick); | 169 | clk_disable(rng_ick); |
153 | clk_put(rng_ick); | 170 | clk_put(rng_ick); |
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c index 7b3a212c86b1..de26a978fbdd 100644 --- a/drivers/char/keyboard.c +++ b/drivers/char/keyboard.c | |||
@@ -1249,7 +1249,7 @@ static void kbd_keycode(unsigned int keycode, int down, int hw_raw) | |||
1249 | return; | 1249 | return; |
1250 | } | 1250 | } |
1251 | 1251 | ||
1252 | if (keycode > NR_KEYS) | 1252 | if (keycode >= NR_KEYS) |
1253 | if (keycode >= KEY_BRL_DOT1 && keycode <= KEY_BRL_DOT8) | 1253 | if (keycode >= KEY_BRL_DOT1 && keycode <= KEY_BRL_DOT8) |
1254 | keysym = K(KT_BRL, keycode - KEY_BRL_DOT1 + 1); | 1254 | keysym = K(KT_BRL, keycode - KEY_BRL_DOT1 + 1); |
1255 | else | 1255 | else |
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 | ||
1208 | static int uuid_strategy(ctl_table *table, int __user *name, int nlen, | 1208 | static 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; | |||
96 | static int rtc_irq; | 96 | static 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 | ||
331 | static void sysrq_handle_kill(int key, struct tty_struct *tty) | 333 | static 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 | } |
535 | EXPORT_SYMBOL(unregister_sysrq_key); | 537 | EXPORT_SYMBOL(unregister_sysrq_key); |
538 | |||
539 | #ifdef CONFIG_PROC_FS | ||
540 | /* | ||
541 | * writing 'C' to /proc/sysrq-trigger is like sysrq-C | ||
542 | */ | ||
543 | static 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 | |||
556 | static const struct file_operations proc_sysrq_trigger_operations = { | ||
557 | .write = write_sysrq_trigger, | ||
558 | }; | ||
559 | |||
560 | static int __init sysrq_init(void) | ||
561 | { | ||
562 | proc_create("sysrq-trigger", S_IWUSR, NULL, &proc_sysrq_trigger_operations); | ||
563 | return 0; | ||
564 | } | ||
565 | module_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 | ||
542 | duration: | 542 | duration: |
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 | |||
1250 | out_free: | ||
1251 | kfree(chip); | ||
1252 | kfree(devname); | ||
1253 | return NULL; | ||
1246 | } | 1254 | } |
1247 | EXPORT_SYMBOL_GPL(tpm_register_hardware); | 1255 | EXPORT_SYMBOL_GPL(tpm_register_hardware); |
1248 | 1256 | ||
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index a0f7ffb68087..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 |