aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorJames Morris <jmorris@namei.org>2011-01-09 17:46:24 -0500
committerJames Morris <jmorris@namei.org>2011-01-09 17:46:24 -0500
commitd2e7ad19229f982fc1eb731827d82ceac90abfb3 (patch)
tree98a3741b4d4b27a48b3c7ea9babe331e539416a8 /drivers/char
parentd03a5d888fb688c832d470b749acc5ed38e0bc1d (diff)
parent0c21e3aaf6ae85bee804a325aa29c325209180fd (diff)
Merge branch 'master' into next
Conflicts: security/smack/smack_lsm.c Verified and added fix by Stephen Rothwell <sfr@canb.auug.org.au> Ok'd by Casey Schaufler <casey@schaufler-ca.com> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/Kconfig9
-rw-r--r--drivers/char/Makefile1
-rw-r--r--drivers/char/agp/amd64-agp.c33
-rw-r--r--drivers/char/agp/intel-gtt.c17
-rw-r--r--drivers/char/hvc_dcc.c133
-rw-r--r--drivers/char/hvsi.c4
-rw-r--r--drivers/char/ip2/ip2main.c2
-rw-r--r--drivers/char/pcmcia/ipwireless/hardware.c2
-rw-r--r--drivers/char/pcmcia/ipwireless/network.c3
-rw-r--r--drivers/char/pcmcia/ipwireless/tty.c2
-rw-r--r--drivers/char/ramoops.c12
-rw-r--r--drivers/char/random.c2
-rw-r--r--drivers/char/rocket.c2
-rw-r--r--drivers/char/sonypi.c2
-rw-r--r--drivers/char/specialix.c2
-rw-r--r--drivers/char/tpm/tpm.c4
-rw-r--r--drivers/char/tpm/tpm_tis.c24
17 files changed, 216 insertions, 38 deletions
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 43d3395325c5..d4a7776f4b77 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -682,6 +682,15 @@ config HVC_UDBG
682 select HVC_DRIVER 682 select HVC_DRIVER
683 default n 683 default n
684 684
685config HVC_DCC
686 bool "ARM JTAG DCC console"
687 depends on ARM
688 select HVC_DRIVER
689 help
690 This console uses the JTAG DCC on ARM to create a console under the HVC
691 driver. This console is used through a JTAG only on ARM. If you don't have
692 a JTAG then you probably don't want this option.
693
685config VIRTIO_CONSOLE 694config VIRTIO_CONSOLE
686 tristate "Virtio console" 695 tristate "Virtio console"
687 depends on VIRTIO 696 depends on VIRTIO
diff --git a/drivers/char/Makefile b/drivers/char/Makefile
index ba53ec956c95..fa0b824b7a65 100644
--- a/drivers/char/Makefile
+++ b/drivers/char/Makefile
@@ -34,6 +34,7 @@ obj-$(CONFIG_HVC_CONSOLE) += hvc_vio.o hvsi.o
34obj-$(CONFIG_HVC_ISERIES) += hvc_iseries.o 34obj-$(CONFIG_HVC_ISERIES) += hvc_iseries.o
35obj-$(CONFIG_HVC_RTAS) += hvc_rtas.o 35obj-$(CONFIG_HVC_RTAS) += hvc_rtas.o
36obj-$(CONFIG_HVC_TILE) += hvc_tile.o 36obj-$(CONFIG_HVC_TILE) += hvc_tile.o
37obj-$(CONFIG_HVC_DCC) += hvc_dcc.o
37obj-$(CONFIG_HVC_BEAT) += hvc_beat.o 38obj-$(CONFIG_HVC_BEAT) += hvc_beat.o
38obj-$(CONFIG_HVC_DRIVER) += hvc_console.o 39obj-$(CONFIG_HVC_DRIVER) += hvc_console.o
39obj-$(CONFIG_HVC_IRQ) += hvc_irq.o 40obj-$(CONFIG_HVC_IRQ) += hvc_irq.o
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
index 42396df55556..9252e85706ef 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -38,7 +38,7 @@ static int agp_bridges_found;
38 38
39static void amd64_tlbflush(struct agp_memory *temp) 39static void amd64_tlbflush(struct agp_memory *temp)
40{ 40{
41 k8_flush_garts(); 41 amd_flush_garts();
42} 42}
43 43
44static int amd64_insert_memory(struct agp_memory *mem, off_t pg_start, int type) 44static int amd64_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
@@ -124,7 +124,7 @@ static int amd64_fetch_size(void)
124 u32 temp; 124 u32 temp;
125 struct aper_size_info_32 *values; 125 struct aper_size_info_32 *values;
126 126
127 dev = k8_northbridges.nb_misc[0]; 127 dev = node_to_amd_nb(0)->misc;
128 if (dev==NULL) 128 if (dev==NULL)
129 return 0; 129 return 0;
130 130
@@ -181,16 +181,15 @@ static int amd_8151_configure(void)
181 unsigned long gatt_bus = virt_to_phys(agp_bridge->gatt_table_real); 181 unsigned long gatt_bus = virt_to_phys(agp_bridge->gatt_table_real);
182 int i; 182 int i;
183 183
184 if (!k8_northbridges.gart_supported) 184 if (!amd_nb_has_feature(AMD_NB_GART))
185 return 0; 185 return 0;
186 186
187 /* Configure AGP regs in each x86-64 host bridge. */ 187 /* Configure AGP regs in each x86-64 host bridge. */
188 for (i = 0; i < k8_northbridges.num; i++) { 188 for (i = 0; i < amd_nb_num(); i++) {
189 agp_bridge->gart_bus_addr = 189 agp_bridge->gart_bus_addr =
190 amd64_configure(k8_northbridges.nb_misc[i], 190 amd64_configure(node_to_amd_nb(i)->misc, gatt_bus);
191 gatt_bus);
192 } 191 }
193 k8_flush_garts(); 192 amd_flush_garts();
194 return 0; 193 return 0;
195} 194}
196 195
@@ -200,11 +199,11 @@ static void amd64_cleanup(void)
200 u32 tmp; 199 u32 tmp;
201 int i; 200 int i;
202 201
203 if (!k8_northbridges.gart_supported) 202 if (!amd_nb_has_feature(AMD_NB_GART))
204 return; 203 return;
205 204
206 for (i = 0; i < k8_northbridges.num; i++) { 205 for (i = 0; i < amd_nb_num(); i++) {
207 struct pci_dev *dev = k8_northbridges.nb_misc[i]; 206 struct pci_dev *dev = node_to_amd_nb(i)->misc;
208 /* disable gart translation */ 207 /* disable gart translation */
209 pci_read_config_dword(dev, AMD64_GARTAPERTURECTL, &tmp); 208 pci_read_config_dword(dev, AMD64_GARTAPERTURECTL, &tmp);
210 tmp &= ~GARTEN; 209 tmp &= ~GARTEN;
@@ -331,15 +330,15 @@ static __devinit int cache_nbs(struct pci_dev *pdev, u32 cap_ptr)
331{ 330{
332 int i; 331 int i;
333 332
334 if (cache_k8_northbridges() < 0) 333 if (amd_cache_northbridges() < 0)
335 return -ENODEV; 334 return -ENODEV;
336 335
337 if (!k8_northbridges.gart_supported) 336 if (!amd_nb_has_feature(AMD_NB_GART))
338 return -ENODEV; 337 return -ENODEV;
339 338
340 i = 0; 339 i = 0;
341 for (i = 0; i < k8_northbridges.num; i++) { 340 for (i = 0; i < amd_nb_num(); i++) {
342 struct pci_dev *dev = k8_northbridges.nb_misc[i]; 341 struct pci_dev *dev = node_to_amd_nb(i)->misc;
343 if (fix_northbridge(dev, pdev, cap_ptr) < 0) { 342 if (fix_northbridge(dev, pdev, cap_ptr) < 0) {
344 dev_err(&dev->dev, "no usable aperture found\n"); 343 dev_err(&dev->dev, "no usable aperture found\n");
345#ifdef __x86_64__ 344#ifdef __x86_64__
@@ -416,7 +415,7 @@ static int __devinit uli_agp_init(struct pci_dev *pdev)
416 } 415 }
417 416
418 /* shadow x86-64 registers into ULi registers */ 417 /* shadow x86-64 registers into ULi registers */
419 pci_read_config_dword (k8_northbridges.nb_misc[0], AMD64_GARTAPERTUREBASE, 418 pci_read_config_dword (node_to_amd_nb(0)->misc, AMD64_GARTAPERTUREBASE,
420 &httfea); 419 &httfea);
421 420
422 /* if x86-64 aperture base is beyond 4G, exit here */ 421 /* if x86-64 aperture base is beyond 4G, exit here */
@@ -484,7 +483,7 @@ static int nforce3_agp_init(struct pci_dev *pdev)
484 pci_write_config_dword(dev1, NVIDIA_X86_64_1_APSIZE, tmp); 483 pci_write_config_dword(dev1, NVIDIA_X86_64_1_APSIZE, tmp);
485 484
486 /* shadow x86-64 registers into NVIDIA registers */ 485 /* shadow x86-64 registers into NVIDIA registers */
487 pci_read_config_dword (k8_northbridges.nb_misc[0], AMD64_GARTAPERTUREBASE, 486 pci_read_config_dword (node_to_amd_nb(0)->misc, AMD64_GARTAPERTUREBASE,
488 &apbase); 487 &apbase);
489 488
490 /* if x86-64 aperture base is beyond 4G, exit here */ 489 /* if x86-64 aperture base is beyond 4G, exit here */
@@ -778,7 +777,7 @@ int __init agp_amd64_init(void)
778 } 777 }
779 778
780 /* First check that we have at least one AMD64 NB */ 779 /* First check that we have at least one AMD64 NB */
781 if (!pci_dev_present(k8_nb_ids)) 780 if (!pci_dev_present(amd_nb_misc_ids))
782 return -ENODEV; 781 return -ENODEV;
783 782
784 /* Look for any AGP bridge */ 783 /* Look for any AGP bridge */
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
index 9272c38dd3c6..29ac6d499fa6 100644
--- a/drivers/char/agp/intel-gtt.c
+++ b/drivers/char/agp/intel-gtt.c
@@ -812,8 +812,10 @@ static int intel_fake_agp_fetch_size(void)
812 812
813static void i830_cleanup(void) 813static void i830_cleanup(void)
814{ 814{
815 kunmap(intel_private.i8xx_page); 815 if (intel_private.i8xx_flush_page) {
816 intel_private.i8xx_flush_page = NULL; 816 kunmap(intel_private.i8xx_flush_page);
817 intel_private.i8xx_flush_page = NULL;
818 }
817 819
818 __free_page(intel_private.i8xx_page); 820 __free_page(intel_private.i8xx_page);
819 intel_private.i8xx_page = NULL; 821 intel_private.i8xx_page = NULL;
@@ -1190,12 +1192,19 @@ static void i9xx_chipset_flush(void)
1190 writel(1, intel_private.i9xx_flush_page); 1192 writel(1, intel_private.i9xx_flush_page);
1191} 1193}
1192 1194
1193static void i965_write_entry(dma_addr_t addr, unsigned int entry, 1195static void i965_write_entry(dma_addr_t addr,
1196 unsigned int entry,
1194 unsigned int flags) 1197 unsigned int flags)
1195{ 1198{
1199 u32 pte_flags;
1200
1201 pte_flags = I810_PTE_VALID;
1202 if (flags == AGP_USER_CACHED_MEMORY)
1203 pte_flags |= I830_PTE_SYSTEM_CACHED;
1204
1196 /* Shift high bits down */ 1205 /* Shift high bits down */
1197 addr |= (addr >> 28) & 0xf0; 1206 addr |= (addr >> 28) & 0xf0;
1198 writel(addr | I810_PTE_VALID, intel_private.gtt + entry); 1207 writel(addr | pte_flags, intel_private.gtt + entry);
1199} 1208}
1200 1209
1201static bool gen6_check_flags(unsigned int flags) 1210static bool gen6_check_flags(unsigned int flags)
diff --git a/drivers/char/hvc_dcc.c b/drivers/char/hvc_dcc.c
new file mode 100644
index 000000000000..6470f63deb4b
--- /dev/null
+++ b/drivers/char/hvc_dcc.c
@@ -0,0 +1,133 @@
1/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 */
17
18#include <linux/console.h>
19#include <linux/delay.h>
20#include <linux/err.h>
21#include <linux/init.h>
22#include <linux/moduleparam.h>
23#include <linux/types.h>
24
25#include <asm/processor.h>
26
27#include "hvc_console.h"
28
29/* DCC Status Bits */
30#define DCC_STATUS_RX (1 << 30)
31#define DCC_STATUS_TX (1 << 29)
32
33static inline u32 __dcc_getstatus(void)
34{
35 u32 __ret;
36
37 asm("mrc p14, 0, %0, c0, c1, 0 @ read comms ctrl reg"
38 : "=r" (__ret) : : "cc");
39
40 return __ret;
41}
42
43
44#if defined(CONFIG_CPU_V7)
45static inline char __dcc_getchar(void)
46{
47 char __c;
48
49 asm("get_wait: mrc p14, 0, pc, c0, c1, 0 \n\
50 bne get_wait \n\
51 mrc p14, 0, %0, c0, c5, 0 @ read comms data reg"
52 : "=r" (__c) : : "cc");
53
54 return __c;
55}
56#else
57static inline char __dcc_getchar(void)
58{
59 char __c;
60
61 asm("mrc p14, 0, %0, c0, c5, 0 @ read comms data reg"
62 : "=r" (__c));
63
64 return __c;
65}
66#endif
67
68#if defined(CONFIG_CPU_V7)
69static inline void __dcc_putchar(char c)
70{
71 asm("put_wait: mrc p14, 0, pc, c0, c1, 0 \n\
72 bcs put_wait \n\
73 mcr p14, 0, %0, c0, c5, 0 "
74 : : "r" (c) : "cc");
75}
76#else
77static inline void __dcc_putchar(char c)
78{
79 asm("mcr p14, 0, %0, c0, c5, 0 @ write a char"
80 : /* no output register */
81 : "r" (c));
82}
83#endif
84
85static int hvc_dcc_put_chars(uint32_t vt, const char *buf, int count)
86{
87 int i;
88
89 for (i = 0; i < count; i++) {
90 while (__dcc_getstatus() & DCC_STATUS_TX)
91 cpu_relax();
92
93 __dcc_putchar((char)(buf[i] & 0xFF));
94 }
95
96 return count;
97}
98
99static int hvc_dcc_get_chars(uint32_t vt, char *buf, int count)
100{
101 int i;
102
103 for (i = 0; i < count; ++i) {
104 int c = -1;
105
106 if (__dcc_getstatus() & DCC_STATUS_RX)
107 c = __dcc_getchar();
108 if (c < 0)
109 break;
110 buf[i] = c;
111 }
112
113 return i;
114}
115
116static const struct hv_ops hvc_dcc_get_put_ops = {
117 .get_chars = hvc_dcc_get_chars,
118 .put_chars = hvc_dcc_put_chars,
119};
120
121static int __init hvc_dcc_console_init(void)
122{
123 hvc_instantiate(0, 0, &hvc_dcc_get_put_ops);
124 return 0;
125}
126console_initcall(hvc_dcc_console_init);
127
128static int __init hvc_dcc_init(void)
129{
130 hvc_alloc(0, 0, &hvc_dcc_get_put_ops, 128);
131 return 0;
132}
133device_initcall(hvc_dcc_init);
diff --git a/drivers/char/hvsi.c b/drivers/char/hvsi.c
index a2bc885ce60a..67a75a502c01 100644
--- a/drivers/char/hvsi.c
+++ b/drivers/char/hvsi.c
@@ -850,8 +850,8 @@ static void hvsi_flush_output(struct hvsi_struct *hp)
850 wait_event_timeout(hp->emptyq, (hp->n_outbuf <= 0), HVSI_TIMEOUT); 850 wait_event_timeout(hp->emptyq, (hp->n_outbuf <= 0), HVSI_TIMEOUT);
851 851
852 /* 'writer' could still be pending if it didn't see n_outbuf = 0 yet */ 852 /* 'writer' could still be pending if it didn't see n_outbuf = 0 yet */
853 cancel_delayed_work(&hp->writer); 853 cancel_delayed_work_sync(&hp->writer);
854 flush_scheduled_work(); 854 flush_work_sync(&hp->handshaker);
855 855
856 /* 856 /*
857 * it's also possible that our timeout expired and hvsi_write_worker 857 * it's also possible that our timeout expired and hvsi_write_worker
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c
index fcd02baa7d65..c3a025356b8b 100644
--- a/drivers/char/ip2/ip2main.c
+++ b/drivers/char/ip2/ip2main.c
@@ -3224,7 +3224,7 @@ ip2trace (unsigned short pn, unsigned char cat, unsigned char label, unsigned lo
3224 3224
3225MODULE_LICENSE("GPL"); 3225MODULE_LICENSE("GPL");
3226 3226
3227static struct pci_device_id ip2main_pci_tbl[] __devinitdata = { 3227static struct pci_device_id ip2main_pci_tbl[] __devinitdata __used = {
3228 { PCI_DEVICE(PCI_VENDOR_ID_COMPUTONE, PCI_DEVICE_ID_COMPUTONE_IP2EX) }, 3228 { PCI_DEVICE(PCI_VENDOR_ID_COMPUTONE, PCI_DEVICE_ID_COMPUTONE_IP2EX) },
3229 { } 3229 { }
3230}; 3230};
diff --git a/drivers/char/pcmcia/ipwireless/hardware.c b/drivers/char/pcmcia/ipwireless/hardware.c
index 99cffdab1056..0aeb5a38d296 100644
--- a/drivers/char/pcmcia/ipwireless/hardware.c
+++ b/drivers/char/pcmcia/ipwireless/hardware.c
@@ -1729,7 +1729,7 @@ void ipwireless_hardware_free(struct ipw_hardware *hw)
1729 1729
1730 ipwireless_stop_interrupts(hw); 1730 ipwireless_stop_interrupts(hw);
1731 1731
1732 flush_scheduled_work(); 1732 flush_work_sync(&hw->work_rx);
1733 1733
1734 for (i = 0; i < NL_NUM_OF_ADDRESSES; i++) 1734 for (i = 0; i < NL_NUM_OF_ADDRESSES; i++)
1735 if (hw->packet_assembler[i] != NULL) 1735 if (hw->packet_assembler[i] != NULL)
diff --git a/drivers/char/pcmcia/ipwireless/network.c b/drivers/char/pcmcia/ipwireless/network.c
index 9fe538347932..f7daeea598e4 100644
--- a/drivers/char/pcmcia/ipwireless/network.c
+++ b/drivers/char/pcmcia/ipwireless/network.c
@@ -430,7 +430,8 @@ void ipwireless_network_free(struct ipw_network *network)
430 network->shutting_down = 1; 430 network->shutting_down = 1;
431 431
432 ipwireless_ppp_close(network); 432 ipwireless_ppp_close(network);
433 flush_scheduled_work(); 433 flush_work_sync(&network->work_go_online);
434 flush_work_sync(&network->work_go_offline);
434 435
435 ipwireless_stop_interrupts(network->hardware); 436 ipwireless_stop_interrupts(network->hardware);
436 ipwireless_associate_network(network->hardware, NULL); 437 ipwireless_associate_network(network->hardware, NULL);
diff --git a/drivers/char/pcmcia/ipwireless/tty.c b/drivers/char/pcmcia/ipwireless/tty.c
index 1a2c2c3b068f..f5eb28b6cb0f 100644
--- a/drivers/char/pcmcia/ipwireless/tty.c
+++ b/drivers/char/pcmcia/ipwireless/tty.c
@@ -577,7 +577,7 @@ void ipwireless_tty_free(struct ipw_tty *tty)
577 mutex_unlock(&ttyj->ipw_tty_mutex); 577 mutex_unlock(&ttyj->ipw_tty_mutex);
578 tty_hangup(ttyj->linux_tty); 578 tty_hangup(ttyj->linux_tty);
579 /* Wait till the tty_hangup has completed */ 579 /* Wait till the tty_hangup has completed */
580 flush_scheduled_work(); 580 flush_work_sync(&ttyj->linux_tty->hangup_work);
581 /* FIXME: Exactly how is the tty object locked here 581 /* FIXME: Exactly how is the tty object locked here
582 against a parallel ioctl etc */ 582 against a parallel ioctl etc */
583 mutex_lock(&ttyj->ipw_tty_mutex); 583 mutex_lock(&ttyj->ipw_tty_mutex);
diff --git a/drivers/char/ramoops.c b/drivers/char/ramoops.c
index 73dcb0ee41fd..d3d63be2cd37 100644
--- a/drivers/char/ramoops.c
+++ b/drivers/char/ramoops.c
@@ -29,7 +29,6 @@
29#include <linux/ramoops.h> 29#include <linux/ramoops.h>
30 30
31#define RAMOOPS_KERNMSG_HDR "====" 31#define RAMOOPS_KERNMSG_HDR "===="
32#define RAMOOPS_HEADER_SIZE (5 + sizeof(struct timeval))
33 32
34#define RECORD_SIZE 4096 33#define RECORD_SIZE 4096
35 34
@@ -65,8 +64,8 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper,
65 struct ramoops_context, dump); 64 struct ramoops_context, dump);
66 unsigned long s1_start, s2_start; 65 unsigned long s1_start, s2_start;
67 unsigned long l1_cpy, l2_cpy; 66 unsigned long l1_cpy, l2_cpy;
68 int res; 67 int res, hdr_size;
69 char *buf; 68 char *buf, *buf_orig;
70 struct timeval timestamp; 69 struct timeval timestamp;
71 70
72 /* Only dump oopses if dump_oops is set */ 71 /* Only dump oopses if dump_oops is set */
@@ -74,6 +73,8 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper,
74 return; 73 return;
75 74
76 buf = (char *)(cxt->virt_addr + (cxt->count * RECORD_SIZE)); 75 buf = (char *)(cxt->virt_addr + (cxt->count * RECORD_SIZE));
76 buf_orig = buf;
77
77 memset(buf, '\0', RECORD_SIZE); 78 memset(buf, '\0', RECORD_SIZE);
78 res = sprintf(buf, "%s", RAMOOPS_KERNMSG_HDR); 79 res = sprintf(buf, "%s", RAMOOPS_KERNMSG_HDR);
79 buf += res; 80 buf += res;
@@ -81,8 +82,9 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper,
81 res = sprintf(buf, "%lu.%lu\n", (long)timestamp.tv_sec, (long)timestamp.tv_usec); 82 res = sprintf(buf, "%lu.%lu\n", (long)timestamp.tv_sec, (long)timestamp.tv_usec);
82 buf += res; 83 buf += res;
83 84
84 l2_cpy = min(l2, (unsigned long)(RECORD_SIZE - RAMOOPS_HEADER_SIZE)); 85 hdr_size = buf - buf_orig;
85 l1_cpy = min(l1, (unsigned long)(RECORD_SIZE - RAMOOPS_HEADER_SIZE) - l2_cpy); 86 l2_cpy = min(l2, (unsigned long)(RECORD_SIZE - hdr_size));
87 l1_cpy = min(l1, (unsigned long)(RECORD_SIZE - hdr_size) - l2_cpy);
86 88
87 s2_start = l2 - l2_cpy; 89 s2_start = l2 - l2_cpy;
88 s1_start = l1 - l1_cpy; 90 s1_start = l1 - l1_cpy;
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 5a1aa64f4e76..72a4fcb17745 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -626,7 +626,7 @@ static void add_timer_randomness(struct timer_rand_state *state, unsigned num)
626 preempt_disable(); 626 preempt_disable();
627 /* if over the trickle threshold, use only 1 in 4096 samples */ 627 /* if over the trickle threshold, use only 1 in 4096 samples */
628 if (input_pool.entropy_count > trickle_thresh && 628 if (input_pool.entropy_count > trickle_thresh &&
629 (__get_cpu_var(trickle_count)++ & 0xfff)) 629 ((__this_cpu_inc_return(trickle_count) - 1) & 0xfff))
630 goto out; 630 goto out;
631 631
632 sample.jiffies = jiffies; 632 sample.jiffies = jiffies;
diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c
index 86308830ac42..3e4e73a0d7c1 100644
--- a/drivers/char/rocket.c
+++ b/drivers/char/rocket.c
@@ -1764,7 +1764,7 @@ static void rp_flush_buffer(struct tty_struct *tty)
1764 1764
1765#ifdef CONFIG_PCI 1765#ifdef CONFIG_PCI
1766 1766
1767static struct pci_device_id __devinitdata rocket_pci_ids[] = { 1767static struct pci_device_id __devinitdata __used rocket_pci_ids[] = {
1768 { PCI_DEVICE(PCI_VENDOR_ID_RP, PCI_ANY_ID) }, 1768 { PCI_DEVICE(PCI_VENDOR_ID_RP, PCI_ANY_ID) },
1769 { } 1769 { }
1770}; 1770};
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index 73f66d03624d..79e36c878a4c 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -1434,7 +1434,7 @@ static int __devexit sonypi_remove(struct platform_device *dev)
1434 sonypi_disable(); 1434 sonypi_disable();
1435 1435
1436 synchronize_irq(sonypi_device.irq); 1436 synchronize_irq(sonypi_device.irq);
1437 flush_scheduled_work(); 1437 flush_work_sync(&sonypi_device.input_work);
1438 1438
1439 if (useinput) { 1439 if (useinput) {
1440 input_unregister_device(sonypi_device.input_key_dev); 1440 input_unregister_device(sonypi_device.input_key_dev);
diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c
index a7616d226a49..c2bca3f25ef3 100644
--- a/drivers/char/specialix.c
+++ b/drivers/char/specialix.c
@@ -2355,7 +2355,7 @@ static void __exit specialix_exit_module(void)
2355 func_exit(); 2355 func_exit();
2356} 2356}
2357 2357
2358static struct pci_device_id specialx_pci_tbl[] __devinitdata = { 2358static struct pci_device_id specialx_pci_tbl[] __devinitdata __used = {
2359 { PCI_DEVICE(PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_SPECIALIX_IO8) }, 2359 { PCI_DEVICE(PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_SPECIALIX_IO8) },
2360 { } 2360 { }
2361}; 2361};
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 068bac858b4a..1f46f1cd9225 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -1002,7 +1002,7 @@ int tpm_release(struct inode *inode, struct file *file)
1002 struct tpm_chip *chip = file->private_data; 1002 struct tpm_chip *chip = file->private_data;
1003 1003
1004 del_singleshot_timer_sync(&chip->user_read_timer); 1004 del_singleshot_timer_sync(&chip->user_read_timer);
1005 flush_scheduled_work(); 1005 flush_work_sync(&chip->work);
1006 file->private_data = NULL; 1006 file->private_data = NULL;
1007 atomic_set(&chip->data_pending, 0); 1007 atomic_set(&chip->data_pending, 0);
1008 kfree(chip->data_buffer); 1008 kfree(chip->data_buffer);
@@ -1054,7 +1054,7 @@ ssize_t tpm_read(struct file *file, char __user *buf,
1054 ssize_t ret_size; 1054 ssize_t ret_size;
1055 1055
1056 del_singleshot_timer_sync(&chip->user_read_timer); 1056 del_singleshot_timer_sync(&chip->user_read_timer);
1057 flush_scheduled_work(); 1057 flush_work_sync(&chip->work);
1058 ret_size = atomic_read(&chip->data_pending); 1058 ret_size = atomic_read(&chip->data_pending);
1059 atomic_set(&chip->data_pending, 0); 1059 atomic_set(&chip->data_pending, 0);
1060 if (ret_size > 0) { /* relay data */ 1060 if (ret_size > 0) { /* relay data */
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 1030f8420137..c17a305ecb28 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -25,6 +25,7 @@
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/wait.h> 27#include <linux/wait.h>
28#include <linux/acpi.h>
28#include "tpm.h" 29#include "tpm.h"
29 30
30#define TPM_HEADER_SIZE 10 31#define TPM_HEADER_SIZE 10
@@ -78,6 +79,26 @@ enum tis_defaults {
78static LIST_HEAD(tis_chips); 79static LIST_HEAD(tis_chips);
79static DEFINE_SPINLOCK(tis_lock); 80static DEFINE_SPINLOCK(tis_lock);
80 81
82#ifdef CONFIG_ACPI
83static int is_itpm(struct pnp_dev *dev)
84{
85 struct acpi_device *acpi = pnp_acpi_device(dev);
86 struct acpi_hardware_id *id;
87
88 list_for_each_entry(id, &acpi->pnp.ids, list) {
89 if (!strcmp("INTC0102", id->id))
90 return 1;
91 }
92
93 return 0;
94}
95#else
96static int is_itpm(struct pnp_dev *dev)
97{
98 return 0;
99}
100#endif
101
81static int check_locality(struct tpm_chip *chip, int l) 102static int check_locality(struct tpm_chip *chip, int l)
82{ 103{
83 if ((ioread8(chip->vendor.iobase + TPM_ACCESS(l)) & 104 if ((ioread8(chip->vendor.iobase + TPM_ACCESS(l)) &
@@ -472,6 +493,9 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
472 "1.2 TPM (device-id 0x%X, rev-id %d)\n", 493 "1.2 TPM (device-id 0x%X, rev-id %d)\n",
473 vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0))); 494 vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0)));
474 495
496 if (is_itpm(to_pnp_dev(dev)))
497 itpm = 1;
498
475 if (itpm) 499 if (itpm)
476 dev_info(dev, "Intel iTPM workaround enabled\n"); 500 dev_info(dev, "Intel iTPM workaround enabled\n");
477 501