diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-08-07 06:38:41 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-08-07 06:38:41 -0400 |
commit | 242898be7a1921f646ca529ddc26d7337c69922f (patch) | |
tree | 674adf64ca6254318dab5bcd428ebe8ac73957ff | |
parent | 6bbad18a8b18228fa65d73547dfd5efad1515ef8 (diff) | |
parent | 9f737633e6ee54fc174282d49b2559bd2208391d (diff) |
Merge branch 'master' into upstream
94 files changed, 1133 insertions, 723 deletions
diff --git a/Documentation/cpu-freq/user-guide.txt b/Documentation/cpu-freq/user-guide.txt index 7fedc00c3d30..555c8cf3650a 100644 --- a/Documentation/cpu-freq/user-guide.txt +++ b/Documentation/cpu-freq/user-guide.txt | |||
@@ -153,10 +153,13 @@ scaling_governor, and by "echoing" the name of another | |||
153 | that some governors won't load - they only | 153 | that some governors won't load - they only |
154 | work on some specific architectures or | 154 | work on some specific architectures or |
155 | processors. | 155 | processors. |
156 | scaling_min_freq and | 156 | scaling_min_freq and |
157 | scaling_max_freq show the current "policy limits" (in | 157 | scaling_max_freq show the current "policy limits" (in |
158 | kHz). By echoing new values into these | 158 | kHz). By echoing new values into these |
159 | files, you can change these limits. | 159 | files, you can change these limits. |
160 | NOTE: when setting a policy you need to | ||
161 | first set scaling_max_freq, then | ||
162 | scaling_min_freq. | ||
160 | 163 | ||
161 | 164 | ||
162 | If you have selected the "userspace" governor which allows you to | 165 | If you have selected the "userspace" governor which allows you to |
diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt index b0c7ab93dcb9..7345c338080a 100644 --- a/Documentation/sysctl/kernel.txt +++ b/Documentation/sysctl/kernel.txt | |||
@@ -211,9 +211,8 @@ Controls the kernel's behaviour when an oops or BUG is encountered. | |||
211 | 211 | ||
212 | 0: try to continue operation | 212 | 0: try to continue operation |
213 | 213 | ||
214 | 1: delay a few seconds (to give klogd time to record the oops output) and | 214 | 1: panic immediatly. If the `panic' sysctl is also non-zero then the |
215 | then panic. If the `panic' sysctl is also non-zero then the machine will | 215 | machine will be rebooted. |
216 | be rebooted. | ||
217 | 216 | ||
218 | ============================================================== | 217 | ============================================================== |
219 | 218 | ||
diff --git a/MAINTAINERS b/MAINTAINERS index f1a71ffd840f..13f345cf77ce 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -298,6 +298,13 @@ L: info-linux@geode.amd.com | |||
298 | W: http://www.amd.com/us-en/ConnectivitySolutions/TechnicalResources/0,,50_2334_2452_11363,00.html | 298 | W: http://www.amd.com/us-en/ConnectivitySolutions/TechnicalResources/0,,50_2334_2452_11363,00.html |
299 | S: Supported | 299 | S: Supported |
300 | 300 | ||
301 | AOA (Apple Onboard Audio) ALSA DRIVER | ||
302 | P: Johannes Berg | ||
303 | M: johannes@sipsolutions.net | ||
304 | L: linuxppc-dev@ozlabs.org | ||
305 | L: alsa-devel@alsa-project.org | ||
306 | S: Maintained | ||
307 | |||
301 | APM DRIVER | 308 | APM DRIVER |
302 | P: Stephen Rothwell | 309 | P: Stephen Rothwell |
303 | M: sfr@canb.auug.org.au | 310 | M: sfr@canb.auug.org.au |
@@ -2659,6 +2666,14 @@ M: dbrownell@users.sourceforge.net | |||
2659 | L: spi-devel-general@lists.sourceforge.net | 2666 | L: spi-devel-general@lists.sourceforge.net |
2660 | S: Maintained | 2667 | S: Maintained |
2661 | 2668 | ||
2669 | STABLE BRANCH: | ||
2670 | P: Greg Kroah-Hartman | ||
2671 | M: greg@kroah.com | ||
2672 | P: Chris Wright | ||
2673 | M: chrisw@sous-sol.org | ||
2674 | L: stable@kernel.org | ||
2675 | S: Maintained | ||
2676 | |||
2662 | TPM DEVICE DRIVER | 2677 | TPM DEVICE DRIVER |
2663 | P: Kylene Hall | 2678 | P: Kylene Hall |
2664 | M: kjhall@us.ibm.com | 2679 | M: kjhall@us.ibm.com |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 2 | 1 | VERSION = 2 |
2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
3 | SUBLEVEL = 18 | 3 | SUBLEVEL = 18 |
4 | EXTRAVERSION = -rc3 | 4 | EXTRAVERSION = -rc4 |
5 | NAME=Crazed Snow-Weasel | 5 | NAME=Crazed Snow-Weasel |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/i386/kernel/cpu/cpufreq/Kconfig b/arch/i386/kernel/cpu/cpufreq/Kconfig index e44a4c6a4fe5..ccc1edff5c97 100644 --- a/arch/i386/kernel/cpu/cpufreq/Kconfig +++ b/arch/i386/kernel/cpu/cpufreq/Kconfig | |||
@@ -96,6 +96,7 @@ config X86_POWERNOW_K8_ACPI | |||
96 | 96 | ||
97 | config X86_GX_SUSPMOD | 97 | config X86_GX_SUSPMOD |
98 | tristate "Cyrix MediaGX/NatSemi Geode Suspend Modulation" | 98 | tristate "Cyrix MediaGX/NatSemi Geode Suspend Modulation" |
99 | depends on PCI | ||
99 | help | 100 | help |
100 | This add the CPUFreq driver for NatSemi Geode processors which | 101 | This add the CPUFreq driver for NatSemi Geode processors which |
101 | support suspend modulation. | 102 | support suspend modulation. |
@@ -202,7 +203,7 @@ config X86_LONGRUN | |||
202 | config X86_LONGHAUL | 203 | config X86_LONGHAUL |
203 | tristate "VIA Cyrix III Longhaul" | 204 | tristate "VIA Cyrix III Longhaul" |
204 | select CPU_FREQ_TABLE | 205 | select CPU_FREQ_TABLE |
205 | depends on BROKEN | 206 | depends on ACPI_PROCESSOR |
206 | help | 207 | help |
207 | This adds the CPUFreq driver for VIA Samuel/CyrixIII, | 208 | This adds the CPUFreq driver for VIA Samuel/CyrixIII, |
208 | VIA Cyrix Samuel/C3, VIA Cyrix Ezra and VIA Cyrix Ezra-T | 209 | VIA Cyrix Samuel/C3, VIA Cyrix Ezra and VIA Cyrix Ezra-T |
diff --git a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c index 567b39bea07e..efb41e81351c 100644 --- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c | |||
@@ -384,8 +384,7 @@ static int acpi_cpufreq_early_init_acpi(void) | |||
384 | } | 384 | } |
385 | 385 | ||
386 | /* Do initialization in ACPI core */ | 386 | /* Do initialization in ACPI core */ |
387 | acpi_processor_preregister_performance(acpi_perf_data); | 387 | return acpi_processor_preregister_performance(acpi_perf_data); |
388 | return 0; | ||
389 | } | 388 | } |
390 | 389 | ||
391 | static int | 390 | static int |
diff --git a/arch/i386/kernel/cpu/cpufreq/longhaul.c b/arch/i386/kernel/cpu/cpufreq/longhaul.c index 146f607e9c44..4f2c3aeef724 100644 --- a/arch/i386/kernel/cpu/cpufreq/longhaul.c +++ b/arch/i386/kernel/cpu/cpufreq/longhaul.c | |||
@@ -29,11 +29,13 @@ | |||
29 | #include <linux/cpufreq.h> | 29 | #include <linux/cpufreq.h> |
30 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
31 | #include <linux/string.h> | 31 | #include <linux/string.h> |
32 | #include <linux/pci.h> | ||
33 | 32 | ||
34 | #include <asm/msr.h> | 33 | #include <asm/msr.h> |
35 | #include <asm/timex.h> | 34 | #include <asm/timex.h> |
36 | #include <asm/io.h> | 35 | #include <asm/io.h> |
36 | #include <asm/acpi.h> | ||
37 | #include <linux/acpi.h> | ||
38 | #include <acpi/processor.h> | ||
37 | 39 | ||
38 | #include "longhaul.h" | 40 | #include "longhaul.h" |
39 | 41 | ||
@@ -56,6 +58,8 @@ static int minvid, maxvid; | |||
56 | static unsigned int minmult, maxmult; | 58 | static unsigned int minmult, maxmult; |
57 | static int can_scale_voltage; | 59 | static int can_scale_voltage; |
58 | static int vrmrev; | 60 | static int vrmrev; |
61 | static struct acpi_processor *pr = NULL; | ||
62 | static struct acpi_processor_cx *cx = NULL; | ||
59 | 63 | ||
60 | /* Module parameters */ | 64 | /* Module parameters */ |
61 | static int dont_scale_voltage; | 65 | static int dont_scale_voltage; |
@@ -118,84 +122,65 @@ static int longhaul_get_cpu_mult(void) | |||
118 | return eblcr_table[invalue]; | 122 | return eblcr_table[invalue]; |
119 | } | 123 | } |
120 | 124 | ||
125 | /* For processor with BCR2 MSR */ | ||
121 | 126 | ||
122 | static void do_powersaver(union msr_longhaul *longhaul, | 127 | static void do_longhaul1(int cx_address, unsigned int clock_ratio_index) |
123 | unsigned int clock_ratio_index) | ||
124 | { | 128 | { |
125 | struct pci_dev *dev; | 129 | union msr_bcr2 bcr2; |
126 | unsigned long flags; | 130 | u32 t; |
127 | unsigned int tmp_mask; | ||
128 | int version; | ||
129 | int i; | ||
130 | u16 pci_cmd; | ||
131 | u16 cmd_state[64]; | ||
132 | 131 | ||
133 | switch (cpu_model) { | 132 | rdmsrl(MSR_VIA_BCR2, bcr2.val); |
134 | case CPU_EZRA_T: | 133 | /* Enable software clock multiplier */ |
135 | version = 3; | 134 | bcr2.bits.ESOFTBF = 1; |
136 | break; | 135 | bcr2.bits.CLOCKMUL = clock_ratio_index; |
137 | case CPU_NEHEMIAH: | ||
138 | version = 0xf; | ||
139 | break; | ||
140 | default: | ||
141 | return; | ||
142 | } | ||
143 | 136 | ||
144 | rdmsrl(MSR_VIA_LONGHAUL, longhaul->val); | 137 | /* Sync to timer tick */ |
145 | longhaul->bits.SoftBusRatio = clock_ratio_index & 0xf; | 138 | safe_halt(); |
146 | longhaul->bits.SoftBusRatio4 = (clock_ratio_index & 0x10) >> 4; | 139 | ACPI_FLUSH_CPU_CACHE(); |
147 | longhaul->bits.EnableSoftBusRatio = 1; | 140 | /* Change frequency on next halt or sleep */ |
148 | longhaul->bits.RevisionKey = 0; | 141 | wrmsrl(MSR_VIA_BCR2, bcr2.val); |
142 | /* Invoke C3 */ | ||
143 | inb(cx_address); | ||
144 | /* Dummy op - must do something useless after P_LVL3 read */ | ||
145 | t = inl(acpi_fadt.xpm_tmr_blk.address); | ||
146 | |||
147 | /* Disable software clock multiplier */ | ||
148 | local_irq_disable(); | ||
149 | rdmsrl(MSR_VIA_BCR2, bcr2.val); | ||
150 | bcr2.bits.ESOFTBF = 0; | ||
151 | wrmsrl(MSR_VIA_BCR2, bcr2.val); | ||
152 | } | ||
149 | 153 | ||
150 | preempt_disable(); | 154 | /* For processor with Longhaul MSR */ |
151 | local_irq_save(flags); | ||
152 | 155 | ||
153 | /* | 156 | static void do_powersaver(int cx_address, unsigned int clock_ratio_index) |
154 | * get current pci bus master state for all devices | 157 | { |
155 | * and clear bus master bit | 158 | union msr_longhaul longhaul; |
156 | */ | 159 | u32 t; |
157 | dev = NULL; | ||
158 | i = 0; | ||
159 | do { | ||
160 | dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev); | ||
161 | if (dev != NULL) { | ||
162 | pci_read_config_word(dev, PCI_COMMAND, &pci_cmd); | ||
163 | cmd_state[i++] = pci_cmd; | ||
164 | pci_cmd &= ~PCI_COMMAND_MASTER; | ||
165 | pci_write_config_word(dev, PCI_COMMAND, pci_cmd); | ||
166 | } | ||
167 | } while (dev != NULL); | ||
168 | 160 | ||
169 | tmp_mask=inb(0x21); /* works on C3. save mask. */ | 161 | rdmsrl(MSR_VIA_LONGHAUL, longhaul.val); |
170 | outb(0xFE,0x21); /* TMR0 only */ | 162 | longhaul.bits.RevisionKey = longhaul.bits.RevisionID; |
171 | outb(0xFF,0x80); /* delay */ | 163 | longhaul.bits.SoftBusRatio = clock_ratio_index & 0xf; |
164 | longhaul.bits.SoftBusRatio4 = (clock_ratio_index & 0x10) >> 4; | ||
165 | longhaul.bits.EnableSoftBusRatio = 1; | ||
172 | 166 | ||
167 | /* Sync to timer tick */ | ||
173 | safe_halt(); | 168 | safe_halt(); |
174 | wrmsrl(MSR_VIA_LONGHAUL, longhaul->val); | 169 | ACPI_FLUSH_CPU_CACHE(); |
175 | halt(); | 170 | /* Change frequency on next halt or sleep */ |
176 | 171 | wrmsrl(MSR_VIA_LONGHAUL, longhaul.val); | |
172 | /* Invoke C3 */ | ||
173 | inb(cx_address); | ||
174 | /* Dummy op - must do something useless after P_LVL3 read */ | ||
175 | t = inl(acpi_fadt.xpm_tmr_blk.address); | ||
176 | |||
177 | /* Disable bus ratio bit */ | ||
177 | local_irq_disable(); | 178 | local_irq_disable(); |
178 | 179 | longhaul.bits.RevisionKey = longhaul.bits.RevisionID; | |
179 | outb(tmp_mask,0x21); /* restore mask */ | 180 | longhaul.bits.EnableSoftBusRatio = 0; |
180 | 181 | longhaul.bits.EnableSoftBSEL = 0; | |
181 | /* restore pci bus master state for all devices */ | 182 | longhaul.bits.EnableSoftVID = 0; |
182 | dev = NULL; | 183 | wrmsrl(MSR_VIA_LONGHAUL, longhaul.val); |
183 | i = 0; | ||
184 | do { | ||
185 | dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev); | ||
186 | if (dev != NULL) { | ||
187 | pci_cmd = cmd_state[i++]; | ||
188 | pci_write_config_byte(dev, PCI_COMMAND, pci_cmd); | ||
189 | } | ||
190 | } while (dev != NULL); | ||
191 | local_irq_restore(flags); | ||
192 | preempt_enable(); | ||
193 | |||
194 | /* disable bus ratio bit */ | ||
195 | rdmsrl(MSR_VIA_LONGHAUL, longhaul->val); | ||
196 | longhaul->bits.EnableSoftBusRatio = 0; | ||
197 | longhaul->bits.RevisionKey = version; | ||
198 | wrmsrl(MSR_VIA_LONGHAUL, longhaul->val); | ||
199 | } | 184 | } |
200 | 185 | ||
201 | /** | 186 | /** |
@@ -209,9 +194,9 @@ static void longhaul_setstate(unsigned int clock_ratio_index) | |||
209 | { | 194 | { |
210 | int speed, mult; | 195 | int speed, mult; |
211 | struct cpufreq_freqs freqs; | 196 | struct cpufreq_freqs freqs; |
212 | union msr_longhaul longhaul; | ||
213 | union msr_bcr2 bcr2; | ||
214 | static unsigned int old_ratio=-1; | 197 | static unsigned int old_ratio=-1; |
198 | unsigned long flags; | ||
199 | unsigned int pic1_mask, pic2_mask; | ||
215 | 200 | ||
216 | if (old_ratio == clock_ratio_index) | 201 | if (old_ratio == clock_ratio_index) |
217 | return; | 202 | return; |
@@ -234,6 +219,20 @@ static void longhaul_setstate(unsigned int clock_ratio_index) | |||
234 | dprintk ("Setting to FSB:%dMHz Mult:%d.%dx (%s)\n", | 219 | dprintk ("Setting to FSB:%dMHz Mult:%d.%dx (%s)\n", |
235 | fsb, mult/10, mult%10, print_speed(speed/1000)); | 220 | fsb, mult/10, mult%10, print_speed(speed/1000)); |
236 | 221 | ||
222 | preempt_disable(); | ||
223 | local_irq_save(flags); | ||
224 | |||
225 | pic2_mask = inb(0xA1); | ||
226 | pic1_mask = inb(0x21); /* works on C3. save mask. */ | ||
227 | outb(0xFF,0xA1); /* Overkill */ | ||
228 | outb(0xFE,0x21); /* TMR0 only */ | ||
229 | |||
230 | /* Disable bus master arbitration */ | ||
231 | if (pr->flags.bm_check) { | ||
232 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1, | ||
233 | ACPI_MTX_DO_NOT_LOCK); | ||
234 | } | ||
235 | |||
237 | switch (longhaul_version) { | 236 | switch (longhaul_version) { |
238 | 237 | ||
239 | /* | 238 | /* |
@@ -245,20 +244,7 @@ static void longhaul_setstate(unsigned int clock_ratio_index) | |||
245 | */ | 244 | */ |
246 | case TYPE_LONGHAUL_V1: | 245 | case TYPE_LONGHAUL_V1: |
247 | case TYPE_LONGHAUL_V2: | 246 | case TYPE_LONGHAUL_V2: |
248 | rdmsrl (MSR_VIA_BCR2, bcr2.val); | 247 | do_longhaul1(cx->address, clock_ratio_index); |
249 | /* Enable software clock multiplier */ | ||
250 | bcr2.bits.ESOFTBF = 1; | ||
251 | bcr2.bits.CLOCKMUL = clock_ratio_index; | ||
252 | local_irq_disable(); | ||
253 | wrmsrl (MSR_VIA_BCR2, bcr2.val); | ||
254 | safe_halt(); | ||
255 | |||
256 | /* Disable software clock multiplier */ | ||
257 | rdmsrl (MSR_VIA_BCR2, bcr2.val); | ||
258 | bcr2.bits.ESOFTBF = 0; | ||
259 | local_irq_disable(); | ||
260 | wrmsrl (MSR_VIA_BCR2, bcr2.val); | ||
261 | local_irq_enable(); | ||
262 | break; | 248 | break; |
263 | 249 | ||
264 | /* | 250 | /* |
@@ -273,10 +259,22 @@ static void longhaul_setstate(unsigned int clock_ratio_index) | |||
273 | * to work in practice. | 259 | * to work in practice. |
274 | */ | 260 | */ |
275 | case TYPE_POWERSAVER: | 261 | case TYPE_POWERSAVER: |
276 | do_powersaver(&longhaul, clock_ratio_index); | 262 | do_powersaver(cx->address, clock_ratio_index); |
277 | break; | 263 | break; |
278 | } | 264 | } |
279 | 265 | ||
266 | /* Enable bus master arbitration */ | ||
267 | if (pr->flags.bm_check) { | ||
268 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0, | ||
269 | ACPI_MTX_DO_NOT_LOCK); | ||
270 | } | ||
271 | |||
272 | outb(pic2_mask,0xA1); /* restore mask */ | ||
273 | outb(pic1_mask,0x21); | ||
274 | |||
275 | local_irq_restore(flags); | ||
276 | preempt_enable(); | ||
277 | |||
280 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 278 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); |
281 | } | 279 | } |
282 | 280 | ||
@@ -324,9 +322,11 @@ static int guess_fsb(void) | |||
324 | static int __init longhaul_get_ranges(void) | 322 | static int __init longhaul_get_ranges(void) |
325 | { | 323 | { |
326 | unsigned long invalue; | 324 | unsigned long invalue; |
327 | unsigned int multipliers[32]= { | 325 | unsigned int ezra_t_multipliers[32]= { |
328 | 50,30,40,100,55,35,45,95,90,70,80,60,120,75,85,65, | 326 | 90, 30, 40, 100, 55, 35, 45, 95, |
329 | -1,110,120,-1,135,115,125,105,130,150,160,140,-1,155,-1,145 }; | 327 | 50, 70, 80, 60, 120, 75, 85, 65, |
328 | -1, 110, 120, -1, 135, 115, 125, 105, | ||
329 | 130, 150, 160, 140, -1, 155, -1, 145 }; | ||
330 | unsigned int j, k = 0; | 330 | unsigned int j, k = 0; |
331 | union msr_longhaul longhaul; | 331 | union msr_longhaul longhaul; |
332 | unsigned long lo, hi; | 332 | unsigned long lo, hi; |
@@ -355,13 +355,13 @@ static int __init longhaul_get_ranges(void) | |||
355 | invalue = longhaul.bits.MaxMHzBR; | 355 | invalue = longhaul.bits.MaxMHzBR; |
356 | if (longhaul.bits.MaxMHzBR4) | 356 | if (longhaul.bits.MaxMHzBR4) |
357 | invalue += 16; | 357 | invalue += 16; |
358 | maxmult=multipliers[invalue]; | 358 | maxmult=ezra_t_multipliers[invalue]; |
359 | 359 | ||
360 | invalue = longhaul.bits.MinMHzBR; | 360 | invalue = longhaul.bits.MinMHzBR; |
361 | if (longhaul.bits.MinMHzBR4 == 1) | 361 | if (longhaul.bits.MinMHzBR4 == 1) |
362 | minmult = 30; | 362 | minmult = 30; |
363 | else | 363 | else |
364 | minmult = multipliers[invalue]; | 364 | minmult = ezra_t_multipliers[invalue]; |
365 | fsb = eblcr_fsb_table_v2[longhaul.bits.MaxMHzFSB]; | 365 | fsb = eblcr_fsb_table_v2[longhaul.bits.MaxMHzFSB]; |
366 | break; | 366 | break; |
367 | } | 367 | } |
@@ -527,6 +527,18 @@ static unsigned int longhaul_get(unsigned int cpu) | |||
527 | return calc_speed(longhaul_get_cpu_mult()); | 527 | return calc_speed(longhaul_get_cpu_mult()); |
528 | } | 528 | } |
529 | 529 | ||
530 | static acpi_status longhaul_walk_callback(acpi_handle obj_handle, | ||
531 | u32 nesting_level, | ||
532 | void *context, void **return_value) | ||
533 | { | ||
534 | struct acpi_device *d; | ||
535 | |||
536 | if ( acpi_bus_get_device(obj_handle, &d) ) { | ||
537 | return 0; | ||
538 | } | ||
539 | *return_value = (void *)acpi_driver_data(d); | ||
540 | return 1; | ||
541 | } | ||
530 | 542 | ||
531 | static int __init longhaul_cpu_init(struct cpufreq_policy *policy) | 543 | static int __init longhaul_cpu_init(struct cpufreq_policy *policy) |
532 | { | 544 | { |
@@ -534,6 +546,15 @@ static int __init longhaul_cpu_init(struct cpufreq_policy *policy) | |||
534 | char *cpuname=NULL; | 546 | char *cpuname=NULL; |
535 | int ret; | 547 | int ret; |
536 | 548 | ||
549 | /* Check ACPI support for C3 state */ | ||
550 | acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, | ||
551 | &longhaul_walk_callback, NULL, (void *)&pr); | ||
552 | if (pr == NULL) goto err_acpi; | ||
553 | |||
554 | cx = &pr->power.states[ACPI_STATE_C3]; | ||
555 | if (cx->address == 0 || cx->latency > 1000) goto err_acpi; | ||
556 | |||
557 | /* Now check what we have on this motherboard */ | ||
537 | switch (c->x86_model) { | 558 | switch (c->x86_model) { |
538 | case 6: | 559 | case 6: |
539 | cpu_model = CPU_SAMUEL; | 560 | cpu_model = CPU_SAMUEL; |
@@ -634,6 +655,10 @@ static int __init longhaul_cpu_init(struct cpufreq_policy *policy) | |||
634 | cpufreq_frequency_table_get_attr(longhaul_table, policy->cpu); | 655 | cpufreq_frequency_table_get_attr(longhaul_table, policy->cpu); |
635 | 656 | ||
636 | return 0; | 657 | return 0; |
658 | |||
659 | err_acpi: | ||
660 | printk(KERN_ERR PFX "No ACPI support for CPU frequency changes.\n"); | ||
661 | return -ENODEV; | ||
637 | } | 662 | } |
638 | 663 | ||
639 | static int __devexit longhaul_cpu_exit(struct cpufreq_policy *policy) | 664 | static int __devexit longhaul_cpu_exit(struct cpufreq_policy *policy) |
@@ -666,6 +691,18 @@ static int __init longhaul_init(void) | |||
666 | if (c->x86_vendor != X86_VENDOR_CENTAUR || c->x86 != 6) | 691 | if (c->x86_vendor != X86_VENDOR_CENTAUR || c->x86 != 6) |
667 | return -ENODEV; | 692 | return -ENODEV; |
668 | 693 | ||
694 | #ifdef CONFIG_SMP | ||
695 | if (num_online_cpus() > 1) { | ||
696 | return -ENODEV; | ||
697 | printk(KERN_ERR PFX "More than 1 CPU detected, longhaul disabled.\n"); | ||
698 | } | ||
699 | #endif | ||
700 | #ifdef CONFIG_X86_IO_APIC | ||
701 | if (cpu_has_apic) { | ||
702 | printk(KERN_ERR PFX "APIC detected. Longhaul is currently broken in this configuration.\n"); | ||
703 | return -ENODEV; | ||
704 | } | ||
705 | #endif | ||
669 | switch (c->x86_model) { | 706 | switch (c->x86_model) { |
670 | case 6 ... 9: | 707 | case 6 ... 9: |
671 | return cpufreq_register_driver(&longhaul_driver); | 708 | return cpufreq_register_driver(&longhaul_driver); |
@@ -699,6 +736,6 @@ MODULE_AUTHOR ("Dave Jones <davej@codemonkey.org.uk>"); | |||
699 | MODULE_DESCRIPTION ("Longhaul driver for VIA Cyrix processors."); | 736 | MODULE_DESCRIPTION ("Longhaul driver for VIA Cyrix processors."); |
700 | MODULE_LICENSE ("GPL"); | 737 | MODULE_LICENSE ("GPL"); |
701 | 738 | ||
702 | module_init(longhaul_init); | 739 | late_initcall(longhaul_init); |
703 | module_exit(longhaul_exit); | 740 | module_exit(longhaul_exit); |
704 | 741 | ||
diff --git a/arch/ia64/kernel/uncached.c b/arch/ia64/kernel/uncached.c index 5f03b9e524dd..4c73a6763669 100644 --- a/arch/ia64/kernel/uncached.c +++ b/arch/ia64/kernel/uncached.c | |||
@@ -32,32 +32,38 @@ | |||
32 | 32 | ||
33 | extern void __init efi_memmap_walk_uc(efi_freemem_callback_t, void *); | 33 | extern void __init efi_memmap_walk_uc(efi_freemem_callback_t, void *); |
34 | 34 | ||
35 | #define MAX_UNCACHED_GRANULES 5 | 35 | struct uncached_pool { |
36 | static int allocated_granules; | 36 | struct gen_pool *pool; |
37 | struct mutex add_chunk_mutex; /* serialize adding a converted chunk */ | ||
38 | int nchunks_added; /* #of converted chunks added to pool */ | ||
39 | atomic_t status; /* smp called function's return status*/ | ||
40 | }; | ||
41 | |||
42 | #define MAX_CONVERTED_CHUNKS_PER_NODE 2 | ||
37 | 43 | ||
38 | struct gen_pool *uncached_pool[MAX_NUMNODES]; | 44 | struct uncached_pool uncached_pools[MAX_NUMNODES]; |
39 | 45 | ||
40 | 46 | ||
41 | static void uncached_ipi_visibility(void *data) | 47 | static void uncached_ipi_visibility(void *data) |
42 | { | 48 | { |
43 | int status; | 49 | int status; |
50 | struct uncached_pool *uc_pool = (struct uncached_pool *)data; | ||
44 | 51 | ||
45 | status = ia64_pal_prefetch_visibility(PAL_VISIBILITY_PHYSICAL); | 52 | status = ia64_pal_prefetch_visibility(PAL_VISIBILITY_PHYSICAL); |
46 | if ((status != PAL_VISIBILITY_OK) && | 53 | if ((status != PAL_VISIBILITY_OK) && |
47 | (status != PAL_VISIBILITY_OK_REMOTE_NEEDED)) | 54 | (status != PAL_VISIBILITY_OK_REMOTE_NEEDED)) |
48 | printk(KERN_DEBUG "pal_prefetch_visibility() returns %i on " | 55 | atomic_inc(&uc_pool->status); |
49 | "CPU %i\n", status, raw_smp_processor_id()); | ||
50 | } | 56 | } |
51 | 57 | ||
52 | 58 | ||
53 | static void uncached_ipi_mc_drain(void *data) | 59 | static void uncached_ipi_mc_drain(void *data) |
54 | { | 60 | { |
55 | int status; | 61 | int status; |
62 | struct uncached_pool *uc_pool = (struct uncached_pool *)data; | ||
56 | 63 | ||
57 | status = ia64_pal_mc_drain(); | 64 | status = ia64_pal_mc_drain(); |
58 | if (status) | 65 | if (status != PAL_STATUS_SUCCESS) |
59 | printk(KERN_WARNING "ia64_pal_mc_drain() failed with %i on " | 66 | atomic_inc(&uc_pool->status); |
60 | "CPU %i\n", status, raw_smp_processor_id()); | ||
61 | } | 67 | } |
62 | 68 | ||
63 | 69 | ||
@@ -70,21 +76,34 @@ static void uncached_ipi_mc_drain(void *data) | |||
70 | * This is accomplished by first allocating a granule of cached memory pages | 76 | * This is accomplished by first allocating a granule of cached memory pages |
71 | * and then converting them to uncached memory pages. | 77 | * and then converting them to uncached memory pages. |
72 | */ | 78 | */ |
73 | static int uncached_add_chunk(struct gen_pool *pool, int nid) | 79 | static int uncached_add_chunk(struct uncached_pool *uc_pool, int nid) |
74 | { | 80 | { |
75 | struct page *page; | 81 | struct page *page; |
76 | int status, i; | 82 | int status, i, nchunks_added = uc_pool->nchunks_added; |
77 | unsigned long c_addr, uc_addr; | 83 | unsigned long c_addr, uc_addr; |
78 | 84 | ||
79 | if (allocated_granules >= MAX_UNCACHED_GRANULES) | 85 | if (mutex_lock_interruptible(&uc_pool->add_chunk_mutex) != 0) |
86 | return -1; /* interrupted by a signal */ | ||
87 | |||
88 | if (uc_pool->nchunks_added > nchunks_added) { | ||
89 | /* someone added a new chunk while we were waiting */ | ||
90 | mutex_unlock(&uc_pool->add_chunk_mutex); | ||
91 | return 0; | ||
92 | } | ||
93 | |||
94 | if (uc_pool->nchunks_added >= MAX_CONVERTED_CHUNKS_PER_NODE) { | ||
95 | mutex_unlock(&uc_pool->add_chunk_mutex); | ||
80 | return -1; | 96 | return -1; |
97 | } | ||
81 | 98 | ||
82 | /* attempt to allocate a granule's worth of cached memory pages */ | 99 | /* attempt to allocate a granule's worth of cached memory pages */ |
83 | 100 | ||
84 | page = alloc_pages_node(nid, GFP_KERNEL | __GFP_ZERO, | 101 | page = alloc_pages_node(nid, GFP_KERNEL | __GFP_ZERO, |
85 | IA64_GRANULE_SHIFT-PAGE_SHIFT); | 102 | IA64_GRANULE_SHIFT-PAGE_SHIFT); |
86 | if (!page) | 103 | if (!page) { |
104 | mutex_unlock(&uc_pool->add_chunk_mutex); | ||
87 | return -1; | 105 | return -1; |
106 | } | ||
88 | 107 | ||
89 | /* convert the memory pages from cached to uncached */ | 108 | /* convert the memory pages from cached to uncached */ |
90 | 109 | ||
@@ -102,11 +121,14 @@ static int uncached_add_chunk(struct gen_pool *pool, int nid) | |||
102 | flush_tlb_kernel_range(uc_addr, uc_adddr + IA64_GRANULE_SIZE); | 121 | flush_tlb_kernel_range(uc_addr, uc_adddr + IA64_GRANULE_SIZE); |
103 | 122 | ||
104 | status = ia64_pal_prefetch_visibility(PAL_VISIBILITY_PHYSICAL); | 123 | status = ia64_pal_prefetch_visibility(PAL_VISIBILITY_PHYSICAL); |
105 | if (!status) { | 124 | if (status == PAL_VISIBILITY_OK_REMOTE_NEEDED) { |
106 | status = smp_call_function(uncached_ipi_visibility, NULL, 0, 1); | 125 | atomic_set(&uc_pool->status, 0); |
107 | if (status) | 126 | status = smp_call_function(uncached_ipi_visibility, uc_pool, |
127 | 0, 1); | ||
128 | if (status || atomic_read(&uc_pool->status)) | ||
108 | goto failed; | 129 | goto failed; |
109 | } | 130 | } else if (status != PAL_VISIBILITY_OK) |
131 | goto failed; | ||
110 | 132 | ||
111 | preempt_disable(); | 133 | preempt_disable(); |
112 | 134 | ||
@@ -120,20 +142,24 @@ static int uncached_add_chunk(struct gen_pool *pool, int nid) | |||
120 | 142 | ||
121 | preempt_enable(); | 143 | preempt_enable(); |
122 | 144 | ||
123 | ia64_pal_mc_drain(); | 145 | status = ia64_pal_mc_drain(); |
124 | status = smp_call_function(uncached_ipi_mc_drain, NULL, 0, 1); | 146 | if (status != PAL_STATUS_SUCCESS) |
125 | if (status) | 147 | goto failed; |
148 | atomic_set(&uc_pool->status, 0); | ||
149 | status = smp_call_function(uncached_ipi_mc_drain, uc_pool, 0, 1); | ||
150 | if (status || atomic_read(&uc_pool->status)) | ||
126 | goto failed; | 151 | goto failed; |
127 | 152 | ||
128 | /* | 153 | /* |
129 | * The chunk of memory pages has been converted to uncached so now we | 154 | * The chunk of memory pages has been converted to uncached so now we |
130 | * can add it to the pool. | 155 | * can add it to the pool. |
131 | */ | 156 | */ |
132 | status = gen_pool_add(pool, uc_addr, IA64_GRANULE_SIZE, nid); | 157 | status = gen_pool_add(uc_pool->pool, uc_addr, IA64_GRANULE_SIZE, nid); |
133 | if (status) | 158 | if (status) |
134 | goto failed; | 159 | goto failed; |
135 | 160 | ||
136 | allocated_granules++; | 161 | uc_pool->nchunks_added++; |
162 | mutex_unlock(&uc_pool->add_chunk_mutex); | ||
137 | return 0; | 163 | return 0; |
138 | 164 | ||
139 | /* failed to convert or add the chunk so give it back to the kernel */ | 165 | /* failed to convert or add the chunk so give it back to the kernel */ |
@@ -142,6 +168,7 @@ failed: | |||
142 | ClearPageUncached(&page[i]); | 168 | ClearPageUncached(&page[i]); |
143 | 169 | ||
144 | free_pages(c_addr, IA64_GRANULE_SHIFT-PAGE_SHIFT); | 170 | free_pages(c_addr, IA64_GRANULE_SHIFT-PAGE_SHIFT); |
171 | mutex_unlock(&uc_pool->add_chunk_mutex); | ||
145 | return -1; | 172 | return -1; |
146 | } | 173 | } |
147 | 174 | ||
@@ -158,7 +185,7 @@ failed: | |||
158 | unsigned long uncached_alloc_page(int starting_nid) | 185 | unsigned long uncached_alloc_page(int starting_nid) |
159 | { | 186 | { |
160 | unsigned long uc_addr; | 187 | unsigned long uc_addr; |
161 | struct gen_pool *pool; | 188 | struct uncached_pool *uc_pool; |
162 | int nid; | 189 | int nid; |
163 | 190 | ||
164 | if (unlikely(starting_nid >= MAX_NUMNODES)) | 191 | if (unlikely(starting_nid >= MAX_NUMNODES)) |
@@ -171,14 +198,14 @@ unsigned long uncached_alloc_page(int starting_nid) | |||
171 | do { | 198 | do { |
172 | if (!node_online(nid)) | 199 | if (!node_online(nid)) |
173 | continue; | 200 | continue; |
174 | pool = uncached_pool[nid]; | 201 | uc_pool = &uncached_pools[nid]; |
175 | if (pool == NULL) | 202 | if (uc_pool->pool == NULL) |
176 | continue; | 203 | continue; |
177 | do { | 204 | do { |
178 | uc_addr = gen_pool_alloc(pool, PAGE_SIZE); | 205 | uc_addr = gen_pool_alloc(uc_pool->pool, PAGE_SIZE); |
179 | if (uc_addr != 0) | 206 | if (uc_addr != 0) |
180 | return uc_addr; | 207 | return uc_addr; |
181 | } while (uncached_add_chunk(pool, nid) == 0); | 208 | } while (uncached_add_chunk(uc_pool, nid) == 0); |
182 | 209 | ||
183 | } while ((nid = (nid + 1) % MAX_NUMNODES) != starting_nid); | 210 | } while ((nid = (nid + 1) % MAX_NUMNODES) != starting_nid); |
184 | 211 | ||
@@ -197,7 +224,7 @@ EXPORT_SYMBOL(uncached_alloc_page); | |||
197 | void uncached_free_page(unsigned long uc_addr) | 224 | void uncached_free_page(unsigned long uc_addr) |
198 | { | 225 | { |
199 | int nid = paddr_to_nid(uc_addr - __IA64_UNCACHED_OFFSET); | 226 | int nid = paddr_to_nid(uc_addr - __IA64_UNCACHED_OFFSET); |
200 | struct gen_pool *pool = uncached_pool[nid]; | 227 | struct gen_pool *pool = uncached_pools[nid].pool; |
201 | 228 | ||
202 | if (unlikely(pool == NULL)) | 229 | if (unlikely(pool == NULL)) |
203 | return; | 230 | return; |
@@ -224,7 +251,7 @@ static int __init uncached_build_memmap(unsigned long uc_start, | |||
224 | unsigned long uc_end, void *arg) | 251 | unsigned long uc_end, void *arg) |
225 | { | 252 | { |
226 | int nid = paddr_to_nid(uc_start - __IA64_UNCACHED_OFFSET); | 253 | int nid = paddr_to_nid(uc_start - __IA64_UNCACHED_OFFSET); |
227 | struct gen_pool *pool = uncached_pool[nid]; | 254 | struct gen_pool *pool = uncached_pools[nid].pool; |
228 | size_t size = uc_end - uc_start; | 255 | size_t size = uc_end - uc_start; |
229 | 256 | ||
230 | touch_softlockup_watchdog(); | 257 | touch_softlockup_watchdog(); |
@@ -242,7 +269,8 @@ static int __init uncached_init(void) | |||
242 | int nid; | 269 | int nid; |
243 | 270 | ||
244 | for_each_online_node(nid) { | 271 | for_each_online_node(nid) { |
245 | uncached_pool[nid] = gen_pool_create(PAGE_SHIFT, nid); | 272 | uncached_pools[nid].pool = gen_pool_create(PAGE_SHIFT, nid); |
273 | mutex_init(&uncached_pools[nid].add_chunk_mutex); | ||
246 | } | 274 | } |
247 | 275 | ||
248 | efi_memmap_walk_uc(uncached_build_memmap, NULL); | 276 | efi_memmap_walk_uc(uncached_build_memmap, NULL); |
diff --git a/arch/sh/kernel/cpu/sh4/sq.c b/arch/sh/kernel/cpu/sh4/sq.c index 781dbb11c038..b09805f3ee23 100644 --- a/arch/sh/kernel/cpu/sh4/sq.c +++ b/arch/sh/kernel/cpu/sh4/sq.c | |||
@@ -421,18 +421,22 @@ static struct miscdevice sq_dev = { | |||
421 | 421 | ||
422 | static int __init sq_api_init(void) | 422 | static int __init sq_api_init(void) |
423 | { | 423 | { |
424 | int ret; | ||
424 | printk(KERN_NOTICE "sq: Registering store queue API.\n"); | 425 | printk(KERN_NOTICE "sq: Registering store queue API.\n"); |
425 | 426 | ||
426 | #ifdef CONFIG_PROC_FS | ||
427 | create_proc_read_entry("sq_mapping", 0, 0, sq_mapping_read_proc, 0); | 427 | create_proc_read_entry("sq_mapping", 0, 0, sq_mapping_read_proc, 0); |
428 | #endif | ||
429 | 428 | ||
430 | return misc_register(&sq_dev); | 429 | ret = misc_register(&sq_dev); |
430 | if (ret) | ||
431 | remove_proc_entry("sq_mapping", NULL); | ||
432 | |||
433 | return ret; | ||
431 | } | 434 | } |
432 | 435 | ||
433 | static void __exit sq_api_exit(void) | 436 | static void __exit sq_api_exit(void) |
434 | { | 437 | { |
435 | misc_deregister(&sq_dev); | 438 | misc_deregister(&sq_dev); |
439 | remove_proc_entry("sq_mapping", NULL); | ||
436 | } | 440 | } |
437 | 441 | ||
438 | module_init(sq_api_init); | 442 | module_init(sq_api_init); |
diff --git a/arch/x86_64/kernel/smp.c b/arch/x86_64/kernel/smp.c index 5a1c0a3bf872..06af6ca60129 100644 --- a/arch/x86_64/kernel/smp.c +++ b/arch/x86_64/kernel/smp.c | |||
@@ -203,7 +203,7 @@ int __cpuinit init_smp_flush(void) | |||
203 | { | 203 | { |
204 | int i; | 204 | int i; |
205 | for_each_cpu_mask(i, cpu_possible_map) { | 205 | for_each_cpu_mask(i, cpu_possible_map) { |
206 | spin_lock_init(&per_cpu(flush_state.tlbstate_lock, i)); | 206 | spin_lock_init(&per_cpu(flush_state, i).tlbstate_lock); |
207 | } | 207 | } |
208 | return 0; | 208 | return 0; |
209 | } | 209 | } |
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index 81e970adeab3..b0d4b147b19e 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c | |||
@@ -129,11 +129,15 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device) | |||
129 | struct acpi_memory_info *info, *n; | 129 | struct acpi_memory_info *info, *n; |
130 | 130 | ||
131 | 131 | ||
132 | if (!list_empty(&mem_device->res_list)) | ||
133 | return 0; | ||
134 | |||
132 | status = acpi_walk_resources(mem_device->device->handle, METHOD_NAME__CRS, | 135 | status = acpi_walk_resources(mem_device->device->handle, METHOD_NAME__CRS, |
133 | acpi_memory_get_resource, mem_device); | 136 | acpi_memory_get_resource, mem_device); |
134 | if (ACPI_FAILURE(status)) { | 137 | if (ACPI_FAILURE(status)) { |
135 | list_for_each_entry_safe(info, n, &mem_device->res_list, list) | 138 | list_for_each_entry_safe(info, n, &mem_device->res_list, list) |
136 | kfree(info); | 139 | kfree(info); |
140 | INIT_LIST_HEAD(&mem_device->res_list); | ||
137 | return -EINVAL; | 141 | return -EINVAL; |
138 | } | 142 | } |
139 | 143 | ||
@@ -230,17 +234,10 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) | |||
230 | * (i.e. memory-hot-remove function) | 234 | * (i.e. memory-hot-remove function) |
231 | */ | 235 | */ |
232 | list_for_each_entry(info, &mem_device->res_list, list) { | 236 | list_for_each_entry(info, &mem_device->res_list, list) { |
233 | u64 start_pfn, end_pfn; | 237 | if (info->enabled) { /* just sanity check...*/ |
234 | |||
235 | start_pfn = info->start_addr >> PAGE_SHIFT; | ||
236 | end_pfn = (info->start_addr + info->length - 1) >> PAGE_SHIFT; | ||
237 | |||
238 | if (pfn_valid(start_pfn) || pfn_valid(end_pfn)) { | ||
239 | /* already enabled. try next area */ | ||
240 | num_enabled++; | 238 | num_enabled++; |
241 | continue; | 239 | continue; |
242 | } | 240 | } |
243 | |||
244 | result = add_memory(node, info->start_addr, info->length); | 241 | result = add_memory(node, info->start_addr, info->length); |
245 | if (result) | 242 | if (result) |
246 | continue; | 243 | continue; |
diff --git a/drivers/char/hvsi.c b/drivers/char/hvsi.c index 41db8060e8f7..017f755632a3 100644 --- a/drivers/char/hvsi.c +++ b/drivers/char/hvsi.c | |||
@@ -311,7 +311,8 @@ static void hvsi_recv_control(struct hvsi_struct *hp, uint8_t *packet, | |||
311 | /* CD went away; no more connection */ | 311 | /* CD went away; no more connection */ |
312 | pr_debug("hvsi%i: CD dropped\n", hp->index); | 312 | pr_debug("hvsi%i: CD dropped\n", hp->index); |
313 | hp->mctrl &= TIOCM_CD; | 313 | hp->mctrl &= TIOCM_CD; |
314 | if (!(hp->tty->flags & CLOCAL)) | 314 | /* If userland hasn't done an open(2) yet, hp->tty is NULL. */ |
315 | if (hp->tty && !(hp->tty->flags & CLOCAL)) | ||
315 | *to_hangup = hp->tty; | 316 | *to_hangup = hp->tty; |
316 | } | 317 | } |
317 | break; | 318 | break; |
@@ -986,10 +987,7 @@ static void hvsi_write_worker(void *arg) | |||
986 | start_j = 0; | 987 | start_j = 0; |
987 | #endif /* DEBUG */ | 988 | #endif /* DEBUG */ |
988 | wake_up_all(&hp->emptyq); | 989 | wake_up_all(&hp->emptyq); |
989 | if (test_bit(TTY_DO_WRITE_WAKEUP, &hp->tty->flags) | 990 | tty_wakeup(hp->tty); |
990 | && hp->tty->ldisc.write_wakeup) | ||
991 | hp->tty->ldisc.write_wakeup(hp->tty); | ||
992 | wake_up_interruptible(&hp->tty->write_wait); | ||
993 | } | 991 | } |
994 | 992 | ||
995 | out: | 993 | out: |
diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c index 819516b35a79..a01d796d1eeb 100644 --- a/drivers/char/hw_random/omap-rng.c +++ b/drivers/char/hw_random/omap-rng.c | |||
@@ -25,12 +25,12 @@ | |||
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/random.h> | 27 | #include <linux/random.h> |
28 | #include <linux/clk.h> | ||
28 | #include <linux/err.h> | 29 | #include <linux/err.h> |
29 | #include <linux/device.h> | 30 | #include <linux/platform_device.h> |
30 | #include <linux/hw_random.h> | 31 | #include <linux/hw_random.h> |
31 | 32 | ||
32 | #include <asm/io.h> | 33 | #include <asm/io.h> |
33 | #include <asm/hardware/clock.h> | ||
34 | 34 | ||
35 | #define RNG_OUT_REG 0x00 /* Output register */ | 35 | #define RNG_OUT_REG 0x00 /* Output register */ |
36 | #define RNG_STAT_REG 0x04 /* Status register | 36 | #define RNG_STAT_REG 0x04 /* Status register |
@@ -52,7 +52,7 @@ | |||
52 | 52 | ||
53 | static void __iomem *rng_base; | 53 | static void __iomem *rng_base; |
54 | static struct clk *rng_ick; | 54 | static struct clk *rng_ick; |
55 | static struct device *rng_dev; | 55 | static struct platform_device *rng_dev; |
56 | 56 | ||
57 | static u32 omap_rng_read_reg(int reg) | 57 | static u32 omap_rng_read_reg(int reg) |
58 | { | 58 | { |
@@ -83,9 +83,8 @@ static struct hwrng omap_rng_ops = { | |||
83 | .data_read = omap_rng_data_read, | 83 | .data_read = omap_rng_data_read, |
84 | }; | 84 | }; |
85 | 85 | ||
86 | static int __init omap_rng_probe(struct device *dev) | 86 | static int __init omap_rng_probe(struct platform_device *pdev) |
87 | { | 87 | { |
88 | struct platform_device *pdev = to_platform_device(dev); | ||
89 | struct resource *res, *mem; | 88 | struct resource *res, *mem; |
90 | int ret; | 89 | int ret; |
91 | 90 | ||
@@ -95,16 +94,14 @@ static int __init omap_rng_probe(struct device *dev) | |||
95 | */ | 94 | */ |
96 | BUG_ON(rng_dev); | 95 | BUG_ON(rng_dev); |
97 | 96 | ||
98 | if (cpu_is_omap24xx()) { | 97 | if (cpu_is_omap24xx()) { |
99 | rng_ick = clk_get(NULL, "rng_ick"); | 98 | rng_ick = clk_get(NULL, "rng_ick"); |
100 | if (IS_ERR(rng_ick)) { | 99 | if (IS_ERR(rng_ick)) { |
101 | dev_err(dev, "Could not get rng_ick\n"); | 100 | dev_err(&pdev->dev, "Could not get rng_ick\n"); |
102 | ret = PTR_ERR(rng_ick); | 101 | ret = PTR_ERR(rng_ick); |
103 | return ret; | 102 | return ret; |
104 | } | 103 | } else |
105 | else { | 104 | clk_enable(rng_ick); |
106 | clk_use(rng_ick); | ||
107 | } | ||
108 | } | 105 | } |
109 | 106 | ||
110 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 107 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
@@ -117,7 +114,7 @@ static int __init omap_rng_probe(struct device *dev) | |||
117 | if (mem == NULL) | 114 | if (mem == NULL) |
118 | return -EBUSY; | 115 | return -EBUSY; |
119 | 116 | ||
120 | dev_set_drvdata(dev, mem); | 117 | dev_set_drvdata(&pdev->dev, mem); |
121 | rng_base = (u32 __iomem *)io_p2v(res->start); | 118 | rng_base = (u32 __iomem *)io_p2v(res->start); |
122 | 119 | ||
123 | ret = hwrng_register(&omap_rng_ops); | 120 | ret = hwrng_register(&omap_rng_ops); |
@@ -127,25 +124,25 @@ static int __init omap_rng_probe(struct device *dev) | |||
127 | return ret; | 124 | return ret; |
128 | } | 125 | } |
129 | 126 | ||
130 | dev_info(dev, "OMAP Random Number Generator ver. %02x\n", | 127 | dev_info(&pdev->dev, "OMAP Random Number Generator ver. %02x\n", |
131 | omap_rng_read_reg(RNG_REV_REG)); | 128 | omap_rng_read_reg(RNG_REV_REG)); |
132 | omap_rng_write_reg(RNG_MASK_REG, 0x1); | 129 | omap_rng_write_reg(RNG_MASK_REG, 0x1); |
133 | 130 | ||
134 | rng_dev = dev; | 131 | rng_dev = pdev; |
135 | 132 | ||
136 | return 0; | 133 | return 0; |
137 | } | 134 | } |
138 | 135 | ||
139 | static int __exit omap_rng_remove(struct device *dev) | 136 | static int __exit omap_rng_remove(struct platform_device *pdev) |
140 | { | 137 | { |
141 | struct resource *mem = dev_get_drvdata(dev); | 138 | struct resource *mem = dev_get_drvdata(&pdev->dev); |
142 | 139 | ||
143 | hwrng_unregister(&omap_rng_ops); | 140 | hwrng_unregister(&omap_rng_ops); |
144 | 141 | ||
145 | omap_rng_write_reg(RNG_MASK_REG, 0x0); | 142 | omap_rng_write_reg(RNG_MASK_REG, 0x0); |
146 | 143 | ||
147 | if (cpu_is_omap24xx()) { | 144 | if (cpu_is_omap24xx()) { |
148 | clk_unuse(rng_ick); | 145 | clk_disable(rng_ick); |
149 | clk_put(rng_ick); | 146 | clk_put(rng_ick); |
150 | } | 147 | } |
151 | 148 | ||
@@ -157,18 +154,16 @@ static int __exit omap_rng_remove(struct device *dev) | |||
157 | 154 | ||
158 | #ifdef CONFIG_PM | 155 | #ifdef CONFIG_PM |
159 | 156 | ||
160 | static int omap_rng_suspend(struct device *dev, pm_message_t message, u32 level) | 157 | static int omap_rng_suspend(struct platform_device *pdev, pm_message_t message) |
161 | { | 158 | { |
162 | omap_rng_write_reg(RNG_MASK_REG, 0x0); | 159 | omap_rng_write_reg(RNG_MASK_REG, 0x0); |
163 | |||
164 | return 0; | 160 | return 0; |
165 | } | 161 | } |
166 | 162 | ||
167 | static int omap_rng_resume(struct device *dev, pm_message_t message, u32 level) | 163 | static int omap_rng_resume(struct platform_device *pdev) |
168 | { | 164 | { |
169 | omap_rng_write_reg(RNG_MASK_REG, 0x1); | 165 | omap_rng_write_reg(RNG_MASK_REG, 0x1); |
170 | 166 | return 0; | |
171 | return 1; | ||
172 | } | 167 | } |
173 | 168 | ||
174 | #else | 169 | #else |
@@ -179,9 +174,11 @@ static int omap_rng_resume(struct device *dev, pm_message_t message, u32 level) | |||
179 | #endif | 174 | #endif |
180 | 175 | ||
181 | 176 | ||
182 | static struct device_driver omap_rng_driver = { | 177 | static struct platform_driver omap_rng_driver = { |
183 | .name = "omap_rng", | 178 | .driver = { |
184 | .bus = &platform_bus_type, | 179 | .name = "omap_rng", |
180 | .owner = THIS_MODULE, | ||
181 | }, | ||
185 | .probe = omap_rng_probe, | 182 | .probe = omap_rng_probe, |
186 | .remove = __exit_p(omap_rng_remove), | 183 | .remove = __exit_p(omap_rng_remove), |
187 | .suspend = omap_rng_suspend, | 184 | .suspend = omap_rng_suspend, |
@@ -193,12 +190,12 @@ static int __init omap_rng_init(void) | |||
193 | if (!cpu_is_omap16xx() && !cpu_is_omap24xx()) | 190 | if (!cpu_is_omap16xx() && !cpu_is_omap24xx()) |
194 | return -ENODEV; | 191 | return -ENODEV; |
195 | 192 | ||
196 | return driver_register(&omap_rng_driver); | 193 | return platform_driver_register(&omap_rng_driver); |
197 | } | 194 | } |
198 | 195 | ||
199 | static void __exit omap_rng_exit(void) | 196 | static void __exit omap_rng_exit(void) |
200 | { | 197 | { |
201 | driver_unregister(&omap_rng_driver); | 198 | platform_driver_unregister(&omap_rng_driver); |
202 | } | 199 | } |
203 | 200 | ||
204 | module_init(omap_rng_init); | 201 | module_init(omap_rng_init); |
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c index 056ebe84b81d..3e90aac37510 100644 --- a/drivers/char/keyboard.c +++ b/drivers/char/keyboard.c | |||
@@ -107,7 +107,6 @@ const int NR_TYPES = ARRAY_SIZE(max_vals); | |||
107 | 107 | ||
108 | struct kbd_struct kbd_table[MAX_NR_CONSOLES]; | 108 | struct kbd_struct kbd_table[MAX_NR_CONSOLES]; |
109 | static struct kbd_struct *kbd = kbd_table; | 109 | static struct kbd_struct *kbd = kbd_table; |
110 | static struct kbd_struct kbd0; | ||
111 | 110 | ||
112 | int spawnpid, spawnsig; | 111 | int spawnpid, spawnsig; |
113 | 112 | ||
@@ -223,13 +222,13 @@ static void kd_nosound(unsigned long ignored) | |||
223 | { | 222 | { |
224 | struct list_head *node; | 223 | struct list_head *node; |
225 | 224 | ||
226 | list_for_each(node,&kbd_handler.h_list) { | 225 | list_for_each(node, &kbd_handler.h_list) { |
227 | struct input_handle *handle = to_handle_h(node); | 226 | struct input_handle *handle = to_handle_h(node); |
228 | if (test_bit(EV_SND, handle->dev->evbit)) { | 227 | if (test_bit(EV_SND, handle->dev->evbit)) { |
229 | if (test_bit(SND_TONE, handle->dev->sndbit)) | 228 | if (test_bit(SND_TONE, handle->dev->sndbit)) |
230 | input_event(handle->dev, EV_SND, SND_TONE, 0); | 229 | input_inject_event(handle, EV_SND, SND_TONE, 0); |
231 | if (test_bit(SND_BELL, handle->dev->sndbit)) | 230 | if (test_bit(SND_BELL, handle->dev->sndbit)) |
232 | input_event(handle->dev, EV_SND, SND_BELL, 0); | 231 | input_inject_event(handle, EV_SND, SND_BELL, 0); |
233 | } | 232 | } |
234 | } | 233 | } |
235 | } | 234 | } |
@@ -247,11 +246,11 @@ void kd_mksound(unsigned int hz, unsigned int ticks) | |||
247 | struct input_handle *handle = to_handle_h(node); | 246 | struct input_handle *handle = to_handle_h(node); |
248 | if (test_bit(EV_SND, handle->dev->evbit)) { | 247 | if (test_bit(EV_SND, handle->dev->evbit)) { |
249 | if (test_bit(SND_TONE, handle->dev->sndbit)) { | 248 | if (test_bit(SND_TONE, handle->dev->sndbit)) { |
250 | input_event(handle->dev, EV_SND, SND_TONE, hz); | 249 | input_inject_event(handle, EV_SND, SND_TONE, hz); |
251 | break; | 250 | break; |
252 | } | 251 | } |
253 | if (test_bit(SND_BELL, handle->dev->sndbit)) { | 252 | if (test_bit(SND_BELL, handle->dev->sndbit)) { |
254 | input_event(handle->dev, EV_SND, SND_BELL, 1); | 253 | input_inject_event(handle, EV_SND, SND_BELL, 1); |
255 | break; | 254 | break; |
256 | } | 255 | } |
257 | } | 256 | } |
@@ -272,15 +271,15 @@ int kbd_rate(struct kbd_repeat *rep) | |||
272 | unsigned int d = 0; | 271 | unsigned int d = 0; |
273 | unsigned int p = 0; | 272 | unsigned int p = 0; |
274 | 273 | ||
275 | list_for_each(node,&kbd_handler.h_list) { | 274 | list_for_each(node, &kbd_handler.h_list) { |
276 | struct input_handle *handle = to_handle_h(node); | 275 | struct input_handle *handle = to_handle_h(node); |
277 | struct input_dev *dev = handle->dev; | 276 | struct input_dev *dev = handle->dev; |
278 | 277 | ||
279 | if (test_bit(EV_REP, dev->evbit)) { | 278 | if (test_bit(EV_REP, dev->evbit)) { |
280 | if (rep->delay > 0) | 279 | if (rep->delay > 0) |
281 | input_event(dev, EV_REP, REP_DELAY, rep->delay); | 280 | input_inject_event(handle, EV_REP, REP_DELAY, rep->delay); |
282 | if (rep->period > 0) | 281 | if (rep->period > 0) |
283 | input_event(dev, EV_REP, REP_PERIOD, rep->period); | 282 | input_inject_event(handle, EV_REP, REP_PERIOD, rep->period); |
284 | d = dev->rep[REP_DELAY]; | 283 | d = dev->rep[REP_DELAY]; |
285 | p = dev->rep[REP_PERIOD]; | 284 | p = dev->rep[REP_PERIOD]; |
286 | } | 285 | } |
@@ -988,7 +987,7 @@ static inline unsigned char getleds(void) | |||
988 | * interrupt routines for this thing allows us to easily mask | 987 | * interrupt routines for this thing allows us to easily mask |
989 | * this when we don't want any of the above to happen. | 988 | * this when we don't want any of the above to happen. |
990 | * This allows for easy and efficient race-condition prevention | 989 | * This allows for easy and efficient race-condition prevention |
991 | * for kbd_refresh_leds => input_event(dev, EV_LED, ...) => ... | 990 | * for kbd_start => input_inject_event(dev, EV_LED, ...) => ... |
992 | */ | 991 | */ |
993 | 992 | ||
994 | static void kbd_bh(unsigned long dummy) | 993 | static void kbd_bh(unsigned long dummy) |
@@ -998,11 +997,11 @@ static void kbd_bh(unsigned long dummy) | |||
998 | 997 | ||
999 | if (leds != ledstate) { | 998 | if (leds != ledstate) { |
1000 | list_for_each(node, &kbd_handler.h_list) { | 999 | list_for_each(node, &kbd_handler.h_list) { |
1001 | struct input_handle * handle = to_handle_h(node); | 1000 | struct input_handle *handle = to_handle_h(node); |
1002 | input_event(handle->dev, EV_LED, LED_SCROLLL, !!(leds & 0x01)); | 1001 | input_inject_event(handle, EV_LED, LED_SCROLLL, !!(leds & 0x01)); |
1003 | input_event(handle->dev, EV_LED, LED_NUML, !!(leds & 0x02)); | 1002 | input_inject_event(handle, EV_LED, LED_NUML, !!(leds & 0x02)); |
1004 | input_event(handle->dev, EV_LED, LED_CAPSL, !!(leds & 0x04)); | 1003 | input_inject_event(handle, EV_LED, LED_CAPSL, !!(leds & 0x04)); |
1005 | input_sync(handle->dev); | 1004 | input_inject_event(handle, EV_SYN, SYN_REPORT, 0); |
1006 | } | 1005 | } |
1007 | } | 1006 | } |
1008 | 1007 | ||
@@ -1011,23 +1010,6 @@ static void kbd_bh(unsigned long dummy) | |||
1011 | 1010 | ||
1012 | DECLARE_TASKLET_DISABLED(keyboard_tasklet, kbd_bh, 0); | 1011 | DECLARE_TASKLET_DISABLED(keyboard_tasklet, kbd_bh, 0); |
1013 | 1012 | ||
1014 | /* | ||
1015 | * This allows a newly plugged keyboard to pick the LED state. | ||
1016 | */ | ||
1017 | static void kbd_refresh_leds(struct input_handle *handle) | ||
1018 | { | ||
1019 | unsigned char leds = ledstate; | ||
1020 | |||
1021 | tasklet_disable(&keyboard_tasklet); | ||
1022 | if (leds != 0xff) { | ||
1023 | input_event(handle->dev, EV_LED, LED_SCROLLL, !!(leds & 0x01)); | ||
1024 | input_event(handle->dev, EV_LED, LED_NUML, !!(leds & 0x02)); | ||
1025 | input_event(handle->dev, EV_LED, LED_CAPSL, !!(leds & 0x04)); | ||
1026 | input_sync(handle->dev); | ||
1027 | } | ||
1028 | tasklet_enable(&keyboard_tasklet); | ||
1029 | } | ||
1030 | |||
1031 | #if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(CONFIG_ALPHA) ||\ | 1013 | #if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(CONFIG_ALPHA) ||\ |
1032 | defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) ||\ | 1014 | defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) ||\ |
1033 | defined(CONFIG_PARISC) || defined(CONFIG_SUPERH) ||\ | 1015 | defined(CONFIG_PARISC) || defined(CONFIG_SUPERH) ||\ |
@@ -1043,7 +1025,7 @@ static const unsigned short x86_keycodes[256] = | |||
1043 | 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, | 1025 | 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, |
1044 | 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, | 1026 | 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, |
1045 | 80, 81, 82, 83, 84,118, 86, 87, 88,115,120,119,121,112,123, 92, | 1027 | 80, 81, 82, 83, 84,118, 86, 87, 88,115,120,119,121,112,123, 92, |
1046 | 284,285,309,298,312, 91,327,328,329,331,333,335,336,337,338,339, | 1028 | 284,285,309, 0,312, 91,327,328,329,331,333,335,336,337,338,339, |
1047 | 367,288,302,304,350, 89,334,326,267,126,268,269,125,347,348,349, | 1029 | 367,288,302,304,350, 89,334,326,267,126,268,269,125,347,348,349, |
1048 | 360,261,262,263,268,376,100,101,321,316,373,286,289,102,351,355, | 1030 | 360,261,262,263,268,376,100,101,321,316,373,286,289,102,351,355, |
1049 | 103,104,105,275,287,279,306,106,274,107,294,364,358,363,362,361, | 1031 | 103,104,105,275,287,279,306,106,274,107,294,364,358,363,362,361, |
@@ -1065,38 +1047,55 @@ extern void sun_do_break(void); | |||
1065 | static int emulate_raw(struct vc_data *vc, unsigned int keycode, | 1047 | static int emulate_raw(struct vc_data *vc, unsigned int keycode, |
1066 | unsigned char up_flag) | 1048 | unsigned char up_flag) |
1067 | { | 1049 | { |
1068 | if (keycode > 255 || !x86_keycodes[keycode]) | 1050 | int code; |
1069 | return -1; | ||
1070 | 1051 | ||
1071 | switch (keycode) { | 1052 | switch (keycode) { |
1072 | case KEY_PAUSE: | 1053 | case KEY_PAUSE: |
1073 | put_queue(vc, 0xe1); | 1054 | put_queue(vc, 0xe1); |
1074 | put_queue(vc, 0x1d | up_flag); | 1055 | put_queue(vc, 0x1d | up_flag); |
1075 | put_queue(vc, 0x45 | up_flag); | 1056 | put_queue(vc, 0x45 | up_flag); |
1076 | return 0; | 1057 | break; |
1058 | |||
1077 | case KEY_HANGEUL: | 1059 | case KEY_HANGEUL: |
1078 | if (!up_flag) | 1060 | if (!up_flag) |
1079 | put_queue(vc, 0xf2); | 1061 | put_queue(vc, 0xf2); |
1080 | return 0; | 1062 | break; |
1063 | |||
1081 | case KEY_HANJA: | 1064 | case KEY_HANJA: |
1082 | if (!up_flag) | 1065 | if (!up_flag) |
1083 | put_queue(vc, 0xf1); | 1066 | put_queue(vc, 0xf1); |
1084 | return 0; | 1067 | break; |
1085 | } | ||
1086 | 1068 | ||
1087 | if (keycode == KEY_SYSRQ && sysrq_alt) { | 1069 | case KEY_SYSRQ: |
1088 | put_queue(vc, 0x54 | up_flag); | 1070 | /* |
1089 | return 0; | 1071 | * Real AT keyboards (that's what we're trying |
1090 | } | 1072 | * to emulate here emit 0xe0 0x2a 0xe0 0x37 when |
1073 | * pressing PrtSc/SysRq alone, but simply 0x54 | ||
1074 | * when pressing Alt+PrtSc/SysRq. | ||
1075 | */ | ||
1076 | if (sysrq_alt) { | ||
1077 | put_queue(vc, 0x54 | up_flag); | ||
1078 | } else { | ||
1079 | put_queue(vc, 0xe0); | ||
1080 | put_queue(vc, 0x2a | up_flag); | ||
1081 | put_queue(vc, 0xe0); | ||
1082 | put_queue(vc, 0x37 | up_flag); | ||
1083 | } | ||
1084 | break; | ||
1085 | |||
1086 | default: | ||
1087 | if (keycode > 255) | ||
1088 | return -1; | ||
1091 | 1089 | ||
1092 | if (x86_keycodes[keycode] & 0x100) | 1090 | code = x86_keycodes[keycode]; |
1093 | put_queue(vc, 0xe0); | 1091 | if (!code) |
1092 | return -1; | ||
1094 | 1093 | ||
1095 | put_queue(vc, (x86_keycodes[keycode] & 0x7f) | up_flag); | 1094 | if (code & 0x100) |
1095 | put_queue(vc, 0xe0); | ||
1096 | put_queue(vc, (code & 0x7f) | up_flag); | ||
1096 | 1097 | ||
1097 | if (keycode == KEY_SYSRQ) { | 1098 | break; |
1098 | put_queue(vc, 0xe0); | ||
1099 | put_queue(vc, 0x37 | up_flag); | ||
1100 | } | 1099 | } |
1101 | 1100 | ||
1102 | return 0; | 1101 | return 0; |
@@ -1298,16 +1297,15 @@ static struct input_handle *kbd_connect(struct input_handler *handler, | |||
1298 | if (i == BTN_MISC && !test_bit(EV_SND, dev->evbit)) | 1297 | if (i == BTN_MISC && !test_bit(EV_SND, dev->evbit)) |
1299 | return NULL; | 1298 | return NULL; |
1300 | 1299 | ||
1301 | if (!(handle = kmalloc(sizeof(struct input_handle), GFP_KERNEL))) | 1300 | handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL); |
1301 | if (!handle) | ||
1302 | return NULL; | 1302 | return NULL; |
1303 | memset(handle, 0, sizeof(struct input_handle)); | ||
1304 | 1303 | ||
1305 | handle->dev = dev; | 1304 | handle->dev = dev; |
1306 | handle->handler = handler; | 1305 | handle->handler = handler; |
1307 | handle->name = "kbd"; | 1306 | handle->name = "kbd"; |
1308 | 1307 | ||
1309 | input_open_device(handle); | 1308 | input_open_device(handle); |
1310 | kbd_refresh_leds(handle); | ||
1311 | 1309 | ||
1312 | return handle; | 1310 | return handle; |
1313 | } | 1311 | } |
@@ -1318,6 +1316,24 @@ static void kbd_disconnect(struct input_handle *handle) | |||
1318 | kfree(handle); | 1316 | kfree(handle); |
1319 | } | 1317 | } |
1320 | 1318 | ||
1319 | /* | ||
1320 | * Start keyboard handler on the new keyboard by refreshing LED state to | ||
1321 | * match the rest of the system. | ||
1322 | */ | ||
1323 | static void kbd_start(struct input_handle *handle) | ||
1324 | { | ||
1325 | unsigned char leds = ledstate; | ||
1326 | |||
1327 | tasklet_disable(&keyboard_tasklet); | ||
1328 | if (leds != 0xff) { | ||
1329 | input_inject_event(handle, EV_LED, LED_SCROLLL, !!(leds & 0x01)); | ||
1330 | input_inject_event(handle, EV_LED, LED_NUML, !!(leds & 0x02)); | ||
1331 | input_inject_event(handle, EV_LED, LED_CAPSL, !!(leds & 0x04)); | ||
1332 | input_inject_event(handle, EV_SYN, SYN_REPORT, 0); | ||
1333 | } | ||
1334 | tasklet_enable(&keyboard_tasklet); | ||
1335 | } | ||
1336 | |||
1321 | static struct input_device_id kbd_ids[] = { | 1337 | static struct input_device_id kbd_ids[] = { |
1322 | { | 1338 | { |
1323 | .flags = INPUT_DEVICE_ID_MATCH_EVBIT, | 1339 | .flags = INPUT_DEVICE_ID_MATCH_EVBIT, |
@@ -1338,6 +1354,7 @@ static struct input_handler kbd_handler = { | |||
1338 | .event = kbd_event, | 1354 | .event = kbd_event, |
1339 | .connect = kbd_connect, | 1355 | .connect = kbd_connect, |
1340 | .disconnect = kbd_disconnect, | 1356 | .disconnect = kbd_disconnect, |
1357 | .start = kbd_start, | ||
1341 | .name = "kbd", | 1358 | .name = "kbd", |
1342 | .id_table = kbd_ids, | 1359 | .id_table = kbd_ids, |
1343 | }; | 1360 | }; |
@@ -1346,15 +1363,15 @@ int __init kbd_init(void) | |||
1346 | { | 1363 | { |
1347 | int i; | 1364 | int i; |
1348 | 1365 | ||
1349 | kbd0.ledflagstate = kbd0.default_ledflagstate = KBD_DEFLEDS; | 1366 | for (i = 0; i < MAX_NR_CONSOLES; i++) { |
1350 | kbd0.ledmode = LED_SHOW_FLAGS; | 1367 | kbd_table[i].ledflagstate = KBD_DEFLEDS; |
1351 | kbd0.lockstate = KBD_DEFLOCK; | 1368 | kbd_table[i].default_ledflagstate = KBD_DEFLEDS; |
1352 | kbd0.slockstate = 0; | 1369 | kbd_table[i].ledmode = LED_SHOW_FLAGS; |
1353 | kbd0.modeflags = KBD_DEFMODE; | 1370 | kbd_table[i].lockstate = KBD_DEFLOCK; |
1354 | kbd0.kbdmode = VC_XLATE; | 1371 | kbd_table[i].slockstate = 0; |
1355 | 1372 | kbd_table[i].modeflags = KBD_DEFMODE; | |
1356 | for (i = 0 ; i < MAX_NR_CONSOLES ; i++) | 1373 | kbd_table[i].kbdmode = VC_XLATE; |
1357 | kbd_table[i] = kbd0; | 1374 | } |
1358 | 1375 | ||
1359 | input_register_handler(&kbd_handler); | 1376 | input_register_handler(&kbd_handler); |
1360 | 1377 | ||
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index bc1088d9b379..b3df613ae4ec 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -284,39 +284,69 @@ EXPORT_SYMBOL_GPL(cpufreq_notify_transition); | |||
284 | * SYSFS INTERFACE * | 284 | * SYSFS INTERFACE * |
285 | *********************************************************************/ | 285 | *********************************************************************/ |
286 | 286 | ||
287 | static struct cpufreq_governor *__find_governor(const char *str_governor) | ||
288 | { | ||
289 | struct cpufreq_governor *t; | ||
290 | |||
291 | list_for_each_entry(t, &cpufreq_governor_list, governor_list) | ||
292 | if (!strnicmp(str_governor,t->name,CPUFREQ_NAME_LEN)) | ||
293 | return t; | ||
294 | |||
295 | return NULL; | ||
296 | } | ||
297 | |||
287 | /** | 298 | /** |
288 | * cpufreq_parse_governor - parse a governor string | 299 | * cpufreq_parse_governor - parse a governor string |
289 | */ | 300 | */ |
290 | static int cpufreq_parse_governor (char *str_governor, unsigned int *policy, | 301 | static int cpufreq_parse_governor (char *str_governor, unsigned int *policy, |
291 | struct cpufreq_governor **governor) | 302 | struct cpufreq_governor **governor) |
292 | { | 303 | { |
304 | int err = -EINVAL; | ||
305 | |||
293 | if (!cpufreq_driver) | 306 | if (!cpufreq_driver) |
294 | return -EINVAL; | 307 | goto out; |
308 | |||
295 | if (cpufreq_driver->setpolicy) { | 309 | if (cpufreq_driver->setpolicy) { |
296 | if (!strnicmp(str_governor, "performance", CPUFREQ_NAME_LEN)) { | 310 | if (!strnicmp(str_governor, "performance", CPUFREQ_NAME_LEN)) { |
297 | *policy = CPUFREQ_POLICY_PERFORMANCE; | 311 | *policy = CPUFREQ_POLICY_PERFORMANCE; |
298 | return 0; | 312 | err = 0; |
299 | } else if (!strnicmp(str_governor, "powersave", CPUFREQ_NAME_LEN)) { | 313 | } else if (!strnicmp(str_governor, "powersave", CPUFREQ_NAME_LEN)) { |
300 | *policy = CPUFREQ_POLICY_POWERSAVE; | 314 | *policy = CPUFREQ_POLICY_POWERSAVE; |
301 | return 0; | 315 | err = 0; |
302 | } | 316 | } |
303 | return -EINVAL; | 317 | } else if (cpufreq_driver->target) { |
304 | } else { | ||
305 | struct cpufreq_governor *t; | 318 | struct cpufreq_governor *t; |
319 | |||
306 | mutex_lock(&cpufreq_governor_mutex); | 320 | mutex_lock(&cpufreq_governor_mutex); |
307 | if (!cpufreq_driver || !cpufreq_driver->target) | 321 | |
308 | goto out; | 322 | t = __find_governor(str_governor); |
309 | list_for_each_entry(t, &cpufreq_governor_list, governor_list) { | 323 | |
310 | if (!strnicmp(str_governor,t->name,CPUFREQ_NAME_LEN)) { | 324 | if (t == NULL) { |
311 | *governor = t; | 325 | char *name = kasprintf(GFP_KERNEL, "cpufreq_%s", str_governor); |
326 | |||
327 | if (name) { | ||
328 | int ret; | ||
329 | |||
312 | mutex_unlock(&cpufreq_governor_mutex); | 330 | mutex_unlock(&cpufreq_governor_mutex); |
313 | return 0; | 331 | ret = request_module(name); |
332 | mutex_lock(&cpufreq_governor_mutex); | ||
333 | |||
334 | if (ret == 0) | ||
335 | t = __find_governor(str_governor); | ||
314 | } | 336 | } |
337 | |||
338 | kfree(name); | ||
315 | } | 339 | } |
316 | out: | 340 | |
341 | if (t != NULL) { | ||
342 | *governor = t; | ||
343 | err = 0; | ||
344 | } | ||
345 | |||
317 | mutex_unlock(&cpufreq_governor_mutex); | 346 | mutex_unlock(&cpufreq_governor_mutex); |
318 | } | 347 | } |
319 | return -EINVAL; | 348 | out: |
349 | return err; | ||
320 | } | 350 | } |
321 | 351 | ||
322 | 352 | ||
@@ -1265,23 +1295,21 @@ static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event) | |||
1265 | 1295 | ||
1266 | int cpufreq_register_governor(struct cpufreq_governor *governor) | 1296 | int cpufreq_register_governor(struct cpufreq_governor *governor) |
1267 | { | 1297 | { |
1268 | struct cpufreq_governor *t; | 1298 | int err; |
1269 | 1299 | ||
1270 | if (!governor) | 1300 | if (!governor) |
1271 | return -EINVAL; | 1301 | return -EINVAL; |
1272 | 1302 | ||
1273 | mutex_lock(&cpufreq_governor_mutex); | 1303 | mutex_lock(&cpufreq_governor_mutex); |
1274 | 1304 | ||
1275 | list_for_each_entry(t, &cpufreq_governor_list, governor_list) { | 1305 | err = -EBUSY; |
1276 | if (!strnicmp(governor->name,t->name,CPUFREQ_NAME_LEN)) { | 1306 | if (__find_governor(governor->name) == NULL) { |
1277 | mutex_unlock(&cpufreq_governor_mutex); | 1307 | err = 0; |
1278 | return -EBUSY; | 1308 | list_add(&governor->governor_list, &cpufreq_governor_list); |
1279 | } | ||
1280 | } | 1309 | } |
1281 | list_add(&governor->governor_list, &cpufreq_governor_list); | ||
1282 | 1310 | ||
1283 | mutex_unlock(&cpufreq_governor_mutex); | 1311 | mutex_unlock(&cpufreq_governor_mutex); |
1284 | return 0; | 1312 | return err; |
1285 | } | 1313 | } |
1286 | EXPORT_SYMBOL_GPL(cpufreq_register_governor); | 1314 | EXPORT_SYMBOL_GPL(cpufreq_register_governor); |
1287 | 1315 | ||
@@ -1343,6 +1371,11 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_poli | |||
1343 | 1371 | ||
1344 | memcpy(&policy->cpuinfo, &data->cpuinfo, sizeof(struct cpufreq_cpuinfo)); | 1372 | memcpy(&policy->cpuinfo, &data->cpuinfo, sizeof(struct cpufreq_cpuinfo)); |
1345 | 1373 | ||
1374 | if (policy->min > data->min && policy->min > policy->max) { | ||
1375 | ret = -EINVAL; | ||
1376 | goto error_out; | ||
1377 | } | ||
1378 | |||
1346 | /* verify the cpu speed can be set within this limit */ | 1379 | /* verify the cpu speed can be set within this limit */ |
1347 | ret = cpufreq_driver->verify(policy); | 1380 | ret = cpufreq_driver->verify(policy); |
1348 | if (ret) | 1381 | if (ret) |
diff --git a/drivers/edac/edac_mc.h b/drivers/edac/edac_mc.h index bf6ab8a8d5ed..a1cfd4e3c97d 100644 --- a/drivers/edac/edac_mc.h +++ b/drivers/edac/edac_mc.h | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/rcupdate.h> | 29 | #include <linux/rcupdate.h> |
30 | #include <linux/completion.h> | 30 | #include <linux/completion.h> |
31 | #include <linux/kobject.h> | 31 | #include <linux/kobject.h> |
32 | #include <linux/platform_device.h> | ||
32 | 33 | ||
33 | #define EDAC_MC_LABEL_LEN 31 | 34 | #define EDAC_MC_LABEL_LEN 31 |
34 | #define MC_PROC_NAME_MAX_LEN 7 | 35 | #define MC_PROC_NAME_MAX_LEN 7 |
diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c index ced309ff056f..eae9e81be375 100644 --- a/drivers/i2c/busses/scx200_acb.c +++ b/drivers/i2c/busses/scx200_acb.c | |||
@@ -232,7 +232,7 @@ static void scx200_acb_poll(struct scx200_acb_iface *iface) | |||
232 | unsigned long timeout; | 232 | unsigned long timeout; |
233 | 233 | ||
234 | timeout = jiffies + POLL_TIMEOUT; | 234 | timeout = jiffies + POLL_TIMEOUT; |
235 | while (time_before(jiffies, timeout)) { | 235 | while (1) { |
236 | status = inb(ACBST); | 236 | status = inb(ACBST); |
237 | 237 | ||
238 | /* Reset the status register to avoid the hang */ | 238 | /* Reset the status register to avoid the hang */ |
@@ -242,7 +242,10 @@ static void scx200_acb_poll(struct scx200_acb_iface *iface) | |||
242 | scx200_acb_machine(iface, status); | 242 | scx200_acb_machine(iface, status); |
243 | return; | 243 | return; |
244 | } | 244 | } |
245 | yield(); | 245 | if (time_after(jiffies, timeout)) |
246 | break; | ||
247 | cpu_relax(); | ||
248 | cond_resched(); | ||
246 | } | 249 | } |
247 | 250 | ||
248 | dev_err(&iface->adapter.dev, "timeout in state %s\n", | 251 | dev_err(&iface->adapter.dev, "timeout in state %s\n", |
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index aaa74f293aaf..b08755e2e68f 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -2515,6 +2515,9 @@ static int sbp2scsi_slave_configure(struct scsi_device *sdev) | |||
2515 | sdev->skip_ms_page_8 = 1; | 2515 | sdev->skip_ms_page_8 = 1; |
2516 | if (scsi_id->workarounds & SBP2_WORKAROUND_FIX_CAPACITY) | 2516 | if (scsi_id->workarounds & SBP2_WORKAROUND_FIX_CAPACITY) |
2517 | sdev->fix_capacity = 1; | 2517 | sdev->fix_capacity = 1; |
2518 | if (scsi_id->ne->guid_vendor_id == 0x0010b9 && /* Maxtor's OUI */ | ||
2519 | (sdev->type == TYPE_DISK || sdev->type == TYPE_RBC)) | ||
2520 | sdev->allow_restart = 1; | ||
2518 | return 0; | 2521 | return 0; |
2519 | } | 2522 | } |
2520 | 2523 | ||
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index a29d5ceb00cf..4bf48188cc91 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
@@ -127,14 +127,10 @@ static int evdev_open(struct inode * inode, struct file * file) | |||
127 | { | 127 | { |
128 | struct evdev_list *list; | 128 | struct evdev_list *list; |
129 | int i = iminor(inode) - EVDEV_MINOR_BASE; | 129 | int i = iminor(inode) - EVDEV_MINOR_BASE; |
130 | int accept_err; | ||
131 | 130 | ||
132 | if (i >= EVDEV_MINORS || !evdev_table[i] || !evdev_table[i]->exist) | 131 | if (i >= EVDEV_MINORS || !evdev_table[i] || !evdev_table[i]->exist) |
133 | return -ENODEV; | 132 | return -ENODEV; |
134 | 133 | ||
135 | if ((accept_err = input_accept_process(&(evdev_table[i]->handle), file))) | ||
136 | return accept_err; | ||
137 | |||
138 | if (!(list = kzalloc(sizeof(struct evdev_list), GFP_KERNEL))) | 134 | if (!(list = kzalloc(sizeof(struct evdev_list), GFP_KERNEL))) |
139 | return -ENOMEM; | 135 | return -ENOMEM; |
140 | 136 | ||
@@ -260,7 +256,7 @@ static ssize_t evdev_write(struct file * file, const char __user * buffer, size_ | |||
260 | 256 | ||
261 | if (evdev_event_from_user(buffer + retval, &event)) | 257 | if (evdev_event_from_user(buffer + retval, &event)) |
262 | return -EFAULT; | 258 | return -EFAULT; |
263 | input_event(list->evdev->handle.dev, event.type, event.code, event.value); | 259 | input_inject_event(&list->evdev->handle, event.type, event.code, event.value); |
264 | retval += evdev_event_size(); | 260 | retval += evdev_event_size(); |
265 | } | 261 | } |
266 | 262 | ||
@@ -428,8 +424,8 @@ static long evdev_ioctl_handler(struct file *file, unsigned int cmd, | |||
428 | if (get_user(v, ip + 1)) | 424 | if (get_user(v, ip + 1)) |
429 | return -EFAULT; | 425 | return -EFAULT; |
430 | 426 | ||
431 | input_event(dev, EV_REP, REP_DELAY, u); | 427 | input_inject_event(&evdev->handle, EV_REP, REP_DELAY, u); |
432 | input_event(dev, EV_REP, REP_PERIOD, v); | 428 | input_inject_event(&evdev->handle, EV_REP, REP_PERIOD, v); |
433 | 429 | ||
434 | return 0; | 430 | return 0; |
435 | 431 | ||
diff --git a/drivers/input/gameport/fm801-gp.c b/drivers/input/gameport/fm801-gp.c index 47e93daa0fa7..90de5afe03c2 100644 --- a/drivers/input/gameport/fm801-gp.c +++ b/drivers/input/gameport/fm801-gp.c | |||
@@ -106,10 +106,10 @@ static int __devinit fm801_gp_probe(struct pci_dev *pci, const struct pci_device | |||
106 | gp->gameport = port; | 106 | gp->gameport = port; |
107 | gp->res_port = request_region(port->io, 0x10, "FM801 GP"); | 107 | gp->res_port = request_region(port->io, 0x10, "FM801 GP"); |
108 | if (!gp->res_port) { | 108 | if (!gp->res_port) { |
109 | kfree(gp); | ||
110 | gameport_free_port(port); | ||
111 | printk(KERN_DEBUG "fm801-gp: unable to grab region 0x%x-0x%x\n", | 109 | printk(KERN_DEBUG "fm801-gp: unable to grab region 0x%x-0x%x\n", |
112 | port->io, port->io + 0x0f); | 110 | port->io, port->io + 0x0f); |
111 | gameport_free_port(port); | ||
112 | kfree(gp); | ||
113 | return -EBUSY; | 113 | return -EBUSY; |
114 | } | 114 | } |
115 | 115 | ||
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c index 36644bff379d..3f47ae55c6f3 100644 --- a/drivers/input/gameport/gameport.c +++ b/drivers/input/gameport/gameport.c | |||
@@ -53,6 +53,7 @@ static LIST_HEAD(gameport_list); | |||
53 | 53 | ||
54 | static struct bus_type gameport_bus; | 54 | static struct bus_type gameport_bus; |
55 | 55 | ||
56 | static void gameport_add_driver(struct gameport_driver *drv); | ||
56 | static void gameport_add_port(struct gameport *gameport); | 57 | static void gameport_add_port(struct gameport *gameport); |
57 | static void gameport_destroy_port(struct gameport *gameport); | 58 | static void gameport_destroy_port(struct gameport *gameport); |
58 | static void gameport_reconnect_port(struct gameport *gameport); | 59 | static void gameport_reconnect_port(struct gameport *gameport); |
@@ -211,8 +212,14 @@ static void gameport_release_driver(struct gameport *gameport) | |||
211 | 212 | ||
212 | static void gameport_find_driver(struct gameport *gameport) | 213 | static void gameport_find_driver(struct gameport *gameport) |
213 | { | 214 | { |
215 | int error; | ||
216 | |||
214 | down_write(&gameport_bus.subsys.rwsem); | 217 | down_write(&gameport_bus.subsys.rwsem); |
215 | device_attach(&gameport->dev); | 218 | error = device_attach(&gameport->dev); |
219 | if (error < 0) | ||
220 | printk(KERN_WARNING | ||
221 | "gameport: device_attach() failed for %s (%s), error: %d\n", | ||
222 | gameport->phys, gameport->name, error); | ||
216 | up_write(&gameport_bus.subsys.rwsem); | 223 | up_write(&gameport_bus.subsys.rwsem); |
217 | } | 224 | } |
218 | 225 | ||
@@ -316,7 +323,6 @@ static void gameport_remove_duplicate_events(struct gameport_event *event) | |||
316 | spin_unlock_irqrestore(&gameport_event_lock, flags); | 323 | spin_unlock_irqrestore(&gameport_event_lock, flags); |
317 | } | 324 | } |
318 | 325 | ||
319 | |||
320 | static struct gameport_event *gameport_get_event(void) | 326 | static struct gameport_event *gameport_get_event(void) |
321 | { | 327 | { |
322 | struct gameport_event *event; | 328 | struct gameport_event *event; |
@@ -342,7 +348,6 @@ static struct gameport_event *gameport_get_event(void) | |||
342 | static void gameport_handle_event(void) | 348 | static void gameport_handle_event(void) |
343 | { | 349 | { |
344 | struct gameport_event *event; | 350 | struct gameport_event *event; |
345 | struct gameport_driver *gameport_drv; | ||
346 | 351 | ||
347 | mutex_lock(&gameport_mutex); | 352 | mutex_lock(&gameport_mutex); |
348 | 353 | ||
@@ -369,8 +374,7 @@ static void gameport_handle_event(void) | |||
369 | break; | 374 | break; |
370 | 375 | ||
371 | case GAMEPORT_REGISTER_DRIVER: | 376 | case GAMEPORT_REGISTER_DRIVER: |
372 | gameport_drv = event->object; | 377 | gameport_add_driver(event->object); |
373 | driver_register(&gameport_drv->driver); | ||
374 | break; | 378 | break; |
375 | 379 | ||
376 | default: | 380 | default: |
@@ -532,6 +536,7 @@ static void gameport_init_port(struct gameport *gameport) | |||
532 | if (gameport->parent) | 536 | if (gameport->parent) |
533 | gameport->dev.parent = &gameport->parent->dev; | 537 | gameport->dev.parent = &gameport->parent->dev; |
534 | 538 | ||
539 | INIT_LIST_HEAD(&gameport->node); | ||
535 | spin_lock_init(&gameport->timer_lock); | 540 | spin_lock_init(&gameport->timer_lock); |
536 | init_timer(&gameport->poll_timer); | 541 | init_timer(&gameport->poll_timer); |
537 | gameport->poll_timer.function = gameport_run_poll_handler; | 542 | gameport->poll_timer.function = gameport_run_poll_handler; |
@@ -544,6 +549,8 @@ static void gameport_init_port(struct gameport *gameport) | |||
544 | */ | 549 | */ |
545 | static void gameport_add_port(struct gameport *gameport) | 550 | static void gameport_add_port(struct gameport *gameport) |
546 | { | 551 | { |
552 | int error; | ||
553 | |||
547 | if (gameport->parent) | 554 | if (gameport->parent) |
548 | gameport->parent->child = gameport; | 555 | gameport->parent->child = gameport; |
549 | 556 | ||
@@ -558,8 +565,13 @@ static void gameport_add_port(struct gameport *gameport) | |||
558 | printk(KERN_INFO "gameport: %s is %s, speed %dkHz\n", | 565 | printk(KERN_INFO "gameport: %s is %s, speed %dkHz\n", |
559 | gameport->name, gameport->phys, gameport->speed); | 566 | gameport->name, gameport->phys, gameport->speed); |
560 | 567 | ||
561 | device_add(&gameport->dev); | 568 | error = device_add(&gameport->dev); |
562 | gameport->registered = 1; | 569 | if (error) |
570 | printk(KERN_ERR | ||
571 | "gameport: device_add() failed for %s (%s), error: %d\n", | ||
572 | gameport->phys, gameport->name, error); | ||
573 | else | ||
574 | gameport->registered = 1; | ||
563 | } | 575 | } |
564 | 576 | ||
565 | /* | 577 | /* |
@@ -583,10 +595,11 @@ static void gameport_destroy_port(struct gameport *gameport) | |||
583 | 595 | ||
584 | if (gameport->registered) { | 596 | if (gameport->registered) { |
585 | device_del(&gameport->dev); | 597 | device_del(&gameport->dev); |
586 | list_del_init(&gameport->node); | ||
587 | gameport->registered = 0; | 598 | gameport->registered = 0; |
588 | } | 599 | } |
589 | 600 | ||
601 | list_del_init(&gameport->node); | ||
602 | |||
590 | gameport_remove_pending_events(gameport); | 603 | gameport_remove_pending_events(gameport); |
591 | put_device(&gameport->dev); | 604 | put_device(&gameport->dev); |
592 | } | 605 | } |
@@ -704,11 +717,22 @@ static int gameport_driver_remove(struct device *dev) | |||
704 | } | 717 | } |
705 | 718 | ||
706 | static struct bus_type gameport_bus = { | 719 | static struct bus_type gameport_bus = { |
707 | .name = "gameport", | 720 | .name = "gameport", |
708 | .probe = gameport_driver_probe, | 721 | .probe = gameport_driver_probe, |
709 | .remove = gameport_driver_remove, | 722 | .remove = gameport_driver_remove, |
710 | }; | 723 | }; |
711 | 724 | ||
725 | static void gameport_add_driver(struct gameport_driver *drv) | ||
726 | { | ||
727 | int error; | ||
728 | |||
729 | error = driver_register(&drv->driver); | ||
730 | if (error) | ||
731 | printk(KERN_ERR | ||
732 | "gameport: driver_register() failed for %s, error: %d\n", | ||
733 | drv->driver.name, error); | ||
734 | } | ||
735 | |||
712 | void __gameport_register_driver(struct gameport_driver *drv, struct module *owner) | 736 | void __gameport_register_driver(struct gameport_driver *drv, struct module *owner) |
713 | { | 737 | { |
714 | drv->driver.bus = &gameport_bus; | 738 | drv->driver.bus = &gameport_bus; |
@@ -778,16 +802,24 @@ void gameport_close(struct gameport *gameport) | |||
778 | 802 | ||
779 | static int __init gameport_init(void) | 803 | static int __init gameport_init(void) |
780 | { | 804 | { |
781 | gameport_task = kthread_run(gameport_thread, NULL, "kgameportd"); | 805 | int error; |
782 | if (IS_ERR(gameport_task)) { | ||
783 | printk(KERN_ERR "gameport: Failed to start kgameportd\n"); | ||
784 | return PTR_ERR(gameport_task); | ||
785 | } | ||
786 | 806 | ||
787 | gameport_bus.dev_attrs = gameport_device_attrs; | 807 | gameport_bus.dev_attrs = gameport_device_attrs; |
788 | gameport_bus.drv_attrs = gameport_driver_attrs; | 808 | gameport_bus.drv_attrs = gameport_driver_attrs; |
789 | gameport_bus.match = gameport_bus_match; | 809 | gameport_bus.match = gameport_bus_match; |
790 | bus_register(&gameport_bus); | 810 | error = bus_register(&gameport_bus); |
811 | if (error) { | ||
812 | printk(KERN_ERR "gameport: failed to register gameport bus, error: %d\n", error); | ||
813 | return error; | ||
814 | } | ||
815 | |||
816 | gameport_task = kthread_run(gameport_thread, NULL, "kgameportd"); | ||
817 | if (IS_ERR(gameport_task)) { | ||
818 | bus_unregister(&gameport_bus); | ||
819 | error = PTR_ERR(gameport_task); | ||
820 | printk(KERN_ERR "gameport: Failed to start kgameportd, error: %d\n", error); | ||
821 | return error; | ||
822 | } | ||
791 | 823 | ||
792 | return 0; | 824 | return 0; |
793 | } | 825 | } |
diff --git a/drivers/input/input.c b/drivers/input/input.c index a90486f5e491..9cb4b9a54f01 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -35,6 +35,16 @@ static LIST_HEAD(input_handler_list); | |||
35 | 35 | ||
36 | static struct input_handler *input_table[8]; | 36 | static struct input_handler *input_table[8]; |
37 | 37 | ||
38 | /** | ||
39 | * input_event() - report new input event | ||
40 | * @handle: device that generated the event | ||
41 | * @type: type of the event | ||
42 | * @code: event code | ||
43 | * @value: value of the event | ||
44 | * | ||
45 | * This function should be used by drivers implementing various input devices | ||
46 | * See also input_inject_event() | ||
47 | */ | ||
38 | void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) | 48 | void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) |
39 | { | 49 | { |
40 | struct input_handle *handle; | 50 | struct input_handle *handle; |
@@ -183,6 +193,23 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in | |||
183 | } | 193 | } |
184 | EXPORT_SYMBOL(input_event); | 194 | EXPORT_SYMBOL(input_event); |
185 | 195 | ||
196 | /** | ||
197 | * input_inject_event() - send input event from input handler | ||
198 | * @handle: input handle to send event through | ||
199 | * @type: type of the event | ||
200 | * @code: event code | ||
201 | * @value: value of the event | ||
202 | * | ||
203 | * Similar to input_event() but will ignore event if device is "grabbed" and handle | ||
204 | * injecting event is not the one that owns the device. | ||
205 | */ | ||
206 | void input_inject_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) | ||
207 | { | ||
208 | if (!handle->dev->grab || handle->dev->grab == handle) | ||
209 | input_event(handle->dev, type, code, value); | ||
210 | } | ||
211 | EXPORT_SYMBOL(input_inject_event); | ||
212 | |||
186 | static void input_repeat_key(unsigned long data) | 213 | static void input_repeat_key(unsigned long data) |
187 | { | 214 | { |
188 | struct input_dev *dev = (void *) data; | 215 | struct input_dev *dev = (void *) data; |
@@ -197,15 +224,6 @@ static void input_repeat_key(unsigned long data) | |||
197 | mod_timer(&dev->timer, jiffies + msecs_to_jiffies(dev->rep[REP_PERIOD])); | 224 | mod_timer(&dev->timer, jiffies + msecs_to_jiffies(dev->rep[REP_PERIOD])); |
198 | } | 225 | } |
199 | 226 | ||
200 | int input_accept_process(struct input_handle *handle, struct file *file) | ||
201 | { | ||
202 | if (handle->dev->accept) | ||
203 | return handle->dev->accept(handle->dev, file); | ||
204 | |||
205 | return 0; | ||
206 | } | ||
207 | EXPORT_SYMBOL(input_accept_process); | ||
208 | |||
209 | int input_grab_device(struct input_handle *handle) | 227 | int input_grab_device(struct input_handle *handle) |
210 | { | 228 | { |
211 | if (handle->dev->grab) | 229 | if (handle->dev->grab) |
@@ -218,8 +236,15 @@ EXPORT_SYMBOL(input_grab_device); | |||
218 | 236 | ||
219 | void input_release_device(struct input_handle *handle) | 237 | void input_release_device(struct input_handle *handle) |
220 | { | 238 | { |
221 | if (handle->dev->grab == handle) | 239 | struct input_dev *dev = handle->dev; |
222 | handle->dev->grab = NULL; | 240 | |
241 | if (dev->grab == handle) { | ||
242 | dev->grab = NULL; | ||
243 | |||
244 | list_for_each_entry(handle, &dev->h_list, d_node) | ||
245 | if (handle->handler->start) | ||
246 | handle->handler->start(handle); | ||
247 | } | ||
223 | } | 248 | } |
224 | EXPORT_SYMBOL(input_release_device); | 249 | EXPORT_SYMBOL(input_release_device); |
225 | 250 | ||
@@ -963,8 +988,11 @@ int input_register_device(struct input_dev *dev) | |||
963 | list_for_each_entry(handler, &input_handler_list, node) | 988 | list_for_each_entry(handler, &input_handler_list, node) |
964 | if (!handler->blacklist || !input_match_device(handler->blacklist, dev)) | 989 | if (!handler->blacklist || !input_match_device(handler->blacklist, dev)) |
965 | if ((id = input_match_device(handler->id_table, dev))) | 990 | if ((id = input_match_device(handler->id_table, dev))) |
966 | if ((handle = handler->connect(handler, dev, id))) | 991 | if ((handle = handler->connect(handler, dev, id))) { |
967 | input_link_handle(handle); | 992 | input_link_handle(handle); |
993 | if (handler->start) | ||
994 | handler->start(handle); | ||
995 | } | ||
968 | 996 | ||
969 | input_wakeup_procfs_readers(); | 997 | input_wakeup_procfs_readers(); |
970 | 998 | ||
@@ -1028,8 +1056,11 @@ void input_register_handler(struct input_handler *handler) | |||
1028 | list_for_each_entry(dev, &input_dev_list, node) | 1056 | list_for_each_entry(dev, &input_dev_list, node) |
1029 | if (!handler->blacklist || !input_match_device(handler->blacklist, dev)) | 1057 | if (!handler->blacklist || !input_match_device(handler->blacklist, dev)) |
1030 | if ((id = input_match_device(handler->id_table, dev))) | 1058 | if ((id = input_match_device(handler->id_table, dev))) |
1031 | if ((handle = handler->connect(handler, dev, id))) | 1059 | if ((handle = handler->connect(handler, dev, id))) { |
1032 | input_link_handle(handle); | 1060 | input_link_handle(handle); |
1061 | if (handler->start) | ||
1062 | handler->start(handle); | ||
1063 | } | ||
1033 | 1064 | ||
1034 | input_wakeup_procfs_readers(); | 1065 | input_wakeup_procfs_readers(); |
1035 | } | 1066 | } |
diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c index 6d99e3c37884..b4914e7231f8 100644 --- a/drivers/input/joystick/iforce/iforce-main.c +++ b/drivers/input/joystick/iforce/iforce-main.c | |||
@@ -79,6 +79,7 @@ static struct iforce_device iforce_device[] = { | |||
79 | { 0x06f8, 0x0001, "Guillemot Race Leader Force Feedback", btn_wheel, abs_wheel, ff_iforce }, //? | 79 | { 0x06f8, 0x0001, "Guillemot Race Leader Force Feedback", btn_wheel, abs_wheel, ff_iforce }, //? |
80 | { 0x06f8, 0x0004, "Guillemot Force Feedback Racing Wheel", btn_wheel, abs_wheel, ff_iforce }, //? | 80 | { 0x06f8, 0x0004, "Guillemot Force Feedback Racing Wheel", btn_wheel, abs_wheel, ff_iforce }, //? |
81 | { 0x06f8, 0x0004, "Gullemot Jet Leader 3D", btn_joystick, abs_joystick, ff_iforce }, //? | 81 | { 0x06f8, 0x0004, "Gullemot Jet Leader 3D", btn_joystick, abs_joystick, ff_iforce }, //? |
82 | { 0x06d6, 0x29bc, "Trust Force Feedback Race Master", btn_wheel, abs_wheel, ff_iforce }, | ||
82 | { 0x0000, 0x0000, "Unknown I-Force Device [%04x:%04x]", btn_joystick, abs_joystick, ff_iforce } | 83 | { 0x0000, 0x0000, "Unknown I-Force Device [%04x:%04x]", btn_joystick, abs_joystick, ff_iforce } |
83 | }; | 84 | }; |
84 | 85 | ||
@@ -222,22 +223,22 @@ static int iforce_erase_effect(struct input_dev *dev, int effect_id) | |||
222 | int err = 0; | 223 | int err = 0; |
223 | struct iforce_core_effect* core_effect; | 224 | struct iforce_core_effect* core_effect; |
224 | 225 | ||
225 | /* Check who is trying to erase this effect */ | ||
226 | if (iforce->core_effects[effect_id].owner != current->pid) { | ||
227 | printk(KERN_WARNING "iforce-main.c: %d tried to erase an effect belonging to %d\n", current->pid, iforce->core_effects[effect_id].owner); | ||
228 | return -EACCES; | ||
229 | } | ||
230 | |||
231 | if (effect_id < 0 || effect_id >= FF_EFFECTS_MAX) | 226 | if (effect_id < 0 || effect_id >= FF_EFFECTS_MAX) |
232 | return -EINVAL; | 227 | return -EINVAL; |
233 | 228 | ||
234 | core_effect = iforce->core_effects + effect_id; | 229 | core_effect = &iforce->core_effects[effect_id]; |
230 | |||
231 | /* Check who is trying to erase this effect */ | ||
232 | if (core_effect->owner != current->pid) { | ||
233 | printk(KERN_WARNING "iforce-main.c: %d tried to erase an effect belonging to %d\n", current->pid, core_effect->owner); | ||
234 | return -EACCES; | ||
235 | } | ||
235 | 236 | ||
236 | if (test_bit(FF_MOD1_IS_USED, core_effect->flags)) | 237 | if (test_bit(FF_MOD1_IS_USED, core_effect->flags)) |
237 | err = release_resource(&(iforce->core_effects[effect_id].mod1_chunk)); | 238 | err = release_resource(&core_effect->mod1_chunk); |
238 | 239 | ||
239 | if (!err && test_bit(FF_MOD2_IS_USED, core_effect->flags)) | 240 | if (!err && test_bit(FF_MOD2_IS_USED, core_effect->flags)) |
240 | err = release_resource(&(iforce->core_effects[effect_id].mod2_chunk)); | 241 | err = release_resource(&core_effect->mod2_chunk); |
241 | 242 | ||
242 | /*TODO: remember to change that if more FF_MOD* bits are added */ | 243 | /*TODO: remember to change that if more FF_MOD* bits are added */ |
243 | core_effect->flags[0] = 0; | 244 | core_effect->flags[0] = 0; |
diff --git a/drivers/input/joystick/spaceball.c b/drivers/input/joystick/spaceball.c index 75eb5ca59992..7a19ee052972 100644 --- a/drivers/input/joystick/spaceball.c +++ b/drivers/input/joystick/spaceball.c | |||
@@ -50,7 +50,7 @@ MODULE_LICENSE("GPL"); | |||
50 | */ | 50 | */ |
51 | 51 | ||
52 | #define SPACEBALL_MAX_LENGTH 128 | 52 | #define SPACEBALL_MAX_LENGTH 128 |
53 | #define SPACEBALL_MAX_ID 8 | 53 | #define SPACEBALL_MAX_ID 9 |
54 | 54 | ||
55 | #define SPACEBALL_1003 1 | 55 | #define SPACEBALL_1003 1 |
56 | #define SPACEBALL_2003B 3 | 56 | #define SPACEBALL_2003B 3 |
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index ce1f10e8984b..6bfa0cf4b1d2 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c | |||
@@ -482,13 +482,7 @@ out: | |||
482 | return IRQ_HANDLED; | 482 | return IRQ_HANDLED; |
483 | } | 483 | } |
484 | 484 | ||
485 | /* | 485 | static int atkbd_set_repeat_rate(struct atkbd *atkbd) |
486 | * atkbd_event_work() is used to complete processing of events that | ||
487 | * can not be processed by input_event() which is often called from | ||
488 | * interrupt context. | ||
489 | */ | ||
490 | |||
491 | static void atkbd_event_work(void *data) | ||
492 | { | 486 | { |
493 | const short period[32] = | 487 | const short period[32] = |
494 | { 33, 37, 42, 46, 50, 54, 58, 63, 67, 75, 83, 92, 100, 109, 116, 125, | 488 | { 33, 37, 42, 46, 50, 54, 58, 63, 67, 75, 83, 92, 100, 109, 116, 125, |
@@ -496,41 +490,64 @@ static void atkbd_event_work(void *data) | |||
496 | const short delay[4] = | 490 | const short delay[4] = |
497 | { 250, 500, 750, 1000 }; | 491 | { 250, 500, 750, 1000 }; |
498 | 492 | ||
499 | struct atkbd *atkbd = data; | 493 | struct input_dev *dev = atkbd->dev; |
494 | unsigned char param; | ||
495 | int i = 0, j = 0; | ||
496 | |||
497 | while (i < ARRAY_SIZE(period) - 1 && period[i] < dev->rep[REP_PERIOD]) | ||
498 | i++; | ||
499 | dev->rep[REP_PERIOD] = period[i]; | ||
500 | |||
501 | while (j < ARRAY_SIZE(period) - 1 && delay[j] < dev->rep[REP_DELAY]) | ||
502 | j++; | ||
503 | dev->rep[REP_DELAY] = delay[j]; | ||
504 | |||
505 | param = i | (j << 5); | ||
506 | return ps2_command(&atkbd->ps2dev, ¶m, ATKBD_CMD_SETREP); | ||
507 | } | ||
508 | |||
509 | static int atkbd_set_leds(struct atkbd *atkbd) | ||
510 | { | ||
500 | struct input_dev *dev = atkbd->dev; | 511 | struct input_dev *dev = atkbd->dev; |
501 | unsigned char param[2]; | 512 | unsigned char param[2]; |
502 | int i, j; | ||
503 | 513 | ||
504 | mutex_lock(&atkbd->event_mutex); | 514 | param[0] = (test_bit(LED_SCROLLL, dev->led) ? 1 : 0) |
515 | | (test_bit(LED_NUML, dev->led) ? 2 : 0) | ||
516 | | (test_bit(LED_CAPSL, dev->led) ? 4 : 0); | ||
517 | if (ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_SETLEDS)) | ||
518 | return -1; | ||
505 | 519 | ||
506 | if (test_and_clear_bit(ATKBD_LED_EVENT_BIT, &atkbd->event_mask)) { | 520 | if (atkbd->extra) { |
507 | param[0] = (test_bit(LED_SCROLLL, dev->led) ? 1 : 0) | 521 | param[0] = 0; |
508 | | (test_bit(LED_NUML, dev->led) ? 2 : 0) | 522 | param[1] = (test_bit(LED_COMPOSE, dev->led) ? 0x01 : 0) |
509 | | (test_bit(LED_CAPSL, dev->led) ? 4 : 0); | 523 | | (test_bit(LED_SLEEP, dev->led) ? 0x02 : 0) |
510 | ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_SETLEDS); | 524 | | (test_bit(LED_SUSPEND, dev->led) ? 0x04 : 0) |
511 | 525 | | (test_bit(LED_MISC, dev->led) ? 0x10 : 0) | |
512 | if (atkbd->extra) { | 526 | | (test_bit(LED_MUTE, dev->led) ? 0x20 : 0); |
513 | param[0] = 0; | 527 | if (ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_EX_SETLEDS)) |
514 | param[1] = (test_bit(LED_COMPOSE, dev->led) ? 0x01 : 0) | 528 | return -1; |
515 | | (test_bit(LED_SLEEP, dev->led) ? 0x02 : 0) | ||
516 | | (test_bit(LED_SUSPEND, dev->led) ? 0x04 : 0) | ||
517 | | (test_bit(LED_MISC, dev->led) ? 0x10 : 0) | ||
518 | | (test_bit(LED_MUTE, dev->led) ? 0x20 : 0); | ||
519 | ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_EX_SETLEDS); | ||
520 | } | ||
521 | } | 529 | } |
522 | 530 | ||
523 | if (test_and_clear_bit(ATKBD_REP_EVENT_BIT, &atkbd->event_mask)) { | 531 | return 0; |
524 | i = j = 0; | 532 | } |
525 | while (i < 31 && period[i] < dev->rep[REP_PERIOD]) | 533 | |
526 | i++; | 534 | /* |
527 | while (j < 3 && delay[j] < dev->rep[REP_DELAY]) | 535 | * atkbd_event_work() is used to complete processing of events that |
528 | j++; | 536 | * can not be processed by input_event() which is often called from |
529 | dev->rep[REP_PERIOD] = period[i]; | 537 | * interrupt context. |
530 | dev->rep[REP_DELAY] = delay[j]; | 538 | */ |
531 | param[0] = i | (j << 5); | 539 | |
532 | ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_SETREP); | 540 | static void atkbd_event_work(void *data) |
533 | } | 541 | { |
542 | struct atkbd *atkbd = data; | ||
543 | |||
544 | mutex_lock(&atkbd->event_mutex); | ||
545 | |||
546 | if (test_and_clear_bit(ATKBD_LED_EVENT_BIT, &atkbd->event_mask)) | ||
547 | atkbd_set_leds(atkbd); | ||
548 | |||
549 | if (test_and_clear_bit(ATKBD_REP_EVENT_BIT, &atkbd->event_mask)) | ||
550 | atkbd_set_repeat_rate(atkbd); | ||
534 | 551 | ||
535 | mutex_unlock(&atkbd->event_mutex); | 552 | mutex_unlock(&atkbd->event_mutex); |
536 | } | 553 | } |
@@ -975,7 +992,6 @@ static int atkbd_reconnect(struct serio *serio) | |||
975 | { | 992 | { |
976 | struct atkbd *atkbd = serio_get_drvdata(serio); | 993 | struct atkbd *atkbd = serio_get_drvdata(serio); |
977 | struct serio_driver *drv = serio->drv; | 994 | struct serio_driver *drv = serio->drv; |
978 | unsigned char param[1]; | ||
979 | 995 | ||
980 | if (!atkbd || !drv) { | 996 | if (!atkbd || !drv) { |
981 | printk(KERN_DEBUG "atkbd: reconnect request, but serio is disconnected, ignoring...\n"); | 997 | printk(KERN_DEBUG "atkbd: reconnect request, but serio is disconnected, ignoring...\n"); |
@@ -985,10 +1001,6 @@ static int atkbd_reconnect(struct serio *serio) | |||
985 | atkbd_disable(atkbd); | 1001 | atkbd_disable(atkbd); |
986 | 1002 | ||
987 | if (atkbd->write) { | 1003 | if (atkbd->write) { |
988 | param[0] = (test_bit(LED_SCROLLL, atkbd->dev->led) ? 1 : 0) | ||
989 | | (test_bit(LED_NUML, atkbd->dev->led) ? 2 : 0) | ||
990 | | (test_bit(LED_CAPSL, atkbd->dev->led) ? 4 : 0); | ||
991 | |||
992 | if (atkbd_probe(atkbd)) | 1004 | if (atkbd_probe(atkbd)) |
993 | return -1; | 1005 | return -1; |
994 | if (atkbd->set != atkbd_select_set(atkbd, atkbd->set, atkbd->extra)) | 1006 | if (atkbd->set != atkbd_select_set(atkbd, atkbd->set, atkbd->extra)) |
@@ -996,8 +1008,13 @@ static int atkbd_reconnect(struct serio *serio) | |||
996 | 1008 | ||
997 | atkbd_activate(atkbd); | 1009 | atkbd_activate(atkbd); |
998 | 1010 | ||
999 | if (ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_SETLEDS)) | 1011 | /* |
1000 | return -1; | 1012 | * Restore repeat rate and LEDs (that were reset by atkbd_activate) |
1013 | * to pre-resume state | ||
1014 | */ | ||
1015 | if (!atkbd->softrepeat) | ||
1016 | atkbd_set_repeat_rate(atkbd); | ||
1017 | atkbd_set_leds(atkbd); | ||
1001 | } | 1018 | } |
1002 | 1019 | ||
1003 | atkbd_enable(atkbd); | 1020 | atkbd_enable(atkbd); |
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c index ccf0faeee5c1..a8efc1af36cb 100644 --- a/drivers/input/misc/wistron_btns.c +++ b/drivers/input/misc/wistron_btns.c | |||
@@ -94,7 +94,7 @@ static void call_bios(struct regs *regs) | |||
94 | 94 | ||
95 | static ssize_t __init locate_wistron_bios(void __iomem *base) | 95 | static ssize_t __init locate_wistron_bios(void __iomem *base) |
96 | { | 96 | { |
97 | static const unsigned char __initdata signature[] = | 97 | static unsigned char __initdata signature[] = |
98 | { 0x42, 0x21, 0x55, 0x30 }; | 98 | { 0x42, 0x21, 0x55, 0x30 }; |
99 | ssize_t offset; | 99 | ssize_t offset; |
100 | 100 | ||
@@ -259,11 +259,11 @@ static int __init dmi_matched(struct dmi_system_id *dmi) | |||
259 | return 1; | 259 | return 1; |
260 | } | 260 | } |
261 | 261 | ||
262 | static struct key_entry keymap_empty[] = { | 262 | static struct key_entry keymap_empty[] __initdata = { |
263 | { KE_END, 0 } | 263 | { KE_END, 0 } |
264 | }; | 264 | }; |
265 | 265 | ||
266 | static struct key_entry keymap_fs_amilo_pro_v2000[] = { | 266 | static struct key_entry keymap_fs_amilo_pro_v2000[] __initdata = { |
267 | { KE_KEY, 0x01, KEY_HELP }, | 267 | { KE_KEY, 0x01, KEY_HELP }, |
268 | { KE_KEY, 0x11, KEY_PROG1 }, | 268 | { KE_KEY, 0x11, KEY_PROG1 }, |
269 | { KE_KEY, 0x12, KEY_PROG2 }, | 269 | { KE_KEY, 0x12, KEY_PROG2 }, |
@@ -273,7 +273,7 @@ static struct key_entry keymap_fs_amilo_pro_v2000[] = { | |||
273 | { KE_END, 0 } | 273 | { KE_END, 0 } |
274 | }; | 274 | }; |
275 | 275 | ||
276 | static struct key_entry keymap_fujitsu_n3510[] = { | 276 | static struct key_entry keymap_fujitsu_n3510[] __initdata = { |
277 | { KE_KEY, 0x11, KEY_PROG1 }, | 277 | { KE_KEY, 0x11, KEY_PROG1 }, |
278 | { KE_KEY, 0x12, KEY_PROG2 }, | 278 | { KE_KEY, 0x12, KEY_PROG2 }, |
279 | { KE_KEY, 0x36, KEY_WWW }, | 279 | { KE_KEY, 0x36, KEY_WWW }, |
@@ -285,7 +285,7 @@ static struct key_entry keymap_fujitsu_n3510[] = { | |||
285 | { KE_END, 0 } | 285 | { KE_END, 0 } |
286 | }; | 286 | }; |
287 | 287 | ||
288 | static struct key_entry keymap_wistron_ms2111[] = { | 288 | static struct key_entry keymap_wistron_ms2111[] __initdata = { |
289 | { KE_KEY, 0x11, KEY_PROG1 }, | 289 | { KE_KEY, 0x11, KEY_PROG1 }, |
290 | { KE_KEY, 0x12, KEY_PROG2 }, | 290 | { KE_KEY, 0x12, KEY_PROG2 }, |
291 | { KE_KEY, 0x13, KEY_PROG3 }, | 291 | { KE_KEY, 0x13, KEY_PROG3 }, |
@@ -294,7 +294,7 @@ static struct key_entry keymap_wistron_ms2111[] = { | |||
294 | { KE_END, 0 } | 294 | { KE_END, 0 } |
295 | }; | 295 | }; |
296 | 296 | ||
297 | static struct key_entry keymap_wistron_ms2141[] = { | 297 | static struct key_entry keymap_wistron_ms2141[] __initdata = { |
298 | { KE_KEY, 0x11, KEY_PROG1 }, | 298 | { KE_KEY, 0x11, KEY_PROG1 }, |
299 | { KE_KEY, 0x12, KEY_PROG2 }, | 299 | { KE_KEY, 0x12, KEY_PROG2 }, |
300 | { KE_WIFI, 0x30, 0 }, | 300 | { KE_WIFI, 0x30, 0 }, |
@@ -307,7 +307,7 @@ static struct key_entry keymap_wistron_ms2141[] = { | |||
307 | { KE_END, 0 } | 307 | { KE_END, 0 } |
308 | }; | 308 | }; |
309 | 309 | ||
310 | static struct key_entry keymap_acer_aspire_1500[] = { | 310 | static struct key_entry keymap_acer_aspire_1500[] __initdata = { |
311 | { KE_KEY, 0x11, KEY_PROG1 }, | 311 | { KE_KEY, 0x11, KEY_PROG1 }, |
312 | { KE_KEY, 0x12, KEY_PROG2 }, | 312 | { KE_KEY, 0x12, KEY_PROG2 }, |
313 | { KE_WIFI, 0x30, 0 }, | 313 | { KE_WIFI, 0x30, 0 }, |
@@ -317,7 +317,7 @@ static struct key_entry keymap_acer_aspire_1500[] = { | |||
317 | { KE_END, 0 } | 317 | { KE_END, 0 } |
318 | }; | 318 | }; |
319 | 319 | ||
320 | static struct key_entry keymap_acer_travelmate_240[] = { | 320 | static struct key_entry keymap_acer_travelmate_240[] __initdata = { |
321 | { KE_KEY, 0x31, KEY_MAIL }, | 321 | { KE_KEY, 0x31, KEY_MAIL }, |
322 | { KE_KEY, 0x36, KEY_WWW }, | 322 | { KE_KEY, 0x36, KEY_WWW }, |
323 | { KE_KEY, 0x11, KEY_PROG1 }, | 323 | { KE_KEY, 0x11, KEY_PROG1 }, |
@@ -327,7 +327,7 @@ static struct key_entry keymap_acer_travelmate_240[] = { | |||
327 | { KE_END, 0 } | 327 | { KE_END, 0 } |
328 | }; | 328 | }; |
329 | 329 | ||
330 | static struct key_entry keymap_aopen_1559as[] = { | 330 | static struct key_entry keymap_aopen_1559as[] __initdata = { |
331 | { KE_KEY, 0x01, KEY_HELP }, | 331 | { KE_KEY, 0x01, KEY_HELP }, |
332 | { KE_KEY, 0x06, KEY_PROG3 }, | 332 | { KE_KEY, 0x06, KEY_PROG3 }, |
333 | { KE_KEY, 0x11, KEY_PROG1 }, | 333 | { KE_KEY, 0x11, KEY_PROG1 }, |
@@ -343,7 +343,7 @@ static struct key_entry keymap_aopen_1559as[] = { | |||
343 | * a list of buttons and their key codes (reported when loading this module | 343 | * a list of buttons and their key codes (reported when loading this module |
344 | * with force=1) and the output of dmidecode to $MODULE_AUTHOR. | 344 | * with force=1) and the output of dmidecode to $MODULE_AUTHOR. |
345 | */ | 345 | */ |
346 | static struct dmi_system_id dmi_ids[] = { | 346 | static struct dmi_system_id dmi_ids[] __initdata = { |
347 | { | 347 | { |
348 | .callback = dmi_matched, | 348 | .callback = dmi_matched, |
349 | .ident = "Fujitsu-Siemens Amilo Pro V2000", | 349 | .ident = "Fujitsu-Siemens Amilo Pro V2000", |
diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c index 2f0d28840810..54b696cfe1e3 100644 --- a/drivers/input/mouse/logips2pp.c +++ b/drivers/input/mouse/logips2pp.c | |||
@@ -238,8 +238,7 @@ static struct ps2pp_info *get_model_info(unsigned char model) | |||
238 | { 100, PS2PP_KIND_MX, /* MX510 */ | 238 | { 100, PS2PP_KIND_MX, /* MX510 */ |
239 | PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN | | 239 | PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN | |
240 | PS2PP_EXTRA_BTN | PS2PP_NAV_BTN }, | 240 | PS2PP_EXTRA_BTN | PS2PP_NAV_BTN }, |
241 | { 111, PS2PP_KIND_MX, /* MX300 */ | 241 | { 111, PS2PP_KIND_MX, PS2PP_WHEEL | PS2PP_SIDE_BTN }, /* MX300 reports task button as side */ |
242 | PS2PP_WHEEL | PS2PP_EXTRA_BTN | PS2PP_TASK_BTN }, | ||
243 | { 112, PS2PP_KIND_MX, /* MX500 */ | 242 | { 112, PS2PP_KIND_MX, /* MX500 */ |
244 | PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN | | 243 | PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN | |
245 | PS2PP_EXTRA_BTN | PS2PP_NAV_BTN }, | 244 | PS2PP_EXTRA_BTN | PS2PP_NAV_BTN }, |
diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c index 6d9ec9ab1b90..ae5871a0e060 100644 --- a/drivers/input/mouse/trackpoint.c +++ b/drivers/input/mouse/trackpoint.c | |||
@@ -183,21 +183,26 @@ static struct attribute_group trackpoint_attr_group = { | |||
183 | .attrs = trackpoint_attrs, | 183 | .attrs = trackpoint_attrs, |
184 | }; | 184 | }; |
185 | 185 | ||
186 | static void trackpoint_disconnect(struct psmouse *psmouse) | 186 | static int trackpoint_start_protocol(struct psmouse *psmouse, unsigned char *firmware_id) |
187 | { | 187 | { |
188 | sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, &trackpoint_attr_group); | 188 | unsigned char param[2] = { 0 }; |
189 | 189 | ||
190 | kfree(psmouse->private); | 190 | if (ps2_command(&psmouse->ps2dev, param, MAKE_PS2_CMD(0, 2, TP_READ_ID))) |
191 | psmouse->private = NULL; | 191 | return -1; |
192 | |||
193 | if (param[0] != TP_MAGIC_IDENT) | ||
194 | return -1; | ||
195 | |||
196 | if (firmware_id) | ||
197 | *firmware_id = param[1]; | ||
198 | |||
199 | return 0; | ||
192 | } | 200 | } |
193 | 201 | ||
194 | static int trackpoint_sync(struct psmouse *psmouse) | 202 | static int trackpoint_sync(struct psmouse *psmouse) |
195 | { | 203 | { |
196 | unsigned char toggle; | ||
197 | struct trackpoint_data *tp = psmouse->private; | 204 | struct trackpoint_data *tp = psmouse->private; |
198 | 205 | unsigned char toggle; | |
199 | if (!tp) | ||
200 | return -1; | ||
201 | 206 | ||
202 | /* Disable features that may make device unusable with this driver */ | 207 | /* Disable features that may make device unusable with this driver */ |
203 | trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_TWOHAND, &toggle); | 208 | trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_TWOHAND, &toggle); |
@@ -263,27 +268,38 @@ static void trackpoint_defaults(struct trackpoint_data *tp) | |||
263 | tp->ext_dev = TP_DEF_EXT_DEV; | 268 | tp->ext_dev = TP_DEF_EXT_DEV; |
264 | } | 269 | } |
265 | 270 | ||
271 | static void trackpoint_disconnect(struct psmouse *psmouse) | ||
272 | { | ||
273 | sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, &trackpoint_attr_group); | ||
274 | |||
275 | kfree(psmouse->private); | ||
276 | psmouse->private = NULL; | ||
277 | } | ||
278 | |||
279 | static int trackpoint_reconnect(struct psmouse *psmouse) | ||
280 | { | ||
281 | if (trackpoint_start_protocol(psmouse, NULL)) | ||
282 | return -1; | ||
283 | |||
284 | if (trackpoint_sync(psmouse)) | ||
285 | return -1; | ||
286 | |||
287 | return 0; | ||
288 | } | ||
289 | |||
266 | int trackpoint_detect(struct psmouse *psmouse, int set_properties) | 290 | int trackpoint_detect(struct psmouse *psmouse, int set_properties) |
267 | { | 291 | { |
268 | struct trackpoint_data *priv; | 292 | struct trackpoint_data *priv; |
269 | struct ps2dev *ps2dev = &psmouse->ps2dev; | 293 | struct ps2dev *ps2dev = &psmouse->ps2dev; |
270 | unsigned char firmware_id; | 294 | unsigned char firmware_id; |
271 | unsigned char button_info; | 295 | unsigned char button_info; |
272 | unsigned char param[2]; | ||
273 | |||
274 | param[0] = param[1] = 0; | ||
275 | 296 | ||
276 | if (ps2_command(ps2dev, param, MAKE_PS2_CMD(0, 2, TP_READ_ID))) | 297 | if (trackpoint_start_protocol(psmouse, &firmware_id)) |
277 | return -1; | ||
278 | |||
279 | if (param[0] != TP_MAGIC_IDENT) | ||
280 | return -1; | 298 | return -1; |
281 | 299 | ||
282 | if (!set_properties) | 300 | if (!set_properties) |
283 | return 0; | 301 | return 0; |
284 | 302 | ||
285 | firmware_id = param[1]; | ||
286 | |||
287 | if (trackpoint_read(&psmouse->ps2dev, TP_EXT_BTN, &button_info)) { | 303 | if (trackpoint_read(&psmouse->ps2dev, TP_EXT_BTN, &button_info)) { |
288 | printk(KERN_WARNING "trackpoint.c: failed to get extended button data\n"); | 304 | printk(KERN_WARNING "trackpoint.c: failed to get extended button data\n"); |
289 | button_info = 0; | 305 | button_info = 0; |
@@ -296,7 +312,7 @@ int trackpoint_detect(struct psmouse *psmouse, int set_properties) | |||
296 | psmouse->vendor = "IBM"; | 312 | psmouse->vendor = "IBM"; |
297 | psmouse->name = "TrackPoint"; | 313 | psmouse->name = "TrackPoint"; |
298 | 314 | ||
299 | psmouse->reconnect = trackpoint_sync; | 315 | psmouse->reconnect = trackpoint_reconnect; |
300 | psmouse->disconnect = trackpoint_disconnect; | 316 | psmouse->disconnect = trackpoint_disconnect; |
301 | 317 | ||
302 | trackpoint_defaults(priv); | 318 | trackpoint_defaults(priv); |
diff --git a/drivers/input/serio/libps2.c b/drivers/input/serio/libps2.c index 61a6f977846f..ed202f2f251a 100644 --- a/drivers/input/serio/libps2.c +++ b/drivers/input/serio/libps2.c | |||
@@ -177,6 +177,11 @@ int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command) | |||
177 | return -1; | 177 | return -1; |
178 | } | 178 | } |
179 | 179 | ||
180 | if (send && !param) { | ||
181 | WARN_ON(1); | ||
182 | return -1; | ||
183 | } | ||
184 | |||
180 | mutex_lock_nested(&ps2dev->cmd_mutex, SINGLE_DEPTH_NESTING); | 185 | mutex_lock_nested(&ps2dev->cmd_mutex, SINGLE_DEPTH_NESTING); |
181 | 186 | ||
182 | serio_pause_rx(ps2dev->serio); | 187 | serio_pause_rx(ps2dev->serio); |
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index 6521034bc933..3e76ad71c9a0 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c | |||
@@ -62,6 +62,7 @@ static LIST_HEAD(serio_list); | |||
62 | 62 | ||
63 | static struct bus_type serio_bus; | 63 | static struct bus_type serio_bus; |
64 | 64 | ||
65 | static void serio_add_driver(struct serio_driver *drv); | ||
65 | static void serio_add_port(struct serio *serio); | 66 | static void serio_add_port(struct serio *serio); |
66 | static void serio_destroy_port(struct serio *serio); | 67 | static void serio_destroy_port(struct serio *serio); |
67 | static void serio_reconnect_port(struct serio *serio); | 68 | static void serio_reconnect_port(struct serio *serio); |
@@ -140,8 +141,14 @@ static void serio_release_driver(struct serio *serio) | |||
140 | 141 | ||
141 | static void serio_find_driver(struct serio *serio) | 142 | static void serio_find_driver(struct serio *serio) |
142 | { | 143 | { |
144 | int error; | ||
145 | |||
143 | down_write(&serio_bus.subsys.rwsem); | 146 | down_write(&serio_bus.subsys.rwsem); |
144 | device_attach(&serio->dev); | 147 | error = device_attach(&serio->dev); |
148 | if (error < 0) | ||
149 | printk(KERN_WARNING | ||
150 | "serio: device_attach() failed for %s (%s), error: %d\n", | ||
151 | serio->phys, serio->name, error); | ||
145 | up_write(&serio_bus.subsys.rwsem); | 152 | up_write(&serio_bus.subsys.rwsem); |
146 | } | 153 | } |
147 | 154 | ||
@@ -272,7 +279,6 @@ static struct serio_event *serio_get_event(void) | |||
272 | static void serio_handle_event(void) | 279 | static void serio_handle_event(void) |
273 | { | 280 | { |
274 | struct serio_event *event; | 281 | struct serio_event *event; |
275 | struct serio_driver *serio_drv; | ||
276 | 282 | ||
277 | mutex_lock(&serio_mutex); | 283 | mutex_lock(&serio_mutex); |
278 | 284 | ||
@@ -304,8 +310,7 @@ static void serio_handle_event(void) | |||
304 | break; | 310 | break; |
305 | 311 | ||
306 | case SERIO_REGISTER_DRIVER: | 312 | case SERIO_REGISTER_DRIVER: |
307 | serio_drv = event->object; | 313 | serio_add_driver(event->object); |
308 | driver_register(&serio_drv->driver); | ||
309 | break; | 314 | break; |
310 | 315 | ||
311 | default: | 316 | default: |
@@ -525,6 +530,7 @@ static void serio_init_port(struct serio *serio) | |||
525 | 530 | ||
526 | __module_get(THIS_MODULE); | 531 | __module_get(THIS_MODULE); |
527 | 532 | ||
533 | INIT_LIST_HEAD(&serio->node); | ||
528 | spin_lock_init(&serio->lock); | 534 | spin_lock_init(&serio->lock); |
529 | mutex_init(&serio->drv_mutex); | 535 | mutex_init(&serio->drv_mutex); |
530 | device_initialize(&serio->dev); | 536 | device_initialize(&serio->dev); |
@@ -542,6 +548,8 @@ static void serio_init_port(struct serio *serio) | |||
542 | */ | 548 | */ |
543 | static void serio_add_port(struct serio *serio) | 549 | static void serio_add_port(struct serio *serio) |
544 | { | 550 | { |
551 | int error; | ||
552 | |||
545 | if (serio->parent) { | 553 | if (serio->parent) { |
546 | serio_pause_rx(serio->parent); | 554 | serio_pause_rx(serio->parent); |
547 | serio->parent->child = serio; | 555 | serio->parent->child = serio; |
@@ -551,9 +559,19 @@ static void serio_add_port(struct serio *serio) | |||
551 | list_add_tail(&serio->node, &serio_list); | 559 | list_add_tail(&serio->node, &serio_list); |
552 | if (serio->start) | 560 | if (serio->start) |
553 | serio->start(serio); | 561 | serio->start(serio); |
554 | device_add(&serio->dev); | 562 | error = device_add(&serio->dev); |
555 | sysfs_create_group(&serio->dev.kobj, &serio_id_attr_group); | 563 | if (error) |
556 | serio->registered = 1; | 564 | printk(KERN_ERR |
565 | "serio: device_add() failed for %s (%s), error: %d\n", | ||
566 | serio->phys, serio->name, error); | ||
567 | else { | ||
568 | serio->registered = 1; | ||
569 | error = sysfs_create_group(&serio->dev.kobj, &serio_id_attr_group); | ||
570 | if (error) | ||
571 | printk(KERN_ERR | ||
572 | "serio: sysfs_create_group() failed for %s (%s), error: %d\n", | ||
573 | serio->phys, serio->name, error); | ||
574 | } | ||
557 | } | 575 | } |
558 | 576 | ||
559 | /* | 577 | /* |
@@ -583,10 +601,10 @@ static void serio_destroy_port(struct serio *serio) | |||
583 | if (serio->registered) { | 601 | if (serio->registered) { |
584 | sysfs_remove_group(&serio->dev.kobj, &serio_id_attr_group); | 602 | sysfs_remove_group(&serio->dev.kobj, &serio_id_attr_group); |
585 | device_del(&serio->dev); | 603 | device_del(&serio->dev); |
586 | list_del_init(&serio->node); | ||
587 | serio->registered = 0; | 604 | serio->registered = 0; |
588 | } | 605 | } |
589 | 606 | ||
607 | list_del_init(&serio->node); | ||
590 | serio_remove_pending_events(serio); | 608 | serio_remove_pending_events(serio); |
591 | put_device(&serio->dev); | 609 | put_device(&serio->dev); |
592 | } | 610 | } |
@@ -756,6 +774,17 @@ static struct bus_type serio_bus = { | |||
756 | .remove = serio_driver_remove, | 774 | .remove = serio_driver_remove, |
757 | }; | 775 | }; |
758 | 776 | ||
777 | static void serio_add_driver(struct serio_driver *drv) | ||
778 | { | ||
779 | int error; | ||
780 | |||
781 | error = driver_register(&drv->driver); | ||
782 | if (error) | ||
783 | printk(KERN_ERR | ||
784 | "serio: driver_register() failed for %s, error: %d\n", | ||
785 | drv->driver.name, error); | ||
786 | } | ||
787 | |||
759 | void __serio_register_driver(struct serio_driver *drv, struct module *owner) | 788 | void __serio_register_driver(struct serio_driver *drv, struct module *owner) |
760 | { | 789 | { |
761 | drv->driver.bus = &serio_bus; | 790 | drv->driver.bus = &serio_bus; |
@@ -903,18 +932,26 @@ irqreturn_t serio_interrupt(struct serio *serio, | |||
903 | 932 | ||
904 | static int __init serio_init(void) | 933 | static int __init serio_init(void) |
905 | { | 934 | { |
906 | serio_task = kthread_run(serio_thread, NULL, "kseriod"); | 935 | int error; |
907 | if (IS_ERR(serio_task)) { | ||
908 | printk(KERN_ERR "serio: Failed to start kseriod\n"); | ||
909 | return PTR_ERR(serio_task); | ||
910 | } | ||
911 | 936 | ||
912 | serio_bus.dev_attrs = serio_device_attrs; | 937 | serio_bus.dev_attrs = serio_device_attrs; |
913 | serio_bus.drv_attrs = serio_driver_attrs; | 938 | serio_bus.drv_attrs = serio_driver_attrs; |
914 | serio_bus.match = serio_bus_match; | 939 | serio_bus.match = serio_bus_match; |
915 | serio_bus.uevent = serio_uevent; | 940 | serio_bus.uevent = serio_uevent; |
916 | serio_bus.resume = serio_resume; | 941 | serio_bus.resume = serio_resume; |
917 | bus_register(&serio_bus); | 942 | error = bus_register(&serio_bus); |
943 | if (error) { | ||
944 | printk(KERN_ERR "serio: failed to register serio bus, error: %d\n", error); | ||
945 | return error; | ||
946 | } | ||
947 | |||
948 | serio_task = kthread_run(serio_thread, NULL, "kseriod"); | ||
949 | if (IS_ERR(serio_task)) { | ||
950 | bus_unregister(&serio_bus); | ||
951 | error = PTR_ERR(serio_task); | ||
952 | printk(KERN_ERR "serio: Failed to start kseriod, error: %d\n", error); | ||
953 | return error; | ||
954 | } | ||
918 | 955 | ||
919 | return 0; | 956 | return 0; |
920 | } | 957 | } |
diff --git a/drivers/isdn/hardware/eicon/divasync.h b/drivers/isdn/hardware/eicon/divasync.h index 0a5be7f969f2..af3eb9e795b5 100644 --- a/drivers/isdn/hardware/eicon/divasync.h +++ b/drivers/isdn/hardware/eicon/divasync.h | |||
@@ -256,7 +256,6 @@ typedef struct | |||
256 | #define NO_ORDER_CHECK_MASK 0x00000010 | 256 | #define NO_ORDER_CHECK_MASK 0x00000010 |
257 | #define LOW_CHANNEL_MASK 0x00000020 | 257 | #define LOW_CHANNEL_MASK 0x00000020 |
258 | #define NO_HSCX30_MASK 0x00000040 | 258 | #define NO_HSCX30_MASK 0x00000040 |
259 | #define MODE_MASK 0x00000080 | ||
260 | #define SET_BOARD 0x00001000 | 259 | #define SET_BOARD 0x00001000 |
261 | #define SET_CRC4 0x00030000 | 260 | #define SET_CRC4 0x00030000 |
262 | #define SET_L1_TRISTATE 0x00040000 | 261 | #define SET_L1_TRISTATE 0x00040000 |
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index ff83c9b5979e..b99c19c7eb22 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
@@ -162,7 +162,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
162 | goto out; | 162 | goto out; |
163 | } | 163 | } |
164 | 164 | ||
165 | min_spacing = mddev->array_size; | 165 | min_spacing = conf->array_size; |
166 | sector_div(min_spacing, PAGE_SIZE/sizeof(struct dev_info *)); | 166 | sector_div(min_spacing, PAGE_SIZE/sizeof(struct dev_info *)); |
167 | 167 | ||
168 | /* min_spacing is the minimum spacing that will fit the hash | 168 | /* min_spacing is the minimum spacing that will fit the hash |
@@ -171,7 +171,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
171 | * that is larger than min_spacing as use the size of that as | 171 | * that is larger than min_spacing as use the size of that as |
172 | * the actual spacing | 172 | * the actual spacing |
173 | */ | 173 | */ |
174 | conf->hash_spacing = mddev->array_size; | 174 | conf->hash_spacing = conf->array_size; |
175 | for (i=0; i < cnt-1 ; i++) { | 175 | for (i=0; i < cnt-1 ; i++) { |
176 | sector_t sz = 0; | 176 | sector_t sz = 0; |
177 | int j; | 177 | int j; |
@@ -228,7 +228,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
228 | curr_offset = 0; | 228 | curr_offset = 0; |
229 | i = 0; | 229 | i = 0; |
230 | for (curr_offset = 0; | 230 | for (curr_offset = 0; |
231 | curr_offset < mddev->array_size; | 231 | curr_offset < conf->array_size; |
232 | curr_offset += conf->hash_spacing) { | 232 | curr_offset += conf->hash_spacing) { |
233 | 233 | ||
234 | while (i < mddev->raid_disks-1 && | 234 | while (i < mddev->raid_disks-1 && |
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 212268881857..dc79b0a0059f 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -173,6 +173,9 @@ pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res_table, | |||
173 | return; | 173 | return; |
174 | } | 174 | } |
175 | 175 | ||
176 | if (p->producer_consumer == ACPI_PRODUCER) | ||
177 | return; | ||
178 | |||
176 | if (p->resource_type == ACPI_MEMORY_RANGE) | 179 | if (p->resource_type == ACPI_MEMORY_RANGE) |
177 | pnpacpi_parse_allocated_memresource(res_table, | 180 | pnpacpi_parse_allocated_memresource(res_table, |
178 | p->minimum, p->address_length); | 181 | p->minimum, p->address_length); |
@@ -252,9 +255,14 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
252 | break; | 255 | break; |
253 | 256 | ||
254 | case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: | 257 | case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: |
258 | if (res->data.ext_address64.producer_consumer == ACPI_PRODUCER) | ||
259 | return AE_OK; | ||
255 | break; | 260 | break; |
256 | 261 | ||
257 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: | 262 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
263 | if (res->data.extended_irq.producer_consumer == ACPI_PRODUCER) | ||
264 | return AE_OK; | ||
265 | |||
258 | for (i = 0; i < res->data.extended_irq.interrupt_count; i++) { | 266 | for (i = 0; i < res->data.extended_irq.interrupt_count; i++) { |
259 | pnpacpi_parse_allocated_irqresource(res_table, | 267 | pnpacpi_parse_allocated_irqresource(res_table, |
260 | res->data.extended_irq.interrupts[i], | 268 | res->data.extended_irq.interrupts[i], |
diff --git a/drivers/usb/input/ati_remote.c b/drivers/usb/input/ati_remote.c index df198cf76f52..3719fcb04b8f 100644 --- a/drivers/usb/input/ati_remote.c +++ b/drivers/usb/input/ati_remote.c | |||
@@ -111,14 +111,28 @@ | |||
111 | #define NAME_BUFSIZE 80 /* size of product name, path buffers */ | 111 | #define NAME_BUFSIZE 80 /* size of product name, path buffers */ |
112 | #define DATA_BUFSIZE 63 /* size of URB data buffers */ | 112 | #define DATA_BUFSIZE 63 /* size of URB data buffers */ |
113 | 113 | ||
114 | /* | ||
115 | * Duplicate event filtering time. | ||
116 | * Sequential, identical KIND_FILTERED inputs with less than | ||
117 | * FILTER_TIME milliseconds between them are considered as repeat | ||
118 | * events. The hardware generates 5 events for the first keypress | ||
119 | * and we have to take this into account for an accurate repeat | ||
120 | * behaviour. | ||
121 | */ | ||
122 | #define FILTER_TIME 60 /* msec */ | ||
123 | |||
114 | static unsigned long channel_mask; | 124 | static unsigned long channel_mask; |
115 | module_param(channel_mask, ulong, 0444); | 125 | module_param(channel_mask, ulong, 0644); |
116 | MODULE_PARM_DESC(channel_mask, "Bitmask of remote control channels to ignore"); | 126 | MODULE_PARM_DESC(channel_mask, "Bitmask of remote control channels to ignore"); |
117 | 127 | ||
118 | static int debug; | 128 | static int debug; |
119 | module_param(debug, int, 0444); | 129 | module_param(debug, int, 0644); |
120 | MODULE_PARM_DESC(debug, "Enable extra debug messages and information"); | 130 | MODULE_PARM_DESC(debug, "Enable extra debug messages and information"); |
121 | 131 | ||
132 | static int repeat_filter = FILTER_TIME; | ||
133 | module_param(repeat_filter, int, 0644); | ||
134 | MODULE_PARM_DESC(repeat_filter, "Repeat filter time, default = 60 msec"); | ||
135 | |||
122 | #define dbginfo(dev, format, arg...) do { if (debug) dev_info(dev , format , ## arg); } while (0) | 136 | #define dbginfo(dev, format, arg...) do { if (debug) dev_info(dev , format , ## arg); } while (0) |
123 | #undef err | 137 | #undef err |
124 | #define err(format, arg...) printk(KERN_ERR format , ## arg) | 138 | #define err(format, arg...) printk(KERN_ERR format , ## arg) |
@@ -143,18 +157,6 @@ MODULE_DEVICE_TABLE(usb, ati_remote_table); | |||
143 | static char init1[] = { 0x01, 0x00, 0x20, 0x14 }; | 157 | static char init1[] = { 0x01, 0x00, 0x20, 0x14 }; |
144 | static char init2[] = { 0x01, 0x00, 0x20, 0x14, 0x20, 0x20, 0x20 }; | 158 | static char init2[] = { 0x01, 0x00, 0x20, 0x14, 0x20, 0x20, 0x20 }; |
145 | 159 | ||
146 | /* Acceleration curve for directional control pad */ | ||
147 | static const char accel[] = { 1, 2, 4, 6, 9, 13, 20 }; | ||
148 | |||
149 | /* Duplicate event filtering time. | ||
150 | * Sequential, identical KIND_FILTERED inputs with less than | ||
151 | * FILTER_TIME jiffies between them are considered as repeat | ||
152 | * events. The hardware generates 5 events for the first keypress | ||
153 | * and we have to take this into account for an accurate repeat | ||
154 | * behaviour. | ||
155 | */ | ||
156 | #define FILTER_TIME 60 /* msec */ | ||
157 | |||
158 | struct ati_remote { | 160 | struct ati_remote { |
159 | struct input_dev *idev; | 161 | struct input_dev *idev; |
160 | struct usb_device *udev; | 162 | struct usb_device *udev; |
@@ -412,6 +414,43 @@ static int ati_remote_event_lookup(int rem, unsigned char d1, unsigned char d2) | |||
412 | } | 414 | } |
413 | 415 | ||
414 | /* | 416 | /* |
417 | * ati_remote_compute_accel | ||
418 | * | ||
419 | * Implements acceleration curve for directional control pad | ||
420 | * If elapsed time since last event is > 1/4 second, user "stopped", | ||
421 | * so reset acceleration. Otherwise, user is probably holding the control | ||
422 | * pad down, so we increase acceleration, ramping up over two seconds to | ||
423 | * a maximum speed. | ||
424 | */ | ||
425 | static int ati_remote_compute_accel(struct ati_remote *ati_remote) | ||
426 | { | ||
427 | static const char accel[] = { 1, 2, 4, 6, 9, 13, 20 }; | ||
428 | unsigned long now = jiffies; | ||
429 | int acc; | ||
430 | |||
431 | if (time_after(now, ati_remote->old_jiffies + msecs_to_jiffies(250))) { | ||
432 | acc = 1; | ||
433 | ati_remote->acc_jiffies = now; | ||
434 | } | ||
435 | else if (time_before(now, ati_remote->acc_jiffies + msecs_to_jiffies(125))) | ||
436 | acc = accel[0]; | ||
437 | else if (time_before(now, ati_remote->acc_jiffies + msecs_to_jiffies(250))) | ||
438 | acc = accel[1]; | ||
439 | else if (time_before(now, ati_remote->acc_jiffies + msecs_to_jiffies(500))) | ||
440 | acc = accel[2]; | ||
441 | else if (time_before(now, ati_remote->acc_jiffies + msecs_to_jiffies(1000))) | ||
442 | acc = accel[3]; | ||
443 | else if (time_before(now, ati_remote->acc_jiffies + msecs_to_jiffies(1500))) | ||
444 | acc = accel[4]; | ||
445 | else if (time_before(now, ati_remote->acc_jiffies + msecs_to_jiffies(2000))) | ||
446 | acc = accel[5]; | ||
447 | else | ||
448 | acc = accel[6]; | ||
449 | |||
450 | return acc; | ||
451 | } | ||
452 | |||
453 | /* | ||
415 | * ati_remote_report_input | 454 | * ati_remote_report_input |
416 | */ | 455 | */ |
417 | static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs) | 456 | static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs) |
@@ -464,9 +503,9 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs) | |||
464 | 503 | ||
465 | if (ati_remote_tbl[index].kind == KIND_FILTERED) { | 504 | if (ati_remote_tbl[index].kind == KIND_FILTERED) { |
466 | /* Filter duplicate events which happen "too close" together. */ | 505 | /* Filter duplicate events which happen "too close" together. */ |
467 | if ((ati_remote->old_data[0] == data[1]) && | 506 | if (ati_remote->old_data[0] == data[1] && |
468 | (ati_remote->old_data[1] == data[2]) && | 507 | ati_remote->old_data[1] == data[2] && |
469 | time_before(jiffies, ati_remote->old_jiffies + msecs_to_jiffies(FILTER_TIME))) { | 508 | time_before(jiffies, ati_remote->old_jiffies + msecs_to_jiffies(repeat_filter))) { |
470 | ati_remote->repeat_count++; | 509 | ati_remote->repeat_count++; |
471 | } else { | 510 | } else { |
472 | ati_remote->repeat_count = 0; | 511 | ati_remote->repeat_count = 0; |
@@ -476,75 +515,61 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs) | |||
476 | ati_remote->old_data[1] = data[2]; | 515 | ati_remote->old_data[1] = data[2]; |
477 | ati_remote->old_jiffies = jiffies; | 516 | ati_remote->old_jiffies = jiffies; |
478 | 517 | ||
479 | if ((ati_remote->repeat_count > 0) | 518 | if (ati_remote->repeat_count > 0 && |
480 | && (ati_remote->repeat_count < 5)) | 519 | ati_remote->repeat_count < 5) |
481 | return; | 520 | return; |
482 | 521 | ||
483 | 522 | ||
484 | input_regs(dev, regs); | 523 | input_regs(dev, regs); |
485 | input_event(dev, ati_remote_tbl[index].type, | 524 | input_event(dev, ati_remote_tbl[index].type, |
486 | ati_remote_tbl[index].code, 1); | 525 | ati_remote_tbl[index].code, 1); |
526 | input_sync(dev); | ||
487 | input_event(dev, ati_remote_tbl[index].type, | 527 | input_event(dev, ati_remote_tbl[index].type, |
488 | ati_remote_tbl[index].code, 0); | 528 | ati_remote_tbl[index].code, 0); |
489 | input_sync(dev); | 529 | input_sync(dev); |
490 | 530 | ||
491 | return; | 531 | } else { |
492 | } | ||
493 | 532 | ||
494 | /* | 533 | /* |
495 | * Other event kinds are from the directional control pad, and have an | 534 | * Other event kinds are from the directional control pad, and have an |
496 | * acceleration factor applied to them. Without this acceleration, the | 535 | * acceleration factor applied to them. Without this acceleration, the |
497 | * control pad is mostly unusable. | 536 | * control pad is mostly unusable. |
498 | * | 537 | */ |
499 | * If elapsed time since last event is > 1/4 second, user "stopped", | 538 | acc = ati_remote_compute_accel(ati_remote); |
500 | * so reset acceleration. Otherwise, user is probably holding the control | 539 | |
501 | * pad down, so we increase acceleration, ramping up over two seconds to | 540 | input_regs(dev, regs); |
502 | * a maximum speed. The acceleration curve is #defined above. | 541 | switch (ati_remote_tbl[index].kind) { |
503 | */ | 542 | case KIND_ACCEL: |
504 | if (time_after(jiffies, ati_remote->old_jiffies + (HZ >> 2))) { | 543 | input_event(dev, ati_remote_tbl[index].type, |
505 | acc = 1; | 544 | ati_remote_tbl[index].code, |
506 | ati_remote->acc_jiffies = jiffies; | 545 | ati_remote_tbl[index].value * acc); |
507 | } | 546 | break; |
508 | else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ >> 3))) acc = accel[0]; | 547 | case KIND_LU: |
509 | else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ >> 2))) acc = accel[1]; | 548 | input_report_rel(dev, REL_X, -acc); |
510 | else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ >> 1))) acc = accel[2]; | 549 | input_report_rel(dev, REL_Y, -acc); |
511 | else if (time_before(jiffies, ati_remote->acc_jiffies + HZ)) acc = accel[3]; | 550 | break; |
512 | else if (time_before(jiffies, ati_remote->acc_jiffies + HZ+(HZ>>1))) acc = accel[4]; | 551 | case KIND_RU: |
513 | else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ << 1))) acc = accel[5]; | 552 | input_report_rel(dev, REL_X, acc); |
514 | else acc = accel[6]; | 553 | input_report_rel(dev, REL_Y, -acc); |
515 | 554 | break; | |
516 | input_regs(dev, regs); | 555 | case KIND_LD: |
517 | switch (ati_remote_tbl[index].kind) { | 556 | input_report_rel(dev, REL_X, -acc); |
518 | case KIND_ACCEL: | 557 | input_report_rel(dev, REL_Y, acc); |
519 | input_event(dev, ati_remote_tbl[index].type, | 558 | break; |
520 | ati_remote_tbl[index].code, | 559 | case KIND_RD: |
521 | ati_remote_tbl[index].value * acc); | 560 | input_report_rel(dev, REL_X, acc); |
522 | break; | 561 | input_report_rel(dev, REL_Y, acc); |
523 | case KIND_LU: | 562 | break; |
524 | input_report_rel(dev, REL_X, -acc); | 563 | default: |
525 | input_report_rel(dev, REL_Y, -acc); | 564 | dev_dbg(&ati_remote->interface->dev, "ati_remote kind=%d\n", |
526 | break; | 565 | ati_remote_tbl[index].kind); |
527 | case KIND_RU: | 566 | } |
528 | input_report_rel(dev, REL_X, acc); | 567 | input_sync(dev); |
529 | input_report_rel(dev, REL_Y, -acc); | ||
530 | break; | ||
531 | case KIND_LD: | ||
532 | input_report_rel(dev, REL_X, -acc); | ||
533 | input_report_rel(dev, REL_Y, acc); | ||
534 | break; | ||
535 | case KIND_RD: | ||
536 | input_report_rel(dev, REL_X, acc); | ||
537 | input_report_rel(dev, REL_Y, acc); | ||
538 | break; | ||
539 | default: | ||
540 | dev_dbg(&ati_remote->interface->dev, "ati_remote kind=%d\n", | ||
541 | ati_remote_tbl[index].kind); | ||
542 | } | ||
543 | input_sync(dev); | ||
544 | 568 | ||
545 | ati_remote->old_jiffies = jiffies; | 569 | ati_remote->old_jiffies = jiffies; |
546 | ati_remote->old_data[0] = data[1]; | 570 | ati_remote->old_data[0] = data[1]; |
547 | ati_remote->old_data[1] = data[2]; | 571 | ati_remote->old_data[1] = data[2]; |
572 | } | ||
548 | } | 573 | } |
549 | 574 | ||
550 | /* | 575 | /* |
diff --git a/drivers/usb/input/hid-input.c b/drivers/usb/input/hid-input.c index 028e1ad89f5d..7208839f2dbf 100644 --- a/drivers/usb/input/hid-input.c +++ b/drivers/usb/input/hid-input.c | |||
@@ -607,7 +607,8 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
607 | 607 | ||
608 | } | 608 | } |
609 | 609 | ||
610 | if (usage->hat_min < usage->hat_max || usage->hat_dir) { | 610 | if (usage->type == EV_ABS && |
611 | (usage->hat_min < usage->hat_max || usage->hat_dir)) { | ||
611 | int i; | 612 | int i; |
612 | for (i = usage->code; i < usage->code + 2 && i <= max; i++) { | 613 | for (i = usage->code; i < usage->code + 2 && i <= max; i++) { |
613 | input_set_abs_params(input, i, -1, 1, 0, 0); | 614 | input_set_abs_params(input, i, -1, 1, 0, 0); |
diff --git a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c index 70477f02cc29..f6b839c257a7 100644 --- a/drivers/usb/input/hiddev.c +++ b/drivers/usb/input/hiddev.c | |||
@@ -49,7 +49,7 @@ struct hiddev { | |||
49 | int open; | 49 | int open; |
50 | wait_queue_head_t wait; | 50 | wait_queue_head_t wait; |
51 | struct hid_device *hid; | 51 | struct hid_device *hid; |
52 | struct hiddev_list *list; | 52 | struct list_head list; |
53 | }; | 53 | }; |
54 | 54 | ||
55 | struct hiddev_list { | 55 | struct hiddev_list { |
@@ -59,7 +59,7 @@ struct hiddev_list { | |||
59 | unsigned flags; | 59 | unsigned flags; |
60 | struct fasync_struct *fasync; | 60 | struct fasync_struct *fasync; |
61 | struct hiddev *hiddev; | 61 | struct hiddev *hiddev; |
62 | struct hiddev_list *next; | 62 | struct list_head node; |
63 | }; | 63 | }; |
64 | 64 | ||
65 | static struct hiddev *hiddev_table[HIDDEV_MINORS]; | 65 | static struct hiddev *hiddev_table[HIDDEV_MINORS]; |
@@ -73,12 +73,15 @@ static struct hiddev *hiddev_table[HIDDEV_MINORS]; | |||
73 | static struct hid_report * | 73 | static struct hid_report * |
74 | hiddev_lookup_report(struct hid_device *hid, struct hiddev_report_info *rinfo) | 74 | hiddev_lookup_report(struct hid_device *hid, struct hiddev_report_info *rinfo) |
75 | { | 75 | { |
76 | unsigned flags = rinfo->report_id & ~HID_REPORT_ID_MASK; | 76 | unsigned int flags = rinfo->report_id & ~HID_REPORT_ID_MASK; |
77 | unsigned int rid = rinfo->report_id & HID_REPORT_ID_MASK; | ||
77 | struct hid_report_enum *report_enum; | 78 | struct hid_report_enum *report_enum; |
79 | struct hid_report *report; | ||
78 | struct list_head *list; | 80 | struct list_head *list; |
79 | 81 | ||
80 | if (rinfo->report_type < HID_REPORT_TYPE_MIN || | 82 | if (rinfo->report_type < HID_REPORT_TYPE_MIN || |
81 | rinfo->report_type > HID_REPORT_TYPE_MAX) return NULL; | 83 | rinfo->report_type > HID_REPORT_TYPE_MAX) |
84 | return NULL; | ||
82 | 85 | ||
83 | report_enum = hid->report_enum + | 86 | report_enum = hid->report_enum + |
84 | (rinfo->report_type - HID_REPORT_TYPE_MIN); | 87 | (rinfo->report_type - HID_REPORT_TYPE_MIN); |
@@ -88,21 +91,25 @@ hiddev_lookup_report(struct hid_device *hid, struct hiddev_report_info *rinfo) | |||
88 | break; | 91 | break; |
89 | 92 | ||
90 | case HID_REPORT_ID_FIRST: | 93 | case HID_REPORT_ID_FIRST: |
91 | list = report_enum->report_list.next; | 94 | if (list_empty(&report_enum->report_list)) |
92 | if (list == &report_enum->report_list) | ||
93 | return NULL; | 95 | return NULL; |
94 | rinfo->report_id = ((struct hid_report *) list)->id; | 96 | |
97 | list = report_enum->report_list.next; | ||
98 | report = list_entry(list, struct hid_report, list); | ||
99 | rinfo->report_id = report->id; | ||
95 | break; | 100 | break; |
96 | 101 | ||
97 | case HID_REPORT_ID_NEXT: | 102 | case HID_REPORT_ID_NEXT: |
98 | list = (struct list_head *) | 103 | report = report_enum->report_id_hash[rid]; |
99 | report_enum->report_id_hash[rinfo->report_id & HID_REPORT_ID_MASK]; | 104 | if (!report) |
100 | if (list == NULL) | ||
101 | return NULL; | 105 | return NULL; |
102 | list = list->next; | 106 | |
107 | list = report->list.next; | ||
103 | if (list == &report_enum->report_list) | 108 | if (list == &report_enum->report_list) |
104 | return NULL; | 109 | return NULL; |
105 | rinfo->report_id = ((struct hid_report *) list)->id; | 110 | |
111 | report = list_entry(list, struct hid_report, list); | ||
112 | rinfo->report_id = report->id; | ||
106 | break; | 113 | break; |
107 | 114 | ||
108 | default: | 115 | default: |
@@ -125,12 +132,13 @@ hiddev_lookup_usage(struct hid_device *hid, struct hiddev_usage_ref *uref) | |||
125 | struct hid_field *field; | 132 | struct hid_field *field; |
126 | 133 | ||
127 | if (uref->report_type < HID_REPORT_TYPE_MIN || | 134 | if (uref->report_type < HID_REPORT_TYPE_MIN || |
128 | uref->report_type > HID_REPORT_TYPE_MAX) return NULL; | 135 | uref->report_type > HID_REPORT_TYPE_MAX) |
136 | return NULL; | ||
129 | 137 | ||
130 | report_enum = hid->report_enum + | 138 | report_enum = hid->report_enum + |
131 | (uref->report_type - HID_REPORT_TYPE_MIN); | 139 | (uref->report_type - HID_REPORT_TYPE_MIN); |
132 | 140 | ||
133 | list_for_each_entry(report, &report_enum->report_list, list) | 141 | list_for_each_entry(report, &report_enum->report_list, list) { |
134 | for (i = 0; i < report->maxfield; i++) { | 142 | for (i = 0; i < report->maxfield; i++) { |
135 | field = report->field[i]; | 143 | field = report->field[i]; |
136 | for (j = 0; j < field->maxusage; j++) { | 144 | for (j = 0; j < field->maxusage; j++) { |
@@ -142,6 +150,7 @@ hiddev_lookup_usage(struct hid_device *hid, struct hiddev_usage_ref *uref) | |||
142 | } | 150 | } |
143 | } | 151 | } |
144 | } | 152 | } |
153 | } | ||
145 | 154 | ||
146 | return NULL; | 155 | return NULL; |
147 | } | 156 | } |
@@ -150,9 +159,9 @@ static void hiddev_send_event(struct hid_device *hid, | |||
150 | struct hiddev_usage_ref *uref) | 159 | struct hiddev_usage_ref *uref) |
151 | { | 160 | { |
152 | struct hiddev *hiddev = hid->hiddev; | 161 | struct hiddev *hiddev = hid->hiddev; |
153 | struct hiddev_list *list = hiddev->list; | 162 | struct hiddev_list *list; |
154 | 163 | ||
155 | while (list) { | 164 | list_for_each_entry(list, &hiddev->list, node) { |
156 | if (uref->field_index != HID_FIELD_INDEX_NONE || | 165 | if (uref->field_index != HID_FIELD_INDEX_NONE || |
157 | (list->flags & HIDDEV_FLAG_REPORT) != 0) { | 166 | (list->flags & HIDDEV_FLAG_REPORT) != 0) { |
158 | list->buffer[list->head] = *uref; | 167 | list->buffer[list->head] = *uref; |
@@ -160,8 +169,6 @@ static void hiddev_send_event(struct hid_device *hid, | |||
160 | (HIDDEV_BUFFER_SIZE - 1); | 169 | (HIDDEV_BUFFER_SIZE - 1); |
161 | kill_fasync(&list->fasync, SIGIO, POLL_IN); | 170 | kill_fasync(&list->fasync, SIGIO, POLL_IN); |
162 | } | 171 | } |
163 | |||
164 | list = list->next; | ||
165 | } | 172 | } |
166 | 173 | ||
167 | wake_up_interruptible(&hiddev->wait); | 174 | wake_up_interruptible(&hiddev->wait); |
@@ -180,7 +187,7 @@ void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, | |||
180 | uref.report_type = | 187 | uref.report_type = |
181 | (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT : | 188 | (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT : |
182 | ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT : | 189 | ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT : |
183 | ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE:0)); | 190 | ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE : 0)); |
184 | uref.report_id = field->report->id; | 191 | uref.report_id = field->report->id; |
185 | uref.field_index = field->index; | 192 | uref.field_index = field->index; |
186 | uref.usage_index = (usage - field->usage); | 193 | uref.usage_index = (usage - field->usage); |
@@ -200,7 +207,7 @@ void hiddev_report_event(struct hid_device *hid, struct hid_report *report) | |||
200 | uref.report_type = | 207 | uref.report_type = |
201 | (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT : | 208 | (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT : |
202 | ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT : | 209 | ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT : |
203 | ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE:0)); | 210 | ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE : 0)); |
204 | uref.report_id = report->id; | 211 | uref.report_id = report->id; |
205 | uref.field_index = HID_FIELD_INDEX_NONE; | 212 | uref.field_index = HID_FIELD_INDEX_NONE; |
206 | 213 | ||
@@ -213,7 +220,9 @@ static int hiddev_fasync(int fd, struct file *file, int on) | |||
213 | { | 220 | { |
214 | int retval; | 221 | int retval; |
215 | struct hiddev_list *list = file->private_data; | 222 | struct hiddev_list *list = file->private_data; |
223 | |||
216 | retval = fasync_helper(fd, file, on, &list->fasync); | 224 | retval = fasync_helper(fd, file, on, &list->fasync); |
225 | |||
217 | return retval < 0 ? retval : 0; | 226 | return retval < 0 ? retval : 0; |
218 | } | 227 | } |
219 | 228 | ||
@@ -224,14 +233,9 @@ static int hiddev_fasync(int fd, struct file *file, int on) | |||
224 | static int hiddev_release(struct inode * inode, struct file * file) | 233 | static int hiddev_release(struct inode * inode, struct file * file) |
225 | { | 234 | { |
226 | struct hiddev_list *list = file->private_data; | 235 | struct hiddev_list *list = file->private_data; |
227 | struct hiddev_list **listptr; | ||
228 | 236 | ||
229 | listptr = &list->hiddev->list; | ||
230 | hiddev_fasync(-1, file, 0); | 237 | hiddev_fasync(-1, file, 0); |
231 | 238 | list_del(&list->node); | |
232 | while (*listptr && (*listptr != list)) | ||
233 | listptr = &((*listptr)->next); | ||
234 | *listptr = (*listptr)->next; | ||
235 | 239 | ||
236 | if (!--list->hiddev->open) { | 240 | if (!--list->hiddev->open) { |
237 | if (list->hiddev->exist) | 241 | if (list->hiddev->exist) |
@@ -248,7 +252,8 @@ static int hiddev_release(struct inode * inode, struct file * file) | |||
248 | /* | 252 | /* |
249 | * open file op | 253 | * open file op |
250 | */ | 254 | */ |
251 | static int hiddev_open(struct inode * inode, struct file * file) { | 255 | static int hiddev_open(struct inode *inode, struct file *file) |
256 | { | ||
252 | struct hiddev_list *list; | 257 | struct hiddev_list *list; |
253 | 258 | ||
254 | int i = iminor(inode) - HIDDEV_MINOR_BASE; | 259 | int i = iminor(inode) - HIDDEV_MINOR_BASE; |
@@ -260,9 +265,7 @@ static int hiddev_open(struct inode * inode, struct file * file) { | |||
260 | return -ENOMEM; | 265 | return -ENOMEM; |
261 | 266 | ||
262 | list->hiddev = hiddev_table[i]; | 267 | list->hiddev = hiddev_table[i]; |
263 | list->next = hiddev_table[i]->list; | 268 | list_add_tail(&list->node, &hiddev_table[i]->list); |
264 | hiddev_table[i]->list = list; | ||
265 | |||
266 | file->private_data = list; | 269 | file->private_data = list; |
267 | 270 | ||
268 | if (!list->hiddev->open++) | 271 | if (!list->hiddev->open++) |
@@ -362,6 +365,7 @@ static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t coun | |||
362 | static unsigned int hiddev_poll(struct file *file, poll_table *wait) | 365 | static unsigned int hiddev_poll(struct file *file, poll_table *wait) |
363 | { | 366 | { |
364 | struct hiddev_list *list = file->private_data; | 367 | struct hiddev_list *list = file->private_data; |
368 | |||
365 | poll_wait(file, &list->hiddev->wait, wait); | 369 | poll_wait(file, &list->hiddev->wait, wait); |
366 | if (list->head != list->tail) | 370 | if (list->head != list->tail) |
367 | return POLLIN | POLLRDNORM; | 371 | return POLLIN | POLLRDNORM; |
@@ -382,7 +386,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
382 | struct hiddev_collection_info cinfo; | 386 | struct hiddev_collection_info cinfo; |
383 | struct hiddev_report_info rinfo; | 387 | struct hiddev_report_info rinfo; |
384 | struct hiddev_field_info finfo; | 388 | struct hiddev_field_info finfo; |
385 | struct hiddev_usage_ref_multi *uref_multi=NULL; | 389 | struct hiddev_usage_ref_multi *uref_multi = NULL; |
386 | struct hiddev_usage_ref *uref; | 390 | struct hiddev_usage_ref *uref; |
387 | struct hiddev_devinfo dinfo; | 391 | struct hiddev_devinfo dinfo; |
388 | struct hid_report *report; | 392 | struct hid_report *report; |
@@ -764,15 +768,15 @@ int hiddev_connect(struct hid_device *hid) | |||
764 | } | 768 | } |
765 | 769 | ||
766 | init_waitqueue_head(&hiddev->wait); | 770 | init_waitqueue_head(&hiddev->wait); |
767 | 771 | INIT_LIST_HEAD(&hiddev->list); | |
768 | hiddev_table[hid->intf->minor - HIDDEV_MINOR_BASE] = hiddev; | ||
769 | |||
770 | hiddev->hid = hid; | 772 | hiddev->hid = hid; |
771 | hiddev->exist = 1; | 773 | hiddev->exist = 1; |
772 | 774 | ||
773 | hid->minor = hid->intf->minor; | 775 | hid->minor = hid->intf->minor; |
774 | hid->hiddev = hiddev; | 776 | hid->hiddev = hiddev; |
775 | 777 | ||
778 | hiddev_table[hid->intf->minor - HIDDEV_MINOR_BASE] = hiddev; | ||
779 | |||
776 | return 0; | 780 | return 0; |
777 | } | 781 | } |
778 | 782 | ||
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c index 8b08121b390b..3e827e04a2aa 100644 --- a/drivers/video/aty/aty128fb.c +++ b/drivers/video/aty/aty128fb.c | |||
@@ -1913,9 +1913,6 @@ static int __devinit aty128_init(struct pci_dev *pdev, const struct pci_device_i | |||
1913 | u8 chip_rev; | 1913 | u8 chip_rev; |
1914 | u32 dac; | 1914 | u32 dac; |
1915 | 1915 | ||
1916 | if (!par->vram_size) /* may have already been probed */ | ||
1917 | par->vram_size = aty_ld_le32(CONFIG_MEMSIZE) & 0x03FFFFFF; | ||
1918 | |||
1919 | /* Get the chip revision */ | 1916 | /* Get the chip revision */ |
1920 | chip_rev = (aty_ld_le32(CONFIG_CNTL) >> 16) & 0x1F; | 1917 | chip_rev = (aty_ld_le32(CONFIG_CNTL) >> 16) & 0x1F; |
1921 | 1918 | ||
@@ -2028,9 +2025,6 @@ static int __devinit aty128_init(struct pci_dev *pdev, const struct pci_device_i | |||
2028 | 2025 | ||
2029 | aty128_init_engine(par); | 2026 | aty128_init_engine(par); |
2030 | 2027 | ||
2031 | if (register_framebuffer(info) < 0) | ||
2032 | return 0; | ||
2033 | |||
2034 | par->pm_reg = pci_find_capability(pdev, PCI_CAP_ID_PM); | 2028 | par->pm_reg = pci_find_capability(pdev, PCI_CAP_ID_PM); |
2035 | par->pdev = pdev; | 2029 | par->pdev = pdev; |
2036 | par->asleep = 0; | 2030 | par->asleep = 0; |
@@ -2040,6 +2034,9 @@ static int __devinit aty128_init(struct pci_dev *pdev, const struct pci_device_i | |||
2040 | aty128_bl_init(par); | 2034 | aty128_bl_init(par); |
2041 | #endif | 2035 | #endif |
2042 | 2036 | ||
2037 | if (register_framebuffer(info) < 0) | ||
2038 | return 0; | ||
2039 | |||
2043 | printk(KERN_INFO "fb%d: %s frame buffer device on %s\n", | 2040 | printk(KERN_INFO "fb%d: %s frame buffer device on %s\n", |
2044 | info->node, info->fix.id, video_card); | 2041 | info->node, info->fix.id, video_card); |
2045 | 2042 | ||
@@ -2089,7 +2086,6 @@ static int __devinit aty128_probe(struct pci_dev *pdev, const struct pci_device_ | |||
2089 | par = info->par; | 2086 | par = info->par; |
2090 | 2087 | ||
2091 | info->pseudo_palette = par->pseudo_palette; | 2088 | info->pseudo_palette = par->pseudo_palette; |
2092 | info->fix = aty128fb_fix; | ||
2093 | 2089 | ||
2094 | /* Virtualize mmio region */ | 2090 | /* Virtualize mmio region */ |
2095 | info->fix.mmio_start = reg_addr; | 2091 | info->fix.mmio_start = reg_addr; |
diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c index a92a91fef16f..f25d5d648333 100644 --- a/drivers/video/au1100fb.c +++ b/drivers/video/au1100fb.c | |||
@@ -156,7 +156,7 @@ int au1100fb_setmode(struct au1100fb_device *fbdev) | |||
156 | 156 | ||
157 | info->fix.visual = FB_VISUAL_TRUECOLOR; | 157 | info->fix.visual = FB_VISUAL_TRUECOLOR; |
158 | info->fix.line_length = info->var.xres_virtual << 1; /* depth=16 */ | 158 | info->fix.line_length = info->var.xres_virtual << 1; /* depth=16 */ |
159 | } | 159 | } |
160 | } else { | 160 | } else { |
161 | /* mono */ | 161 | /* mono */ |
162 | info->fix.visual = FB_VISUAL_MONO10; | 162 | info->fix.visual = FB_VISUAL_MONO10; |
@@ -164,20 +164,16 @@ int au1100fb_setmode(struct au1100fb_device *fbdev) | |||
164 | } | 164 | } |
165 | 165 | ||
166 | info->screen_size = info->fix.line_length * info->var.yres_virtual; | 166 | info->screen_size = info->fix.line_length * info->var.yres_virtual; |
167 | info->var.rotate = ((fbdev->panel->control_base&LCD_CONTROL_SM_MASK) \ | ||
168 | >> LCD_CONTROL_SM_BIT) * 90; | ||
167 | 169 | ||
168 | /* Determine BPP mode and format */ | 170 | /* Determine BPP mode and format */ |
169 | fbdev->regs->lcd_control = fbdev->panel->control_base | | 171 | fbdev->regs->lcd_control = fbdev->panel->control_base; |
170 | ((info->var.rotate/90) << LCD_CONTROL_SM_BIT); | ||
171 | |||
172 | fbdev->regs->lcd_intenable = 0; | ||
173 | fbdev->regs->lcd_intstatus = 0; | ||
174 | |||
175 | fbdev->regs->lcd_horztiming = fbdev->panel->horztiming; | 172 | fbdev->regs->lcd_horztiming = fbdev->panel->horztiming; |
176 | |||
177 | fbdev->regs->lcd_verttiming = fbdev->panel->verttiming; | 173 | fbdev->regs->lcd_verttiming = fbdev->panel->verttiming; |
178 | |||
179 | fbdev->regs->lcd_clkcontrol = fbdev->panel->clkcontrol_base; | 174 | fbdev->regs->lcd_clkcontrol = fbdev->panel->clkcontrol_base; |
180 | 175 | fbdev->regs->lcd_intenable = 0; | |
176 | fbdev->regs->lcd_intstatus = 0; | ||
181 | fbdev->regs->lcd_dmaaddr0 = LCD_DMA_SA_N(fbdev->fb_phys); | 177 | fbdev->regs->lcd_dmaaddr0 = LCD_DMA_SA_N(fbdev->fb_phys); |
182 | 178 | ||
183 | if (panel_is_dual(fbdev->panel)) { | 179 | if (panel_is_dual(fbdev->panel)) { |
@@ -206,6 +202,8 @@ int au1100fb_setmode(struct au1100fb_device *fbdev) | |||
206 | 202 | ||
207 | /* Resume controller */ | 203 | /* Resume controller */ |
208 | fbdev->regs->lcd_control |= LCD_CONTROL_GO; | 204 | fbdev->regs->lcd_control |= LCD_CONTROL_GO; |
205 | mdelay(10); | ||
206 | au1100fb_fb_blank(VESA_NO_BLANKING, info); | ||
209 | 207 | ||
210 | return 0; | 208 | return 0; |
211 | } | 209 | } |
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index fcaeead9696b..50cfca5c7efd 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c | |||
@@ -512,7 +512,11 @@ befs_utf2nls(struct super_block *sb, const char *in, | |||
512 | wchar_t uni; | 512 | wchar_t uni; |
513 | int unilen, utflen; | 513 | int unilen, utflen; |
514 | char *result; | 514 | char *result; |
515 | int maxlen = in_len; /* The utf8->nls conversion can't make more chars */ | 515 | /* The utf8->nls conversion won't make the final nls string bigger |
516 | * than the utf one, but if the string is pure ascii they'll have the | ||
517 | * same width and an extra char is needed to save the additional \0 | ||
518 | */ | ||
519 | int maxlen = in_len + 1; | ||
516 | 520 | ||
517 | befs_debug(sb, "---> utf2nls()"); | 521 | befs_debug(sb, "---> utf2nls()"); |
518 | 522 | ||
@@ -588,7 +592,10 @@ befs_nls2utf(struct super_block *sb, const char *in, | |||
588 | wchar_t uni; | 592 | wchar_t uni; |
589 | int unilen, utflen; | 593 | int unilen, utflen; |
590 | char *result; | 594 | char *result; |
591 | int maxlen = 3 * in_len; | 595 | /* There're nls characters that will translate to 3-chars-wide UTF-8 |
596 | * characters, a additional byte is needed to save the final \0 | ||
597 | * in special cases */ | ||
598 | int maxlen = (3 * in_len) + 1; | ||
592 | 599 | ||
593 | befs_debug(sb, "---> nls2utf()\n"); | 600 | befs_debug(sb, "---> nls2utf()\n"); |
594 | 601 | ||
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c index baf5ae513481..c9d419703cf3 100644 --- a/fs/lockd/svclock.c +++ b/fs/lockd/svclock.c | |||
@@ -638,9 +638,6 @@ static void nlmsvc_grant_callback(struct rpc_task *task, void *data) | |||
638 | if (task->tk_status < 0) { | 638 | if (task->tk_status < 0) { |
639 | /* RPC error: Re-insert for retransmission */ | 639 | /* RPC error: Re-insert for retransmission */ |
640 | timeout = 10 * HZ; | 640 | timeout = 10 * HZ; |
641 | } else if (block->b_done) { | ||
642 | /* Block already removed, kill it for real */ | ||
643 | timeout = 0; | ||
644 | } else { | 641 | } else { |
645 | /* Call was successful, now wait for client callback */ | 642 | /* Call was successful, now wait for client callback */ |
646 | timeout = 60 * HZ; | 643 | timeout = 60 * HZ; |
@@ -709,13 +706,10 @@ nlmsvc_retry_blocked(void) | |||
709 | break; | 706 | break; |
710 | if (time_after(block->b_when,jiffies)) | 707 | if (time_after(block->b_when,jiffies)) |
711 | break; | 708 | break; |
712 | dprintk("nlmsvc_retry_blocked(%p, when=%ld, done=%d)\n", | 709 | dprintk("nlmsvc_retry_blocked(%p, when=%ld)\n", |
713 | block, block->b_when, block->b_done); | 710 | block, block->b_when); |
714 | kref_get(&block->b_count); | 711 | kref_get(&block->b_count); |
715 | if (block->b_done) | 712 | nlmsvc_grant_blocked(block); |
716 | nlmsvc_unlink_block(block); | ||
717 | else | ||
718 | nlmsvc_grant_blocked(block); | ||
719 | nlmsvc_release_block(block); | 713 | nlmsvc_release_block(block); |
720 | } | 714 | } |
721 | 715 | ||
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c index 19b98ca468eb..86b3169c8cac 100644 --- a/fs/nfs/namespace.c +++ b/fs/nfs/namespace.c | |||
@@ -51,7 +51,7 @@ char *nfs_path(const char *base, const struct dentry *dentry, | |||
51 | namelen = dentry->d_name.len; | 51 | namelen = dentry->d_name.len; |
52 | buflen -= namelen + 1; | 52 | buflen -= namelen + 1; |
53 | if (buflen < 0) | 53 | if (buflen < 0) |
54 | goto Elong; | 54 | goto Elong_unlock; |
55 | end -= namelen; | 55 | end -= namelen; |
56 | memcpy(end, dentry->d_name.name, namelen); | 56 | memcpy(end, dentry->d_name.name, namelen); |
57 | *--end = '/'; | 57 | *--end = '/'; |
@@ -68,6 +68,8 @@ char *nfs_path(const char *base, const struct dentry *dentry, | |||
68 | end -= namelen; | 68 | end -= namelen; |
69 | memcpy(end, base, namelen); | 69 | memcpy(end, base, namelen); |
70 | return end; | 70 | return end; |
71 | Elong_unlock: | ||
72 | spin_unlock(&dcache_lock); | ||
71 | Elong: | 73 | Elong: |
72 | return ERR_PTR(-ENAMETOOLONG); | 74 | return ERR_PTR(-ENAMETOOLONG); |
73 | } | 75 | } |
diff --git a/fs/nfs/read.c b/fs/nfs/read.c index 52bf634260a1..65c0c5b32351 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c | |||
@@ -63,7 +63,7 @@ struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount) | |||
63 | return p; | 63 | return p; |
64 | } | 64 | } |
65 | 65 | ||
66 | void nfs_readdata_free(struct nfs_read_data *p) | 66 | static void nfs_readdata_free(struct nfs_read_data *p) |
67 | { | 67 | { |
68 | if (p && (p->pagevec != &p->page_array[0])) | 68 | if (p && (p->pagevec != &p->page_array[0])) |
69 | kfree(p->pagevec); | 69 | kfree(p->pagevec); |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 86bac6a5008e..50774991f8d5 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -137,7 +137,7 @@ struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount) | |||
137 | return p; | 137 | return p; |
138 | } | 138 | } |
139 | 139 | ||
140 | void nfs_writedata_free(struct nfs_write_data *p) | 140 | static void nfs_writedata_free(struct nfs_write_data *p) |
141 | { | 141 | { |
142 | if (p && (p->pagevec != &p->page_array[0])) | 142 | if (p && (p->pagevec != &p->page_array[0])) |
143 | kfree(p->pagevec); | 143 | kfree(p->pagevec); |
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index f318b58510fd..1627edd50810 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c | |||
@@ -48,8 +48,8 @@ static int reiserfs_file_release(struct inode *inode, struct file *filp) | |||
48 | return 0; | 48 | return 0; |
49 | } | 49 | } |
50 | 50 | ||
51 | reiserfs_write_lock(inode->i_sb); | ||
52 | mutex_lock(&inode->i_mutex); | 51 | mutex_lock(&inode->i_mutex); |
52 | reiserfs_write_lock(inode->i_sb); | ||
53 | /* freeing preallocation only involves relogging blocks that | 53 | /* freeing preallocation only involves relogging blocks that |
54 | * are already in the current transaction. preallocation gets | 54 | * are already in the current transaction. preallocation gets |
55 | * freed at the end of each transaction, so it is impossible for | 55 | * freed at the end of each transaction, so it is impossible for |
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 12dfdcfbee3d..52f1e2136546 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -39,14 +39,10 @@ void reiserfs_delete_inode(struct inode *inode) | |||
39 | 39 | ||
40 | /* The = 0 happens when we abort creating a new inode for some reason like lack of space.. */ | 40 | /* The = 0 happens when we abort creating a new inode for some reason like lack of space.. */ |
41 | if (!(inode->i_state & I_NEW) && INODE_PKEY(inode)->k_objectid != 0) { /* also handles bad_inode case */ | 41 | if (!(inode->i_state & I_NEW) && INODE_PKEY(inode)->k_objectid != 0) { /* also handles bad_inode case */ |
42 | mutex_lock(&inode->i_mutex); | ||
43 | |||
44 | reiserfs_delete_xattrs(inode); | 42 | reiserfs_delete_xattrs(inode); |
45 | 43 | ||
46 | if (journal_begin(&th, inode->i_sb, jbegin_count)) { | 44 | if (journal_begin(&th, inode->i_sb, jbegin_count)) |
47 | mutex_unlock(&inode->i_mutex); | ||
48 | goto out; | 45 | goto out; |
49 | } | ||
50 | reiserfs_update_inode_transaction(inode); | 46 | reiserfs_update_inode_transaction(inode); |
51 | 47 | ||
52 | err = reiserfs_delete_object(&th, inode); | 48 | err = reiserfs_delete_object(&th, inode); |
@@ -57,12 +53,8 @@ void reiserfs_delete_inode(struct inode *inode) | |||
57 | if (!err) | 53 | if (!err) |
58 | DQUOT_FREE_INODE(inode); | 54 | DQUOT_FREE_INODE(inode); |
59 | 55 | ||
60 | if (journal_end(&th, inode->i_sb, jbegin_count)) { | 56 | if (journal_end(&th, inode->i_sb, jbegin_count)) |
61 | mutex_unlock(&inode->i_mutex); | ||
62 | goto out; | 57 | goto out; |
63 | } | ||
64 | |||
65 | mutex_unlock(&inode->i_mutex); | ||
66 | 58 | ||
67 | /* check return value from reiserfs_delete_object after | 59 | /* check return value from reiserfs_delete_object after |
68 | * ending the transaction | 60 | * ending the transaction |
@@ -2348,6 +2340,7 @@ static int reiserfs_write_full_page(struct page *page, | |||
2348 | unsigned long end_index = inode->i_size >> PAGE_CACHE_SHIFT; | 2340 | unsigned long end_index = inode->i_size >> PAGE_CACHE_SHIFT; |
2349 | int error = 0; | 2341 | int error = 0; |
2350 | unsigned long block; | 2342 | unsigned long block; |
2343 | sector_t last_block; | ||
2351 | struct buffer_head *head, *bh; | 2344 | struct buffer_head *head, *bh; |
2352 | int partial = 0; | 2345 | int partial = 0; |
2353 | int nr = 0; | 2346 | int nr = 0; |
@@ -2395,10 +2388,19 @@ static int reiserfs_write_full_page(struct page *page, | |||
2395 | } | 2388 | } |
2396 | bh = head; | 2389 | bh = head; |
2397 | block = page->index << (PAGE_CACHE_SHIFT - s->s_blocksize_bits); | 2390 | block = page->index << (PAGE_CACHE_SHIFT - s->s_blocksize_bits); |
2391 | last_block = (i_size_read(inode) - 1) >> inode->i_blkbits; | ||
2398 | /* first map all the buffers, logging any direct items we find */ | 2392 | /* first map all the buffers, logging any direct items we find */ |
2399 | do { | 2393 | do { |
2400 | if ((checked || buffer_dirty(bh)) && (!buffer_mapped(bh) || | 2394 | if (block > last_block) { |
2401 | (buffer_mapped(bh) | 2395 | /* |
2396 | * This can happen when the block size is less than | ||
2397 | * the page size. The corresponding bytes in the page | ||
2398 | * were zero filled above | ||
2399 | */ | ||
2400 | clear_buffer_dirty(bh); | ||
2401 | set_buffer_uptodate(bh); | ||
2402 | } else if ((checked || buffer_dirty(bh)) && | ||
2403 | (!buffer_mapped(bh) || (buffer_mapped(bh) | ||
2402 | && bh->b_blocknr == | 2404 | && bh->b_blocknr == |
2403 | 0))) { | 2405 | 0))) { |
2404 | /* not mapped yet, or it points to a direct item, search | 2406 | /* not mapped yet, or it points to a direct item, search |
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c index 745c88100895..a986b5e1e288 100644 --- a/fs/reiserfs/ioctl.c +++ b/fs/reiserfs/ioctl.c | |||
@@ -116,12 +116,12 @@ static int reiserfs_unpack(struct inode *inode, struct file *filp) | |||
116 | if (REISERFS_I(inode)->i_flags & i_nopack_mask) { | 116 | if (REISERFS_I(inode)->i_flags & i_nopack_mask) { |
117 | return 0; | 117 | return 0; |
118 | } | 118 | } |
119 | reiserfs_write_lock(inode->i_sb); | ||
120 | 119 | ||
121 | /* we need to make sure nobody is changing the file size beneath | 120 | /* we need to make sure nobody is changing the file size beneath |
122 | ** us | 121 | ** us |
123 | */ | 122 | */ |
124 | mutex_lock(&inode->i_mutex); | 123 | mutex_lock(&inode->i_mutex); |
124 | reiserfs_write_lock(inode->i_sb); | ||
125 | 125 | ||
126 | write_from = inode->i_size & (blocksize - 1); | 126 | write_from = inode->i_size & (blocksize - 1); |
127 | /* if we are on a block boundary, we are already unpacked. */ | 127 | /* if we are on a block boundary, we are already unpacked. */ |
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c index 3873c672cb4c..33323473e3c4 100644 --- a/fs/udf/ialloc.c +++ b/fs/udf/ialloc.c | |||
@@ -75,6 +75,12 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err) | |||
75 | } | 75 | } |
76 | *err = -ENOSPC; | 76 | *err = -ENOSPC; |
77 | 77 | ||
78 | UDF_I_UNIQUE(inode) = 0; | ||
79 | UDF_I_LENEXTENTS(inode) = 0; | ||
80 | UDF_I_NEXT_ALLOC_BLOCK(inode) = 0; | ||
81 | UDF_I_NEXT_ALLOC_GOAL(inode) = 0; | ||
82 | UDF_I_STRAT4096(inode) = 0; | ||
83 | |||
78 | block = udf_new_block(dir->i_sb, NULL, UDF_I_LOCATION(dir).partitionReferenceNum, | 84 | block = udf_new_block(dir->i_sb, NULL, UDF_I_LOCATION(dir).partitionReferenceNum, |
79 | start, err); | 85 | start, err); |
80 | if (*err) | 86 | if (*err) |
@@ -84,11 +90,6 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err) | |||
84 | } | 90 | } |
85 | 91 | ||
86 | mutex_lock(&sbi->s_alloc_mutex); | 92 | mutex_lock(&sbi->s_alloc_mutex); |
87 | UDF_I_UNIQUE(inode) = 0; | ||
88 | UDF_I_LENEXTENTS(inode) = 0; | ||
89 | UDF_I_NEXT_ALLOC_BLOCK(inode) = 0; | ||
90 | UDF_I_NEXT_ALLOC_GOAL(inode) = 0; | ||
91 | UDF_I_STRAT4096(inode) = 0; | ||
92 | if (UDF_SB_LVIDBH(sb)) | 93 | if (UDF_SB_LVIDBH(sb)) |
93 | { | 94 | { |
94 | struct logicalVolHeaderDesc *lvhd; | 95 | struct logicalVolHeaderDesc *lvhd; |
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c index b01804baa120..b82381475779 100644 --- a/fs/ufs/balloc.c +++ b/fs/ufs/balloc.c | |||
@@ -248,7 +248,7 @@ static void ufs_change_blocknr(struct inode *inode, unsigned int baseblk, | |||
248 | 248 | ||
249 | if (likely(cur_index != index)) { | 249 | if (likely(cur_index != index)) { |
250 | page = ufs_get_locked_page(mapping, index); | 250 | page = ufs_get_locked_page(mapping, index); |
251 | if (IS_ERR(page)) | 251 | if (!page || IS_ERR(page)) /* it was truncated or EIO */ |
252 | continue; | 252 | continue; |
253 | } else | 253 | } else |
254 | page = locked_page; | 254 | page = locked_page; |
diff --git a/fs/ufs/util.c b/fs/ufs/util.c index 337cf2c46d10..22f820a9b15c 100644 --- a/fs/ufs/util.c +++ b/fs/ufs/util.c | |||
@@ -251,12 +251,12 @@ struct page *ufs_get_locked_page(struct address_space *mapping, | |||
251 | { | 251 | { |
252 | struct page *page; | 252 | struct page *page; |
253 | 253 | ||
254 | try_again: | ||
255 | page = find_lock_page(mapping, index); | 254 | page = find_lock_page(mapping, index); |
256 | if (!page) { | 255 | if (!page) { |
257 | page = read_cache_page(mapping, index, | 256 | page = read_cache_page(mapping, index, |
258 | (filler_t*)mapping->a_ops->readpage, | 257 | (filler_t*)mapping->a_ops->readpage, |
259 | NULL); | 258 | NULL); |
259 | |||
260 | if (IS_ERR(page)) { | 260 | if (IS_ERR(page)) { |
261 | printk(KERN_ERR "ufs_change_blocknr: " | 261 | printk(KERN_ERR "ufs_change_blocknr: " |
262 | "read_cache_page error: ino %lu, index: %lu\n", | 262 | "read_cache_page error: ino %lu, index: %lu\n", |
@@ -266,6 +266,14 @@ try_again: | |||
266 | 266 | ||
267 | lock_page(page); | 267 | lock_page(page); |
268 | 268 | ||
269 | if (unlikely(page->mapping == NULL)) { | ||
270 | /* Truncate got there first */ | ||
271 | unlock_page(page); | ||
272 | page_cache_release(page); | ||
273 | page = NULL; | ||
274 | goto out; | ||
275 | } | ||
276 | |||
269 | if (!PageUptodate(page) || PageError(page)) { | 277 | if (!PageUptodate(page) || PageError(page)) { |
270 | unlock_page(page); | 278 | unlock_page(page); |
271 | page_cache_release(page); | 279 | page_cache_release(page); |
@@ -275,15 +283,8 @@ try_again: | |||
275 | mapping->host->i_ino, index); | 283 | mapping->host->i_ino, index); |
276 | 284 | ||
277 | page = ERR_PTR(-EIO); | 285 | page = ERR_PTR(-EIO); |
278 | goto out; | ||
279 | } | 286 | } |
280 | } | 287 | } |
281 | |||
282 | if (unlikely(!page->mapping || !page_has_buffers(page))) { | ||
283 | unlock_page(page); | ||
284 | page_cache_release(page); | ||
285 | goto try_again;/*we really need these buffers*/ | ||
286 | } | ||
287 | out: | 288 | out: |
288 | return page; | 289 | return page; |
289 | } | 290 | } |
diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h index 6a7047851e48..88dafa246d87 100644 --- a/include/linux/debug_locks.h +++ b/include/linux/debug_locks.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef __LINUX_DEBUG_LOCKING_H | 1 | #ifndef __LINUX_DEBUG_LOCKING_H |
2 | #define __LINUX_DEBUG_LOCKING_H | 2 | #define __LINUX_DEBUG_LOCKING_H |
3 | 3 | ||
4 | struct task_struct; | ||
5 | |||
4 | extern int debug_locks; | 6 | extern int debug_locks; |
5 | extern int debug_locks_silent; | 7 | extern int debug_locks_silent; |
6 | 8 | ||
diff --git a/include/linux/input.h b/include/linux/input.h index 56f1e0e1e598..b3253ab72ff7 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
@@ -893,7 +893,6 @@ struct input_dev { | |||
893 | 893 | ||
894 | int (*open)(struct input_dev *dev); | 894 | int (*open)(struct input_dev *dev); |
895 | void (*close)(struct input_dev *dev); | 895 | void (*close)(struct input_dev *dev); |
896 | int (*accept)(struct input_dev *dev, struct file *file); | ||
897 | int (*flush)(struct input_dev *dev, struct file *file); | 896 | int (*flush)(struct input_dev *dev, struct file *file); |
898 | int (*event)(struct input_dev *dev, unsigned int type, unsigned int code, int value); | 897 | int (*event)(struct input_dev *dev, unsigned int type, unsigned int code, int value); |
899 | int (*upload_effect)(struct input_dev *dev, struct ff_effect *effect); | 898 | int (*upload_effect)(struct input_dev *dev, struct ff_effect *effect); |
@@ -961,6 +960,26 @@ struct input_dev { | |||
961 | 960 | ||
962 | struct input_handle; | 961 | struct input_handle; |
963 | 962 | ||
963 | /** | ||
964 | * struct input_handler - implements one of interfaces for input devices | ||
965 | * @private: driver-specific data | ||
966 | * @event: event handler | ||
967 | * @connect: called when attaching a handler to an input device | ||
968 | * @disconnect: disconnects a handler from input device | ||
969 | * @start: starts handler for given handle. This function is called by | ||
970 | * input core right after connect() method and also when a process | ||
971 | * that "grabbed" a device releases it | ||
972 | * @fops: file operations this driver implements | ||
973 | * @minor: beginning of range of 32 minors for devices this driver | ||
974 | * can provide | ||
975 | * @name: name of the handler, to be shown in /proc/bus/input/handlers | ||
976 | * @id_table: pointer to a table of input_device_ids this driver can | ||
977 | * handle | ||
978 | * @blacklist: prointer to a table of input_device_ids this driver should | ||
979 | * ignore even if they match @id_table | ||
980 | * @h_list: list of input handles associated with the handler | ||
981 | * @node: for placing the driver onto input_handler_list | ||
982 | */ | ||
964 | struct input_handler { | 983 | struct input_handler { |
965 | 984 | ||
966 | void *private; | 985 | void *private; |
@@ -968,6 +987,7 @@ struct input_handler { | |||
968 | void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value); | 987 | void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value); |
969 | struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id); | 988 | struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id); |
970 | void (*disconnect)(struct input_handle *handle); | 989 | void (*disconnect)(struct input_handle *handle); |
990 | void (*start)(struct input_handle *handle); | ||
971 | 991 | ||
972 | const struct file_operations *fops; | 992 | const struct file_operations *fops; |
973 | int minor; | 993 | int minor; |
@@ -1030,10 +1050,10 @@ void input_release_device(struct input_handle *); | |||
1030 | int input_open_device(struct input_handle *); | 1050 | int input_open_device(struct input_handle *); |
1031 | void input_close_device(struct input_handle *); | 1051 | void input_close_device(struct input_handle *); |
1032 | 1052 | ||
1033 | int input_accept_process(struct input_handle *handle, struct file *file); | ||
1034 | int input_flush_device(struct input_handle* handle, struct file* file); | 1053 | int input_flush_device(struct input_handle* handle, struct file* file); |
1035 | 1054 | ||
1036 | void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value); | 1055 | void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value); |
1056 | void input_inject_event(struct input_handle *handle, unsigned int type, unsigned int code, int value); | ||
1037 | 1057 | ||
1038 | static inline void input_report_key(struct input_dev *dev, unsigned int code, int value) | 1058 | static inline void input_report_key(struct input_dev *dev, unsigned int code, int value) |
1039 | { | 1059 | { |
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h index aa4fe905bb4d..0d92c468d55a 100644 --- a/include/linux/lockd/lockd.h +++ b/include/linux/lockd/lockd.h | |||
@@ -123,7 +123,6 @@ struct nlm_block { | |||
123 | unsigned int b_id; /* block id */ | 123 | unsigned int b_id; /* block id */ |
124 | unsigned char b_queued; /* re-queued */ | 124 | unsigned char b_queued; /* re-queued */ |
125 | unsigned char b_granted; /* VFS granted lock */ | 125 | unsigned char b_granted; /* VFS granted lock */ |
126 | unsigned char b_done; /* callback complete */ | ||
127 | struct nlm_file * b_file; /* file in question */ | 126 | struct nlm_file * b_file; /* file in question */ |
128 | }; | 127 | }; |
129 | 128 | ||
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 55ea853d57bc..247434553ae8 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -476,10 +476,9 @@ static inline int nfs_wb_page(struct inode *inode, struct page* page) | |||
476 | } | 476 | } |
477 | 477 | ||
478 | /* | 478 | /* |
479 | * Allocate and free nfs_write_data structures | 479 | * Allocate nfs_write_data structures |
480 | */ | 480 | */ |
481 | extern struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount); | 481 | extern struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount); |
482 | extern void nfs_writedata_free(struct nfs_write_data *p); | ||
483 | 482 | ||
484 | /* | 483 | /* |
485 | * linux/fs/nfs/read.c | 484 | * linux/fs/nfs/read.c |
@@ -491,10 +490,9 @@ extern int nfs_readpage_result(struct rpc_task *, struct nfs_read_data *); | |||
491 | extern void nfs_readdata_release(void *data); | 490 | extern void nfs_readdata_release(void *data); |
492 | 491 | ||
493 | /* | 492 | /* |
494 | * Allocate and free nfs_read_data structures | 493 | * Allocate nfs_read_data structures |
495 | */ | 494 | */ |
496 | extern struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount); | 495 | extern struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount); |
497 | extern void nfs_readdata_free(struct nfs_read_data *p); | ||
498 | 496 | ||
499 | /* | 497 | /* |
500 | * linux/fs/nfs3proc.c | 498 | * linux/fs/nfs3proc.c |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 6afa72e080cb..6674fc1e51bf 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1558,6 +1558,14 @@ static inline void freeze(struct task_struct *p) | |||
1558 | } | 1558 | } |
1559 | 1559 | ||
1560 | /* | 1560 | /* |
1561 | * Sometimes we may need to cancel the previous 'freeze' request | ||
1562 | */ | ||
1563 | static inline void do_not_freeze(struct task_struct *p) | ||
1564 | { | ||
1565 | p->flags &= ~PF_FREEZE; | ||
1566 | } | ||
1567 | |||
1568 | /* | ||
1561 | * Wake up a frozen process | 1569 | * Wake up a frozen process |
1562 | */ | 1570 | */ |
1563 | static inline int thaw_process(struct task_struct *p) | 1571 | static inline int thaw_process(struct task_struct *p) |
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index e8bbe8118de8..840e47a4ccc5 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h | |||
@@ -229,7 +229,7 @@ int xprt_reserve_xprt(struct rpc_task *task); | |||
229 | int xprt_reserve_xprt_cong(struct rpc_task *task); | 229 | int xprt_reserve_xprt_cong(struct rpc_task *task); |
230 | int xprt_prepare_transmit(struct rpc_task *task); | 230 | int xprt_prepare_transmit(struct rpc_task *task); |
231 | void xprt_transmit(struct rpc_task *task); | 231 | void xprt_transmit(struct rpc_task *task); |
232 | void xprt_abort_transmit(struct rpc_task *task); | 232 | void xprt_end_transmit(struct rpc_task *task); |
233 | int xprt_adjust_timeout(struct rpc_rqst *req); | 233 | int xprt_adjust_timeout(struct rpc_rqst *req); |
234 | void xprt_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task); | 234 | void xprt_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task); |
235 | void xprt_release_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task); | 235 | void xprt_release_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task); |
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 1ab806c47514..2d9b1b60798a 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h | |||
@@ -41,23 +41,23 @@ DECLARE_PER_CPU(struct vm_event_state, vm_event_states); | |||
41 | 41 | ||
42 | static inline void __count_vm_event(enum vm_event_item item) | 42 | static inline void __count_vm_event(enum vm_event_item item) |
43 | { | 43 | { |
44 | __get_cpu_var(vm_event_states.event[item])++; | 44 | __get_cpu_var(vm_event_states).event[item]++; |
45 | } | 45 | } |
46 | 46 | ||
47 | static inline void count_vm_event(enum vm_event_item item) | 47 | static inline void count_vm_event(enum vm_event_item item) |
48 | { | 48 | { |
49 | get_cpu_var(vm_event_states.event[item])++; | 49 | get_cpu_var(vm_event_states).event[item]++; |
50 | put_cpu(); | 50 | put_cpu(); |
51 | } | 51 | } |
52 | 52 | ||
53 | static inline void __count_vm_events(enum vm_event_item item, long delta) | 53 | static inline void __count_vm_events(enum vm_event_item item, long delta) |
54 | { | 54 | { |
55 | __get_cpu_var(vm_event_states.event[item]) += delta; | 55 | __get_cpu_var(vm_event_states).event[item] += delta; |
56 | } | 56 | } |
57 | 57 | ||
58 | static inline void count_vm_events(enum vm_event_item item, long delta) | 58 | static inline void count_vm_events(enum vm_event_item item, long delta) |
59 | { | 59 | { |
60 | get_cpu_var(vm_event_states.event[item]) += delta; | 60 | get_cpu_var(vm_event_states).event[item] += delta; |
61 | put_cpu(); | 61 | put_cpu(); |
62 | } | 62 | } |
63 | 63 | ||
diff --git a/include/net/red.h b/include/net/red.h index 5ccdbb3d4722..a4eb37946f2c 100644 --- a/include/net/red.h +++ b/include/net/red.h | |||
@@ -212,7 +212,7 @@ static inline unsigned long red_calc_qavg_from_idle_time(struct red_parms *p) | |||
212 | * Seems, it is the best solution to | 212 | * Seems, it is the best solution to |
213 | * problem of too coarse exponent tabulation. | 213 | * problem of too coarse exponent tabulation. |
214 | */ | 214 | */ |
215 | us_idle = (p->qavg * us_idle) >> p->Scell_log; | 215 | us_idle = (p->qavg * (u64)us_idle) >> p->Scell_log; |
216 | 216 | ||
217 | if (us_idle < (p->qavg >> 1)) | 217 | if (us_idle < (p->qavg >> 1)) |
218 | return p->qavg - us_idle; | 218 | return p->qavg - us_idle; |
diff --git a/kernel/fork.c b/kernel/fork.c index 1b0f7b1e0881..aa36c43783cc 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -1387,8 +1387,10 @@ long do_fork(unsigned long clone_flags, | |||
1387 | 1387 | ||
1388 | if (clone_flags & CLONE_VFORK) { | 1388 | if (clone_flags & CLONE_VFORK) { |
1389 | wait_for_completion(&vfork); | 1389 | wait_for_completion(&vfork); |
1390 | if (unlikely (current->ptrace & PT_TRACE_VFORK_DONE)) | 1390 | if (unlikely (current->ptrace & PT_TRACE_VFORK_DONE)) { |
1391 | current->ptrace_message = nr; | ||
1391 | ptrace_notify ((PTRACE_EVENT_VFORK_DONE << 8) | SIGTRAP); | 1392 | ptrace_notify ((PTRACE_EVENT_VFORK_DONE << 8) | SIGTRAP); |
1393 | } | ||
1392 | } | 1394 | } |
1393 | } else { | 1395 | } else { |
1394 | free_pid(pid); | 1396 | free_pid(pid); |
diff --git a/kernel/futex.c b/kernel/futex.c index dda2049692a2..c2b2e0b83abf 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -948,6 +948,7 @@ static int unqueue_me(struct futex_q *q) | |||
948 | /* In the common case we don't take the spinlock, which is nice. */ | 948 | /* In the common case we don't take the spinlock, which is nice. */ |
949 | retry: | 949 | retry: |
950 | lock_ptr = q->lock_ptr; | 950 | lock_ptr = q->lock_ptr; |
951 | barrier(); | ||
951 | if (lock_ptr != 0) { | 952 | if (lock_ptr != 0) { |
952 | spin_lock(lock_ptr); | 953 | spin_lock(lock_ptr); |
953 | /* | 954 | /* |
diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c index d1aab1a452cc..c5cca3f65cb7 100644 --- a/kernel/futex_compat.c +++ b/kernel/futex_compat.c | |||
@@ -39,7 +39,7 @@ void compat_exit_robust_list(struct task_struct *curr) | |||
39 | { | 39 | { |
40 | struct compat_robust_list_head __user *head = curr->compat_robust_list; | 40 | struct compat_robust_list_head __user *head = curr->compat_robust_list; |
41 | struct robust_list __user *entry, *pending; | 41 | struct robust_list __user *entry, *pending; |
42 | unsigned int limit = ROBUST_LIST_LIMIT, pi; | 42 | unsigned int limit = ROBUST_LIST_LIMIT, pi, pip; |
43 | compat_uptr_t uentry, upending; | 43 | compat_uptr_t uentry, upending; |
44 | compat_long_t futex_offset; | 44 | compat_long_t futex_offset; |
45 | 45 | ||
@@ -59,10 +59,10 @@ void compat_exit_robust_list(struct task_struct *curr) | |||
59 | * if it exists: | 59 | * if it exists: |
60 | */ | 60 | */ |
61 | if (fetch_robust_entry(&upending, &pending, | 61 | if (fetch_robust_entry(&upending, &pending, |
62 | &head->list_op_pending, &pi)) | 62 | &head->list_op_pending, &pip)) |
63 | return; | 63 | return; |
64 | if (upending) | 64 | if (upending) |
65 | handle_futex_death((void *)pending + futex_offset, curr, pi); | 65 | handle_futex_death((void *)pending + futex_offset, curr, pip); |
66 | 66 | ||
67 | while (compat_ptr(uentry) != &head->list) { | 67 | while (compat_ptr(uentry) != &head->list) { |
68 | /* | 68 | /* |
diff --git a/kernel/power/process.c b/kernel/power/process.c index b2a5f671d6cd..72e72d2c61e6 100644 --- a/kernel/power/process.c +++ b/kernel/power/process.c | |||
@@ -66,13 +66,25 @@ static inline void freeze_process(struct task_struct *p) | |||
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | static void cancel_freezing(struct task_struct *p) | ||
70 | { | ||
71 | unsigned long flags; | ||
72 | |||
73 | if (freezing(p)) { | ||
74 | pr_debug(" clean up: %s\n", p->comm); | ||
75 | do_not_freeze(p); | ||
76 | spin_lock_irqsave(&p->sighand->siglock, flags); | ||
77 | recalc_sigpending_tsk(p); | ||
78 | spin_unlock_irqrestore(&p->sighand->siglock, flags); | ||
79 | } | ||
80 | } | ||
81 | |||
69 | /* 0 = success, else # of processes that we failed to stop */ | 82 | /* 0 = success, else # of processes that we failed to stop */ |
70 | int freeze_processes(void) | 83 | int freeze_processes(void) |
71 | { | 84 | { |
72 | int todo, nr_user, user_frozen; | 85 | int todo, nr_user, user_frozen; |
73 | unsigned long start_time; | 86 | unsigned long start_time; |
74 | struct task_struct *g, *p; | 87 | struct task_struct *g, *p; |
75 | unsigned long flags; | ||
76 | 88 | ||
77 | printk( "Stopping tasks: " ); | 89 | printk( "Stopping tasks: " ); |
78 | start_time = jiffies; | 90 | start_time = jiffies; |
@@ -85,6 +97,10 @@ int freeze_processes(void) | |||
85 | continue; | 97 | continue; |
86 | if (frozen(p)) | 98 | if (frozen(p)) |
87 | continue; | 99 | continue; |
100 | if (p->state == TASK_TRACED && frozen(p->parent)) { | ||
101 | cancel_freezing(p); | ||
102 | continue; | ||
103 | } | ||
88 | if (p->mm && !(p->flags & PF_BORROWED_MM)) { | 104 | if (p->mm && !(p->flags & PF_BORROWED_MM)) { |
89 | /* The task is a user-space one. | 105 | /* The task is a user-space one. |
90 | * Freeze it unless there's a vfork completion | 106 | * Freeze it unless there's a vfork completion |
@@ -126,13 +142,7 @@ int freeze_processes(void) | |||
126 | do_each_thread(g, p) { | 142 | do_each_thread(g, p) { |
127 | if (freezeable(p) && !frozen(p)) | 143 | if (freezeable(p) && !frozen(p)) |
128 | printk(KERN_ERR " %s\n", p->comm); | 144 | printk(KERN_ERR " %s\n", p->comm); |
129 | if (freezing(p)) { | 145 | cancel_freezing(p); |
130 | pr_debug(" clean up: %s\n", p->comm); | ||
131 | p->flags &= ~PF_FREEZE; | ||
132 | spin_lock_irqsave(&p->sighand->siglock, flags); | ||
133 | recalc_sigpending_tsk(p); | ||
134 | spin_unlock_irqrestore(&p->sighand->siglock, flags); | ||
135 | } | ||
136 | } while_each_thread(g, p); | 146 | } while_each_thread(g, p); |
137 | read_unlock(&tasklist_lock); | 147 | read_unlock(&tasklist_lock); |
138 | return todo; | 148 | return todo; |
diff --git a/kernel/printk.c b/kernel/printk.c index 65ca0688f86f..1149365e989e 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -799,6 +799,9 @@ void release_console_sem(void) | |||
799 | up(&secondary_console_sem); | 799 | up(&secondary_console_sem); |
800 | return; | 800 | return; |
801 | } | 801 | } |
802 | |||
803 | console_may_schedule = 0; | ||
804 | |||
802 | for ( ; ; ) { | 805 | for ( ; ; ) { |
803 | spin_lock_irqsave(&logbuf_lock, flags); | 806 | spin_lock_irqsave(&logbuf_lock, flags); |
804 | wake_klogd |= log_start - log_end; | 807 | wake_klogd |= log_start - log_end; |
@@ -812,7 +815,6 @@ void release_console_sem(void) | |||
812 | local_irq_restore(flags); | 815 | local_irq_restore(flags); |
813 | } | 816 | } |
814 | console_locked = 0; | 817 | console_locked = 0; |
815 | console_may_schedule = 0; | ||
816 | up(&console_sem); | 818 | up(&console_sem); |
817 | spin_unlock_irqrestore(&logbuf_lock, flags); | 819 | spin_unlock_irqrestore(&logbuf_lock, flags); |
818 | if (wake_klogd && !oops_in_progress && waitqueue_active(&log_wait)) { | 820 | if (wake_klogd && !oops_in_progress && waitqueue_active(&log_wait)) { |
diff --git a/kernel/resource.c b/kernel/resource.c index 0dd3a857579e..46286434af80 100644 --- a/kernel/resource.c +++ b/kernel/resource.c | |||
@@ -244,6 +244,7 @@ int find_next_system_ram(struct resource *res) | |||
244 | 244 | ||
245 | start = res->start; | 245 | start = res->start; |
246 | end = res->end; | 246 | end = res->end; |
247 | BUG_ON(start >= end); | ||
247 | 248 | ||
248 | read_lock(&resource_lock); | 249 | read_lock(&resource_lock); |
249 | for (p = iomem_resource.child; p ; p = p->sibling) { | 250 | for (p = iomem_resource.child; p ; p = p->sibling) { |
@@ -254,15 +255,17 @@ int find_next_system_ram(struct resource *res) | |||
254 | p = NULL; | 255 | p = NULL; |
255 | break; | 256 | break; |
256 | } | 257 | } |
257 | if (p->start >= start) | 258 | if ((p->end >= start) && (p->start < end)) |
258 | break; | 259 | break; |
259 | } | 260 | } |
260 | read_unlock(&resource_lock); | 261 | read_unlock(&resource_lock); |
261 | if (!p) | 262 | if (!p) |
262 | return -1; | 263 | return -1; |
263 | /* copy data */ | 264 | /* copy data */ |
264 | res->start = p->start; | 265 | if (res->start < p->start) |
265 | res->end = p->end; | 266 | res->start = p->start; |
267 | if (res->end > p->end) | ||
268 | res->end = p->end; | ||
266 | return 0; | 269 | return 0; |
267 | } | 270 | } |
268 | #endif | 271 | #endif |
diff --git a/lib/spinlock_debug.c b/lib/spinlock_debug.c index 3d9c4dc965ed..58c577dd82e5 100644 --- a/lib/spinlock_debug.c +++ b/lib/spinlock_debug.c | |||
@@ -162,6 +162,7 @@ static void rwlock_bug(rwlock_t *lock, const char *msg) | |||
162 | 162 | ||
163 | #define RWLOCK_BUG_ON(cond, lock, msg) if (unlikely(cond)) rwlock_bug(lock, msg) | 163 | #define RWLOCK_BUG_ON(cond, lock, msg) if (unlikely(cond)) rwlock_bug(lock, msg) |
164 | 164 | ||
165 | #if 0 /* __write_lock_debug() can lock up - maybe this can too? */ | ||
165 | static void __read_lock_debug(rwlock_t *lock) | 166 | static void __read_lock_debug(rwlock_t *lock) |
166 | { | 167 | { |
167 | int print_once = 1; | 168 | int print_once = 1; |
@@ -184,12 +185,12 @@ static void __read_lock_debug(rwlock_t *lock) | |||
184 | } | 185 | } |
185 | } | 186 | } |
186 | } | 187 | } |
188 | #endif | ||
187 | 189 | ||
188 | void _raw_read_lock(rwlock_t *lock) | 190 | void _raw_read_lock(rwlock_t *lock) |
189 | { | 191 | { |
190 | RWLOCK_BUG_ON(lock->magic != RWLOCK_MAGIC, lock, "bad magic"); | 192 | RWLOCK_BUG_ON(lock->magic != RWLOCK_MAGIC, lock, "bad magic"); |
191 | if (unlikely(!__raw_read_trylock(&lock->raw_lock))) | 193 | __raw_read_lock(&lock->raw_lock); |
192 | __read_lock_debug(lock); | ||
193 | } | 194 | } |
194 | 195 | ||
195 | int _raw_read_trylock(rwlock_t *lock) | 196 | int _raw_read_trylock(rwlock_t *lock) |
@@ -235,6 +236,7 @@ static inline void debug_write_unlock(rwlock_t *lock) | |||
235 | lock->owner_cpu = -1; | 236 | lock->owner_cpu = -1; |
236 | } | 237 | } |
237 | 238 | ||
239 | #if 0 /* This can cause lockups */ | ||
238 | static void __write_lock_debug(rwlock_t *lock) | 240 | static void __write_lock_debug(rwlock_t *lock) |
239 | { | 241 | { |
240 | int print_once = 1; | 242 | int print_once = 1; |
@@ -257,12 +259,12 @@ static void __write_lock_debug(rwlock_t *lock) | |||
257 | } | 259 | } |
258 | } | 260 | } |
259 | } | 261 | } |
262 | #endif | ||
260 | 263 | ||
261 | void _raw_write_lock(rwlock_t *lock) | 264 | void _raw_write_lock(rwlock_t *lock) |
262 | { | 265 | { |
263 | debug_write_lock_before(lock); | 266 | debug_write_lock_before(lock); |
264 | if (unlikely(!__raw_write_trylock(&lock->raw_lock))) | 267 | __raw_write_lock(&lock->raw_lock); |
265 | __write_lock_debug(lock); | ||
266 | debug_write_lock_after(lock); | 268 | debug_write_lock_after(lock); |
267 | } | 269 | } |
268 | 270 | ||
diff --git a/mm/fadvise.c b/mm/fadvise.c index 60a5d55e51d9..168c78a121bb 100644 --- a/mm/fadvise.c +++ b/mm/fadvise.c | |||
@@ -73,7 +73,6 @@ asmlinkage long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice) | |||
73 | file->f_ra.ra_pages = bdi->ra_pages * 2; | 73 | file->f_ra.ra_pages = bdi->ra_pages * 2; |
74 | break; | 74 | break; |
75 | case POSIX_FADV_WILLNEED: | 75 | case POSIX_FADV_WILLNEED: |
76 | case POSIX_FADV_NOREUSE: | ||
77 | if (!mapping->a_ops->readpage) { | 76 | if (!mapping->a_ops->readpage) { |
78 | ret = -EINVAL; | 77 | ret = -EINVAL; |
79 | break; | 78 | break; |
@@ -94,6 +93,8 @@ asmlinkage long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice) | |||
94 | if (ret > 0) | 93 | if (ret > 0) |
95 | ret = 0; | 94 | ret = 0; |
96 | break; | 95 | break; |
96 | case POSIX_FADV_NOREUSE: | ||
97 | break; | ||
97 | case POSIX_FADV_DONTNEED: | 98 | case POSIX_FADV_DONTNEED: |
98 | if (!bdi_write_congested(mapping->backing_dev_info)) | 99 | if (!bdi_write_congested(mapping->backing_dev_info)) |
99 | filemap_flush(mapping); | 100 | filemap_flush(mapping); |
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 01c9fb97c619..c37319542b70 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -52,6 +52,9 @@ static int __add_section(struct zone *zone, unsigned long phys_start_pfn) | |||
52 | int nr_pages = PAGES_PER_SECTION; | 52 | int nr_pages = PAGES_PER_SECTION; |
53 | int ret; | 53 | int ret; |
54 | 54 | ||
55 | if (pfn_valid(phys_start_pfn)) | ||
56 | return -EEXIST; | ||
57 | |||
55 | ret = sparse_add_one_section(zone, phys_start_pfn, nr_pages); | 58 | ret = sparse_add_one_section(zone, phys_start_pfn, nr_pages); |
56 | 59 | ||
57 | if (ret < 0) | 60 | if (ret < 0) |
@@ -76,15 +79,22 @@ int __add_pages(struct zone *zone, unsigned long phys_start_pfn, | |||
76 | { | 79 | { |
77 | unsigned long i; | 80 | unsigned long i; |
78 | int err = 0; | 81 | int err = 0; |
82 | int start_sec, end_sec; | ||
83 | /* during initialize mem_map, align hot-added range to section */ | ||
84 | start_sec = pfn_to_section_nr(phys_start_pfn); | ||
85 | end_sec = pfn_to_section_nr(phys_start_pfn + nr_pages - 1); | ||
79 | 86 | ||
80 | for (i = 0; i < nr_pages; i += PAGES_PER_SECTION) { | 87 | for (i = start_sec; i <= end_sec; i++) { |
81 | err = __add_section(zone, phys_start_pfn + i); | 88 | err = __add_section(zone, i << PFN_SECTION_SHIFT); |
82 | 89 | ||
83 | /* We want to keep adding the rest of the | 90 | /* |
84 | * sections if the first ones already exist | 91 | * EEXIST is finally dealed with by ioresource collision |
92 | * check. see add_memory() => register_memory_resource() | ||
93 | * Warning will be printed if there is collision. | ||
85 | */ | 94 | */ |
86 | if (err && (err != -EEXIST)) | 95 | if (err && (err != -EEXIST)) |
87 | break; | 96 | break; |
97 | err = 0; | ||
88 | } | 98 | } |
89 | 99 | ||
90 | return err; | 100 | return err; |
@@ -156,7 +166,7 @@ int online_pages(unsigned long pfn, unsigned long nr_pages) | |||
156 | res.flags = IORESOURCE_MEM; /* we just need system ram */ | 166 | res.flags = IORESOURCE_MEM; /* we just need system ram */ |
157 | section_end = res.end; | 167 | section_end = res.end; |
158 | 168 | ||
159 | while (find_next_system_ram(&res) >= 0) { | 169 | while ((res.start < res.end) && (find_next_system_ram(&res) >= 0)) { |
160 | start_pfn = (unsigned long)(res.start >> PAGE_SHIFT); | 170 | start_pfn = (unsigned long)(res.start >> PAGE_SHIFT); |
161 | nr_pages = (unsigned long) | 171 | nr_pages = (unsigned long) |
162 | ((res.end + 1 - res.start) >> PAGE_SHIFT); | 172 | ((res.end + 1 - res.start) >> PAGE_SHIFT); |
@@ -213,10 +223,9 @@ static void rollback_node_hotadd(int nid, pg_data_t *pgdat) | |||
213 | } | 223 | } |
214 | 224 | ||
215 | /* add this memory to iomem resource */ | 225 | /* add this memory to iomem resource */ |
216 | static void register_memory_resource(u64 start, u64 size) | 226 | static struct resource *register_memory_resource(u64 start, u64 size) |
217 | { | 227 | { |
218 | struct resource *res; | 228 | struct resource *res; |
219 | |||
220 | res = kzalloc(sizeof(struct resource), GFP_KERNEL); | 229 | res = kzalloc(sizeof(struct resource), GFP_KERNEL); |
221 | BUG_ON(!res); | 230 | BUG_ON(!res); |
222 | 231 | ||
@@ -228,7 +237,18 @@ static void register_memory_resource(u64 start, u64 size) | |||
228 | printk("System RAM resource %llx - %llx cannot be added\n", | 237 | printk("System RAM resource %llx - %llx cannot be added\n", |
229 | (unsigned long long)res->start, (unsigned long long)res->end); | 238 | (unsigned long long)res->start, (unsigned long long)res->end); |
230 | kfree(res); | 239 | kfree(res); |
240 | res = NULL; | ||
231 | } | 241 | } |
242 | return res; | ||
243 | } | ||
244 | |||
245 | static void release_memory_resource(struct resource *res) | ||
246 | { | ||
247 | if (!res) | ||
248 | return; | ||
249 | release_resource(res); | ||
250 | kfree(res); | ||
251 | return; | ||
232 | } | 252 | } |
233 | 253 | ||
234 | 254 | ||
@@ -237,8 +257,13 @@ int add_memory(int nid, u64 start, u64 size) | |||
237 | { | 257 | { |
238 | pg_data_t *pgdat = NULL; | 258 | pg_data_t *pgdat = NULL; |
239 | int new_pgdat = 0; | 259 | int new_pgdat = 0; |
260 | struct resource *res; | ||
240 | int ret; | 261 | int ret; |
241 | 262 | ||
263 | res = register_memory_resource(start, size); | ||
264 | if (!res) | ||
265 | return -EEXIST; | ||
266 | |||
242 | if (!node_online(nid)) { | 267 | if (!node_online(nid)) { |
243 | pgdat = hotadd_new_pgdat(nid, start); | 268 | pgdat = hotadd_new_pgdat(nid, start); |
244 | if (!pgdat) | 269 | if (!pgdat) |
@@ -268,14 +293,13 @@ int add_memory(int nid, u64 start, u64 size) | |||
268 | BUG_ON(ret); | 293 | BUG_ON(ret); |
269 | } | 294 | } |
270 | 295 | ||
271 | /* register this memory as resource */ | ||
272 | register_memory_resource(start, size); | ||
273 | |||
274 | return ret; | 296 | return ret; |
275 | error: | 297 | error: |
276 | /* rollback pgdat allocation and others */ | 298 | /* rollback pgdat allocation and others */ |
277 | if (new_pgdat) | 299 | if (new_pgdat) |
278 | rollback_node_hotadd(nid, pgdat); | 300 | rollback_node_hotadd(nid, pgdat); |
301 | if (res) | ||
302 | release_memory_resource(res); | ||
279 | 303 | ||
280 | return ret; | 304 | return ret; |
281 | } | 305 | } |
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index 06abb6634f5b..53086fb75089 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c | |||
@@ -85,7 +85,7 @@ void br_ifinfo_notify(int event, struct net_bridge_port *port) | |||
85 | goto err_out; | 85 | goto err_out; |
86 | 86 | ||
87 | err = br_fill_ifinfo(skb, port, current->pid, 0, event, 0); | 87 | err = br_fill_ifinfo(skb, port, current->pid, 0, event, 0); |
88 | if (err) | 88 | if (err < 0) |
89 | goto err_kfree; | 89 | goto err_kfree; |
90 | 90 | ||
91 | NETLINK_CB(skb).dst_group = RTNLGRP_LINK; | 91 | NETLINK_CB(skb).dst_group = RTNLGRP_LINK; |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 738dad9f7d49..104af5d5bcbc 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -3541,7 +3541,8 @@ void tcp_cwnd_application_limited(struct sock *sk) | |||
3541 | if (inet_csk(sk)->icsk_ca_state == TCP_CA_Open && | 3541 | if (inet_csk(sk)->icsk_ca_state == TCP_CA_Open && |
3542 | sk->sk_socket && !test_bit(SOCK_NOSPACE, &sk->sk_socket->flags)) { | 3542 | sk->sk_socket && !test_bit(SOCK_NOSPACE, &sk->sk_socket->flags)) { |
3543 | /* Limited by application or receiver window. */ | 3543 | /* Limited by application or receiver window. */ |
3544 | u32 win_used = max(tp->snd_cwnd_used, 2U); | 3544 | u32 init_win = tcp_init_cwnd(tp, __sk_dst_get(sk)); |
3545 | u32 win_used = max(tp->snd_cwnd_used, init_win); | ||
3545 | if (win_used < tp->snd_cwnd) { | 3546 | if (win_used < tp->snd_cwnd) { |
3546 | tp->snd_ssthresh = tcp_current_ssthresh(sk); | 3547 | tp->snd_ssthresh = tcp_current_ssthresh(sk); |
3547 | tp->snd_cwnd = (tp->snd_cwnd + win_used) >> 1; | 3548 | tp->snd_cwnd = (tp->snd_cwnd + win_used) >> 1; |
diff --git a/net/lapb/lapb_iface.c b/net/lapb/lapb_iface.c index d504eed416f6..7e6bc41eeb21 100644 --- a/net/lapb/lapb_iface.c +++ b/net/lapb/lapb_iface.c | |||
@@ -238,11 +238,13 @@ int lapb_setparms(struct net_device *dev, struct lapb_parms_struct *parms) | |||
238 | goto out_put; | 238 | goto out_put; |
239 | 239 | ||
240 | if (lapb->state == LAPB_STATE_0) { | 240 | if (lapb->state == LAPB_STATE_0) { |
241 | if (((parms->mode & LAPB_EXTENDED) && | 241 | if (parms->mode & LAPB_EXTENDED) { |
242 | (parms->window < 1 || parms->window > 127)) || | 242 | if (parms->window < 1 || parms->window > 127) |
243 | (parms->window < 1 || parms->window > 7)) | 243 | goto out_put; |
244 | goto out_put; | 244 | } else { |
245 | 245 | if (parms->window < 1 || parms->window > 7) | |
246 | goto out_put; | ||
247 | } | ||
246 | lapb->mode = parms->mode; | 248 | lapb->mode = parms->mode; |
247 | lapb->window = parms->window; | 249 | lapb->window = parms->window; |
248 | } | 250 | } |
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c index d6cfe84d521b..2652ead96c64 100644 --- a/net/llc/af_llc.c +++ b/net/llc/af_llc.c | |||
@@ -784,24 +784,20 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
784 | copied += used; | 784 | copied += used; |
785 | len -= used; | 785 | len -= used; |
786 | 786 | ||
787 | if (used + offset < skb->len) | ||
788 | continue; | ||
789 | |||
790 | if (!(flags & MSG_PEEK)) { | 787 | if (!(flags & MSG_PEEK)) { |
791 | sk_eat_skb(sk, skb, 0); | 788 | sk_eat_skb(sk, skb, 0); |
792 | *seq = 0; | 789 | *seq = 0; |
793 | } | 790 | } |
791 | |||
792 | /* For non stream protcols we get one packet per recvmsg call */ | ||
793 | if (sk->sk_type != SOCK_STREAM) | ||
794 | goto copy_uaddr; | ||
795 | |||
796 | /* Partial read */ | ||
797 | if (used + offset < skb->len) | ||
798 | continue; | ||
794 | } while (len > 0); | 799 | } while (len > 0); |
795 | 800 | ||
796 | /* | ||
797 | * According to UNIX98, msg_name/msg_namelen are ignored | ||
798 | * on connected socket. -ANK | ||
799 | * But... af_llc still doesn't have separate sets of methods for | ||
800 | * SOCK_DGRAM and SOCK_STREAM :-( So we have to do this test, will | ||
801 | * eventually fix this tho :-) -acme | ||
802 | */ | ||
803 | if (sk->sk_type == SOCK_DGRAM) | ||
804 | goto copy_uaddr; | ||
805 | out: | 801 | out: |
806 | release_sock(sk); | 802 | release_sock(sk); |
807 | return copied; | 803 | return copied; |
diff --git a/net/llc/llc_sap.c b/net/llc/llc_sap.c index 20c4eb5c1ac6..42eb0c3a9780 100644 --- a/net/llc/llc_sap.c +++ b/net/llc/llc_sap.c | |||
@@ -51,10 +51,10 @@ void llc_save_primitive(struct sock *sk, struct sk_buff* skb, u8 prim) | |||
51 | { | 51 | { |
52 | struct sockaddr_llc *addr; | 52 | struct sockaddr_llc *addr; |
53 | 53 | ||
54 | if (skb->sk->sk_type == SOCK_STREAM) /* See UNIX98 */ | ||
55 | return; | ||
56 | /* save primitive for use by the user. */ | 54 | /* save primitive for use by the user. */ |
57 | addr = llc_ui_skb_cb(skb); | 55 | addr = llc_ui_skb_cb(skb); |
56 | |||
57 | memset(addr, 0, sizeof(*addr)); | ||
58 | addr->sllc_family = sk->sk_family; | 58 | addr->sllc_family = sk->sk_family; |
59 | addr->sllc_arphrd = skb->dev->type; | 59 | addr->sllc_arphrd = skb->dev->type; |
60 | addr->sllc_test = prim == LLC_TEST_PRIM; | 60 | addr->sllc_test = prim == LLC_TEST_PRIM; |
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index c7844bacbbcb..a19eff12cf78 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -430,7 +430,7 @@ qdisc_create(struct net_device *dev, u32 handle, struct rtattr **tca, int *errp) | |||
430 | } | 430 | } |
431 | #endif | 431 | #endif |
432 | 432 | ||
433 | err = -EINVAL; | 433 | err = -ENOENT; |
434 | if (ops == NULL) | 434 | if (ops == NULL) |
435 | goto err_out; | 435 | goto err_out; |
436 | 436 | ||
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 7026b0866b7b..00cb388ece03 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c | |||
@@ -71,7 +71,12 @@ struct cache_head *sunrpc_cache_lookup(struct cache_detail *detail, | |||
71 | new = detail->alloc(); | 71 | new = detail->alloc(); |
72 | if (!new) | 72 | if (!new) |
73 | return NULL; | 73 | return NULL; |
74 | /* must fully initialise 'new', else | ||
75 | * we might get lose if we need to | ||
76 | * cache_put it soon. | ||
77 | */ | ||
74 | cache_init(new); | 78 | cache_init(new); |
79 | detail->init(new, key); | ||
75 | 80 | ||
76 | write_lock(&detail->hash_lock); | 81 | write_lock(&detail->hash_lock); |
77 | 82 | ||
@@ -85,7 +90,6 @@ struct cache_head *sunrpc_cache_lookup(struct cache_detail *detail, | |||
85 | return tmp; | 90 | return tmp; |
86 | } | 91 | } |
87 | } | 92 | } |
88 | detail->init(new, key); | ||
89 | new->next = *head; | 93 | new->next = *head; |
90 | *head = new; | 94 | *head = new; |
91 | detail->entries++; | 95 | detail->entries++; |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 4ba271f892c8..d6409e757219 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -921,26 +921,43 @@ call_transmit(struct rpc_task *task) | |||
921 | task->tk_status = xprt_prepare_transmit(task); | 921 | task->tk_status = xprt_prepare_transmit(task); |
922 | if (task->tk_status != 0) | 922 | if (task->tk_status != 0) |
923 | return; | 923 | return; |
924 | task->tk_action = call_transmit_status; | ||
924 | /* Encode here so that rpcsec_gss can use correct sequence number. */ | 925 | /* Encode here so that rpcsec_gss can use correct sequence number. */ |
925 | if (rpc_task_need_encode(task)) { | 926 | if (rpc_task_need_encode(task)) { |
926 | task->tk_rqstp->rq_bytes_sent = 0; | 927 | BUG_ON(task->tk_rqstp->rq_bytes_sent != 0); |
927 | call_encode(task); | 928 | call_encode(task); |
928 | /* Did the encode result in an error condition? */ | 929 | /* Did the encode result in an error condition? */ |
929 | if (task->tk_status != 0) | 930 | if (task->tk_status != 0) |
930 | goto out_nosend; | 931 | return; |
931 | } | 932 | } |
932 | task->tk_action = call_transmit_status; | ||
933 | xprt_transmit(task); | 933 | xprt_transmit(task); |
934 | if (task->tk_status < 0) | 934 | if (task->tk_status < 0) |
935 | return; | 935 | return; |
936 | if (!task->tk_msg.rpc_proc->p_decode) { | 936 | /* |
937 | task->tk_action = rpc_exit_task; | 937 | * On success, ensure that we call xprt_end_transmit() before sleeping |
938 | rpc_wake_up_task(task); | 938 | * in order to allow access to the socket to other RPC requests. |
939 | } | 939 | */ |
940 | return; | 940 | call_transmit_status(task); |
941 | out_nosend: | 941 | if (task->tk_msg.rpc_proc->p_decode != NULL) |
942 | /* release socket write lock before attempting to handle error */ | 942 | return; |
943 | xprt_abort_transmit(task); | 943 | task->tk_action = rpc_exit_task; |
944 | rpc_wake_up_task(task); | ||
945 | } | ||
946 | |||
947 | /* | ||
948 | * 5a. Handle cleanup after a transmission | ||
949 | */ | ||
950 | static void | ||
951 | call_transmit_status(struct rpc_task *task) | ||
952 | { | ||
953 | task->tk_action = call_status; | ||
954 | /* | ||
955 | * Special case: if we've been waiting on the socket's write_space() | ||
956 | * callback, then don't call xprt_end_transmit(). | ||
957 | */ | ||
958 | if (task->tk_status == -EAGAIN) | ||
959 | return; | ||
960 | xprt_end_transmit(task); | ||
944 | rpc_task_force_reencode(task); | 961 | rpc_task_force_reencode(task); |
945 | } | 962 | } |
946 | 963 | ||
@@ -992,18 +1009,7 @@ call_status(struct rpc_task *task) | |||
992 | } | 1009 | } |
993 | 1010 | ||
994 | /* | 1011 | /* |
995 | * 6a. Handle transmission errors. | 1012 | * 6a. Handle RPC timeout |
996 | */ | ||
997 | static void | ||
998 | call_transmit_status(struct rpc_task *task) | ||
999 | { | ||
1000 | if (task->tk_status != -EAGAIN) | ||
1001 | rpc_task_force_reencode(task); | ||
1002 | call_status(task); | ||
1003 | } | ||
1004 | |||
1005 | /* | ||
1006 | * 6b. Handle RPC timeout | ||
1007 | * We do not release the request slot, so we keep using the | 1013 | * We do not release the request slot, so we keep using the |
1008 | * same XID for all retransmits. | 1014 | * same XID for all retransmits. |
1009 | */ | 1015 | */ |
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index dc6cb93c8830..a3bd2db2e024 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
@@ -667,10 +667,11 @@ rpc_mkdir(char *path, struct rpc_clnt *rpc_client) | |||
667 | RPCAUTH_info, RPCAUTH_EOF); | 667 | RPCAUTH_info, RPCAUTH_EOF); |
668 | if (error) | 668 | if (error) |
669 | goto err_depopulate; | 669 | goto err_depopulate; |
670 | dget(dentry); | ||
670 | out: | 671 | out: |
671 | mutex_unlock(&dir->i_mutex); | 672 | mutex_unlock(&dir->i_mutex); |
672 | rpc_release_path(&nd); | 673 | rpc_release_path(&nd); |
673 | return dget(dentry); | 674 | return dentry; |
674 | err_depopulate: | 675 | err_depopulate: |
675 | rpc_depopulate(dentry); | 676 | rpc_depopulate(dentry); |
676 | __rpc_rmdir(dir, dentry); | 677 | __rpc_rmdir(dir, dentry); |
@@ -731,10 +732,11 @@ rpc_mkpipe(char *path, void *private, struct rpc_pipe_ops *ops, int flags) | |||
731 | rpci->flags = flags; | 732 | rpci->flags = flags; |
732 | rpci->ops = ops; | 733 | rpci->ops = ops; |
733 | inode_dir_notify(dir, DN_CREATE); | 734 | inode_dir_notify(dir, DN_CREATE); |
735 | dget(dentry); | ||
734 | out: | 736 | out: |
735 | mutex_unlock(&dir->i_mutex); | 737 | mutex_unlock(&dir->i_mutex); |
736 | rpc_release_path(&nd); | 738 | rpc_release_path(&nd); |
737 | return dget(dentry); | 739 | return dentry; |
738 | err_dput: | 740 | err_dput: |
739 | dput(dentry); | 741 | dput(dentry); |
740 | dentry = ERR_PTR(-ENOMEM); | 742 | dentry = ERR_PTR(-ENOMEM); |
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 313b68d892c6..e8c2bc4977f3 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
@@ -707,12 +707,9 @@ out_unlock: | |||
707 | return err; | 707 | return err; |
708 | } | 708 | } |
709 | 709 | ||
710 | void | 710 | void xprt_end_transmit(struct rpc_task *task) |
711 | xprt_abort_transmit(struct rpc_task *task) | ||
712 | { | 711 | { |
713 | struct rpc_xprt *xprt = task->tk_xprt; | 712 | xprt_release_write(task->tk_xprt, task); |
714 | |||
715 | xprt_release_write(xprt, task); | ||
716 | } | 713 | } |
717 | 714 | ||
718 | /** | 715 | /** |
@@ -761,8 +758,6 @@ void xprt_transmit(struct rpc_task *task) | |||
761 | task->tk_status = -ENOTCONN; | 758 | task->tk_status = -ENOTCONN; |
762 | else if (!req->rq_received) | 759 | else if (!req->rq_received) |
763 | rpc_sleep_on(&xprt->pending, task, NULL, xprt_timer); | 760 | rpc_sleep_on(&xprt->pending, task, NULL, xprt_timer); |
764 | |||
765 | xprt->ops->release_xprt(xprt, task); | ||
766 | spin_unlock_bh(&xprt->transport_lock); | 761 | spin_unlock_bh(&xprt->transport_lock); |
767 | return; | 762 | return; |
768 | } | 763 | } |
@@ -772,18 +767,8 @@ void xprt_transmit(struct rpc_task *task) | |||
772 | * schedq, and being picked up by a parallel run of rpciod(). | 767 | * schedq, and being picked up by a parallel run of rpciod(). |
773 | */ | 768 | */ |
774 | task->tk_status = status; | 769 | task->tk_status = status; |
775 | 770 | if (status == -ECONNREFUSED) | |
776 | switch (status) { | ||
777 | case -ECONNREFUSED: | ||
778 | rpc_sleep_on(&xprt->sending, task, NULL, NULL); | 771 | rpc_sleep_on(&xprt->sending, task, NULL, NULL); |
779 | case -EAGAIN: | ||
780 | case -ENOTCONN: | ||
781 | return; | ||
782 | default: | ||
783 | break; | ||
784 | } | ||
785 | xprt_release_write(xprt, task); | ||
786 | return; | ||
787 | } | 772 | } |
788 | 773 | ||
789 | static inline void do_xprt_reserve(struct rpc_task *task) | 774 | static inline void do_xprt_reserve(struct rpc_task *task) |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index ee678ed13b6f..441bd53f5eca 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -414,6 +414,33 @@ static int xs_tcp_send_request(struct rpc_task *task) | |||
414 | } | 414 | } |
415 | 415 | ||
416 | /** | 416 | /** |
417 | * xs_tcp_release_xprt - clean up after a tcp transmission | ||
418 | * @xprt: transport | ||
419 | * @task: rpc task | ||
420 | * | ||
421 | * This cleans up if an error causes us to abort the transmission of a request. | ||
422 | * In this case, the socket may need to be reset in order to avoid confusing | ||
423 | * the server. | ||
424 | */ | ||
425 | static void xs_tcp_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task) | ||
426 | { | ||
427 | struct rpc_rqst *req; | ||
428 | |||
429 | if (task != xprt->snd_task) | ||
430 | return; | ||
431 | if (task == NULL) | ||
432 | goto out_release; | ||
433 | req = task->tk_rqstp; | ||
434 | if (req->rq_bytes_sent == 0) | ||
435 | goto out_release; | ||
436 | if (req->rq_bytes_sent == req->rq_snd_buf.len) | ||
437 | goto out_release; | ||
438 | set_bit(XPRT_CLOSE_WAIT, &task->tk_xprt->state); | ||
439 | out_release: | ||
440 | xprt_release_xprt(xprt, task); | ||
441 | } | ||
442 | |||
443 | /** | ||
417 | * xs_close - close a socket | 444 | * xs_close - close a socket |
418 | * @xprt: transport | 445 | * @xprt: transport |
419 | * | 446 | * |
@@ -1250,7 +1277,7 @@ static struct rpc_xprt_ops xs_udp_ops = { | |||
1250 | 1277 | ||
1251 | static struct rpc_xprt_ops xs_tcp_ops = { | 1278 | static struct rpc_xprt_ops xs_tcp_ops = { |
1252 | .reserve_xprt = xprt_reserve_xprt, | 1279 | .reserve_xprt = xprt_reserve_xprt, |
1253 | .release_xprt = xprt_release_xprt, | 1280 | .release_xprt = xs_tcp_release_xprt, |
1254 | .set_port = xs_set_port, | 1281 | .set_port = xs_set_port, |
1255 | .connect = xs_connect, | 1282 | .connect = xs_connect, |
1256 | .buf_alloc = rpc_malloc, | 1283 | .buf_alloc = rpc_malloc, |
diff --git a/sound/aoa/codecs/snd-aoa-codec-toonie.c b/sound/aoa/codecs/snd-aoa-codec-toonie.c index bcc555647e79..3c7d1d8a9a6f 100644 --- a/sound/aoa/codecs/snd-aoa-codec-toonie.c +++ b/sound/aoa/codecs/snd-aoa-codec-toonie.c | |||
@@ -51,6 +51,13 @@ static struct transfer_info toonie_transfers[] = { | |||
51 | {} | 51 | {} |
52 | }; | 52 | }; |
53 | 53 | ||
54 | static int toonie_usable(struct codec_info_item *cii, | ||
55 | struct transfer_info *ti, | ||
56 | struct transfer_info *out) | ||
57 | { | ||
58 | return 1; | ||
59 | } | ||
60 | |||
54 | #ifdef CONFIG_PM | 61 | #ifdef CONFIG_PM |
55 | static int toonie_suspend(struct codec_info_item *cii, pm_message_t state) | 62 | static int toonie_suspend(struct codec_info_item *cii, pm_message_t state) |
56 | { | 63 | { |
@@ -69,6 +76,7 @@ static struct codec_info toonie_codec_info = { | |||
69 | .sysclock_factor = 256, | 76 | .sysclock_factor = 256, |
70 | .bus_factor = 64, | 77 | .bus_factor = 64, |
71 | .owner = THIS_MODULE, | 78 | .owner = THIS_MODULE, |
79 | .usable = toonie_usable, | ||
72 | #ifdef CONFIG_PM | 80 | #ifdef CONFIG_PM |
73 | .suspend = toonie_suspend, | 81 | .suspend = toonie_suspend, |
74 | .resume = toonie_resume, | 82 | .resume = toonie_resume, |
@@ -79,19 +87,20 @@ static int toonie_init_codec(struct aoa_codec *codec) | |||
79 | { | 87 | { |
80 | struct toonie *toonie = codec_to_toonie(codec); | 88 | struct toonie *toonie = codec_to_toonie(codec); |
81 | 89 | ||
90 | /* nothing connected? what a joke! */ | ||
91 | if (toonie->codec.connected != 1) | ||
92 | return -ENOTCONN; | ||
93 | |||
82 | if (aoa_snd_device_new(SNDRV_DEV_LOWLEVEL, toonie, &ops)) { | 94 | if (aoa_snd_device_new(SNDRV_DEV_LOWLEVEL, toonie, &ops)) { |
83 | printk(KERN_ERR PFX "failed to create toonie snd device!\n"); | 95 | printk(KERN_ERR PFX "failed to create toonie snd device!\n"); |
84 | return -ENODEV; | 96 | return -ENODEV; |
85 | } | 97 | } |
86 | 98 | ||
87 | /* nothing connected? what a joke! */ | ||
88 | if (toonie->codec.connected != 1) | ||
89 | return -ENOTCONN; | ||
90 | |||
91 | if (toonie->codec.soundbus_dev->attach_codec(toonie->codec.soundbus_dev, | 99 | if (toonie->codec.soundbus_dev->attach_codec(toonie->codec.soundbus_dev, |
92 | aoa_get_card(), | 100 | aoa_get_card(), |
93 | &toonie_codec_info, toonie)) { | 101 | &toonie_codec_info, toonie)) { |
94 | printk(KERN_ERR PFX "error creating toonie pcm\n"); | 102 | printk(KERN_ERR PFX "error creating toonie pcm\n"); |
103 | snd_device_free(aoa_get_card(), toonie); | ||
95 | return -ENODEV; | 104 | return -ENODEV; |
96 | } | 105 | } |
97 | 106 | ||
diff --git a/sound/aoa/core/snd-aoa-gpio-feature.c b/sound/aoa/core/snd-aoa-gpio-feature.c index 7ae0c0bdfad8..f69d33357a28 100644 --- a/sound/aoa/core/snd-aoa-gpio-feature.c +++ b/sound/aoa/core/snd-aoa-gpio-feature.c | |||
@@ -112,7 +112,10 @@ static struct device_node *get_gpio(char *name, | |||
112 | 112 | ||
113 | static void get_irq(struct device_node * np, int *irqptr) | 113 | static void get_irq(struct device_node * np, int *irqptr) |
114 | { | 114 | { |
115 | *irqptr = irq_of_parse_and_map(np, 0); | 115 | if (np) |
116 | *irqptr = irq_of_parse_and_map(np, 0); | ||
117 | else | ||
118 | *irqptr = NO_IRQ; | ||
116 | } | 119 | } |
117 | 120 | ||
118 | /* 0x4 is outenable, 0x1 is out, thus 4 or 5 */ | 121 | /* 0x4 is outenable, 0x1 is out, thus 4 or 5 */ |
@@ -322,7 +325,7 @@ static int ftr_set_notify(struct gpio_runtime *rt, | |||
322 | return -EINVAL; | 325 | return -EINVAL; |
323 | } | 326 | } |
324 | 327 | ||
325 | if (irq == -1) | 328 | if (irq == NO_IRQ) |
326 | return -ENODEV; | 329 | return -ENODEV; |
327 | 330 | ||
328 | mutex_lock(¬if->mutex); | 331 | mutex_lock(¬if->mutex); |
diff --git a/sound/aoa/core/snd-aoa-gpio-pmf.c b/sound/aoa/core/snd-aoa-gpio-pmf.c index 3d57fd1aec4b..2836c3218391 100644 --- a/sound/aoa/core/snd-aoa-gpio-pmf.c +++ b/sound/aoa/core/snd-aoa-gpio-pmf.c | |||
@@ -18,7 +18,7 @@ static void pmf_gpio_set_##name(struct gpio_runtime *rt, int on)\ | |||
18 | \ | 18 | \ |
19 | if (unlikely(!rt)) return; \ | 19 | if (unlikely(!rt)) return; \ |
20 | rc = pmf_call_function(rt->node, #name "-mute", &args); \ | 20 | rc = pmf_call_function(rt->node, #name "-mute", &args); \ |
21 | if (rc) \ | 21 | if (rc && rc != -ENODEV) \ |
22 | printk(KERN_WARNING "pmf_gpio_set_" #name \ | 22 | printk(KERN_WARNING "pmf_gpio_set_" #name \ |
23 | " failed, rc: %d\n", rc); \ | 23 | " failed, rc: %d\n", rc); \ |
24 | rt->implementation_private &= ~(1<<bit); \ | 24 | rt->implementation_private &= ~(1<<bit); \ |
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index 71b5080fa66d..75a9505c7445 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c | |||
@@ -988,13 +988,12 @@ static int snd_mixer_oss_build_input(struct snd_mixer_oss *mixer, struct snd_mix | |||
988 | if (ptr->index == 0 && (kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0)) != NULL) { | 988 | if (ptr->index == 0 && (kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0)) != NULL) { |
989 | struct snd_ctl_elem_info *uinfo; | 989 | struct snd_ctl_elem_info *uinfo; |
990 | 990 | ||
991 | uinfo = kmalloc(sizeof(*uinfo), GFP_KERNEL); | 991 | uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL); |
992 | if (! uinfo) { | 992 | if (! uinfo) { |
993 | up_read(&mixer->card->controls_rwsem); | 993 | up_read(&mixer->card->controls_rwsem); |
994 | return -ENOMEM; | 994 | return -ENOMEM; |
995 | } | 995 | } |
996 | 996 | ||
997 | memset(uinfo, 0, sizeof(*uinfo)); | ||
998 | if (kctl->info(kctl, uinfo)) { | 997 | if (kctl->info(kctl, uinfo)) { |
999 | up_read(&mixer->card->controls_rwsem); | 998 | up_read(&mixer->card->controls_rwsem); |
1000 | return 0; | 999 | return 0; |
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index f5ff4f4a16ee..472fce0ee0e8 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c | |||
@@ -2228,6 +2228,8 @@ static int snd_pcm_oss_open_file(struct file *file, | |||
2228 | for (idx = 0; idx < 2; idx++) { | 2228 | for (idx = 0; idx < 2; idx++) { |
2229 | if (setup[idx].disable) | 2229 | if (setup[idx].disable) |
2230 | continue; | 2230 | continue; |
2231 | if (! pcm->streams[idx].substream_count) | ||
2232 | continue; /* no matching substream */ | ||
2231 | if (idx == SNDRV_PCM_STREAM_PLAYBACK) { | 2233 | if (idx == SNDRV_PCM_STREAM_PLAYBACK) { |
2232 | if (! (f_mode & FMODE_WRITE)) | 2234 | if (! (f_mode & FMODE_WRITE)) |
2233 | continue; | 2235 | continue; |
diff --git a/sound/core/seq/seq_device.c b/sound/core/seq/seq_device.c index 4260de90f36f..102ff548ce69 100644 --- a/sound/core/seq/seq_device.c +++ b/sound/core/seq/seq_device.c | |||
@@ -372,10 +372,9 @@ static struct ops_list * create_driver(char *id) | |||
372 | { | 372 | { |
373 | struct ops_list *ops; | 373 | struct ops_list *ops; |
374 | 374 | ||
375 | ops = kmalloc(sizeof(*ops), GFP_KERNEL); | 375 | ops = kzalloc(sizeof(*ops), GFP_KERNEL); |
376 | if (ops == NULL) | 376 | if (ops == NULL) |
377 | return ops; | 377 | return ops; |
378 | memset(ops, 0, sizeof(*ops)); | ||
379 | 378 | ||
380 | /* set up driver entry */ | 379 | /* set up driver entry */ |
381 | strlcpy(ops->id, id, sizeof(ops->id)); | 380 | strlcpy(ops->id, id, sizeof(ops->id)); |
diff --git a/sound/core/sgbuf.c b/sound/core/sgbuf.c index 6e4d4ab34632..c30669f14ac0 100644 --- a/sound/core/sgbuf.c +++ b/sound/core/sgbuf.c | |||
@@ -68,21 +68,18 @@ void *snd_malloc_sgbuf_pages(struct device *device, | |||
68 | 68 | ||
69 | dmab->area = NULL; | 69 | dmab->area = NULL; |
70 | dmab->addr = 0; | 70 | dmab->addr = 0; |
71 | dmab->private_data = sgbuf = kmalloc(sizeof(*sgbuf), GFP_KERNEL); | 71 | dmab->private_data = sgbuf = kzalloc(sizeof(*sgbuf), GFP_KERNEL); |
72 | if (! sgbuf) | 72 | if (! sgbuf) |
73 | return NULL; | 73 | return NULL; |
74 | memset(sgbuf, 0, sizeof(*sgbuf)); | ||
75 | sgbuf->dev = device; | 74 | sgbuf->dev = device; |
76 | pages = snd_sgbuf_aligned_pages(size); | 75 | pages = snd_sgbuf_aligned_pages(size); |
77 | sgbuf->tblsize = sgbuf_align_table(pages); | 76 | sgbuf->tblsize = sgbuf_align_table(pages); |
78 | sgbuf->table = kmalloc(sizeof(*sgbuf->table) * sgbuf->tblsize, GFP_KERNEL); | 77 | sgbuf->table = kcalloc(sgbuf->tblsize, sizeof(*sgbuf->table), GFP_KERNEL); |
79 | if (! sgbuf->table) | 78 | if (! sgbuf->table) |
80 | goto _failed; | 79 | goto _failed; |
81 | memset(sgbuf->table, 0, sizeof(*sgbuf->table) * sgbuf->tblsize); | 80 | sgbuf->page_table = kcalloc(sgbuf->tblsize, sizeof(*sgbuf->page_table), GFP_KERNEL); |
82 | sgbuf->page_table = kmalloc(sizeof(*sgbuf->page_table) * sgbuf->tblsize, GFP_KERNEL); | ||
83 | if (! sgbuf->page_table) | 81 | if (! sgbuf->page_table) |
84 | goto _failed; | 82 | goto _failed; |
85 | memset(sgbuf->page_table, 0, sizeof(*sgbuf->page_table) * sgbuf->tblsize); | ||
86 | 83 | ||
87 | /* allocate each page */ | 84 | /* allocate each page */ |
88 | for (i = 0; i < pages; i++) { | 85 | for (i = 0; i < pages; i++) { |
diff --git a/sound/drivers/vx/vx_pcm.c b/sound/drivers/vx/vx_pcm.c index c4af84995d05..7e65a103fbb2 100644 --- a/sound/drivers/vx/vx_pcm.c +++ b/sound/drivers/vx/vx_pcm.c | |||
@@ -1252,18 +1252,15 @@ static int vx_init_audio_io(struct vx_core *chip) | |||
1252 | chip->audio_info = rmh.Stat[1]; | 1252 | chip->audio_info = rmh.Stat[1]; |
1253 | 1253 | ||
1254 | /* allocate pipes */ | 1254 | /* allocate pipes */ |
1255 | chip->playback_pipes = kmalloc(sizeof(struct vx_pipe *) * chip->audio_outs, GFP_KERNEL); | 1255 | chip->playback_pipes = kcalloc(chip->audio_outs, sizeof(struct vx_pipe *), GFP_KERNEL); |
1256 | if (!chip->playback_pipes) | 1256 | if (!chip->playback_pipes) |
1257 | return -ENOMEM; | 1257 | return -ENOMEM; |
1258 | chip->capture_pipes = kmalloc(sizeof(struct vx_pipe *) * chip->audio_ins, GFP_KERNEL); | 1258 | chip->capture_pipes = kcalloc(chip->audio_ins, sizeof(struct vx_pipe *), GFP_KERNEL); |
1259 | if (!chip->capture_pipes) { | 1259 | if (!chip->capture_pipes) { |
1260 | kfree(chip->playback_pipes); | 1260 | kfree(chip->playback_pipes); |
1261 | return -ENOMEM; | 1261 | return -ENOMEM; |
1262 | } | 1262 | } |
1263 | 1263 | ||
1264 | memset(chip->playback_pipes, 0, sizeof(struct vx_pipe *) * chip->audio_outs); | ||
1265 | memset(chip->capture_pipes, 0, sizeof(struct vx_pipe *) * chip->audio_ins); | ||
1266 | |||
1267 | preferred = chip->ibl.size; | 1264 | preferred = chip->ibl.size; |
1268 | chip->ibl.size = 0; | 1265 | chip->ibl.size = 0; |
1269 | vx_set_ibl(chip, &chip->ibl); /* query the info */ | 1266 | vx_set_ibl(chip, &chip->ibl); /* query the info */ |
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index 27a8dbe6f6a8..c3dafa29054f 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c | |||
@@ -236,9 +236,9 @@ static int pcm_open(struct snd_pcm_substream *substream, | |||
236 | chip = snd_pcm_substream_chip(substream); | 236 | chip = snd_pcm_substream_chip(substream); |
237 | runtime = substream->runtime; | 237 | runtime = substream->runtime; |
238 | 238 | ||
239 | if (!(pipe = kmalloc(sizeof(struct audiopipe), GFP_KERNEL))) | 239 | pipe = kzalloc(sizeof(struct audiopipe), GFP_KERNEL); |
240 | if (!pipe) | ||
240 | return -ENOMEM; | 241 | return -ENOMEM; |
241 | memset(pipe, 0, sizeof(struct audiopipe)); | ||
242 | pipe->index = -1; /* Not configured yet */ | 242 | pipe->index = -1; /* Not configured yet */ |
243 | 243 | ||
244 | /* Set up hw capabilities and contraints */ | 244 | /* Set up hw capabilities and contraints */ |
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index f9b5c3dc3b34..79f24cdf5fbf 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c | |||
@@ -936,6 +936,17 @@ static struct snd_emu_chip_details emu_chip_details[] = { | |||
936 | .ca0151_chip = 1, | 936 | .ca0151_chip = 1, |
937 | .spk71 = 1, | 937 | .spk71 = 1, |
938 | .spdif_bug = 1} , | 938 | .spdif_bug = 1} , |
939 | /* Dell OEM/Creative Labs Audigy 2 ZS */ | ||
940 | /* See ALSA bug#1365 */ | ||
941 | {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10031102, | ||
942 | .driver = "Audigy2", .name = "Audigy 2 ZS [SB0353]", | ||
943 | .id = "Audigy2", | ||
944 | .emu10k2_chip = 1, | ||
945 | .ca0102_chip = 1, | ||
946 | .ca0151_chip = 1, | ||
947 | .spk71 = 1, | ||
948 | .spdif_bug = 1, | ||
949 | .ac97_chip = 1} , | ||
939 | {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10021102, | 950 | {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10021102, |
940 | .driver = "Audigy2", .name = "Audigy 2 Platinum [SB0240P]", | 951 | .driver = "Audigy2", .name = "Audigy 2 Platinum [SB0240P]", |
941 | .id = "Audigy2", | 952 | .id = "Audigy2", |
diff --git a/sound/pci/emu10k1/irq.c b/sound/pci/emu10k1/irq.c index a8b31286b6db..1076af4c3669 100644 --- a/sound/pci/emu10k1/irq.c +++ b/sound/pci/emu10k1/irq.c | |||
@@ -37,9 +37,13 @@ irqreturn_t snd_emu10k1_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
37 | int handled = 0; | 37 | int handled = 0; |
38 | 38 | ||
39 | while ((status = inl(emu->port + IPR)) != 0) { | 39 | while ((status = inl(emu->port + IPR)) != 0) { |
40 | //printk("emu10k1 irq - status = 0x%x\n", status); | 40 | //snd_printk(KERN_INFO "emu10k1 irq - status = 0x%x\n", status); |
41 | orig_status = status; | 41 | orig_status = status; |
42 | handled = 1; | 42 | handled = 1; |
43 | if ((status & 0xffffffff) == 0xffffffff) { | ||
44 | snd_printk(KERN_INFO "snd-emu10k1: Suspected sound card removal\n"); | ||
45 | break; | ||
46 | } | ||
43 | if (status & IPR_PCIERROR) { | 47 | if (status & IPR_PCIERROR) { |
44 | snd_printk(KERN_ERR "interrupt: PCI error\n"); | 48 | snd_printk(KERN_ERR "interrupt: PCI error\n"); |
45 | snd_emu10k1_intr_disable(emu, INTE_PCIERRORENABLE); | 49 | snd_emu10k1_intr_disable(emu, INTE_PCIERRORENABLE); |
diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c index 82d791be7499..05dabe454658 100644 --- a/sound/ppc/awacs.c +++ b/sound/ppc/awacs.c | |||
@@ -801,11 +801,10 @@ snd_pmac_awacs_init(struct snd_pmac *chip) | |||
801 | chip->revision = (in_le32(&chip->awacs->codec_stat) >> 12) & 0xf; | 801 | chip->revision = (in_le32(&chip->awacs->codec_stat) >> 12) & 0xf; |
802 | #ifdef PMAC_AMP_AVAIL | 802 | #ifdef PMAC_AMP_AVAIL |
803 | if (chip->revision == 3 && chip->has_iic && CHECK_CUDA_AMP()) { | 803 | if (chip->revision == 3 && chip->has_iic && CHECK_CUDA_AMP()) { |
804 | struct awacs_amp *amp = kmalloc(sizeof(*amp), GFP_KERNEL); | 804 | struct awacs_amp *amp = kzalloc(sizeof(*amp), GFP_KERNEL); |
805 | if (! amp) | 805 | if (! amp) |
806 | return -ENOMEM; | 806 | return -ENOMEM; |
807 | chip->mixer_data = amp; | 807 | chip->mixer_data = amp; |
808 | memset(amp, 0, sizeof(*amp)); | ||
809 | chip->mixer_free = awacs_amp_free; | 808 | chip->mixer_free = awacs_amp_free; |
810 | awacs_amp_set_vol(amp, 0, 63, 63, 0); /* mute and zero vol */ | 809 | awacs_amp_set_vol(amp, 0, 63, 63, 0); /* mute and zero vol */ |
811 | awacs_amp_set_vol(amp, 1, 63, 63, 0); | 810 | awacs_amp_set_vol(amp, 1, 63, 63, 0); |
diff --git a/sound/ppc/daca.c b/sound/ppc/daca.c index 46eebf5610e3..57202b0f033e 100644 --- a/sound/ppc/daca.c +++ b/sound/ppc/daca.c | |||
@@ -258,10 +258,9 @@ int __init snd_pmac_daca_init(struct snd_pmac *chip) | |||
258 | request_module("i2c-powermac"); | 258 | request_module("i2c-powermac"); |
259 | #endif /* CONFIG_KMOD */ | 259 | #endif /* CONFIG_KMOD */ |
260 | 260 | ||
261 | mix = kmalloc(sizeof(*mix), GFP_KERNEL); | 261 | mix = kzalloc(sizeof(*mix), GFP_KERNEL); |
262 | if (! mix) | 262 | if (! mix) |
263 | return -ENOMEM; | 263 | return -ENOMEM; |
264 | memset(mix, 0, sizeof(*mix)); | ||
265 | chip->mixer_data = mix; | 264 | chip->mixer_data = mix; |
266 | chip->mixer_free = daca_cleanup; | 265 | chip->mixer_free = daca_cleanup; |
267 | mix->amp_on = 1; /* default on */ | 266 | mix->amp_on = 1; /* default on */ |
diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c index fb05938dcbd9..59482a4cd446 100644 --- a/sound/ppc/keywest.c +++ b/sound/ppc/keywest.c | |||
@@ -64,11 +64,10 @@ static int keywest_attach_adapter(struct i2c_adapter *adapter) | |||
64 | if (strncmp(i2c_device_name(adapter), "mac-io", 6)) | 64 | if (strncmp(i2c_device_name(adapter), "mac-io", 6)) |
65 | return 0; /* ignored */ | 65 | return 0; /* ignored */ |
66 | 66 | ||
67 | new_client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 67 | new_client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
68 | if (! new_client) | 68 | if (! new_client) |
69 | return -ENOMEM; | 69 | return -ENOMEM; |
70 | 70 | ||
71 | memset(new_client, 0, sizeof(*new_client)); | ||
72 | new_client->addr = keywest_ctx->addr; | 71 | new_client->addr = keywest_ctx->addr; |
73 | i2c_set_clientdata(new_client, keywest_ctx); | 72 | i2c_set_clientdata(new_client, keywest_ctx); |
74 | new_client->adapter = adapter; | 73 | new_client->adapter = adapter; |
diff --git a/sound/ppc/powermac.c b/sound/ppc/powermac.c index fa9a44ab487e..2264574fa06b 100644 --- a/sound/ppc/powermac.c +++ b/sound/ppc/powermac.c | |||
@@ -181,21 +181,14 @@ static int __init alsa_card_pmac_init(void) | |||
181 | if ((err = platform_driver_register(&snd_pmac_driver)) < 0) | 181 | if ((err = platform_driver_register(&snd_pmac_driver)) < 0) |
182 | return err; | 182 | return err; |
183 | device = platform_device_register_simple(SND_PMAC_DRIVER, -1, NULL, 0); | 183 | device = platform_device_register_simple(SND_PMAC_DRIVER, -1, NULL, 0); |
184 | if (!IS_ERR(device)) { | 184 | return 0; |
185 | if (platform_get_drvdata(device)) | ||
186 | return 0; | ||
187 | platform_device_unregister(device); | ||
188 | err = -ENODEV; | ||
189 | } else | ||
190 | err = PTR_ERR(device); | ||
191 | platform_driver_unregister(&snd_pmac_driver); | ||
192 | return err; | ||
193 | 185 | ||
194 | } | 186 | } |
195 | 187 | ||
196 | static void __exit alsa_card_pmac_exit(void) | 188 | static void __exit alsa_card_pmac_exit(void) |
197 | { | 189 | { |
198 | platform_device_unregister(device); | 190 | if (!IS_ERR(device)) |
191 | platform_device_unregister(device); | ||
199 | platform_driver_unregister(&snd_pmac_driver); | 192 | platform_driver_unregister(&snd_pmac_driver); |
200 | } | 193 | } |
201 | 194 | ||
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c index 692c61177678..84f6b19c07ca 100644 --- a/sound/ppc/tumbler.c +++ b/sound/ppc/tumbler.c | |||
@@ -1316,10 +1316,9 @@ int __init snd_pmac_tumbler_init(struct snd_pmac *chip) | |||
1316 | request_module("i2c-powermac"); | 1316 | request_module("i2c-powermac"); |
1317 | #endif /* CONFIG_KMOD */ | 1317 | #endif /* CONFIG_KMOD */ |
1318 | 1318 | ||
1319 | mix = kmalloc(sizeof(*mix), GFP_KERNEL); | 1319 | mix = kzalloc(sizeof(*mix), GFP_KERNEL); |
1320 | if (! mix) | 1320 | if (! mix) |
1321 | return -ENOMEM; | 1321 | return -ENOMEM; |
1322 | memset(mix, 0, sizeof(*mix)); | ||
1323 | mix->headphone_irq = -1; | 1322 | mix->headphone_irq = -1; |
1324 | 1323 | ||
1325 | chip->mixer_data = mix; | 1324 | chip->mixer_data = mix; |
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index d32d83d970cc..1b7f499c549d 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -2260,10 +2260,9 @@ static int add_audio_endpoint(struct snd_usb_audio *chip, int stream, struct aud | |||
2260 | } | 2260 | } |
2261 | 2261 | ||
2262 | /* create a new pcm */ | 2262 | /* create a new pcm */ |
2263 | as = kmalloc(sizeof(*as), GFP_KERNEL); | 2263 | as = kzalloc(sizeof(*as), GFP_KERNEL); |
2264 | if (! as) | 2264 | if (! as) |
2265 | return -ENOMEM; | 2265 | return -ENOMEM; |
2266 | memset(as, 0, sizeof(*as)); | ||
2267 | as->pcm_index = chip->pcm_devs; | 2266 | as->pcm_index = chip->pcm_devs; |
2268 | as->chip = chip; | 2267 | as->chip = chip; |
2269 | as->fmt_type = fp->fmt_type; | 2268 | as->fmt_type = fp->fmt_type; |
@@ -2633,13 +2632,12 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) | |||
2633 | csep = NULL; | 2632 | csep = NULL; |
2634 | } | 2633 | } |
2635 | 2634 | ||
2636 | fp = kmalloc(sizeof(*fp), GFP_KERNEL); | 2635 | fp = kzalloc(sizeof(*fp), GFP_KERNEL); |
2637 | if (! fp) { | 2636 | if (! fp) { |
2638 | snd_printk(KERN_ERR "cannot malloc\n"); | 2637 | snd_printk(KERN_ERR "cannot malloc\n"); |
2639 | return -ENOMEM; | 2638 | return -ENOMEM; |
2640 | } | 2639 | } |
2641 | 2640 | ||
2642 | memset(fp, 0, sizeof(*fp)); | ||
2643 | fp->iface = iface_no; | 2641 | fp->iface = iface_no; |
2644 | fp->altsetting = altno; | 2642 | fp->altsetting = altno; |
2645 | fp->altset_idx = i; | 2643 | fp->altset_idx = i; |