Magellan Linux

Contents of /trunk/kernel26-magellan/patches-2.6.25-r5/0115-2.6.25.16-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 677 - (show annotations) (download)
Wed Sep 10 21:27:27 2008 UTC (15 years, 8 months ago) by niro
File size: 60934 byte(s)
2.6.25-magellan-r5:
- updated to linux-2.6.25.17

1 diff --git a/arch/sparc64/kernel/signal.c b/arch/sparc64/kernel/signal.c
2 index ec016cb..6165841 100644
3 --- a/arch/sparc64/kernel/signal.c
4 +++ b/arch/sparc64/kernel/signal.c
5 @@ -2,7 +2,7 @@
6 * arch/sparc64/kernel/signal.c
7 *
8 * Copyright (C) 1991, 1992 Linus Torvalds
9 - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
10 + * Copyright (C) 1995, 2008 David S. Miller (davem@davemloft.net)
11 * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx)
12 * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
13 * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
14 @@ -90,7 +90,9 @@ asmlinkage void sparc64_set_context(struct pt_regs *regs)
15 err |= __get_user(regs->u_regs[UREG_G4], (&(*grp)[MC_G4]));
16 err |= __get_user(regs->u_regs[UREG_G5], (&(*grp)[MC_G5]));
17 err |= __get_user(regs->u_regs[UREG_G6], (&(*grp)[MC_G6]));
18 - err |= __get_user(regs->u_regs[UREG_G7], (&(*grp)[MC_G7]));
19 +
20 + /* Skip %g7 as that's the thread register in userspace. */
21 +
22 err |= __get_user(regs->u_regs[UREG_I0], (&(*grp)[MC_O0]));
23 err |= __get_user(regs->u_regs[UREG_I1], (&(*grp)[MC_O1]));
24 err |= __get_user(regs->u_regs[UREG_I2], (&(*grp)[MC_O2]));
25 diff --git a/arch/um/Makefile b/arch/um/Makefile
26 index dbeab15..ca40397 100644
27 --- a/arch/um/Makefile
28 +++ b/arch/um/Makefile
29 @@ -77,7 +77,6 @@ include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS)
30 KERNEL_DEFINES = $(strip -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask \
31 -Dmktime=kernel_mktime $(ARCH_KERNEL_DEFINES))
32 KBUILD_CFLAGS += $(KERNEL_DEFINES)
33 -KBUILD_CFLAGS += $(call cc-option,-fno-unit-at-a-time,)
34
35 PHONY += linux
36
37 diff --git a/arch/um/Makefile-i386 b/arch/um/Makefile-i386
38 index 561e373..302cbe5 100644
39 --- a/arch/um/Makefile-i386
40 +++ b/arch/um/Makefile-i386
41 @@ -32,4 +32,11 @@ cflags-y += $(call cc-option,-mpreferred-stack-boundary=2)
42 # an unresolved reference.
43 cflags-y += -ffreestanding
44
45 +# Disable unit-at-a-time mode on pre-gcc-4.0 compilers, it makes gcc use
46 +# a lot more stack due to the lack of sharing of stacklots. Also, gcc
47 +# 4.3.0 needs -funit-at-a-time for extern inline functions.
48 +KBUILD_CFLAGS += $(shell if [ $(call cc-version) -lt 0400 ] ; then \
49 + echo $(call cc-option,-fno-unit-at-a-time); \
50 + else echo $(call cc-option,-funit-at-a-time); fi ;)
51 +
52 KBUILD_CFLAGS += $(cflags-y)
53 diff --git a/arch/um/Makefile-x86_64 b/arch/um/Makefile-x86_64
54 index 8ed362f..a9cd7e7 100644
55 --- a/arch/um/Makefile-x86_64
56 +++ b/arch/um/Makefile-x86_64
57 @@ -21,3 +21,6 @@ HEADER_ARCH := x86
58
59 LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib64
60 LINK-y += -m64
61 +
62 +# Do unit-at-a-time unconditionally on x86_64, following the host
63 +KBUILD_CFLAGS += $(call cc-option,-funit-at-a-time)
64 diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c
65 index 0257640..cfeb3f4 100644
66 --- a/arch/um/drivers/chan_user.c
67 +++ b/arch/um/drivers/chan_user.c
68 @@ -11,6 +11,7 @@
69 #include <termios.h>
70 #include <sys/ioctl.h>
71 #include "chan_user.h"
72 +#include "kern_constants.h"
73 #include "os.h"
74 #include "um_malloc.h"
75 #include "user.h"
76 diff --git a/arch/um/drivers/cow_sys.h b/arch/um/drivers/cow_sys.h
77 index ca8c9e1..f5701fd 100644
78 --- a/arch/um/drivers/cow_sys.h
79 +++ b/arch/um/drivers/cow_sys.h
80 @@ -8,7 +8,7 @@
81
82 static inline void *cow_malloc(int size)
83 {
84 - return kmalloc(size, UM_GFP_KERNEL);
85 + return uml_kmalloc(size, UM_GFP_KERNEL);
86 }
87
88 static inline void cow_free(void *ptr)
89 diff --git a/arch/um/drivers/daemon_user.c b/arch/um/drivers/daemon_user.c
90 index f23c109..f8e85e0 100644
91 --- a/arch/um/drivers/daemon_user.c
92 +++ b/arch/um/drivers/daemon_user.c
93 @@ -34,7 +34,7 @@ static struct sockaddr_un *new_addr(void *name, int len)
94 {
95 struct sockaddr_un *sun;
96
97 - sun = kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL);
98 + sun = uml_kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL);
99 if (sun == NULL) {
100 printk(UM_KERN_ERR "new_addr: allocation of sockaddr_un "
101 "failed\n");
102 @@ -83,7 +83,7 @@ static int connect_to_switch(struct daemon_data *pri)
103 goto out_close;
104 }
105
106 - sun = kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL);
107 + sun = uml_kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL);
108 if (sun == NULL) {
109 printk(UM_KERN_ERR "new_addr: allocation of sockaddr_un "
110 "failed\n");
111 diff --git a/arch/um/drivers/fd.c b/arch/um/drivers/fd.c
112 index 0a2bb5b..f5a981a 100644
113 --- a/arch/um/drivers/fd.c
114 +++ b/arch/um/drivers/fd.c
115 @@ -40,7 +40,7 @@ static void *fd_init(char *str, int device, const struct chan_opts *opts)
116 return NULL;
117 }
118
119 - data = kmalloc(sizeof(*data), UM_GFP_KERNEL);
120 + data = uml_kmalloc(sizeof(*data), UM_GFP_KERNEL);
121 if (data == NULL)
122 return NULL;
123
124 diff --git a/arch/um/drivers/mcast_user.c b/arch/um/drivers/mcast_user.c
125 index 5f647d7..ee19e91 100644
126 --- a/arch/um/drivers/mcast_user.c
127 +++ b/arch/um/drivers/mcast_user.c
128 @@ -15,6 +15,7 @@
129 #include <unistd.h>
130 #include <errno.h>
131 #include <netinet/in.h>
132 +#include "kern_constants.h"
133 #include "mcast.h"
134 #include "net_user.h"
135 #include "um_malloc.h"
136 @@ -24,7 +25,7 @@ static struct sockaddr_in *new_addr(char *addr, unsigned short port)
137 {
138 struct sockaddr_in *sin;
139
140 - sin = kmalloc(sizeof(struct sockaddr_in), UM_GFP_KERNEL);
141 + sin = uml_kmalloc(sizeof(struct sockaddr_in), UM_GFP_KERNEL);
142 if (sin == NULL) {
143 printk(UM_KERN_ERR "new_addr: allocation of sockaddr_in "
144 "failed\n");
145 diff --git a/arch/um/drivers/net_user.c b/arch/um/drivers/net_user.c
146 index abf2653..9415dd9 100644
147 --- a/arch/um/drivers/net_user.c
148 +++ b/arch/um/drivers/net_user.c
149 @@ -222,7 +222,7 @@ static void change(char *dev, char *what, unsigned char *addr,
150 netmask[2], netmask[3]);
151
152 output_len = UM_KERN_PAGE_SIZE;
153 - output = kmalloc(output_len, UM_GFP_KERNEL);
154 + output = uml_kmalloc(output_len, UM_GFP_KERNEL);
155 if (output == NULL)
156 printk(UM_KERN_ERR "change : failed to allocate output "
157 "buffer\n");
158 diff --git a/arch/um/drivers/pcap_user.c b/arch/um/drivers/pcap_user.c
159 index e980935..5f90358 100644
160 --- a/arch/um/drivers/pcap_user.c
161 +++ b/arch/um/drivers/pcap_user.c
162 @@ -50,7 +50,7 @@ static int pcap_open(void *data)
163 return -EIO;
164 }
165
166 - pri->compiled = kmalloc(sizeof(struct bpf_program),
167 + pri->compiled = uml_kmalloc(sizeof(struct bpf_program),
168 UM_GFP_KERNEL);
169 if (pri->compiled == NULL) {
170 printk(UM_KERN_ERR "pcap_open : kmalloc failed\n");
171 diff --git a/arch/um/drivers/port_user.c b/arch/um/drivers/port_user.c
172 index addd759..8a191f1 100644
173 --- a/arch/um/drivers/port_user.c
174 +++ b/arch/um/drivers/port_user.c
175 @@ -47,7 +47,7 @@ static void *port_init(char *str, int device, const struct chan_opts *opts)
176 if (kern_data == NULL)
177 return NULL;
178
179 - data = kmalloc(sizeof(*data), UM_GFP_KERNEL);
180 + data = uml_kmalloc(sizeof(*data), UM_GFP_KERNEL);
181 if (data == NULL)
182 goto err;
183
184 diff --git a/arch/um/drivers/pty.c b/arch/um/drivers/pty.c
185 index 49c79dd..1113911 100644
186 --- a/arch/um/drivers/pty.c
187 +++ b/arch/um/drivers/pty.c
188 @@ -29,7 +29,7 @@ static void *pty_chan_init(char *str, int device, const struct chan_opts *opts)
189 {
190 struct pty_chan *data;
191
192 - data = kmalloc(sizeof(*data), UM_GFP_KERNEL);
193 + data = uml_kmalloc(sizeof(*data), UM_GFP_KERNEL);
194 if (data == NULL)
195 return NULL;
196
197 diff --git a/arch/um/drivers/slip_user.c b/arch/um/drivers/slip_user.c
198 index 8b80505..a1c2d2c 100644
199 --- a/arch/um/drivers/slip_user.c
200 +++ b/arch/um/drivers/slip_user.c
201 @@ -96,7 +96,7 @@ static int slip_tramp(char **argv, int fd)
202 pid = err;
203
204 output_len = UM_KERN_PAGE_SIZE;
205 - output = kmalloc(output_len, UM_GFP_KERNEL);
206 + output = uml_kmalloc(output_len, UM_GFP_KERNEL);
207 if (output == NULL) {
208 printk(UM_KERN_ERR "slip_tramp : failed to allocate output "
209 "buffer\n");
210 diff --git a/arch/um/drivers/tty.c b/arch/um/drivers/tty.c
211 index c930fed..495858a 100644
212 --- a/arch/um/drivers/tty.c
213 +++ b/arch/um/drivers/tty.c
214 @@ -29,7 +29,7 @@ static void *tty_chan_init(char *str, int device, const struct chan_opts *opts)
215 }
216 str++;
217
218 - data = kmalloc(sizeof(*data), UM_GFP_KERNEL);
219 + data = uml_kmalloc(sizeof(*data), UM_GFP_KERNEL);
220 if (data == NULL)
221 return NULL;
222 *data = ((struct tty_chan) { .dev = str,
223 diff --git a/arch/um/drivers/xterm.c b/arch/um/drivers/xterm.c
224 index 8a1c18a..da2caa5 100644
225 --- a/arch/um/drivers/xterm.c
226 +++ b/arch/um/drivers/xterm.c
227 @@ -30,7 +30,7 @@ static void *xterm_init(char *str, int device, const struct chan_opts *opts)
228 {
229 struct xterm_chan *data;
230
231 - data = kmalloc(sizeof(*data), UM_GFP_KERNEL);
232 + data = uml_kmalloc(sizeof(*data), UM_GFP_KERNEL);
233 if (data == NULL)
234 return NULL;
235 *data = ((struct xterm_chan) { .pid = -1,
236 diff --git a/arch/um/include/init.h b/arch/um/include/init.h
237 index b00a957..37dd097 100644
238 --- a/arch/um/include/init.h
239 +++ b/arch/um/include/init.h
240 @@ -45,6 +45,8 @@ typedef void (*exitcall_t)(void);
241 # define __section(S) __attribute__ ((__section__(#S)))
242 #endif
243
244 +#if __GNUC__ == 3
245 +
246 #if __GNUC_MINOR__ >= 3
247 # define __used __attribute__((__used__))
248 #else
249 @@ -52,6 +54,12 @@ typedef void (*exitcall_t)(void);
250 #endif
251
252 #else
253 +#if __GNUC__ == 4
254 +# define __used __attribute__((__used__))
255 +#endif
256 +#endif
257 +
258 +#else
259 #include <linux/compiler.h>
260 #endif
261 /* These are for everybody (although not all archs will actually
262 diff --git a/arch/um/include/os.h b/arch/um/include/os.h
263 index 32c799e..2d0a2a6 100644
264 --- a/arch/um/include/os.h
265 +++ b/arch/um/include/os.h
266 @@ -298,6 +298,6 @@ extern int os_arch_prctl(int pid, int code, unsigned long *addr);
267 extern int get_pty(void);
268
269 /* sys-$ARCH/task_size.c */
270 -extern unsigned long os_get_task_size(void);
271 +extern unsigned long os_get_top_address(void);
272
273 #endif
274 diff --git a/arch/um/include/process.h b/arch/um/include/process.h
275 index 5af9157..348f8a3 100644
276 --- a/arch/um/include/process.h
277 +++ b/arch/um/include/process.h
278 @@ -8,8 +8,8 @@
279
280 #include <signal.h>
281
282 -extern void sig_handler(int sig, struct sigcontext sc);
283 -extern void alarm_handler(int sig, struct sigcontext sc);
284 +extern void sig_handler(int sig, struct sigcontext *sc);
285 +extern void alarm_handler(int sig, struct sigcontext *sc);
286
287 #endif
288
289 diff --git a/arch/um/include/um_malloc.h b/arch/um/include/um_malloc.h
290 index 0ad17cb..c554d70 100644
291 --- a/arch/um/include/um_malloc.h
292 +++ b/arch/um/include/um_malloc.h
293 @@ -8,15 +8,12 @@
294
295 #include "kern_constants.h"
296
297 -extern void *__kmalloc(int size, int flags);
298 -static inline void *kmalloc(int size, int flags)
299 -{
300 - return __kmalloc(size, flags);
301 -}
302 -
303 +extern void *uml_kmalloc(int size, int flags);
304 extern void kfree(const void *ptr);
305
306 extern void *vmalloc(unsigned long size);
307 extern void vfree(void *ptr);
308
309 #endif /* __UM_MALLOC_H__ */
310 +
311 +
312 diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
313 index 2eea1ff..b0ee646 100644
314 --- a/arch/um/kernel/mem.c
315 +++ b/arch/um/kernel/mem.c
316 @@ -375,3 +375,8 @@ pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
317 return pmd;
318 }
319 #endif
320 +
321 +void *uml_kmalloc(int size, int flags)
322 +{
323 + return kmalloc(size, flags);
324 +}
325 diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c
326 index e066e84..5036c81 100644
327 --- a/arch/um/kernel/time.c
328 +++ b/arch/um/kernel/time.c
329 @@ -74,7 +74,7 @@ static irqreturn_t um_timer(int irq, void *dev)
330
331 static cycle_t itimer_read(void)
332 {
333 - return os_nsecs();
334 + return os_nsecs() / 1000;
335 }
336
337 static struct clocksource itimer_clocksource = {
338 @@ -82,7 +82,7 @@ static struct clocksource itimer_clocksource = {
339 .rating = 300,
340 .read = itimer_read,
341 .mask = CLOCKSOURCE_MASK(64),
342 - .mult = 1,
343 + .mult = 1000,
344 .shift = 0,
345 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
346 };
347 diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
348 index a6c1dd1..d1fe222 100644
349 --- a/arch/um/kernel/um_arch.c
350 +++ b/arch/um/kernel/um_arch.c
351 @@ -259,6 +259,7 @@ int __init linux_main(int argc, char **argv)
352 unsigned long avail, diff;
353 unsigned long virtmem_size, max_physmem;
354 unsigned int i, add;
355 + unsigned long stack;
356 char * mode;
357
358 for (i = 1; i < argc; i++) {
359 @@ -272,7 +273,7 @@ int __init linux_main(int argc, char **argv)
360 if (have_root == 0)
361 add_arg(DEFAULT_COMMAND_LINE);
362
363 - host_task_size = os_get_task_size();
364 + host_task_size = os_get_top_address();
365 /*
366 * TASK_SIZE needs to be PGDIR_SIZE aligned or else exit_mmap craps
367 * out
368 @@ -347,7 +348,9 @@ int __init linux_main(int argc, char **argv)
369 }
370
371 virtmem_size = physmem_size;
372 - avail = TASK_SIZE - start_vm;
373 + stack = (unsigned long) argv;
374 + stack &= ~(1024 * 1024 - 1);
375 + avail = stack - start_vm;
376 if (physmem_size > avail)
377 virtmem_size = avail;
378 end_vm = start_vm + virtmem_size;
379 diff --git a/arch/um/os-Linux/drivers/ethertap_user.c b/arch/um/os-Linux/drivers/ethertap_user.c
380 index 6fb0b17..cc72cb2 100644
381 --- a/arch/um/os-Linux/drivers/ethertap_user.c
382 +++ b/arch/um/os-Linux/drivers/ethertap_user.c
383 @@ -52,7 +52,7 @@ static void etap_change(int op, unsigned char *addr, unsigned char *netmask,
384 return;
385 }
386
387 - output = kmalloc(UM_KERN_PAGE_SIZE, UM_GFP_KERNEL);
388 + output = uml_kmalloc(UM_KERN_PAGE_SIZE, UM_GFP_KERNEL);
389 if (output == NULL)
390 printk(UM_KERN_ERR "etap_change : Failed to allocate output "
391 "buffer\n");
392 @@ -165,7 +165,7 @@ static int etap_open(void *data)
393 err = etap_tramp(pri->dev_name, pri->gate_addr, control_fds[0],
394 control_fds[1], data_fds[0], data_fds[1]);
395 output_len = UM_KERN_PAGE_SIZE;
396 - output = kmalloc(output_len, UM_GFP_KERNEL);
397 + output = uml_kmalloc(output_len, UM_GFP_KERNEL);
398 read_output(control_fds[0], output, output_len);
399
400 if (output == NULL)
401 diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c
402 index f4bd349..b6b1096 100644
403 --- a/arch/um/os-Linux/helper.c
404 +++ b/arch/um/os-Linux/helper.c
405 @@ -7,6 +7,7 @@
406 #include <unistd.h>
407 #include <errno.h>
408 #include <sched.h>
409 +#include <linux/limits.h>
410 #include <sys/socket.h>
411 #include <sys/wait.h>
412 #include "kern_constants.h"
413 @@ -70,8 +71,8 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv)
414 data.pre_data = pre_data;
415 data.argv = argv;
416 data.fd = fds[1];
417 - data.buf = __cant_sleep() ? kmalloc(PATH_MAX, UM_GFP_ATOMIC) :
418 - kmalloc(PATH_MAX, UM_GFP_KERNEL);
419 + data.buf = __cant_sleep() ? uml_kmalloc(PATH_MAX, UM_GFP_ATOMIC) :
420 + uml_kmalloc(PATH_MAX, UM_GFP_KERNEL);
421 pid = clone(helper_child, (void *) sp, CLONE_VM, &data);
422 if (pid < 0) {
423 ret = -errno;
424 diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c
425 index abb9b0f..eee69b9 100644
426 --- a/arch/um/os-Linux/main.c
427 +++ b/arch/um/os-Linux/main.c
428 @@ -199,7 +199,7 @@ void *__wrap_malloc(int size)
429 return __real_malloc(size);
430 else if (size <= UM_KERN_PAGE_SIZE)
431 /* finding contiguous pages can be hard*/
432 - ret = kmalloc(size, UM_GFP_KERNEL);
433 + ret = uml_kmalloc(size, UM_GFP_KERNEL);
434 else ret = vmalloc(size);
435
436 /*
437 diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c
438 index abf47a7..0578481 100644
439 --- a/arch/um/os-Linux/sigio.c
440 +++ b/arch/um/os-Linux/sigio.c
441 @@ -109,7 +109,7 @@ static int need_poll(struct pollfds *polls, int n)
442 if (n <= polls->size)
443 return 0;
444
445 - new = kmalloc(n * sizeof(struct pollfd), UM_GFP_ATOMIC);
446 + new = uml_kmalloc(n * sizeof(struct pollfd), UM_GFP_ATOMIC);
447 if (new == NULL) {
448 printk(UM_KERN_ERR "need_poll : failed to allocate new "
449 "pollfds\n");
450 @@ -243,7 +243,7 @@ static struct pollfd *setup_initial_poll(int fd)
451 {
452 struct pollfd *p;
453
454 - p = kmalloc(sizeof(struct pollfd), UM_GFP_KERNEL);
455 + p = uml_kmalloc(sizeof(struct pollfd), UM_GFP_KERNEL);
456 if (p == NULL) {
457 printk(UM_KERN_ERR "setup_initial_poll : failed to allocate "
458 "poll\n");
459 diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c
460 index 3f1694b..5aade60 100644
461 --- a/arch/um/os-Linux/signal.c
462 +++ b/arch/um/os-Linux/signal.c
463 @@ -12,6 +12,7 @@
464 #include "as-layout.h"
465 #include "kern_util.h"
466 #include "os.h"
467 +#include "process.h"
468 #include "sysdep/barrier.h"
469 #include "sysdep/sigcontext.h"
470 #include "user.h"
471 diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
472 index 1e8cba6..2328098 100644
473 --- a/arch/um/os-Linux/skas/process.c
474 +++ b/arch/um/os-Linux/skas/process.c
475 @@ -55,7 +55,7 @@ static int ptrace_dump_regs(int pid)
476 * Signals that are OK to receive in the stub - we'll just continue it.
477 * SIGWINCH will happen when UML is inside a detached screen.
478 */
479 -#define STUB_SIG_MASK (1 << SIGVTALRM)
480 +#define STUB_SIG_MASK ((1 << SIGVTALRM) | (1 << SIGWINCH))
481
482 /* Signals that the stub will finish with - anything else is an error */
483 #define STUB_DONE_MASK (1 << SIGTRAP)
484 diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
485 index b616e15..fd71bdb 100644
486 --- a/arch/um/os-Linux/start_up.c
487 +++ b/arch/um/os-Linux/start_up.c
488 @@ -122,8 +122,10 @@ static int stop_ptraced_child(int pid, int exitcode, int mustexit)
489 {
490 int status, n, ret = 0;
491
492 - if (ptrace(PTRACE_CONT, pid, 0, 0) < 0)
493 - fatal_perror("stop_ptraced_child : ptrace failed");
494 + if (ptrace(PTRACE_CONT, pid, 0, 0) < 0) {
495 + perror("stop_ptraced_child : ptrace failed");
496 + return -1;
497 + }
498 CATCH_EINTR(n = waitpid(pid, &status, 0));
499 if (!WIFEXITED(status) || (WEXITSTATUS(status) != exitcode)) {
500 int exit_with = WEXITSTATUS(status);
501 @@ -203,7 +205,7 @@ static void __init check_sysemu(void)
502 if (n < 0)
503 fatal_perror("check_sysemu : wait failed");
504 if (!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGTRAP))
505 - fatal("check_sysemu : expected SIGTRAP, got status = %d",
506 + fatal("check_sysemu : expected SIGTRAP, got status = %d\n",
507 status);
508
509 if (ptrace(PTRACE_GETREGS, pid, 0, regs) < 0)
510 @@ -245,9 +247,11 @@ static void __init check_sysemu(void)
511
512 if (WIFSTOPPED(status) &&
513 (WSTOPSIG(status) == (SIGTRAP|0x80))) {
514 - if (!count)
515 - fatal("check_ptrace : SYSEMU_SINGLESTEP "
516 - "doesn't singlestep");
517 + if (!count) {
518 + non_fatal("check_ptrace : SYSEMU_SINGLESTEP "
519 + "doesn't singlestep");
520 + goto fail;
521 + }
522 n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_RET_OFFSET,
523 os_getpid());
524 if (n < 0)
525 @@ -257,9 +261,12 @@ static void __init check_sysemu(void)
526 }
527 else if (WIFSTOPPED(status) && (WSTOPSIG(status) == SIGTRAP))
528 count++;
529 - else
530 - fatal("check_ptrace : expected SIGTRAP or "
531 - "(SIGTRAP | 0x80), got status = %d", status);
532 + else {
533 + non_fatal("check_ptrace : expected SIGTRAP or "
534 + "(SIGTRAP | 0x80), got status = %d\n",
535 + status);
536 + goto fail;
537 + }
538 }
539 if (stop_ptraced_child(pid, 0, 0) < 0)
540 goto fail_stopped;
541 diff --git a/arch/um/os-Linux/sys-i386/task_size.c b/arch/um/os-Linux/sys-i386/task_size.c
542 index 48d211b..4d26d5d 100644
543 --- a/arch/um/os-Linux/sys-i386/task_size.c
544 +++ b/arch/um/os-Linux/sys-i386/task_size.c
545 @@ -63,7 +63,7 @@ static int page_ok(unsigned long page)
546 return ok;
547 }
548
549 -unsigned long os_get_task_size(void)
550 +unsigned long os_get_top_address(void)
551 {
552 struct sigaction sa, old;
553 unsigned long bottom = 0;
554 @@ -76,9 +76,9 @@ unsigned long os_get_task_size(void)
555 * hosts, but shouldn't hurt otherwise.
556 */
557 unsigned long top = 0xffffd000 >> UM_KERN_PAGE_SHIFT;
558 - unsigned long test;
559 + unsigned long test, original;
560
561 - printf("Locating the top of the address space ... ");
562 + printf("Locating the bottom of the address space ... ");
563 fflush(stdout);
564
565 /*
566 @@ -88,14 +88,32 @@ unsigned long os_get_task_size(void)
567 sa.sa_handler = segfault;
568 sigemptyset(&sa.sa_mask);
569 sa.sa_flags = SA_NODEFER;
570 - sigaction(SIGSEGV, &sa, &old);
571 + if (sigaction(SIGSEGV, &sa, &old)) {
572 + perror("os_get_top_address");
573 + exit(1);
574 + }
575
576 - if (!page_ok(bottom)) {
577 - fprintf(stderr, "Address 0x%x no good?\n",
578 - bottom << UM_KERN_PAGE_SHIFT);
579 + /* Manually scan the address space, bottom-up, until we find
580 + * the first valid page (or run out of them).
581 + */
582 + for (bottom = 0; bottom < top; bottom++) {
583 + if (page_ok(bottom))
584 + break;
585 + }
586 +
587 + /* If we've got this far, we ran out of pages. */
588 + if (bottom == top) {
589 + fprintf(stderr, "Unable to determine bottom of address "
590 + "space.\n");
591 exit(1);
592 }
593
594 + printf("0x%x\n", bottom << UM_KERN_PAGE_SHIFT);
595 + printf("Locating the top of the address space ... ");
596 + fflush(stdout);
597 +
598 + original = bottom;
599 +
600 /* This could happen with a 4G/4G split */
601 if (page_ok(top))
602 goto out;
603 @@ -110,8 +128,10 @@ unsigned long os_get_task_size(void)
604
605 out:
606 /* Restore the old SIGSEGV handling */
607 - sigaction(SIGSEGV, &old, NULL);
608 -
609 + if (sigaction(SIGSEGV, &old, NULL)) {
610 + perror("os_get_top_address");
611 + exit(1);
612 + }
613 top <<= UM_KERN_PAGE_SHIFT;
614 printf("0x%x\n", top);
615 fflush(stdout);
616 diff --git a/arch/um/os-Linux/sys-x86_64/task_size.c b/arch/um/os-Linux/sys-x86_64/task_size.c
617 index fad6f57..26a0dd1 100644
618 --- a/arch/um/os-Linux/sys-x86_64/task_size.c
619 +++ b/arch/um/os-Linux/sys-x86_64/task_size.c
620 @@ -1,4 +1,4 @@
621 -unsigned long os_get_task_size(unsigned long shift)
622 +unsigned long os_get_top_address(unsigned long shift)
623 {
624 /* The old value of CONFIG_TOP_ADDR */
625 return 0x7fc0000000;
626 diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c
627 index e492805..dec5678 100644
628 --- a/arch/um/os-Linux/time.c
629 +++ b/arch/um/os-Linux/time.c
630 @@ -9,7 +9,9 @@
631 #include <time.h>
632 #include <sys/time.h>
633 #include "kern_constants.h"
634 +#include "kern_util.h"
635 #include "os.h"
636 +#include "process.h"
637 #include "user.h"
638
639 int set_interval(void)
640 @@ -58,12 +60,17 @@ static inline long long timeval_to_ns(const struct timeval *tv)
641 long long disable_timer(void)
642 {
643 struct itimerval time = ((struct itimerval) { { 0, 0 }, { 0, 0 } });
644 + int remain, max = UM_NSEC_PER_SEC / UM_HZ;
645
646 if (setitimer(ITIMER_VIRTUAL, &time, &time) < 0)
647 printk(UM_KERN_ERR "disable_timer - setitimer failed, "
648 "errno = %d\n", errno);
649
650 - return timeval_to_ns(&time.it_value);
651 + remain = timeval_to_ns(&time.it_value);
652 + if (remain > max)
653 + remain = max;
654 +
655 + return remain;
656 }
657
658 long long os_nsecs(void)
659 @@ -79,7 +86,48 @@ static int after_sleep_interval(struct timespec *ts)
660 {
661 return 0;
662 }
663 +
664 +static void deliver_alarm(void)
665 +{
666 + alarm_handler(SIGVTALRM, NULL);
667 +}
668 +
669 +static unsigned long long sleep_time(unsigned long long nsecs)
670 +{
671 + return nsecs;
672 +}
673 +
674 #else
675 +unsigned long long last_tick;
676 +unsigned long long skew;
677 +
678 +static void deliver_alarm(void)
679 +{
680 + unsigned long long this_tick = os_nsecs();
681 + int one_tick = UM_NSEC_PER_SEC / UM_HZ;
682 +
683 + /* Protection against the host's time going backwards */
684 + if ((last_tick != 0) && (this_tick < last_tick))
685 + this_tick = last_tick;
686 +
687 + if (last_tick == 0)
688 + last_tick = this_tick - one_tick;
689 +
690 + skew += this_tick - last_tick;
691 +
692 + while (skew >= one_tick) {
693 + alarm_handler(SIGVTALRM, NULL);
694 + skew -= one_tick;
695 + }
696 +
697 + last_tick = this_tick;
698 +}
699 +
700 +static unsigned long long sleep_time(unsigned long long nsecs)
701 +{
702 + return nsecs > skew ? nsecs - skew : 0;
703 +}
704 +
705 static inline long long timespec_to_us(const struct timespec *ts)
706 {
707 return ((long long) ts->tv_sec * UM_USEC_PER_SEC) +
708 @@ -102,6 +150,11 @@ static int after_sleep_interval(struct timespec *ts)
709 */
710 if (start_usecs > usec)
711 start_usecs = usec;
712 +
713 + start_usecs -= skew / UM_NSEC_PER_USEC;
714 + if (start_usecs < 0)
715 + start_usecs = 0;
716 +
717 tv = ((struct timeval) { .tv_sec = start_usecs / UM_USEC_PER_SEC,
718 .tv_usec = start_usecs % UM_USEC_PER_SEC });
719 interval = ((struct itimerval) { { 0, usec }, tv });
720 @@ -113,8 +166,6 @@ static int after_sleep_interval(struct timespec *ts)
721 }
722 #endif
723
724 -extern void alarm_handler(int sig, struct sigcontext *sc);
725 -
726 void idle_sleep(unsigned long long nsecs)
727 {
728 struct timespec ts;
729 @@ -126,10 +177,12 @@ void idle_sleep(unsigned long long nsecs)
730 */
731 if (nsecs == 0)
732 nsecs = UM_NSEC_PER_SEC / UM_HZ;
733 +
734 + nsecs = sleep_time(nsecs);
735 ts = ((struct timespec) { .tv_sec = nsecs / UM_NSEC_PER_SEC,
736 .tv_nsec = nsecs % UM_NSEC_PER_SEC });
737
738 if (nanosleep(&ts, &ts) == 0)
739 - alarm_handler(SIGVTALRM, NULL);
740 + deliver_alarm();
741 after_sleep_interval(&ts);
742 }
743 diff --git a/arch/um/sys-x86_64/ksyms.c b/arch/um/sys-x86_64/ksyms.c
744 index 12c5936..467879a 100644
745 --- a/arch/um/sys-x86_64/ksyms.c
746 +++ b/arch/um/sys-x86_64/ksyms.c
747 @@ -13,4 +13,9 @@ EXPORT_SYMBOL(__down_failed_trylock);
748 EXPORT_SYMBOL(__up_wakeup);
749
750 /*XXX: we need them because they would be exported by x86_64 */
751 +#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4
752 +EXPORT_SYMBOL(memcpy);
753 +#else
754 EXPORT_SYMBOL(__memcpy);
755 +#endif
756 +EXPORT_SYMBOL(csum_partial);
757 diff --git a/arch/x86/boot/boot.h b/arch/x86/boot/boot.h
758 index 7822a49..4f199c1 100644
759 --- a/arch/x86/boot/boot.h
760 +++ b/arch/x86/boot/boot.h
761 @@ -27,6 +27,8 @@
762 #include <asm/boot.h>
763 #include <asm/setup.h>
764
765 +#define NCAPINTS 8
766 +
767 /* Useful macros */
768 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
769
770 @@ -244,6 +246,12 @@ int cmdline_find_option(const char *option, char *buffer, int bufsize);
771 int cmdline_find_option_bool(const char *option);
772
773 /* cpu.c, cpucheck.c */
774 +struct cpu_features {
775 + int level; /* Family, or 64 for x86-64 */
776 + int model;
777 + u32 flags[NCAPINTS];
778 +};
779 +extern struct cpu_features cpu;
780 int check_cpu(int *cpu_level_ptr, int *req_level_ptr, u32 **err_flags_ptr);
781 int validate_cpu(void);
782
783 diff --git a/arch/x86/boot/cpucheck.c b/arch/x86/boot/cpucheck.c
784 index 769065b..b93b194 100644
785 --- a/arch/x86/boot/cpucheck.c
786 +++ b/arch/x86/boot/cpucheck.c
787 @@ -32,13 +32,7 @@
788 #include <asm/required-features.h>
789 #include <asm/msr-index.h>
790
791 -struct cpu_features {
792 - int level; /* Family, or 64 for x86-64 */
793 - int model;
794 - u32 flags[NCAPINTS];
795 -};
796 -
797 -static struct cpu_features cpu;
798 +struct cpu_features cpu;
799 static u32 cpu_vendor[3];
800 static u32 err_flags[NCAPINTS];
801
802 diff --git a/arch/x86/boot/main.c b/arch/x86/boot/main.c
803 index 7828da5..3d86d65 100644
804 --- a/arch/x86/boot/main.c
805 +++ b/arch/x86/boot/main.c
806 @@ -75,6 +75,10 @@ static void keyboard_set_repeat(void)
807 */
808 static void query_ist(void)
809 {
810 + /* Some 486 BIOSes apparently crash on this call */
811 + if (cpu.level < 6)
812 + return;
813 +
814 asm("int $0x15"
815 : "=a" (boot_params.ist_info.signature),
816 "=b" (boot_params.ist_info.command),
817 diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
818 index a2c3a93..84d8341 100644
819 --- a/block/scsi_ioctl.c
820 +++ b/block/scsi_ioctl.c
821 @@ -633,7 +633,7 @@ int scsi_cmd_ioctl(struct file *file, struct request_queue *q,
822 hdr.sbp = cgc.sense;
823 if (hdr.sbp)
824 hdr.mx_sb_len = sizeof(struct request_sense);
825 - hdr.timeout = cgc.timeout;
826 + hdr.timeout = jiffies_to_msecs(cgc.timeout);
827 hdr.cmdp = ((struct cdrom_generic_command __user*) arg)->cmd;
828 hdr.cmd_len = sizeof(cgc.cmd);
829
830 diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
831 index 8b645c6..fd2123b 100644
832 --- a/drivers/i2c/i2c-core.c
833 +++ b/drivers/i2c/i2c-core.c
834 @@ -1173,9 +1173,11 @@ i2c_new_probed_device(struct i2c_adapter *adap,
835 if ((addr_list[i] & ~0x07) == 0x30
836 || (addr_list[i] & ~0x0f) == 0x50
837 || !i2c_check_functionality(adap, I2C_FUNC_SMBUS_QUICK)) {
838 + union i2c_smbus_data data;
839 +
840 if (i2c_smbus_xfer(adap, addr_list[i], 0,
841 I2C_SMBUS_READ, 0,
842 - I2C_SMBUS_BYTE, NULL) >= 0)
843 + I2C_SMBUS_BYTE, &data) >= 0)
844 break;
845 } else {
846 if (i2c_smbus_xfer(adap, addr_list[i], 0,
847 diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
848 index e54da02..17f19f7 100644
849 --- a/drivers/ide/ide-cd.c
850 +++ b/drivers/ide/ide-cd.c
851 @@ -1411,6 +1411,7 @@ static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity,
852
853 int stat;
854 struct request req;
855 + u32 blocklen;
856
857 ide_cd_init_rq(drive, &req);
858
859 @@ -1427,23 +1428,24 @@ static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity,
860 /*
861 * Sanity check the given block size
862 */
863 - switch (capbuf.blocklen) {
864 - case __constant_cpu_to_be32(512):
865 - case __constant_cpu_to_be32(1024):
866 - case __constant_cpu_to_be32(2048):
867 - case __constant_cpu_to_be32(4096):
868 + blocklen = be32_to_cpu(capbuf.blocklen);
869 + switch (blocklen) {
870 + case 512:
871 + case 1024:
872 + case 2048:
873 + case 4096:
874 break;
875 default:
876 printk(KERN_ERR "%s: weird block size %u\n",
877 - drive->name, capbuf.blocklen);
878 + drive->name, blocklen);
879 printk(KERN_ERR "%s: default to 2kb block size\n",
880 drive->name);
881 - capbuf.blocklen = __constant_cpu_to_be32(2048);
882 + blocklen = 2048;
883 break;
884 }
885
886 *capacity = 1 + be32_to_cpu(capbuf.lba);
887 - *sectors_per_frame = be32_to_cpu(capbuf.blocklen) >> SECTOR_BITS;
888 + *sectors_per_frame = blocklen >> SECTOR_BITS;
889 return 0;
890 }
891
892 diff --git a/drivers/misc/acer-wmi.c b/drivers/misc/acer-wmi.c
893 index dd13a37..3a3e4c1 100644
894 --- a/drivers/misc/acer-wmi.c
895 +++ b/drivers/misc/acer-wmi.c
896 @@ -742,11 +742,30 @@ static acpi_status get_u32(u32 *value, u32 cap)
897
898 static acpi_status set_u32(u32 value, u32 cap)
899 {
900 + acpi_status status;
901 +
902 if (interface->capability & cap) {
903 switch (interface->type) {
904 case ACER_AMW0:
905 return AMW0_set_u32(value, cap, interface);
906 case ACER_AMW0_V2:
907 + if (cap == ACER_CAP_MAILLED)
908 + return AMW0_set_u32(value, cap, interface);
909 +
910 + /*
911 + * On some models, some WMID methods don't toggle
912 + * properly. For those cases, we want to run the AMW0
913 + * method afterwards to be certain we've really toggled
914 + * the device state.
915 + */
916 + if (cap == ACER_CAP_WIRELESS ||
917 + cap == ACER_CAP_BLUETOOTH) {
918 + status = WMID_set_u32(value, cap, interface);
919 + if (ACPI_FAILURE(status))
920 + return status;
921 +
922 + return AMW0_set_u32(value, cap, interface);
923 + }
924 case ACER_WMID:
925 return WMID_set_u32(value, cap, interface);
926 default:
927 diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
928 index 6572425..42d7c0a 100644
929 --- a/drivers/net/r8169.c
930 +++ b/drivers/net/r8169.c
931 @@ -1438,8 +1438,10 @@ static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp)
932
933 rtl_hw_phy_config(dev);
934
935 - dprintk("Set MAC Reg C+CR Offset 0x82h = 0x01h\n");
936 - RTL_W8(0x82, 0x01);
937 + if (tp->mac_version <= RTL_GIGA_MAC_VER_06) {
938 + dprintk("Set MAC Reg C+CR Offset 0x82h = 0x01h\n");
939 + RTL_W8(0x82, 0x01);
940 + }
941
942 pci_write_config_byte(tp->pci_dev, PCI_LATENCY_TIMER, 0x40);
943
944 diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
945 index ff149ad..611ed07 100644
946 --- a/drivers/scsi/hptiop.c
947 +++ b/drivers/scsi/hptiop.c
948 @@ -1246,6 +1246,13 @@ static struct pci_device_id hptiop_id_table[] = {
949 { PCI_VDEVICE(TTI, 0x3522), (kernel_ulong_t)&hptiop_itl_ops },
950 { PCI_VDEVICE(TTI, 0x3410), (kernel_ulong_t)&hptiop_itl_ops },
951 { PCI_VDEVICE(TTI, 0x3540), (kernel_ulong_t)&hptiop_itl_ops },
952 + { PCI_VDEVICE(TTI, 0x3530), (kernel_ulong_t)&hptiop_itl_ops },
953 + { PCI_VDEVICE(TTI, 0x3560), (kernel_ulong_t)&hptiop_itl_ops },
954 + { PCI_VDEVICE(TTI, 0x4322), (kernel_ulong_t)&hptiop_itl_ops },
955 + { PCI_VDEVICE(TTI, 0x4210), (kernel_ulong_t)&hptiop_itl_ops },
956 + { PCI_VDEVICE(TTI, 0x4211), (kernel_ulong_t)&hptiop_itl_ops },
957 + { PCI_VDEVICE(TTI, 0x4310), (kernel_ulong_t)&hptiop_itl_ops },
958 + { PCI_VDEVICE(TTI, 0x4311), (kernel_ulong_t)&hptiop_itl_ops },
959 { PCI_VDEVICE(TTI, 0x3120), (kernel_ulong_t)&hptiop_mv_ops },
960 { PCI_VDEVICE(TTI, 0x3122), (kernel_ulong_t)&hptiop_mv_ops },
961 { PCI_VDEVICE(TTI, 0x3020), (kernel_ulong_t)&hptiop_mv_ops },
962 diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
963 index 4894dc8..6ca83a2 100644
964 --- a/drivers/scsi/qla2xxx/qla_attr.c
965 +++ b/drivers/scsi/qla2xxx/qla_attr.c
966 @@ -947,26 +947,39 @@ qla2x00_get_starget_port_id(struct scsi_target *starget)
967 }
968
969 static void
970 -qla2x00_get_rport_loss_tmo(struct fc_rport *rport)
971 +qla2x00_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout)
972 {
973 - struct Scsi_Host *host = rport_to_shost(rport);
974 - scsi_qla_host_t *ha = shost_priv(host);
975 -
976 - rport->dev_loss_tmo = ha->port_down_retry_count + 5;
977 + if (timeout)
978 + rport->dev_loss_tmo = timeout;
979 + else
980 + rport->dev_loss_tmo = 1;
981 }
982
983 static void
984 -qla2x00_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout)
985 +qla2x00_dev_loss_tmo_callbk(struct fc_rport *rport)
986 {
987 struct Scsi_Host *host = rport_to_shost(rport);
988 - scsi_qla_host_t *ha = shost_priv(host);
989 + fc_port_t *fcport = *(fc_port_t **)rport->dd_data;
990 +
991 + qla2x00_abort_fcport_cmds(fcport);
992 +
993 + /*
994 + * Transport has effectively 'deleted' the rport, clear
995 + * all local references.
996 + */
997 + spin_lock_irq(host->host_lock);
998 + fcport->rport = NULL;
999 + *((fc_port_t **)rport->dd_data) = NULL;
1000 + spin_unlock_irq(host->host_lock);
1001 +}
1002
1003 - if (timeout)
1004 - ha->port_down_retry_count = timeout;
1005 - else
1006 - ha->port_down_retry_count = 1;
1007 +static void
1008 +qla2x00_terminate_rport_io(struct fc_rport *rport)
1009 +{
1010 + fc_port_t *fcport = *(fc_port_t **)rport->dd_data;
1011
1012 - rport->dev_loss_tmo = ha->port_down_retry_count + 5;
1013 + qla2x00_abort_fcport_cmds(fcport);
1014 + scsi_target_unblock(&rport->dev);
1015 }
1016
1017 static int
1018 @@ -1222,11 +1235,12 @@ struct fc_function_template qla2xxx_transport_functions = {
1019 .get_starget_port_id = qla2x00_get_starget_port_id,
1020 .show_starget_port_id = 1,
1021
1022 - .get_rport_dev_loss_tmo = qla2x00_get_rport_loss_tmo,
1023 .set_rport_dev_loss_tmo = qla2x00_set_rport_loss_tmo,
1024 .show_rport_dev_loss_tmo = 1,
1025
1026 .issue_fc_host_lip = qla2x00_issue_lip,
1027 + .dev_loss_tmo_callbk = qla2x00_dev_loss_tmo_callbk,
1028 + .terminate_rport_io = qla2x00_terminate_rport_io,
1029 .get_fc_host_stats = qla2x00_get_fc_host_stats,
1030
1031 .vport_create = qla24xx_vport_create,
1032 @@ -1265,11 +1279,12 @@ struct fc_function_template qla2xxx_transport_vport_functions = {
1033 .get_starget_port_id = qla2x00_get_starget_port_id,
1034 .show_starget_port_id = 1,
1035
1036 - .get_rport_dev_loss_tmo = qla2x00_get_rport_loss_tmo,
1037 .set_rport_dev_loss_tmo = qla2x00_set_rport_loss_tmo,
1038 .show_rport_dev_loss_tmo = 1,
1039
1040 .issue_fc_host_lip = qla2x00_issue_lip,
1041 + .dev_loss_tmo_callbk = qla2x00_dev_loss_tmo_callbk,
1042 + .terminate_rport_io = qla2x00_terminate_rport_io,
1043 .get_fc_host_stats = qla2x00_get_fc_host_stats,
1044 };
1045
1046 diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
1047 index 3750319..ab5928b 100644
1048 --- a/drivers/scsi/qla2xxx/qla_def.h
1049 +++ b/drivers/scsi/qla2xxx/qla_def.h
1050 @@ -1548,7 +1548,6 @@ typedef struct fc_port {
1051 int login_retry;
1052 atomic_t port_down_timer;
1053
1054 - spinlock_t rport_lock;
1055 struct fc_rport *rport, *drport;
1056 u32 supported_classes;
1057
1058 diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
1059 index 193f688..d6eccbe 100644
1060 --- a/drivers/scsi/qla2xxx/qla_gbl.h
1061 +++ b/drivers/scsi/qla2xxx/qla_gbl.h
1062 @@ -68,6 +68,8 @@ extern int num_hosts;
1063 extern int qla2x00_loop_reset(scsi_qla_host_t *);
1064 extern void qla2x00_abort_all_cmds(scsi_qla_host_t *, int);
1065
1066 +extern void qla2x00_abort_fcport_cmds(fc_port_t *);
1067 +
1068 /*
1069 * Global Functions in qla_mid.c source file.
1070 */
1071 diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
1072 index 364be7d..6ffaf0e 100644
1073 --- a/drivers/scsi/qla2xxx/qla_init.c
1074 +++ b/drivers/scsi/qla2xxx/qla_init.c
1075 @@ -1827,12 +1827,11 @@ qla2x00_rport_del(void *data)
1076 {
1077 fc_port_t *fcport = data;
1078 struct fc_rport *rport;
1079 - unsigned long flags;
1080
1081 - spin_lock_irqsave(&fcport->rport_lock, flags);
1082 + spin_lock_irq(fcport->ha->host->host_lock);
1083 rport = fcport->drport;
1084 fcport->drport = NULL;
1085 - spin_unlock_irqrestore(&fcport->rport_lock, flags);
1086 + spin_unlock_irq(fcport->ha->host->host_lock);
1087 if (rport)
1088 fc_remote_port_delete(rport);
1089 }
1090 @@ -1861,7 +1860,6 @@ qla2x00_alloc_fcport(scsi_qla_host_t *ha, gfp_t flags)
1091 atomic_set(&fcport->state, FCS_UNCONFIGURED);
1092 fcport->flags = FCF_RLC_SUPPORT;
1093 fcport->supported_classes = FC_COS_UNSPECIFIED;
1094 - spin_lock_init(&fcport->rport_lock);
1095
1096 return fcport;
1097 }
1098 @@ -2220,28 +2218,24 @@ qla2x00_reg_remote_port(scsi_qla_host_t *ha, fc_port_t *fcport)
1099 {
1100 struct fc_rport_identifiers rport_ids;
1101 struct fc_rport *rport;
1102 - unsigned long flags;
1103
1104 if (fcport->drport)
1105 qla2x00_rport_del(fcport);
1106 - if (fcport->rport)
1107 - return;
1108
1109 rport_ids.node_name = wwn_to_u64(fcport->node_name);
1110 rport_ids.port_name = wwn_to_u64(fcport->port_name);
1111 rport_ids.port_id = fcport->d_id.b.domain << 16 |
1112 fcport->d_id.b.area << 8 | fcport->d_id.b.al_pa;
1113 rport_ids.roles = FC_RPORT_ROLE_UNKNOWN;
1114 - rport = fc_remote_port_add(ha->host, 0, &rport_ids);
1115 + fcport->rport = rport = fc_remote_port_add(ha->host, 0, &rport_ids);
1116 if (!rport) {
1117 qla_printk(KERN_WARNING, ha,
1118 "Unable to allocate fc remote port!\n");
1119 return;
1120 }
1121 - spin_lock_irqsave(&fcport->rport_lock, flags);
1122 - fcport->rport = rport;
1123 + spin_lock_irq(fcport->ha->host->host_lock);
1124 *((fc_port_t **)rport->dd_data) = fcport;
1125 - spin_unlock_irqrestore(&fcport->rport_lock, flags);
1126 + spin_unlock_irq(fcport->ha->host->host_lock);
1127
1128 rport->supported_classes = fcport->supported_classes;
1129
1130 diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
1131 index 0e8e092..6c03cd5 100644
1132 --- a/drivers/scsi/qla2xxx/qla_os.c
1133 +++ b/drivers/scsi/qla2xxx/qla_os.c
1134 @@ -386,7 +386,7 @@ qla2x00_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
1135 }
1136
1137 /* Close window on fcport/rport state-transitioning. */
1138 - if (!*(fc_port_t **)rport->dd_data) {
1139 + if (fcport->drport) {
1140 cmd->result = DID_IMM_RETRY << 16;
1141 goto qc_fail_command;
1142 }
1143 @@ -453,7 +453,7 @@ qla24xx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
1144 }
1145
1146 /* Close window on fcport/rport state-transitioning. */
1147 - if (!*(fc_port_t **)rport->dd_data) {
1148 + if (fcport->drport) {
1149 cmd->result = DID_IMM_RETRY << 16;
1150 goto qc24_fail_command;
1151 }
1152 @@ -617,6 +617,40 @@ qla2x00_wait_for_loop_ready(scsi_qla_host_t *ha)
1153 return (return_status);
1154 }
1155
1156 +void
1157 +qla2x00_abort_fcport_cmds(fc_port_t *fcport)
1158 +{
1159 + int cnt;
1160 + unsigned long flags;
1161 + srb_t *sp;
1162 + scsi_qla_host_t *ha = fcport->ha;
1163 + scsi_qla_host_t *pha = to_qla_parent(ha);
1164 +
1165 + spin_lock_irqsave(&pha->hardware_lock, flags);
1166 + for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) {
1167 + sp = pha->outstanding_cmds[cnt];
1168 + if (!sp)
1169 + continue;
1170 + if (sp->fcport != fcport)
1171 + continue;
1172 +
1173 + spin_unlock_irqrestore(&pha->hardware_lock, flags);
1174 + if (ha->isp_ops->abort_command(ha, sp)) {
1175 + DEBUG2(qla_printk(KERN_WARNING, ha,
1176 + "Abort failed -- %lx\n", sp->cmd->serial_number));
1177 + } else {
1178 + if (qla2x00_eh_wait_on_command(ha, sp->cmd) !=
1179 + QLA_SUCCESS)
1180 + DEBUG2(qla_printk(KERN_WARNING, ha,
1181 + "Abort failed while waiting -- %lx\n",
1182 + sp->cmd->serial_number));
1183 +
1184 + }
1185 + spin_lock_irqsave(&pha->hardware_lock, flags);
1186 + }
1187 + spin_unlock_irqrestore(&pha->hardware_lock, flags);
1188 +}
1189 +
1190 static void
1191 qla2x00_block_error_handler(struct scsi_cmnd *cmnd)
1192 {
1193 @@ -1160,7 +1194,7 @@ qla2xxx_slave_configure(struct scsi_device *sdev)
1194 else
1195 scsi_deactivate_tcq(sdev, ha->max_q_depth);
1196
1197 - rport->dev_loss_tmo = ha->port_down_retry_count + 5;
1198 + rport->dev_loss_tmo = ha->port_down_retry_count;
1199
1200 return 0;
1201 }
1202 @@ -1883,7 +1917,6 @@ static inline void
1203 qla2x00_schedule_rport_del(struct scsi_qla_host *ha, fc_port_t *fcport,
1204 int defer)
1205 {
1206 - unsigned long flags;
1207 struct fc_rport *rport;
1208
1209 if (!fcport->rport)
1210 @@ -1891,19 +1924,13 @@ qla2x00_schedule_rport_del(struct scsi_qla_host *ha, fc_port_t *fcport,
1211
1212 rport = fcport->rport;
1213 if (defer) {
1214 - spin_lock_irqsave(&fcport->rport_lock, flags);
1215 + spin_lock_irq(ha->host->host_lock);
1216 fcport->drport = rport;
1217 - fcport->rport = NULL;
1218 - *(fc_port_t **)rport->dd_data = NULL;
1219 - spin_unlock_irqrestore(&fcport->rport_lock, flags);
1220 + spin_unlock_irq(ha->host->host_lock);
1221 set_bit(FCPORT_UPDATE_NEEDED, &ha->dpc_flags);
1222 - } else {
1223 - spin_lock_irqsave(&fcport->rport_lock, flags);
1224 - fcport->rport = NULL;
1225 - *(fc_port_t **)rport->dd_data = NULL;
1226 - spin_unlock_irqrestore(&fcport->rport_lock, flags);
1227 + qla2xxx_wake_dpc(ha);
1228 + } else
1229 fc_remote_port_delete(rport);
1230 - }
1231 }
1232
1233 /*
1234 diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c
1235 index 1fb6031..945e1fb 100644
1236 --- a/drivers/scsi/scsi_transport_spi.c
1237 +++ b/drivers/scsi/scsi_transport_spi.c
1238 @@ -360,12 +360,14 @@ spi_transport_rd_attr(rti, "%d\n");
1239 spi_transport_rd_attr(pcomp_en, "%d\n");
1240 spi_transport_rd_attr(hold_mcs, "%d\n");
1241
1242 -/* we only care about the first child device so we return 1 */
1243 +/* we only care about the first child device that's a real SCSI device
1244 + * so we return 1 to terminate the iteration when we find it */
1245 static int child_iter(struct device *dev, void *data)
1246 {
1247 - struct scsi_device *sdev = to_scsi_device(dev);
1248 + if (!scsi_is_sdev_device(dev))
1249 + return 0;
1250
1251 - spi_dv_device(sdev);
1252 + spi_dv_device(to_scsi_device(dev));
1253 return 1;
1254 }
1255
1256 diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c
1257 index f1f2f65..ef7a95e 100644
1258 --- a/drivers/scsi/ses.c
1259 +++ b/drivers/scsi/ses.c
1260 @@ -345,14 +345,14 @@ static int ses_enclosure_find_by_addr(struct enclosure_device *edev,
1261 return 0;
1262 }
1263
1264 -#define VPD_INQUIRY_SIZE 512
1265 +#define VPD_INQUIRY_SIZE 36
1266
1267 static void ses_match_to_enclosure(struct enclosure_device *edev,
1268 struct scsi_device *sdev)
1269 {
1270 unsigned char *buf = kmalloc(VPD_INQUIRY_SIZE, GFP_KERNEL);
1271 unsigned char *desc;
1272 - int len;
1273 + u16 vpd_len;
1274 struct efd efd = {
1275 .addr = 0,
1276 };
1277 @@ -372,9 +372,19 @@ static void ses_match_to_enclosure(struct enclosure_device *edev,
1278 VPD_INQUIRY_SIZE, NULL, SES_TIMEOUT, SES_RETRIES))
1279 goto free;
1280
1281 - len = (buf[2] << 8) + buf[3];
1282 + vpd_len = (buf[2] << 8) + buf[3];
1283 + kfree(buf);
1284 + buf = kmalloc(vpd_len, GFP_KERNEL);
1285 + if (!buf)
1286 + return;
1287 + cmd[3] = vpd_len >> 8;
1288 + cmd[4] = vpd_len & 0xff;
1289 + if (scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf,
1290 + vpd_len, NULL, SES_TIMEOUT, SES_RETRIES))
1291 + goto free;
1292 +
1293 desc = buf + 4;
1294 - while (desc < buf + len) {
1295 + while (desc < buf + vpd_len) {
1296 enum scsi_protocol proto = desc[0] >> 4;
1297 u8 code_set = desc[0] & 0x0f;
1298 u8 piv = desc[1] & 0x80;
1299 diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
1300 index af2bd47..c51233a 100644
1301 --- a/drivers/usb/serial/ftdi_sio.c
1302 +++ b/drivers/usb/serial/ftdi_sio.c
1303 @@ -283,6 +283,7 @@ static struct usb_device_id id_table_combined [] = {
1304 { USB_DEVICE(FTDI_VID, FTDI_ELV_FHZ1300PC_PID) },
1305 { USB_DEVICE(FTDI_VID, FTDI_ELV_EM1010PC_PID) },
1306 { USB_DEVICE(FTDI_VID, FTDI_ELV_WS500_PID) },
1307 + { USB_DEVICE(FTDI_VID, FTDI_ELV_HS485_PID) },
1308 { USB_DEVICE(FTDI_VID, LINX_SDMUSBQSS_PID) },
1309 { USB_DEVICE(FTDI_VID, LINX_MASTERDEVEL2_PID) },
1310 { USB_DEVICE(FTDI_VID, LINX_FUTURE_0_PID) },
1311 @@ -366,6 +367,10 @@ static struct usb_device_id id_table_combined [] = {
1312 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
1313 { USB_DEVICE(FTDI_VID, FTDI_OOCDLINK_PID),
1314 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
1315 + { USB_DEVICE(FTDI_VID, LMI_LM3S_DEVEL_BOARD_PID),
1316 + .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
1317 + { USB_DEVICE(FTDI_VID, LMI_LM3S_EVAL_BOARD_PID),
1318 + .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
1319 { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) },
1320 { }, /* Optional parameter entry */
1321 { } /* Terminating entry */
1322 diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
1323 index 0e1c569..00a452a 100644
1324 --- a/drivers/usb/serial/ftdi_sio.h
1325 +++ b/drivers/usb/serial/ftdi_sio.h
1326 @@ -256,6 +256,7 @@
1327 #define FTDI_ELV_WS300PC_PID 0xE0F6 /* PC-Wetterstation (WS 300 PC) */
1328 #define FTDI_ELV_FHZ1300PC_PID 0xE0E8 /* FHZ 1300 PC */
1329 #define FTDI_ELV_WS500_PID 0xE0E9 /* PC-Wetterstation (WS 500) */
1330 +#define FTDI_ELV_HS485_PID 0xE0EA /* USB to RS-485 adapter */
1331 #define FTDI_ELV_EM1010PC_PID 0xE0EF /* Engery monitor EM 1010 PC */
1332
1333 /*
1334 @@ -547,6 +548,11 @@
1335 #define OLIMEX_VID 0x15BA
1336 #define OLIMEX_ARM_USB_OCD_PID 0x0003
1337
1338 +/* Luminary Micro Stellaris Boards, VID = FTDI_VID */
1339 +/* FTDI 2332C Dual channel device, side A=245 FIFO (JTAG), Side B=RS232 UART */
1340 +#define LMI_LM3S_DEVEL_BOARD_PID 0xbcd8
1341 +#define LMI_LM3S_EVAL_BOARD_PID 0xbcd9
1342 +
1343 /* www.elsterelectricity.com Elster Unicom III Optical Probe */
1344 #define FTDI_ELSTER_UNICOM_PID 0xE700 /* Product Id */
1345
1346 diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
1347 index 4c1a70a..157b458 100644
1348 --- a/drivers/usb/serial/pl2303.c
1349 +++ b/drivers/usb/serial/pl2303.c
1350 @@ -87,7 +87,6 @@ static struct usb_device_id id_table [] = {
1351 { USB_DEVICE(ALCOR_VENDOR_ID, ALCOR_PRODUCT_ID) },
1352 { USB_DEVICE(WS002IN_VENDOR_ID, WS002IN_PRODUCT_ID) },
1353 { USB_DEVICE(COREGA_VENDOR_ID, COREGA_PRODUCT_ID) },
1354 - { USB_DEVICE(HL340_VENDOR_ID, HL340_PRODUCT_ID) },
1355 { USB_DEVICE(YCCABLE_VENDOR_ID, YCCABLE_PRODUCT_ID) },
1356 { } /* Terminating entry */
1357 };
1358 diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h
1359 index 3bdefe0..b4b9df2 100644
1360 --- a/drivers/usb/serial/pl2303.h
1361 +++ b/drivers/usb/serial/pl2303.h
1362 @@ -105,10 +105,6 @@
1363 #define COREGA_VENDOR_ID 0x07aa
1364 #define COREGA_PRODUCT_ID 0x002a
1365
1366 -/* HL HL-340 (ID: 4348:5523) */
1367 -#define HL340_VENDOR_ID 0x4348
1368 -#define HL340_PRODUCT_ID 0x5523
1369 -
1370 /* Y.C. Cable U.S.A., Inc - USB to RS-232 */
1371 #define YCCABLE_VENDOR_ID 0x05ad
1372 #define YCCABLE_PRODUCT_ID 0x0fba
1373 diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
1374 index 2138ba8..ec7b96b 100644
1375 --- a/drivers/usb/serial/usb-serial.c
1376 +++ b/drivers/usb/serial/usb-serial.c
1377 @@ -119,9 +119,6 @@ static void return_serial(struct usb_serial *serial)
1378
1379 dbg("%s", __FUNCTION__);
1380
1381 - if (serial == NULL)
1382 - return;
1383 -
1384 for (i = 0; i < serial->num_ports; ++i) {
1385 serial_table[serial->minor + i] = NULL;
1386 }
1387 @@ -140,7 +137,8 @@ static void destroy_serial(struct kref *kref)
1388 serial->type->shutdown(serial);
1389
1390 /* return the minor range that this device had */
1391 - return_serial(serial);
1392 + if (serial->minor != SERIAL_TTY_NO_MINOR)
1393 + return_serial(serial);
1394
1395 for (i = 0; i < serial->num_ports; ++i)
1396 serial->port[i]->open_count = 0;
1397 @@ -635,6 +633,7 @@ static struct usb_serial * create_serial (struct usb_device *dev,
1398 serial->interface = interface;
1399 kref_init(&serial->kref);
1400 mutex_init(&serial->disc_mutex);
1401 + serial->minor = SERIAL_TTY_NO_MINOR;
1402
1403 return serial;
1404 }
1405 diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
1406 index f1d14c9..83f6e80 100644
1407 --- a/drivers/usb/storage/unusual_devs.h
1408 +++ b/drivers/usb/storage/unusual_devs.h
1409 @@ -357,14 +357,14 @@ UNUSUAL_DEV( 0x04b0, 0x040f, 0x0100, 0x0200,
1410 US_FL_FIX_CAPACITY),
1411
1412 /* Reported by Emil Larsson <emil@swip.net> */
1413 -UNUSUAL_DEV( 0x04b0, 0x0411, 0x0100, 0x0110,
1414 +UNUSUAL_DEV( 0x04b0, 0x0411, 0x0100, 0x0111,
1415 "NIKON",
1416 "NIKON DSC D80",
1417 US_SC_DEVICE, US_PR_DEVICE, NULL,
1418 US_FL_FIX_CAPACITY),
1419
1420 /* Reported by Ortwin Glueck <odi@odi.ch> */
1421 -UNUSUAL_DEV( 0x04b0, 0x0413, 0x0110, 0x0110,
1422 +UNUSUAL_DEV( 0x04b0, 0x0413, 0x0110, 0x0111,
1423 "NIKON",
1424 "NIKON DSC D40",
1425 US_SC_DEVICE, US_PR_DEVICE, NULL,
1426 @@ -1164,6 +1164,13 @@ UNUSUAL_DEV( 0x07c4, 0xa400, 0x0000, 0xffff,
1427 US_SC_DEVICE, US_PR_DEVICE, NULL,
1428 US_FL_FIX_INQUIRY ),
1429
1430 +/* Reported by Rauch Wolke <rauchwolke@gmx.net> */
1431 +UNUSUAL_DEV( 0x07c4, 0xa4a5, 0x0000, 0xffff,
1432 + "Simple Tech/Datafab",
1433 + "CF+SM Reader",
1434 + US_SC_DEVICE, US_PR_DEVICE, NULL,
1435 + US_FL_IGNORE_RESIDUE ),
1436 +
1437 /* Casio QV 2x00/3x00/4000/8000 digital still cameras are not conformant
1438 * to the USB storage specification in two ways:
1439 * - They tell us they are using transport protocol CBI. In reality they
1440 @@ -1705,6 +1712,13 @@ UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999,
1441 US_SC_DEVICE, US_PR_DEVICE, NULL,
1442 US_FL_GO_SLOW ),
1443
1444 +/* Reported by Andrey Rahmatullin <wrar@altlinux.org> */
1445 +UNUSUAL_DEV( 0x4102, 0x1020, 0x0100, 0x0100,
1446 + "iRiver",
1447 + "MP3 T10",
1448 + US_SC_DEVICE, US_PR_DEVICE, NULL,
1449 + US_FL_IGNORE_RESIDUE ),
1450 +
1451 /*
1452 * David Härdeman <david@2gen.com>
1453 * The key makes the SCSI stack print confusing (but harmless) messages
1454 diff --git a/drivers/video/aty/radeon_accel.c b/drivers/video/aty/radeon_accel.c
1455 index 3ca27cb..aa95f83 100644
1456 --- a/drivers/video/aty/radeon_accel.c
1457 +++ b/drivers/video/aty/radeon_accel.c
1458 @@ -55,6 +55,10 @@ static void radeonfb_prim_fillrect(struct radeonfb_info *rinfo,
1459 OUTREG(DP_WRITE_MSK, 0xffffffff);
1460 OUTREG(DP_CNTL, (DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM));
1461
1462 + radeon_fifo_wait(2);
1463 + OUTREG(DSTCACHE_CTLSTAT, RB2D_DC_FLUSH_ALL);
1464 + OUTREG(WAIT_UNTIL, (WAIT_2D_IDLECLEAN | WAIT_DMA_GUI_IDLE));
1465 +
1466 radeon_fifo_wait(2);
1467 OUTREG(DST_Y_X, (region->dy << 16) | region->dx);
1468 OUTREG(DST_WIDTH_HEIGHT, (region->width << 16) | region->height);
1469 @@ -116,6 +120,10 @@ static void radeonfb_prim_copyarea(struct radeonfb_info *rinfo,
1470 OUTREG(DP_CNTL, (xdir>=0 ? DST_X_LEFT_TO_RIGHT : 0)
1471 | (ydir>=0 ? DST_Y_TOP_TO_BOTTOM : 0));
1472
1473 + radeon_fifo_wait(2);
1474 + OUTREG(DSTCACHE_CTLSTAT, RB2D_DC_FLUSH_ALL);
1475 + OUTREG(WAIT_UNTIL, (WAIT_2D_IDLECLEAN | WAIT_DMA_GUI_IDLE));
1476 +
1477 radeon_fifo_wait(3);
1478 OUTREG(SRC_Y_X, (sy << 16) | sx);
1479 OUTREG(DST_Y_X, (dy << 16) | dx);
1480 @@ -241,8 +249,8 @@ void radeonfb_engine_reset(struct radeonfb_info *rinfo)
1481 INREG(HOST_PATH_CNTL);
1482 OUTREG(HOST_PATH_CNTL, host_path_cntl);
1483
1484 - if (rinfo->family != CHIP_FAMILY_R300 ||
1485 - rinfo->family != CHIP_FAMILY_R350 ||
1486 + if (rinfo->family != CHIP_FAMILY_R300 &&
1487 + rinfo->family != CHIP_FAMILY_R350 &&
1488 rinfo->family != CHIP_FAMILY_RV350)
1489 OUTREG(RBBM_SOFT_RESET, rbbm_soft_reset);
1490
1491 diff --git a/drivers/video/matrox/matroxfb_maven.c b/drivers/video/matrox/matroxfb_maven.c
1492 index 0cd58f8..8c416f7 100644
1493 --- a/drivers/video/matrox/matroxfb_maven.c
1494 +++ b/drivers/video/matrox/matroxfb_maven.c
1495 @@ -1266,7 +1266,7 @@ static int maven_detect_client(struct i2c_adapter* adapter, int address, int kin
1496 ERROR4:;
1497 i2c_detach_client(new_client);
1498 ERROR3:;
1499 - kfree(new_client);
1500 + kfree(data);
1501 ERROR0:;
1502 return err;
1503 }
1504 diff --git a/fs/cifs/asn1.c b/fs/cifs/asn1.c
1505 index 5dbba89..9b9d960 100644
1506 --- a/fs/cifs/asn1.c
1507 +++ b/fs/cifs/asn1.c
1508 @@ -400,7 +400,7 @@ asn1_oid_decode(struct asn1_ctx *ctx,
1509 size = eoc - ctx->pointer + 1;
1510
1511 /* first subid actually encodes first two subids */
1512 - if (size < 2 || size > ULONG_MAX/sizeof(unsigned long))
1513 + if (size < 2 || size > UINT_MAX/sizeof(unsigned long))
1514 return 0;
1515
1516 *oid = kmalloc(size * sizeof(unsigned long), GFP_ATOMIC);
1517 diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
1518 index b94fb5c..77f8770 100644
1519 --- a/fs/cifs/cifsfs.c
1520 +++ b/fs/cifs/cifsfs.c
1521 @@ -175,6 +175,8 @@ out_no_root:
1522 if (inode)
1523 iput(inode);
1524
1525 + cifs_umount(sb, cifs_sb);
1526 +
1527 out_mount_failed:
1528 if (cifs_sb) {
1529 #ifdef CONFIG_CIFS_DFS_UPCALL
1530 diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
1531 index e1031b9..78a7f5e 100644
1532 --- a/fs/cifs/inode.c
1533 +++ b/fs/cifs/inode.c
1534 @@ -639,6 +639,7 @@ struct inode *cifs_iget(struct super_block *sb, unsigned long ino)
1535 inode->i_fop = &simple_dir_operations;
1536 inode->i_uid = cifs_sb->mnt_uid;
1537 inode->i_gid = cifs_sb->mnt_gid;
1538 + } else if (rc) {
1539 _FreeXid(xid);
1540 iget_failed(inode);
1541 return ERR_PTR(rc);
1542 diff --git a/include/asm-sparc64/futex.h b/include/asm-sparc64/futex.h
1543 index df1097d..9bf183b 100644
1544 --- a/include/asm-sparc64/futex.h
1545 +++ b/include/asm-sparc64/futex.h
1546 @@ -59,7 +59,7 @@ static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr)
1547 __futex_cas_op("or\t%2, %4, %1", ret, oldval, uaddr, oparg);
1548 break;
1549 case FUTEX_OP_ANDN:
1550 - __futex_cas_op("and\t%2, %4, %1", ret, oldval, uaddr, oparg);
1551 + __futex_cas_op("andn\t%2, %4, %1", ret, oldval, uaddr, oparg);
1552 break;
1553 case FUTEX_OP_XOR:
1554 __futex_cas_op("xor\t%2, %4, %1", ret, oldval, uaddr, oparg);
1555 diff --git a/include/asm-x86/spinlock.h b/include/asm-x86/spinlock.h
1556 index 23804c1..68d473c 100644
1557 --- a/include/asm-x86/spinlock.h
1558 +++ b/include/asm-x86/spinlock.h
1559 @@ -75,7 +75,7 @@ static inline int __raw_spin_is_contended(raw_spinlock_t *lock)
1560 {
1561 int tmp = *(volatile signed int *)(&(lock)->slock);
1562
1563 - return (((tmp >> 8) & 0xff) - (tmp & 0xff)) > 1;
1564 + return (((tmp >> 8) - tmp) & 0xff) > 1;
1565 }
1566
1567 static inline void __raw_spin_lock(raw_spinlock_t *lock)
1568 @@ -141,7 +141,7 @@ static inline int __raw_spin_is_contended(raw_spinlock_t *lock)
1569 {
1570 int tmp = *(volatile signed int *)(&(lock)->slock);
1571
1572 - return (((tmp >> 16) & 0xffff) - (tmp & 0xffff)) > 1;
1573 + return (((tmp >> 16) - tmp) & 0xffff) > 1;
1574 }
1575
1576 static inline void __raw_spin_lock(raw_spinlock_t *lock)
1577 diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
1578 index 21b4a1c..e6f623d 100644
1579 --- a/include/linux/usb/serial.h
1580 +++ b/include/linux/usb/serial.h
1581 @@ -18,7 +18,8 @@
1582 #include <linux/mutex.h>
1583
1584 #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */
1585 -#define SERIAL_TTY_MINORS 255 /* loads of devices :) */
1586 +#define SERIAL_TTY_MINORS 254 /* loads of devices :) */
1587 +#define SERIAL_TTY_NO_MINOR 255 /* No minor was assigned */
1588
1589 /* The maximum number of ports one device can grab at once */
1590 #define MAX_NUM_PORTS 8
1591 diff --git a/include/video/radeon.h b/include/video/radeon.h
1592 index 83467e1..099ffa5 100644
1593 --- a/include/video/radeon.h
1594 +++ b/include/video/radeon.h
1595 @@ -527,8 +527,9 @@
1596
1597
1598 /* DSTCACHE_CTLSTAT bit constants */
1599 -#define RB2D_DC_FLUSH (3 << 0)
1600 -#define RB2D_DC_FLUSH_ALL 0xf
1601 +#define RB2D_DC_FLUSH_2D (1 << 0)
1602 +#define RB2D_DC_FREE_2D (1 << 2)
1603 +#define RB2D_DC_FLUSH_ALL (RB2D_DC_FLUSH_2D | RB2D_DC_FREE_2D)
1604 #define RB2D_DC_BUSY (1 << 31)
1605
1606
1607 @@ -741,6 +742,10 @@
1608 #define SOFT_RESET_RB (1 << 6)
1609 #define SOFT_RESET_HDP (1 << 7)
1610
1611 +/* WAIT_UNTIL bit constants */
1612 +#define WAIT_DMA_GUI_IDLE (1 << 9)
1613 +#define WAIT_2D_IDLECLEAN (1 << 16)
1614 +
1615 /* SURFACE_CNTL bit consants */
1616 #define SURF_TRANSLATION_DIS (1 << 8)
1617 #define NONSURF_AP0_SWP_16BPP (1 << 20)
1618 diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
1619 index a9b0420..bd90854 100644
1620 --- a/kernel/posix-timers.c
1621 +++ b/kernel/posix-timers.c
1622 @@ -290,21 +290,29 @@ void do_schedule_next_timer(struct siginfo *info)
1623 else
1624 schedule_next_timer(timr);
1625
1626 - info->si_overrun = timr->it_overrun_last;
1627 + info->si_overrun += timr->it_overrun_last;
1628 }
1629
1630 if (timr)
1631 unlock_timer(timr, flags);
1632 }
1633
1634 -int posix_timer_event(struct k_itimer *timr,int si_private)
1635 +int posix_timer_event(struct k_itimer *timr, int si_private)
1636 {
1637 - memset(&timr->sigq->info, 0, sizeof(siginfo_t));
1638 + /*
1639 + * FIXME: if ->sigq is queued we can race with
1640 + * dequeue_signal()->do_schedule_next_timer().
1641 + *
1642 + * If dequeue_signal() sees the "right" value of
1643 + * si_sys_private it calls do_schedule_next_timer().
1644 + * We re-queue ->sigq and drop ->it_lock().
1645 + * do_schedule_next_timer() locks the timer
1646 + * and re-schedules it while ->sigq is pending.
1647 + * Not really bad, but not that we want.
1648 + */
1649 timr->sigq->info.si_sys_private = si_private;
1650 - /* Send signal to the process that owns this timer.*/
1651
1652 timr->sigq->info.si_signo = timr->it_sigev_signo;
1653 - timr->sigq->info.si_errno = 0;
1654 timr->sigq->info.si_code = SI_TIMER;
1655 timr->sigq->info.si_tid = timr->it_id;
1656 timr->sigq->info.si_value = timr->it_sigev_value;
1657 @@ -438,6 +446,7 @@ static struct k_itimer * alloc_posix_timer(void)
1658 kmem_cache_free(posix_timers_cache, tmr);
1659 tmr = NULL;
1660 }
1661 + memset(&tmr->sigq->info, 0, sizeof(siginfo_t));
1662 return tmr;
1663 }
1664
1665 diff --git a/kernel/relay.c b/kernel/relay.c
1666 index d6204a4..ee2e614 100644
1667 --- a/kernel/relay.c
1668 +++ b/kernel/relay.c
1669 @@ -803,6 +803,10 @@ static void relay_file_read_consume(struct rchan_buf *buf,
1670 size_t n_subbufs = buf->chan->n_subbufs;
1671 size_t read_subbuf;
1672
1673 + if (buf->subbufs_produced == buf->subbufs_consumed &&
1674 + buf->offset == buf->bytes_consumed)
1675 + return;
1676 +
1677 if (buf->bytes_consumed + bytes_consumed > subbuf_size) {
1678 relay_subbufs_consumed(buf->chan, buf->cpu, 1);
1679 buf->bytes_consumed = 0;
1680 @@ -834,6 +838,8 @@ static int relay_file_read_avail(struct rchan_buf *buf, size_t read_pos)
1681
1682 relay_file_read_consume(buf, read_pos, 0);
1683
1684 + consumed = buf->subbufs_consumed;
1685 +
1686 if (unlikely(buf->offset > subbuf_size)) {
1687 if (produced == consumed)
1688 return 0;
1689 @@ -852,8 +858,12 @@ static int relay_file_read_avail(struct rchan_buf *buf, size_t read_pos)
1690 if (consumed > produced)
1691 produced += n_subbufs * subbuf_size;
1692
1693 - if (consumed == produced)
1694 + if (consumed == produced) {
1695 + if (buf->offset == subbuf_size &&
1696 + buf->subbufs_produced > buf->subbufs_consumed)
1697 + return 1;
1698 return 0;
1699 + }
1700
1701 return 1;
1702 }
1703 diff --git a/kernel/signal.c b/kernel/signal.c
1704 index 6af1210..286435b 100644
1705 --- a/kernel/signal.c
1706 +++ b/kernel/signal.c
1707 @@ -1312,6 +1312,7 @@ int send_sigqueue(int sig, struct sigqueue *q, struct task_struct *p)
1708 ret = -1;
1709 goto out_err;
1710 }
1711 + q->info.si_overrun = 0;
1712
1713 if (unlikely(!list_empty(&q->list))) {
1714 /*
1715 diff --git a/lib/random32.c b/lib/random32.c
1716 index ca87d86..217d5c4 100644
1717 --- a/lib/random32.c
1718 +++ b/lib/random32.c
1719 @@ -56,23 +56,12 @@ static u32 __random32(struct rnd_state *state)
1720 return (state->s1 ^ state->s2 ^ state->s3);
1721 }
1722
1723 -static void __set_random32(struct rnd_state *state, unsigned long s)
1724 +/*
1725 + * Handle minimum values for seeds
1726 + */
1727 +static inline u32 __seed(u32 x, u32 m)
1728 {
1729 - if (s == 0)
1730 - s = 1; /* default seed is 1 */
1731 -
1732 -#define LCG(n) (69069 * n)
1733 - state->s1 = LCG(s);
1734 - state->s2 = LCG(state->s1);
1735 - state->s3 = LCG(state->s2);
1736 -
1737 - /* "warm it up" */
1738 - __random32(state);
1739 - __random32(state);
1740 - __random32(state);
1741 - __random32(state);
1742 - __random32(state);
1743 - __random32(state);
1744 + return (x < m) ? x + m : x;
1745 }
1746
1747 /**
1748 @@ -107,7 +96,7 @@ void srandom32(u32 entropy)
1749 */
1750 for_each_possible_cpu (i) {
1751 struct rnd_state *state = &per_cpu(net_rand_state, i);
1752 - __set_random32(state, state->s1 ^ entropy);
1753 + state->s1 = __seed(state->s1 ^ entropy, 1);
1754 }
1755 }
1756 EXPORT_SYMBOL(srandom32);
1757 @@ -122,7 +111,19 @@ static int __init random32_init(void)
1758
1759 for_each_possible_cpu(i) {
1760 struct rnd_state *state = &per_cpu(net_rand_state,i);
1761 - __set_random32(state, i + jiffies);
1762 +
1763 +#define LCG(x) ((x) * 69069) /* super-duper LCG */
1764 + state->s1 = __seed(LCG(i + jiffies), 1);
1765 + state->s2 = __seed(LCG(state->s1), 7);
1766 + state->s3 = __seed(LCG(state->s2), 15);
1767 +
1768 + /* "warm it up" */
1769 + __random32(state);
1770 + __random32(state);
1771 + __random32(state);
1772 + __random32(state);
1773 + __random32(state);
1774 + __random32(state);
1775 }
1776 return 0;
1777 }
1778 @@ -135,13 +136,18 @@ core_initcall(random32_init);
1779 static int __init random32_reseed(void)
1780 {
1781 int i;
1782 - unsigned long seed;
1783
1784 for_each_possible_cpu(i) {
1785 struct rnd_state *state = &per_cpu(net_rand_state,i);
1786 + u32 seeds[3];
1787 +
1788 + get_random_bytes(&seeds, sizeof(seeds));
1789 + state->s1 = __seed(seeds[0], 1);
1790 + state->s2 = __seed(seeds[1], 7);
1791 + state->s3 = __seed(seeds[2], 15);
1792
1793 - get_random_bytes(&seed, sizeof(seed));
1794 - __set_random32(state, seed);
1795 + /* mix it in */
1796 + __random32(state);
1797 }
1798 return 0;
1799 }
1800 diff --git a/mm/memory.c b/mm/memory.c
1801 index df84668..2d7e606 100644
1802 --- a/mm/memory.c
1803 +++ b/mm/memory.c
1804 @@ -2618,16 +2618,26 @@ int make_pages_present(unsigned long addr, unsigned long end)
1805
1806 vma = find_vma(current->mm, addr);
1807 if (!vma)
1808 - return -1;
1809 + return -ENOMEM;
1810 write = (vma->vm_flags & VM_WRITE) != 0;
1811 BUG_ON(addr >= end);
1812 BUG_ON(end > vma->vm_end);
1813 len = DIV_ROUND_UP(end, PAGE_SIZE) - addr/PAGE_SIZE;
1814 ret = get_user_pages(current, current->mm, addr,
1815 len, write, 0, NULL, NULL);
1816 - if (ret < 0)
1817 + if (ret < 0) {
1818 + /*
1819 + SUS require strange return value to mlock
1820 + - invalid addr generate to ENOMEM.
1821 + - out of memory should generate EAGAIN.
1822 + */
1823 + if (ret == -EFAULT)
1824 + ret = -ENOMEM;
1825 + else if (ret == -ENOMEM)
1826 + ret = -EAGAIN;
1827 return ret;
1828 - return ret == len ? 0 : -1;
1829 + }
1830 + return ret == len ? 0 : -ENOMEM;
1831 }
1832
1833 #if !defined(__HAVE_ARCH_GATE_AREA)
1834 diff --git a/mm/mlock.c b/mm/mlock.c
1835 index 7b26560..01fbe93 100644
1836 --- a/mm/mlock.c
1837 +++ b/mm/mlock.c
1838 @@ -78,8 +78,6 @@ success:
1839
1840 mm->locked_vm -= pages;
1841 out:
1842 - if (ret == -ENOMEM)
1843 - ret = -EAGAIN;
1844 return ret;
1845 }
1846
1847 diff --git a/net/dccp/proto.c b/net/dccp/proto.c
1848 index c91d3c1..c3e3acb 100644
1849 --- a/net/dccp/proto.c
1850 +++ b/net/dccp/proto.c
1851 @@ -477,6 +477,11 @@ static int dccp_setsockopt_change(struct sock *sk, int type,
1852
1853 if (copy_from_user(&opt, optval, sizeof(opt)))
1854 return -EFAULT;
1855 + /*
1856 + * rfc4340: 6.1. Change Options
1857 + */
1858 + if (opt.dccpsf_len < 1)
1859 + return -EINVAL;
1860
1861 val = kmalloc(opt.dccpsf_len, GFP_KERNEL);
1862 if (!val)
1863 diff --git a/net/ipv4/ipvs/ip_vs_est.c b/net/ipv4/ipvs/ip_vs_est.c
1864 index dfa0d71..f97ffc5 100644
1865 --- a/net/ipv4/ipvs/ip_vs_est.c
1866 +++ b/net/ipv4/ipvs/ip_vs_est.c
1867 @@ -172,8 +172,11 @@ void ip_vs_kill_estimator(struct ip_vs_stats *stats)
1868 kfree(est);
1869 killed++;
1870 }
1871 - if (killed && est_list == NULL)
1872 - del_timer_sync(&est_timer);
1873 + while (killed && !est_list && try_to_del_timer_sync(&est_timer) < 0) {
1874 + write_unlock_bh(&est_lock);
1875 + cpu_relax();
1876 + write_lock_bh(&est_lock);
1877 + }
1878 write_unlock_bh(&est_lock);
1879 }
1880
1881 diff --git a/net/ipv4/netfilter/nf_nat_snmp_basic.c b/net/ipv4/netfilter/nf_nat_snmp_basic.c
1882 index 5f35f0b..8e4148d 100644
1883 --- a/net/ipv4/netfilter/nf_nat_snmp_basic.c
1884 +++ b/net/ipv4/netfilter/nf_nat_snmp_basic.c
1885 @@ -438,8 +438,8 @@ static unsigned char asn1_oid_decode(struct asn1_ctx *ctx,
1886 unsigned int *len)
1887 {
1888 unsigned long subid;
1889 - unsigned int size;
1890 unsigned long *optr;
1891 + size_t size;
1892
1893 size = eoc - ctx->pointer + 1;
1894
1895 diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
1896 index 8b67ca0..fb1c192 100644
1897 --- a/net/ipv6/ip6_output.c
1898 +++ b/net/ipv6/ip6_output.c
1899 @@ -229,6 +229,10 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
1900 skb_reset_network_header(skb);
1901 hdr = ipv6_hdr(skb);
1902
1903 + /* Allow local fragmentation. */
1904 + if (ipfragok)
1905 + skb->local_df = 1;
1906 +
1907 /*
1908 * Fill in the IPv6 header
1909 */