aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/agp/efficeon-agp.c22
-rw-r--r--drivers/char/agp/intel-agp.c26
-rw-r--r--drivers/char/agp/intel-agp.h6
-rw-r--r--drivers/char/agp/intel-gtt.c96
-rw-r--r--drivers/char/bsr.c1
-rw-r--r--drivers/char/hvc_console.c12
-rw-r--r--drivers/char/hvsi.c4
-rw-r--r--drivers/char/hw_random/n2-drv.c6
-rw-r--r--drivers/char/keyboard.c6
-rw-r--r--drivers/char/mem.c2
-rw-r--r--drivers/char/random.c2
-rw-r--r--drivers/char/synclink_gt.c2
-rw-r--r--drivers/char/tpm/tpm_tis.c9
-rw-r--r--drivers/char/tty_io.c4
-rw-r--r--drivers/char/vt.c78
15 files changed, 222 insertions, 54 deletions
diff --git a/drivers/char/agp/efficeon-agp.c b/drivers/char/agp/efficeon-agp.c
index aa109cbe0e6e..d607f53d8afc 100644
--- a/drivers/char/agp/efficeon-agp.c
+++ b/drivers/char/agp/efficeon-agp.c
@@ -372,6 +372,17 @@ static int __devinit agp_efficeon_probe(struct pci_dev *pdev,
372 bridge->capndx = cap_ptr; 372 bridge->capndx = cap_ptr;
373 373
374 /* 374 /*
375 * If the device has not been properly setup, the following will catch
376 * the problem and should stop the system from crashing.
377 * 20030610 - hamish@zot.org
378 */
379 if (pci_enable_device(pdev)) {
380 printk(KERN_ERR PFX "Unable to Enable PCI device\n");
381 agp_put_bridge(bridge);
382 return -ENODEV;
383 }
384
385 /*
375 * The following fixes the case where the BIOS has "forgotten" to 386 * The following fixes the case where the BIOS has "forgotten" to
376 * provide an address range for the GART. 387 * provide an address range for the GART.
377 * 20030610 - hamish@zot.org 388 * 20030610 - hamish@zot.org
@@ -385,17 +396,6 @@ static int __devinit agp_efficeon_probe(struct pci_dev *pdev,
385 } 396 }
386 } 397 }
387 398
388 /*
389 * If the device has not been properly setup, the following will catch
390 * the problem and should stop the system from crashing.
391 * 20030610 - hamish@zot.org
392 */
393 if (pci_enable_device(pdev)) {
394 printk(KERN_ERR PFX "Unable to Enable PCI device\n");
395 agp_put_bridge(bridge);
396 return -ENODEV;
397 }
398
399 /* Fill in the mode register */ 399 /* Fill in the mode register */
400 if (cap_ptr) { 400 if (cap_ptr) {
401 pci_read_config_dword(pdev, 401 pci_read_config_dword(pdev,
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index d836a71bf06d..ddf5def1b0da 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -816,9 +816,9 @@ static const struct intel_driver_description {
816 { PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB, PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG, 816 { PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB, PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG,
817 "HD Graphics", NULL, &intel_i965_driver }, 817 "HD Graphics", NULL, &intel_i965_driver },
818 { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_IG, 818 { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_IG,
819 "Sandybridge", NULL, &intel_i965_driver }, 819 "Sandybridge", NULL, &intel_gen6_driver },
820 { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_IG, 820 { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB, PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_IG,
821 "Sandybridge", NULL, &intel_i965_driver }, 821 "Sandybridge", NULL, &intel_gen6_driver },
822 { 0, 0, NULL, NULL, NULL } 822 { 0, 0, NULL, NULL, NULL }
823}; 823};
824 824
@@ -908,6 +908,17 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
908 dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name); 908 dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name);
909 909
910 /* 910 /*
911 * If the device has not been properly setup, the following will catch
912 * the problem and should stop the system from crashing.
913 * 20030610 - hamish@zot.org
914 */
915 if (pci_enable_device(pdev)) {
916 dev_err(&pdev->dev, "can't enable PCI device\n");
917 agp_put_bridge(bridge);
918 return -ENODEV;
919 }
920
921 /*
911 * The following fixes the case where the BIOS has "forgotten" to 922 * The following fixes the case where the BIOS has "forgotten" to
912 * provide an address range for the GART. 923 * provide an address range for the GART.
913 * 20030610 - hamish@zot.org 924 * 20030610 - hamish@zot.org
@@ -921,17 +932,6 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
921 } 932 }
922 } 933 }
923 934
924 /*
925 * If the device has not been properly setup, the following will catch
926 * the problem and should stop the system from crashing.
927 * 20030610 - hamish@zot.org
928 */
929 if (pci_enable_device(pdev)) {
930 dev_err(&pdev->dev, "can't enable PCI device\n");
931 agp_put_bridge(bridge);
932 return -ENODEV;
933 }
934
935 /* Fill in the mode register */ 935 /* Fill in the mode register */
936 if (cap_ptr) { 936 if (cap_ptr) {
937 pci_read_config_dword(pdev, 937 pci_read_config_dword(pdev,
diff --git a/drivers/char/agp/intel-agp.h b/drivers/char/agp/intel-agp.h
index 2547465d4658..c05e3e518268 100644
--- a/drivers/char/agp/intel-agp.h
+++ b/drivers/char/agp/intel-agp.h
@@ -60,6 +60,12 @@
60#define I810_PTE_LOCAL 0x00000002 60#define I810_PTE_LOCAL 0x00000002
61#define I810_PTE_VALID 0x00000001 61#define I810_PTE_VALID 0x00000001
62#define I830_PTE_SYSTEM_CACHED 0x00000006 62#define I830_PTE_SYSTEM_CACHED 0x00000006
63/* GT PTE cache control fields */
64#define GEN6_PTE_UNCACHED 0x00000002
65#define GEN6_PTE_LLC 0x00000004
66#define GEN6_PTE_LLC_MLC 0x00000006
67#define GEN6_PTE_GFDT 0x00000008
68
63#define I810_SMRAM_MISCC 0x70 69#define I810_SMRAM_MISCC 0x70
64#define I810_GFX_MEM_WIN_SIZE 0x00010000 70#define I810_GFX_MEM_WIN_SIZE 0x00010000
65#define I810_GFX_MEM_WIN_32M 0x00010000 71#define I810_GFX_MEM_WIN_32M 0x00010000
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
index 9344216183a4..d22ffb811bf2 100644
--- a/drivers/char/agp/intel-gtt.c
+++ b/drivers/char/agp/intel-gtt.c
@@ -25,6 +25,10 @@
25#define USE_PCI_DMA_API 1 25#define USE_PCI_DMA_API 1
26#endif 26#endif
27 27
28/* Max amount of stolen space, anything above will be returned to Linux */
29int intel_max_stolen = 32 * 1024 * 1024;
30EXPORT_SYMBOL(intel_max_stolen);
31
28static const struct aper_size_info_fixed intel_i810_sizes[] = 32static const struct aper_size_info_fixed intel_i810_sizes[] =
29{ 33{
30 {64, 16384, 4}, 34 {64, 16384, 4},
@@ -104,7 +108,7 @@ static int intel_agp_map_memory(struct agp_memory *mem)
104 DBG("try mapping %lu pages\n", (unsigned long)mem->page_count); 108 DBG("try mapping %lu pages\n", (unsigned long)mem->page_count);
105 109
106 if (sg_alloc_table(&st, mem->page_count, GFP_KERNEL)) 110 if (sg_alloc_table(&st, mem->page_count, GFP_KERNEL))
107 return -ENOMEM; 111 goto err;
108 112
109 mem->sg_list = sg = st.sgl; 113 mem->sg_list = sg = st.sgl;
110 114
@@ -113,11 +117,14 @@ static int intel_agp_map_memory(struct agp_memory *mem)
113 117
114 mem->num_sg = pci_map_sg(intel_private.pcidev, mem->sg_list, 118 mem->num_sg = pci_map_sg(intel_private.pcidev, mem->sg_list,
115 mem->page_count, PCI_DMA_BIDIRECTIONAL); 119 mem->page_count, PCI_DMA_BIDIRECTIONAL);
116 if (unlikely(!mem->num_sg)) { 120 if (unlikely(!mem->num_sg))
117 intel_agp_free_sglist(mem); 121 goto err;
118 return -ENOMEM; 122
119 }
120 return 0; 123 return 0;
124
125err:
126 sg_free_table(&st);
127 return -ENOMEM;
121} 128}
122 129
123static void intel_agp_unmap_memory(struct agp_memory *mem) 130static void intel_agp_unmap_memory(struct agp_memory *mem)
@@ -176,7 +183,7 @@ static void intel_agp_insert_sg_entries(struct agp_memory *mem,
176 if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB || 183 if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB ||
177 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB) 184 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB)
178 { 185 {
179 cache_bits = I830_PTE_SYSTEM_CACHED; 186 cache_bits = GEN6_PTE_LLC_MLC;
180 } 187 }
181 188
182 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { 189 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
@@ -710,7 +717,12 @@ static void intel_i830_init_gtt_entries(void)
710 break; 717 break;
711 } 718 }
712 } 719 }
713 if (gtt_entries > 0) { 720 if (!local && gtt_entries > intel_max_stolen) {
721 dev_info(&agp_bridge->dev->dev,
722 "detected %dK stolen memory, trimming to %dK\n",
723 gtt_entries / KB(1), intel_max_stolen / KB(1));
724 gtt_entries = intel_max_stolen / KB(4);
725 } else if (gtt_entries > 0) {
714 dev_info(&agp_bridge->dev->dev, "detected %dK %s memory\n", 726 dev_info(&agp_bridge->dev->dev, "detected %dK %s memory\n",
715 gtt_entries / KB(1), local ? "local" : "stolen"); 727 gtt_entries / KB(1), local ? "local" : "stolen");
716 gtt_entries /= KB(4); 728 gtt_entries /= KB(4);
@@ -797,6 +809,10 @@ static int intel_i830_create_gatt_table(struct agp_bridge_data *bridge)
797 809
798 /* we have to call this as early as possible after the MMIO base address is known */ 810 /* we have to call this as early as possible after the MMIO base address is known */
799 intel_i830_init_gtt_entries(); 811 intel_i830_init_gtt_entries();
812 if (intel_private.gtt_entries == 0) {
813 iounmap(intel_private.registers);
814 return -ENOMEM;
815 }
800 816
801 agp_bridge->gatt_table = NULL; 817 agp_bridge->gatt_table = NULL;
802 818
@@ -1216,17 +1232,20 @@ static int intel_i915_get_gtt_size(void)
1216 1232
1217 /* G33's GTT size defined in gmch_ctrl */ 1233 /* G33's GTT size defined in gmch_ctrl */
1218 pci_read_config_word(agp_bridge->dev, I830_GMCH_CTRL, &gmch_ctrl); 1234 pci_read_config_word(agp_bridge->dev, I830_GMCH_CTRL, &gmch_ctrl);
1219 switch (gmch_ctrl & G33_PGETBL_SIZE_MASK) { 1235 switch (gmch_ctrl & I830_GMCH_GMS_MASK) {
1220 case G33_PGETBL_SIZE_1M: 1236 case I830_GMCH_GMS_STOLEN_512:
1237 size = 512;
1238 break;
1239 case I830_GMCH_GMS_STOLEN_1024:
1221 size = 1024; 1240 size = 1024;
1222 break; 1241 break;
1223 case G33_PGETBL_SIZE_2M: 1242 case I830_GMCH_GMS_STOLEN_8192:
1224 size = 2048; 1243 size = 8*1024;
1225 break; 1244 break;
1226 default: 1245 default:
1227 dev_info(&agp_bridge->dev->dev, 1246 dev_info(&agp_bridge->dev->dev,
1228 "unknown page table size 0x%x, assuming 512KB\n", 1247 "unknown page table size 0x%x, assuming 512KB\n",
1229 (gmch_ctrl & G33_PGETBL_SIZE_MASK)); 1248 (gmch_ctrl & I830_GMCH_GMS_MASK));
1230 size = 512; 1249 size = 512;
1231 } 1250 }
1232 } else { 1251 } else {
@@ -1279,6 +1298,11 @@ static int intel_i915_create_gatt_table(struct agp_bridge_data *bridge)
1279 1298
1280 /* we have to call this as early as possible after the MMIO base address is known */ 1299 /* we have to call this as early as possible after the MMIO base address is known */
1281 intel_i830_init_gtt_entries(); 1300 intel_i830_init_gtt_entries();
1301 if (intel_private.gtt_entries == 0) {
1302 iounmap(intel_private.gtt);
1303 iounmap(intel_private.registers);
1304 return -ENOMEM;
1305 }
1282 1306
1283 agp_bridge->gatt_table = NULL; 1307 agp_bridge->gatt_table = NULL;
1284 1308
@@ -1306,6 +1330,16 @@ static unsigned long intel_i965_mask_memory(struct agp_bridge_data *bridge,
1306 return addr | bridge->driver->masks[type].mask; 1330 return addr | bridge->driver->masks[type].mask;
1307} 1331}
1308 1332
1333static unsigned long intel_gen6_mask_memory(struct agp_bridge_data *bridge,
1334 dma_addr_t addr, int type)
1335{
1336 /* Shift high bits down */
1337 addr |= (addr >> 28) & 0xff;
1338
1339 /* Type checking must be done elsewhere */
1340 return addr | bridge->driver->masks[type].mask;
1341}
1342
1309static void intel_i965_get_gtt_range(int *gtt_offset, int *gtt_size) 1343static void intel_i965_get_gtt_range(int *gtt_offset, int *gtt_size)
1310{ 1344{
1311 u16 snb_gmch_ctl; 1345 u16 snb_gmch_ctl;
@@ -1387,6 +1421,11 @@ static int intel_i965_create_gatt_table(struct agp_bridge_data *bridge)
1387 1421
1388 /* we have to call this as early as possible after the MMIO base address is known */ 1422 /* we have to call this as early as possible after the MMIO base address is known */
1389 intel_i830_init_gtt_entries(); 1423 intel_i830_init_gtt_entries();
1424 if (intel_private.gtt_entries == 0) {
1425 iounmap(intel_private.gtt);
1426 iounmap(intel_private.registers);
1427 return -ENOMEM;
1428 }
1390 1429
1391 agp_bridge->gatt_table = NULL; 1430 agp_bridge->gatt_table = NULL;
1392 1431
@@ -1514,6 +1553,39 @@ static const struct agp_bridge_driver intel_i965_driver = {
1514#endif 1553#endif
1515}; 1554};
1516 1555
1556static const struct agp_bridge_driver intel_gen6_driver = {
1557 .owner = THIS_MODULE,
1558 .aperture_sizes = intel_i830_sizes,
1559 .size_type = FIXED_APER_SIZE,
1560 .num_aperture_sizes = 4,
1561 .needs_scratch_page = true,
1562 .configure = intel_i9xx_configure,
1563 .fetch_size = intel_i9xx_fetch_size,
1564 .cleanup = intel_i915_cleanup,
1565 .mask_memory = intel_gen6_mask_memory,
1566 .masks = intel_i810_masks,
1567 .agp_enable = intel_i810_agp_enable,
1568 .cache_flush = global_cache_flush,
1569 .create_gatt_table = intel_i965_create_gatt_table,
1570 .free_gatt_table = intel_i830_free_gatt_table,
1571 .insert_memory = intel_i915_insert_entries,
1572 .remove_memory = intel_i915_remove_entries,
1573 .alloc_by_type = intel_i830_alloc_by_type,
1574 .free_by_type = intel_i810_free_by_type,
1575 .agp_alloc_page = agp_generic_alloc_page,
1576 .agp_alloc_pages = agp_generic_alloc_pages,
1577 .agp_destroy_page = agp_generic_destroy_page,
1578 .agp_destroy_pages = agp_generic_destroy_pages,
1579 .agp_type_to_mask_type = intel_i830_type_to_mask_type,
1580 .chipset_flush = intel_i915_chipset_flush,
1581#ifdef USE_PCI_DMA_API
1582 .agp_map_page = intel_agp_map_page,
1583 .agp_unmap_page = intel_agp_unmap_page,
1584 .agp_map_memory = intel_agp_map_memory,
1585 .agp_unmap_memory = intel_agp_unmap_memory,
1586#endif
1587};
1588
1517static const struct agp_bridge_driver intel_g33_driver = { 1589static const struct agp_bridge_driver intel_g33_driver = {
1518 .owner = THIS_MODULE, 1590 .owner = THIS_MODULE,
1519 .aperture_sizes = intel_i830_sizes, 1591 .aperture_sizes = intel_i830_sizes,
diff --git a/drivers/char/bsr.c b/drivers/char/bsr.c
index 89d871ef8c2f..91917133ae0a 100644
--- a/drivers/char/bsr.c
+++ b/drivers/char/bsr.c
@@ -23,6 +23,7 @@
23#include <linux/of.h> 23#include <linux/of.h>
24#include <linux/of_device.h> 24#include <linux/of_device.h>
25#include <linux/of_platform.h> 25#include <linux/of_platform.h>
26#include <linux/fs.h>
26#include <linux/module.h> 27#include <linux/module.h>
27#include <linux/cdev.h> 28#include <linux/cdev.h>
28#include <linux/list.h> 29#include <linux/list.h>
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c
index 35cca4c7fb18..fa27d1676ee5 100644
--- a/drivers/char/hvc_console.c
+++ b/drivers/char/hvc_console.c
@@ -194,7 +194,7 @@ static int __init hvc_console_setup(struct console *co, char *options)
194 return 0; 194 return 0;
195} 195}
196 196
197static struct console hvc_con_driver = { 197static struct console hvc_console = {
198 .name = "hvc", 198 .name = "hvc",
199 .write = hvc_console_print, 199 .write = hvc_console_print,
200 .device = hvc_console_device, 200 .device = hvc_console_device,
@@ -220,7 +220,7 @@ static struct console hvc_con_driver = {
220 */ 220 */
221static int __init hvc_console_init(void) 221static int __init hvc_console_init(void)
222{ 222{
223 register_console(&hvc_con_driver); 223 register_console(&hvc_console);
224 return 0; 224 return 0;
225} 225}
226console_initcall(hvc_console_init); 226console_initcall(hvc_console_init);
@@ -276,8 +276,8 @@ int hvc_instantiate(uint32_t vtermno, int index, const struct hv_ops *ops)
276 * now (setup won't fail at this point). It's ok to just 276 * now (setup won't fail at this point). It's ok to just
277 * call register again if previously .setup failed. 277 * call register again if previously .setup failed.
278 */ 278 */
279 if (index == hvc_con_driver.index) 279 if (index == hvc_console.index)
280 register_console(&hvc_con_driver); 280 register_console(&hvc_console);
281 281
282 return 0; 282 return 0;
283} 283}
@@ -641,7 +641,7 @@ int hvc_poll(struct hvc_struct *hp)
641 } 641 }
642 for (i = 0; i < n; ++i) { 642 for (i = 0; i < n; ++i) {
643#ifdef CONFIG_MAGIC_SYSRQ 643#ifdef CONFIG_MAGIC_SYSRQ
644 if (hp->index == hvc_con_driver.index) { 644 if (hp->index == hvc_console.index) {
645 /* Handle the SysRq Hack */ 645 /* Handle the SysRq Hack */
646 /* XXX should support a sequence */ 646 /* XXX should support a sequence */
647 if (buf[i] == '\x0f') { /* ^O */ 647 if (buf[i] == '\x0f') { /* ^O */
@@ -909,7 +909,7 @@ static void __exit hvc_exit(void)
909 tty_unregister_driver(hvc_driver); 909 tty_unregister_driver(hvc_driver);
910 /* return tty_struct instances allocated in hvc_init(). */ 910 /* return tty_struct instances allocated in hvc_init(). */
911 put_tty_driver(hvc_driver); 911 put_tty_driver(hvc_driver);
912 unregister_console(&hvc_con_driver); 912 unregister_console(&hvc_console);
913 } 913 }
914} 914}
915module_exit(hvc_exit); 915module_exit(hvc_exit);
diff --git a/drivers/char/hvsi.c b/drivers/char/hvsi.c
index d4b14ff1c4c1..1f4b6de65a2d 100644
--- a/drivers/char/hvsi.c
+++ b/drivers/char/hvsi.c
@@ -1255,7 +1255,7 @@ static int __init hvsi_console_setup(struct console *console, char *options)
1255 return 0; 1255 return 0;
1256} 1256}
1257 1257
1258static struct console hvsi_con_driver = { 1258static struct console hvsi_console = {
1259 .name = "hvsi", 1259 .name = "hvsi",
1260 .write = hvsi_console_print, 1260 .write = hvsi_console_print,
1261 .device = hvsi_console_device, 1261 .device = hvsi_console_device,
@@ -1308,7 +1308,7 @@ static int __init hvsi_console_init(void)
1308 } 1308 }
1309 1309
1310 if (hvsi_count) 1310 if (hvsi_count)
1311 register_console(&hvsi_con_driver); 1311 register_console(&hvsi_console);
1312 return 0; 1312 return 0;
1313} 1313}
1314console_initcall(hvsi_console_init); 1314console_initcall(hvsi_console_init);
diff --git a/drivers/char/hw_random/n2-drv.c b/drivers/char/hw_random/n2-drv.c
index 0f9cbf1aaf15..7a4f080f8356 100644
--- a/drivers/char/hw_random/n2-drv.c
+++ b/drivers/char/hw_random/n2-drv.c
@@ -387,7 +387,7 @@ static int n2rng_init_control(struct n2rng *np)
387 387
388static int n2rng_data_read(struct hwrng *rng, u32 *data) 388static int n2rng_data_read(struct hwrng *rng, u32 *data)
389{ 389{
390 struct n2rng *np = (struct n2rng *) rng->priv; 390 struct n2rng *np = rng->priv;
391 unsigned long ra = __pa(&np->test_data); 391 unsigned long ra = __pa(&np->test_data);
392 int len; 392 int len;
393 393
@@ -762,12 +762,12 @@ static struct of_platform_driver n2rng_driver = {
762 762
763static int __init n2rng_init(void) 763static int __init n2rng_init(void)
764{ 764{
765 return of_register_driver(&n2rng_driver, &of_bus_type); 765 return of_register_platform_driver(&n2rng_driver);
766} 766}
767 767
768static void __exit n2rng_exit(void) 768static void __exit n2rng_exit(void)
769{ 769{
770 of_unregister_driver(&n2rng_driver); 770 of_unregister_platform_driver(&n2rng_driver);
771} 771}
772 772
773module_init(n2rng_init); 773module_init(n2rng_init);
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index 54109dc9240c..25be2102a60a 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -1315,10 +1315,14 @@ static bool kbd_match(struct input_handler *handler, struct input_dev *dev)
1315 if (test_bit(EV_SND, dev->evbit)) 1315 if (test_bit(EV_SND, dev->evbit))
1316 return true; 1316 return true;
1317 1317
1318 if (test_bit(EV_KEY, dev->evbit)) 1318 if (test_bit(EV_KEY, dev->evbit)) {
1319 for (i = KEY_RESERVED; i < BTN_MISC; i++) 1319 for (i = KEY_RESERVED; i < BTN_MISC; i++)
1320 if (test_bit(i, dev->keybit)) 1320 if (test_bit(i, dev->keybit))
1321 return true; 1321 return true;
1322 for (i = KEY_BRL_DOT1; i <= KEY_BRL_DOT10; i++)
1323 if (test_bit(i, dev->keybit))
1324 return true;
1325 }
1322 1326
1323 return false; 1327 return false;
1324} 1328}
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index f54dab8acdcd..a398ecdbd758 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -916,7 +916,7 @@ static int __init chr_dev_init(void)
916 NULL, devlist[minor].name); 916 NULL, devlist[minor].name);
917 } 917 }
918 918
919 return 0; 919 return tty_init();
920} 920}
921 921
922fs_initcall(chr_dev_init); 922fs_initcall(chr_dev_init);
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 8d85587b6d4f..caef35a46890 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -407,8 +407,8 @@ struct entropy_store {
407 struct poolinfo *poolinfo; 407 struct poolinfo *poolinfo;
408 __u32 *pool; 408 __u32 *pool;
409 const char *name; 409 const char *name;
410 int limit;
411 struct entropy_store *pull; 410 struct entropy_store *pull;
411 int limit;
412 412
413 /* read-write data: */ 413 /* read-write data: */
414 spinlock_t lock; 414 spinlock_t lock;
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
index 4561ce2fba6d..334cf5c8c8b6 100644
--- a/drivers/char/synclink_gt.c
+++ b/drivers/char/synclink_gt.c
@@ -4845,7 +4845,7 @@ static int register_test(struct slgt_info *info)
4845{ 4845{
4846 static unsigned short patterns[] = 4846 static unsigned short patterns[] =
4847 {0x0000, 0xffff, 0xaaaa, 0x5555, 0x6969, 0x9696}; 4847 {0x0000, 0xffff, 0xaaaa, 0x5555, 0x6969, 0x9696};
4848 static unsigned int count = sizeof(patterns)/sizeof(patterns[0]); 4848 static unsigned int count = ARRAY_SIZE(patterns);
4849 unsigned int i; 4849 unsigned int i;
4850 int rc = 0; 4850 int rc = 0;
4851 4851
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 24314a9cffe8..1030f8420137 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -623,7 +623,14 @@ static int tpm_tis_pnp_suspend(struct pnp_dev *dev, pm_message_t msg)
623 623
624static int tpm_tis_pnp_resume(struct pnp_dev *dev) 624static int tpm_tis_pnp_resume(struct pnp_dev *dev)
625{ 625{
626 return tpm_pm_resume(&dev->dev); 626 struct tpm_chip *chip = pnp_get_drvdata(dev);
627 int ret;
628
629 ret = tpm_pm_resume(&dev->dev);
630 if (!ret)
631 tpm_continue_selftest(chip);
632
633 return ret;
627} 634}
628 635
629static struct pnp_device_id tpm_pnp_tbl[] __devinitdata = { 636static struct pnp_device_id tpm_pnp_tbl[] __devinitdata = {
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index d71f0fc34b46..507441ac6edb 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -3128,7 +3128,7 @@ static struct cdev tty_cdev, console_cdev;
3128 * Ok, now we can initialize the rest of the tty devices and can count 3128 * Ok, now we can initialize the rest of the tty devices and can count
3129 * on memory allocations, interrupts etc.. 3129 * on memory allocations, interrupts etc..
3130 */ 3130 */
3131static int __init tty_init(void) 3131int __init tty_init(void)
3132{ 3132{
3133 cdev_init(&tty_cdev, &tty_fops); 3133 cdev_init(&tty_cdev, &tty_fops);
3134 if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) || 3134 if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) ||
@@ -3149,4 +3149,4 @@ static int __init tty_init(void)
3149#endif 3149#endif
3150 return 0; 3150 return 0;
3151} 3151}
3152module_init(tty_init); 3152
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index 7cdb6ee569cd..4a9eb3044e52 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -104,6 +104,7 @@
104#include <linux/io.h> 104#include <linux/io.h>
105#include <asm/system.h> 105#include <asm/system.h>
106#include <linux/uaccess.h> 106#include <linux/uaccess.h>
107#include <linux/kdb.h>
107 108
108#define MAX_NR_CON_DRIVER 16 109#define MAX_NR_CON_DRIVER 16
109 110
@@ -187,10 +188,15 @@ static DECLARE_WORK(console_work, console_callback);
187 * fg_console is the current virtual console, 188 * fg_console is the current virtual console,
188 * last_console is the last used one, 189 * last_console is the last used one,
189 * want_console is the console we want to switch to, 190 * want_console is the console we want to switch to,
191 * saved_* variants are for save/restore around kernel debugger enter/leave
190 */ 192 */
191int fg_console; 193int fg_console;
192int last_console; 194int last_console;
193int want_console = -1; 195int want_console = -1;
196int saved_fg_console;
197int saved_last_console;
198int saved_want_console;
199int saved_vc_mode;
194 200
195/* 201/*
196 * For each existing display, we have a pointer to console currently visible 202 * For each existing display, we have a pointer to console currently visible
@@ -3414,6 +3420,78 @@ int con_is_bound(const struct consw *csw)
3414EXPORT_SYMBOL(con_is_bound); 3420EXPORT_SYMBOL(con_is_bound);
3415 3421
3416/** 3422/**
3423 * con_debug_enter - prepare the console for the kernel debugger
3424 * @sw: console driver
3425 *
3426 * Called when the console is taken over by the kernel debugger, this
3427 * function needs to save the current console state, then put the console
3428 * into a state suitable for the kernel debugger.
3429 *
3430 * RETURNS:
3431 * Zero on success, nonzero if a failure occurred when trying to prepare
3432 * the console for the debugger.
3433 */
3434int con_debug_enter(struct vc_data *vc)
3435{
3436 int ret = 0;
3437
3438 saved_fg_console = fg_console;
3439 saved_last_console = last_console;
3440 saved_want_console = want_console;
3441 saved_vc_mode = vc->vc_mode;
3442 vc->vc_mode = KD_TEXT;
3443 console_blanked = 0;
3444 if (vc->vc_sw->con_debug_enter)
3445 ret = vc->vc_sw->con_debug_enter(vc);
3446#ifdef CONFIG_KGDB_KDB
3447 /* Set the initial LINES variable if it is not already set */
3448 if (vc->vc_rows < 999) {
3449 int linecount;
3450 char lns[4];
3451 const char *setargs[3] = {
3452 "set",
3453 "LINES",
3454 lns,
3455 };
3456 if (kdbgetintenv(setargs[0], &linecount)) {
3457 snprintf(lns, 4, "%i", vc->vc_rows);
3458 kdb_set(2, setargs);
3459 }
3460 }
3461#endif /* CONFIG_KGDB_KDB */
3462 return ret;
3463}
3464EXPORT_SYMBOL_GPL(con_debug_enter);
3465
3466/**
3467 * con_debug_leave - restore console state
3468 * @sw: console driver
3469 *
3470 * Restore the console state to what it was before the kernel debugger
3471 * was invoked.
3472 *
3473 * RETURNS:
3474 * Zero on success, nonzero if a failure occurred when trying to restore
3475 * the console.
3476 */
3477int con_debug_leave(void)
3478{
3479 struct vc_data *vc;
3480 int ret = 0;
3481
3482 fg_console = saved_fg_console;
3483 last_console = saved_last_console;
3484 want_console = saved_want_console;
3485 vc_cons[fg_console].d->vc_mode = saved_vc_mode;
3486
3487 vc = vc_cons[fg_console].d;
3488 if (vc->vc_sw->con_debug_leave)
3489 ret = vc->vc_sw->con_debug_leave(vc);
3490 return ret;
3491}
3492EXPORT_SYMBOL_GPL(con_debug_leave);
3493
3494/**
3417 * register_con_driver - register console driver to console layer 3495 * register_con_driver - register console driver to console layer
3418 * @csw: console driver 3496 * @csw: console driver
3419 * @first: the first console to take over, minimum value is 0 3497 * @first: the first console to take over, minimum value is 0