Gentoo Archives: gentoo-commits

From: "Stratos Psomadakis (psomas)" <psomas@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] linux-patches r2018 - genpatches-2.6/trunk/2.6.32
Date: Sun, 27 Nov 2011 20:05:39
Message-Id: 20111127200519.535462004B@flycatcher.gentoo.org
1 Author: psomas
2 Date: 2011-11-27 20:05:18 +0000 (Sun, 27 Nov 2011)
3 New Revision: 2018
4
5 Added:
6 genpatches-2.6/trunk/2.6.32/1048_linux-2.6.32.49.patch
7 Removed:
8 genpatches-2.6/trunk/2.6.32/2900_disable-wunused-but-set-var-gcc-4-6-0.patch
9 genpatches-2.6/trunk/2.6.32/2901_kbuild-fix-passing-wno-options-to-gcc-4.4.patch
10 Modified:
11 genpatches-2.6/trunk/2.6.32/0000_README
12 Log:
13 Linux patch 2.6.32.49
14
15 Modified: genpatches-2.6/trunk/2.6.32/0000_README
16 ===================================================================
17 --- genpatches-2.6/trunk/2.6.32/0000_README 2011-11-26 20:26:00 UTC (rev 2017)
18 +++ genpatches-2.6/trunk/2.6.32/0000_README 2011-11-27 20:05:18 UTC (rev 2018)
19 @@ -231,14 +231,10 @@
20 From: http://www.kernel.org
21 Desc: Linux 2.6.32.48
22
23 -Patch: 2900_disable-wunused-but-set-var-gcc-4-6-0.patch
24 -From: https://bugs.gentoo.org/show_bug.cgi?id=366579
25 -Desc: Disable -Wunused-but-set-variable for gcc 4.6.0. Thanks to Stratos Psomadakis
26 +Patch: 1048_2.6.32.49.patch
27 +From: http://www.kernel.org
28 +Desc: Linux 2.6.32.49
29
30 -Patch: 2901_kbuild-fix-passing-wno-options-to-gcc-4.4.patch
31 -From: https://patchwork.kernel.org/patch/1010172/
32 -Desc: Fix passing -Wno options to gcc-4.4
33 -
34 Patch: 4200_fbcondecor-0.9.6.patch
35 From: http://dev.gentoo.org/~spock
36 Desc: Bootsplash successor by Michal Januszewski
37
38 Added: genpatches-2.6/trunk/2.6.32/1048_linux-2.6.32.49.patch
39 ===================================================================
40 --- genpatches-2.6/trunk/2.6.32/1048_linux-2.6.32.49.patch (rev 0)
41 +++ genpatches-2.6/trunk/2.6.32/1048_linux-2.6.32.49.patch 2011-11-27 20:05:18 UTC (rev 2018)
42 @@ -0,0 +1,2143 @@
43 +diff --git a/Documentation/Makefile b/Documentation/Makefile
44 +index 94b9457..043d7da 100644
45 +--- a/Documentation/Makefile
46 ++++ b/Documentation/Makefile
47 +@@ -1,3 +1,3 @@
48 + obj-m := DocBook/ accounting/ auxdisplay/ connector/ \
49 + filesystems/configfs/ ia64/ networking/ \
50 +- pcmcia/ spi/ video4linux/ vm/ watchdog/src/
51 ++ pcmcia/ spi/ vm/ watchdog/src/
52 +diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
53 +index 71c602d..ab8689b 100644
54 +--- a/Documentation/kbuild/makefiles.txt
55 ++++ b/Documentation/kbuild/makefiles.txt
56 +@@ -502,6 +502,18 @@ more details, with real examples.
57 + gcc >= 3.00. For gcc < 3.00, -malign-functions=4 is used.
58 + Note: cc-option-align uses KBUILD_CFLAGS for $(CC) options
59 +
60 ++ cc-disable-warning
61 ++ cc-disable-warning checks if gcc supports a given warning and returns
62 ++ the commandline switch to disable it. This special function is needed,
63 ++ because gcc 4.4 and later accept any unknown -Wno-* option and only
64 ++ warn about it if there is another warning in the source file.
65 ++
66 ++ Example:
67 ++ KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
68 ++
69 ++ In the above example, -Wno-unused-but-set-variable will be added to
70 ++ KBUILD_CFLAGS only if gcc really accepts it.
71 ++
72 + cc-version
73 + cc-version returns a numerical version of the $(CC) compiler version.
74 + The format is <major><minor> where both are two digits. So for example
75 +diff --git a/Documentation/video4linux/Makefile b/Documentation/video4linux/Makefile
76 +deleted file mode 100644
77 +index 1ed0e98..0000000
78 +--- a/Documentation/video4linux/Makefile
79 ++++ /dev/null
80 +@@ -1,8 +0,0 @@
81 +-# kbuild trick to avoid linker error. Can be omitted if a module is built.
82 +-obj- := dummy.o
83 +-
84 +-# List of programs to build
85 +-hostprogs-y := v4lgrab
86 +-
87 +-# Tell kbuild to always build the programs
88 +-always := $(hostprogs-y)
89 +diff --git a/Documentation/video4linux/v4lgrab.c b/Documentation/video4linux/v4lgrab.c
90 +deleted file mode 100644
91 +index c8ded17..0000000
92 +--- a/Documentation/video4linux/v4lgrab.c
93 ++++ /dev/null
94 +@@ -1,201 +0,0 @@
95 +-/* Simple Video4Linux image grabber. */
96 +-/*
97 +- * Video4Linux Driver Test/Example Framegrabbing Program
98 +- *
99 +- * Compile with:
100 +- * gcc -s -Wall -Wstrict-prototypes v4lgrab.c -o v4lgrab
101 +- * Use as:
102 +- * v4lgrab >image.ppm
103 +- *
104 +- * Copyright (C) 1998-05-03, Phil Blundell <philb@×××.org>
105 +- * Copied from http://www.tazenda.demon.co.uk/phil/vgrabber.c
106 +- * with minor modifications (Dave Forrest, drf5n@××××××××.edu).
107 +- *
108 +- *
109 +- * For some cameras you may need to pre-load libv4l to perform
110 +- * the necessary decompression, e.g.:
111 +- *
112 +- * export LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so
113 +- * ./v4lgrab >image.ppm
114 +- *
115 +- * see http://hansdegoede.livejournal.com/3636.html for details.
116 +- *
117 +- */
118 +-
119 +-#include <unistd.h>
120 +-#include <sys/types.h>
121 +-#include <sys/stat.h>
122 +-#include <fcntl.h>
123 +-#include <stdio.h>
124 +-#include <sys/ioctl.h>
125 +-#include <stdlib.h>
126 +-
127 +-#include <linux/types.h>
128 +-#include <linux/videodev.h>
129 +-
130 +-#define VIDEO_DEV "/dev/video0"
131 +-
132 +-/* Stole this from tvset.c */
133 +-
134 +-#define READ_VIDEO_PIXEL(buf, format, depth, r, g, b) \
135 +-{ \
136 +- switch (format) \
137 +- { \
138 +- case VIDEO_PALETTE_GREY: \
139 +- switch (depth) \
140 +- { \
141 +- case 4: \
142 +- case 6: \
143 +- case 8: \
144 +- (r) = (g) = (b) = (*buf++ << 8);\
145 +- break; \
146 +- \
147 +- case 16: \
148 +- (r) = (g) = (b) = \
149 +- *((unsigned short *) buf); \
150 +- buf += 2; \
151 +- break; \
152 +- } \
153 +- break; \
154 +- \
155 +- \
156 +- case VIDEO_PALETTE_RGB565: \
157 +- { \
158 +- unsigned short tmp = *(unsigned short *)buf; \
159 +- (r) = tmp&0xF800; \
160 +- (g) = (tmp<<5)&0xFC00; \
161 +- (b) = (tmp<<11)&0xF800; \
162 +- buf += 2; \
163 +- } \
164 +- break; \
165 +- \
166 +- case VIDEO_PALETTE_RGB555: \
167 +- (r) = (buf[0]&0xF8)<<8; \
168 +- (g) = ((buf[0] << 5 | buf[1] >> 3)&0xF8)<<8; \
169 +- (b) = ((buf[1] << 2 ) & 0xF8)<<8; \
170 +- buf += 2; \
171 +- break; \
172 +- \
173 +- case VIDEO_PALETTE_RGB24: \
174 +- (r) = buf[0] << 8; (g) = buf[1] << 8; \
175 +- (b) = buf[2] << 8; \
176 +- buf += 3; \
177 +- break; \
178 +- \
179 +- default: \
180 +- fprintf(stderr, \
181 +- "Format %d not yet supported\n", \
182 +- format); \
183 +- } \
184 +-}
185 +-
186 +-static int get_brightness_adj(unsigned char *image, long size, int *brightness) {
187 +- long i, tot = 0;
188 +- for (i=0;i<size*3;i++)
189 +- tot += image[i];
190 +- *brightness = (128 - tot/(size*3))/3;
191 +- return !((tot/(size*3)) >= 126 && (tot/(size*3)) <= 130);
192 +-}
193 +-
194 +-int main(int argc, char ** argv)
195 +-{
196 +- int fd = open(VIDEO_DEV, O_RDONLY), f;
197 +- struct video_capability cap;
198 +- struct video_window win;
199 +- struct video_picture vpic;
200 +-
201 +- unsigned char *buffer, *src;
202 +- int bpp = 24, r = 0, g = 0, b = 0;
203 +- unsigned int i, src_depth = 16;
204 +-
205 +- if (fd < 0) {
206 +- perror(VIDEO_DEV);
207 +- exit(1);
208 +- }
209 +-
210 +- if (ioctl(fd, VIDIOCGCAP, &cap) < 0) {
211 +- perror("VIDIOGCAP");
212 +- fprintf(stderr, "(" VIDEO_DEV " not a video4linux device?)\n");
213 +- close(fd);
214 +- exit(1);
215 +- }
216 +-
217 +- if (ioctl(fd, VIDIOCGWIN, &win) < 0) {
218 +- perror("VIDIOCGWIN");
219 +- close(fd);
220 +- exit(1);
221 +- }
222 +-
223 +- if (ioctl(fd, VIDIOCGPICT, &vpic) < 0) {
224 +- perror("VIDIOCGPICT");
225 +- close(fd);
226 +- exit(1);
227 +- }
228 +-
229 +- if (cap.type & VID_TYPE_MONOCHROME) {
230 +- vpic.depth=8;
231 +- vpic.palette=VIDEO_PALETTE_GREY; /* 8bit grey */
232 +- if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) {
233 +- vpic.depth=6;
234 +- if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) {
235 +- vpic.depth=4;
236 +- if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) {
237 +- fprintf(stderr, "Unable to find a supported capture format.\n");
238 +- close(fd);
239 +- exit(1);
240 +- }
241 +- }
242 +- }
243 +- } else {
244 +- vpic.depth=24;
245 +- vpic.palette=VIDEO_PALETTE_RGB24;
246 +-
247 +- if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) {
248 +- vpic.palette=VIDEO_PALETTE_RGB565;
249 +- vpic.depth=16;
250 +-
251 +- if(ioctl(fd, VIDIOCSPICT, &vpic)==-1) {
252 +- vpic.palette=VIDEO_PALETTE_RGB555;
253 +- vpic.depth=15;
254 +-
255 +- if(ioctl(fd, VIDIOCSPICT, &vpic)==-1) {
256 +- fprintf(stderr, "Unable to find a supported capture format.\n");
257 +- return -1;
258 +- }
259 +- }
260 +- }
261 +- }
262 +-
263 +- buffer = malloc(win.width * win.height * bpp);
264 +- if (!buffer) {
265 +- fprintf(stderr, "Out of memory.\n");
266 +- exit(1);
267 +- }
268 +-
269 +- do {
270 +- int newbright;
271 +- read(fd, buffer, win.width * win.height * bpp);
272 +- f = get_brightness_adj(buffer, win.width * win.height, &newbright);
273 +- if (f) {
274 +- vpic.brightness += (newbright << 8);
275 +- if(ioctl(fd, VIDIOCSPICT, &vpic)==-1) {
276 +- perror("VIDIOSPICT");
277 +- break;
278 +- }
279 +- }
280 +- } while (f);
281 +-
282 +- fprintf(stdout, "P6\n%d %d 255\n", win.width, win.height);
283 +-
284 +- src = buffer;
285 +-
286 +- for (i = 0; i < win.width * win.height; i++) {
287 +- READ_VIDEO_PIXEL(src, vpic.palette, src_depth, r, g, b);
288 +- fputc(r>>8, stdout);
289 +- fputc(g>>8, stdout);
290 +- fputc(b>>8, stdout);
291 +- }
292 +-
293 +- close(fd);
294 +- return 0;
295 +-}
296 +diff --git a/Makefile b/Makefile
297 +index 400a175..a19b0e8 100644
298 +--- a/Makefile
299 ++++ b/Makefile
300 +@@ -537,6 +537,9 @@ ifndef CONFIG_CC_STACKPROTECTOR
301 + KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
302 + endif
303 +
304 ++# This warning generated too much noise in a regular build.
305 ++KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
306 ++
307 + ifdef CONFIG_FRAME_POINTER
308 + KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
309 + else
310 +@@ -565,7 +568,7 @@ CHECKFLAGS += $(NOSTDINC_FLAGS)
311 + KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
312 +
313 + # disable pointer signed / unsigned warnings in gcc 4.0
314 +-KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,)
315 ++KBUILD_CFLAGS += $(call cc-disable-warning, pointer-sign)
316 +
317 + # disable invalid "can't wrap" optimizations for signed / pointers
318 + KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
319 +diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c
320 +index 2bef526..204f650 100644
321 +--- a/arch/ia64/hp/sim/simserial.c
322 ++++ b/arch/ia64/hp/sim/simserial.c
323 +@@ -395,7 +395,7 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
324 + {
325 + if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
326 + (cmd != TIOCSERCONFIG) && (cmd != TIOCSERGSTRUCT) &&
327 +- (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) {
328 ++ (cmd != TIOCMIWAIT)) {
329 + if (tty->flags & (1 << TTY_IO_ERROR))
330 + return -EIO;
331 + }
332 +@@ -433,16 +433,6 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
333 + case TIOCMIWAIT:
334 + printk(KERN_INFO "rs_ioctl: TIOCMIWAIT: called\n");
335 + return 0;
336 +- /*
337 +- * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
338 +- * Return: write counters to the user passed counter struct
339 +- * NB: both 1->0 and 0->1 transitions are counted except for
340 +- * RI where only 0->1 is counted.
341 +- */
342 +- case TIOCGICOUNT:
343 +- printk(KERN_INFO "rs_ioctl: TIOCGICOUNT called\n");
344 +- return 0;
345 +-
346 + case TIOCSERGWILD:
347 + case TIOCSERSWILD:
348 + /* "setserial -W" is called in Debian boot */
349 +diff --git a/drivers/base/sys.c b/drivers/base/sys.c
350 +index 0d90390..3f202f7 100644
351 +--- a/drivers/base/sys.c
352 ++++ b/drivers/base/sys.c
353 +@@ -471,6 +471,12 @@ int sysdev_resume(void)
354 + {
355 + struct sysdev_class *cls;
356 +
357 ++ /*
358 ++ * Called from syscore in mainline but called directly here
359 ++ * since syscore does not exist in this tree.
360 ++ */
361 ++ irq_pm_syscore_resume();
362 ++
363 + WARN_ONCE(!irqs_disabled(),
364 + "Interrupts enabled while resuming system devices\n");
365 +
366 +diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c
367 +index 6c32fbf..579d479 100644
368 +--- a/drivers/char/amiserial.c
369 ++++ b/drivers/char/amiserial.c
370 +@@ -1262,6 +1262,36 @@ static int rs_break(struct tty_struct *tty, int break_state)
371 + return 0;
372 + }
373 +
374 ++/*
375 ++ * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
376 ++ * Return: write counters to the user passed counter struct
377 ++ * NB: both 1->0 and 0->1 transitions are counted except for
378 ++ * RI where only 0->1 is counted.
379 ++ */
380 ++static int rs_get_icount(struct tty_struct *tty,
381 ++ struct serial_icounter_struct *icount)
382 ++{
383 ++ struct async_struct *info = tty->driver_data;
384 ++ struct async_icount cnow;
385 ++ unsigned long flags;
386 ++
387 ++ local_irq_save(flags);
388 ++ cnow = info->state->icount;
389 ++ local_irq_restore(flags);
390 ++ icount->cts = cnow.cts;
391 ++ icount->dsr = cnow.dsr;
392 ++ icount->rng = cnow.rng;
393 ++ icount->dcd = cnow.dcd;
394 ++ icount->rx = cnow.rx;
395 ++ icount->tx = cnow.tx;
396 ++ icount->frame = cnow.frame;
397 ++ icount->overrun = cnow.overrun;
398 ++ icount->parity = cnow.parity;
399 ++ icount->brk = cnow.brk;
400 ++ icount->buf_overrun = cnow.buf_overrun;
401 ++
402 ++ return 0;
403 ++}
404 +
405 + static int rs_ioctl(struct tty_struct *tty, struct file * file,
406 + unsigned int cmd, unsigned long arg)
407 +@@ -1331,31 +1361,6 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
408 + }
409 + /* NOTREACHED */
410 +
411 +- /*
412 +- * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
413 +- * Return: write counters to the user passed counter struct
414 +- * NB: both 1->0 and 0->1 transitions are counted except for
415 +- * RI where only 0->1 is counted.
416 +- */
417 +- case TIOCGICOUNT:
418 +- local_irq_save(flags);
419 +- cnow = info->state->icount;
420 +- local_irq_restore(flags);
421 +- icount.cts = cnow.cts;
422 +- icount.dsr = cnow.dsr;
423 +- icount.rng = cnow.rng;
424 +- icount.dcd = cnow.dcd;
425 +- icount.rx = cnow.rx;
426 +- icount.tx = cnow.tx;
427 +- icount.frame = cnow.frame;
428 +- icount.overrun = cnow.overrun;
429 +- icount.parity = cnow.parity;
430 +- icount.brk = cnow.brk;
431 +- icount.buf_overrun = cnow.buf_overrun;
432 +-
433 +- if (copy_to_user(argp, &icount, sizeof(icount)))
434 +- return -EFAULT;
435 +- return 0;
436 + case TIOCSERGWILD:
437 + case TIOCSERSWILD:
438 + /* "setserial -W" is called in Debian boot */
439 +@@ -1948,6 +1953,7 @@ static const struct tty_operations serial_ops = {
440 + .wait_until_sent = rs_wait_until_sent,
441 + .tiocmget = rs_tiocmget,
442 + .tiocmset = rs_tiocmset,
443 ++ .get_icount = rs_get_icount,
444 + .proc_fops = &rs_proc_fops,
445 + };
446 +
447 +diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
448 +index 4254457..a0369dc 100644
449 +--- a/drivers/char/cyclades.c
450 ++++ b/drivers/char/cyclades.c
451 +@@ -2798,29 +2798,6 @@ cy_ioctl(struct tty_struct *tty, struct file *file,
452 + * NB: both 1->0 and 0->1 transitions are counted except for
453 + * RI where only 0->1 is counted.
454 + */
455 +- case TIOCGICOUNT: {
456 +- struct serial_icounter_struct sic = { };
457 +-
458 +- spin_lock_irqsave(&info->card->card_lock, flags);
459 +- cnow = info->icount;
460 +- spin_unlock_irqrestore(&info->card->card_lock, flags);
461 +-
462 +- sic.cts = cnow.cts;
463 +- sic.dsr = cnow.dsr;
464 +- sic.rng = cnow.rng;
465 +- sic.dcd = cnow.dcd;
466 +- sic.rx = cnow.rx;
467 +- sic.tx = cnow.tx;
468 +- sic.frame = cnow.frame;
469 +- sic.overrun = cnow.overrun;
470 +- sic.parity = cnow.parity;
471 +- sic.brk = cnow.brk;
472 +- sic.buf_overrun = cnow.buf_overrun;
473 +-
474 +- if (copy_to_user(argp, &sic, sizeof(sic)))
475 +- ret_val = -EFAULT;
476 +- break;
477 +- }
478 + default:
479 + ret_val = -ENOIOCTLCMD;
480 + }
481 +@@ -2832,6 +2809,31 @@ cy_ioctl(struct tty_struct *tty, struct file *file,
482 + return ret_val;
483 + } /* cy_ioctl */
484 +
485 ++static int cy_get_icount(struct tty_struct *tty,
486 ++ struct serial_icounter_struct *sic)
487 ++{
488 ++ struct cyclades_port *info = tty->driver_data;
489 ++ struct cyclades_icount cnow; /* Used to snapshot */
490 ++ unsigned long flags;
491 ++
492 ++ spin_lock_irqsave(&info->card->card_lock, flags);
493 ++ cnow = info->icount;
494 ++ spin_unlock_irqrestore(&info->card->card_lock, flags);
495 ++
496 ++ sic->cts = cnow.cts;
497 ++ sic->dsr = cnow.dsr;
498 ++ sic->rng = cnow.rng;
499 ++ sic->dcd = cnow.dcd;
500 ++ sic->rx = cnow.rx;
501 ++ sic->tx = cnow.tx;
502 ++ sic->frame = cnow.frame;
503 ++ sic->overrun = cnow.overrun;
504 ++ sic->parity = cnow.parity;
505 ++ sic->brk = cnow.brk;
506 ++ sic->buf_overrun = cnow.buf_overrun;
507 ++ return 0;
508 ++}
509 ++
510 + /*
511 + * This routine allows the tty driver to be notified when
512 + * device's termios settings have changed. Note that a
513 +@@ -4098,6 +4100,7 @@ static const struct tty_operations cy_ops = {
514 + .wait_until_sent = cy_wait_until_sent,
515 + .tiocmget = cy_tiocmget,
516 + .tiocmset = cy_tiocmset,
517 ++ .get_icount = cy_get_icount,
518 + .proc_fops = &cyclades_proc_fops,
519 + };
520 +
521 +diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c
522 +index 517271c..3bec541 100644
523 +--- a/drivers/char/ip2/ip2main.c
524 ++++ b/drivers/char/ip2/ip2main.c
525 +@@ -183,6 +183,8 @@ static void ip2_hangup(PTTY);
526 + static int ip2_tiocmget(struct tty_struct *tty, struct file *file);
527 + static int ip2_tiocmset(struct tty_struct *tty, struct file *file,
528 + unsigned int set, unsigned int clear);
529 ++static int ip2_get_icount(struct tty_struct *tty,
530 ++ struct serial_icounter_struct *icount);
531 +
532 + static void set_irq(int, int);
533 + static void ip2_interrupt_bh(struct work_struct *work);
534 +@@ -448,6 +450,7 @@ static const struct tty_operations ip2_ops = {
535 + .hangup = ip2_hangup,
536 + .tiocmget = ip2_tiocmget,
537 + .tiocmset = ip2_tiocmset,
538 ++ .get_icount = ip2_get_icount,
539 + .proc_fops = &ip2_proc_fops,
540 + };
541 +
542 +@@ -2112,7 +2115,6 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg )
543 + i2ChanStrPtr pCh = DevTable[tty->index];
544 + i2eBordStrPtr pB;
545 + struct async_icount cprev, cnow; /* kernel counter temps */
546 +- struct serial_icounter_struct __user *p_cuser;
547 + int rc = 0;
548 + unsigned long flags;
549 + void __user *argp = (void __user *)arg;
550 +@@ -2281,34 +2283,6 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg )
551 + break;
552 +
553 + /*
554 +- * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
555 +- * Return: write counters to the user passed counter struct
556 +- * NB: both 1->0 and 0->1 transitions are counted except for RI where
557 +- * only 0->1 is counted. The controller is quite capable of counting
558 +- * both, but this done to preserve compatibility with the standard
559 +- * serial driver.
560 +- */
561 +- case TIOCGICOUNT:
562 +- ip2trace (CHANN, ITRC_IOCTL, 11, 1, rc );
563 +-
564 +- write_lock_irqsave(&pB->read_fifo_spinlock, flags);
565 +- cnow = pCh->icount;
566 +- write_unlock_irqrestore(&pB->read_fifo_spinlock, flags);
567 +- p_cuser = argp;
568 +- rc = put_user(cnow.cts, &p_cuser->cts);
569 +- rc = put_user(cnow.dsr, &p_cuser->dsr);
570 +- rc = put_user(cnow.rng, &p_cuser->rng);
571 +- rc = put_user(cnow.dcd, &p_cuser->dcd);
572 +- rc = put_user(cnow.rx, &p_cuser->rx);
573 +- rc = put_user(cnow.tx, &p_cuser->tx);
574 +- rc = put_user(cnow.frame, &p_cuser->frame);
575 +- rc = put_user(cnow.overrun, &p_cuser->overrun);
576 +- rc = put_user(cnow.parity, &p_cuser->parity);
577 +- rc = put_user(cnow.brk, &p_cuser->brk);
578 +- rc = put_user(cnow.buf_overrun, &p_cuser->buf_overrun);
579 +- break;
580 +-
581 +- /*
582 + * The rest are not supported by this driver. By returning -ENOIOCTLCMD they
583 + * will be passed to the line discipline for it to handle.
584 + */
585 +@@ -2332,6 +2306,46 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg )
586 + return rc;
587 + }
588 +
589 ++static int ip2_get_icount(struct tty_struct *tty,
590 ++ struct serial_icounter_struct *icount)
591 ++{
592 ++ i2ChanStrPtr pCh = DevTable[tty->index];
593 ++ i2eBordStrPtr pB;
594 ++ struct async_icount cnow; /* kernel counter temp */
595 ++ unsigned long flags;
596 ++
597 ++ if ( pCh == NULL )
598 ++ return -ENODEV;
599 ++
600 ++ pB = pCh->pMyBord;
601 ++
602 ++ /*
603 ++ * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
604 ++ * Return: write counters to the user passed counter struct
605 ++ * NB: both 1->0 and 0->1 transitions are counted except for RI where
606 ++ * only 0->1 is counted. The controller is quite capable of counting
607 ++ * both, but this done to preserve compatibility with the standard
608 ++ * serial driver.
609 ++ */
610 ++
611 ++ write_lock_irqsave(&pB->read_fifo_spinlock, flags);
612 ++ cnow = pCh->icount;
613 ++ write_unlock_irqrestore(&pB->read_fifo_spinlock, flags);
614 ++
615 ++ icount->cts = cnow.cts;
616 ++ icount->dsr = cnow.dsr;
617 ++ icount->rng = cnow.rng;
618 ++ icount->dcd = cnow.dcd;
619 ++ icount->rx = cnow.rx;
620 ++ icount->tx = cnow.tx;
621 ++ icount->frame = cnow.frame;
622 ++ icount->overrun = cnow.overrun;
623 ++ icount->parity = cnow.parity;
624 ++ icount->brk = cnow.brk;
625 ++ icount->buf_overrun = cnow.buf_overrun;
626 ++ return 0;
627 ++}
628 ++
629 + /******************************************************************************/
630 + /* Function: GetSerialInfo() */
631 + /* Parameters: Pointer to channel structure */
632 +diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
633 +index 5e28d39..4b97406 100644
634 +--- a/drivers/char/mxser.c
635 ++++ b/drivers/char/mxser.c
636 +@@ -1736,7 +1736,7 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file,
637 + return 0;
638 + }
639 +
640 +- if (cmd != TIOCGSERIAL && cmd != TIOCMIWAIT && cmd != TIOCGICOUNT &&
641 ++ if (cmd != TIOCGSERIAL && cmd != TIOCMIWAIT &&
642 + test_bit(TTY_IO_ERROR, &tty->flags))
643 + return -EIO;
644 +
645 +@@ -1766,32 +1766,6 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file,
646 +
647 + return wait_event_interruptible(info->port.delta_msr_wait,
648 + mxser_cflags_changed(info, arg, &cnow));
649 +- /*
650 +- * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
651 +- * Return: write counters to the user passed counter struct
652 +- * NB: both 1->0 and 0->1 transitions are counted except for
653 +- * RI where only 0->1 is counted.
654 +- */
655 +- case TIOCGICOUNT: {
656 +- struct serial_icounter_struct icnt = { 0 };
657 +- spin_lock_irqsave(&info->slock, flags);
658 +- cnow = info->icount;
659 +- spin_unlock_irqrestore(&info->slock, flags);
660 +-
661 +- icnt.frame = cnow.frame;
662 +- icnt.brk = cnow.brk;
663 +- icnt.overrun = cnow.overrun;
664 +- icnt.buf_overrun = cnow.buf_overrun;
665 +- icnt.parity = cnow.parity;
666 +- icnt.rx = cnow.rx;
667 +- icnt.tx = cnow.tx;
668 +- icnt.cts = cnow.cts;
669 +- icnt.dsr = cnow.dsr;
670 +- icnt.rng = cnow.rng;
671 +- icnt.dcd = cnow.dcd;
672 +-
673 +- return copy_to_user(argp, &icnt, sizeof(icnt)) ? -EFAULT : 0;
674 +- }
675 + case MOXA_HighSpeedOn:
676 + return put_user(info->baud_base != 115200 ? 1 : 0, (int __user *)argp);
677 + case MOXA_SDS_RSTICOUNTER:
678 +@@ -1862,6 +1836,39 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file,
679 + return 0;
680 + }
681 +
682 ++ /*
683 ++ * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
684 ++ * Return: write counters to the user passed counter struct
685 ++ * NB: both 1->0 and 0->1 transitions are counted except for
686 ++ * RI where only 0->1 is counted.
687 ++ */
688 ++
689 ++static int mxser_get_icount(struct tty_struct *tty,
690 ++ struct serial_icounter_struct *icount)
691 ++
692 ++{
693 ++ struct mxser_port *info = tty->driver_data;
694 ++ struct async_icount cnow;
695 ++ unsigned long flags;
696 ++
697 ++ spin_lock_irqsave(&info->slock, flags);
698 ++ cnow = info->icount;
699 ++ spin_unlock_irqrestore(&info->slock, flags);
700 ++
701 ++ icount->frame = cnow.frame;
702 ++ icount->brk = cnow.brk;
703 ++ icount->overrun = cnow.overrun;
704 ++ icount->buf_overrun = cnow.buf_overrun;
705 ++ icount->parity = cnow.parity;
706 ++ icount->rx = cnow.rx;
707 ++ icount->tx = cnow.tx;
708 ++ icount->cts = cnow.cts;
709 ++ icount->dsr = cnow.dsr;
710 ++ icount->rng = cnow.rng;
711 ++ icount->dcd = cnow.dcd;
712 ++ return 0;
713 ++}
714 ++
715 + static void mxser_stoprx(struct tty_struct *tty)
716 + {
717 + struct mxser_port *info = tty->driver_data;
718 +@@ -2358,6 +2365,7 @@ static const struct tty_operations mxser_ops = {
719 + .wait_until_sent = mxser_wait_until_sent,
720 + .tiocmget = mxser_tiocmget,
721 + .tiocmset = mxser_tiocmset,
722 ++ .get_icount = mxser_get_icount,
723 + };
724 +
725 + struct tty_port_operations mxser_port_ops = {
726 +diff --git a/drivers/char/nozomi.c b/drivers/char/nozomi.c
727 +index dc52f75..19b3e1d 100644
728 +--- a/drivers/char/nozomi.c
729 ++++ b/drivers/char/nozomi.c
730 +@@ -1783,24 +1783,24 @@ static int ntty_cflags_changed(struct port *port, unsigned long flags,
731 + return ret;
732 + }
733 +
734 +-static int ntty_ioctl_tiocgicount(struct port *port, void __user *argp)
735 ++static int ntty_tiocgicount(struct tty_struct *tty,
736 ++ struct serial_icounter_struct *icount)
737 + {
738 ++ struct port *port = tty->driver_data;
739 + const struct async_icount cnow = port->tty_icount;
740 +- struct serial_icounter_struct icount;
741 +-
742 +- icount.cts = cnow.cts;
743 +- icount.dsr = cnow.dsr;
744 +- icount.rng = cnow.rng;
745 +- icount.dcd = cnow.dcd;
746 +- icount.rx = cnow.rx;
747 +- icount.tx = cnow.tx;
748 +- icount.frame = cnow.frame;
749 +- icount.overrun = cnow.overrun;
750 +- icount.parity = cnow.parity;
751 +- icount.brk = cnow.brk;
752 +- icount.buf_overrun = cnow.buf_overrun;
753 +-
754 +- return copy_to_user(argp, &icount, sizeof(icount)) ? -EFAULT : 0;
755 ++
756 ++ icount->cts = cnow.cts;
757 ++ icount->dsr = cnow.dsr;
758 ++ icount->rng = cnow.rng;
759 ++ icount->dcd = cnow.dcd;
760 ++ icount->rx = cnow.rx;
761 ++ icount->tx = cnow.tx;
762 ++ icount->frame = cnow.frame;
763 ++ icount->overrun = cnow.overrun;
764 ++ icount->parity = cnow.parity;
765 ++ icount->brk = cnow.brk;
766 ++ icount->buf_overrun = cnow.buf_overrun;
767 ++ return 0;
768 + }
769 +
770 + static int ntty_ioctl(struct tty_struct *tty, struct file *file,
771 +@@ -1819,9 +1819,7 @@ static int ntty_ioctl(struct tty_struct *tty, struct file *file,
772 + rval = wait_event_interruptible(port->tty_wait,
773 + ntty_cflags_changed(port, arg, &cprev));
774 + break;
775 +- } case TIOCGICOUNT:
776 +- rval = ntty_ioctl_tiocgicount(port, argp);
777 +- break;
778 ++ }
779 + default:
780 + DBG1("ERR: 0x%08X, %d", cmd, cmd);
781 + break;
782 +@@ -1895,6 +1893,7 @@ static const struct tty_operations tty_ops = {
783 + .chars_in_buffer = ntty_chars_in_buffer,
784 + .tiocmget = ntty_tiocmget,
785 + .tiocmset = ntty_tiocmset,
786 ++ .get_icount = ntty_tiocgicount,
787 + };
788 +
789 + /* Module initialization */
790 +diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
791 +index a08c899..74d124b 100644
792 +--- a/drivers/char/pcmcia/synclink_cs.c
793 ++++ b/drivers/char/pcmcia/synclink_cs.c
794 +@@ -2252,6 +2252,32 @@ static int mgslpc_break(struct tty_struct *tty, int break_state)
795 + return 0;
796 + }
797 +
798 ++static int mgslpc_get_icount(struct tty_struct *tty,
799 ++ struct serial_icounter_struct *icount)
800 ++{
801 ++ MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data;
802 ++ struct mgsl_icount cnow; /* kernel counter temps */
803 ++ unsigned long flags;
804 ++
805 ++ spin_lock_irqsave(&info->lock,flags);
806 ++ cnow = info->icount;
807 ++ spin_unlock_irqrestore(&info->lock,flags);
808 ++
809 ++ icount->cts = cnow.cts;
810 ++ icount->dsr = cnow.dsr;
811 ++ icount->rng = cnow.rng;
812 ++ icount->dcd = cnow.dcd;
813 ++ icount->rx = cnow.rx;
814 ++ icount->tx = cnow.tx;
815 ++ icount->frame = cnow.frame;
816 ++ icount->overrun = cnow.overrun;
817 ++ icount->parity = cnow.parity;
818 ++ icount->brk = cnow.brk;
819 ++ icount->buf_overrun = cnow.buf_overrun;
820 ++
821 ++ return 0;
822 ++}
823 ++
824 + /* Service an IOCTL request
825 + *
826 + * Arguments:
827 +@@ -2267,11 +2293,7 @@ static int mgslpc_ioctl(struct tty_struct *tty, struct file * file,
828 + unsigned int cmd, unsigned long arg)
829 + {
830 + MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data;
831 +- int error;
832 +- struct mgsl_icount cnow; /* kernel counter temps */
833 +- struct serial_icounter_struct __user *p_cuser; /* user space */
834 + void __user *argp = (void __user *)arg;
835 +- unsigned long flags;
836 +
837 + if (debug_level >= DEBUG_LEVEL_INFO)
838 + printk("%s(%d):mgslpc_ioctl %s cmd=%08X\n", __FILE__,__LINE__,
839 +@@ -2281,7 +2303,7 @@ static int mgslpc_ioctl(struct tty_struct *tty, struct file * file,
840 + return -ENODEV;
841 +
842 + if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
843 +- (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) {
844 ++ (cmd != TIOCMIWAIT)) {
845 + if (tty->flags & (1 << TTY_IO_ERROR))
846 + return -EIO;
847 + }
848 +@@ -2311,34 +2333,6 @@ static int mgslpc_ioctl(struct tty_struct *tty, struct file * file,
849 + return wait_events(info, argp);
850 + case TIOCMIWAIT:
851 + return modem_input_wait(info,(int)arg);
852 +- case TIOCGICOUNT:
853 +- spin_lock_irqsave(&info->lock,flags);
854 +- cnow = info->icount;
855 +- spin_unlock_irqrestore(&info->lock,flags);
856 +- p_cuser = argp;
857 +- PUT_USER(error,cnow.cts, &p_cuser->cts);
858 +- if (error) return error;
859 +- PUT_USER(error,cnow.dsr, &p_cuser->dsr);
860 +- if (error) return error;
861 +- PUT_USER(error,cnow.rng, &p_cuser->rng);
862 +- if (error) return error;
863 +- PUT_USER(error,cnow.dcd, &p_cuser->dcd);
864 +- if (error) return error;
865 +- PUT_USER(error,cnow.rx, &p_cuser->rx);
866 +- if (error) return error;
867 +- PUT_USER(error,cnow.tx, &p_cuser->tx);
868 +- if (error) return error;
869 +- PUT_USER(error,cnow.frame, &p_cuser->frame);
870 +- if (error) return error;
871 +- PUT_USER(error,cnow.overrun, &p_cuser->overrun);
872 +- if (error) return error;
873 +- PUT_USER(error,cnow.parity, &p_cuser->parity);
874 +- if (error) return error;
875 +- PUT_USER(error,cnow.brk, &p_cuser->brk);
876 +- if (error) return error;
877 +- PUT_USER(error,cnow.buf_overrun, &p_cuser->buf_overrun);
878 +- if (error) return error;
879 +- return 0;
880 + default:
881 + return -ENOIOCTLCMD;
882 + }
883 +diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
884 +index 4846b73..b118959 100644
885 +--- a/drivers/char/synclink.c
886 ++++ b/drivers/char/synclink.c
887 +@@ -2920,6 +2920,38 @@ static int mgsl_break(struct tty_struct *tty, int break_state)
888 +
889 + } /* end of mgsl_break() */
890 +
891 ++/*
892 ++ * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
893 ++ * Return: write counters to the user passed counter struct
894 ++ * NB: both 1->0 and 0->1 transitions are counted except for
895 ++ * RI where only 0->1 is counted.
896 ++ */
897 ++static int msgl_get_icount(struct tty_struct *tty,
898 ++ struct serial_icounter_struct *icount)
899 ++
900 ++{
901 ++ struct mgsl_struct * info = tty->driver_data;
902 ++ struct mgsl_icount cnow; /* kernel counter temps */
903 ++ unsigned long flags;
904 ++
905 ++ spin_lock_irqsave(&info->irq_spinlock,flags);
906 ++ cnow = info->icount;
907 ++ spin_unlock_irqrestore(&info->irq_spinlock,flags);
908 ++
909 ++ icount->cts = cnow.cts;
910 ++ icount->dsr = cnow.dsr;
911 ++ icount->rng = cnow.rng;
912 ++ icount->dcd = cnow.dcd;
913 ++ icount->rx = cnow.rx;
914 ++ icount->tx = cnow.tx;
915 ++ icount->frame = cnow.frame;
916 ++ icount->overrun = cnow.overrun;
917 ++ icount->parity = cnow.parity;
918 ++ icount->brk = cnow.brk;
919 ++ icount->buf_overrun = cnow.buf_overrun;
920 ++ return 0;
921 ++}
922 ++
923 + /* mgsl_ioctl() Service an IOCTL request
924 + *
925 + * Arguments:
926 +@@ -2945,7 +2977,7 @@ static int mgsl_ioctl(struct tty_struct *tty, struct file * file,
927 + return -ENODEV;
928 +
929 + if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
930 +- (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) {
931 ++ (cmd != TIOCMIWAIT)) {
932 + if (tty->flags & (1 << TTY_IO_ERROR))
933 + return -EIO;
934 + }
935 +@@ -2958,11 +2990,7 @@ static int mgsl_ioctl(struct tty_struct *tty, struct file * file,
936 +
937 + static int mgsl_ioctl_common(struct mgsl_struct *info, unsigned int cmd, unsigned long arg)
938 + {
939 +- int error;
940 +- struct mgsl_icount cnow; /* kernel counter temps */
941 + void __user *argp = (void __user *)arg;
942 +- struct serial_icounter_struct __user *p_cuser; /* user space */
943 +- unsigned long flags;
944 +
945 + switch (cmd) {
946 + case MGSL_IOCGPARAMS:
947 +@@ -2991,40 +3019,6 @@ static int mgsl_ioctl_common(struct mgsl_struct *info, unsigned int cmd, unsigne
948 + case TIOCMIWAIT:
949 + return modem_input_wait(info,(int)arg);
950 +
951 +- /*
952 +- * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
953 +- * Return: write counters to the user passed counter struct
954 +- * NB: both 1->0 and 0->1 transitions are counted except for
955 +- * RI where only 0->1 is counted.
956 +- */
957 +- case TIOCGICOUNT:
958 +- spin_lock_irqsave(&info->irq_spinlock,flags);
959 +- cnow = info->icount;
960 +- spin_unlock_irqrestore(&info->irq_spinlock,flags);
961 +- p_cuser = argp;
962 +- PUT_USER(error,cnow.cts, &p_cuser->cts);
963 +- if (error) return error;
964 +- PUT_USER(error,cnow.dsr, &p_cuser->dsr);
965 +- if (error) return error;
966 +- PUT_USER(error,cnow.rng, &p_cuser->rng);
967 +- if (error) return error;
968 +- PUT_USER(error,cnow.dcd, &p_cuser->dcd);
969 +- if (error) return error;
970 +- PUT_USER(error,cnow.rx, &p_cuser->rx);
971 +- if (error) return error;
972 +- PUT_USER(error,cnow.tx, &p_cuser->tx);
973 +- if (error) return error;
974 +- PUT_USER(error,cnow.frame, &p_cuser->frame);
975 +- if (error) return error;
976 +- PUT_USER(error,cnow.overrun, &p_cuser->overrun);
977 +- if (error) return error;
978 +- PUT_USER(error,cnow.parity, &p_cuser->parity);
979 +- if (error) return error;
980 +- PUT_USER(error,cnow.brk, &p_cuser->brk);
981 +- if (error) return error;
982 +- PUT_USER(error,cnow.buf_overrun, &p_cuser->buf_overrun);
983 +- if (error) return error;
984 +- return 0;
985 + default:
986 + return -ENOIOCTLCMD;
987 + }
988 +@@ -4325,6 +4319,7 @@ static const struct tty_operations mgsl_ops = {
989 + .hangup = mgsl_hangup,
990 + .tiocmget = tiocmget,
991 + .tiocmset = tiocmset,
992 ++ .get_icount = msgl_get_icount,
993 + .proc_fops = &mgsl_proc_fops,
994 + };
995 +
996 +diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
997 +index 8678f0c..c300ff6 100644
998 +--- a/drivers/char/synclink_gt.c
999 ++++ b/drivers/char/synclink_gt.c
1000 +@@ -1057,9 +1057,6 @@ static int ioctl(struct tty_struct *tty, struct file *file,
1001 + unsigned int cmd, unsigned long arg)
1002 + {
1003 + struct slgt_info *info = tty->driver_data;
1004 +- struct mgsl_icount cnow; /* kernel counter temps */
1005 +- struct serial_icounter_struct __user *p_cuser; /* user space */
1006 +- unsigned long flags;
1007 + void __user *argp = (void __user *)arg;
1008 + int ret;
1009 +
1010 +@@ -1068,7 +1065,7 @@ static int ioctl(struct tty_struct *tty, struct file *file,
1011 + DBGINFO(("%s ioctl() cmd=%08X\n", info->device_name, cmd));
1012 +
1013 + if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
1014 +- (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) {
1015 ++ (cmd != TIOCMIWAIT)) {
1016 + if (tty->flags & (1 << TTY_IO_ERROR))
1017 + return -EIO;
1018 + }
1019 +@@ -1121,25 +1118,6 @@ static int ioctl(struct tty_struct *tty, struct file *file,
1020 + case MGSL_IOCWAITGPIO:
1021 + ret = wait_gpio(info, argp);
1022 + break;
1023 +- case TIOCGICOUNT:
1024 +- spin_lock_irqsave(&info->lock,flags);
1025 +- cnow = info->icount;
1026 +- spin_unlock_irqrestore(&info->lock,flags);
1027 +- p_cuser = argp;
1028 +- if (put_user(cnow.cts, &p_cuser->cts) ||
1029 +- put_user(cnow.dsr, &p_cuser->dsr) ||
1030 +- put_user(cnow.rng, &p_cuser->rng) ||
1031 +- put_user(cnow.dcd, &p_cuser->dcd) ||
1032 +- put_user(cnow.rx, &p_cuser->rx) ||
1033 +- put_user(cnow.tx, &p_cuser->tx) ||
1034 +- put_user(cnow.frame, &p_cuser->frame) ||
1035 +- put_user(cnow.overrun, &p_cuser->overrun) ||
1036 +- put_user(cnow.parity, &p_cuser->parity) ||
1037 +- put_user(cnow.brk, &p_cuser->brk) ||
1038 +- put_user(cnow.buf_overrun, &p_cuser->buf_overrun))
1039 +- ret = -EFAULT;
1040 +- ret = 0;
1041 +- break;
1042 + default:
1043 + ret = -ENOIOCTLCMD;
1044 + }
1045 +@@ -1147,6 +1125,33 @@ static int ioctl(struct tty_struct *tty, struct file *file,
1046 + return ret;
1047 + }
1048 +
1049 ++static int get_icount(struct tty_struct *tty,
1050 ++ struct serial_icounter_struct *icount)
1051 ++
1052 ++{
1053 ++ struct slgt_info *info = tty->driver_data;
1054 ++ struct mgsl_icount cnow; /* kernel counter temps */
1055 ++ unsigned long flags;
1056 ++
1057 ++ spin_lock_irqsave(&info->lock,flags);
1058 ++ cnow = info->icount;
1059 ++ spin_unlock_irqrestore(&info->lock,flags);
1060 ++
1061 ++ icount->cts = cnow.cts;
1062 ++ icount->dsr = cnow.dsr;
1063 ++ icount->rng = cnow.rng;
1064 ++ icount->dcd = cnow.dcd;
1065 ++ icount->rx = cnow.rx;
1066 ++ icount->tx = cnow.tx;
1067 ++ icount->frame = cnow.frame;
1068 ++ icount->overrun = cnow.overrun;
1069 ++ icount->parity = cnow.parity;
1070 ++ icount->brk = cnow.brk;
1071 ++ icount->buf_overrun = cnow.buf_overrun;
1072 ++
1073 ++ return 0;
1074 ++}
1075 ++
1076 + /*
1077 + * support for 32 bit ioctl calls on 64 bit systems
1078 + */
1079 +@@ -1236,10 +1241,6 @@ static long slgt_compat_ioctl(struct tty_struct *tty, struct file *file,
1080 + case MGSL_IOCSGPIO:
1081 + case MGSL_IOCGGPIO:
1082 + case MGSL_IOCWAITGPIO:
1083 +- case TIOCGICOUNT:
1084 +- rc = ioctl(tty, file, cmd, (unsigned long)(compat_ptr(arg)));
1085 +- break;
1086 +-
1087 + case MGSL_IOCSTXIDLE:
1088 + case MGSL_IOCTXENABLE:
1089 + case MGSL_IOCRXENABLE:
1090 +@@ -3639,6 +3640,7 @@ static const struct tty_operations ops = {
1091 + .hangup = hangup,
1092 + .tiocmget = tiocmget,
1093 + .tiocmset = tiocmset,
1094 ++ .get_icount = get_icount,
1095 + .proc_fops = &synclink_gt_proc_fops,
1096 + };
1097 +
1098 +diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c
1099 +index 2b18adc..951b65f 100644
1100 +--- a/drivers/char/synclinkmp.c
1101 ++++ b/drivers/char/synclinkmp.c
1102 +@@ -1255,10 +1255,6 @@ static int do_ioctl(struct tty_struct *tty, struct file *file,
1103 + unsigned int cmd, unsigned long arg)
1104 + {
1105 + SLMP_INFO *info = tty->driver_data;
1106 +- int error;
1107 +- struct mgsl_icount cnow; /* kernel counter temps */
1108 +- struct serial_icounter_struct __user *p_cuser; /* user space */
1109 +- unsigned long flags;
1110 + void __user *argp = (void __user *)arg;
1111 +
1112 + if (debug_level >= DEBUG_LEVEL_INFO)
1113 +@@ -1269,7 +1265,7 @@ static int do_ioctl(struct tty_struct *tty, struct file *file,
1114 + return -ENODEV;
1115 +
1116 + if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
1117 +- (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) {
1118 ++ (cmd != TIOCMIWAIT)) {
1119 + if (tty->flags & (1 << TTY_IO_ERROR))
1120 + return -EIO;
1121 + }
1122 +@@ -1307,40 +1303,38 @@ static int do_ioctl(struct tty_struct *tty, struct file *file,
1123 + * NB: both 1->0 and 0->1 transitions are counted except for
1124 + * RI where only 0->1 is counted.
1125 + */
1126 +- case TIOCGICOUNT:
1127 +- spin_lock_irqsave(&info->lock,flags);
1128 +- cnow = info->icount;
1129 +- spin_unlock_irqrestore(&info->lock,flags);
1130 +- p_cuser = argp;
1131 +- PUT_USER(error,cnow.cts, &p_cuser->cts);
1132 +- if (error) return error;
1133 +- PUT_USER(error,cnow.dsr, &p_cuser->dsr);
1134 +- if (error) return error;
1135 +- PUT_USER(error,cnow.rng, &p_cuser->rng);
1136 +- if (error) return error;
1137 +- PUT_USER(error,cnow.dcd, &p_cuser->dcd);
1138 +- if (error) return error;
1139 +- PUT_USER(error,cnow.rx, &p_cuser->rx);
1140 +- if (error) return error;
1141 +- PUT_USER(error,cnow.tx, &p_cuser->tx);
1142 +- if (error) return error;
1143 +- PUT_USER(error,cnow.frame, &p_cuser->frame);
1144 +- if (error) return error;
1145 +- PUT_USER(error,cnow.overrun, &p_cuser->overrun);
1146 +- if (error) return error;
1147 +- PUT_USER(error,cnow.parity, &p_cuser->parity);
1148 +- if (error) return error;
1149 +- PUT_USER(error,cnow.brk, &p_cuser->brk);
1150 +- if (error) return error;
1151 +- PUT_USER(error,cnow.buf_overrun, &p_cuser->buf_overrun);
1152 +- if (error) return error;
1153 +- return 0;
1154 + default:
1155 + return -ENOIOCTLCMD;
1156 + }
1157 + return 0;
1158 + }
1159 +
1160 ++static int get_icount(struct tty_struct *tty,
1161 ++ struct serial_icounter_struct *icount)
1162 ++{
1163 ++ SLMP_INFO *info = tty->driver_data;
1164 ++ struct mgsl_icount cnow; /* kernel counter temps */
1165 ++ unsigned long flags;
1166 ++
1167 ++ spin_lock_irqsave(&info->lock,flags);
1168 ++ cnow = info->icount;
1169 ++ spin_unlock_irqrestore(&info->lock,flags);
1170 ++
1171 ++ icount->cts = cnow.cts;
1172 ++ icount->dsr = cnow.dsr;
1173 ++ icount->rng = cnow.rng;
1174 ++ icount->dcd = cnow.dcd;
1175 ++ icount->rx = cnow.rx;
1176 ++ icount->tx = cnow.tx;
1177 ++ icount->frame = cnow.frame;
1178 ++ icount->overrun = cnow.overrun;
1179 ++ icount->parity = cnow.parity;
1180 ++ icount->brk = cnow.brk;
1181 ++ icount->buf_overrun = cnow.buf_overrun;
1182 ++
1183 ++ return 0;
1184 ++}
1185 ++
1186 + static int ioctl(struct tty_struct *tty, struct file *file,
1187 + unsigned int cmd, unsigned long arg)
1188 + {
1189 +@@ -3908,6 +3902,7 @@ static const struct tty_operations ops = {
1190 + .hangup = hangup,
1191 + .tiocmget = tiocmget,
1192 + .tiocmset = tiocmset,
1193 ++ .get_icount = get_icount,
1194 + .proc_fops = &synclinkmp_proc_fops,
1195 + };
1196 +
1197 +diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
1198 +index 53ffcfc..123cedf 100644
1199 +--- a/drivers/char/tty_io.c
1200 ++++ b/drivers/char/tty_io.c
1201 +@@ -96,6 +96,7 @@
1202 + #include <linux/bitops.h>
1203 + #include <linux/delay.h>
1204 + #include <linux/seq_file.h>
1205 ++#include <linux/serial.h>
1206 +
1207 + #include <linux/uaccess.h>
1208 + #include <asm/system.h>
1209 +@@ -2436,6 +2437,20 @@ static int tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int
1210 + return tty->ops->tiocmset(tty, file, set, clear);
1211 + }
1212 +
1213 ++static int tty_tiocgicount(struct tty_struct *tty, void __user *arg)
1214 ++{
1215 ++ int retval = -EINVAL;
1216 ++ struct serial_icounter_struct icount;
1217 ++ memset(&icount, 0, sizeof(icount));
1218 ++ if (tty->ops->get_icount)
1219 ++ retval = tty->ops->get_icount(tty, &icount);
1220 ++ if (retval != 0)
1221 ++ return retval;
1222 ++ if (copy_to_user(arg, &icount, sizeof(icount)))
1223 ++ return -EFAULT;
1224 ++ return 0;
1225 ++}
1226 ++
1227 + struct tty_struct *tty_pair_get_tty(struct tty_struct *tty)
1228 + {
1229 + if (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
1230 +@@ -2556,6 +2571,12 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1231 + case TIOCMBIC:
1232 + case TIOCMBIS:
1233 + return tty_tiocmset(tty, file, cmd, p);
1234 ++ case TIOCGICOUNT:
1235 ++ retval = tty_tiocgicount(tty, p);
1236 ++ /* For the moment allow fall through to the old method */
1237 ++ if (retval != -EINVAL)
1238 ++ return retval;
1239 ++ break;
1240 + case TCFLSH:
1241 + switch (arg) {
1242 + case TCIFLUSH:
1243 +diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
1244 +index 3ada62b..27a3074 100644
1245 +--- a/drivers/gpu/drm/i915/i915_gem.c
1246 ++++ b/drivers/gpu/drm/i915/i915_gem.c
1247 +@@ -482,14 +482,17 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data,
1248 + return -EBADF;
1249 + obj_priv = obj->driver_private;
1250 +
1251 +- /* Bounds check source.
1252 +- *
1253 +- * XXX: This could use review for overflow issues...
1254 +- */
1255 +- if (args->offset > obj->size || args->size > obj->size ||
1256 +- args->offset + args->size > obj->size) {
1257 +- drm_gem_object_unreference(obj);
1258 +- return -EINVAL;
1259 ++ /* Bounds check source. */
1260 ++ if (args->offset > obj->size || args->size > obj->size - args->offset) {
1261 ++ ret = -EINVAL;
1262 ++ goto err;
1263 ++ }
1264 ++
1265 ++ if (!access_ok(VERIFY_WRITE,
1266 ++ (char __user *)(uintptr_t)args->data_ptr,
1267 ++ args->size)) {
1268 ++ ret = -EFAULT;
1269 ++ goto err;
1270 + }
1271 +
1272 + if (i915_gem_object_needs_bit17_swizzle(obj)) {
1273 +@@ -501,8 +504,8 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data,
1274 + file_priv);
1275 + }
1276 +
1277 ++err:
1278 + drm_gem_object_unreference(obj);
1279 +-
1280 + return ret;
1281 + }
1282 +
1283 +@@ -592,8 +595,6 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev, struct drm_gem_object *obj,
1284 +
1285 + user_data = (char __user *) (uintptr_t) args->data_ptr;
1286 + remain = args->size;
1287 +- if (!access_ok(VERIFY_READ, user_data, remain))
1288 +- return -EFAULT;
1289 +
1290 +
1291 + mutex_lock(&dev->struct_mutex);
1292 +@@ -955,14 +956,17 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
1293 + return -EBADF;
1294 + obj_priv = obj->driver_private;
1295 +
1296 +- /* Bounds check destination.
1297 +- *
1298 +- * XXX: This could use review for overflow issues...
1299 +- */
1300 +- if (args->offset > obj->size || args->size > obj->size ||
1301 +- args->offset + args->size > obj->size) {
1302 +- drm_gem_object_unreference(obj);
1303 +- return -EINVAL;
1304 ++ /* Bounds check destination. */
1305 ++ if (args->offset > obj->size || args->size > obj->size - args->offset) {
1306 ++ ret = -EINVAL;
1307 ++ goto err;
1308 ++ }
1309 ++
1310 ++ if (!access_ok(VERIFY_READ,
1311 ++ (char __user *)(uintptr_t)args->data_ptr,
1312 ++ args->size)) {
1313 ++ ret = -EFAULT;
1314 ++ goto err;
1315 + }
1316 +
1317 + /* We can only do the GTT pwrite on untiled buffers, as otherwise
1318 +@@ -995,8 +999,8 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
1319 + DRM_INFO("pwrite failed %d\n", ret);
1320 + #endif
1321 +
1322 ++err:
1323 + drm_gem_object_unreference(obj);
1324 +-
1325 + return ret;
1326 + }
1327 +
1328 +diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
1329 +index cf59d64..883215d 100644
1330 +--- a/drivers/md/raid5.c
1331 ++++ b/drivers/md/raid5.c
1332 +@@ -3038,12 +3038,16 @@ static void handle_stripe5(struct stripe_head *sh)
1333 + /* check if the array has lost two devices and, if so, some requests might
1334 + * need to be failed
1335 + */
1336 +- if (s.failed > 1 && s.to_read+s.to_write+s.written)
1337 +- handle_failed_stripe(conf, sh, &s, disks, &return_bi);
1338 +- if (s.failed > 1 && s.syncing) {
1339 +- md_done_sync(conf->mddev, STRIPE_SECTORS,0);
1340 +- clear_bit(STRIPE_SYNCING, &sh->state);
1341 +- s.syncing = 0;
1342 ++ if (s.failed > 1) {
1343 ++ sh->check_state = 0;
1344 ++ sh->reconstruct_state = 0;
1345 ++ if (s.to_read+s.to_write+s.written)
1346 ++ handle_failed_stripe(conf, sh, &s, disks, &return_bi);
1347 ++ if (s.syncing) {
1348 ++ md_done_sync(conf->mddev, STRIPE_SECTORS,0);
1349 ++ clear_bit(STRIPE_SYNCING, &sh->state);
1350 ++ s.syncing = 0;
1351 ++ }
1352 + }
1353 +
1354 + /* might be able to return some write requests if the parity block
1355 +@@ -3314,12 +3318,16 @@ static void handle_stripe6(struct stripe_head *sh)
1356 + /* check if the array has lost >2 devices and, if so, some requests
1357 + * might need to be failed
1358 + */
1359 +- if (s.failed > 2 && s.to_read+s.to_write+s.written)
1360 +- handle_failed_stripe(conf, sh, &s, disks, &return_bi);
1361 +- if (s.failed > 2 && s.syncing) {
1362 +- md_done_sync(conf->mddev, STRIPE_SECTORS,0);
1363 +- clear_bit(STRIPE_SYNCING, &sh->state);
1364 +- s.syncing = 0;
1365 ++ if (s.failed > 2) {
1366 ++ sh->check_state = 0;
1367 ++ sh->reconstruct_state = 0;
1368 ++ if (s.to_read+s.to_write+s.written)
1369 ++ handle_failed_stripe(conf, sh, &s, disks, &return_bi);
1370 ++ if (s.syncing) {
1371 ++ md_done_sync(conf->mddev, STRIPE_SECTORS,0);
1372 ++ clear_bit(STRIPE_SYNCING, &sh->state);
1373 ++ s.syncing = 0;
1374 ++ }
1375 + }
1376 +
1377 + /*
1378 +diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
1379 +index 5b081cb..726a1b8 100644
1380 +--- a/drivers/mtd/mtdchar.c
1381 ++++ b/drivers/mtd/mtdchar.c
1382 +@@ -290,6 +290,7 @@ static ssize_t mtd_write(struct file *file, const char __user *buf, size_t count
1383 + ops.mode = MTD_OOB_RAW;
1384 + ops.datbuf = kbuf;
1385 + ops.oobbuf = NULL;
1386 ++ ops.ooboffs = 0;
1387 + ops.len = len;
1388 +
1389 + ret = mtd->write_oob(mtd, *ppos, &ops);
1390 +diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
1391 +index 554626e..d03a926 100644
1392 +--- a/drivers/scsi/hosts.c
1393 ++++ b/drivers/scsi/hosts.c
1394 +@@ -275,6 +275,7 @@ static void scsi_host_dev_release(struct device *dev)
1395 + {
1396 + struct Scsi_Host *shost = dev_to_shost(dev);
1397 + struct device *parent = dev->parent;
1398 ++ struct request_queue *q;
1399 +
1400 + scsi_proc_hostdir_rm(shost->hostt);
1401 +
1402 +@@ -282,9 +283,11 @@ static void scsi_host_dev_release(struct device *dev)
1403 + kthread_stop(shost->ehandler);
1404 + if (shost->work_q)
1405 + destroy_workqueue(shost->work_q);
1406 +- if (shost->uspace_req_q) {
1407 +- kfree(shost->uspace_req_q->queuedata);
1408 +- scsi_free_queue(shost->uspace_req_q);
1409 ++ q = shost->uspace_req_q;
1410 ++ if (q) {
1411 ++ kfree(q->queuedata);
1412 ++ q->queuedata = NULL;
1413 ++ scsi_free_queue(q);
1414 + }
1415 +
1416 + scsi_destroy_command_freelist(shost);
1417 +diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
1418 +index 1492e3e..1ae7b7c 100644
1419 +--- a/drivers/scsi/scsi_lib.c
1420 ++++ b/drivers/scsi/scsi_lib.c
1421 +@@ -1672,6 +1672,15 @@ struct request_queue *scsi_alloc_queue(struct scsi_device *sdev)
1422 +
1423 + void scsi_free_queue(struct request_queue *q)
1424 + {
1425 ++ unsigned long flags;
1426 ++
1427 ++ WARN_ON(q->queuedata);
1428 ++
1429 ++ /* cause scsi_request_fn() to kill all non-finished requests */
1430 ++ spin_lock_irqsave(q->queue_lock, flags);
1431 ++ q->request_fn(q);
1432 ++ spin_unlock_irqrestore(q->queue_lock, flags);
1433 ++
1434 + blk_cleanup_queue(q);
1435 + }
1436 +
1437 +diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
1438 +index 5081f97..723da1d 100644
1439 +--- a/drivers/scsi/st.c
1440 ++++ b/drivers/scsi/st.c
1441 +@@ -461,14 +461,16 @@ static void st_scsi_execute_end(struct request *req, int uptodate)
1442 + {
1443 + struct st_request *SRpnt = req->end_io_data;
1444 + struct scsi_tape *STp = SRpnt->stp;
1445 ++ struct bio *tmp;
1446 +
1447 + STp->buffer->cmdstat.midlevel_result = SRpnt->result = req->errors;
1448 + STp->buffer->cmdstat.residual = req->resid_len;
1449 +
1450 ++ tmp = SRpnt->bio;
1451 + if (SRpnt->waiting)
1452 + complete(SRpnt->waiting);
1453 +
1454 +- blk_rq_unmap_user(SRpnt->bio);
1455 ++ blk_rq_unmap_user(tmp);
1456 + __blk_put_request(req->q, req);
1457 + }
1458 +
1459 +diff --git a/drivers/serial/68360serial.c b/drivers/serial/68360serial.c
1460 +index 24661cd..1e4f831 100644
1461 +--- a/drivers/serial/68360serial.c
1462 ++++ b/drivers/serial/68360serial.c
1463 +@@ -1381,6 +1381,30 @@ static void send_break(ser_info_t *info, unsigned int duration)
1464 + }
1465 +
1466 +
1467 ++/*
1468 ++ * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
1469 ++ * Return: write counters to the user passed counter struct
1470 ++ * NB: both 1->0 and 0->1 transitions are counted except for
1471 ++ * RI where only 0->1 is counted.
1472 ++ */
1473 ++static int rs_360_get_icount(struct tty_struct *tty,
1474 ++ struct serial_icounter_struct *icount)
1475 ++{
1476 ++ ser_info_t *info = (ser_info_t *)tty->driver_data;
1477 ++ struct async_icount cnow;
1478 ++
1479 ++ local_irq_disable();
1480 ++ cnow = info->state->icount;
1481 ++ local_irq_enable();
1482 ++
1483 ++ icount->cts = cnow.cts;
1484 ++ icount->dsr = cnow.dsr;
1485 ++ icount->rng = cnow.rng;
1486 ++ icount->dcd = cnow.dcd;
1487 ++
1488 ++ return 0;
1489 ++}
1490 ++
1491 + static int rs_360_ioctl(struct tty_struct *tty, struct file * file,
1492 + unsigned int cmd, unsigned long arg)
1493 + {
1494 +@@ -1394,7 +1418,7 @@ static int rs_360_ioctl(struct tty_struct *tty, struct file * file,
1495 + if (serial_paranoia_check(info, tty->name, "rs_ioctl"))
1496 + return -ENODEV;
1497 +
1498 +- if ((cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) {
1499 ++ if (cmd != TIOCMIWAIT) {
1500 + if (tty->flags & (1 << TTY_IO_ERROR))
1501 + return -EIO;
1502 + }
1503 +@@ -1477,31 +1501,6 @@ static int rs_360_ioctl(struct tty_struct *tty, struct file * file,
1504 + return 0;
1505 + #endif
1506 +
1507 +- /*
1508 +- * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
1509 +- * Return: write counters to the user passed counter struct
1510 +- * NB: both 1->0 and 0->1 transitions are counted except for
1511 +- * RI where only 0->1 is counted.
1512 +- */
1513 +- case TIOCGICOUNT:
1514 +- local_irq_disable();
1515 +- cnow = info->state->icount;
1516 +- local_irq_enable();
1517 +- p_cuser = (struct serial_icounter_struct *) arg;
1518 +-/* error = put_user(cnow.cts, &p_cuser->cts); */
1519 +-/* if (error) return error; */
1520 +-/* error = put_user(cnow.dsr, &p_cuser->dsr); */
1521 +-/* if (error) return error; */
1522 +-/* error = put_user(cnow.rng, &p_cuser->rng); */
1523 +-/* if (error) return error; */
1524 +-/* error = put_user(cnow.dcd, &p_cuser->dcd); */
1525 +-/* if (error) return error; */
1526 +-
1527 +- put_user(cnow.cts, &p_cuser->cts);
1528 +- put_user(cnow.dsr, &p_cuser->dsr);
1529 +- put_user(cnow.rng, &p_cuser->rng);
1530 +- put_user(cnow.dcd, &p_cuser->dcd);
1531 +- return 0;
1532 +
1533 + default:
1534 + return -ENOIOCTLCMD;
1535 +diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
1536 +index dcc7244..772d9d8 100644
1537 +--- a/drivers/serial/serial_core.c
1538 ++++ b/drivers/serial/serial_core.c
1539 +@@ -1067,10 +1067,10 @@ uart_wait_modem_status(struct uart_state *state, unsigned long arg)
1540 + * NB: both 1->0 and 0->1 transitions are counted except for
1541 + * RI where only 0->1 is counted.
1542 + */
1543 +-static int uart_get_count(struct uart_state *state,
1544 +- struct serial_icounter_struct __user *icnt)
1545 ++static int uart_get_icount(struct tty_struct *tty,
1546 ++ struct serial_icounter_struct *icount)
1547 + {
1548 +- struct serial_icounter_struct icount;
1549 ++ struct uart_state *state = tty->driver_data;
1550 + struct uart_icount cnow;
1551 + struct uart_port *uport = state->uart_port;
1552 +
1553 +@@ -1078,19 +1078,19 @@ static int uart_get_count(struct uart_state *state,
1554 + memcpy(&cnow, &uport->icount, sizeof(struct uart_icount));
1555 + spin_unlock_irq(&uport->lock);
1556 +
1557 +- icount.cts = cnow.cts;
1558 +- icount.dsr = cnow.dsr;
1559 +- icount.rng = cnow.rng;
1560 +- icount.dcd = cnow.dcd;
1561 +- icount.rx = cnow.rx;
1562 +- icount.tx = cnow.tx;
1563 +- icount.frame = cnow.frame;
1564 +- icount.overrun = cnow.overrun;
1565 +- icount.parity = cnow.parity;
1566 +- icount.brk = cnow.brk;
1567 +- icount.buf_overrun = cnow.buf_overrun;
1568 ++ icount->cts = cnow.cts;
1569 ++ icount->dsr = cnow.dsr;
1570 ++ icount->rng = cnow.rng;
1571 ++ icount->dcd = cnow.dcd;
1572 ++ icount->rx = cnow.rx;
1573 ++ icount->tx = cnow.tx;
1574 ++ icount->frame = cnow.frame;
1575 ++ icount->overrun = cnow.overrun;
1576 ++ icount->parity = cnow.parity;
1577 ++ icount->brk = cnow.brk;
1578 ++ icount->buf_overrun = cnow.buf_overrun;
1579 +
1580 +- return copy_to_user(icnt, &icount, sizeof(icount)) ? -EFAULT : 0;
1581 ++ return 0;
1582 + }
1583 +
1584 + /*
1585 +@@ -1143,10 +1143,6 @@ uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd,
1586 + case TIOCMIWAIT:
1587 + ret = uart_wait_modem_status(state, arg);
1588 + break;
1589 +-
1590 +- case TIOCGICOUNT:
1591 +- ret = uart_get_count(state, uarg);
1592 +- break;
1593 + }
1594 +
1595 + if (ret != -ENOIOCTLCMD)
1596 +@@ -2322,6 +2318,7 @@ static const struct tty_operations uart_ops = {
1597 + #endif
1598 + .tiocmget = uart_tiocmget,
1599 + .tiocmset = uart_tiocmset,
1600 ++ .get_icount = uart_get_icount,
1601 + #ifdef CONFIG_CONSOLE_POLL
1602 + .poll_init = uart_poll_init,
1603 + .poll_get_char = uart_poll_get_char,
1604 +diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
1605 +index 93448eb..e163df9 100644
1606 +--- a/drivers/usb/core/quirks.c
1607 ++++ b/drivers/usb/core/quirks.c
1608 +@@ -47,15 +47,42 @@ static const struct usb_device_id usb_quirk_list[] = {
1609 + /* Logitech Webcam B/C500 */
1610 + { USB_DEVICE(0x046d, 0x0807), .driver_info = USB_QUIRK_RESET_RESUME },
1611 +
1612 ++ /* Logitech Webcam C600 */
1613 ++ { USB_DEVICE(0x046d, 0x0808), .driver_info = USB_QUIRK_RESET_RESUME },
1614 ++
1615 + /* Logitech Webcam Pro 9000 */
1616 + { USB_DEVICE(0x046d, 0x0809), .driver_info = USB_QUIRK_RESET_RESUME },
1617 +
1618 ++ /* Logitech Webcam C905 */
1619 ++ { USB_DEVICE(0x046d, 0x080a), .driver_info = USB_QUIRK_RESET_RESUME },
1620 ++
1621 ++ /* Logitech Webcam C210 */
1622 ++ { USB_DEVICE(0x046d, 0x0819), .driver_info = USB_QUIRK_RESET_RESUME },
1623 ++
1624 ++ /* Logitech Webcam C260 */
1625 ++ { USB_DEVICE(0x046d, 0x081a), .driver_info = USB_QUIRK_RESET_RESUME },
1626 ++
1627 + /* Logitech Webcam C310 */
1628 + { USB_DEVICE(0x046d, 0x081b), .driver_info = USB_QUIRK_RESET_RESUME },
1629 +
1630 ++ /* Logitech Webcam C910 */
1631 ++ { USB_DEVICE(0x046d, 0x0821), .driver_info = USB_QUIRK_RESET_RESUME },
1632 ++
1633 ++ /* Logitech Webcam C160 */
1634 ++ { USB_DEVICE(0x046d, 0x0824), .driver_info = USB_QUIRK_RESET_RESUME },
1635 ++
1636 + /* Logitech Webcam C270 */
1637 + { USB_DEVICE(0x046d, 0x0825), .driver_info = USB_QUIRK_RESET_RESUME },
1638 +
1639 ++ /* Logitech Quickcam Pro 9000 */
1640 ++ { USB_DEVICE(0x046d, 0x0990), .driver_info = USB_QUIRK_RESET_RESUME },
1641 ++
1642 ++ /* Logitech Quickcam E3500 */
1643 ++ { USB_DEVICE(0x046d, 0x09a4), .driver_info = USB_QUIRK_RESET_RESUME },
1644 ++
1645 ++ /* Logitech Quickcam Vision Pro */
1646 ++ { USB_DEVICE(0x046d, 0x09a6), .driver_info = USB_QUIRK_RESET_RESUME },
1647 ++
1648 + /* Logitech Harmony 700-series */
1649 + { USB_DEVICE(0x046d, 0xc122), .driver_info = USB_QUIRK_DELAY_INIT },
1650 +
1651 +diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
1652 +index 7a4b41c..5689b90 100644
1653 +--- a/drivers/usb/serial/ftdi_sio.c
1654 ++++ b/drivers/usb/serial/ftdi_sio.c
1655 +@@ -2355,13 +2355,19 @@ static void ftdi_set_termios(struct tty_struct *tty,
1656 +
1657 + cflag = termios->c_cflag;
1658 +
1659 +- /* FIXME -For this cut I don't care if the line is really changing or
1660 +- not - so just do the change regardless - should be able to
1661 +- compare old_termios and tty->termios */
1662 ++ if (old_termios->c_cflag == termios->c_cflag
1663 ++ && old_termios->c_ispeed == termios->c_ispeed
1664 ++ && old_termios->c_ospeed == termios->c_ospeed)
1665 ++ goto no_c_cflag_changes;
1666 ++
1667 + /* NOTE These routines can get interrupted by
1668 + ftdi_sio_read_bulk_callback - need to examine what this means -
1669 + don't see any problems yet */
1670 +
1671 ++ if ((old_termios->c_cflag & (CSIZE|PARODD|PARENB|CMSPAR|CSTOPB)) ==
1672 ++ (termios->c_cflag & (CSIZE|PARODD|PARENB|CMSPAR|CSTOPB)))
1673 ++ goto no_data_parity_stop_changes;
1674 ++
1675 + /* Set number of data bits, parity, stop bits */
1676 +
1677 + termios->c_cflag &= ~CMSPAR;
1678 +@@ -2398,6 +2404,7 @@ static void ftdi_set_termios(struct tty_struct *tty,
1679 + }
1680 +
1681 + /* Now do the baudrate */
1682 ++no_data_parity_stop_changes:
1683 + if ((cflag & CBAUD) == B0) {
1684 + /* Disable flow control */
1685 + if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
1686 +@@ -2423,6 +2430,7 @@ static void ftdi_set_termios(struct tty_struct *tty,
1687 +
1688 + /* Set flow control */
1689 + /* Note device also supports DTR/CD (ugh) and Xon/Xoff in hardware */
1690 ++no_c_cflag_changes:
1691 + if (cflag & CRTSCTS) {
1692 + dbg("%s Setting to CRTSCTS flow control", __func__);
1693 + if (usb_control_msg(dev,
1694 +diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
1695 +index 150cad4..9f89940 100644
1696 +--- a/drivers/usb/serial/pl2303.c
1697 ++++ b/drivers/usb/serial/pl2303.c
1698 +@@ -101,7 +101,6 @@ static struct usb_device_id id_table [] = {
1699 + { USB_DEVICE(SONY_VENDOR_ID, SONY_QN3USB_PRODUCT_ID) },
1700 + { USB_DEVICE(SANWA_VENDOR_ID, SANWA_PRODUCT_ID) },
1701 + { USB_DEVICE(ADLINK_VENDOR_ID, ADLINK_ND6530_PRODUCT_ID) },
1702 +- { USB_DEVICE(WINCHIPHEAD_VENDOR_ID, WINCHIPHEAD_USBSER_PRODUCT_ID) },
1703 + { USB_DEVICE(SMART_VENDOR_ID, SMART_PRODUCT_ID) },
1704 + { } /* Terminating entry */
1705 + };
1706 +diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h
1707 +index 3d10d7f..c38b8c0 100644
1708 +--- a/drivers/usb/serial/pl2303.h
1709 ++++ b/drivers/usb/serial/pl2303.h
1710 +@@ -145,10 +145,6 @@
1711 + #define ADLINK_VENDOR_ID 0x0b63
1712 + #define ADLINK_ND6530_PRODUCT_ID 0x6530
1713 +
1714 +-/* WinChipHead USB->RS 232 adapter */
1715 +-#define WINCHIPHEAD_VENDOR_ID 0x4348
1716 +-#define WINCHIPHEAD_USBSER_PRODUCT_ID 0x5523
1717 +-
1718 + /* SMART USB Serial Adapter */
1719 + #define SMART_VENDOR_ID 0x0b8c
1720 + #define SMART_PRODUCT_ID 0x2303
1721 +diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
1722 +index bd3fa7f..f23f3b4 100644
1723 +--- a/drivers/usb/serial/usb-serial.c
1724 ++++ b/drivers/usb/serial/usb-serial.c
1725 +@@ -562,6 +562,18 @@ static int serial_tiocmset(struct tty_struct *tty, struct file *file,
1726 + return -EINVAL;
1727 + }
1728 +
1729 ++static int serial_get_icount(struct tty_struct *tty,
1730 ++ struct serial_icounter_struct *icount)
1731 ++{
1732 ++ struct usb_serial_port *port = tty->driver_data;
1733 ++
1734 ++ dbg("%s - port %d", __func__, port->number);
1735 ++
1736 ++ if (port->serial->type->get_icount)
1737 ++ return port->serial->type->get_icount(tty, icount);
1738 ++ return -EINVAL;
1739 ++}
1740 ++
1741 + /*
1742 + * We would be calling tty_wakeup here, but unfortunately some line
1743 + * disciplines have an annoying habit of calling tty->write from
1744 +@@ -1214,6 +1226,7 @@ static const struct tty_operations serial_ops = {
1745 + .chars_in_buffer = serial_chars_in_buffer,
1746 + .tiocmget = serial_tiocmget,
1747 + .tiocmset = serial_tiocmset,
1748 ++ .get_icount = serial_get_icount,
1749 + .cleanup = serial_cleanup,
1750 + .install = serial_install,
1751 + .proc_fops = &serial_proc_fops,
1752 +diff --git a/drivers/usb/storage/protocol.c b/drivers/usb/storage/protocol.c
1753 +index fc310f7..0fded39 100644
1754 +--- a/drivers/usb/storage/protocol.c
1755 ++++ b/drivers/usb/storage/protocol.c
1756 +@@ -58,7 +58,9 @@
1757 +
1758 + void usb_stor_pad12_command(struct scsi_cmnd *srb, struct us_data *us)
1759 + {
1760 +- /* Pad the SCSI command with zeros out to 12 bytes
1761 ++ /*
1762 ++ * Pad the SCSI command with zeros out to 12 bytes. If the
1763 ++ * command already is 12 bytes or longer, leave it alone.
1764 + *
1765 + * NOTE: This only works because a scsi_cmnd struct field contains
1766 + * a unsigned char cmnd[16], so we know we have storage available
1767 +@@ -66,9 +68,6 @@ void usb_stor_pad12_command(struct scsi_cmnd *srb, struct us_data *us)
1768 + for (; srb->cmd_len<12; srb->cmd_len++)
1769 + srb->cmnd[srb->cmd_len] = 0;
1770 +
1771 +- /* set command length to 12 bytes */
1772 +- srb->cmd_len = 12;
1773 +-
1774 + /* send the command to the transport layer */
1775 + usb_stor_invoke_transport(srb, us);
1776 + }
1777 +diff --git a/drivers/xen/events.c b/drivers/xen/events.c
1778 +index 009ca4e..15ed43e 100644
1779 +--- a/drivers/xen/events.c
1780 ++++ b/drivers/xen/events.c
1781 +@@ -536,7 +536,7 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi,
1782 + if (irq < 0)
1783 + return irq;
1784 +
1785 +- irqflags |= IRQF_NO_SUSPEND | IRQF_FORCE_RESUME;
1786 ++ irqflags |= IRQF_NO_SUSPEND | IRQF_FORCE_RESUME | IRQF_EARLY_RESUME;
1787 + retval = request_irq(irq, handler, irqflags, devname, dev_id);
1788 + if (retval != 0) {
1789 + unbind_from_irq(irq);
1790 +diff --git a/fs/hfs/trans.c b/fs/hfs/trans.c
1791 +index e673a88..b1ce4c7 100644
1792 +--- a/fs/hfs/trans.c
1793 ++++ b/fs/hfs/trans.c
1794 +@@ -40,6 +40,8 @@ int hfs_mac2asc(struct super_block *sb, char *out, const struct hfs_name *in)
1795 +
1796 + src = in->name;
1797 + srclen = in->len;
1798 ++ if (srclen > HFS_NAMELEN)
1799 ++ srclen = HFS_NAMELEN;
1800 + dst = out;
1801 + dstlen = HFS_MAX_NAMELEN;
1802 + if (nls_io) {
1803 +diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
1804 +index 4528f29..c739150 100644
1805 +--- a/include/linux/interrupt.h
1806 ++++ b/include/linux/interrupt.h
1807 +@@ -54,6 +54,8 @@
1808 + * irq line disabled until the threaded handler has been run.
1809 + * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend
1810 + * IRQF_FORCE_RESUME - Force enable it on resume even if IRQF_NO_SUSPEND is set
1811 ++ * IRQF_EARLY_RESUME - Resume IRQ early during syscore instead of at device
1812 ++ * resume time.
1813 + */
1814 + #define IRQF_DISABLED 0x00000020
1815 + #define IRQF_SAMPLE_RANDOM 0x00000040
1816 +@@ -66,6 +68,7 @@
1817 + #define IRQF_ONESHOT 0x00002000
1818 + #define IRQF_NO_SUSPEND 0x00004000
1819 + #define IRQF_FORCE_RESUME 0x00008000
1820 ++#define IRQF_EARLY_RESUME 0x00020000
1821 +
1822 + #define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND)
1823 +
1824 +@@ -198,13 +201,16 @@ extern void suspend_device_irqs(void);
1825 + extern void resume_device_irqs(void);
1826 + #ifdef CONFIG_PM_SLEEP
1827 + extern int check_wakeup_irqs(void);
1828 ++extern void irq_pm_syscore_resume(void);
1829 + #else
1830 + static inline int check_wakeup_irqs(void) { return 0; }
1831 ++static inline void irq_pm_syscore_resume(void) { };
1832 + #endif
1833 + #else
1834 + static inline void suspend_device_irqs(void) { };
1835 + static inline void resume_device_irqs(void) { };
1836 + static inline int check_wakeup_irqs(void) { return 0; }
1837 ++static inline void irq_pm_syscore_resume(void) { };
1838 + #endif
1839 +
1840 + #if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS)
1841 +diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
1842 +index b086779..db2d227 100644
1843 +--- a/include/linux/tty_driver.h
1844 ++++ b/include/linux/tty_driver.h
1845 +@@ -224,6 +224,12 @@
1846 + * unless the tty also has a valid tty->termiox pointer.
1847 + *
1848 + * Optional: Called under the termios lock
1849 ++ *
1850 ++ * int (*get_icount)(struct tty_struct *tty, struct serial_icounter *icount);
1851 ++ *
1852 ++ * Called when the device receives a TIOCGICOUNT ioctl. Passed a kernel
1853 ++ * structure to complete. This method is optional and will only be called
1854 ++ * if provided (otherwise EINVAL will be returned).
1855 + */
1856 +
1857 + #include <linux/fs.h>
1858 +@@ -232,6 +238,7 @@
1859 +
1860 + struct tty_struct;
1861 + struct tty_driver;
1862 ++struct serial_icounter_struct;
1863 +
1864 + struct tty_operations {
1865 + struct tty_struct * (*lookup)(struct tty_driver *driver,
1866 +@@ -268,6 +275,8 @@ struct tty_operations {
1867 + unsigned int set, unsigned int clear);
1868 + int (*resize)(struct tty_struct *tty, struct winsize *ws);
1869 + int (*set_termiox)(struct tty_struct *tty, struct termiox *tnew);
1870 ++ int (*get_icount)(struct tty_struct *tty,
1871 ++ struct serial_icounter_struct *icount);
1872 + #ifdef CONFIG_CONSOLE_POLL
1873 + int (*poll_init)(struct tty_driver *driver, int line, char *options);
1874 + int (*poll_get_char)(struct tty_driver *driver, int line);
1875 +diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
1876 +index bb911e3..78670cb 100644
1877 +--- a/include/linux/usb/serial.h
1878 ++++ b/include/linux/usb/serial.h
1879 +@@ -259,6 +259,8 @@ struct usb_serial_driver {
1880 + int (*tiocmget)(struct tty_struct *tty, struct file *file);
1881 + int (*tiocmset)(struct tty_struct *tty, struct file *file,
1882 + unsigned int set, unsigned int clear);
1883 ++ int (*get_icount)(struct tty_struct *tty,
1884 ++ struct serial_icounter_struct *icount);
1885 + /* Called by the tty layer for port level work. There may or may not
1886 + be an attached tty at this point */
1887 + void (*dtr_rts)(struct usb_serial_port *port, int on);
1888 +diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
1889 +index 3c123c3..819a634 100644
1890 +--- a/include/linux/vmalloc.h
1891 ++++ b/include/linux/vmalloc.h
1892 +@@ -13,6 +13,7 @@ struct vm_area_struct; /* vma defining user mapping in mm_types.h */
1893 + #define VM_MAP 0x00000004 /* vmap()ed pages */
1894 + #define VM_USERMAP 0x00000008 /* suitable for remap_vmalloc_range */
1895 + #define VM_VPAGES 0x00000010 /* buffer for pages was vmalloc'ed */
1896 ++#define VM_UNLIST 0x00000020 /* vm_struct is not listed in vmlist */
1897 + /* bits [20..32] reserved for arch specific ioremap internals */
1898 +
1899 + /*
1900 +diff --git a/kernel/irq/pm.c b/kernel/irq/pm.c
1901 +index 0067abb..b1fc3dd 100644
1902 +--- a/kernel/irq/pm.c
1903 ++++ b/kernel/irq/pm.c
1904 +@@ -39,25 +39,46 @@ void suspend_device_irqs(void)
1905 + }
1906 + EXPORT_SYMBOL_GPL(suspend_device_irqs);
1907 +
1908 +-/**
1909 +- * resume_device_irqs - enable interrupt lines disabled by suspend_device_irqs()
1910 +- *
1911 +- * Enable all interrupt lines previously disabled by suspend_device_irqs() that
1912 +- * have the IRQ_SUSPENDED flag set.
1913 +- */
1914 +-void resume_device_irqs(void)
1915 ++static void resume_irqs(bool want_early)
1916 + {
1917 + struct irq_desc *desc;
1918 + int irq;
1919 +
1920 + for_each_irq_desc(irq, desc) {
1921 + unsigned long flags;
1922 ++ bool is_early = desc->action &&
1923 ++ desc->action->flags & IRQF_EARLY_RESUME;
1924 ++
1925 ++ if (is_early != want_early)
1926 ++ continue;
1927 +
1928 + spin_lock_irqsave(&desc->lock, flags);
1929 + __enable_irq(desc, irq, true);
1930 + spin_unlock_irqrestore(&desc->lock, flags);
1931 + }
1932 + }
1933 ++
1934 ++/**
1935 ++ * irq_pm_syscore_ops - enable interrupt lines early
1936 ++ *
1937 ++ * Enable all interrupt lines with %IRQF_EARLY_RESUME set.
1938 ++ */
1939 ++void irq_pm_syscore_resume(void)
1940 ++{
1941 ++ resume_irqs(true);
1942 ++}
1943 ++
1944 ++/**
1945 ++ * resume_device_irqs - enable interrupt lines disabled by suspend_device_irqs()
1946 ++ *
1947 ++ * Enable all non-%IRQF_EARLY_RESUME interrupt lines previously
1948 ++ * disabled by suspend_device_irqs() that have the IRQS_SUSPENDED flag
1949 ++ * set as well as those with %IRQF_FORCE_RESUME.
1950 ++ */
1951 ++void resume_device_irqs(void)
1952 ++{
1953 ++ resume_irqs(false);
1954 ++}
1955 + EXPORT_SYMBOL_GPL(resume_device_irqs);
1956 +
1957 + /**
1958 +diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
1959 +index 6f10dfc..40dd021 100644
1960 +--- a/kernel/power/suspend.c
1961 ++++ b/kernel/power/suspend.c
1962 +@@ -293,7 +293,7 @@ int enter_state(suspend_state_t state)
1963 + */
1964 + int pm_suspend(suspend_state_t state)
1965 + {
1966 +- if (state > PM_SUSPEND_ON && state <= PM_SUSPEND_MAX)
1967 ++ if (state > PM_SUSPEND_ON && state < PM_SUSPEND_MAX)
1968 + return enter_state(state);
1969 + return -EINVAL;
1970 + }
1971 +diff --git a/lib/nlattr.c b/lib/nlattr.c
1972 +index c4706eb..109d4fe 100644
1973 +--- a/lib/nlattr.c
1974 ++++ b/lib/nlattr.c
1975 +@@ -20,6 +20,7 @@ static u16 nla_attr_minlen[NLA_TYPE_MAX+1] __read_mostly = {
1976 + [NLA_U16] = sizeof(u16),
1977 + [NLA_U32] = sizeof(u32),
1978 + [NLA_U64] = sizeof(u64),
1979 ++ [NLA_MSECS] = sizeof(u64),
1980 + [NLA_NESTED] = NLA_HDRLEN,
1981 + };
1982 +
1983 +diff --git a/mm/vmalloc.c b/mm/vmalloc.c
1984 +index 7221e9e..f34ffd0 100644
1985 +--- a/mm/vmalloc.c
1986 ++++ b/mm/vmalloc.c
1987 +@@ -1203,17 +1203,22 @@ EXPORT_SYMBOL_GPL(map_vm_area);
1988 + DEFINE_RWLOCK(vmlist_lock);
1989 + struct vm_struct *vmlist;
1990 +
1991 +-static void insert_vmalloc_vm(struct vm_struct *vm, struct vmap_area *va,
1992 ++static void setup_vmalloc_vm(struct vm_struct *vm, struct vmap_area *va,
1993 + unsigned long flags, void *caller)
1994 + {
1995 +- struct vm_struct *tmp, **p;
1996 +-
1997 + vm->flags = flags;
1998 + vm->addr = (void *)va->va_start;
1999 + vm->size = va->va_end - va->va_start;
2000 + vm->caller = caller;
2001 + va->private = vm;
2002 + va->flags |= VM_VM_AREA;
2003 ++}
2004 ++
2005 ++static void insert_vmalloc_vmlist(struct vm_struct *vm)
2006 ++{
2007 ++ struct vm_struct *tmp, **p;
2008 ++
2009 ++ vm->flags &= ~VM_UNLIST;
2010 +
2011 + write_lock(&vmlist_lock);
2012 + for (p = &vmlist; (tmp = *p) != NULL; p = &tmp->next) {
2013 +@@ -1225,6 +1230,13 @@ static void insert_vmalloc_vm(struct vm_struct *vm, struct vmap_area *va,
2014 + write_unlock(&vmlist_lock);
2015 + }
2016 +
2017 ++static void insert_vmalloc_vm(struct vm_struct *vm, struct vmap_area *va,
2018 ++ unsigned long flags, void *caller)
2019 ++{
2020 ++ setup_vmalloc_vm(vm, va, flags, caller);
2021 ++ insert_vmalloc_vmlist(vm);
2022 ++}
2023 ++
2024 + static struct vm_struct *__get_vm_area_node(unsigned long size,
2025 + unsigned long align, unsigned long flags, unsigned long start,
2026 + unsigned long end, int node, gfp_t gfp_mask, void *caller)
2027 +@@ -1263,7 +1275,18 @@ static struct vm_struct *__get_vm_area_node(unsigned long size,
2028 + return NULL;
2029 + }
2030 +
2031 +- insert_vmalloc_vm(area, va, flags, caller);
2032 ++ /*
2033 ++ * When this function is called from __vmalloc_node,
2034 ++ * we do not add vm_struct to vmlist here to avoid
2035 ++ * accessing uninitialized members of vm_struct such as
2036 ++ * pages and nr_pages fields. They will be set later.
2037 ++ * To distinguish it from others, we use a VM_UNLIST flag.
2038 ++ */
2039 ++ if (flags & VM_UNLIST)
2040 ++ setup_vmalloc_vm(area, va, flags, caller);
2041 ++ else
2042 ++ insert_vmalloc_vm(area, va, flags, caller);
2043 ++
2044 + return area;
2045 + }
2046 +
2047 +@@ -1338,17 +1361,20 @@ struct vm_struct *remove_vm_area(const void *addr)
2048 + va = find_vmap_area((unsigned long)addr);
2049 + if (va && va->flags & VM_VM_AREA) {
2050 + struct vm_struct *vm = va->private;
2051 +- struct vm_struct *tmp, **p;
2052 +- /*
2053 +- * remove from list and disallow access to this vm_struct
2054 +- * before unmap. (address range confliction is maintained by
2055 +- * vmap.)
2056 +- */
2057 +- write_lock(&vmlist_lock);
2058 +- for (p = &vmlist; (tmp = *p) != vm; p = &tmp->next)
2059 +- ;
2060 +- *p = tmp->next;
2061 +- write_unlock(&vmlist_lock);
2062 ++
2063 ++ if (!(vm->flags & VM_UNLIST)) {
2064 ++ struct vm_struct *tmp, **p;
2065 ++ /*
2066 ++ * remove from list and disallow access to
2067 ++ * this vm_struct before unmap. (address range
2068 ++ * confliction is maintained by vmap.)
2069 ++ */
2070 ++ write_lock(&vmlist_lock);
2071 ++ for (p = &vmlist; (tmp = *p) != vm; p = &tmp->next)
2072 ++ ;
2073 ++ *p = tmp->next;
2074 ++ write_unlock(&vmlist_lock);
2075 ++ }
2076 +
2077 + vmap_debug_free_range(va->va_start, va->va_end);
2078 + free_unmap_vmap_area(va);
2079 +@@ -1568,8 +1594,9 @@ static void *__vmalloc_node(unsigned long size, unsigned long align,
2080 + if (!size || (size >> PAGE_SHIFT) > totalram_pages)
2081 + return NULL;
2082 +
2083 +- area = __get_vm_area_node(size, align, VM_ALLOC, VMALLOC_START,
2084 +- VMALLOC_END, node, gfp_mask, caller);
2085 ++ area = __get_vm_area_node(size, align, VM_ALLOC | VM_UNLIST,
2086 ++ VMALLOC_START, VMALLOC_END, node,
2087 ++ gfp_mask, caller);
2088 +
2089 + if (!area)
2090 + return NULL;
2091 +@@ -1577,6 +1604,12 @@ static void *__vmalloc_node(unsigned long size, unsigned long align,
2092 + addr = __vmalloc_area_node(area, gfp_mask, prot, node, caller);
2093 +
2094 + /*
2095 ++ * In this function, newly allocated vm_struct is not added
2096 ++ * to vmlist at __get_vm_area_node(). so, it is added here.
2097 ++ */
2098 ++ insert_vmalloc_vmlist(area);
2099 ++
2100 ++ /*
2101 + * A ref_count = 3 is needed because the vm_struct and vmap_area
2102 + * structures allocated in the __get_vm_area_node() function contain
2103 + * references to the virtual address of the vmalloc'ed block.
2104 +diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
2105 +index cab71ea..5f6a305 100644
2106 +--- a/net/bluetooth/rfcomm/tty.c
2107 ++++ b/net/bluetooth/rfcomm/tty.c
2108 +@@ -844,10 +844,6 @@ static int rfcomm_tty_ioctl(struct tty_struct *tty, struct file *filp, unsigned
2109 + BT_DBG("TIOCMIWAIT");
2110 + break;
2111 +
2112 +- case TIOCGICOUNT:
2113 +- BT_DBG("TIOCGICOUNT");
2114 +- break;
2115 +-
2116 + case TIOCGSERIAL:
2117 + BT_ERR("TIOCGSERIAL is not supported");
2118 + return -ENOIOCTLCMD;
2119 +diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
2120 +index ca520d4..9cc6289 100644
2121 +--- a/net/ipv6/udp.c
2122 ++++ b/net/ipv6/udp.c
2123 +@@ -1141,7 +1141,7 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, int features)
2124 + skb->ip_summed = CHECKSUM_NONE;
2125 +
2126 + /* Check if there is enough headroom to insert fragment header. */
2127 +- if ((skb_headroom(skb) < frag_hdr_sz) &&
2128 ++ if ((skb_mac_header(skb) < skb->head + frag_hdr_sz) &&
2129 + pskb_expand_head(skb, frag_hdr_sz, 0, GFP_ATOMIC))
2130 + goto out;
2131 +
2132 +diff --git a/net/sunrpc/auth_unix.c b/net/sunrpc/auth_unix.c
2133 +index 46b2647..adaa02c 100644
2134 +--- a/net/sunrpc/auth_unix.c
2135 ++++ b/net/sunrpc/auth_unix.c
2136 +@@ -129,6 +129,9 @@ unx_match(struct auth_cred *acred, struct rpc_cred *rcred, int flags)
2137 + for (i = 0; i < groups ; i++)
2138 + if (cred->uc_gids[i] != GROUP_AT(acred->group_info, i))
2139 + return 0;
2140 ++ if (groups < NFS_NGROUPS &&
2141 ++ cred->uc_gids[groups] != NOGROUP)
2142 ++ return 0;
2143 + return 1;
2144 + }
2145 +
2146 +diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
2147 +index c67e73e..92b62a8 100644
2148 +--- a/scripts/Kbuild.include
2149 ++++ b/scripts/Kbuild.include
2150 +@@ -118,6 +118,11 @@ cc-option-yn = $(call try-run,\
2151 + cc-option-align = $(subst -functions=0,,\
2152 + $(call cc-option,-falign-functions=0,-malign-functions=0))
2153 +
2154 ++# cc-disable-warning
2155 ++# Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)
2156 ++cc-disable-warning = $(call try-run,\
2157 ++ $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -xc /dev/null -o "$$TMP",-Wno-$(strip $(1)))
2158 ++
2159 + # cc-version
2160 + # Usage gcc-ver := $(call cc-version)
2161 + cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))
2162 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
2163 +index 2db8b5a..ba44dc0 100644
2164 +--- a/sound/pci/hda/patch_realtek.c
2165 ++++ b/sound/pci/hda/patch_realtek.c
2166 +@@ -12664,7 +12664,6 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = {
2167 + SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
2168 + ALC268_ACER_ASPIRE_ONE),
2169 + SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
2170 +- SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron 910", ALC268_AUTO),
2171 + SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
2172 + "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
2173 + /* almost compatible with toshiba but with optional digital outs;
2174 +diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c
2175 +index 63bc2ae..6fa3152 100644
2176 +--- a/sound/soc/codecs/wm8940.c
2177 ++++ b/sound/soc/codecs/wm8940.c
2178 +@@ -472,6 +472,7 @@ static int wm8940_set_bias_level(struct snd_soc_codec *codec,
2179 + ret = snd_soc_write(codec, WM8940_POWER1, pwr_reg);
2180 + break;
2181 + }
2182 ++ codec->bias_level = level;
2183 +
2184 + return ret;
2185 + }
2186
2187 Deleted: genpatches-2.6/trunk/2.6.32/2900_disable-wunused-but-set-var-gcc-4-6-0.patch
2188 ===================================================================
2189 --- genpatches-2.6/trunk/2.6.32/2900_disable-wunused-but-set-var-gcc-4-6-0.patch 2011-11-26 20:26:00 UTC (rev 2017)
2190 +++ genpatches-2.6/trunk/2.6.32/2900_disable-wunused-but-set-var-gcc-4-6-0.patch 2011-11-27 20:05:18 UTC (rev 2018)
2191 @@ -1,12 +0,0 @@
2192 ---- linux-2.6.32.orig/Makefile
2193 -+++ linux-2.6.32/Makefile
2194 -@@ -537,6 +537,9 @@ ifndef CONFIG_CC_STACKPROTECTOR
2195 - KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
2196 - endif
2197 -
2198 -+# This warning generated too much noise in a regular build.
2199 -+KBUILD_CFLAGS += $(call cc-option, -Wno-unused-but-set-variable)
2200 -+
2201 - ifdef CONFIG_FRAME_POINTER
2202 - KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
2203 - else
2204
2205 Deleted: genpatches-2.6/trunk/2.6.32/2901_kbuild-fix-passing-wno-options-to-gcc-4.4.patch
2206 ===================================================================
2207 --- genpatches-2.6/trunk/2.6.32/2901_kbuild-fix-passing-wno-options-to-gcc-4.4.patch 2011-11-26 20:26:00 UTC (rev 2017)
2208 +++ genpatches-2.6/trunk/2.6.32/2901_kbuild-fix-passing-wno-options-to-gcc-4.4.patch 2011-11-27 20:05:18 UTC (rev 2018)
2209 @@ -1,55 +0,0 @@
2210 ---- linux-2.6.35.y.orig/Documentation/kbuild/makefiles.txt
2211 -+++ linux-2.6.35.y/Documentation/kbuild/makefiles.txt
2212 -@@ -502,6 +502,18 @@ more details, with real examples.
2213 - gcc >= 3.00. For gcc < 3.00, -malign-functions=4 is used.
2214 - Note: cc-option-align uses KBUILD_CFLAGS for $(CC) options
2215 -
2216 -+ cc-disable-warning
2217 -+ cc-disable-warning checks if gcc supports a given warning and returns
2218 -+ the commandline switch to disable it. This special function is needed,
2219 -+ because gcc 4.4 and later accept any unknown -Wno-* option and only
2220 -+ warn about it if there is another warning in the source file.
2221 -+
2222 -+ Example:
2223 -+ KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
2224 -+
2225 -+ In the above example, -Wno-unused-but-set-variable will be added to
2226 -+ KBUILD_CFLAGS only if gcc really accepts it.
2227 -+
2228 - cc-version
2229 - cc-version returns a numerical version of the $(CC) compiler version.
2230 - The format is <major><minor> where both are two digits. So for example
2231 ---- linux-2.6.35.y.orig/Makefile
2232 -+++ linux-2.6.35.y/Makefile
2233 -@@ -547,7 +547,7 @@ KBUILD_CFLAGS += $(call cc-option, -fno-
2234 - endif
2235 -
2236 - # This warning generated too much noise in a regular build.
2237 --KBUILD_CFLAGS += $(call cc-option, -Wno-unused-but-set-variable)
2238 -+KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
2239 -
2240 - ifdef CONFIG_FRAME_POINTER
2241 - KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
2242 -@@ -577,7 +577,7 @@ CHECKFLAGS += $(NOSTDINC_FLAGS)
2243 - KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
2244 -
2245 - # disable pointer signed / unsigned warnings in gcc 4.0
2246 --KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,)
2247 -+KBUILD_CFLAGS += $(call cc-disable-warning, pointer-sign)
2248 -
2249 - # disable invalid "can't wrap" optimizations for signed / pointers
2250 - KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
2251 ---- linux-2.6.35.y.orig/scripts/Kbuild.include
2252 -+++ linux-2.6.35.y/scripts/Kbuild.include
2253 -@@ -118,6 +118,11 @@ cc-option-yn = $(call try-run,\
2254 - cc-option-align = $(subst -functions=0,,\
2255 - $(call cc-option,-falign-functions=0,-malign-functions=0))
2256 -
2257 -+# cc-disable-warning
2258 -+# Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)
2259 -+cc-disable-warning = $(call try-run,\
2260 -+ $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -xc /dev/null -o "$$TMP",-Wno-$(strip $(1)))
2261 -+
2262 - # cc-version
2263 - # Usage gcc-ver := $(call cc-version)
2264 - cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))