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/agp/ali-agp.c2
-rw-r--r--drivers/char/agp/amd-k7-agp.c38
-rw-r--r--drivers/char/agp/amd64-agp.c2
-rw-r--r--drivers/char/agp/ati-agp.c2
-rw-r--r--drivers/char/agp/backend.c2
-rw-r--r--drivers/char/agp/intel-agp.c20
-rw-r--r--drivers/char/agp/nvidia-agp.c24
-rw-r--r--drivers/char/agp/via-agp.c2
-rw-r--r--drivers/char/applicom.c2
-rw-r--r--drivers/char/bsr.c5
-rw-r--r--drivers/char/ds1286.c38
-rw-r--r--drivers/char/ds1302.c24
-rw-r--r--drivers/char/dsp56k.c4
-rw-r--r--drivers/char/epca.c6
-rw-r--r--drivers/char/hvc_console.c10
-rw-r--r--drivers/char/hw_random/omap-rng.c33
-rw-r--r--drivers/char/ip2/ip2main.c12
-rw-r--r--drivers/char/ip27-rtc.c24
-rw-r--r--drivers/char/ipmi/ipmi_devintf.c2
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c2
-rw-r--r--drivers/char/istallion.c5
-rw-r--r--drivers/char/keyboard.c2
-rw-r--r--drivers/char/lp.c4
-rw-r--r--drivers/char/mem.c6
-rw-r--r--drivers/char/misc.c4
-rw-r--r--drivers/char/moxa.c2
-rw-r--r--drivers/char/pc8736x_gpio.c11
-rw-r--r--drivers/char/pcmcia/cm4000_cs.c2
-rw-r--r--drivers/char/pcmcia/cm4040_cs.c3
-rw-r--r--drivers/char/ppdev.c5
-rw-r--r--drivers/char/random.c2
-rw-r--r--drivers/char/raw.c7
-rw-r--r--drivers/char/rtc.c42
-rw-r--r--drivers/char/snsc.c4
-rw-r--r--drivers/char/stallion.c4
-rw-r--r--drivers/char/sx.c6
-rw-r--r--drivers/char/sysrq.c33
-rw-r--r--drivers/char/tpm/tpm.c38
-rw-r--r--drivers/char/tty_io.c7
-rw-r--r--drivers/char/vc_screen.c12
-rw-r--r--drivers/char/viotape.c8
-rw-r--r--drivers/char/vt.c2
-rw-r--r--drivers/char/xilinx_hwicap/xilinx_hwicap.c3
44 files changed, 283 insertions, 192 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/agp/ali-agp.c b/drivers/char/agp/ali-agp.c
index 31dcd9142d54..dc8d1a90971f 100644
--- a/drivers/char/agp/ali-agp.c
+++ b/drivers/char/agp/ali-agp.c
@@ -417,6 +417,6 @@ static void __exit agp_ali_cleanup(void)
417module_init(agp_ali_init); 417module_init(agp_ali_init);
418module_exit(agp_ali_cleanup); 418module_exit(agp_ali_cleanup);
419 419
420MODULE_AUTHOR("Dave Jones <davej@codemonkey.org.uk>"); 420MODULE_AUTHOR("Dave Jones <davej@redhat.com>");
421MODULE_LICENSE("GPL and additional rights"); 421MODULE_LICENSE("GPL and additional rights");
422 422
diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c
index 603a986e96af..3f98254b911f 100644
--- a/drivers/char/agp/amd-k7-agp.c
+++ b/drivers/char/agp/amd-k7-agp.c
@@ -223,12 +223,14 @@ static int amd_irongate_configure(void)
223 223
224 current_size = A_SIZE_LVL2(agp_bridge->current_size); 224 current_size = A_SIZE_LVL2(agp_bridge->current_size);
225 225
226 /* Get the memory mapped registers */ 226 if (!amd_irongate_private.registers) {
227 pci_read_config_dword(agp_bridge->dev, AMD_MMBASE, &temp); 227 /* Get the memory mapped registers */
228 temp = (temp & PCI_BASE_ADDRESS_MEM_MASK); 228 pci_read_config_dword(agp_bridge->dev, AMD_MMBASE, &temp);
229 amd_irongate_private.registers = (volatile u8 __iomem *) ioremap(temp, 4096); 229 temp = (temp & PCI_BASE_ADDRESS_MEM_MASK);
230 if (!amd_irongate_private.registers) 230 amd_irongate_private.registers = (volatile u8 __iomem *) ioremap(temp, 4096);
231 return -ENOMEM; 231 if (!amd_irongate_private.registers)
232 return -ENOMEM;
233 }
232 234
233 /* Write out the address of the gatt table */ 235 /* Write out the address of the gatt table */
234 writel(agp_bridge->gatt_bus_addr, amd_irongate_private.registers+AMD_ATTBASE); 236 writel(agp_bridge->gatt_bus_addr, amd_irongate_private.registers+AMD_ATTBASE);
@@ -492,6 +494,26 @@ static void __devexit agp_amdk7_remove(struct pci_dev *pdev)
492 agp_put_bridge(bridge); 494 agp_put_bridge(bridge);
493} 495}
494 496
497#ifdef CONFIG_PM
498
499static int agp_amdk7_suspend(struct pci_dev *pdev, pm_message_t state)
500{
501 pci_save_state(pdev);
502 pci_set_power_state(pdev, pci_choose_state(pdev, state));
503
504 return 0;
505}
506
507static int agp_amdk7_resume(struct pci_dev *pdev)
508{
509 pci_set_power_state(pdev, PCI_D0);
510 pci_restore_state(pdev);
511
512 return amd_irongate_driver.configure();
513}
514
515#endif /* CONFIG_PM */
516
495/* must be the same order as name table above */ 517/* must be the same order as name table above */
496static struct pci_device_id agp_amdk7_pci_table[] = { 518static struct pci_device_id agp_amdk7_pci_table[] = {
497 { 519 {
@@ -528,6 +550,10 @@ static struct pci_driver agp_amdk7_pci_driver = {
528 .id_table = agp_amdk7_pci_table, 550 .id_table = agp_amdk7_pci_table,
529 .probe = agp_amdk7_probe, 551 .probe = agp_amdk7_probe,
530 .remove = agp_amdk7_remove, 552 .remove = agp_amdk7_remove,
553#ifdef CONFIG_PM
554 .suspend = agp_amdk7_suspend,
555 .resume = agp_amdk7_resume,
556#endif
531}; 557};
532 558
533static int __init agp_amdk7_init(void) 559static int __init agp_amdk7_init(void)
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
index 2812ee2b165a..52f4361eb6e4 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -772,6 +772,6 @@ module_init(agp_amd64_init);
772module_exit(agp_amd64_cleanup); 772module_exit(agp_amd64_cleanup);
773#endif 773#endif
774 774
775MODULE_AUTHOR("Dave Jones <davej@codemonkey.org.uk>, Andi Kleen"); 775MODULE_AUTHOR("Dave Jones <davej@redhat.com>, Andi Kleen");
776module_param(agp_try_unsupported, bool, 0); 776module_param(agp_try_unsupported, bool, 0);
777MODULE_LICENSE("GPL"); 777MODULE_LICENSE("GPL");
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c
index ae2791b926b9..f1537eece07f 100644
--- a/drivers/char/agp/ati-agp.c
+++ b/drivers/char/agp/ati-agp.c
@@ -561,6 +561,6 @@ static void __exit agp_ati_cleanup(void)
561module_init(agp_ati_init); 561module_init(agp_ati_init);
562module_exit(agp_ati_cleanup); 562module_exit(agp_ati_cleanup);
563 563
564MODULE_AUTHOR("Dave Jones <davej@codemonkey.org.uk>"); 564MODULE_AUTHOR("Dave Jones <davej@redhat.com>");
565MODULE_LICENSE("GPL and additional rights"); 565MODULE_LICENSE("GPL and additional rights");
566 566
diff --git a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c
index 3a3cc03d401c..8c617ad7497f 100644
--- a/drivers/char/agp/backend.c
+++ b/drivers/char/agp/backend.c
@@ -349,7 +349,7 @@ static __init int agp_setup(char *s)
349__setup("agp=", agp_setup); 349__setup("agp=", agp_setup);
350#endif 350#endif
351 351
352MODULE_AUTHOR("Dave Jones <davej@codemonkey.org.uk>"); 352MODULE_AUTHOR("Dave Jones <davej@redhat.com>");
353MODULE_DESCRIPTION("AGP GART driver"); 353MODULE_DESCRIPTION("AGP GART driver");
354MODULE_LICENSE("GPL and additional rights"); 354MODULE_LICENSE("GPL and additional rights");
355MODULE_ALIAS_MISCDEV(AGPGART_MINOR); 355MODULE_ALIAS_MISCDEV(AGPGART_MINOR);
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index 043e36628d6d..9cf6e9bb017e 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -54,8 +54,7 @@
54 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965Q_HB || \ 54 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965Q_HB || \
55 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_HB || \ 55 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_HB || \
56 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GM_HB || \ 56 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GM_HB || \
57 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GME_HB || \ 57 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GME_HB)
58 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_GM45_HB)
59 58
60#define IS_G33 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G33_HB || \ 59#define IS_G33 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G33_HB || \
61 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q35_HB || \ 60 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q35_HB || \
@@ -63,7 +62,8 @@
63 62
64#define IS_G4X (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGD_E_HB || \ 63#define IS_G4X (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGD_E_HB || \
65 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q45_HB || \ 64 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q45_HB || \
66 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G45_HB) 65 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G45_HB || \
66 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_GM45_HB)
67 67
68extern int agp_memory_reserved; 68extern int agp_memory_reserved;
69 69
@@ -214,8 +214,8 @@ static int intel_i810_configure(void)
214 if (agp_bridge->driver->needs_scratch_page) { 214 if (agp_bridge->driver->needs_scratch_page) {
215 for (i = 0; i < current_size->num_entries; i++) { 215 for (i = 0; i < current_size->num_entries; i++) {
216 writel(agp_bridge->scratch_page, intel_private.registers+I810_PTE_BASE+(i*4)); 216 writel(agp_bridge->scratch_page, intel_private.registers+I810_PTE_BASE+(i*4));
217 readl(intel_private.registers+I810_PTE_BASE+(i*4)); /* PCI posting. */
218 } 217 }
218 readl(intel_private.registers+I810_PTE_BASE+((i-1)*4)); /* PCI posting. */
219 } 219 }
220 global_cache_flush(); 220 global_cache_flush();
221 return 0; 221 return 0;
@@ -525,8 +525,10 @@ static void intel_i830_init_gtt_entries(void)
525 size += 4; 525 size += 4;
526 } else if (IS_G4X) { 526 } else if (IS_G4X) {
527 /* On 4 series hardware, GTT stolen is separate from graphics 527 /* On 4 series hardware, GTT stolen is separate from graphics
528 * stolen, ignore it in stolen gtt entries counting */ 528 * stolen, ignore it in stolen gtt entries counting. However,
529 size = 0; 529 * 4KB of the stolen memory doesn't get mapped to the GTT.
530 */
531 size = 4;
530 } else { 532 } else {
531 /* On previous hardware, the GTT size was just what was 533 /* On previous hardware, the GTT size was just what was
532 * required to map the aperture. 534 * required to map the aperture.
@@ -773,8 +775,8 @@ static int intel_i830_configure(void)
773 if (agp_bridge->driver->needs_scratch_page) { 775 if (agp_bridge->driver->needs_scratch_page) {
774 for (i = intel_private.gtt_entries; i < current_size->num_entries; i++) { 776 for (i = intel_private.gtt_entries; i < current_size->num_entries; i++) {
775 writel(agp_bridge->scratch_page, intel_private.registers+I810_PTE_BASE+(i*4)); 777 writel(agp_bridge->scratch_page, intel_private.registers+I810_PTE_BASE+(i*4));
776 readl(intel_private.registers+I810_PTE_BASE+(i*4)); /* PCI Posting. */
777 } 778 }
779 readl(intel_private.registers+I810_PTE_BASE+((i-1)*4)); /* PCI Posting. */
778 } 780 }
779 781
780 global_cache_flush(); 782 global_cache_flush();
@@ -989,8 +991,8 @@ static int intel_i915_configure(void)
989 if (agp_bridge->driver->needs_scratch_page) { 991 if (agp_bridge->driver->needs_scratch_page) {
990 for (i = intel_private.gtt_entries; i < current_size->num_entries; i++) { 992 for (i = intel_private.gtt_entries; i < current_size->num_entries; i++) {
991 writel(agp_bridge->scratch_page, intel_private.gtt+i); 993 writel(agp_bridge->scratch_page, intel_private.gtt+i);
992 readl(intel_private.gtt+i); /* PCI Posting. */
993 } 994 }
995 readl(intel_private.gtt+i-1); /* PCI Posting. */
994 } 996 }
995 997
996 global_cache_flush(); 998 global_cache_flush();
@@ -2388,5 +2390,5 @@ static void __exit agp_intel_cleanup(void)
2388module_init(agp_intel_init); 2390module_init(agp_intel_init);
2389module_exit(agp_intel_cleanup); 2391module_exit(agp_intel_cleanup);
2390 2392
2391MODULE_AUTHOR("Dave Jones <davej@codemonkey.org.uk>"); 2393MODULE_AUTHOR("Dave Jones <davej@redhat.com>");
2392MODULE_LICENSE("GPL and additional rights"); 2394MODULE_LICENSE("GPL and additional rights");
diff --git a/drivers/char/agp/nvidia-agp.c b/drivers/char/agp/nvidia-agp.c
index dc70d3771811..16acee2de117 100644
--- a/drivers/char/agp/nvidia-agp.c
+++ b/drivers/char/agp/nvidia-agp.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Nvidia AGPGART routines. 2 * Nvidia AGPGART routines.
3 * Based upon a 2.4 agpgart diff by the folks from NVIDIA, and hacked up 3 * Based upon a 2.4 agpgart diff by the folks from NVIDIA, and hacked up
4 * to work in 2.5 by Dave Jones <davej@codemonkey.org.uk> 4 * to work in 2.5 by Dave Jones <davej@redhat.com>
5 */ 5 */
6 6
7#include <linux/module.h> 7#include <linux/module.h>
@@ -201,10 +201,15 @@ extern int agp_memory_reserved;
201static int nvidia_insert_memory(struct agp_memory *mem, off_t pg_start, int type) 201static int nvidia_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
202{ 202{
203 int i, j; 203 int i, j;
204 int mask_type;
204 205
205 if ((type != 0) || (mem->type != 0)) 206 mask_type = agp_generic_type_to_mask_type(mem->bridge, type);
207 if (mask_type != 0 || type != mem->type)
206 return -EINVAL; 208 return -EINVAL;
207 209
210 if (mem->page_count == 0)
211 return 0;
212
208 if ((pg_start + mem->page_count) > 213 if ((pg_start + mem->page_count) >
209 (nvidia_private.num_active_entries - agp_memory_reserved/PAGE_SIZE)) 214 (nvidia_private.num_active_entries - agp_memory_reserved/PAGE_SIZE))
210 return -EINVAL; 215 return -EINVAL;
@@ -220,10 +225,13 @@ static int nvidia_insert_memory(struct agp_memory *mem, off_t pg_start, int type
220 } 225 }
221 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { 226 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
222 writel(agp_bridge->driver->mask_memory(agp_bridge, 227 writel(agp_bridge->driver->mask_memory(agp_bridge,
223 mem->memory[i], mem->type), 228 mem->memory[i], mask_type),
224 agp_bridge->gatt_table+nvidia_private.pg_offset+j); 229 agp_bridge->gatt_table+nvidia_private.pg_offset+j);
225 readl(agp_bridge->gatt_table+nvidia_private.pg_offset+j); /* PCI Posting. */
226 } 230 }
231
232 /* PCI Posting. */
233 readl(agp_bridge->gatt_table+nvidia_private.pg_offset+j - 1);
234
227 agp_bridge->driver->tlb_flush(mem); 235 agp_bridge->driver->tlb_flush(mem);
228 return 0; 236 return 0;
229} 237}
@@ -233,9 +241,15 @@ static int nvidia_remove_memory(struct agp_memory *mem, off_t pg_start, int type
233{ 241{
234 int i; 242 int i;
235 243
236 if ((type != 0) || (mem->type != 0)) 244 int mask_type;
245
246 mask_type = agp_generic_type_to_mask_type(mem->bridge, type);
247 if (mask_type != 0 || type != mem->type)
237 return -EINVAL; 248 return -EINVAL;
238 249
250 if (mem->page_count == 0)
251 return 0;
252
239 for (i = pg_start; i < (mem->page_count + pg_start); i++) 253 for (i = pg_start; i < (mem->page_count + pg_start); i++)
240 writel(agp_bridge->scratch_page, agp_bridge->gatt_table+nvidia_private.pg_offset+i); 254 writel(agp_bridge->scratch_page, agp_bridge->gatt_table+nvidia_private.pg_offset+i);
241 255
diff --git a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c
index 9f4d49e1b59a..d3bd243867fc 100644
--- a/drivers/char/agp/via-agp.c
+++ b/drivers/char/agp/via-agp.c
@@ -595,4 +595,4 @@ module_init(agp_via_init);
595module_exit(agp_via_cleanup); 595module_exit(agp_via_cleanup);
596 596
597MODULE_LICENSE("GPL"); 597MODULE_LICENSE("GPL");
598MODULE_AUTHOR("Dave Jones <davej@codemonkey.org.uk>"); 598MODULE_AUTHOR("Dave Jones <davej@redhat.com>");
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/bsr.c b/drivers/char/bsr.c
index b650b4e48e50..456f54db73e2 100644
--- a/drivers/char/bsr.c
+++ b/drivers/char/bsr.c
@@ -229,9 +229,8 @@ static int bsr_create_devs(struct device_node *bn)
229 if (result) 229 if (result)
230 goto out_err; 230 goto out_err;
231 231
232 cur->bsr_device = device_create_drvdata(bsr_class, NULL, 232 cur->bsr_device = device_create(bsr_class, NULL, cur->bsr_dev,
233 cur->bsr_dev, 233 cur, cur->bsr_name);
234 cur, cur->bsr_name);
235 if (!cur->bsr_device) { 234 if (!cur->bsr_device) {
236 printk(KERN_ERR "device_create failed for %s\n", 235 printk(KERN_ERR "device_create failed for %s\n",
237 cur->bsr_name); 236 cur->bsr_name);
diff --git a/drivers/char/ds1286.c b/drivers/char/ds1286.c
index fb584938c9c3..0a826d7be10e 100644
--- a/drivers/char/ds1286.c
+++ b/drivers/char/ds1286.c
@@ -210,8 +210,8 @@ static int ds1286_ioctl(struct inode *inode, struct file *file,
210 if (sec != 0) 210 if (sec != 0)
211 return -EINVAL; 211 return -EINVAL;
212 212
213 min = BIN2BCD(min); 213 min = bin2bcd(min);
214 min = BIN2BCD(hrs); 214 min = bin2bcd(hrs);
215 215
216 spin_lock(&ds1286_lock); 216 spin_lock(&ds1286_lock);
217 rtc_write(hrs, RTC_HOURS_ALARM); 217 rtc_write(hrs, RTC_HOURS_ALARM);
@@ -353,7 +353,7 @@ static int ds1286_proc_output(char *buf)
353 353
354 ds1286_get_time(&tm); 354 ds1286_get_time(&tm);
355 hundredth = rtc_read(RTC_HUNDREDTH_SECOND); 355 hundredth = rtc_read(RTC_HUNDREDTH_SECOND);
356 BCD_TO_BIN(hundredth); 356 hundredth = bcd2bin(hundredth);
357 357
358 p += sprintf(p, 358 p += sprintf(p,
359 "rtc_time\t: %02d:%02d:%02d.%02d\n" 359 "rtc_time\t: %02d:%02d:%02d.%02d\n"
@@ -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
@@ -479,12 +477,12 @@ static void ds1286_get_time(struct rtc_time *rtc_tm)
479 rtc_write(save_control, RTC_CMD); 477 rtc_write(save_control, RTC_CMD);
480 spin_unlock_irqrestore(&ds1286_lock, flags); 478 spin_unlock_irqrestore(&ds1286_lock, flags);
481 479
482 BCD_TO_BIN(rtc_tm->tm_sec); 480 rtc_tm->tm_sec = bcd2bin(rtc_tm->tm_sec);
483 BCD_TO_BIN(rtc_tm->tm_min); 481 rtc_tm->tm_min = bcd2bin(rtc_tm->tm_min);
484 BCD_TO_BIN(rtc_tm->tm_hour); 482 rtc_tm->tm_hour = bcd2bin(rtc_tm->tm_hour);
485 BCD_TO_BIN(rtc_tm->tm_mday); 483 rtc_tm->tm_mday = bcd2bin(rtc_tm->tm_mday);
486 BCD_TO_BIN(rtc_tm->tm_mon); 484 rtc_tm->tm_mon = bcd2bin(rtc_tm->tm_mon);
487 BCD_TO_BIN(rtc_tm->tm_year); 485 rtc_tm->tm_year = bcd2bin(rtc_tm->tm_year);
488 486
489 /* 487 /*
490 * Account for differences between how the RTC uses the values 488 * Account for differences between how the RTC uses the values
@@ -533,12 +531,12 @@ static int ds1286_set_time(struct rtc_time *rtc_tm)
533 if (yrs >= 100) 531 if (yrs >= 100)
534 yrs -= 100; 532 yrs -= 100;
535 533
536 BIN_TO_BCD(sec); 534 sec = bin2bcd(sec);
537 BIN_TO_BCD(min); 535 min = bin2bcd(min);
538 BIN_TO_BCD(hrs); 536 hrs = bin2bcd(hrs);
539 BIN_TO_BCD(day); 537 day = bin2bcd(day);
540 BIN_TO_BCD(mon); 538 mon = bin2bcd(mon);
541 BIN_TO_BCD(yrs); 539 yrs = bin2bcd(yrs);
542 540
543 spin_lock_irqsave(&ds1286_lock, flags); 541 spin_lock_irqsave(&ds1286_lock, flags);
544 save_control = rtc_read(RTC_CMD); 542 save_control = rtc_read(RTC_CMD);
@@ -574,8 +572,8 @@ static void ds1286_get_alm_time(struct rtc_time *alm_tm)
574 cmd = rtc_read(RTC_CMD); 572 cmd = rtc_read(RTC_CMD);
575 spin_unlock_irqrestore(&ds1286_lock, flags); 573 spin_unlock_irqrestore(&ds1286_lock, flags);
576 574
577 BCD_TO_BIN(alm_tm->tm_min); 575 alm_tm->tm_min = bcd2bin(alm_tm->tm_min);
578 BCD_TO_BIN(alm_tm->tm_hour); 576 alm_tm->tm_hour = bcd2bin(alm_tm->tm_hour);
579 alm_tm->tm_sec = 0; 577 alm_tm->tm_sec = 0;
580} 578}
581 579
diff --git a/drivers/char/ds1302.c b/drivers/char/ds1302.c
index c5e67a623951..170693c93c73 100644
--- a/drivers/char/ds1302.c
+++ b/drivers/char/ds1302.c
@@ -131,12 +131,12 @@ get_rtc_time(struct rtc_time *rtc_tm)
131 131
132 local_irq_restore(flags); 132 local_irq_restore(flags);
133 133
134 BCD_TO_BIN(rtc_tm->tm_sec); 134 rtc_tm->tm_sec = bcd2bin(rtc_tm->tm_sec);
135 BCD_TO_BIN(rtc_tm->tm_min); 135 rtc_tm->tm_min = bcd2bin(rtc_tm->tm_min);
136 BCD_TO_BIN(rtc_tm->tm_hour); 136 rtc_tm->tm_hour = bcd2bin(rtc_tm->tm_hour);
137 BCD_TO_BIN(rtc_tm->tm_mday); 137 rtc_tm->tm_mday = bcd2bin(rtc_tm->tm_mday);
138 BCD_TO_BIN(rtc_tm->tm_mon); 138 rtc_tm->tm_mon = bcd2bin(rtc_tm->tm_mon);
139 BCD_TO_BIN(rtc_tm->tm_year); 139 rtc_tm->tm_year = bcd2bin(rtc_tm->tm_year);
140 140
141 /* 141 /*
142 * Account for differences between how the RTC uses the values 142 * Account for differences between how the RTC uses the values
@@ -211,12 +211,12 @@ static long rtc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
211 else 211 else
212 yrs -= 1900; /* RTC (70, 71, ... 99) */ 212 yrs -= 1900; /* RTC (70, 71, ... 99) */
213 213
214 BIN_TO_BCD(sec); 214 sec = bin2bcd(sec);
215 BIN_TO_BCD(min); 215 min = bin2bcd(min);
216 BIN_TO_BCD(hrs); 216 hrs = bin2bcd(hrs);
217 BIN_TO_BCD(day); 217 day = bin2bcd(day);
218 BIN_TO_BCD(mon); 218 mon = bin2bcd(mon);
219 BIN_TO_BCD(yrs); 219 yrs = bin2bcd(yrs);
220 220
221 lock_kernel(); 221 lock_kernel();
222 local_irq_save(flags); 222 local_irq_save(flags);
diff --git a/drivers/char/dsp56k.c b/drivers/char/dsp56k.c
index ca7c72a486b2..85832ab924e6 100644
--- a/drivers/char/dsp56k.c
+++ b/drivers/char/dsp56k.c
@@ -508,8 +508,8 @@ static int __init dsp56k_init_driver(void)
508 err = PTR_ERR(dsp56k_class); 508 err = PTR_ERR(dsp56k_class);
509 goto out_chrdev; 509 goto out_chrdev;
510 } 510 }
511 device_create_drvdata(dsp56k_class, NULL, MKDEV(DSP56K_MAJOR, 0), 511 device_create(dsp56k_class, NULL, MKDEV(DSP56K_MAJOR, 0), NULL,
512 NULL, "dsp56k"); 512 "dsp56k");
513 513
514 printk(banner); 514 printk(banner);
515 goto out; 515 goto out;
diff --git a/drivers/char/epca.c b/drivers/char/epca.c
index 4998b2761e8f..cf2461d34e5f 100644
--- a/drivers/char/epca.c
+++ b/drivers/char/epca.c
@@ -2477,7 +2477,11 @@ static int pc_send_break(struct tty_struct *tty, int msec)
2477 unsigned long flags; 2477 unsigned long flags;
2478 2478
2479 if (msec == -1) 2479 if (msec == -1)
2480 return -EOPNOTSUPP; 2480 msec = 0xFFFF;
2481 else if (msec > 0xFFFE)
2482 msec = 0xFFFE;
2483 else if (msec < 1)
2484 msec = 1;
2481 2485
2482 spin_lock_irqsave(&epca_lock, flags); 2486 spin_lock_irqsave(&epca_lock, flags);
2483 globalwinon(ch); 2487 globalwinon(ch);
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/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
145err_register:
146 iounmap(rng_base);
147 rng_base = NULL;
148err_ioremap:
149 release_resource(mem);
150err_region:
151 if (cpu_is_omap24xx()) {
152 clk_disable(rng_ick);
153 clk_put(rng_ick);
154 }
155 return ret;
141} 156}
142 157
143static int __exit omap_rng_remove(struct platform_device *pdev) 158static 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/ip2/ip2main.c b/drivers/char/ip2/ip2main.c
index 6774572d3759..70e0ebc30bd0 100644
--- a/drivers/char/ip2/ip2main.c
+++ b/drivers/char/ip2/ip2main.c
@@ -745,12 +745,12 @@ static int __init ip2_loadmain(void)
745 745
746 pB = i2BoardPtrTable[i]; 746 pB = i2BoardPtrTable[i];
747 if (pB != NULL) { 747 if (pB != NULL) {
748 device_create_drvdata(ip2_class, NULL, 748 device_create(ip2_class, NULL,
749 MKDEV(IP2_IPL_MAJOR, 4 * i), 749 MKDEV(IP2_IPL_MAJOR, 4 * i),
750 NULL, "ipl%d", i); 750 NULL, "ipl%d", i);
751 device_create_drvdata(ip2_class, NULL, 751 device_create(ip2_class, NULL,
752 MKDEV(IP2_IPL_MAJOR, 4 * i + 1), 752 MKDEV(IP2_IPL_MAJOR, 4 * i + 1),
753 NULL, "stat%d", i); 753 NULL, "stat%d", i);
754 754
755 for (box = 0; box < ABS_MAX_BOXES; box++) 755 for (box = 0; box < ABS_MAX_BOXES; box++)
756 for (j = 0; j < ABS_BIGGEST_BOX; j++) 756 for (j = 0; j < ABS_BIGGEST_BOX; j++)
diff --git a/drivers/char/ip27-rtc.c b/drivers/char/ip27-rtc.c
index ec9d0443d92c..2abd881b4cbc 100644
--- a/drivers/char/ip27-rtc.c
+++ b/drivers/char/ip27-rtc.c
@@ -130,12 +130,12 @@ static long rtc_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
130 if (yrs >= 100) 130 if (yrs >= 100)
131 yrs -= 100; 131 yrs -= 100;
132 132
133 sec = BIN2BCD(sec); 133 sec = bin2bcd(sec);
134 min = BIN2BCD(min); 134 min = bin2bcd(min);
135 hrs = BIN2BCD(hrs); 135 hrs = bin2bcd(hrs);
136 day = BIN2BCD(day); 136 day = bin2bcd(day);
137 mon = BIN2BCD(mon); 137 mon = bin2bcd(mon);
138 yrs = BIN2BCD(yrs); 138 yrs = bin2bcd(yrs);
139 139
140 spin_lock_irq(&rtc_lock); 140 spin_lock_irq(&rtc_lock);
141 rtc->control |= M48T35_RTC_SET; 141 rtc->control |= M48T35_RTC_SET;
@@ -311,12 +311,12 @@ static void get_rtc_time(struct rtc_time *rtc_tm)
311 rtc->control &= ~M48T35_RTC_READ; 311 rtc->control &= ~M48T35_RTC_READ;
312 spin_unlock_irq(&rtc_lock); 312 spin_unlock_irq(&rtc_lock);
313 313
314 rtc_tm->tm_sec = BCD2BIN(rtc_tm->tm_sec); 314 rtc_tm->tm_sec = bcd2bin(rtc_tm->tm_sec);
315 rtc_tm->tm_min = BCD2BIN(rtc_tm->tm_min); 315 rtc_tm->tm_min = bcd2bin(rtc_tm->tm_min);
316 rtc_tm->tm_hour = BCD2BIN(rtc_tm->tm_hour); 316 rtc_tm->tm_hour = bcd2bin(rtc_tm->tm_hour);
317 rtc_tm->tm_mday = BCD2BIN(rtc_tm->tm_mday); 317 rtc_tm->tm_mday = bcd2bin(rtc_tm->tm_mday);
318 rtc_tm->tm_mon = BCD2BIN(rtc_tm->tm_mon); 318 rtc_tm->tm_mon = bcd2bin(rtc_tm->tm_mon);
319 rtc_tm->tm_year = BCD2BIN(rtc_tm->tm_year); 319 rtc_tm->tm_year = bcd2bin(rtc_tm->tm_year);
320 320
321 /* 321 /*
322 * Account for differences between how the RTC uses the values 322 * Account for differences between how the RTC uses the values
diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c
index 64e1c169e826..835a33c8d5f5 100644
--- a/drivers/char/ipmi/ipmi_devintf.c
+++ b/drivers/char/ipmi/ipmi_devintf.c
@@ -871,7 +871,7 @@ static void ipmi_new_smi(int if_num, struct device *device)
871 entry->dev = dev; 871 entry->dev = dev;
872 872
873 mutex_lock(&reg_list_mutex); 873 mutex_lock(&reg_list_mutex);
874 device_create_drvdata(ipmi_class, device, dev, NULL, "ipmi%d", if_num); 874 device_create(ipmi_class, device, dev, NULL, "ipmi%d", if_num);
875 list_add(&entry->link, &reg_list); 875 list_add(&entry->link, &reg_list);
876 mutex_unlock(&reg_list_mutex); 876 mutex_unlock(&reg_list_mutex);
877} 877}
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/istallion.c b/drivers/char/istallion.c
index 505d7a1f6b8c..44e5d60f517e 100644
--- a/drivers/char/istallion.c
+++ b/drivers/char/istallion.c
@@ -4600,9 +4600,8 @@ static int __init istallion_module_init(void)
4600 4600
4601 istallion_class = class_create(THIS_MODULE, "staliomem"); 4601 istallion_class = class_create(THIS_MODULE, "staliomem");
4602 for (i = 0; i < 4; i++) 4602 for (i = 0; i < 4; i++)
4603 device_create_drvdata(istallion_class, NULL, 4603 device_create(istallion_class, NULL, MKDEV(STL_SIOMEMMAJOR, i),
4604 MKDEV(STL_SIOMEMMAJOR, i), 4604 NULL, "staliomem%d", i);
4605 NULL, "staliomem%d", i);
4606 4605
4607 return 0; 4606 return 0;
4608err_deinit: 4607err_deinit:
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/lp.c b/drivers/char/lp.c
index 3f2719b9f77b..e444c2dba160 100644
--- a/drivers/char/lp.c
+++ b/drivers/char/lp.c
@@ -813,8 +813,8 @@ static int lp_register(int nr, struct parport *port)
813 if (reset) 813 if (reset)
814 lp_reset(nr); 814 lp_reset(nr);
815 815
816 device_create_drvdata(lp_class, port->dev, MKDEV(LP_MAJOR, nr), NULL, 816 device_create(lp_class, port->dev, MKDEV(LP_MAJOR, nr), NULL,
817 "lp%d", nr); 817 "lp%d", nr);
818 818
819 printk(KERN_INFO "lp%d: using %s (%s).\n", nr, port->name, 819 printk(KERN_INFO "lp%d: using %s (%s).\n", nr, port->name,
820 (port->irq == PARPORT_IRQ_NONE)?"polling":"interrupt-driven"); 820 (port->irq == PARPORT_IRQ_NONE)?"polling":"interrupt-driven");
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 672b08e694d0..6431f6921a67 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -992,9 +992,9 @@ static int __init chr_dev_init(void)
992 992
993 mem_class = class_create(THIS_MODULE, "mem"); 993 mem_class = class_create(THIS_MODULE, "mem");
994 for (i = 0; i < ARRAY_SIZE(devlist); i++) 994 for (i = 0; i < ARRAY_SIZE(devlist); i++)
995 device_create_drvdata(mem_class, NULL, 995 device_create(mem_class, NULL,
996 MKDEV(MEM_MAJOR, devlist[i].minor), 996 MKDEV(MEM_MAJOR, devlist[i].minor), NULL,
997 NULL, devlist[i].name); 997 devlist[i].name);
998 998
999 return 0; 999 return 0;
1000} 1000}
diff --git a/drivers/char/misc.c b/drivers/char/misc.c
index 999aa779c08a..a5e0db9d7662 100644
--- a/drivers/char/misc.c
+++ b/drivers/char/misc.c
@@ -217,8 +217,8 @@ int misc_register(struct miscdevice * misc)
217 misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7); 217 misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7);
218 dev = MKDEV(MISC_MAJOR, misc->minor); 218 dev = MKDEV(MISC_MAJOR, misc->minor);
219 219
220 misc->this_device = device_create_drvdata(misc_class, misc->parent, 220 misc->this_device = device_create(misc_class, misc->parent, dev, NULL,
221 dev, NULL, "%s", misc->name); 221 "%s", misc->name);
222 if (IS_ERR(misc->this_device)) { 222 if (IS_ERR(misc->this_device)) {
223 err = PTR_ERR(misc->this_device); 223 err = PTR_ERR(misc->this_device);
224 goto out; 224 goto out;
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/pc8736x_gpio.c b/drivers/char/pc8736x_gpio.c
index b930de50407a..3f7da8cf3a80 100644
--- a/drivers/char/pc8736x_gpio.c
+++ b/drivers/char/pc8736x_gpio.c
@@ -41,7 +41,8 @@ static u8 pc8736x_gpio_shadow[4];
41#define SIO_BASE2 0x4E /* alt command-reg to check */ 41#define SIO_BASE2 0x4E /* alt command-reg to check */
42 42
43#define SIO_SID 0x20 /* SuperI/O ID Register */ 43#define SIO_SID 0x20 /* SuperI/O ID Register */
44#define SIO_SID_VALUE 0xe9 /* Expected value in SuperI/O ID Register */ 44#define SIO_SID_PC87365 0xe5 /* Expected value in ID Register for PC87365 */
45#define SIO_SID_PC87366 0xe9 /* Expected value in ID Register for PC87366 */
45 46
46#define SIO_CF1 0x21 /* chip config, bit0 is chip enable */ 47#define SIO_CF1 0x21 /* chip config, bit0 is chip enable */
47 48
@@ -91,13 +92,17 @@ static inline int superio_inb(int addr)
91 92
92static int pc8736x_superio_present(void) 93static int pc8736x_superio_present(void)
93{ 94{
95 int id;
96
94 /* try the 2 possible values, read a hardware reg to verify */ 97 /* try the 2 possible values, read a hardware reg to verify */
95 superio_cmd = SIO_BASE1; 98 superio_cmd = SIO_BASE1;
96 if (superio_inb(SIO_SID) == SIO_SID_VALUE) 99 id = superio_inb(SIO_SID);
100 if (id == SIO_SID_PC87365 || id == SIO_SID_PC87366)
97 return superio_cmd; 101 return superio_cmd;
98 102
99 superio_cmd = SIO_BASE2; 103 superio_cmd = SIO_BASE2;
100 if (superio_inb(SIO_SID) == SIO_SID_VALUE) 104 id = superio_inb(SIO_SID);
105 if (id == SIO_SID_PC87365 || id == SIO_SID_PC87366)
101 return superio_cmd; 106 return superio_cmd;
102 107
103 return 0; 108 return 0;
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index 1c5bf99895ed..dbb912574569 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -1871,7 +1871,7 @@ static int cm4000_probe(struct pcmcia_device *link)
1871 return ret; 1871 return ret;
1872 } 1872 }
1873 1873
1874 device_create_drvdata(cmm_class, NULL, MKDEV(major, i), NULL, "cmm%d", i); 1874 device_create(cmm_class, NULL, MKDEV(major, i), NULL, "cmm%d", i);
1875 1875
1876 return 0; 1876 return 0;
1877} 1877}
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c
index 2d7c906435b7..4f0723b07974 100644
--- a/drivers/char/pcmcia/cm4040_cs.c
+++ b/drivers/char/pcmcia/cm4040_cs.c
@@ -637,8 +637,7 @@ static int reader_probe(struct pcmcia_device *link)
637 return ret; 637 return ret;
638 } 638 }
639 639
640 device_create_drvdata(cmx_class, NULL, MKDEV(major, i), NULL, 640 device_create(cmx_class, NULL, MKDEV(major, i), NULL, "cmx%d", i);
641 "cmx%d", i);
642 641
643 return 0; 642 return 0;
644} 643}
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c
index bee39fdfba73..c84c34fb1231 100644
--- a/drivers/char/ppdev.c
+++ b/drivers/char/ppdev.c
@@ -760,9 +760,8 @@ static const struct file_operations pp_fops = {
760 760
761static void pp_attach(struct parport *port) 761static void pp_attach(struct parport *port)
762{ 762{
763 device_create_drvdata(ppdev_class, port->dev, 763 device_create(ppdev_class, port->dev, MKDEV(PP_MAJOR, port->number),
764 MKDEV(PP_MAJOR, port->number), 764 NULL, "parport%d", port->number);
765 NULL, "parport%d", port->number);
766} 765}
767 766
768static void pp_detach(struct parport *port) 767static void pp_detach(struct parport *port)
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 1137d2976043..705a839f1796 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1231,7 +1231,7 @@ static int proc_do_uuid(ctl_table *table, int write, struct file *filp,
1231 return proc_dostring(&fake_table, write, filp, buffer, lenp, ppos); 1231 return proc_dostring(&fake_table, write, filp, buffer, lenp, ppos);
1232} 1232}
1233 1233
1234static int uuid_strategy(ctl_table *table, int __user *name, int nlen, 1234static int uuid_strategy(ctl_table *table,
1235 void __user *oldval, size_t __user *oldlenp, 1235 void __user *oldval, size_t __user *oldlenp,
1236 void __user *newval, size_t newlen) 1236 void __user *newval, size_t newlen)
1237{ 1237{
diff --git a/drivers/char/raw.c b/drivers/char/raw.c
index 47b8cf281d4a..e139372d0e69 100644
--- a/drivers/char/raw.c
+++ b/drivers/char/raw.c
@@ -131,8 +131,8 @@ raw_ioctl(struct inode *inode, struct file *filp,
131static void bind_device(struct raw_config_request *rq) 131static void bind_device(struct raw_config_request *rq)
132{ 132{
133 device_destroy(raw_class, MKDEV(RAW_MAJOR, rq->raw_minor)); 133 device_destroy(raw_class, MKDEV(RAW_MAJOR, rq->raw_minor));
134 device_create_drvdata(raw_class, NULL, MKDEV(RAW_MAJOR, rq->raw_minor), 134 device_create(raw_class, NULL, MKDEV(RAW_MAJOR, rq->raw_minor), NULL,
135 NULL, "raw%d", rq->raw_minor); 135 "raw%d", rq->raw_minor);
136} 136}
137 137
138/* 138/*
@@ -283,8 +283,7 @@ static int __init raw_init(void)
283 ret = PTR_ERR(raw_class); 283 ret = PTR_ERR(raw_class);
284 goto error_region; 284 goto error_region;
285 } 285 }
286 device_create_drvdata(raw_class, NULL, MKDEV(RAW_MAJOR, 0), NULL, 286 device_create(raw_class, NULL, MKDEV(RAW_MAJOR, 0), NULL, "rawctl");
287 "rawctl");
288 287
289 return 0; 288 return 0;
290 289
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index b47710c17885..32dc89720d58 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
@@ -518,17 +518,17 @@ static int rtc_do_ioctl(unsigned int cmd, unsigned long arg, int kernel)
518 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || 518 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) ||
519 RTC_ALWAYS_BCD) { 519 RTC_ALWAYS_BCD) {
520 if (sec < 60) 520 if (sec < 60)
521 BIN_TO_BCD(sec); 521 sec = bin2bcd(sec);
522 else 522 else
523 sec = 0xff; 523 sec = 0xff;
524 524
525 if (min < 60) 525 if (min < 60)
526 BIN_TO_BCD(min); 526 min = bin2bcd(min);
527 else 527 else
528 min = 0xff; 528 min = 0xff;
529 529
530 if (hrs < 24) 530 if (hrs < 24)
531 BIN_TO_BCD(hrs); 531 hrs = bin2bcd(hrs);
532 else 532 else
533 hrs = 0xff; 533 hrs = 0xff;
534 } 534 }
@@ -614,12 +614,12 @@ static int rtc_do_ioctl(unsigned int cmd, unsigned long arg, int kernel)
614 614
615 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) 615 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY)
616 || RTC_ALWAYS_BCD) { 616 || RTC_ALWAYS_BCD) {
617 BIN_TO_BCD(sec); 617 sec = bin2bcd(sec);
618 BIN_TO_BCD(min); 618 min = bin2bcd(min);
619 BIN_TO_BCD(hrs); 619 hrs = bin2bcd(hrs);
620 BIN_TO_BCD(day); 620 day = bin2bcd(day);
621 BIN_TO_BCD(mon); 621 mon = bin2bcd(mon);
622 BIN_TO_BCD(yrs); 622 yrs = bin2bcd(yrs);
623 } 623 }
624 624
625 save_control = CMOS_READ(RTC_CONTROL); 625 save_control = CMOS_READ(RTC_CONTROL);
@@ -1099,7 +1099,7 @@ no_irq:
1099 spin_unlock_irq(&rtc_lock); 1099 spin_unlock_irq(&rtc_lock);
1100 1100
1101 if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD) 1101 if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
1102 BCD_TO_BIN(year); /* This should never happen... */ 1102 year = bcd2bin(year); /* This should never happen... */
1103 1103
1104 if (year < 20) { 1104 if (year < 20) {
1105 epoch = 2000; 1105 epoch = 2000;
@@ -1352,13 +1352,13 @@ static void rtc_get_rtc_time(struct rtc_time *rtc_tm)
1352 spin_unlock_irqrestore(&rtc_lock, flags); 1352 spin_unlock_irqrestore(&rtc_lock, flags);
1353 1353
1354 if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { 1354 if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
1355 BCD_TO_BIN(rtc_tm->tm_sec); 1355 rtc_tm->tm_sec = bcd2bin(rtc_tm->tm_sec);
1356 BCD_TO_BIN(rtc_tm->tm_min); 1356 rtc_tm->tm_min = bcd2bin(rtc_tm->tm_min);
1357 BCD_TO_BIN(rtc_tm->tm_hour); 1357 rtc_tm->tm_hour = bcd2bin(rtc_tm->tm_hour);
1358 BCD_TO_BIN(rtc_tm->tm_mday); 1358 rtc_tm->tm_mday = bcd2bin(rtc_tm->tm_mday);
1359 BCD_TO_BIN(rtc_tm->tm_mon); 1359 rtc_tm->tm_mon = bcd2bin(rtc_tm->tm_mon);
1360 BCD_TO_BIN(rtc_tm->tm_year); 1360 rtc_tm->tm_year = bcd2bin(rtc_tm->tm_year);
1361 BCD_TO_BIN(rtc_tm->tm_wday); 1361 rtc_tm->tm_wday = bcd2bin(rtc_tm->tm_wday);
1362 } 1362 }
1363 1363
1364#ifdef CONFIG_MACH_DECSTATION 1364#ifdef CONFIG_MACH_DECSTATION
@@ -1392,9 +1392,9 @@ static void get_rtc_alm_time(struct rtc_time *alm_tm)
1392 spin_unlock_irq(&rtc_lock); 1392 spin_unlock_irq(&rtc_lock);
1393 1393
1394 if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { 1394 if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
1395 BCD_TO_BIN(alm_tm->tm_sec); 1395 alm_tm->tm_sec = bcd2bin(alm_tm->tm_sec);
1396 BCD_TO_BIN(alm_tm->tm_min); 1396 alm_tm->tm_min = bcd2bin(alm_tm->tm_min);
1397 BCD_TO_BIN(alm_tm->tm_hour); 1397 alm_tm->tm_hour = bcd2bin(alm_tm->tm_hour);
1398 } 1398 }
1399} 1399}
1400 1400
diff --git a/drivers/char/snsc.c b/drivers/char/snsc.c
index 3ce60df14c0a..32b74de18f5f 100644
--- a/drivers/char/snsc.c
+++ b/drivers/char/snsc.c
@@ -444,8 +444,8 @@ scdrv_init(void)
444 continue; 444 continue;
445 } 445 }
446 446
447 device_create_drvdata(snsc_class, NULL, dev, NULL, 447 device_create(snsc_class, NULL, dev, NULL,
448 "%s", devname); 448 "%s", devname);
449 449
450 ia64_sn_irtr_intr_enable(scd->scd_nasid, 450 ia64_sn_irtr_intr_enable(scd->scd_nasid,
451 0 /*ignored */ , 451 0 /*ignored */ ,
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c
index 8b8f07a7f505..963b03fb29e5 100644
--- a/drivers/char/stallion.c
+++ b/drivers/char/stallion.c
@@ -4743,8 +4743,8 @@ static int __init stallion_module_init(void)
4743 if (IS_ERR(stallion_class)) 4743 if (IS_ERR(stallion_class))
4744 printk("STALLION: failed to create class\n"); 4744 printk("STALLION: failed to create class\n");
4745 for (i = 0; i < 4; i++) 4745 for (i = 0; i < 4; i++)
4746 device_create_drvdata(stallion_class, NULL, MKDEV(STL_SIOMEMMAJOR, i), 4746 device_create(stallion_class, NULL, MKDEV(STL_SIOMEMMAJOR, i),
4747 NULL, "staliomem%d", i); 4747 NULL, "staliomem%d", i);
4748 4748
4749 return 0; 4749 return 0;
4750err_unrtty: 4750err_unrtty:
diff --git a/drivers/char/sx.c b/drivers/char/sx.c
index 5b8d7a1aa3e6..ba4e86281fbf 100644
--- a/drivers/char/sx.c
+++ b/drivers/char/sx.c
@@ -2504,7 +2504,7 @@ static void __devexit sx_remove_card(struct sx_board *board,
2504 del_timer(&board->timer); 2504 del_timer(&board->timer);
2505 if (pdev) { 2505 if (pdev) {
2506#ifdef CONFIG_PCI 2506#ifdef CONFIG_PCI
2507 pci_iounmap(pdev, board->base2); 2507 iounmap(board->base2);
2508 pci_release_region(pdev, IS_CF_BOARD(board) ? 3 : 2); 2508 pci_release_region(pdev, IS_CF_BOARD(board) ? 3 : 2);
2509#endif 2509#endif
2510 } else { 2510 } else {
@@ -2677,7 +2677,7 @@ static int __devinit sx_pci_probe(struct pci_dev *pdev,
2677 } 2677 }
2678 board->hw_base = pci_resource_start(pdev, reg); 2678 board->hw_base = pci_resource_start(pdev, reg);
2679 board->base2 = 2679 board->base2 =
2680 board->base = pci_iomap(pdev, reg, WINDOW_LEN(board)); 2680 board->base = ioremap_nocache(board->hw_base, WINDOW_LEN(board));
2681 if (!board->base) { 2681 if (!board->base) {
2682 dev_err(&pdev->dev, "ioremap failed\n"); 2682 dev_err(&pdev->dev, "ioremap failed\n");
2683 goto err_reg; 2683 goto err_reg;
@@ -2703,7 +2703,7 @@ static int __devinit sx_pci_probe(struct pci_dev *pdev,
2703 2703
2704 return 0; 2704 return 0;
2705err_unmap: 2705err_unmap:
2706 pci_iounmap(pdev, board->base2); 2706 iounmap(board->base2);
2707err_reg: 2707err_reg:
2708 pci_release_region(pdev, reg); 2708 pci_release_region(pdev, reg);
2709err_flag: 2709err_flag:
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c
index 8fdfe9c871e3..ce0d9da52a8a 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>
@@ -167,7 +168,7 @@ static void sysrq_handle_show_timers(int key, struct tty_struct *tty)
167static struct sysrq_key_op sysrq_show_timers_op = { 168static struct sysrq_key_op sysrq_show_timers_op = {
168 .handler = sysrq_handle_show_timers, 169 .handler = sysrq_handle_show_timers,
169 .help_msg = "show-all-timers(Q)", 170 .help_msg = "show-all-timers(Q)",
170 .action_msg = "Show Pending Timers", 171 .action_msg = "Show clockevent devices & pending hrtimers (no others)",
171}; 172};
172 173
173static void sysrq_handle_mountro(int key, struct tty_struct *tty) 174static void sysrq_handle_mountro(int key, struct tty_struct *tty)
@@ -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..9c47dc48c9fd 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}
@@ -1150,7 +1157,7 @@ EXPORT_SYMBOL_GPL(tpm_dev_vendor_release);
1150 * Once all references to platform device are down to 0, 1157 * Once all references to platform device are down to 0,
1151 * release all allocated structures. 1158 * release all allocated structures.
1152 */ 1159 */
1153static void tpm_dev_release(struct device *dev) 1160void tpm_dev_release(struct device *dev)
1154{ 1161{
1155 struct tpm_chip *chip = dev_get_drvdata(dev); 1162 struct tpm_chip *chip = dev_get_drvdata(dev);
1156 1163
@@ -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..59f472143f08 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -2850,7 +2850,7 @@ struct device *tty_register_device(struct tty_driver *driver, unsigned index,
2850 else 2850 else
2851 tty_line_name(driver, index, name); 2851 tty_line_name(driver, index, name);
2852 2852
2853 return device_create_drvdata(tty_class, device, dev, NULL, name); 2853 return device_create(tty_class, device, dev, NULL, name);
2854} 2854}
2855EXPORT_SYMBOL(tty_register_device); 2855EXPORT_SYMBOL(tty_register_device);
2856 2856
@@ -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/vc_screen.c b/drivers/char/vc_screen.c
index c2ae52dd53d1..4f3b3f95fc42 100644
--- a/drivers/char/vc_screen.c
+++ b/drivers/char/vc_screen.c
@@ -481,10 +481,10 @@ static struct class *vc_class;
481 481
482void vcs_make_sysfs(struct tty_struct *tty) 482void vcs_make_sysfs(struct tty_struct *tty)
483{ 483{
484 device_create_drvdata(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 1), 484 device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 1), NULL,
485 NULL, "vcs%u", tty->index + 1); 485 "vcs%u", tty->index + 1);
486 device_create_drvdata(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 129), 486 device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 129), NULL,
487 NULL, "vcsa%u", tty->index + 1); 487 "vcsa%u", tty->index + 1);
488} 488}
489 489
490void vcs_remove_sysfs(struct tty_struct *tty) 490void vcs_remove_sysfs(struct tty_struct *tty)
@@ -499,7 +499,7 @@ int __init vcs_init(void)
499 panic("unable to get major %d for vcs device", VCS_MAJOR); 499 panic("unable to get major %d for vcs device", VCS_MAJOR);
500 vc_class = class_create(THIS_MODULE, "vc"); 500 vc_class = class_create(THIS_MODULE, "vc");
501 501
502 device_create_drvdata(vc_class, NULL, MKDEV(VCS_MAJOR, 0), NULL, "vcs"); 502 device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 0), NULL, "vcs");
503 device_create_drvdata(vc_class, NULL, MKDEV(VCS_MAJOR, 128), NULL, "vcsa"); 503 device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 128), NULL, "vcsa");
504 return 0; 504 return 0;
505} 505}
diff --git a/drivers/char/viotape.c b/drivers/char/viotape.c
index 7a70a40ad639..ffc9254f7e02 100644
--- a/drivers/char/viotape.c
+++ b/drivers/char/viotape.c
@@ -886,10 +886,10 @@ static int viotape_probe(struct vio_dev *vdev, const struct vio_device_id *id)
886 state[i].cur_part = 0; 886 state[i].cur_part = 0;
887 for (j = 0; j < MAX_PARTITIONS; ++j) 887 for (j = 0; j < MAX_PARTITIONS; ++j)
888 state[i].part_stat_rwi[j] = VIOT_IDLE; 888 state[i].part_stat_rwi[j] = VIOT_IDLE;
889 device_create_drvdata(tape_class, NULL, MKDEV(VIOTAPE_MAJOR, i), 889 device_create(tape_class, NULL, MKDEV(VIOTAPE_MAJOR, i), NULL,
890 NULL, "iseries!vt%d", i); 890 "iseries!vt%d", i);
891 device_create_drvdata(tape_class, NULL, MKDEV(VIOTAPE_MAJOR, i | 0x80), 891 device_create(tape_class, NULL, MKDEV(VIOTAPE_MAJOR, i | 0x80), NULL,
892 NULL, "iseries!nvt%d", i); 892 "iseries!nvt%d", i);
893 printk(VIOTAPE_KERN_INFO "tape iseries/vt%d is iSeries " 893 printk(VIOTAPE_KERN_INFO "tape iseries/vt%d is iSeries "
894 "resource %10.10s type %4.4s, model %3.3s\n", 894 "resource %10.10s type %4.4s, model %3.3s\n",
895 i, viotape_unitinfo[i].rsrcname, 895 i, viotape_unitinfo[i].rsrcname,
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
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
index 278c9857bcf5..ed132fe55d3d 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
@@ -657,8 +657,7 @@ static int __devinit hwicap_setup(struct device *dev, int id,
657 goto failed3; 657 goto failed3;
658 } 658 }
659 659
660 device_create_drvdata(icap_class, dev, devt, NULL, 660 device_create(icap_class, dev, devt, NULL, "%s%d", DRIVER_NAME, id);
661 "%s%d", DRIVER_NAME, id);
662 return 0; /* success */ 661 return 0; /* success */
663 662
664 failed3: 663 failed3: