Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/hardened-patchset:master commit in: 2.6.32/, 3.1.3/
Date: Tue, 29 Nov 2011 14:52:35
Message-Id: d5ac8150531b708b49e4c710a7d6e7f55e286bb4.blueness@gentoo
1 commit: d5ac8150531b708b49e4c710a7d6e7f55e286bb4
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Tue Nov 29 14:52:11 2011 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Tue Nov 29 14:52:11 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-patchset.git;a=commit;h=d5ac8150
7
8 Removed patches available in genpatches
9
10 ---
11 2.6.32/0000_README | 4 -
12 2.6.32/1048_linux-2.6.32.49.patch | 2143 -------------------------------------
13 3.1.3/0000_README | 4 -
14 3.1.3/1002_linux-3.1.3.patch | 1953 ---------------------------------
15 4 files changed, 0 insertions(+), 4104 deletions(-)
16
17 diff --git a/2.6.32/0000_README b/2.6.32/0000_README
18 index ad9e318..11a0ad4 100644
19 --- a/2.6.32/0000_README
20 +++ b/2.6.32/0000_README
21 @@ -3,10 +3,6 @@ README
22
23 Individual Patch Descriptions:
24 -----------------------------------------------------------------------------
25 -Patch: 1048_linux-2.6.32.44.patch
26 -From: http://www.kernel.org
27 -Desc: Linux 2.6.39.49
28 -
29 Patch: 4420_grsecurity-2.2.2-2.6.32.49-201111262001.patch
30 From: http://www.grsecurity.net
31 Desc: hardened-sources base patch from upstream grsecurity
32
33 diff --git a/2.6.32/1048_linux-2.6.32.49.patch b/2.6.32/1048_linux-2.6.32.49.patch
34 deleted file mode 100644
35 index 82f5850..0000000
36 --- a/2.6.32/1048_linux-2.6.32.49.patch
37 +++ /dev/null
38 @@ -1,2143 +0,0 @@
39 -diff --git a/Documentation/Makefile b/Documentation/Makefile
40 -index 94b9457..043d7da 100644
41 ---- a/Documentation/Makefile
42 -+++ b/Documentation/Makefile
43 -@@ -1,3 +1,3 @@
44 - obj-m := DocBook/ accounting/ auxdisplay/ connector/ \
45 - filesystems/configfs/ ia64/ networking/ \
46 -- pcmcia/ spi/ video4linux/ vm/ watchdog/src/
47 -+ pcmcia/ spi/ vm/ watchdog/src/
48 -diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
49 -index 71c602d..ab8689b 100644
50 ---- a/Documentation/kbuild/makefiles.txt
51 -+++ b/Documentation/kbuild/makefiles.txt
52 -@@ -502,6 +502,18 @@ more details, with real examples.
53 - gcc >= 3.00. For gcc < 3.00, -malign-functions=4 is used.
54 - Note: cc-option-align uses KBUILD_CFLAGS for $(CC) options
55 -
56 -+ cc-disable-warning
57 -+ cc-disable-warning checks if gcc supports a given warning and returns
58 -+ the commandline switch to disable it. This special function is needed,
59 -+ because gcc 4.4 and later accept any unknown -Wno-* option and only
60 -+ warn about it if there is another warning in the source file.
61 -+
62 -+ Example:
63 -+ KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
64 -+
65 -+ In the above example, -Wno-unused-but-set-variable will be added to
66 -+ KBUILD_CFLAGS only if gcc really accepts it.
67 -+
68 - cc-version
69 - cc-version returns a numerical version of the $(CC) compiler version.
70 - The format is <major><minor> where both are two digits. So for example
71 -diff --git a/Documentation/video4linux/Makefile b/Documentation/video4linux/Makefile
72 -deleted file mode 100644
73 -index 1ed0e98..0000000
74 ---- a/Documentation/video4linux/Makefile
75 -+++ /dev/null
76 -@@ -1,8 +0,0 @@
77 --# kbuild trick to avoid linker error. Can be omitted if a module is built.
78 --obj- := dummy.o
79 --
80 --# List of programs to build
81 --hostprogs-y := v4lgrab
82 --
83 --# Tell kbuild to always build the programs
84 --always := $(hostprogs-y)
85 -diff --git a/Documentation/video4linux/v4lgrab.c b/Documentation/video4linux/v4lgrab.c
86 -deleted file mode 100644
87 -index c8ded17..0000000
88 ---- a/Documentation/video4linux/v4lgrab.c
89 -+++ /dev/null
90 -@@ -1,201 +0,0 @@
91 --/* Simple Video4Linux image grabber. */
92 --/*
93 -- * Video4Linux Driver Test/Example Framegrabbing Program
94 -- *
95 -- * Compile with:
96 -- * gcc -s -Wall -Wstrict-prototypes v4lgrab.c -o v4lgrab
97 -- * Use as:
98 -- * v4lgrab >image.ppm
99 -- *
100 -- * Copyright (C) 1998-05-03, Phil Blundell <philb@×××.org>
101 -- * Copied from http://www.tazenda.demon.co.uk/phil/vgrabber.c
102 -- * with minor modifications (Dave Forrest, drf5n@××××××××.edu).
103 -- *
104 -- *
105 -- * For some cameras you may need to pre-load libv4l to perform
106 -- * the necessary decompression, e.g.:
107 -- *
108 -- * export LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so
109 -- * ./v4lgrab >image.ppm
110 -- *
111 -- * see http://hansdegoede.livejournal.com/3636.html for details.
112 -- *
113 -- */
114 --
115 --#include <unistd.h>
116 --#include <sys/types.h>
117 --#include <sys/stat.h>
118 --#include <fcntl.h>
119 --#include <stdio.h>
120 --#include <sys/ioctl.h>
121 --#include <stdlib.h>
122 --
123 --#include <linux/types.h>
124 --#include <linux/videodev.h>
125 --
126 --#define VIDEO_DEV "/dev/video0"
127 --
128 --/* Stole this from tvset.c */
129 --
130 --#define READ_VIDEO_PIXEL(buf, format, depth, r, g, b) \
131 --{ \
132 -- switch (format) \
133 -- { \
134 -- case VIDEO_PALETTE_GREY: \
135 -- switch (depth) \
136 -- { \
137 -- case 4: \
138 -- case 6: \
139 -- case 8: \
140 -- (r) = (g) = (b) = (*buf++ << 8);\
141 -- break; \
142 -- \
143 -- case 16: \
144 -- (r) = (g) = (b) = \
145 -- *((unsigned short *) buf); \
146 -- buf += 2; \
147 -- break; \
148 -- } \
149 -- break; \
150 -- \
151 -- \
152 -- case VIDEO_PALETTE_RGB565: \
153 -- { \
154 -- unsigned short tmp = *(unsigned short *)buf; \
155 -- (r) = tmp&0xF800; \
156 -- (g) = (tmp<<5)&0xFC00; \
157 -- (b) = (tmp<<11)&0xF800; \
158 -- buf += 2; \
159 -- } \
160 -- break; \
161 -- \
162 -- case VIDEO_PALETTE_RGB555: \
163 -- (r) = (buf[0]&0xF8)<<8; \
164 -- (g) = ((buf[0] << 5 | buf[1] >> 3)&0xF8)<<8; \
165 -- (b) = ((buf[1] << 2 ) & 0xF8)<<8; \
166 -- buf += 2; \
167 -- break; \
168 -- \
169 -- case VIDEO_PALETTE_RGB24: \
170 -- (r) = buf[0] << 8; (g) = buf[1] << 8; \
171 -- (b) = buf[2] << 8; \
172 -- buf += 3; \
173 -- break; \
174 -- \
175 -- default: \
176 -- fprintf(stderr, \
177 -- "Format %d not yet supported\n", \
178 -- format); \
179 -- } \
180 --}
181 --
182 --static int get_brightness_adj(unsigned char *image, long size, int *brightness) {
183 -- long i, tot = 0;
184 -- for (i=0;i<size*3;i++)
185 -- tot += image[i];
186 -- *brightness = (128 - tot/(size*3))/3;
187 -- return !((tot/(size*3)) >= 126 && (tot/(size*3)) <= 130);
188 --}
189 --
190 --int main(int argc, char ** argv)
191 --{
192 -- int fd = open(VIDEO_DEV, O_RDONLY), f;
193 -- struct video_capability cap;
194 -- struct video_window win;
195 -- struct video_picture vpic;
196 --
197 -- unsigned char *buffer, *src;
198 -- int bpp = 24, r = 0, g = 0, b = 0;
199 -- unsigned int i, src_depth = 16;
200 --
201 -- if (fd < 0) {
202 -- perror(VIDEO_DEV);
203 -- exit(1);
204 -- }
205 --
206 -- if (ioctl(fd, VIDIOCGCAP, &cap) < 0) {
207 -- perror("VIDIOGCAP");
208 -- fprintf(stderr, "(" VIDEO_DEV " not a video4linux device?)\n");
209 -- close(fd);
210 -- exit(1);
211 -- }
212 --
213 -- if (ioctl(fd, VIDIOCGWIN, &win) < 0) {
214 -- perror("VIDIOCGWIN");
215 -- close(fd);
216 -- exit(1);
217 -- }
218 --
219 -- if (ioctl(fd, VIDIOCGPICT, &vpic) < 0) {
220 -- perror("VIDIOCGPICT");
221 -- close(fd);
222 -- exit(1);
223 -- }
224 --
225 -- if (cap.type & VID_TYPE_MONOCHROME) {
226 -- vpic.depth=8;
227 -- vpic.palette=VIDEO_PALETTE_GREY; /* 8bit grey */
228 -- if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) {
229 -- vpic.depth=6;
230 -- if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) {
231 -- vpic.depth=4;
232 -- if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) {
233 -- fprintf(stderr, "Unable to find a supported capture format.\n");
234 -- close(fd);
235 -- exit(1);
236 -- }
237 -- }
238 -- }
239 -- } else {
240 -- vpic.depth=24;
241 -- vpic.palette=VIDEO_PALETTE_RGB24;
242 --
243 -- if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) {
244 -- vpic.palette=VIDEO_PALETTE_RGB565;
245 -- vpic.depth=16;
246 --
247 -- if(ioctl(fd, VIDIOCSPICT, &vpic)==-1) {
248 -- vpic.palette=VIDEO_PALETTE_RGB555;
249 -- vpic.depth=15;
250 --
251 -- if(ioctl(fd, VIDIOCSPICT, &vpic)==-1) {
252 -- fprintf(stderr, "Unable to find a supported capture format.\n");
253 -- return -1;
254 -- }
255 -- }
256 -- }
257 -- }
258 --
259 -- buffer = malloc(win.width * win.height * bpp);
260 -- if (!buffer) {
261 -- fprintf(stderr, "Out of memory.\n");
262 -- exit(1);
263 -- }
264 --
265 -- do {
266 -- int newbright;
267 -- read(fd, buffer, win.width * win.height * bpp);
268 -- f = get_brightness_adj(buffer, win.width * win.height, &newbright);
269 -- if (f) {
270 -- vpic.brightness += (newbright << 8);
271 -- if(ioctl(fd, VIDIOCSPICT, &vpic)==-1) {
272 -- perror("VIDIOSPICT");
273 -- break;
274 -- }
275 -- }
276 -- } while (f);
277 --
278 -- fprintf(stdout, "P6\n%d %d 255\n", win.width, win.height);
279 --
280 -- src = buffer;
281 --
282 -- for (i = 0; i < win.width * win.height; i++) {
283 -- READ_VIDEO_PIXEL(src, vpic.palette, src_depth, r, g, b);
284 -- fputc(r>>8, stdout);
285 -- fputc(g>>8, stdout);
286 -- fputc(b>>8, stdout);
287 -- }
288 --
289 -- close(fd);
290 -- return 0;
291 --}
292 -diff --git a/Makefile b/Makefile
293 -index 400a175..a19b0e8 100644
294 ---- a/Makefile
295 -+++ b/Makefile
296 -@@ -537,6 +537,9 @@ ifndef CONFIG_CC_STACKPROTECTOR
297 - KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
298 - endif
299 -
300 -+# This warning generated too much noise in a regular build.
301 -+KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
302 -+
303 - ifdef CONFIG_FRAME_POINTER
304 - KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
305 - else
306 -@@ -565,7 +568,7 @@ CHECKFLAGS += $(NOSTDINC_FLAGS)
307 - KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
308 -
309 - # disable pointer signed / unsigned warnings in gcc 4.0
310 --KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,)
311 -+KBUILD_CFLAGS += $(call cc-disable-warning, pointer-sign)
312 -
313 - # disable invalid "can't wrap" optimizations for signed / pointers
314 - KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
315 -diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c
316 -index 2bef526..204f650 100644
317 ---- a/arch/ia64/hp/sim/simserial.c
318 -+++ b/arch/ia64/hp/sim/simserial.c
319 -@@ -395,7 +395,7 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
320 - {
321 - if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
322 - (cmd != TIOCSERCONFIG) && (cmd != TIOCSERGSTRUCT) &&
323 -- (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) {
324 -+ (cmd != TIOCMIWAIT)) {
325 - if (tty->flags & (1 << TTY_IO_ERROR))
326 - return -EIO;
327 - }
328 -@@ -433,16 +433,6 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
329 - case TIOCMIWAIT:
330 - printk(KERN_INFO "rs_ioctl: TIOCMIWAIT: called\n");
331 - return 0;
332 -- /*
333 -- * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
334 -- * Return: write counters to the user passed counter struct
335 -- * NB: both 1->0 and 0->1 transitions are counted except for
336 -- * RI where only 0->1 is counted.
337 -- */
338 -- case TIOCGICOUNT:
339 -- printk(KERN_INFO "rs_ioctl: TIOCGICOUNT called\n");
340 -- return 0;
341 --
342 - case TIOCSERGWILD:
343 - case TIOCSERSWILD:
344 - /* "setserial -W" is called in Debian boot */
345 -diff --git a/drivers/base/sys.c b/drivers/base/sys.c
346 -index 0d90390..3f202f7 100644
347 ---- a/drivers/base/sys.c
348 -+++ b/drivers/base/sys.c
349 -@@ -471,6 +471,12 @@ int sysdev_resume(void)
350 - {
351 - struct sysdev_class *cls;
352 -
353 -+ /*
354 -+ * Called from syscore in mainline but called directly here
355 -+ * since syscore does not exist in this tree.
356 -+ */
357 -+ irq_pm_syscore_resume();
358 -+
359 - WARN_ONCE(!irqs_disabled(),
360 - "Interrupts enabled while resuming system devices\n");
361 -
362 -diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c
363 -index 6c32fbf..579d479 100644
364 ---- a/drivers/char/amiserial.c
365 -+++ b/drivers/char/amiserial.c
366 -@@ -1262,6 +1262,36 @@ static int rs_break(struct tty_struct *tty, int break_state)
367 - return 0;
368 - }
369 -
370 -+/*
371 -+ * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
372 -+ * Return: write counters to the user passed counter struct
373 -+ * NB: both 1->0 and 0->1 transitions are counted except for
374 -+ * RI where only 0->1 is counted.
375 -+ */
376 -+static int rs_get_icount(struct tty_struct *tty,
377 -+ struct serial_icounter_struct *icount)
378 -+{
379 -+ struct async_struct *info = tty->driver_data;
380 -+ struct async_icount cnow;
381 -+ unsigned long flags;
382 -+
383 -+ local_irq_save(flags);
384 -+ cnow = info->state->icount;
385 -+ local_irq_restore(flags);
386 -+ icount->cts = cnow.cts;
387 -+ icount->dsr = cnow.dsr;
388 -+ icount->rng = cnow.rng;
389 -+ icount->dcd = cnow.dcd;
390 -+ icount->rx = cnow.rx;
391 -+ icount->tx = cnow.tx;
392 -+ icount->frame = cnow.frame;
393 -+ icount->overrun = cnow.overrun;
394 -+ icount->parity = cnow.parity;
395 -+ icount->brk = cnow.brk;
396 -+ icount->buf_overrun = cnow.buf_overrun;
397 -+
398 -+ return 0;
399 -+}
400 -
401 - static int rs_ioctl(struct tty_struct *tty, struct file * file,
402 - unsigned int cmd, unsigned long arg)
403 -@@ -1331,31 +1361,6 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
404 - }
405 - /* NOTREACHED */
406 -
407 -- /*
408 -- * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
409 -- * Return: write counters to the user passed counter struct
410 -- * NB: both 1->0 and 0->1 transitions are counted except for
411 -- * RI where only 0->1 is counted.
412 -- */
413 -- case TIOCGICOUNT:
414 -- local_irq_save(flags);
415 -- cnow = info->state->icount;
416 -- local_irq_restore(flags);
417 -- icount.cts = cnow.cts;
418 -- icount.dsr = cnow.dsr;
419 -- icount.rng = cnow.rng;
420 -- icount.dcd = cnow.dcd;
421 -- icount.rx = cnow.rx;
422 -- icount.tx = cnow.tx;
423 -- icount.frame = cnow.frame;
424 -- icount.overrun = cnow.overrun;
425 -- icount.parity = cnow.parity;
426 -- icount.brk = cnow.brk;
427 -- icount.buf_overrun = cnow.buf_overrun;
428 --
429 -- if (copy_to_user(argp, &icount, sizeof(icount)))
430 -- return -EFAULT;
431 -- return 0;
432 - case TIOCSERGWILD:
433 - case TIOCSERSWILD:
434 - /* "setserial -W" is called in Debian boot */
435 -@@ -1948,6 +1953,7 @@ static const struct tty_operations serial_ops = {
436 - .wait_until_sent = rs_wait_until_sent,
437 - .tiocmget = rs_tiocmget,
438 - .tiocmset = rs_tiocmset,
439 -+ .get_icount = rs_get_icount,
440 - .proc_fops = &rs_proc_fops,
441 - };
442 -
443 -diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
444 -index 4254457..a0369dc 100644
445 ---- a/drivers/char/cyclades.c
446 -+++ b/drivers/char/cyclades.c
447 -@@ -2798,29 +2798,6 @@ cy_ioctl(struct tty_struct *tty, struct file *file,
448 - * NB: both 1->0 and 0->1 transitions are counted except for
449 - * RI where only 0->1 is counted.
450 - */
451 -- case TIOCGICOUNT: {
452 -- struct serial_icounter_struct sic = { };
453 --
454 -- spin_lock_irqsave(&info->card->card_lock, flags);
455 -- cnow = info->icount;
456 -- spin_unlock_irqrestore(&info->card->card_lock, flags);
457 --
458 -- sic.cts = cnow.cts;
459 -- sic.dsr = cnow.dsr;
460 -- sic.rng = cnow.rng;
461 -- sic.dcd = cnow.dcd;
462 -- sic.rx = cnow.rx;
463 -- sic.tx = cnow.tx;
464 -- sic.frame = cnow.frame;
465 -- sic.overrun = cnow.overrun;
466 -- sic.parity = cnow.parity;
467 -- sic.brk = cnow.brk;
468 -- sic.buf_overrun = cnow.buf_overrun;
469 --
470 -- if (copy_to_user(argp, &sic, sizeof(sic)))
471 -- ret_val = -EFAULT;
472 -- break;
473 -- }
474 - default:
475 - ret_val = -ENOIOCTLCMD;
476 - }
477 -@@ -2832,6 +2809,31 @@ cy_ioctl(struct tty_struct *tty, struct file *file,
478 - return ret_val;
479 - } /* cy_ioctl */
480 -
481 -+static int cy_get_icount(struct tty_struct *tty,
482 -+ struct serial_icounter_struct *sic)
483 -+{
484 -+ struct cyclades_port *info = tty->driver_data;
485 -+ struct cyclades_icount cnow; /* Used to snapshot */
486 -+ unsigned long flags;
487 -+
488 -+ spin_lock_irqsave(&info->card->card_lock, flags);
489 -+ cnow = info->icount;
490 -+ spin_unlock_irqrestore(&info->card->card_lock, flags);
491 -+
492 -+ sic->cts = cnow.cts;
493 -+ sic->dsr = cnow.dsr;
494 -+ sic->rng = cnow.rng;
495 -+ sic->dcd = cnow.dcd;
496 -+ sic->rx = cnow.rx;
497 -+ sic->tx = cnow.tx;
498 -+ sic->frame = cnow.frame;
499 -+ sic->overrun = cnow.overrun;
500 -+ sic->parity = cnow.parity;
501 -+ sic->brk = cnow.brk;
502 -+ sic->buf_overrun = cnow.buf_overrun;
503 -+ return 0;
504 -+}
505 -+
506 - /*
507 - * This routine allows the tty driver to be notified when
508 - * device's termios settings have changed. Note that a
509 -@@ -4098,6 +4100,7 @@ static const struct tty_operations cy_ops = {
510 - .wait_until_sent = cy_wait_until_sent,
511 - .tiocmget = cy_tiocmget,
512 - .tiocmset = cy_tiocmset,
513 -+ .get_icount = cy_get_icount,
514 - .proc_fops = &cyclades_proc_fops,
515 - };
516 -
517 -diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c
518 -index 517271c..3bec541 100644
519 ---- a/drivers/char/ip2/ip2main.c
520 -+++ b/drivers/char/ip2/ip2main.c
521 -@@ -183,6 +183,8 @@ static void ip2_hangup(PTTY);
522 - static int ip2_tiocmget(struct tty_struct *tty, struct file *file);
523 - static int ip2_tiocmset(struct tty_struct *tty, struct file *file,
524 - unsigned int set, unsigned int clear);
525 -+static int ip2_get_icount(struct tty_struct *tty,
526 -+ struct serial_icounter_struct *icount);
527 -
528 - static void set_irq(int, int);
529 - static void ip2_interrupt_bh(struct work_struct *work);
530 -@@ -448,6 +450,7 @@ static const struct tty_operations ip2_ops = {
531 - .hangup = ip2_hangup,
532 - .tiocmget = ip2_tiocmget,
533 - .tiocmset = ip2_tiocmset,
534 -+ .get_icount = ip2_get_icount,
535 - .proc_fops = &ip2_proc_fops,
536 - };
537 -
538 -@@ -2112,7 +2115,6 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg )
539 - i2ChanStrPtr pCh = DevTable[tty->index];
540 - i2eBordStrPtr pB;
541 - struct async_icount cprev, cnow; /* kernel counter temps */
542 -- struct serial_icounter_struct __user *p_cuser;
543 - int rc = 0;
544 - unsigned long flags;
545 - void __user *argp = (void __user *)arg;
546 -@@ -2281,34 +2283,6 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg )
547 - break;
548 -
549 - /*
550 -- * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
551 -- * Return: write counters to the user passed counter struct
552 -- * NB: both 1->0 and 0->1 transitions are counted except for RI where
553 -- * only 0->1 is counted. The controller is quite capable of counting
554 -- * both, but this done to preserve compatibility with the standard
555 -- * serial driver.
556 -- */
557 -- case TIOCGICOUNT:
558 -- ip2trace (CHANN, ITRC_IOCTL, 11, 1, rc );
559 --
560 -- write_lock_irqsave(&pB->read_fifo_spinlock, flags);
561 -- cnow = pCh->icount;
562 -- write_unlock_irqrestore(&pB->read_fifo_spinlock, flags);
563 -- p_cuser = argp;
564 -- rc = put_user(cnow.cts, &p_cuser->cts);
565 -- rc = put_user(cnow.dsr, &p_cuser->dsr);
566 -- rc = put_user(cnow.rng, &p_cuser->rng);
567 -- rc = put_user(cnow.dcd, &p_cuser->dcd);
568 -- rc = put_user(cnow.rx, &p_cuser->rx);
569 -- rc = put_user(cnow.tx, &p_cuser->tx);
570 -- rc = put_user(cnow.frame, &p_cuser->frame);
571 -- rc = put_user(cnow.overrun, &p_cuser->overrun);
572 -- rc = put_user(cnow.parity, &p_cuser->parity);
573 -- rc = put_user(cnow.brk, &p_cuser->brk);
574 -- rc = put_user(cnow.buf_overrun, &p_cuser->buf_overrun);
575 -- break;
576 --
577 -- /*
578 - * The rest are not supported by this driver. By returning -ENOIOCTLCMD they
579 - * will be passed to the line discipline for it to handle.
580 - */
581 -@@ -2332,6 +2306,46 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg )
582 - return rc;
583 - }
584 -
585 -+static int ip2_get_icount(struct tty_struct *tty,
586 -+ struct serial_icounter_struct *icount)
587 -+{
588 -+ i2ChanStrPtr pCh = DevTable[tty->index];
589 -+ i2eBordStrPtr pB;
590 -+ struct async_icount cnow; /* kernel counter temp */
591 -+ unsigned long flags;
592 -+
593 -+ if ( pCh == NULL )
594 -+ return -ENODEV;
595 -+
596 -+ pB = pCh->pMyBord;
597 -+
598 -+ /*
599 -+ * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
600 -+ * Return: write counters to the user passed counter struct
601 -+ * NB: both 1->0 and 0->1 transitions are counted except for RI where
602 -+ * only 0->1 is counted. The controller is quite capable of counting
603 -+ * both, but this done to preserve compatibility with the standard
604 -+ * serial driver.
605 -+ */
606 -+
607 -+ write_lock_irqsave(&pB->read_fifo_spinlock, flags);
608 -+ cnow = pCh->icount;
609 -+ write_unlock_irqrestore(&pB->read_fifo_spinlock, flags);
610 -+
611 -+ icount->cts = cnow.cts;
612 -+ icount->dsr = cnow.dsr;
613 -+ icount->rng = cnow.rng;
614 -+ icount->dcd = cnow.dcd;
615 -+ icount->rx = cnow.rx;
616 -+ icount->tx = cnow.tx;
617 -+ icount->frame = cnow.frame;
618 -+ icount->overrun = cnow.overrun;
619 -+ icount->parity = cnow.parity;
620 -+ icount->brk = cnow.brk;
621 -+ icount->buf_overrun = cnow.buf_overrun;
622 -+ return 0;
623 -+}
624 -+
625 - /******************************************************************************/
626 - /* Function: GetSerialInfo() */
627 - /* Parameters: Pointer to channel structure */
628 -diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
629 -index 5e28d39..4b97406 100644
630 ---- a/drivers/char/mxser.c
631 -+++ b/drivers/char/mxser.c
632 -@@ -1736,7 +1736,7 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file,
633 - return 0;
634 - }
635 -
636 -- if (cmd != TIOCGSERIAL && cmd != TIOCMIWAIT && cmd != TIOCGICOUNT &&
637 -+ if (cmd != TIOCGSERIAL && cmd != TIOCMIWAIT &&
638 - test_bit(TTY_IO_ERROR, &tty->flags))
639 - return -EIO;
640 -
641 -@@ -1766,32 +1766,6 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file,
642 -
643 - return wait_event_interruptible(info->port.delta_msr_wait,
644 - mxser_cflags_changed(info, arg, &cnow));
645 -- /*
646 -- * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
647 -- * Return: write counters to the user passed counter struct
648 -- * NB: both 1->0 and 0->1 transitions are counted except for
649 -- * RI where only 0->1 is counted.
650 -- */
651 -- case TIOCGICOUNT: {
652 -- struct serial_icounter_struct icnt = { 0 };
653 -- spin_lock_irqsave(&info->slock, flags);
654 -- cnow = info->icount;
655 -- spin_unlock_irqrestore(&info->slock, flags);
656 --
657 -- icnt.frame = cnow.frame;
658 -- icnt.brk = cnow.brk;
659 -- icnt.overrun = cnow.overrun;
660 -- icnt.buf_overrun = cnow.buf_overrun;
661 -- icnt.parity = cnow.parity;
662 -- icnt.rx = cnow.rx;
663 -- icnt.tx = cnow.tx;
664 -- icnt.cts = cnow.cts;
665 -- icnt.dsr = cnow.dsr;
666 -- icnt.rng = cnow.rng;
667 -- icnt.dcd = cnow.dcd;
668 --
669 -- return copy_to_user(argp, &icnt, sizeof(icnt)) ? -EFAULT : 0;
670 -- }
671 - case MOXA_HighSpeedOn:
672 - return put_user(info->baud_base != 115200 ? 1 : 0, (int __user *)argp);
673 - case MOXA_SDS_RSTICOUNTER:
674 -@@ -1862,6 +1836,39 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file,
675 - return 0;
676 - }
677 -
678 -+ /*
679 -+ * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
680 -+ * Return: write counters to the user passed counter struct
681 -+ * NB: both 1->0 and 0->1 transitions are counted except for
682 -+ * RI where only 0->1 is counted.
683 -+ */
684 -+
685 -+static int mxser_get_icount(struct tty_struct *tty,
686 -+ struct serial_icounter_struct *icount)
687 -+
688 -+{
689 -+ struct mxser_port *info = tty->driver_data;
690 -+ struct async_icount cnow;
691 -+ unsigned long flags;
692 -+
693 -+ spin_lock_irqsave(&info->slock, flags);
694 -+ cnow = info->icount;
695 -+ spin_unlock_irqrestore(&info->slock, flags);
696 -+
697 -+ icount->frame = cnow.frame;
698 -+ icount->brk = cnow.brk;
699 -+ icount->overrun = cnow.overrun;
700 -+ icount->buf_overrun = cnow.buf_overrun;
701 -+ icount->parity = cnow.parity;
702 -+ icount->rx = cnow.rx;
703 -+ icount->tx = cnow.tx;
704 -+ icount->cts = cnow.cts;
705 -+ icount->dsr = cnow.dsr;
706 -+ icount->rng = cnow.rng;
707 -+ icount->dcd = cnow.dcd;
708 -+ return 0;
709 -+}
710 -+
711 - static void mxser_stoprx(struct tty_struct *tty)
712 - {
713 - struct mxser_port *info = tty->driver_data;
714 -@@ -2358,6 +2365,7 @@ static const struct tty_operations mxser_ops = {
715 - .wait_until_sent = mxser_wait_until_sent,
716 - .tiocmget = mxser_tiocmget,
717 - .tiocmset = mxser_tiocmset,
718 -+ .get_icount = mxser_get_icount,
719 - };
720 -
721 - struct tty_port_operations mxser_port_ops = {
722 -diff --git a/drivers/char/nozomi.c b/drivers/char/nozomi.c
723 -index dc52f75..19b3e1d 100644
724 ---- a/drivers/char/nozomi.c
725 -+++ b/drivers/char/nozomi.c
726 -@@ -1783,24 +1783,24 @@ static int ntty_cflags_changed(struct port *port, unsigned long flags,
727 - return ret;
728 - }
729 -
730 --static int ntty_ioctl_tiocgicount(struct port *port, void __user *argp)
731 -+static int ntty_tiocgicount(struct tty_struct *tty,
732 -+ struct serial_icounter_struct *icount)
733 - {
734 -+ struct port *port = tty->driver_data;
735 - const struct async_icount cnow = port->tty_icount;
736 -- struct serial_icounter_struct icount;
737 --
738 -- icount.cts = cnow.cts;
739 -- icount.dsr = cnow.dsr;
740 -- icount.rng = cnow.rng;
741 -- icount.dcd = cnow.dcd;
742 -- icount.rx = cnow.rx;
743 -- icount.tx = cnow.tx;
744 -- icount.frame = cnow.frame;
745 -- icount.overrun = cnow.overrun;
746 -- icount.parity = cnow.parity;
747 -- icount.brk = cnow.brk;
748 -- icount.buf_overrun = cnow.buf_overrun;
749 --
750 -- return copy_to_user(argp, &icount, sizeof(icount)) ? -EFAULT : 0;
751 -+
752 -+ icount->cts = cnow.cts;
753 -+ icount->dsr = cnow.dsr;
754 -+ icount->rng = cnow.rng;
755 -+ icount->dcd = cnow.dcd;
756 -+ icount->rx = cnow.rx;
757 -+ icount->tx = cnow.tx;
758 -+ icount->frame = cnow.frame;
759 -+ icount->overrun = cnow.overrun;
760 -+ icount->parity = cnow.parity;
761 -+ icount->brk = cnow.brk;
762 -+ icount->buf_overrun = cnow.buf_overrun;
763 -+ return 0;
764 - }
765 -
766 - static int ntty_ioctl(struct tty_struct *tty, struct file *file,
767 -@@ -1819,9 +1819,7 @@ static int ntty_ioctl(struct tty_struct *tty, struct file *file,
768 - rval = wait_event_interruptible(port->tty_wait,
769 - ntty_cflags_changed(port, arg, &cprev));
770 - break;
771 -- } case TIOCGICOUNT:
772 -- rval = ntty_ioctl_tiocgicount(port, argp);
773 -- break;
774 -+ }
775 - default:
776 - DBG1("ERR: 0x%08X, %d", cmd, cmd);
777 - break;
778 -@@ -1895,6 +1893,7 @@ static const struct tty_operations tty_ops = {
779 - .chars_in_buffer = ntty_chars_in_buffer,
780 - .tiocmget = ntty_tiocmget,
781 - .tiocmset = ntty_tiocmset,
782 -+ .get_icount = ntty_tiocgicount,
783 - };
784 -
785 - /* Module initialization */
786 -diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
787 -index a08c899..74d124b 100644
788 ---- a/drivers/char/pcmcia/synclink_cs.c
789 -+++ b/drivers/char/pcmcia/synclink_cs.c
790 -@@ -2252,6 +2252,32 @@ static int mgslpc_break(struct tty_struct *tty, int break_state)
791 - return 0;
792 - }
793 -
794 -+static int mgslpc_get_icount(struct tty_struct *tty,
795 -+ struct serial_icounter_struct *icount)
796 -+{
797 -+ MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data;
798 -+ struct mgsl_icount cnow; /* kernel counter temps */
799 -+ unsigned long flags;
800 -+
801 -+ spin_lock_irqsave(&info->lock,flags);
802 -+ cnow = info->icount;
803 -+ spin_unlock_irqrestore(&info->lock,flags);
804 -+
805 -+ icount->cts = cnow.cts;
806 -+ icount->dsr = cnow.dsr;
807 -+ icount->rng = cnow.rng;
808 -+ icount->dcd = cnow.dcd;
809 -+ icount->rx = cnow.rx;
810 -+ icount->tx = cnow.tx;
811 -+ icount->frame = cnow.frame;
812 -+ icount->overrun = cnow.overrun;
813 -+ icount->parity = cnow.parity;
814 -+ icount->brk = cnow.brk;
815 -+ icount->buf_overrun = cnow.buf_overrun;
816 -+
817 -+ return 0;
818 -+}
819 -+
820 - /* Service an IOCTL request
821 - *
822 - * Arguments:
823 -@@ -2267,11 +2293,7 @@ static int mgslpc_ioctl(struct tty_struct *tty, struct file * file,
824 - unsigned int cmd, unsigned long arg)
825 - {
826 - MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data;
827 -- int error;
828 -- struct mgsl_icount cnow; /* kernel counter temps */
829 -- struct serial_icounter_struct __user *p_cuser; /* user space */
830 - void __user *argp = (void __user *)arg;
831 -- unsigned long flags;
832 -
833 - if (debug_level >= DEBUG_LEVEL_INFO)
834 - printk("%s(%d):mgslpc_ioctl %s cmd=%08X\n", __FILE__,__LINE__,
835 -@@ -2281,7 +2303,7 @@ static int mgslpc_ioctl(struct tty_struct *tty, struct file * file,
836 - return -ENODEV;
837 -
838 - if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
839 -- (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) {
840 -+ (cmd != TIOCMIWAIT)) {
841 - if (tty->flags & (1 << TTY_IO_ERROR))
842 - return -EIO;
843 - }
844 -@@ -2311,34 +2333,6 @@ static int mgslpc_ioctl(struct tty_struct *tty, struct file * file,
845 - return wait_events(info, argp);
846 - case TIOCMIWAIT:
847 - return modem_input_wait(info,(int)arg);
848 -- case TIOCGICOUNT:
849 -- spin_lock_irqsave(&info->lock,flags);
850 -- cnow = info->icount;
851 -- spin_unlock_irqrestore(&info->lock,flags);
852 -- p_cuser = argp;
853 -- PUT_USER(error,cnow.cts, &p_cuser->cts);
854 -- if (error) return error;
855 -- PUT_USER(error,cnow.dsr, &p_cuser->dsr);
856 -- if (error) return error;
857 -- PUT_USER(error,cnow.rng, &p_cuser->rng);
858 -- if (error) return error;
859 -- PUT_USER(error,cnow.dcd, &p_cuser->dcd);
860 -- if (error) return error;
861 -- PUT_USER(error,cnow.rx, &p_cuser->rx);
862 -- if (error) return error;
863 -- PUT_USER(error,cnow.tx, &p_cuser->tx);
864 -- if (error) return error;
865 -- PUT_USER(error,cnow.frame, &p_cuser->frame);
866 -- if (error) return error;
867 -- PUT_USER(error,cnow.overrun, &p_cuser->overrun);
868 -- if (error) return error;
869 -- PUT_USER(error,cnow.parity, &p_cuser->parity);
870 -- if (error) return error;
871 -- PUT_USER(error,cnow.brk, &p_cuser->brk);
872 -- if (error) return error;
873 -- PUT_USER(error,cnow.buf_overrun, &p_cuser->buf_overrun);
874 -- if (error) return error;
875 -- return 0;
876 - default:
877 - return -ENOIOCTLCMD;
878 - }
879 -diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
880 -index 4846b73..b118959 100644
881 ---- a/drivers/char/synclink.c
882 -+++ b/drivers/char/synclink.c
883 -@@ -2920,6 +2920,38 @@ static int mgsl_break(struct tty_struct *tty, int break_state)
884 -
885 - } /* end of mgsl_break() */
886 -
887 -+/*
888 -+ * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
889 -+ * Return: write counters to the user passed counter struct
890 -+ * NB: both 1->0 and 0->1 transitions are counted except for
891 -+ * RI where only 0->1 is counted.
892 -+ */
893 -+static int msgl_get_icount(struct tty_struct *tty,
894 -+ struct serial_icounter_struct *icount)
895 -+
896 -+{
897 -+ struct mgsl_struct * info = tty->driver_data;
898 -+ struct mgsl_icount cnow; /* kernel counter temps */
899 -+ unsigned long flags;
900 -+
901 -+ spin_lock_irqsave(&info->irq_spinlock,flags);
902 -+ cnow = info->icount;
903 -+ spin_unlock_irqrestore(&info->irq_spinlock,flags);
904 -+
905 -+ icount->cts = cnow.cts;
906 -+ icount->dsr = cnow.dsr;
907 -+ icount->rng = cnow.rng;
908 -+ icount->dcd = cnow.dcd;
909 -+ icount->rx = cnow.rx;
910 -+ icount->tx = cnow.tx;
911 -+ icount->frame = cnow.frame;
912 -+ icount->overrun = cnow.overrun;
913 -+ icount->parity = cnow.parity;
914 -+ icount->brk = cnow.brk;
915 -+ icount->buf_overrun = cnow.buf_overrun;
916 -+ return 0;
917 -+}
918 -+
919 - /* mgsl_ioctl() Service an IOCTL request
920 - *
921 - * Arguments:
922 -@@ -2945,7 +2977,7 @@ static int mgsl_ioctl(struct tty_struct *tty, struct file * file,
923 - return -ENODEV;
924 -
925 - if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
926 -- (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) {
927 -+ (cmd != TIOCMIWAIT)) {
928 - if (tty->flags & (1 << TTY_IO_ERROR))
929 - return -EIO;
930 - }
931 -@@ -2958,11 +2990,7 @@ static int mgsl_ioctl(struct tty_struct *tty, struct file * file,
932 -
933 - static int mgsl_ioctl_common(struct mgsl_struct *info, unsigned int cmd, unsigned long arg)
934 - {
935 -- int error;
936 -- struct mgsl_icount cnow; /* kernel counter temps */
937 - void __user *argp = (void __user *)arg;
938 -- struct serial_icounter_struct __user *p_cuser; /* user space */
939 -- unsigned long flags;
940 -
941 - switch (cmd) {
942 - case MGSL_IOCGPARAMS:
943 -@@ -2991,40 +3019,6 @@ static int mgsl_ioctl_common(struct mgsl_struct *info, unsigned int cmd, unsigne
944 - case TIOCMIWAIT:
945 - return modem_input_wait(info,(int)arg);
946 -
947 -- /*
948 -- * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
949 -- * Return: write counters to the user passed counter struct
950 -- * NB: both 1->0 and 0->1 transitions are counted except for
951 -- * RI where only 0->1 is counted.
952 -- */
953 -- case TIOCGICOUNT:
954 -- spin_lock_irqsave(&info->irq_spinlock,flags);
955 -- cnow = info->icount;
956 -- spin_unlock_irqrestore(&info->irq_spinlock,flags);
957 -- p_cuser = argp;
958 -- PUT_USER(error,cnow.cts, &p_cuser->cts);
959 -- if (error) return error;
960 -- PUT_USER(error,cnow.dsr, &p_cuser->dsr);
961 -- if (error) return error;
962 -- PUT_USER(error,cnow.rng, &p_cuser->rng);
963 -- if (error) return error;
964 -- PUT_USER(error,cnow.dcd, &p_cuser->dcd);
965 -- if (error) return error;
966 -- PUT_USER(error,cnow.rx, &p_cuser->rx);
967 -- if (error) return error;
968 -- PUT_USER(error,cnow.tx, &p_cuser->tx);
969 -- if (error) return error;
970 -- PUT_USER(error,cnow.frame, &p_cuser->frame);
971 -- if (error) return error;
972 -- PUT_USER(error,cnow.overrun, &p_cuser->overrun);
973 -- if (error) return error;
974 -- PUT_USER(error,cnow.parity, &p_cuser->parity);
975 -- if (error) return error;
976 -- PUT_USER(error,cnow.brk, &p_cuser->brk);
977 -- if (error) return error;
978 -- PUT_USER(error,cnow.buf_overrun, &p_cuser->buf_overrun);
979 -- if (error) return error;
980 -- return 0;
981 - default:
982 - return -ENOIOCTLCMD;
983 - }
984 -@@ -4325,6 +4319,7 @@ static const struct tty_operations mgsl_ops = {
985 - .hangup = mgsl_hangup,
986 - .tiocmget = tiocmget,
987 - .tiocmset = tiocmset,
988 -+ .get_icount = msgl_get_icount,
989 - .proc_fops = &mgsl_proc_fops,
990 - };
991 -
992 -diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
993 -index 8678f0c..c300ff6 100644
994 ---- a/drivers/char/synclink_gt.c
995 -+++ b/drivers/char/synclink_gt.c
996 -@@ -1057,9 +1057,6 @@ static int ioctl(struct tty_struct *tty, struct file *file,
997 - unsigned int cmd, unsigned long arg)
998 - {
999 - struct slgt_info *info = tty->driver_data;
1000 -- struct mgsl_icount cnow; /* kernel counter temps */
1001 -- struct serial_icounter_struct __user *p_cuser; /* user space */
1002 -- unsigned long flags;
1003 - void __user *argp = (void __user *)arg;
1004 - int ret;
1005 -
1006 -@@ -1068,7 +1065,7 @@ static int ioctl(struct tty_struct *tty, struct file *file,
1007 - DBGINFO(("%s ioctl() cmd=%08X\n", info->device_name, cmd));
1008 -
1009 - if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
1010 -- (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) {
1011 -+ (cmd != TIOCMIWAIT)) {
1012 - if (tty->flags & (1 << TTY_IO_ERROR))
1013 - return -EIO;
1014 - }
1015 -@@ -1121,25 +1118,6 @@ static int ioctl(struct tty_struct *tty, struct file *file,
1016 - case MGSL_IOCWAITGPIO:
1017 - ret = wait_gpio(info, argp);
1018 - break;
1019 -- case TIOCGICOUNT:
1020 -- spin_lock_irqsave(&info->lock,flags);
1021 -- cnow = info->icount;
1022 -- spin_unlock_irqrestore(&info->lock,flags);
1023 -- p_cuser = argp;
1024 -- if (put_user(cnow.cts, &p_cuser->cts) ||
1025 -- put_user(cnow.dsr, &p_cuser->dsr) ||
1026 -- put_user(cnow.rng, &p_cuser->rng) ||
1027 -- put_user(cnow.dcd, &p_cuser->dcd) ||
1028 -- put_user(cnow.rx, &p_cuser->rx) ||
1029 -- put_user(cnow.tx, &p_cuser->tx) ||
1030 -- put_user(cnow.frame, &p_cuser->frame) ||
1031 -- put_user(cnow.overrun, &p_cuser->overrun) ||
1032 -- put_user(cnow.parity, &p_cuser->parity) ||
1033 -- put_user(cnow.brk, &p_cuser->brk) ||
1034 -- put_user(cnow.buf_overrun, &p_cuser->buf_overrun))
1035 -- ret = -EFAULT;
1036 -- ret = 0;
1037 -- break;
1038 - default:
1039 - ret = -ENOIOCTLCMD;
1040 - }
1041 -@@ -1147,6 +1125,33 @@ static int ioctl(struct tty_struct *tty, struct file *file,
1042 - return ret;
1043 - }
1044 -
1045 -+static int get_icount(struct tty_struct *tty,
1046 -+ struct serial_icounter_struct *icount)
1047 -+
1048 -+{
1049 -+ struct slgt_info *info = tty->driver_data;
1050 -+ struct mgsl_icount cnow; /* kernel counter temps */
1051 -+ unsigned long flags;
1052 -+
1053 -+ spin_lock_irqsave(&info->lock,flags);
1054 -+ cnow = info->icount;
1055 -+ spin_unlock_irqrestore(&info->lock,flags);
1056 -+
1057 -+ icount->cts = cnow.cts;
1058 -+ icount->dsr = cnow.dsr;
1059 -+ icount->rng = cnow.rng;
1060 -+ icount->dcd = cnow.dcd;
1061 -+ icount->rx = cnow.rx;
1062 -+ icount->tx = cnow.tx;
1063 -+ icount->frame = cnow.frame;
1064 -+ icount->overrun = cnow.overrun;
1065 -+ icount->parity = cnow.parity;
1066 -+ icount->brk = cnow.brk;
1067 -+ icount->buf_overrun = cnow.buf_overrun;
1068 -+
1069 -+ return 0;
1070 -+}
1071 -+
1072 - /*
1073 - * support for 32 bit ioctl calls on 64 bit systems
1074 - */
1075 -@@ -1236,10 +1241,6 @@ static long slgt_compat_ioctl(struct tty_struct *tty, struct file *file,
1076 - case MGSL_IOCSGPIO:
1077 - case MGSL_IOCGGPIO:
1078 - case MGSL_IOCWAITGPIO:
1079 -- case TIOCGICOUNT:
1080 -- rc = ioctl(tty, file, cmd, (unsigned long)(compat_ptr(arg)));
1081 -- break;
1082 --
1083 - case MGSL_IOCSTXIDLE:
1084 - case MGSL_IOCTXENABLE:
1085 - case MGSL_IOCRXENABLE:
1086 -@@ -3639,6 +3640,7 @@ static const struct tty_operations ops = {
1087 - .hangup = hangup,
1088 - .tiocmget = tiocmget,
1089 - .tiocmset = tiocmset,
1090 -+ .get_icount = get_icount,
1091 - .proc_fops = &synclink_gt_proc_fops,
1092 - };
1093 -
1094 -diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c
1095 -index 2b18adc..951b65f 100644
1096 ---- a/drivers/char/synclinkmp.c
1097 -+++ b/drivers/char/synclinkmp.c
1098 -@@ -1255,10 +1255,6 @@ static int do_ioctl(struct tty_struct *tty, struct file *file,
1099 - unsigned int cmd, unsigned long arg)
1100 - {
1101 - SLMP_INFO *info = tty->driver_data;
1102 -- int error;
1103 -- struct mgsl_icount cnow; /* kernel counter temps */
1104 -- struct serial_icounter_struct __user *p_cuser; /* user space */
1105 -- unsigned long flags;
1106 - void __user *argp = (void __user *)arg;
1107 -
1108 - if (debug_level >= DEBUG_LEVEL_INFO)
1109 -@@ -1269,7 +1265,7 @@ static int do_ioctl(struct tty_struct *tty, struct file *file,
1110 - return -ENODEV;
1111 -
1112 - if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
1113 -- (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) {
1114 -+ (cmd != TIOCMIWAIT)) {
1115 - if (tty->flags & (1 << TTY_IO_ERROR))
1116 - return -EIO;
1117 - }
1118 -@@ -1307,40 +1303,38 @@ static int do_ioctl(struct tty_struct *tty, struct file *file,
1119 - * NB: both 1->0 and 0->1 transitions are counted except for
1120 - * RI where only 0->1 is counted.
1121 - */
1122 -- case TIOCGICOUNT:
1123 -- spin_lock_irqsave(&info->lock,flags);
1124 -- cnow = info->icount;
1125 -- spin_unlock_irqrestore(&info->lock,flags);
1126 -- p_cuser = argp;
1127 -- PUT_USER(error,cnow.cts, &p_cuser->cts);
1128 -- if (error) return error;
1129 -- PUT_USER(error,cnow.dsr, &p_cuser->dsr);
1130 -- if (error) return error;
1131 -- PUT_USER(error,cnow.rng, &p_cuser->rng);
1132 -- if (error) return error;
1133 -- PUT_USER(error,cnow.dcd, &p_cuser->dcd);
1134 -- if (error) return error;
1135 -- PUT_USER(error,cnow.rx, &p_cuser->rx);
1136 -- if (error) return error;
1137 -- PUT_USER(error,cnow.tx, &p_cuser->tx);
1138 -- if (error) return error;
1139 -- PUT_USER(error,cnow.frame, &p_cuser->frame);
1140 -- if (error) return error;
1141 -- PUT_USER(error,cnow.overrun, &p_cuser->overrun);
1142 -- if (error) return error;
1143 -- PUT_USER(error,cnow.parity, &p_cuser->parity);
1144 -- if (error) return error;
1145 -- PUT_USER(error,cnow.brk, &p_cuser->brk);
1146 -- if (error) return error;
1147 -- PUT_USER(error,cnow.buf_overrun, &p_cuser->buf_overrun);
1148 -- if (error) return error;
1149 -- return 0;
1150 - default:
1151 - return -ENOIOCTLCMD;
1152 - }
1153 - return 0;
1154 - }
1155 -
1156 -+static int get_icount(struct tty_struct *tty,
1157 -+ struct serial_icounter_struct *icount)
1158 -+{
1159 -+ SLMP_INFO *info = tty->driver_data;
1160 -+ struct mgsl_icount cnow; /* kernel counter temps */
1161 -+ unsigned long flags;
1162 -+
1163 -+ spin_lock_irqsave(&info->lock,flags);
1164 -+ cnow = info->icount;
1165 -+ spin_unlock_irqrestore(&info->lock,flags);
1166 -+
1167 -+ icount->cts = cnow.cts;
1168 -+ icount->dsr = cnow.dsr;
1169 -+ icount->rng = cnow.rng;
1170 -+ icount->dcd = cnow.dcd;
1171 -+ icount->rx = cnow.rx;
1172 -+ icount->tx = cnow.tx;
1173 -+ icount->frame = cnow.frame;
1174 -+ icount->overrun = cnow.overrun;
1175 -+ icount->parity = cnow.parity;
1176 -+ icount->brk = cnow.brk;
1177 -+ icount->buf_overrun = cnow.buf_overrun;
1178 -+
1179 -+ return 0;
1180 -+}
1181 -+
1182 - static int ioctl(struct tty_struct *tty, struct file *file,
1183 - unsigned int cmd, unsigned long arg)
1184 - {
1185 -@@ -3908,6 +3902,7 @@ static const struct tty_operations ops = {
1186 - .hangup = hangup,
1187 - .tiocmget = tiocmget,
1188 - .tiocmset = tiocmset,
1189 -+ .get_icount = get_icount,
1190 - .proc_fops = &synclinkmp_proc_fops,
1191 - };
1192 -
1193 -diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
1194 -index 53ffcfc..123cedf 100644
1195 ---- a/drivers/char/tty_io.c
1196 -+++ b/drivers/char/tty_io.c
1197 -@@ -96,6 +96,7 @@
1198 - #include <linux/bitops.h>
1199 - #include <linux/delay.h>
1200 - #include <linux/seq_file.h>
1201 -+#include <linux/serial.h>
1202 -
1203 - #include <linux/uaccess.h>
1204 - #include <asm/system.h>
1205 -@@ -2436,6 +2437,20 @@ static int tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int
1206 - return tty->ops->tiocmset(tty, file, set, clear);
1207 - }
1208 -
1209 -+static int tty_tiocgicount(struct tty_struct *tty, void __user *arg)
1210 -+{
1211 -+ int retval = -EINVAL;
1212 -+ struct serial_icounter_struct icount;
1213 -+ memset(&icount, 0, sizeof(icount));
1214 -+ if (tty->ops->get_icount)
1215 -+ retval = tty->ops->get_icount(tty, &icount);
1216 -+ if (retval != 0)
1217 -+ return retval;
1218 -+ if (copy_to_user(arg, &icount, sizeof(icount)))
1219 -+ return -EFAULT;
1220 -+ return 0;
1221 -+}
1222 -+
1223 - struct tty_struct *tty_pair_get_tty(struct tty_struct *tty)
1224 - {
1225 - if (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
1226 -@@ -2556,6 +2571,12 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1227 - case TIOCMBIC:
1228 - case TIOCMBIS:
1229 - return tty_tiocmset(tty, file, cmd, p);
1230 -+ case TIOCGICOUNT:
1231 -+ retval = tty_tiocgicount(tty, p);
1232 -+ /* For the moment allow fall through to the old method */
1233 -+ if (retval != -EINVAL)
1234 -+ return retval;
1235 -+ break;
1236 - case TCFLSH:
1237 - switch (arg) {
1238 - case TCIFLUSH:
1239 -diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
1240 -index 3ada62b..27a3074 100644
1241 ---- a/drivers/gpu/drm/i915/i915_gem.c
1242 -+++ b/drivers/gpu/drm/i915/i915_gem.c
1243 -@@ -482,14 +482,17 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data,
1244 - return -EBADF;
1245 - obj_priv = obj->driver_private;
1246 -
1247 -- /* Bounds check source.
1248 -- *
1249 -- * XXX: This could use review for overflow issues...
1250 -- */
1251 -- if (args->offset > obj->size || args->size > obj->size ||
1252 -- args->offset + args->size > obj->size) {
1253 -- drm_gem_object_unreference(obj);
1254 -- return -EINVAL;
1255 -+ /* Bounds check source. */
1256 -+ if (args->offset > obj->size || args->size > obj->size - args->offset) {
1257 -+ ret = -EINVAL;
1258 -+ goto err;
1259 -+ }
1260 -+
1261 -+ if (!access_ok(VERIFY_WRITE,
1262 -+ (char __user *)(uintptr_t)args->data_ptr,
1263 -+ args->size)) {
1264 -+ ret = -EFAULT;
1265 -+ goto err;
1266 - }
1267 -
1268 - if (i915_gem_object_needs_bit17_swizzle(obj)) {
1269 -@@ -501,8 +504,8 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data,
1270 - file_priv);
1271 - }
1272 -
1273 -+err:
1274 - drm_gem_object_unreference(obj);
1275 --
1276 - return ret;
1277 - }
1278 -
1279 -@@ -592,8 +595,6 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev, struct drm_gem_object *obj,
1280 -
1281 - user_data = (char __user *) (uintptr_t) args->data_ptr;
1282 - remain = args->size;
1283 -- if (!access_ok(VERIFY_READ, user_data, remain))
1284 -- return -EFAULT;
1285 -
1286 -
1287 - mutex_lock(&dev->struct_mutex);
1288 -@@ -955,14 +956,17 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
1289 - return -EBADF;
1290 - obj_priv = obj->driver_private;
1291 -
1292 -- /* Bounds check destination.
1293 -- *
1294 -- * XXX: This could use review for overflow issues...
1295 -- */
1296 -- if (args->offset > obj->size || args->size > obj->size ||
1297 -- args->offset + args->size > obj->size) {
1298 -- drm_gem_object_unreference(obj);
1299 -- return -EINVAL;
1300 -+ /* Bounds check destination. */
1301 -+ if (args->offset > obj->size || args->size > obj->size - args->offset) {
1302 -+ ret = -EINVAL;
1303 -+ goto err;
1304 -+ }
1305 -+
1306 -+ if (!access_ok(VERIFY_READ,
1307 -+ (char __user *)(uintptr_t)args->data_ptr,
1308 -+ args->size)) {
1309 -+ ret = -EFAULT;
1310 -+ goto err;
1311 - }
1312 -
1313 - /* We can only do the GTT pwrite on untiled buffers, as otherwise
1314 -@@ -995,8 +999,8 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
1315 - DRM_INFO("pwrite failed %d\n", ret);
1316 - #endif
1317 -
1318 -+err:
1319 - drm_gem_object_unreference(obj);
1320 --
1321 - return ret;
1322 - }
1323 -
1324 -diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
1325 -index cf59d64..883215d 100644
1326 ---- a/drivers/md/raid5.c
1327 -+++ b/drivers/md/raid5.c
1328 -@@ -3038,12 +3038,16 @@ static void handle_stripe5(struct stripe_head *sh)
1329 - /* check if the array has lost two devices and, if so, some requests might
1330 - * need to be failed
1331 - */
1332 -- if (s.failed > 1 && s.to_read+s.to_write+s.written)
1333 -- handle_failed_stripe(conf, sh, &s, disks, &return_bi);
1334 -- if (s.failed > 1 && s.syncing) {
1335 -- md_done_sync(conf->mddev, STRIPE_SECTORS,0);
1336 -- clear_bit(STRIPE_SYNCING, &sh->state);
1337 -- s.syncing = 0;
1338 -+ if (s.failed > 1) {
1339 -+ sh->check_state = 0;
1340 -+ sh->reconstruct_state = 0;
1341 -+ if (s.to_read+s.to_write+s.written)
1342 -+ handle_failed_stripe(conf, sh, &s, disks, &return_bi);
1343 -+ if (s.syncing) {
1344 -+ md_done_sync(conf->mddev, STRIPE_SECTORS,0);
1345 -+ clear_bit(STRIPE_SYNCING, &sh->state);
1346 -+ s.syncing = 0;
1347 -+ }
1348 - }
1349 -
1350 - /* might be able to return some write requests if the parity block
1351 -@@ -3314,12 +3318,16 @@ static void handle_stripe6(struct stripe_head *sh)
1352 - /* check if the array has lost >2 devices and, if so, some requests
1353 - * might need to be failed
1354 - */
1355 -- if (s.failed > 2 && s.to_read+s.to_write+s.written)
1356 -- handle_failed_stripe(conf, sh, &s, disks, &return_bi);
1357 -- if (s.failed > 2 && s.syncing) {
1358 -- md_done_sync(conf->mddev, STRIPE_SECTORS,0);
1359 -- clear_bit(STRIPE_SYNCING, &sh->state);
1360 -- s.syncing = 0;
1361 -+ if (s.failed > 2) {
1362 -+ sh->check_state = 0;
1363 -+ sh->reconstruct_state = 0;
1364 -+ if (s.to_read+s.to_write+s.written)
1365 -+ handle_failed_stripe(conf, sh, &s, disks, &return_bi);
1366 -+ if (s.syncing) {
1367 -+ md_done_sync(conf->mddev, STRIPE_SECTORS,0);
1368 -+ clear_bit(STRIPE_SYNCING, &sh->state);
1369 -+ s.syncing = 0;
1370 -+ }
1371 - }
1372 -
1373 - /*
1374 -diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
1375 -index 5b081cb..726a1b8 100644
1376 ---- a/drivers/mtd/mtdchar.c
1377 -+++ b/drivers/mtd/mtdchar.c
1378 -@@ -290,6 +290,7 @@ static ssize_t mtd_write(struct file *file, const char __user *buf, size_t count
1379 - ops.mode = MTD_OOB_RAW;
1380 - ops.datbuf = kbuf;
1381 - ops.oobbuf = NULL;
1382 -+ ops.ooboffs = 0;
1383 - ops.len = len;
1384 -
1385 - ret = mtd->write_oob(mtd, *ppos, &ops);
1386 -diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
1387 -index 554626e..d03a926 100644
1388 ---- a/drivers/scsi/hosts.c
1389 -+++ b/drivers/scsi/hosts.c
1390 -@@ -275,6 +275,7 @@ static void scsi_host_dev_release(struct device *dev)
1391 - {
1392 - struct Scsi_Host *shost = dev_to_shost(dev);
1393 - struct device *parent = dev->parent;
1394 -+ struct request_queue *q;
1395 -
1396 - scsi_proc_hostdir_rm(shost->hostt);
1397 -
1398 -@@ -282,9 +283,11 @@ static void scsi_host_dev_release(struct device *dev)
1399 - kthread_stop(shost->ehandler);
1400 - if (shost->work_q)
1401 - destroy_workqueue(shost->work_q);
1402 -- if (shost->uspace_req_q) {
1403 -- kfree(shost->uspace_req_q->queuedata);
1404 -- scsi_free_queue(shost->uspace_req_q);
1405 -+ q = shost->uspace_req_q;
1406 -+ if (q) {
1407 -+ kfree(q->queuedata);
1408 -+ q->queuedata = NULL;
1409 -+ scsi_free_queue(q);
1410 - }
1411 -
1412 - scsi_destroy_command_freelist(shost);
1413 -diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
1414 -index 1492e3e..1ae7b7c 100644
1415 ---- a/drivers/scsi/scsi_lib.c
1416 -+++ b/drivers/scsi/scsi_lib.c
1417 -@@ -1672,6 +1672,15 @@ struct request_queue *scsi_alloc_queue(struct scsi_device *sdev)
1418 -
1419 - void scsi_free_queue(struct request_queue *q)
1420 - {
1421 -+ unsigned long flags;
1422 -+
1423 -+ WARN_ON(q->queuedata);
1424 -+
1425 -+ /* cause scsi_request_fn() to kill all non-finished requests */
1426 -+ spin_lock_irqsave(q->queue_lock, flags);
1427 -+ q->request_fn(q);
1428 -+ spin_unlock_irqrestore(q->queue_lock, flags);
1429 -+
1430 - blk_cleanup_queue(q);
1431 - }
1432 -
1433 -diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
1434 -index 5081f97..723da1d 100644
1435 ---- a/drivers/scsi/st.c
1436 -+++ b/drivers/scsi/st.c
1437 -@@ -461,14 +461,16 @@ static void st_scsi_execute_end(struct request *req, int uptodate)
1438 - {
1439 - struct st_request *SRpnt = req->end_io_data;
1440 - struct scsi_tape *STp = SRpnt->stp;
1441 -+ struct bio *tmp;
1442 -
1443 - STp->buffer->cmdstat.midlevel_result = SRpnt->result = req->errors;
1444 - STp->buffer->cmdstat.residual = req->resid_len;
1445 -
1446 -+ tmp = SRpnt->bio;
1447 - if (SRpnt->waiting)
1448 - complete(SRpnt->waiting);
1449 -
1450 -- blk_rq_unmap_user(SRpnt->bio);
1451 -+ blk_rq_unmap_user(tmp);
1452 - __blk_put_request(req->q, req);
1453 - }
1454 -
1455 -diff --git a/drivers/serial/68360serial.c b/drivers/serial/68360serial.c
1456 -index 24661cd..1e4f831 100644
1457 ---- a/drivers/serial/68360serial.c
1458 -+++ b/drivers/serial/68360serial.c
1459 -@@ -1381,6 +1381,30 @@ static void send_break(ser_info_t *info, unsigned int duration)
1460 - }
1461 -
1462 -
1463 -+/*
1464 -+ * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
1465 -+ * Return: write counters to the user passed counter struct
1466 -+ * NB: both 1->0 and 0->1 transitions are counted except for
1467 -+ * RI where only 0->1 is counted.
1468 -+ */
1469 -+static int rs_360_get_icount(struct tty_struct *tty,
1470 -+ struct serial_icounter_struct *icount)
1471 -+{
1472 -+ ser_info_t *info = (ser_info_t *)tty->driver_data;
1473 -+ struct async_icount cnow;
1474 -+
1475 -+ local_irq_disable();
1476 -+ cnow = info->state->icount;
1477 -+ local_irq_enable();
1478 -+
1479 -+ icount->cts = cnow.cts;
1480 -+ icount->dsr = cnow.dsr;
1481 -+ icount->rng = cnow.rng;
1482 -+ icount->dcd = cnow.dcd;
1483 -+
1484 -+ return 0;
1485 -+}
1486 -+
1487 - static int rs_360_ioctl(struct tty_struct *tty, struct file * file,
1488 - unsigned int cmd, unsigned long arg)
1489 - {
1490 -@@ -1394,7 +1418,7 @@ static int rs_360_ioctl(struct tty_struct *tty, struct file * file,
1491 - if (serial_paranoia_check(info, tty->name, "rs_ioctl"))
1492 - return -ENODEV;
1493 -
1494 -- if ((cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) {
1495 -+ if (cmd != TIOCMIWAIT) {
1496 - if (tty->flags & (1 << TTY_IO_ERROR))
1497 - return -EIO;
1498 - }
1499 -@@ -1477,31 +1501,6 @@ static int rs_360_ioctl(struct tty_struct *tty, struct file * file,
1500 - return 0;
1501 - #endif
1502 -
1503 -- /*
1504 -- * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
1505 -- * Return: write counters to the user passed counter struct
1506 -- * NB: both 1->0 and 0->1 transitions are counted except for
1507 -- * RI where only 0->1 is counted.
1508 -- */
1509 -- case TIOCGICOUNT:
1510 -- local_irq_disable();
1511 -- cnow = info->state->icount;
1512 -- local_irq_enable();
1513 -- p_cuser = (struct serial_icounter_struct *) arg;
1514 --/* error = put_user(cnow.cts, &p_cuser->cts); */
1515 --/* if (error) return error; */
1516 --/* error = put_user(cnow.dsr, &p_cuser->dsr); */
1517 --/* if (error) return error; */
1518 --/* error = put_user(cnow.rng, &p_cuser->rng); */
1519 --/* if (error) return error; */
1520 --/* error = put_user(cnow.dcd, &p_cuser->dcd); */
1521 --/* if (error) return error; */
1522 --
1523 -- put_user(cnow.cts, &p_cuser->cts);
1524 -- put_user(cnow.dsr, &p_cuser->dsr);
1525 -- put_user(cnow.rng, &p_cuser->rng);
1526 -- put_user(cnow.dcd, &p_cuser->dcd);
1527 -- return 0;
1528 -
1529 - default:
1530 - return -ENOIOCTLCMD;
1531 -diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
1532 -index dcc7244..772d9d8 100644
1533 ---- a/drivers/serial/serial_core.c
1534 -+++ b/drivers/serial/serial_core.c
1535 -@@ -1067,10 +1067,10 @@ uart_wait_modem_status(struct uart_state *state, unsigned long arg)
1536 - * NB: both 1->0 and 0->1 transitions are counted except for
1537 - * RI where only 0->1 is counted.
1538 - */
1539 --static int uart_get_count(struct uart_state *state,
1540 -- struct serial_icounter_struct __user *icnt)
1541 -+static int uart_get_icount(struct tty_struct *tty,
1542 -+ struct serial_icounter_struct *icount)
1543 - {
1544 -- struct serial_icounter_struct icount;
1545 -+ struct uart_state *state = tty->driver_data;
1546 - struct uart_icount cnow;
1547 - struct uart_port *uport = state->uart_port;
1548 -
1549 -@@ -1078,19 +1078,19 @@ static int uart_get_count(struct uart_state *state,
1550 - memcpy(&cnow, &uport->icount, sizeof(struct uart_icount));
1551 - spin_unlock_irq(&uport->lock);
1552 -
1553 -- icount.cts = cnow.cts;
1554 -- icount.dsr = cnow.dsr;
1555 -- icount.rng = cnow.rng;
1556 -- icount.dcd = cnow.dcd;
1557 -- icount.rx = cnow.rx;
1558 -- icount.tx = cnow.tx;
1559 -- icount.frame = cnow.frame;
1560 -- icount.overrun = cnow.overrun;
1561 -- icount.parity = cnow.parity;
1562 -- icount.brk = cnow.brk;
1563 -- icount.buf_overrun = cnow.buf_overrun;
1564 -+ icount->cts = cnow.cts;
1565 -+ icount->dsr = cnow.dsr;
1566 -+ icount->rng = cnow.rng;
1567 -+ icount->dcd = cnow.dcd;
1568 -+ icount->rx = cnow.rx;
1569 -+ icount->tx = cnow.tx;
1570 -+ icount->frame = cnow.frame;
1571 -+ icount->overrun = cnow.overrun;
1572 -+ icount->parity = cnow.parity;
1573 -+ icount->brk = cnow.brk;
1574 -+ icount->buf_overrun = cnow.buf_overrun;
1575 -
1576 -- return copy_to_user(icnt, &icount, sizeof(icount)) ? -EFAULT : 0;
1577 -+ return 0;
1578 - }
1579 -
1580 - /*
1581 -@@ -1143,10 +1143,6 @@ uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd,
1582 - case TIOCMIWAIT:
1583 - ret = uart_wait_modem_status(state, arg);
1584 - break;
1585 --
1586 -- case TIOCGICOUNT:
1587 -- ret = uart_get_count(state, uarg);
1588 -- break;
1589 - }
1590 -
1591 - if (ret != -ENOIOCTLCMD)
1592 -@@ -2322,6 +2318,7 @@ static const struct tty_operations uart_ops = {
1593 - #endif
1594 - .tiocmget = uart_tiocmget,
1595 - .tiocmset = uart_tiocmset,
1596 -+ .get_icount = uart_get_icount,
1597 - #ifdef CONFIG_CONSOLE_POLL
1598 - .poll_init = uart_poll_init,
1599 - .poll_get_char = uart_poll_get_char,
1600 -diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
1601 -index 93448eb..e163df9 100644
1602 ---- a/drivers/usb/core/quirks.c
1603 -+++ b/drivers/usb/core/quirks.c
1604 -@@ -47,15 +47,42 @@ static const struct usb_device_id usb_quirk_list[] = {
1605 - /* Logitech Webcam B/C500 */
1606 - { USB_DEVICE(0x046d, 0x0807), .driver_info = USB_QUIRK_RESET_RESUME },
1607 -
1608 -+ /* Logitech Webcam C600 */
1609 -+ { USB_DEVICE(0x046d, 0x0808), .driver_info = USB_QUIRK_RESET_RESUME },
1610 -+
1611 - /* Logitech Webcam Pro 9000 */
1612 - { USB_DEVICE(0x046d, 0x0809), .driver_info = USB_QUIRK_RESET_RESUME },
1613 -
1614 -+ /* Logitech Webcam C905 */
1615 -+ { USB_DEVICE(0x046d, 0x080a), .driver_info = USB_QUIRK_RESET_RESUME },
1616 -+
1617 -+ /* Logitech Webcam C210 */
1618 -+ { USB_DEVICE(0x046d, 0x0819), .driver_info = USB_QUIRK_RESET_RESUME },
1619 -+
1620 -+ /* Logitech Webcam C260 */
1621 -+ { USB_DEVICE(0x046d, 0x081a), .driver_info = USB_QUIRK_RESET_RESUME },
1622 -+
1623 - /* Logitech Webcam C310 */
1624 - { USB_DEVICE(0x046d, 0x081b), .driver_info = USB_QUIRK_RESET_RESUME },
1625 -
1626 -+ /* Logitech Webcam C910 */
1627 -+ { USB_DEVICE(0x046d, 0x0821), .driver_info = USB_QUIRK_RESET_RESUME },
1628 -+
1629 -+ /* Logitech Webcam C160 */
1630 -+ { USB_DEVICE(0x046d, 0x0824), .driver_info = USB_QUIRK_RESET_RESUME },
1631 -+
1632 - /* Logitech Webcam C270 */
1633 - { USB_DEVICE(0x046d, 0x0825), .driver_info = USB_QUIRK_RESET_RESUME },
1634 -
1635 -+ /* Logitech Quickcam Pro 9000 */
1636 -+ { USB_DEVICE(0x046d, 0x0990), .driver_info = USB_QUIRK_RESET_RESUME },
1637 -+
1638 -+ /* Logitech Quickcam E3500 */
1639 -+ { USB_DEVICE(0x046d, 0x09a4), .driver_info = USB_QUIRK_RESET_RESUME },
1640 -+
1641 -+ /* Logitech Quickcam Vision Pro */
1642 -+ { USB_DEVICE(0x046d, 0x09a6), .driver_info = USB_QUIRK_RESET_RESUME },
1643 -+
1644 - /* Logitech Harmony 700-series */
1645 - { USB_DEVICE(0x046d, 0xc122), .driver_info = USB_QUIRK_DELAY_INIT },
1646 -
1647 -diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
1648 -index 7a4b41c..5689b90 100644
1649 ---- a/drivers/usb/serial/ftdi_sio.c
1650 -+++ b/drivers/usb/serial/ftdi_sio.c
1651 -@@ -2355,13 +2355,19 @@ static void ftdi_set_termios(struct tty_struct *tty,
1652 -
1653 - cflag = termios->c_cflag;
1654 -
1655 -- /* FIXME -For this cut I don't care if the line is really changing or
1656 -- not - so just do the change regardless - should be able to
1657 -- compare old_termios and tty->termios */
1658 -+ if (old_termios->c_cflag == termios->c_cflag
1659 -+ && old_termios->c_ispeed == termios->c_ispeed
1660 -+ && old_termios->c_ospeed == termios->c_ospeed)
1661 -+ goto no_c_cflag_changes;
1662 -+
1663 - /* NOTE These routines can get interrupted by
1664 - ftdi_sio_read_bulk_callback - need to examine what this means -
1665 - don't see any problems yet */
1666 -
1667 -+ if ((old_termios->c_cflag & (CSIZE|PARODD|PARENB|CMSPAR|CSTOPB)) ==
1668 -+ (termios->c_cflag & (CSIZE|PARODD|PARENB|CMSPAR|CSTOPB)))
1669 -+ goto no_data_parity_stop_changes;
1670 -+
1671 - /* Set number of data bits, parity, stop bits */
1672 -
1673 - termios->c_cflag &= ~CMSPAR;
1674 -@@ -2398,6 +2404,7 @@ static void ftdi_set_termios(struct tty_struct *tty,
1675 - }
1676 -
1677 - /* Now do the baudrate */
1678 -+no_data_parity_stop_changes:
1679 - if ((cflag & CBAUD) == B0) {
1680 - /* Disable flow control */
1681 - if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
1682 -@@ -2423,6 +2430,7 @@ static void ftdi_set_termios(struct tty_struct *tty,
1683 -
1684 - /* Set flow control */
1685 - /* Note device also supports DTR/CD (ugh) and Xon/Xoff in hardware */
1686 -+no_c_cflag_changes:
1687 - if (cflag & CRTSCTS) {
1688 - dbg("%s Setting to CRTSCTS flow control", __func__);
1689 - if (usb_control_msg(dev,
1690 -diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
1691 -index 150cad4..9f89940 100644
1692 ---- a/drivers/usb/serial/pl2303.c
1693 -+++ b/drivers/usb/serial/pl2303.c
1694 -@@ -101,7 +101,6 @@ static struct usb_device_id id_table [] = {
1695 - { USB_DEVICE(SONY_VENDOR_ID, SONY_QN3USB_PRODUCT_ID) },
1696 - { USB_DEVICE(SANWA_VENDOR_ID, SANWA_PRODUCT_ID) },
1697 - { USB_DEVICE(ADLINK_VENDOR_ID, ADLINK_ND6530_PRODUCT_ID) },
1698 -- { USB_DEVICE(WINCHIPHEAD_VENDOR_ID, WINCHIPHEAD_USBSER_PRODUCT_ID) },
1699 - { USB_DEVICE(SMART_VENDOR_ID, SMART_PRODUCT_ID) },
1700 - { } /* Terminating entry */
1701 - };
1702 -diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h
1703 -index 3d10d7f..c38b8c0 100644
1704 ---- a/drivers/usb/serial/pl2303.h
1705 -+++ b/drivers/usb/serial/pl2303.h
1706 -@@ -145,10 +145,6 @@
1707 - #define ADLINK_VENDOR_ID 0x0b63
1708 - #define ADLINK_ND6530_PRODUCT_ID 0x6530
1709 -
1710 --/* WinChipHead USB->RS 232 adapter */
1711 --#define WINCHIPHEAD_VENDOR_ID 0x4348
1712 --#define WINCHIPHEAD_USBSER_PRODUCT_ID 0x5523
1713 --
1714 - /* SMART USB Serial Adapter */
1715 - #define SMART_VENDOR_ID 0x0b8c
1716 - #define SMART_PRODUCT_ID 0x2303
1717 -diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
1718 -index bd3fa7f..f23f3b4 100644
1719 ---- a/drivers/usb/serial/usb-serial.c
1720 -+++ b/drivers/usb/serial/usb-serial.c
1721 -@@ -562,6 +562,18 @@ static int serial_tiocmset(struct tty_struct *tty, struct file *file,
1722 - return -EINVAL;
1723 - }
1724 -
1725 -+static int serial_get_icount(struct tty_struct *tty,
1726 -+ struct serial_icounter_struct *icount)
1727 -+{
1728 -+ struct usb_serial_port *port = tty->driver_data;
1729 -+
1730 -+ dbg("%s - port %d", __func__, port->number);
1731 -+
1732 -+ if (port->serial->type->get_icount)
1733 -+ return port->serial->type->get_icount(tty, icount);
1734 -+ return -EINVAL;
1735 -+}
1736 -+
1737 - /*
1738 - * We would be calling tty_wakeup here, but unfortunately some line
1739 - * disciplines have an annoying habit of calling tty->write from
1740 -@@ -1214,6 +1226,7 @@ static const struct tty_operations serial_ops = {
1741 - .chars_in_buffer = serial_chars_in_buffer,
1742 - .tiocmget = serial_tiocmget,
1743 - .tiocmset = serial_tiocmset,
1744 -+ .get_icount = serial_get_icount,
1745 - .cleanup = serial_cleanup,
1746 - .install = serial_install,
1747 - .proc_fops = &serial_proc_fops,
1748 -diff --git a/drivers/usb/storage/protocol.c b/drivers/usb/storage/protocol.c
1749 -index fc310f7..0fded39 100644
1750 ---- a/drivers/usb/storage/protocol.c
1751 -+++ b/drivers/usb/storage/protocol.c
1752 -@@ -58,7 +58,9 @@
1753 -
1754 - void usb_stor_pad12_command(struct scsi_cmnd *srb, struct us_data *us)
1755 - {
1756 -- /* Pad the SCSI command with zeros out to 12 bytes
1757 -+ /*
1758 -+ * Pad the SCSI command with zeros out to 12 bytes. If the
1759 -+ * command already is 12 bytes or longer, leave it alone.
1760 - *
1761 - * NOTE: This only works because a scsi_cmnd struct field contains
1762 - * a unsigned char cmnd[16], so we know we have storage available
1763 -@@ -66,9 +68,6 @@ void usb_stor_pad12_command(struct scsi_cmnd *srb, struct us_data *us)
1764 - for (; srb->cmd_len<12; srb->cmd_len++)
1765 - srb->cmnd[srb->cmd_len] = 0;
1766 -
1767 -- /* set command length to 12 bytes */
1768 -- srb->cmd_len = 12;
1769 --
1770 - /* send the command to the transport layer */
1771 - usb_stor_invoke_transport(srb, us);
1772 - }
1773 -diff --git a/drivers/xen/events.c b/drivers/xen/events.c
1774 -index 009ca4e..15ed43e 100644
1775 ---- a/drivers/xen/events.c
1776 -+++ b/drivers/xen/events.c
1777 -@@ -536,7 +536,7 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi,
1778 - if (irq < 0)
1779 - return irq;
1780 -
1781 -- irqflags |= IRQF_NO_SUSPEND | IRQF_FORCE_RESUME;
1782 -+ irqflags |= IRQF_NO_SUSPEND | IRQF_FORCE_RESUME | IRQF_EARLY_RESUME;
1783 - retval = request_irq(irq, handler, irqflags, devname, dev_id);
1784 - if (retval != 0) {
1785 - unbind_from_irq(irq);
1786 -diff --git a/fs/hfs/trans.c b/fs/hfs/trans.c
1787 -index e673a88..b1ce4c7 100644
1788 ---- a/fs/hfs/trans.c
1789 -+++ b/fs/hfs/trans.c
1790 -@@ -40,6 +40,8 @@ int hfs_mac2asc(struct super_block *sb, char *out, const struct hfs_name *in)
1791 -
1792 - src = in->name;
1793 - srclen = in->len;
1794 -+ if (srclen > HFS_NAMELEN)
1795 -+ srclen = HFS_NAMELEN;
1796 - dst = out;
1797 - dstlen = HFS_MAX_NAMELEN;
1798 - if (nls_io) {
1799 -diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
1800 -index 4528f29..c739150 100644
1801 ---- a/include/linux/interrupt.h
1802 -+++ b/include/linux/interrupt.h
1803 -@@ -54,6 +54,8 @@
1804 - * irq line disabled until the threaded handler has been run.
1805 - * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend
1806 - * IRQF_FORCE_RESUME - Force enable it on resume even if IRQF_NO_SUSPEND is set
1807 -+ * IRQF_EARLY_RESUME - Resume IRQ early during syscore instead of at device
1808 -+ * resume time.
1809 - */
1810 - #define IRQF_DISABLED 0x00000020
1811 - #define IRQF_SAMPLE_RANDOM 0x00000040
1812 -@@ -66,6 +68,7 @@
1813 - #define IRQF_ONESHOT 0x00002000
1814 - #define IRQF_NO_SUSPEND 0x00004000
1815 - #define IRQF_FORCE_RESUME 0x00008000
1816 -+#define IRQF_EARLY_RESUME 0x00020000
1817 -
1818 - #define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND)
1819 -
1820 -@@ -198,13 +201,16 @@ extern void suspend_device_irqs(void);
1821 - extern void resume_device_irqs(void);
1822 - #ifdef CONFIG_PM_SLEEP
1823 - extern int check_wakeup_irqs(void);
1824 -+extern void irq_pm_syscore_resume(void);
1825 - #else
1826 - static inline int check_wakeup_irqs(void) { return 0; }
1827 -+static inline void irq_pm_syscore_resume(void) { };
1828 - #endif
1829 - #else
1830 - static inline void suspend_device_irqs(void) { };
1831 - static inline void resume_device_irqs(void) { };
1832 - static inline int check_wakeup_irqs(void) { return 0; }
1833 -+static inline void irq_pm_syscore_resume(void) { };
1834 - #endif
1835 -
1836 - #if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS)
1837 -diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
1838 -index b086779..db2d227 100644
1839 ---- a/include/linux/tty_driver.h
1840 -+++ b/include/linux/tty_driver.h
1841 -@@ -224,6 +224,12 @@
1842 - * unless the tty also has a valid tty->termiox pointer.
1843 - *
1844 - * Optional: Called under the termios lock
1845 -+ *
1846 -+ * int (*get_icount)(struct tty_struct *tty, struct serial_icounter *icount);
1847 -+ *
1848 -+ * Called when the device receives a TIOCGICOUNT ioctl. Passed a kernel
1849 -+ * structure to complete. This method is optional and will only be called
1850 -+ * if provided (otherwise EINVAL will be returned).
1851 - */
1852 -
1853 - #include <linux/fs.h>
1854 -@@ -232,6 +238,7 @@
1855 -
1856 - struct tty_struct;
1857 - struct tty_driver;
1858 -+struct serial_icounter_struct;
1859 -
1860 - struct tty_operations {
1861 - struct tty_struct * (*lookup)(struct tty_driver *driver,
1862 -@@ -268,6 +275,8 @@ struct tty_operations {
1863 - unsigned int set, unsigned int clear);
1864 - int (*resize)(struct tty_struct *tty, struct winsize *ws);
1865 - int (*set_termiox)(struct tty_struct *tty, struct termiox *tnew);
1866 -+ int (*get_icount)(struct tty_struct *tty,
1867 -+ struct serial_icounter_struct *icount);
1868 - #ifdef CONFIG_CONSOLE_POLL
1869 - int (*poll_init)(struct tty_driver *driver, int line, char *options);
1870 - int (*poll_get_char)(struct tty_driver *driver, int line);
1871 -diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
1872 -index bb911e3..78670cb 100644
1873 ---- a/include/linux/usb/serial.h
1874 -+++ b/include/linux/usb/serial.h
1875 -@@ -259,6 +259,8 @@ struct usb_serial_driver {
1876 - int (*tiocmget)(struct tty_struct *tty, struct file *file);
1877 - int (*tiocmset)(struct tty_struct *tty, struct file *file,
1878 - unsigned int set, unsigned int clear);
1879 -+ int (*get_icount)(struct tty_struct *tty,
1880 -+ struct serial_icounter_struct *icount);
1881 - /* Called by the tty layer for port level work. There may or may not
1882 - be an attached tty at this point */
1883 - void (*dtr_rts)(struct usb_serial_port *port, int on);
1884 -diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
1885 -index 3c123c3..819a634 100644
1886 ---- a/include/linux/vmalloc.h
1887 -+++ b/include/linux/vmalloc.h
1888 -@@ -13,6 +13,7 @@ struct vm_area_struct; /* vma defining user mapping in mm_types.h */
1889 - #define VM_MAP 0x00000004 /* vmap()ed pages */
1890 - #define VM_USERMAP 0x00000008 /* suitable for remap_vmalloc_range */
1891 - #define VM_VPAGES 0x00000010 /* buffer for pages was vmalloc'ed */
1892 -+#define VM_UNLIST 0x00000020 /* vm_struct is not listed in vmlist */
1893 - /* bits [20..32] reserved for arch specific ioremap internals */
1894 -
1895 - /*
1896 -diff --git a/kernel/irq/pm.c b/kernel/irq/pm.c
1897 -index 0067abb..b1fc3dd 100644
1898 ---- a/kernel/irq/pm.c
1899 -+++ b/kernel/irq/pm.c
1900 -@@ -39,25 +39,46 @@ void suspend_device_irqs(void)
1901 - }
1902 - EXPORT_SYMBOL_GPL(suspend_device_irqs);
1903 -
1904 --/**
1905 -- * resume_device_irqs - enable interrupt lines disabled by suspend_device_irqs()
1906 -- *
1907 -- * Enable all interrupt lines previously disabled by suspend_device_irqs() that
1908 -- * have the IRQ_SUSPENDED flag set.
1909 -- */
1910 --void resume_device_irqs(void)
1911 -+static void resume_irqs(bool want_early)
1912 - {
1913 - struct irq_desc *desc;
1914 - int irq;
1915 -
1916 - for_each_irq_desc(irq, desc) {
1917 - unsigned long flags;
1918 -+ bool is_early = desc->action &&
1919 -+ desc->action->flags & IRQF_EARLY_RESUME;
1920 -+
1921 -+ if (is_early != want_early)
1922 -+ continue;
1923 -
1924 - spin_lock_irqsave(&desc->lock, flags);
1925 - __enable_irq(desc, irq, true);
1926 - spin_unlock_irqrestore(&desc->lock, flags);
1927 - }
1928 - }
1929 -+
1930 -+/**
1931 -+ * irq_pm_syscore_ops - enable interrupt lines early
1932 -+ *
1933 -+ * Enable all interrupt lines with %IRQF_EARLY_RESUME set.
1934 -+ */
1935 -+void irq_pm_syscore_resume(void)
1936 -+{
1937 -+ resume_irqs(true);
1938 -+}
1939 -+
1940 -+/**
1941 -+ * resume_device_irqs - enable interrupt lines disabled by suspend_device_irqs()
1942 -+ *
1943 -+ * Enable all non-%IRQF_EARLY_RESUME interrupt lines previously
1944 -+ * disabled by suspend_device_irqs() that have the IRQS_SUSPENDED flag
1945 -+ * set as well as those with %IRQF_FORCE_RESUME.
1946 -+ */
1947 -+void resume_device_irqs(void)
1948 -+{
1949 -+ resume_irqs(false);
1950 -+}
1951 - EXPORT_SYMBOL_GPL(resume_device_irqs);
1952 -
1953 - /**
1954 -diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
1955 -index 6f10dfc..40dd021 100644
1956 ---- a/kernel/power/suspend.c
1957 -+++ b/kernel/power/suspend.c
1958 -@@ -293,7 +293,7 @@ int enter_state(suspend_state_t state)
1959 - */
1960 - int pm_suspend(suspend_state_t state)
1961 - {
1962 -- if (state > PM_SUSPEND_ON && state <= PM_SUSPEND_MAX)
1963 -+ if (state > PM_SUSPEND_ON && state < PM_SUSPEND_MAX)
1964 - return enter_state(state);
1965 - return -EINVAL;
1966 - }
1967 -diff --git a/lib/nlattr.c b/lib/nlattr.c
1968 -index c4706eb..109d4fe 100644
1969 ---- a/lib/nlattr.c
1970 -+++ b/lib/nlattr.c
1971 -@@ -20,6 +20,7 @@ static u16 nla_attr_minlen[NLA_TYPE_MAX+1] __read_mostly = {
1972 - [NLA_U16] = sizeof(u16),
1973 - [NLA_U32] = sizeof(u32),
1974 - [NLA_U64] = sizeof(u64),
1975 -+ [NLA_MSECS] = sizeof(u64),
1976 - [NLA_NESTED] = NLA_HDRLEN,
1977 - };
1978 -
1979 -diff --git a/mm/vmalloc.c b/mm/vmalloc.c
1980 -index 7221e9e..f34ffd0 100644
1981 ---- a/mm/vmalloc.c
1982 -+++ b/mm/vmalloc.c
1983 -@@ -1203,17 +1203,22 @@ EXPORT_SYMBOL_GPL(map_vm_area);
1984 - DEFINE_RWLOCK(vmlist_lock);
1985 - struct vm_struct *vmlist;
1986 -
1987 --static void insert_vmalloc_vm(struct vm_struct *vm, struct vmap_area *va,
1988 -+static void setup_vmalloc_vm(struct vm_struct *vm, struct vmap_area *va,
1989 - unsigned long flags, void *caller)
1990 - {
1991 -- struct vm_struct *tmp, **p;
1992 --
1993 - vm->flags = flags;
1994 - vm->addr = (void *)va->va_start;
1995 - vm->size = va->va_end - va->va_start;
1996 - vm->caller = caller;
1997 - va->private = vm;
1998 - va->flags |= VM_VM_AREA;
1999 -+}
2000 -+
2001 -+static void insert_vmalloc_vmlist(struct vm_struct *vm)
2002 -+{
2003 -+ struct vm_struct *tmp, **p;
2004 -+
2005 -+ vm->flags &= ~VM_UNLIST;
2006 -
2007 - write_lock(&vmlist_lock);
2008 - for (p = &vmlist; (tmp = *p) != NULL; p = &tmp->next) {
2009 -@@ -1225,6 +1230,13 @@ static void insert_vmalloc_vm(struct vm_struct *vm, struct vmap_area *va,
2010 - write_unlock(&vmlist_lock);
2011 - }
2012 -
2013 -+static void insert_vmalloc_vm(struct vm_struct *vm, struct vmap_area *va,
2014 -+ unsigned long flags, void *caller)
2015 -+{
2016 -+ setup_vmalloc_vm(vm, va, flags, caller);
2017 -+ insert_vmalloc_vmlist(vm);
2018 -+}
2019 -+
2020 - static struct vm_struct *__get_vm_area_node(unsigned long size,
2021 - unsigned long align, unsigned long flags, unsigned long start,
2022 - unsigned long end, int node, gfp_t gfp_mask, void *caller)
2023 -@@ -1263,7 +1275,18 @@ static struct vm_struct *__get_vm_area_node(unsigned long size,
2024 - return NULL;
2025 - }
2026 -
2027 -- insert_vmalloc_vm(area, va, flags, caller);
2028 -+ /*
2029 -+ * When this function is called from __vmalloc_node,
2030 -+ * we do not add vm_struct to vmlist here to avoid
2031 -+ * accessing uninitialized members of vm_struct such as
2032 -+ * pages and nr_pages fields. They will be set later.
2033 -+ * To distinguish it from others, we use a VM_UNLIST flag.
2034 -+ */
2035 -+ if (flags & VM_UNLIST)
2036 -+ setup_vmalloc_vm(area, va, flags, caller);
2037 -+ else
2038 -+ insert_vmalloc_vm(area, va, flags, caller);
2039 -+
2040 - return area;
2041 - }
2042 -
2043 -@@ -1338,17 +1361,20 @@ struct vm_struct *remove_vm_area(const void *addr)
2044 - va = find_vmap_area((unsigned long)addr);
2045 - if (va && va->flags & VM_VM_AREA) {
2046 - struct vm_struct *vm = va->private;
2047 -- struct vm_struct *tmp, **p;
2048 -- /*
2049 -- * remove from list and disallow access to this vm_struct
2050 -- * before unmap. (address range confliction is maintained by
2051 -- * vmap.)
2052 -- */
2053 -- write_lock(&vmlist_lock);
2054 -- for (p = &vmlist; (tmp = *p) != vm; p = &tmp->next)
2055 -- ;
2056 -- *p = tmp->next;
2057 -- write_unlock(&vmlist_lock);
2058 -+
2059 -+ if (!(vm->flags & VM_UNLIST)) {
2060 -+ struct vm_struct *tmp, **p;
2061 -+ /*
2062 -+ * remove from list and disallow access to
2063 -+ * this vm_struct before unmap. (address range
2064 -+ * confliction is maintained by vmap.)
2065 -+ */
2066 -+ write_lock(&vmlist_lock);
2067 -+ for (p = &vmlist; (tmp = *p) != vm; p = &tmp->next)
2068 -+ ;
2069 -+ *p = tmp->next;
2070 -+ write_unlock(&vmlist_lock);
2071 -+ }
2072 -
2073 - vmap_debug_free_range(va->va_start, va->va_end);
2074 - free_unmap_vmap_area(va);
2075 -@@ -1568,8 +1594,9 @@ static void *__vmalloc_node(unsigned long size, unsigned long align,
2076 - if (!size || (size >> PAGE_SHIFT) > totalram_pages)
2077 - return NULL;
2078 -
2079 -- area = __get_vm_area_node(size, align, VM_ALLOC, VMALLOC_START,
2080 -- VMALLOC_END, node, gfp_mask, caller);
2081 -+ area = __get_vm_area_node(size, align, VM_ALLOC | VM_UNLIST,
2082 -+ VMALLOC_START, VMALLOC_END, node,
2083 -+ gfp_mask, caller);
2084 -
2085 - if (!area)
2086 - return NULL;
2087 -@@ -1577,6 +1604,12 @@ static void *__vmalloc_node(unsigned long size, unsigned long align,
2088 - addr = __vmalloc_area_node(area, gfp_mask, prot, node, caller);
2089 -
2090 - /*
2091 -+ * In this function, newly allocated vm_struct is not added
2092 -+ * to vmlist at __get_vm_area_node(). so, it is added here.
2093 -+ */
2094 -+ insert_vmalloc_vmlist(area);
2095 -+
2096 -+ /*
2097 - * A ref_count = 3 is needed because the vm_struct and vmap_area
2098 - * structures allocated in the __get_vm_area_node() function contain
2099 - * references to the virtual address of the vmalloc'ed block.
2100 -diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
2101 -index cab71ea..5f6a305 100644
2102 ---- a/net/bluetooth/rfcomm/tty.c
2103 -+++ b/net/bluetooth/rfcomm/tty.c
2104 -@@ -844,10 +844,6 @@ static int rfcomm_tty_ioctl(struct tty_struct *tty, struct file *filp, unsigned
2105 - BT_DBG("TIOCMIWAIT");
2106 - break;
2107 -
2108 -- case TIOCGICOUNT:
2109 -- BT_DBG("TIOCGICOUNT");
2110 -- break;
2111 --
2112 - case TIOCGSERIAL:
2113 - BT_ERR("TIOCGSERIAL is not supported");
2114 - return -ENOIOCTLCMD;
2115 -diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
2116 -index ca520d4..9cc6289 100644
2117 ---- a/net/ipv6/udp.c
2118 -+++ b/net/ipv6/udp.c
2119 -@@ -1141,7 +1141,7 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, int features)
2120 - skb->ip_summed = CHECKSUM_NONE;
2121 -
2122 - /* Check if there is enough headroom to insert fragment header. */
2123 -- if ((skb_headroom(skb) < frag_hdr_sz) &&
2124 -+ if ((skb_mac_header(skb) < skb->head + frag_hdr_sz) &&
2125 - pskb_expand_head(skb, frag_hdr_sz, 0, GFP_ATOMIC))
2126 - goto out;
2127 -
2128 -diff --git a/net/sunrpc/auth_unix.c b/net/sunrpc/auth_unix.c
2129 -index 46b2647..adaa02c 100644
2130 ---- a/net/sunrpc/auth_unix.c
2131 -+++ b/net/sunrpc/auth_unix.c
2132 -@@ -129,6 +129,9 @@ unx_match(struct auth_cred *acred, struct rpc_cred *rcred, int flags)
2133 - for (i = 0; i < groups ; i++)
2134 - if (cred->uc_gids[i] != GROUP_AT(acred->group_info, i))
2135 - return 0;
2136 -+ if (groups < NFS_NGROUPS &&
2137 -+ cred->uc_gids[groups] != NOGROUP)
2138 -+ return 0;
2139 - return 1;
2140 - }
2141 -
2142 -diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
2143 -index c67e73e..92b62a8 100644
2144 ---- a/scripts/Kbuild.include
2145 -+++ b/scripts/Kbuild.include
2146 -@@ -118,6 +118,11 @@ cc-option-yn = $(call try-run,\
2147 - cc-option-align = $(subst -functions=0,,\
2148 - $(call cc-option,-falign-functions=0,-malign-functions=0))
2149 -
2150 -+# cc-disable-warning
2151 -+# Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)
2152 -+cc-disable-warning = $(call try-run,\
2153 -+ $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -xc /dev/null -o "$$TMP",-Wno-$(strip $(1)))
2154 -+
2155 - # cc-version
2156 - # Usage gcc-ver := $(call cc-version)
2157 - cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))
2158 -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
2159 -index 2db8b5a..ba44dc0 100644
2160 ---- a/sound/pci/hda/patch_realtek.c
2161 -+++ b/sound/pci/hda/patch_realtek.c
2162 -@@ -12664,7 +12664,6 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = {
2163 - SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
2164 - ALC268_ACER_ASPIRE_ONE),
2165 - SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
2166 -- SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron 910", ALC268_AUTO),
2167 - SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
2168 - "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
2169 - /* almost compatible with toshiba but with optional digital outs;
2170 -diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c
2171 -index 63bc2ae..6fa3152 100644
2172 ---- a/sound/soc/codecs/wm8940.c
2173 -+++ b/sound/soc/codecs/wm8940.c
2174 -@@ -472,6 +472,7 @@ static int wm8940_set_bias_level(struct snd_soc_codec *codec,
2175 - ret = snd_soc_write(codec, WM8940_POWER1, pwr_reg);
2176 - break;
2177 - }
2178 -+ codec->bias_level = level;
2179 -
2180 - return ret;
2181 - }
2182
2183 diff --git a/3.1.3/0000_README b/3.1.3/0000_README
2184 index 55e762b..81ef88b 100644
2185 --- a/3.1.3/0000_README
2186 +++ b/3.1.3/0000_README
2187 @@ -3,10 +3,6 @@ README
2188
2189 Individual Patch Descriptions:
2190 -----------------------------------------------------------------------------
2191 -Patch: 1002_linux-3.1.3.patch
2192 -From: http://www.kernel.org
2193 -Desc: Linux 3.1.3
2194 -
2195 Patch: 4420_grsecurity-2.2.2-3.1.3-201111262001.patch
2196 From: http://www.grsecurity.net
2197 Desc: hardened-sources base patch from upstream grsecurity
2198
2199 diff --git a/3.1.3/1002_linux-3.1.3.patch b/3.1.3/1002_linux-3.1.3.patch
2200 deleted file mode 100644
2201 index d87ecaf..0000000
2202 --- a/3.1.3/1002_linux-3.1.3.patch
2203 +++ /dev/null
2204 @@ -1,1953 +0,0 @@
2205 -diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
2206 -index 742b610..fed957a 100644
2207 ---- a/arch/arm/kernel/head.S
2208 -+++ b/arch/arm/kernel/head.S
2209 -@@ -356,7 +356,7 @@ __secondary_data:
2210 - * r13 = *virtual* address to jump to upon completion
2211 - */
2212 - __enable_mmu:
2213 --#ifdef CONFIG_ALIGNMENT_TRAP
2214 -+#if defined(CONFIG_ALIGNMENT_TRAP) && __LINUX_ARM_ARCH__ < 6
2215 - orr r0, r0, #CR_A
2216 - #else
2217 - bic r0, r0, #CR_A
2218 -diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
2219 -index 00ff00d..123d72a 100644
2220 ---- a/arch/s390/include/asm/kvm_host.h
2221 -+++ b/arch/s390/include/asm/kvm_host.h
2222 -@@ -47,7 +47,7 @@ struct sca_block {
2223 - #define KVM_HPAGE_MASK(x) (~(KVM_HPAGE_SIZE(x) - 1))
2224 - #define KVM_PAGES_PER_HPAGE(x) (KVM_HPAGE_SIZE(x) / PAGE_SIZE)
2225 -
2226 --#define CPUSTAT_HOST 0x80000000
2227 -+#define CPUSTAT_STOPPED 0x80000000
2228 - #define CPUSTAT_WAIT 0x10000000
2229 - #define CPUSTAT_ECALL_PEND 0x08000000
2230 - #define CPUSTAT_STOP_INT 0x04000000
2231 -diff --git a/arch/s390/kvm/diag.c b/arch/s390/kvm/diag.c
2232 -index 9e4c841..5a5c084 100644
2233 ---- a/arch/s390/kvm/diag.c
2234 -+++ b/arch/s390/kvm/diag.c
2235 -@@ -42,7 +42,7 @@ static int __diag_ipl_functions(struct kvm_vcpu *vcpu)
2236 - return -EOPNOTSUPP;
2237 - }
2238 -
2239 -- atomic_clear_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags);
2240 -+ atomic_set_mask(CPUSTAT_STOPPED, &vcpu->arch.sie_block->cpuflags);
2241 - vcpu->run->s390_reset_flags |= KVM_S390_RESET_SUBSYSTEM;
2242 - vcpu->run->s390_reset_flags |= KVM_S390_RESET_IPL;
2243 - vcpu->run->s390_reset_flags |= KVM_S390_RESET_CPU_INIT;
2244 -diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c
2245 -index c7c5189..0243454 100644
2246 ---- a/arch/s390/kvm/intercept.c
2247 -+++ b/arch/s390/kvm/intercept.c
2248 -@@ -132,7 +132,6 @@ static int handle_stop(struct kvm_vcpu *vcpu)
2249 - int rc = 0;
2250 -
2251 - vcpu->stat.exit_stop_request++;
2252 -- atomic_clear_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags);
2253 - spin_lock_bh(&vcpu->arch.local_int.lock);
2254 - if (vcpu->arch.local_int.action_bits & ACTION_STORE_ON_STOP) {
2255 - vcpu->arch.local_int.action_bits &= ~ACTION_STORE_ON_STOP;
2256 -@@ -149,6 +148,8 @@ static int handle_stop(struct kvm_vcpu *vcpu)
2257 - }
2258 -
2259 - if (vcpu->arch.local_int.action_bits & ACTION_STOP_ON_STOP) {
2260 -+ atomic_set_mask(CPUSTAT_STOPPED,
2261 -+ &vcpu->arch.sie_block->cpuflags);
2262 - vcpu->arch.local_int.action_bits &= ~ACTION_STOP_ON_STOP;
2263 - VCPU_EVENT(vcpu, 3, "%s", "cpu stopped");
2264 - rc = -EOPNOTSUPP;
2265 -diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
2266 -index c9aeb4b..d4bd4c7 100644
2267 ---- a/arch/s390/kvm/interrupt.c
2268 -+++ b/arch/s390/kvm/interrupt.c
2269 -@@ -224,6 +224,7 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu,
2270 - offsetof(struct _lowcore, restart_psw), sizeof(psw_t));
2271 - if (rc == -EFAULT)
2272 - exception = 1;
2273 -+ atomic_clear_mask(CPUSTAT_STOPPED, &vcpu->arch.sie_block->cpuflags);
2274 - break;
2275 -
2276 - case KVM_S390_PROGRAM_INT:
2277 -diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
2278 -index 0cba935..8cdb1bd 100644
2279 ---- a/arch/s390/kvm/kvm-s390.c
2280 -+++ b/arch/s390/kvm/kvm-s390.c
2281 -@@ -265,10 +265,12 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
2282 - restore_fp_regs(&vcpu->arch.guest_fpregs);
2283 - restore_access_regs(vcpu->arch.guest_acrs);
2284 - gmap_enable(vcpu->arch.gmap);
2285 -+ atomic_set_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags);
2286 - }
2287 -
2288 - void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
2289 - {
2290 -+ atomic_clear_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags);
2291 - gmap_disable(vcpu->arch.gmap);
2292 - save_fp_regs(&vcpu->arch.guest_fpregs);
2293 - save_access_regs(vcpu->arch.guest_acrs);
2294 -@@ -296,7 +298,9 @@ static void kvm_s390_vcpu_initial_reset(struct kvm_vcpu *vcpu)
2295 -
2296 - int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
2297 - {
2298 -- atomic_set(&vcpu->arch.sie_block->cpuflags, CPUSTAT_ZARCH | CPUSTAT_SM);
2299 -+ atomic_set(&vcpu->arch.sie_block->cpuflags, CPUSTAT_ZARCH |
2300 -+ CPUSTAT_SM |
2301 -+ CPUSTAT_STOPPED);
2302 - vcpu->arch.sie_block->ecb = 6;
2303 - vcpu->arch.sie_block->eca = 0xC1002001U;
2304 - vcpu->arch.sie_block->fac = (int) (long) facilities;
2305 -@@ -421,7 +425,7 @@ static int kvm_arch_vcpu_ioctl_set_initial_psw(struct kvm_vcpu *vcpu, psw_t psw)
2306 - {
2307 - int rc = 0;
2308 -
2309 -- if (atomic_read(&vcpu->arch.sie_block->cpuflags) & CPUSTAT_RUNNING)
2310 -+ if (!(atomic_read(&vcpu->arch.sie_block->cpuflags) & CPUSTAT_STOPPED))
2311 - rc = -EBUSY;
2312 - else {
2313 - vcpu->run->psw_mask = psw.mask;
2314 -@@ -494,7 +498,7 @@ rerun_vcpu:
2315 - if (vcpu->sigset_active)
2316 - sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved);
2317 -
2318 -- atomic_set_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags);
2319 -+ atomic_clear_mask(CPUSTAT_STOPPED, &vcpu->arch.sie_block->cpuflags);
2320 -
2321 - BUG_ON(vcpu->kvm->arch.float_int.local_int[vcpu->vcpu_id] == NULL);
2322 -
2323 -diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c
2324 -index d6a50c1..2a129bf 100644
2325 ---- a/arch/s390/kvm/sigp.c
2326 -+++ b/arch/s390/kvm/sigp.c
2327 -@@ -57,8 +57,8 @@ static int __sigp_sense(struct kvm_vcpu *vcpu, u16 cpu_addr,
2328 - spin_lock(&fi->lock);
2329 - if (fi->local_int[cpu_addr] == NULL)
2330 - rc = 3; /* not operational */
2331 -- else if (atomic_read(fi->local_int[cpu_addr]->cpuflags)
2332 -- & CPUSTAT_RUNNING) {
2333 -+ else if (!(atomic_read(fi->local_int[cpu_addr]->cpuflags)
2334 -+ & CPUSTAT_STOPPED)) {
2335 - *reg &= 0xffffffff00000000UL;
2336 - rc = 1; /* status stored */
2337 - } else {
2338 -@@ -212,7 +212,7 @@ static int __sigp_set_prefix(struct kvm_vcpu *vcpu, u16 cpu_addr, u32 address,
2339 -
2340 - spin_lock_bh(&li->lock);
2341 - /* cpu must be in stopped state */
2342 -- if (atomic_read(li->cpuflags) & CPUSTAT_RUNNING) {
2343 -+ if (!(atomic_read(li->cpuflags) & CPUSTAT_STOPPED)) {
2344 - rc = 1; /* incorrect state */
2345 - *reg &= SIGP_STAT_INCORRECT_STATE;
2346 - kfree(inti);
2347 -diff --git a/drivers/base/core.c b/drivers/base/core.c
2348 -index bc8729d..78445f4 100644
2349 ---- a/drivers/base/core.c
2350 -+++ b/drivers/base/core.c
2351 -@@ -22,6 +22,7 @@
2352 - #include <linux/kallsyms.h>
2353 - #include <linux/mutex.h>
2354 - #include <linux/async.h>
2355 -+#include <linux/pm_runtime.h>
2356 -
2357 - #include "base.h"
2358 - #include "power/power.h"
2359 -@@ -1742,6 +1743,8 @@ void device_shutdown(void)
2360 - */
2361 - list_del_init(&dev->kobj.entry);
2362 - spin_unlock(&devices_kset->list_lock);
2363 -+ /* Disable all device's runtime power management */
2364 -+ pm_runtime_disable(dev);
2365 -
2366 - if (dev->bus && dev->bus->shutdown) {
2367 - dev_dbg(dev, "shutdown\n");
2368 -diff --git a/drivers/base/node.c b/drivers/base/node.c
2369 -index 793f796..5693ece 100644
2370 ---- a/drivers/base/node.c
2371 -+++ b/drivers/base/node.c
2372 -@@ -127,12 +127,13 @@ static ssize_t node_read_meminfo(struct sys_device * dev,
2373 - nid, K(node_page_state(nid, NR_WRITEBACK)),
2374 - nid, K(node_page_state(nid, NR_FILE_PAGES)),
2375 - nid, K(node_page_state(nid, NR_FILE_MAPPED)),
2376 -- nid, K(node_page_state(nid, NR_ANON_PAGES)
2377 - #ifdef CONFIG_TRANSPARENT_HUGEPAGE
2378 -+ nid, K(node_page_state(nid, NR_ANON_PAGES)
2379 - + node_page_state(nid, NR_ANON_TRANSPARENT_HUGEPAGES) *
2380 -- HPAGE_PMD_NR
2381 -+ HPAGE_PMD_NR),
2382 -+#else
2383 -+ nid, K(node_page_state(nid, NR_ANON_PAGES)),
2384 - #endif
2385 -- ),
2386 - nid, K(node_page_state(nid, NR_SHMEM)),
2387 - nid, node_page_state(nid, NR_KERNEL_STACK) *
2388 - THREAD_SIZE / 1024,
2389 -@@ -143,13 +144,14 @@ static ssize_t node_read_meminfo(struct sys_device * dev,
2390 - nid, K(node_page_state(nid, NR_SLAB_RECLAIMABLE) +
2391 - node_page_state(nid, NR_SLAB_UNRECLAIMABLE)),
2392 - nid, K(node_page_state(nid, NR_SLAB_RECLAIMABLE)),
2393 -- nid, K(node_page_state(nid, NR_SLAB_UNRECLAIMABLE))
2394 - #ifdef CONFIG_TRANSPARENT_HUGEPAGE
2395 -+ nid, K(node_page_state(nid, NR_SLAB_UNRECLAIMABLE))
2396 - , nid,
2397 - K(node_page_state(nid, NR_ANON_TRANSPARENT_HUGEPAGES) *
2398 -- HPAGE_PMD_NR)
2399 -+ HPAGE_PMD_NR));
2400 -+#else
2401 -+ nid, K(node_page_state(nid, NR_SLAB_UNRECLAIMABLE)));
2402 - #endif
2403 -- );
2404 - n += hugetlb_report_node_meminfo(nid, buf + n);
2405 - return n;
2406 - }
2407 -diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
2408 -index 542453f..90587de 100644
2409 ---- a/drivers/gpu/drm/i915/i915_reg.h
2410 -+++ b/drivers/gpu/drm/i915/i915_reg.h
2411 -@@ -2554,10 +2554,18 @@
2412 - #define _CURBBASE 0x700c4
2413 - #define _CURBPOS 0x700c8
2414 -
2415 -+#define _CURBCNTR_IVB 0x71080
2416 -+#define _CURBBASE_IVB 0x71084
2417 -+#define _CURBPOS_IVB 0x71088
2418 -+
2419 - #define CURCNTR(pipe) _PIPE(pipe, _CURACNTR, _CURBCNTR)
2420 - #define CURBASE(pipe) _PIPE(pipe, _CURABASE, _CURBBASE)
2421 - #define CURPOS(pipe) _PIPE(pipe, _CURAPOS, _CURBPOS)
2422 -
2423 -+#define CURCNTR_IVB(pipe) _PIPE(pipe, _CURACNTR, _CURBCNTR_IVB)
2424 -+#define CURBASE_IVB(pipe) _PIPE(pipe, _CURABASE, _CURBBASE_IVB)
2425 -+#define CURPOS_IVB(pipe) _PIPE(pipe, _CURAPOS, _CURBPOS_IVB)
2426 -+
2427 - /* Display A control */
2428 - #define _DSPACNTR 0x70180
2429 - #define DISPLAY_PLANE_ENABLE (1<<31)
2430 -@@ -3167,6 +3175,7 @@
2431 - #define FDI_LINK_TRAIN_NONE_IVB (3<<8)
2432 -
2433 - /* both Tx and Rx */
2434 -+#define FDI_COMPOSITE_SYNC (1<<11)
2435 - #define FDI_LINK_TRAIN_AUTO (1<<10)
2436 - #define FDI_SCRAMBLING_ENABLE (0<<7)
2437 - #define FDI_SCRAMBLING_DISABLE (1<<7)
2438 -diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
2439 -index 04411ad..e1340a2 100644
2440 ---- a/drivers/gpu/drm/i915/intel_display.c
2441 -+++ b/drivers/gpu/drm/i915/intel_display.c
2442 -@@ -2600,6 +2600,7 @@ static void ivb_manual_fdi_link_train(struct drm_crtc *crtc)
2443 - temp |= FDI_LINK_TRAIN_PATTERN_1_IVB;
2444 - temp &= ~FDI_LINK_TRAIN_VOL_EMP_MASK;
2445 - temp |= FDI_LINK_TRAIN_400MV_0DB_SNB_B;
2446 -+ temp |= FDI_COMPOSITE_SYNC;
2447 - I915_WRITE(reg, temp | FDI_TX_ENABLE);
2448 -
2449 - reg = FDI_RX_CTL(pipe);
2450 -@@ -2607,6 +2608,7 @@ static void ivb_manual_fdi_link_train(struct drm_crtc *crtc)
2451 - temp &= ~FDI_LINK_TRAIN_AUTO;
2452 - temp &= ~FDI_LINK_TRAIN_PATTERN_MASK_CPT;
2453 - temp |= FDI_LINK_TRAIN_PATTERN_1_CPT;
2454 -+ temp |= FDI_COMPOSITE_SYNC;
2455 - I915_WRITE(reg, temp | FDI_RX_ENABLE);
2456 -
2457 - POSTING_READ(reg);
2458 -@@ -5758,6 +5760,31 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base)
2459 - I915_WRITE(CURBASE(pipe), base);
2460 - }
2461 -
2462 -+static void ivb_update_cursor(struct drm_crtc *crtc, u32 base)
2463 -+{
2464 -+ struct drm_device *dev = crtc->dev;
2465 -+ struct drm_i915_private *dev_priv = dev->dev_private;
2466 -+ struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
2467 -+ int pipe = intel_crtc->pipe;
2468 -+ bool visible = base != 0;
2469 -+
2470 -+ if (intel_crtc->cursor_visible != visible) {
2471 -+ uint32_t cntl = I915_READ(CURCNTR_IVB(pipe));
2472 -+ if (base) {
2473 -+ cntl &= ~CURSOR_MODE;
2474 -+ cntl |= CURSOR_MODE_64_ARGB_AX | MCURSOR_GAMMA_ENABLE;
2475 -+ } else {
2476 -+ cntl &= ~(CURSOR_MODE | MCURSOR_GAMMA_ENABLE);
2477 -+ cntl |= CURSOR_MODE_DISABLE;
2478 -+ }
2479 -+ I915_WRITE(CURCNTR_IVB(pipe), cntl);
2480 -+
2481 -+ intel_crtc->cursor_visible = visible;
2482 -+ }
2483 -+ /* and commit changes on next vblank */
2484 -+ I915_WRITE(CURBASE_IVB(pipe), base);
2485 -+}
2486 -+
2487 - /* If no-part of the cursor is visible on the framebuffer, then the GPU may hang... */
2488 - static void intel_crtc_update_cursor(struct drm_crtc *crtc,
2489 - bool on)
2490 -@@ -5805,11 +5832,16 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
2491 - if (!visible && !intel_crtc->cursor_visible)
2492 - return;
2493 -
2494 -- I915_WRITE(CURPOS(pipe), pos);
2495 -- if (IS_845G(dev) || IS_I865G(dev))
2496 -- i845_update_cursor(crtc, base);
2497 -- else
2498 -- i9xx_update_cursor(crtc, base);
2499 -+ if (IS_IVYBRIDGE(dev)) {
2500 -+ I915_WRITE(CURPOS_IVB(pipe), pos);
2501 -+ ivb_update_cursor(crtc, base);
2502 -+ } else {
2503 -+ I915_WRITE(CURPOS(pipe), pos);
2504 -+ if (IS_845G(dev) || IS_I865G(dev))
2505 -+ i845_update_cursor(crtc, base);
2506 -+ else
2507 -+ i9xx_update_cursor(crtc, base);
2508 -+ }
2509 -
2510 - if (visible)
2511 - intel_mark_busy(dev, to_intel_framebuffer(crtc->fb)->obj);
2512 -diff --git a/drivers/media/video/saa7164/saa7164-cards.c b/drivers/media/video/saa7164/saa7164-cards.c
2513 -index 69822a4..c713691 100644
2514 ---- a/drivers/media/video/saa7164/saa7164-cards.c
2515 -+++ b/drivers/media/video/saa7164/saa7164-cards.c
2516 -@@ -203,6 +203,66 @@ struct saa7164_board saa7164_boards[] = {
2517 - .i2c_reg_len = REGLEN_8bit,
2518 - } },
2519 - },
2520 -+ [SAA7164_BOARD_HAUPPAUGE_HVR2200_4] = {
2521 -+ .name = "Hauppauge WinTV-HVR2200",
2522 -+ .porta = SAA7164_MPEG_DVB,
2523 -+ .portb = SAA7164_MPEG_DVB,
2524 -+ .portc = SAA7164_MPEG_ENCODER,
2525 -+ .portd = SAA7164_MPEG_ENCODER,
2526 -+ .porte = SAA7164_MPEG_VBI,
2527 -+ .portf = SAA7164_MPEG_VBI,
2528 -+ .chiprev = SAA7164_CHIP_REV3,
2529 -+ .unit = {{
2530 -+ .id = 0x1d,
2531 -+ .type = SAA7164_UNIT_EEPROM,
2532 -+ .name = "4K EEPROM",
2533 -+ .i2c_bus_nr = SAA7164_I2C_BUS_0,
2534 -+ .i2c_bus_addr = 0xa0 >> 1,
2535 -+ .i2c_reg_len = REGLEN_8bit,
2536 -+ }, {
2537 -+ .id = 0x04,
2538 -+ .type = SAA7164_UNIT_TUNER,
2539 -+ .name = "TDA18271-1",
2540 -+ .i2c_bus_nr = SAA7164_I2C_BUS_1,
2541 -+ .i2c_bus_addr = 0xc0 >> 1,
2542 -+ .i2c_reg_len = REGLEN_8bit,
2543 -+ }, {
2544 -+ .id = 0x05,
2545 -+ .type = SAA7164_UNIT_ANALOG_DEMODULATOR,
2546 -+ .name = "TDA8290-1",
2547 -+ .i2c_bus_nr = SAA7164_I2C_BUS_1,
2548 -+ .i2c_bus_addr = 0x84 >> 1,
2549 -+ .i2c_reg_len = REGLEN_8bit,
2550 -+ }, {
2551 -+ .id = 0x1b,
2552 -+ .type = SAA7164_UNIT_TUNER,
2553 -+ .name = "TDA18271-2",
2554 -+ .i2c_bus_nr = SAA7164_I2C_BUS_2,
2555 -+ .i2c_bus_addr = 0xc0 >> 1,
2556 -+ .i2c_reg_len = REGLEN_8bit,
2557 -+ }, {
2558 -+ .id = 0x1c,
2559 -+ .type = SAA7164_UNIT_ANALOG_DEMODULATOR,
2560 -+ .name = "TDA8290-2",
2561 -+ .i2c_bus_nr = SAA7164_I2C_BUS_2,
2562 -+ .i2c_bus_addr = 0x84 >> 1,
2563 -+ .i2c_reg_len = REGLEN_8bit,
2564 -+ }, {
2565 -+ .id = 0x1e,
2566 -+ .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
2567 -+ .name = "TDA10048-1",
2568 -+ .i2c_bus_nr = SAA7164_I2C_BUS_1,
2569 -+ .i2c_bus_addr = 0x10 >> 1,
2570 -+ .i2c_reg_len = REGLEN_8bit,
2571 -+ }, {
2572 -+ .id = 0x1f,
2573 -+ .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
2574 -+ .name = "TDA10048-2",
2575 -+ .i2c_bus_nr = SAA7164_I2C_BUS_2,
2576 -+ .i2c_bus_addr = 0x12 >> 1,
2577 -+ .i2c_reg_len = REGLEN_8bit,
2578 -+ } },
2579 -+ },
2580 - [SAA7164_BOARD_HAUPPAUGE_HVR2250] = {
2581 - .name = "Hauppauge WinTV-HVR2250",
2582 - .porta = SAA7164_MPEG_DVB,
2583 -@@ -426,6 +486,10 @@ struct saa7164_subid saa7164_subids[] = {
2584 - .subvendor = 0x0070,
2585 - .subdevice = 0x8851,
2586 - .card = SAA7164_BOARD_HAUPPAUGE_HVR2250_2,
2587 -+ }, {
2588 -+ .subvendor = 0x0070,
2589 -+ .subdevice = 0x8940,
2590 -+ .card = SAA7164_BOARD_HAUPPAUGE_HVR2200_4,
2591 - },
2592 - };
2593 - const unsigned int saa7164_idcount = ARRAY_SIZE(saa7164_subids);
2594 -@@ -469,6 +533,7 @@ void saa7164_gpio_setup(struct saa7164_dev *dev)
2595 - case SAA7164_BOARD_HAUPPAUGE_HVR2200:
2596 - case SAA7164_BOARD_HAUPPAUGE_HVR2200_2:
2597 - case SAA7164_BOARD_HAUPPAUGE_HVR2200_3:
2598 -+ case SAA7164_BOARD_HAUPPAUGE_HVR2200_4:
2599 - case SAA7164_BOARD_HAUPPAUGE_HVR2250:
2600 - case SAA7164_BOARD_HAUPPAUGE_HVR2250_2:
2601 - case SAA7164_BOARD_HAUPPAUGE_HVR2250_3:
2602 -@@ -549,6 +614,7 @@ void saa7164_card_setup(struct saa7164_dev *dev)
2603 - case SAA7164_BOARD_HAUPPAUGE_HVR2200:
2604 - case SAA7164_BOARD_HAUPPAUGE_HVR2200_2:
2605 - case SAA7164_BOARD_HAUPPAUGE_HVR2200_3:
2606 -+ case SAA7164_BOARD_HAUPPAUGE_HVR2200_4:
2607 - case SAA7164_BOARD_HAUPPAUGE_HVR2250:
2608 - case SAA7164_BOARD_HAUPPAUGE_HVR2250_2:
2609 - case SAA7164_BOARD_HAUPPAUGE_HVR2250_3:
2610 -diff --git a/drivers/media/video/saa7164/saa7164-dvb.c b/drivers/media/video/saa7164/saa7164-dvb.c
2611 -index f65eab6..d377937 100644
2612 ---- a/drivers/media/video/saa7164/saa7164-dvb.c
2613 -+++ b/drivers/media/video/saa7164/saa7164-dvb.c
2614 -@@ -475,6 +475,7 @@ int saa7164_dvb_register(struct saa7164_port *port)
2615 - case SAA7164_BOARD_HAUPPAUGE_HVR2200:
2616 - case SAA7164_BOARD_HAUPPAUGE_HVR2200_2:
2617 - case SAA7164_BOARD_HAUPPAUGE_HVR2200_3:
2618 -+ case SAA7164_BOARD_HAUPPAUGE_HVR2200_4:
2619 - i2c_bus = &dev->i2c_bus[port->nr + 1];
2620 - switch (port->nr) {
2621 - case 0:
2622 -diff --git a/drivers/media/video/saa7164/saa7164.h b/drivers/media/video/saa7164/saa7164.h
2623 -index 6678bf1..35b6430 100644
2624 ---- a/drivers/media/video/saa7164/saa7164.h
2625 -+++ b/drivers/media/video/saa7164/saa7164.h
2626 -@@ -82,6 +82,7 @@
2627 - #define SAA7164_BOARD_HAUPPAUGE_HVR2200_3 6
2628 - #define SAA7164_BOARD_HAUPPAUGE_HVR2250_2 7
2629 - #define SAA7164_BOARD_HAUPPAUGE_HVR2250_3 8
2630 -+#define SAA7164_BOARD_HAUPPAUGE_HVR2200_4 9
2631 -
2632 - #define SAA7164_MAX_UNITS 8
2633 - #define SAA7164_TS_NUMBER_OF_LINES 312
2634 -diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
2635 -index 2d6423c..8563e9a 100644
2636 ---- a/drivers/misc/Kconfig
2637 -+++ b/drivers/misc/Kconfig
2638 -@@ -472,7 +472,7 @@ config BMP085
2639 - module will be called bmp085.
2640 -
2641 - config PCH_PHUB
2642 -- tristate "Intel EG20T PCH / OKI SEMICONDUCTOR IOH(ML7213/ML7223) PHUB"
2643 -+ tristate "Intel EG20T PCH/LAPIS Semicon IOH(ML7213/ML7223/ML7831) PHUB"
2644 - depends on PCI
2645 - help
2646 - This driver is for PCH(Platform controller Hub) PHUB(Packet Hub) of
2647 -@@ -480,12 +480,13 @@ config PCH_PHUB
2648 - processor. The Topcliff has MAC address and Option ROM data in SROM.
2649 - This driver can access MAC address and Option ROM data in SROM.
2650 -
2651 -- This driver also can be used for OKI SEMICONDUCTOR IOH(Input/
2652 -- Output Hub), ML7213 and ML7223.
2653 -- ML7213 IOH is for IVI(In-Vehicle Infotainment) use and ML7223 IOH is
2654 -- for MP(Media Phone) use.
2655 -- ML7213/ML7223 is companion chip for Intel Atom E6xx series.
2656 -- ML7213/ML7223 is completely compatible for Intel EG20T PCH.
2657 -+ This driver also can be used for LAPIS Semiconductor's IOH,
2658 -+ ML7213/ML7223/ML7831.
2659 -+ ML7213 which is for IVI(In-Vehicle Infotainment) use.
2660 -+ ML7223 IOH is for MP(Media Phone) use.
2661 -+ ML7831 IOH is for general purpose use.
2662 -+ ML7213/ML7223/ML7831 is companion chip for Intel Atom E6xx series.
2663 -+ ML7213/ML7223/ML7831 is completely compatible for Intel EG20T PCH.
2664 -
2665 - To compile this driver as a module, choose M here: the module will
2666 - be called pch_phub.
2667 -diff --git a/drivers/misc/pch_phub.c b/drivers/misc/pch_phub.c
2668 -index 0fd7e77..ba276ba 100644
2669 ---- a/drivers/misc/pch_phub.c
2670 -+++ b/drivers/misc/pch_phub.c
2671 -@@ -73,6 +73,9 @@
2672 - #define PCI_DEVICE_ID_ROHM_ML7223_mPHUB 0x8012 /* for Bus-m */
2673 - #define PCI_DEVICE_ID_ROHM_ML7223_nPHUB 0x8002 /* for Bus-n */
2674 -
2675 -+/* Macros for ML7831 */
2676 -+#define PCI_DEVICE_ID_ROHM_ML7831_PHUB 0x8801
2677 -+
2678 - /* SROM ACCESS Macro */
2679 - #define PCH_WORD_ADDR_MASK (~((1 << 2) - 1))
2680 -
2681 -@@ -464,7 +467,7 @@ static int pch_phub_write_gbe_mac_addr(struct pch_phub_reg *chip, u8 *data)
2682 - int retval;
2683 - int i;
2684 -
2685 -- if (chip->ioh_type == 1) /* EG20T */
2686 -+ if ((chip->ioh_type == 1) || (chip->ioh_type == 5)) /* EG20T or ML7831*/
2687 - retval = pch_phub_gbe_serial_rom_conf(chip);
2688 - else /* ML7223 */
2689 - retval = pch_phub_gbe_serial_rom_conf_mp(chip);
2690 -@@ -757,6 +760,22 @@ static int __devinit pch_phub_probe(struct pci_dev *pdev,
2691 - chip->pch_opt_rom_start_address =\
2692 - PCH_PHUB_ROM_START_ADDR_ML7223;
2693 - chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_ML7223;
2694 -+ } else if (id->driver_data == 5) { /* ML7831 */
2695 -+ retval = sysfs_create_file(&pdev->dev.kobj,
2696 -+ &dev_attr_pch_mac.attr);
2697 -+ if (retval)
2698 -+ goto err_sysfs_create;
2699 -+
2700 -+ retval = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr);
2701 -+ if (retval)
2702 -+ goto exit_bin_attr;
2703 -+
2704 -+ /* set the prefech value */
2705 -+ iowrite32(0x000affaa, chip->pch_phub_base_address + 0x14);
2706 -+ /* set the interrupt delay value */
2707 -+ iowrite32(0x25, chip->pch_phub_base_address + 0x44);
2708 -+ chip->pch_opt_rom_start_address = PCH_PHUB_ROM_START_ADDR_EG20T;
2709 -+ chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_EG20T;
2710 - }
2711 -
2712 - chip->ioh_type = id->driver_data;
2713 -@@ -841,6 +860,7 @@ static struct pci_device_id pch_phub_pcidev_id[] = {
2714 - { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7213_PHUB), 2, },
2715 - { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7223_mPHUB), 3, },
2716 - { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7223_nPHUB), 4, },
2717 -+ { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7831_PHUB), 5, },
2718 - { }
2719 - };
2720 - MODULE_DEVICE_TABLE(pci, pch_phub_pcidev_id);
2721 -diff --git a/drivers/misc/spear13xx_pcie_gadget.c b/drivers/misc/spear13xx_pcie_gadget.c
2722 -index cfbddbe..43d073b 100644
2723 ---- a/drivers/misc/spear13xx_pcie_gadget.c
2724 -+++ b/drivers/misc/spear13xx_pcie_gadget.c
2725 -@@ -903,6 +903,6 @@ static void __exit spear_pcie_gadget_exit(void)
2726 - }
2727 - module_exit(spear_pcie_gadget_exit);
2728 -
2729 --MODULE_ALIAS("pcie-gadget-spear");
2730 -+MODULE_ALIAS("platform:pcie-gadget-spear");
2731 - MODULE_AUTHOR("Pratyush Anand");
2732 - MODULE_LICENSE("GPL");
2733 -diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
2734 -index e0286cf..7be8b05 100644
2735 ---- a/drivers/net/wireless/libertas/if_spi.c
2736 -+++ b/drivers/net/wireless/libertas/if_spi.c
2737 -@@ -999,6 +999,7 @@ static int if_spi_host_to_card(struct lbs_private *priv,
2738 - spin_unlock_irqrestore(&card->buffer_lock, flags);
2739 - break;
2740 - default:
2741 -+ kfree(packet);
2742 - netdev_err(priv->dev, "can't transfer buffer of type %d\n",
2743 - type);
2744 - err = -EINVAL;
2745 -diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
2746 -index f82bfeb..0415e47 100644
2747 ---- a/drivers/net/wireless/rt2x00/rt2x00.h
2748 -+++ b/drivers/net/wireless/rt2x00/rt2x00.h
2749 -@@ -923,6 +923,7 @@ struct rt2x00_dev {
2750 - * Powersaving work
2751 - */
2752 - struct delayed_work autowakeup_work;
2753 -+ struct work_struct sleep_work;
2754 -
2755 - /*
2756 - * Data queue arrays for RX, TX, Beacon and ATIM.
2757 -diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
2758 -index 0955c94..9d05f87 100644
2759 ---- a/drivers/net/wireless/rt2x00/rt2x00dev.c
2760 -+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
2761 -@@ -449,6 +449,23 @@ static u8 *rt2x00lib_find_ie(u8 *data, unsigned int len, u8 ie)
2762 - return NULL;
2763 - }
2764 -
2765 -+static void rt2x00lib_sleep(struct work_struct *work)
2766 -+{
2767 -+ struct rt2x00_dev *rt2x00dev =
2768 -+ container_of(work, struct rt2x00_dev, sleep_work);
2769 -+
2770 -+ if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
2771 -+ return;
2772 -+
2773 -+ /*
2774 -+ * Check again is powersaving is enabled, to prevent races from delayed
2775 -+ * work execution.
2776 -+ */
2777 -+ if (!test_bit(CONFIG_POWERSAVING, &rt2x00dev->flags))
2778 -+ rt2x00lib_config(rt2x00dev, &rt2x00dev->hw->conf,
2779 -+ IEEE80211_CONF_CHANGE_PS);
2780 -+}
2781 -+
2782 - static void rt2x00lib_rxdone_check_ps(struct rt2x00_dev *rt2x00dev,
2783 - struct sk_buff *skb,
2784 - struct rxdone_entry_desc *rxdesc)
2785 -@@ -496,8 +513,7 @@ static void rt2x00lib_rxdone_check_ps(struct rt2x00_dev *rt2x00dev,
2786 - cam |= (tim_ie->bitmap_ctrl & 0x01);
2787 -
2788 - if (!cam && !test_bit(CONFIG_POWERSAVING, &rt2x00dev->flags))
2789 -- rt2x00lib_config(rt2x00dev, &rt2x00dev->hw->conf,
2790 -- IEEE80211_CONF_CHANGE_PS);
2791 -+ queue_work(rt2x00dev->workqueue, &rt2x00dev->sleep_work);
2792 - }
2793 -
2794 - static int rt2x00lib_rxdone_read_signal(struct rt2x00_dev *rt2x00dev,
2795 -@@ -1121,6 +1137,7 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
2796 -
2797 - INIT_WORK(&rt2x00dev->intf_work, rt2x00lib_intf_scheduled);
2798 - INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup);
2799 -+ INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep);
2800 -
2801 - /*
2802 - * Let the driver probe the device to detect the capabilities.
2803 -@@ -1177,6 +1194,7 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
2804 - */
2805 - cancel_work_sync(&rt2x00dev->intf_work);
2806 - cancel_delayed_work_sync(&rt2x00dev->autowakeup_work);
2807 -+ cancel_work_sync(&rt2x00dev->sleep_work);
2808 - if (rt2x00_is_usb(rt2x00dev)) {
2809 - del_timer_sync(&rt2x00dev->txstatus_timer);
2810 - cancel_work_sync(&rt2x00dev->rxdone_work);
2811 -diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
2812 -index 3382475..c7b6fed 100644
2813 ---- a/drivers/scsi/aacraid/linit.c
2814 -+++ b/drivers/scsi/aacraid/linit.c
2815 -@@ -38,6 +38,7 @@
2816 - #include <linux/module.h>
2817 - #include <linux/moduleparam.h>
2818 - #include <linux/pci.h>
2819 -+#include <linux/pci-aspm.h>
2820 - #include <linux/slab.h>
2821 - #include <linux/mutex.h>
2822 - #include <linux/spinlock.h>
2823 -@@ -1108,6 +1109,9 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
2824 - unique_id++;
2825 - }
2826 -
2827 -+ pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 |
2828 -+ PCIE_LINK_STATE_CLKPM);
2829 -+
2830 - error = pci_enable_device(pdev);
2831 - if (error)
2832 - goto out;
2833 -diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
2834 -index 8c713d3..418ce83 100644
2835 ---- a/drivers/scsi/hpsa.c
2836 -+++ b/drivers/scsi/hpsa.c
2837 -@@ -23,6 +23,7 @@
2838 - #include <linux/interrupt.h>
2839 - #include <linux/types.h>
2840 - #include <linux/pci.h>
2841 -+#include <linux/pci-aspm.h>
2842 - #include <linux/kernel.h>
2843 - #include <linux/slab.h>
2844 - #include <linux/delay.h>
2845 -@@ -3887,6 +3888,10 @@ static int __devinit hpsa_pci_init(struct ctlr_info *h)
2846 - dev_warn(&h->pdev->dev, "controller appears to be disabled\n");
2847 - return -ENODEV;
2848 - }
2849 -+
2850 -+ pci_disable_link_state(h->pdev, PCIE_LINK_STATE_L0S |
2851 -+ PCIE_LINK_STATE_L1 | PCIE_LINK_STATE_CLKPM);
2852 -+
2853 - err = pci_enable_device(h->pdev);
2854 - if (err) {
2855 - dev_warn(&h->pdev->dev, "unable to enable PCI device\n");
2856 -diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
2857 -index 72273a0..b3c6d95 100644
2858 ---- a/drivers/scsi/scsi_scan.c
2859 -+++ b/drivers/scsi/scsi_scan.c
2860 -@@ -319,11 +319,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
2861 - return sdev;
2862 -
2863 - out_device_destroy:
2864 -- scsi_device_set_state(sdev, SDEV_DEL);
2865 -- transport_destroy_device(&sdev->sdev_gendev);
2866 -- put_device(&sdev->sdev_dev);
2867 -- scsi_free_queue(sdev->request_queue);
2868 -- put_device(&sdev->sdev_gendev);
2869 -+ __scsi_remove_device(sdev);
2870 - out:
2871 - if (display_failure_msg)
2872 - printk(ALLOC_FAILURE_MSG, __func__);
2873 -diff --git a/drivers/tty/hvc/hvc_dcc.c b/drivers/tty/hvc/hvc_dcc.c
2874 -index 435f6fa..44fbeba 100644
2875 ---- a/drivers/tty/hvc/hvc_dcc.c
2876 -+++ b/drivers/tty/hvc/hvc_dcc.c
2877 -@@ -46,6 +46,7 @@ static inline char __dcc_getchar(void)
2878 -
2879 - asm volatile("mrc p14, 0, %0, c0, c5, 0 @ read comms data reg"
2880 - : "=r" (__c));
2881 -+ isb();
2882 -
2883 - return __c;
2884 - }
2885 -@@ -55,6 +56,7 @@ static inline void __dcc_putchar(char c)
2886 - asm volatile("mcr p14, 0, %0, c0, c5, 0 @ write a char"
2887 - : /* no output register */
2888 - : "r" (c));
2889 -+ isb();
2890 - }
2891 -
2892 - static int hvc_dcc_put_chars(uint32_t vt, const char *buf, int count)
2893 -diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
2894 -index 4dcb37b..abf6fa4 100644
2895 ---- a/drivers/tty/serial/Kconfig
2896 -+++ b/drivers/tty/serial/Kconfig
2897 -@@ -1570,7 +1570,7 @@ config SERIAL_IFX6X60
2898 - Support for the IFX6x60 modem devices on Intel MID platforms.
2899 -
2900 - config SERIAL_PCH_UART
2901 -- tristate "Intel EG20T PCH / OKI SEMICONDUCTOR IOH(ML7213/ML7223) UART"
2902 -+ tristate "Intel EG20T PCH/LAPIS Semicon IOH(ML7213/ML7223/ML7831) UART"
2903 - depends on PCI
2904 - select SERIAL_CORE
2905 - help
2906 -@@ -1578,12 +1578,12 @@ config SERIAL_PCH_UART
2907 - which is an IOH(Input/Output Hub) for x86 embedded processor.
2908 - Enabling PCH_DMA, this PCH UART works as DMA mode.
2909 -
2910 -- This driver also can be used for OKI SEMICONDUCTOR IOH(Input/
2911 -- Output Hub), ML7213 and ML7223.
2912 -- ML7213 IOH is for IVI(In-Vehicle Infotainment) use and ML7223 IOH is
2913 -- for MP(Media Phone) use.
2914 -- ML7213/ML7223 is companion chip for Intel Atom E6xx series.
2915 -- ML7213/ML7223 is completely compatible for Intel EG20T PCH.
2916 -+ This driver also can be used for LAPIS Semiconductor IOH(Input/
2917 -+ Output Hub), ML7213, ML7223 and ML7831.
2918 -+ ML7213 IOH is for IVI(In-Vehicle Infotainment) use, ML7223 IOH is
2919 -+ for MP(Media Phone) use and ML7831 IOH is for general purpose use.
2920 -+ ML7213/ML7223/ML7831 is companion chip for Intel Atom E6xx series.
2921 -+ ML7213/ML7223/ML7831 is completely compatible for Intel EG20T PCH.
2922 -
2923 - config SERIAL_MSM_SMD
2924 - bool "Enable tty device interface for some SMD ports"
2925 -diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
2926 -index b46218d..f913ed0 100644
2927 ---- a/drivers/tty/serial/pch_uart.c
2928 -+++ b/drivers/tty/serial/pch_uart.c
2929 -@@ -256,6 +256,8 @@ enum pch_uart_num_t {
2930 - pch_ml7213_uart2,
2931 - pch_ml7223_uart0,
2932 - pch_ml7223_uart1,
2933 -+ pch_ml7831_uart0,
2934 -+ pch_ml7831_uart1,
2935 - };
2936 -
2937 - static struct pch_uart_driver_data drv_dat[] = {
2938 -@@ -268,6 +270,8 @@ static struct pch_uart_driver_data drv_dat[] = {
2939 - [pch_ml7213_uart2] = {PCH_UART_2LINE, 2},
2940 - [pch_ml7223_uart0] = {PCH_UART_8LINE, 0},
2941 - [pch_ml7223_uart1] = {PCH_UART_2LINE, 1},
2942 -+ [pch_ml7831_uart0] = {PCH_UART_8LINE, 0},
2943 -+ [pch_ml7831_uart1] = {PCH_UART_2LINE, 1},
2944 - };
2945 -
2946 - static unsigned int default_baud = 9600;
2947 -@@ -626,6 +630,7 @@ static void pch_request_dma(struct uart_port *port)
2948 - dev_err(priv->port.dev, "%s:dma_request_channel FAILS(Rx)\n",
2949 - __func__);
2950 - dma_release_channel(priv->chan_tx);
2951 -+ priv->chan_tx = NULL;
2952 - return;
2953 - }
2954 -
2955 -@@ -1213,8 +1218,7 @@ static void pch_uart_shutdown(struct uart_port *port)
2956 - dev_err(priv->port.dev,
2957 - "pch_uart_hal_set_fifo Failed(ret=%d)\n", ret);
2958 -
2959 -- if (priv->use_dma_flag)
2960 -- pch_free_dma(port);
2961 -+ pch_free_dma(port);
2962 -
2963 - free_irq(priv->port.irq, priv);
2964 - }
2965 -@@ -1278,6 +1282,7 @@ static void pch_uart_set_termios(struct uart_port *port,
2966 - if (rtn)
2967 - goto out;
2968 -
2969 -+ pch_uart_set_mctrl(&priv->port, priv->port.mctrl);
2970 - /* Don't rewrite B0 */
2971 - if (tty_termios_baud_rate(termios))
2972 - tty_termios_encode_baud_rate(termios, baud, baud);
2973 -@@ -1550,6 +1555,10 @@ static DEFINE_PCI_DEVICE_TABLE(pch_uart_pci_id) = {
2974 - .driver_data = pch_ml7223_uart0},
2975 - {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x800D),
2976 - .driver_data = pch_ml7223_uart1},
2977 -+ {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8811),
2978 -+ .driver_data = pch_ml7831_uart0},
2979 -+ {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8812),
2980 -+ .driver_data = pch_ml7831_uart1},
2981 - {0,},
2982 - };
2983 -
2984 -diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
2985 -index ef925d5..a76c808 100644
2986 ---- a/drivers/tty/tty_ldisc.c
2987 -+++ b/drivers/tty/tty_ldisc.c
2988 -@@ -36,6 +36,7 @@
2989 -
2990 - #include <linux/kmod.h>
2991 - #include <linux/nsproxy.h>
2992 -+#include <linux/ratelimit.h>
2993 -
2994 - /*
2995 - * This guards the refcounted line discipline lists. The lock
2996 -@@ -548,15 +549,16 @@ static void tty_ldisc_flush_works(struct tty_struct *tty)
2997 - /**
2998 - * tty_ldisc_wait_idle - wait for the ldisc to become idle
2999 - * @tty: tty to wait for
3000 -+ * @timeout: for how long to wait at most
3001 - *
3002 - * Wait for the line discipline to become idle. The discipline must
3003 - * have been halted for this to guarantee it remains idle.
3004 - */
3005 --static int tty_ldisc_wait_idle(struct tty_struct *tty)
3006 -+static int tty_ldisc_wait_idle(struct tty_struct *tty, long timeout)
3007 - {
3008 -- int ret;
3009 -+ long ret;
3010 - ret = wait_event_timeout(tty_ldisc_idle,
3011 -- atomic_read(&tty->ldisc->users) == 1, 5 * HZ);
3012 -+ atomic_read(&tty->ldisc->users) == 1, timeout);
3013 - if (ret < 0)
3014 - return ret;
3015 - return ret > 0 ? 0 : -EBUSY;
3016 -@@ -666,7 +668,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc)
3017 -
3018 - tty_ldisc_flush_works(tty);
3019 -
3020 -- retval = tty_ldisc_wait_idle(tty);
3021 -+ retval = tty_ldisc_wait_idle(tty, 5 * HZ);
3022 -
3023 - tty_lock();
3024 - mutex_lock(&tty->ldisc_mutex);
3025 -@@ -763,8 +765,6 @@ static int tty_ldisc_reinit(struct tty_struct *tty, int ldisc)
3026 - if (IS_ERR(ld))
3027 - return -1;
3028 -
3029 -- WARN_ON_ONCE(tty_ldisc_wait_idle(tty));
3030 --
3031 - tty_ldisc_close(tty, tty->ldisc);
3032 - tty_ldisc_put(tty->ldisc);
3033 - tty->ldisc = NULL;
3034 -@@ -839,7 +839,7 @@ void tty_ldisc_hangup(struct tty_struct *tty)
3035 - tty_unlock();
3036 - cancel_work_sync(&tty->buf.work);
3037 - mutex_unlock(&tty->ldisc_mutex);
3038 --
3039 -+retry:
3040 - tty_lock();
3041 - mutex_lock(&tty->ldisc_mutex);
3042 -
3043 -@@ -848,6 +848,22 @@ void tty_ldisc_hangup(struct tty_struct *tty)
3044 - it means auditing a lot of other paths so this is
3045 - a FIXME */
3046 - if (tty->ldisc) { /* Not yet closed */
3047 -+ if (atomic_read(&tty->ldisc->users) != 1) {
3048 -+ char cur_n[TASK_COMM_LEN], tty_n[64];
3049 -+ long timeout = 3 * HZ;
3050 -+ tty_unlock();
3051 -+
3052 -+ while (tty_ldisc_wait_idle(tty, timeout) == -EBUSY) {
3053 -+ timeout = MAX_SCHEDULE_TIMEOUT;
3054 -+ printk_ratelimited(KERN_WARNING
3055 -+ "%s: waiting (%s) for %s took too long, but we keep waiting...\n",
3056 -+ __func__, get_task_comm(cur_n, current),
3057 -+ tty_name(tty, tty_n));
3058 -+ }
3059 -+ mutex_unlock(&tty->ldisc_mutex);
3060 -+ goto retry;
3061 -+ }
3062 -+
3063 - if (reset == 0) {
3064 -
3065 - if (!tty_ldisc_reinit(tty, tty->termios->c_line))
3066 -diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
3067 -index 5112f57..2ffcaa0 100644
3068 ---- a/drivers/usb/class/cdc-acm.c
3069 -+++ b/drivers/usb/class/cdc-acm.c
3070 -@@ -539,7 +539,6 @@ static void acm_port_down(struct acm *acm)
3071 - {
3072 - int i;
3073 -
3074 -- mutex_lock(&open_mutex);
3075 - if (acm->dev) {
3076 - usb_autopm_get_interface(acm->control);
3077 - acm_set_control(acm, acm->ctrlout = 0);
3078 -@@ -551,14 +550,15 @@ static void acm_port_down(struct acm *acm)
3079 - acm->control->needs_remote_wakeup = 0;
3080 - usb_autopm_put_interface(acm->control);
3081 - }
3082 -- mutex_unlock(&open_mutex);
3083 - }
3084 -
3085 - static void acm_tty_hangup(struct tty_struct *tty)
3086 - {
3087 - struct acm *acm = tty->driver_data;
3088 - tty_port_hangup(&acm->port);
3089 -+ mutex_lock(&open_mutex);
3090 - acm_port_down(acm);
3091 -+ mutex_unlock(&open_mutex);
3092 - }
3093 -
3094 - static void acm_tty_close(struct tty_struct *tty, struct file *filp)
3095 -@@ -569,8 +569,9 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp)
3096 - shutdown */
3097 - if (!acm)
3098 - return;
3099 -+
3100 -+ mutex_lock(&open_mutex);
3101 - if (tty_port_close_start(&acm->port, tty, filp) == 0) {
3102 -- mutex_lock(&open_mutex);
3103 - if (!acm->dev) {
3104 - tty_port_tty_set(&acm->port, NULL);
3105 - acm_tty_unregister(acm);
3106 -@@ -582,6 +583,7 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp)
3107 - acm_port_down(acm);
3108 - tty_port_close_end(&acm->port, tty);
3109 - tty_port_tty_set(&acm->port, NULL);
3110 -+ mutex_unlock(&open_mutex);
3111 - }
3112 -
3113 - static int acm_tty_write(struct tty_struct *tty,
3114 -diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
3115 -index a428aa0..210e359 100644
3116 ---- a/drivers/usb/core/hub.c
3117 -+++ b/drivers/usb/core/hub.c
3118 -@@ -813,6 +813,12 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
3119 - USB_PORT_FEAT_C_PORT_LINK_STATE);
3120 - }
3121 -
3122 -+ if ((portchange & USB_PORT_STAT_C_BH_RESET) &&
3123 -+ hub_is_superspeed(hub->hdev)) {
3124 -+ need_debounce_delay = true;
3125 -+ clear_port_feature(hub->hdev, port1,
3126 -+ USB_PORT_FEAT_C_BH_PORT_RESET);
3127 -+ }
3128 - /* We can forget about a "removed" device when there's a
3129 - * physical disconnect or the connect status changes.
3130 - */
3131 -diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
3132 -index d6a8d82..ecf12e1 100644
3133 ---- a/drivers/usb/core/quirks.c
3134 -+++ b/drivers/usb/core/quirks.c
3135 -@@ -50,15 +50,42 @@ static const struct usb_device_id usb_quirk_list[] = {
3136 - /* Logitech Webcam B/C500 */
3137 - { USB_DEVICE(0x046d, 0x0807), .driver_info = USB_QUIRK_RESET_RESUME },
3138 -
3139 -+ /* Logitech Webcam C600 */
3140 -+ { USB_DEVICE(0x046d, 0x0808), .driver_info = USB_QUIRK_RESET_RESUME },
3141 -+
3142 - /* Logitech Webcam Pro 9000 */
3143 - { USB_DEVICE(0x046d, 0x0809), .driver_info = USB_QUIRK_RESET_RESUME },
3144 -
3145 -+ /* Logitech Webcam C905 */
3146 -+ { USB_DEVICE(0x046d, 0x080a), .driver_info = USB_QUIRK_RESET_RESUME },
3147 -+
3148 -+ /* Logitech Webcam C210 */
3149 -+ { USB_DEVICE(0x046d, 0x0819), .driver_info = USB_QUIRK_RESET_RESUME },
3150 -+
3151 -+ /* Logitech Webcam C260 */
3152 -+ { USB_DEVICE(0x046d, 0x081a), .driver_info = USB_QUIRK_RESET_RESUME },
3153 -+
3154 - /* Logitech Webcam C310 */
3155 - { USB_DEVICE(0x046d, 0x081b), .driver_info = USB_QUIRK_RESET_RESUME },
3156 -
3157 -+ /* Logitech Webcam C910 */
3158 -+ { USB_DEVICE(0x046d, 0x0821), .driver_info = USB_QUIRK_RESET_RESUME },
3159 -+
3160 -+ /* Logitech Webcam C160 */
3161 -+ { USB_DEVICE(0x046d, 0x0824), .driver_info = USB_QUIRK_RESET_RESUME },
3162 -+
3163 - /* Logitech Webcam C270 */
3164 - { USB_DEVICE(0x046d, 0x0825), .driver_info = USB_QUIRK_RESET_RESUME },
3165 -
3166 -+ /* Logitech Quickcam Pro 9000 */
3167 -+ { USB_DEVICE(0x046d, 0x0990), .driver_info = USB_QUIRK_RESET_RESUME },
3168 -+
3169 -+ /* Logitech Quickcam E3500 */
3170 -+ { USB_DEVICE(0x046d, 0x09a4), .driver_info = USB_QUIRK_RESET_RESUME },
3171 -+
3172 -+ /* Logitech Quickcam Vision Pro */
3173 -+ { USB_DEVICE(0x046d, 0x09a6), .driver_info = USB_QUIRK_RESET_RESUME },
3174 -+
3175 - /* Logitech Harmony 700-series */
3176 - { USB_DEVICE(0x046d, 0xc122), .driver_info = USB_QUIRK_DELAY_INIT },
3177 -
3178 -diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
3179 -index 5a084b9..6f50491 100644
3180 ---- a/drivers/usb/gadget/Kconfig
3181 -+++ b/drivers/usb/gadget/Kconfig
3182 -@@ -442,7 +442,7 @@ config USB_LANGWELL
3183 - gadget drivers to also be dynamically linked.
3184 -
3185 - config USB_EG20T
3186 -- tristate "Intel EG20T PCH/OKI SEMICONDUCTOR ML7213 IOH UDC"
3187 -+ tristate "Intel EG20T PCH/LAPIS Semiconductor IOH(ML7213/ML7831) UDC"
3188 - depends on PCI
3189 - select USB_GADGET_DUALSPEED
3190 - help
3191 -@@ -458,10 +458,11 @@ config USB_EG20T
3192 - This driver dose not support interrupt transfer or isochronous
3193 - transfer modes.
3194 -
3195 -- This driver also can be used for OKI SEMICONDUCTOR's ML7213 which is
3196 -+ This driver also can be used for LAPIS Semiconductor's ML7213 which is
3197 - for IVI(In-Vehicle Infotainment) use.
3198 -- ML7213 is companion chip for Intel Atom E6xx series.
3199 -- ML7213 is completely compatible for Intel EG20T PCH.
3200 -+ ML7831 is for general purpose use.
3201 -+ ML7213/ML7831 is companion chip for Intel Atom E6xx series.
3202 -+ ML7213/ML7831 is completely compatible for Intel EG20T PCH.
3203 -
3204 - config USB_CI13XXX_MSM
3205 - tristate "MIPS USB CI13xxx for MSM"
3206 -diff --git a/drivers/usb/gadget/pch_udc.c b/drivers/usb/gadget/pch_udc.c
3207 -index f96615a..06c40b1 100644
3208 ---- a/drivers/usb/gadget/pch_udc.c
3209 -+++ b/drivers/usb/gadget/pch_udc.c
3210 -@@ -363,6 +363,7 @@ struct pch_udc_dev {
3211 - #define PCI_DEVICE_ID_INTEL_EG20T_UDC 0x8808
3212 - #define PCI_VENDOR_ID_ROHM 0x10DB
3213 - #define PCI_DEVICE_ID_ML7213_IOH_UDC 0x801D
3214 -+#define PCI_DEVICE_ID_ML7831_IOH_UDC 0x8808
3215 -
3216 - static const char ep0_string[] = "ep0in";
3217 - static DEFINE_SPINLOCK(udc_stall_spinlock); /* stall spin lock */
3218 -@@ -2979,6 +2980,11 @@ static DEFINE_PCI_DEVICE_TABLE(pch_udc_pcidev_id) = {
3219 - .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe,
3220 - .class_mask = 0xffffffff,
3221 - },
3222 -+ {
3223 -+ PCI_DEVICE(PCI_VENDOR_ID_ROHM, PCI_DEVICE_ID_ML7831_IOH_UDC),
3224 -+ .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe,
3225 -+ .class_mask = 0xffffffff,
3226 -+ },
3227 - { 0 },
3228 - };
3229 -
3230 -diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
3231 -index 29bec34..afef3df 100644
3232 ---- a/drivers/usb/host/ehci-sched.c
3233 -+++ b/drivers/usb/host/ehci-sched.c
3234 -@@ -1480,10 +1480,15 @@ iso_stream_schedule (
3235 -
3236 - /* NOTE: assumes URB_ISO_ASAP, to limit complexity/bugs */
3237 -
3238 -- /* find a uframe slot with enough bandwidth */
3239 -- next = start + period;
3240 -- for (; start < next; start++) {
3241 --
3242 -+ /* find a uframe slot with enough bandwidth.
3243 -+ * Early uframes are more precious because full-speed
3244 -+ * iso IN transfers can't use late uframes,
3245 -+ * and therefore they should be allocated last.
3246 -+ */
3247 -+ next = start;
3248 -+ start += period;
3249 -+ do {
3250 -+ start--;
3251 - /* check schedule: enough space? */
3252 - if (stream->highspeed) {
3253 - if (itd_slot_ok(ehci, mod, start,
3254 -@@ -1496,7 +1501,7 @@ iso_stream_schedule (
3255 - start, sched, period))
3256 - break;
3257 - }
3258 -- }
3259 -+ } while (start > next);
3260 -
3261 - /* no room in the schedule */
3262 - if (start == next) {
3263 -diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
3264 -index 629a968..a495d48 100644
3265 ---- a/drivers/usb/host/pci-quirks.c
3266 -+++ b/drivers/usb/host/pci-quirks.c
3267 -@@ -626,7 +626,7 @@ static void __devinit quirk_usb_disable_ehci(struct pci_dev *pdev)
3268 - void __iomem *base, *op_reg_base;
3269 - u32 hcc_params, cap, val;
3270 - u8 offset, cap_length;
3271 -- int wait_time, delta, count = 256/4;
3272 -+ int wait_time, count = 256/4;
3273 -
3274 - if (!mmio_resource_enabled(pdev, 0))
3275 - return;
3276 -@@ -672,11 +672,10 @@ static void __devinit quirk_usb_disable_ehci(struct pci_dev *pdev)
3277 - writel(val, op_reg_base + EHCI_USBCMD);
3278 -
3279 - wait_time = 2000;
3280 -- delta = 100;
3281 - do {
3282 - writel(0x3f, op_reg_base + EHCI_USBSTS);
3283 -- udelay(delta);
3284 -- wait_time -= delta;
3285 -+ udelay(100);
3286 -+ wait_time -= 100;
3287 - val = readl(op_reg_base + EHCI_USBSTS);
3288 - if ((val == ~(u32)0) || (val & EHCI_USBSTS_HALTED)) {
3289 - break;
3290 -diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
3291 -index 3428528..d718033 100644
3292 ---- a/drivers/usb/host/xhci-mem.c
3293 -+++ b/drivers/usb/host/xhci-mem.c
3294 -@@ -875,7 +875,6 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *ud
3295 - struct xhci_virt_device *dev;
3296 - struct xhci_ep_ctx *ep0_ctx;
3297 - struct xhci_slot_ctx *slot_ctx;
3298 -- struct xhci_input_control_ctx *ctrl_ctx;
3299 - u32 port_num;
3300 - struct usb_device *top_dev;
3301 -
3302 -@@ -887,12 +886,8 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *ud
3303 - return -EINVAL;
3304 - }
3305 - ep0_ctx = xhci_get_ep_ctx(xhci, dev->in_ctx, 0);
3306 -- ctrl_ctx = xhci_get_input_control_ctx(xhci, dev->in_ctx);
3307 - slot_ctx = xhci_get_slot_ctx(xhci, dev->in_ctx);
3308 -
3309 -- /* 2) New slot context and endpoint 0 context are valid*/
3310 -- ctrl_ctx->add_flags = cpu_to_le32(SLOT_FLAG | EP0_FLAG);
3311 --
3312 - /* 3) Only the control endpoint is valid - one endpoint context */
3313 - slot_ctx->dev_info |= cpu_to_le32(LAST_CTX(1) | udev->route);
3314 - switch (udev->speed) {
3315 -diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
3316 -index dd3eb6f..2c07fff 100644
3317 ---- a/drivers/usb/host/xhci-ring.c
3318 -+++ b/drivers/usb/host/xhci-ring.c
3319 -@@ -816,23 +816,24 @@ void xhci_stop_endpoint_command_watchdog(unsigned long arg)
3320 - struct xhci_ring *ring;
3321 - struct xhci_td *cur_td;
3322 - int ret, i, j;
3323 -+ unsigned long flags;
3324 -
3325 - ep = (struct xhci_virt_ep *) arg;
3326 - xhci = ep->xhci;
3327 -
3328 -- spin_lock(&xhci->lock);
3329 -+ spin_lock_irqsave(&xhci->lock, flags);
3330 -
3331 - ep->stop_cmds_pending--;
3332 - if (xhci->xhc_state & XHCI_STATE_DYING) {
3333 - xhci_dbg(xhci, "Stop EP timer ran, but another timer marked "
3334 - "xHCI as DYING, exiting.\n");
3335 -- spin_unlock(&xhci->lock);
3336 -+ spin_unlock_irqrestore(&xhci->lock, flags);
3337 - return;
3338 - }
3339 - if (!(ep->stop_cmds_pending == 0 && (ep->ep_state & EP_HALT_PENDING))) {
3340 - xhci_dbg(xhci, "Stop EP timer ran, but no command pending, "
3341 - "exiting.\n");
3342 -- spin_unlock(&xhci->lock);
3343 -+ spin_unlock_irqrestore(&xhci->lock, flags);
3344 - return;
3345 - }
3346 -
3347 -@@ -844,11 +845,11 @@ void xhci_stop_endpoint_command_watchdog(unsigned long arg)
3348 - xhci->xhc_state |= XHCI_STATE_DYING;
3349 - /* Disable interrupts from the host controller and start halting it */
3350 - xhci_quiesce(xhci);
3351 -- spin_unlock(&xhci->lock);
3352 -+ spin_unlock_irqrestore(&xhci->lock, flags);
3353 -
3354 - ret = xhci_halt(xhci);
3355 -
3356 -- spin_lock(&xhci->lock);
3357 -+ spin_lock_irqsave(&xhci->lock, flags);
3358 - if (ret < 0) {
3359 - /* This is bad; the host is not responding to commands and it's
3360 - * not allowing itself to be halted. At least interrupts are
3361 -@@ -896,7 +897,7 @@ void xhci_stop_endpoint_command_watchdog(unsigned long arg)
3362 - }
3363 - }
3364 - }
3365 -- spin_unlock(&xhci->lock);
3366 -+ spin_unlock_irqrestore(&xhci->lock, flags);
3367 - xhci_dbg(xhci, "Calling usb_hc_died()\n");
3368 - usb_hc_died(xhci_to_hcd(xhci)->primary_hcd);
3369 - xhci_dbg(xhci, "xHCI host controller is dead.\n");
3370 -diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
3371 -index 3770004..67900ff 100644
3372 ---- a/drivers/usb/host/xhci.c
3373 -+++ b/drivers/usb/host/xhci.c
3374 -@@ -749,7 +749,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
3375 - u32 command, temp = 0;
3376 - struct usb_hcd *hcd = xhci_to_hcd(xhci);
3377 - struct usb_hcd *secondary_hcd;
3378 -- int retval;
3379 -+ int retval = 0;
3380 -
3381 - /* Wait a bit if either of the roothubs need to settle from the
3382 - * transition into bus suspend.
3383 -@@ -759,6 +759,9 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
3384 - xhci->bus_state[1].next_statechange))
3385 - msleep(100);
3386 -
3387 -+ set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
3388 -+ set_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags);
3389 -+
3390 - spin_lock_irq(&xhci->lock);
3391 - if (xhci->quirks & XHCI_RESET_ON_RESUME)
3392 - hibernated = true;
3393 -@@ -828,20 +831,13 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
3394 - return retval;
3395 - xhci_dbg(xhci, "Start the primary HCD\n");
3396 - retval = xhci_run(hcd->primary_hcd);
3397 -- if (retval)
3398 -- goto failed_restart;
3399 --
3400 -- xhci_dbg(xhci, "Start the secondary HCD\n");
3401 -- retval = xhci_run(secondary_hcd);
3402 - if (!retval) {
3403 -- set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
3404 -- set_bit(HCD_FLAG_HW_ACCESSIBLE,
3405 -- &xhci->shared_hcd->flags);
3406 -+ xhci_dbg(xhci, "Start the secondary HCD\n");
3407 -+ retval = xhci_run(secondary_hcd);
3408 - }
3409 --failed_restart:
3410 - hcd->state = HC_STATE_SUSPENDED;
3411 - xhci->shared_hcd->state = HC_STATE_SUSPENDED;
3412 -- return retval;
3413 -+ goto done;
3414 - }
3415 -
3416 - /* step 4: set Run/Stop bit */
3417 -@@ -860,11 +856,14 @@ failed_restart:
3418 - * Running endpoints by ringing their doorbells
3419 - */
3420 -
3421 -- set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
3422 -- set_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags);
3423 --
3424 - spin_unlock_irq(&xhci->lock);
3425 -- return 0;
3426 -+
3427 -+ done:
3428 -+ if (retval == 0) {
3429 -+ usb_hcd_resume_root_hub(hcd);
3430 -+ usb_hcd_resume_root_hub(xhci->shared_hcd);
3431 -+ }
3432 -+ return retval;
3433 - }
3434 - #endif /* CONFIG_PM */
3435 -
3436 -@@ -2873,6 +2872,10 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev)
3437 - /* Otherwise, update the control endpoint ring enqueue pointer. */
3438 - else
3439 - xhci_copy_ep0_dequeue_into_input_ctx(xhci, udev);
3440 -+ ctrl_ctx = xhci_get_input_control_ctx(xhci, virt_dev->in_ctx);
3441 -+ ctrl_ctx->add_flags = cpu_to_le32(SLOT_FLAG | EP0_FLAG);
3442 -+ ctrl_ctx->drop_flags = 0;
3443 -+
3444 - xhci_dbg(xhci, "Slot ID %d Input Context:\n", udev->slot_id);
3445 - xhci_dbg_ctx(xhci, virt_dev->in_ctx, 2);
3446 -
3447 -@@ -2954,7 +2957,6 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev)
3448 - virt_dev->address = (le32_to_cpu(slot_ctx->dev_state) & DEV_ADDR_MASK)
3449 - + 1;
3450 - /* Zero the input context control for later use */
3451 -- ctrl_ctx = xhci_get_input_control_ctx(xhci, virt_dev->in_ctx);
3452 - ctrl_ctx->add_flags = 0;
3453 - ctrl_ctx->drop_flags = 0;
3454 -
3455 -diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
3456 -index 5cdb9d9..18e875b 100644
3457 ---- a/drivers/usb/serial/ark3116.c
3458 -+++ b/drivers/usb/serial/ark3116.c
3459 -@@ -42,7 +42,7 @@ static int debug;
3460 - * Version information
3461 - */
3462 -
3463 --#define DRIVER_VERSION "v0.6"
3464 -+#define DRIVER_VERSION "v0.7"
3465 - #define DRIVER_AUTHOR "Bart Hartgers <bart.hartgers+ark3116@×××××.com>"
3466 - #define DRIVER_DESC "USB ARK3116 serial/IrDA driver"
3467 - #define DRIVER_DEV_DESC "ARK3116 RS232/IrDA"
3468 -@@ -380,10 +380,6 @@ static int ark3116_open(struct tty_struct *tty, struct usb_serial_port *port)
3469 - goto err_out;
3470 - }
3471 -
3472 -- /* setup termios */
3473 -- if (tty)
3474 -- ark3116_set_termios(tty, port, NULL);
3475 --
3476 - /* remove any data still left: also clears error state */
3477 - ark3116_read_reg(serial, UART_RX, buf);
3478 -
3479 -@@ -406,6 +402,10 @@ static int ark3116_open(struct tty_struct *tty, struct usb_serial_port *port)
3480 - /* enable DMA */
3481 - ark3116_write_reg(port->serial, UART_FCR, UART_FCR_DMA_SELECT);
3482 -
3483 -+ /* setup termios */
3484 -+ if (tty)
3485 -+ ark3116_set_termios(tty, port, NULL);
3486 -+
3487 - err_out:
3488 - kfree(buf);
3489 - return result;
3490 -diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
3491 -index f34f6ed..e16394c 100644
3492 ---- a/drivers/usb/serial/ftdi_sio.c
3493 -+++ b/drivers/usb/serial/ftdi_sio.c
3494 -@@ -2083,13 +2083,19 @@ static void ftdi_set_termios(struct tty_struct *tty,
3495 -
3496 - cflag = termios->c_cflag;
3497 -
3498 -- /* FIXME -For this cut I don't care if the line is really changing or
3499 -- not - so just do the change regardless - should be able to
3500 -- compare old_termios and tty->termios */
3501 -+ if (old_termios->c_cflag == termios->c_cflag
3502 -+ && old_termios->c_ispeed == termios->c_ispeed
3503 -+ && old_termios->c_ospeed == termios->c_ospeed)
3504 -+ goto no_c_cflag_changes;
3505 -+
3506 - /* NOTE These routines can get interrupted by
3507 - ftdi_sio_read_bulk_callback - need to examine what this means -
3508 - don't see any problems yet */
3509 -
3510 -+ if ((old_termios->c_cflag & (CSIZE|PARODD|PARENB|CMSPAR|CSTOPB)) ==
3511 -+ (termios->c_cflag & (CSIZE|PARODD|PARENB|CMSPAR|CSTOPB)))
3512 -+ goto no_data_parity_stop_changes;
3513 -+
3514 - /* Set number of data bits, parity, stop bits */
3515 -
3516 - urb_value = 0;
3517 -@@ -2130,6 +2136,7 @@ static void ftdi_set_termios(struct tty_struct *tty,
3518 - }
3519 -
3520 - /* Now do the baudrate */
3521 -+no_data_parity_stop_changes:
3522 - if ((cflag & CBAUD) == B0) {
3523 - /* Disable flow control */
3524 - if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
3525 -@@ -2157,6 +2164,7 @@ static void ftdi_set_termios(struct tty_struct *tty,
3526 -
3527 - /* Set flow control */
3528 - /* Note device also supports DTR/CD (ugh) and Xon/Xoff in hardware */
3529 -+no_c_cflag_changes:
3530 - if (cflag & CRTSCTS) {
3531 - dbg("%s Setting to CRTSCTS flow control", __func__);
3532 - if (usb_control_msg(dev,
3533 -diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
3534 -index 89ae1f6..3a47cbe 100644
3535 ---- a/drivers/usb/serial/option.c
3536 -+++ b/drivers/usb/serial/option.c
3537 -@@ -156,6 +156,7 @@ static void option_instat_callback(struct urb *urb);
3538 - #define HUAWEI_PRODUCT_K4511 0x14CC
3539 - #define HUAWEI_PRODUCT_ETS1220 0x1803
3540 - #define HUAWEI_PRODUCT_E353 0x1506
3541 -+#define HUAWEI_PRODUCT_E173S 0x1C05
3542 -
3543 - #define QUANTA_VENDOR_ID 0x0408
3544 - #define QUANTA_PRODUCT_Q101 0xEA02
3545 -@@ -316,6 +317,9 @@ static void option_instat_callback(struct urb *urb);
3546 - #define ZTE_PRODUCT_AC8710 0xfff1
3547 - #define ZTE_PRODUCT_AC2726 0xfff5
3548 - #define ZTE_PRODUCT_AC8710T 0xffff
3549 -+#define ZTE_PRODUCT_MC2718 0xffe8
3550 -+#define ZTE_PRODUCT_AD3812 0xffeb
3551 -+#define ZTE_PRODUCT_MC2716 0xffed
3552 -
3553 - #define BENQ_VENDOR_ID 0x04a5
3554 - #define BENQ_PRODUCT_H10 0x4068
3555 -@@ -500,6 +504,18 @@ static const struct option_blacklist_info zte_k3765_z_blacklist = {
3556 - .reserved = BIT(4),
3557 - };
3558 -
3559 -+static const struct option_blacklist_info zte_ad3812_z_blacklist = {
3560 -+ .sendsetup = BIT(0) | BIT(1) | BIT(2),
3561 -+};
3562 -+
3563 -+static const struct option_blacklist_info zte_mc2718_z_blacklist = {
3564 -+ .sendsetup = BIT(1) | BIT(2) | BIT(3) | BIT(4),
3565 -+};
3566 -+
3567 -+static const struct option_blacklist_info zte_mc2716_z_blacklist = {
3568 -+ .sendsetup = BIT(1) | BIT(2) | BIT(3),
3569 -+};
3570 -+
3571 - static const struct option_blacklist_info huawei_cdc12_blacklist = {
3572 - .reserved = BIT(1) | BIT(2),
3573 - };
3574 -@@ -622,6 +638,7 @@ static const struct usb_device_id option_ids[] = {
3575 - { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143D, 0xff, 0xff, 0xff) },
3576 - { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143E, 0xff, 0xff, 0xff) },
3577 - { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143F, 0xff, 0xff, 0xff) },
3578 -+ { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173S, 0xff, 0xff, 0xff) },
3579 - { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff),
3580 - .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist },
3581 - { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff),
3582 -@@ -1043,6 +1060,12 @@ static const struct usb_device_id option_ids[] = {
3583 - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) },
3584 - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) },
3585 - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710T, 0xff, 0xff, 0xff) },
3586 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2718, 0xff, 0xff, 0xff),
3587 -+ .driver_info = (kernel_ulong_t)&zte_mc2718_z_blacklist },
3588 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AD3812, 0xff, 0xff, 0xff),
3589 -+ .driver_info = (kernel_ulong_t)&zte_ad3812_z_blacklist },
3590 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2716, 0xff, 0xff, 0xff),
3591 -+ .driver_info = (kernel_ulong_t)&zte_mc2716_z_blacklist },
3592 - { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) },
3593 - { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) },
3594 - { USB_DEVICE(ALINK_VENDOR_ID, DLINK_PRODUCT_DWM_652_U5) }, /* Yes, ALINK_VENDOR_ID */
3595 -diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
3596 -index 614fabc..d44c669 100644
3597 ---- a/drivers/usb/serial/pl2303.c
3598 -+++ b/drivers/usb/serial/pl2303.c
3599 -@@ -91,7 +91,6 @@ static const struct usb_device_id id_table[] = {
3600 - { USB_DEVICE(SONY_VENDOR_ID, SONY_QN3USB_PRODUCT_ID) },
3601 - { USB_DEVICE(SANWA_VENDOR_ID, SANWA_PRODUCT_ID) },
3602 - { USB_DEVICE(ADLINK_VENDOR_ID, ADLINK_ND6530_PRODUCT_ID) },
3603 -- { USB_DEVICE(WINCHIPHEAD_VENDOR_ID, WINCHIPHEAD_USBSER_PRODUCT_ID) },
3604 - { USB_DEVICE(SMART_VENDOR_ID, SMART_PRODUCT_ID) },
3605 - { } /* Terminating entry */
3606 - };
3607 -diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h
3608 -index 3d10d7f..c38b8c0 100644
3609 ---- a/drivers/usb/serial/pl2303.h
3610 -+++ b/drivers/usb/serial/pl2303.h
3611 -@@ -145,10 +145,6 @@
3612 - #define ADLINK_VENDOR_ID 0x0b63
3613 - #define ADLINK_ND6530_PRODUCT_ID 0x6530
3614 -
3615 --/* WinChipHead USB->RS 232 adapter */
3616 --#define WINCHIPHEAD_VENDOR_ID 0x4348
3617 --#define WINCHIPHEAD_USBSER_PRODUCT_ID 0x5523
3618 --
3619 - /* SMART USB Serial Adapter */
3620 - #define SMART_VENDOR_ID 0x0b8c
3621 - #define SMART_PRODUCT_ID 0x2303
3622 -diff --git a/drivers/usb/storage/protocol.c b/drivers/usb/storage/protocol.c
3623 -index fc310f7..0fded39 100644
3624 ---- a/drivers/usb/storage/protocol.c
3625 -+++ b/drivers/usb/storage/protocol.c
3626 -@@ -58,7 +58,9 @@
3627 -
3628 - void usb_stor_pad12_command(struct scsi_cmnd *srb, struct us_data *us)
3629 - {
3630 -- /* Pad the SCSI command with zeros out to 12 bytes
3631 -+ /*
3632 -+ * Pad the SCSI command with zeros out to 12 bytes. If the
3633 -+ * command already is 12 bytes or longer, leave it alone.
3634 - *
3635 - * NOTE: This only works because a scsi_cmnd struct field contains
3636 - * a unsigned char cmnd[16], so we know we have storage available
3637 -@@ -66,9 +68,6 @@ void usb_stor_pad12_command(struct scsi_cmnd *srb, struct us_data *us)
3638 - for (; srb->cmd_len<12; srb->cmd_len++)
3639 - srb->cmnd[srb->cmd_len] = 0;
3640 -
3641 -- /* set command length to 12 bytes */
3642 -- srb->cmd_len = 12;
3643 --
3644 - /* send the command to the transport layer */
3645 - usb_stor_invoke_transport(srb, us);
3646 - }
3647 -diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
3648 -index b238d95..ac28990 100644
3649 ---- a/fs/nfs/dir.c
3650 -+++ b/fs/nfs/dir.c
3651 -@@ -1468,12 +1468,12 @@ static struct dentry *nfs_atomic_lookup(struct inode *dir, struct dentry *dentry
3652 - res = NULL;
3653 - goto out;
3654 - /* This turned out not to be a regular file */
3655 -+ case -EISDIR:
3656 - case -ENOTDIR:
3657 - goto no_open;
3658 - case -ELOOP:
3659 - if (!(nd->intent.open.flags & O_NOFOLLOW))
3660 - goto no_open;
3661 -- /* case -EISDIR: */
3662 - /* case -EINVAL: */
3663 - default:
3664 - res = ERR_CAST(inode);
3665 -diff --git a/fs/nfs/file.c b/fs/nfs/file.c
3666 -index 28b8c3f..5b3d984 100644
3667 ---- a/fs/nfs/file.c
3668 -+++ b/fs/nfs/file.c
3669 -@@ -895,3 +895,35 @@ static int nfs_setlease(struct file *file, long arg, struct file_lock **fl)
3670 - file->f_path.dentry->d_name.name, arg);
3671 - return -EINVAL;
3672 - }
3673 -+
3674 -+#ifdef CONFIG_NFS_V4
3675 -+static int
3676 -+nfs4_file_open(struct inode *inode, struct file *filp)
3677 -+{
3678 -+ /*
3679 -+ * NFSv4 opens are handled in d_lookup and d_revalidate. If we get to
3680 -+ * this point, then something is very wrong
3681 -+ */
3682 -+ dprintk("NFS: %s called! inode=%p filp=%p\n", __func__, inode, filp);
3683 -+ return -ENOTDIR;
3684 -+}
3685 -+
3686 -+const struct file_operations nfs4_file_operations = {
3687 -+ .llseek = nfs_file_llseek,
3688 -+ .read = do_sync_read,
3689 -+ .write = do_sync_write,
3690 -+ .aio_read = nfs_file_read,
3691 -+ .aio_write = nfs_file_write,
3692 -+ .mmap = nfs_file_mmap,
3693 -+ .open = nfs4_file_open,
3694 -+ .flush = nfs_file_flush,
3695 -+ .release = nfs_file_release,
3696 -+ .fsync = nfs_file_fsync,
3697 -+ .lock = nfs_lock,
3698 -+ .flock = nfs_flock,
3699 -+ .splice_read = nfs_file_splice_read,
3700 -+ .splice_write = nfs_file_splice_write,
3701 -+ .check_flags = nfs_check_flags,
3702 -+ .setlease = nfs_setlease,
3703 -+};
3704 -+#endif /* CONFIG_NFS_V4 */
3705 -diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
3706 -index fe12037..679d2f5 100644
3707 ---- a/fs/nfs/inode.c
3708 -+++ b/fs/nfs/inode.c
3709 -@@ -291,7 +291,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr)
3710 - */
3711 - inode->i_op = NFS_SB(sb)->nfs_client->rpc_ops->file_inode_ops;
3712 - if (S_ISREG(inode->i_mode)) {
3713 -- inode->i_fop = &nfs_file_operations;
3714 -+ inode->i_fop = NFS_SB(sb)->nfs_client->rpc_ops->file_ops;
3715 - inode->i_data.a_ops = &nfs_file_aops;
3716 - inode->i_data.backing_dev_info = &NFS_SB(sb)->backing_dev_info;
3717 - } else if (S_ISDIR(inode->i_mode)) {
3718 -diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
3719 -index 85f1690..d4bc9ed9 100644
3720 ---- a/fs/nfs/nfs3proc.c
3721 -+++ b/fs/nfs/nfs3proc.c
3722 -@@ -853,6 +853,7 @@ const struct nfs_rpc_ops nfs_v3_clientops = {
3723 - .dentry_ops = &nfs_dentry_operations,
3724 - .dir_inode_ops = &nfs3_dir_inode_operations,
3725 - .file_inode_ops = &nfs3_file_inode_operations,
3726 -+ .file_ops = &nfs_file_operations,
3727 - .getroot = nfs3_proc_get_root,
3728 - .getattr = nfs3_proc_getattr,
3729 - .setattr = nfs3_proc_setattr,
3730 -diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
3731 -index 4700fae..2d8a169 100644
3732 ---- a/fs/nfs/nfs4proc.c
3733 -+++ b/fs/nfs/nfs4proc.c
3734 -@@ -6267,6 +6267,7 @@ const struct nfs_rpc_ops nfs_v4_clientops = {
3735 - .dentry_ops = &nfs4_dentry_operations,
3736 - .dir_inode_ops = &nfs4_dir_inode_operations,
3737 - .file_inode_ops = &nfs4_file_inode_operations,
3738 -+ .file_ops = &nfs4_file_operations,
3739 - .getroot = nfs4_proc_get_root,
3740 - .getattr = nfs4_proc_getattr,
3741 - .setattr = nfs4_proc_setattr,
3742 -diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c
3743 -index ac40b85..f48125d 100644
3744 ---- a/fs/nfs/proc.c
3745 -+++ b/fs/nfs/proc.c
3746 -@@ -710,6 +710,7 @@ const struct nfs_rpc_ops nfs_v2_clientops = {
3747 - .dentry_ops = &nfs_dentry_operations,
3748 - .dir_inode_ops = &nfs_dir_inode_operations,
3749 - .file_inode_ops = &nfs_file_inode_operations,
3750 -+ .file_ops = &nfs_file_operations,
3751 - .getroot = nfs_proc_get_root,
3752 - .getattr = nfs_proc_getattr,
3753 - .setattr = nfs_proc_setattr,
3754 -diff --git a/fs/super.c b/fs/super.c
3755 -index 3f56a26..32a81f3 100644
3756 ---- a/fs/super.c
3757 -+++ b/fs/super.c
3758 -@@ -61,7 +61,7 @@ static int prune_super(struct shrinker *shrink, struct shrink_control *sc)
3759 - return -1;
3760 -
3761 - if (!grab_super_passive(sb))
3762 -- return -1;
3763 -+ return !sc->nr_to_scan ? 0 : -1;
3764 -
3765 - if (sb->s_op && sb->s_op->nr_cached_objects)
3766 - fs_objects = sb->s_op->nr_cached_objects(sb);
3767 -diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
3768 -index eaac770..fc0fd15 100644
3769 ---- a/include/linux/nfs_fs.h
3770 -+++ b/include/linux/nfs_fs.h
3771 -@@ -410,6 +410,9 @@ extern const struct inode_operations nfs_file_inode_operations;
3772 - extern const struct inode_operations nfs3_file_inode_operations;
3773 - #endif /* CONFIG_NFS_V3 */
3774 - extern const struct file_operations nfs_file_operations;
3775 -+#ifdef CONFIG_NFS_V4
3776 -+extern const struct file_operations nfs4_file_operations;
3777 -+#endif /* CONFIG_NFS_V4 */
3778 - extern const struct address_space_operations nfs_file_aops;
3779 - extern const struct address_space_operations nfs_dir_aops;
3780 -
3781 -diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
3782 -index abd615d..8475f34 100644
3783 ---- a/include/linux/nfs_xdr.h
3784 -+++ b/include/linux/nfs_xdr.h
3785 -@@ -1194,6 +1194,7 @@ struct nfs_rpc_ops {
3786 - const struct dentry_operations *dentry_ops;
3787 - const struct inode_operations *dir_inode_ops;
3788 - const struct inode_operations *file_inode_ops;
3789 -+ const struct file_operations *file_ops;
3790 -
3791 - int (*getroot) (struct nfs_server *, struct nfs_fh *,
3792 - struct nfs_fsinfo *);
3793 -diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h
3794 -index 790651b..a83833a 100644
3795 ---- a/include/linux/shrinker.h
3796 -+++ b/include/linux/shrinker.h
3797 -@@ -20,6 +20,7 @@ struct shrink_control {
3798 - * 'nr_to_scan' entries and attempt to free them up. It should return
3799 - * the number of objects which remain in the cache. If it returns -1, it means
3800 - * it cannot do any scanning at this time (eg. there is a risk of deadlock).
3801 -+ * The callback must not return -1 if nr_to_scan is zero.
3802 - *
3803 - * The 'gfpmask' refers to the allocation we are currently trying to
3804 - * fulfil.
3805 -diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
3806 -index aa57d5d..b5f4742 100644
3807 ---- a/kernel/irq/spurious.c
3808 -+++ b/kernel/irq/spurious.c
3809 -@@ -115,7 +115,7 @@ static int misrouted_irq(int irq)
3810 - struct irq_desc *desc;
3811 - int i, ok = 0;
3812 -
3813 -- if (atomic_inc_return(&irq_poll_active) == 1)
3814 -+ if (atomic_inc_return(&irq_poll_active) != 1)
3815 - goto out;
3816 -
3817 - irq_poll_cpu = smp_processor_id();
3818 -diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
3819 -index fb6931d..d58fd8b 100644
3820 ---- a/net/batman-adv/translation-table.c
3821 -+++ b/net/batman-adv/translation-table.c
3822 -@@ -137,10 +137,22 @@ static void tt_local_entry_free_ref(struct tt_local_entry *tt_local_entry)
3823 - kfree_rcu(tt_local_entry, rcu);
3824 - }
3825 -
3826 -+static void tt_global_entry_free_rcu(struct rcu_head *rcu)
3827 -+{
3828 -+ struct tt_global_entry *tt_global_entry;
3829 -+
3830 -+ tt_global_entry = container_of(rcu, struct tt_global_entry, rcu);
3831 -+
3832 -+ if (tt_global_entry->orig_node)
3833 -+ orig_node_free_ref(tt_global_entry->orig_node);
3834 -+
3835 -+ kfree(tt_global_entry);
3836 -+}
3837 -+
3838 - static void tt_global_entry_free_ref(struct tt_global_entry *tt_global_entry)
3839 - {
3840 - if (atomic_dec_and_test(&tt_global_entry->refcount))
3841 -- kfree_rcu(tt_global_entry, rcu);
3842 -+ call_rcu(&tt_global_entry->rcu, tt_global_entry_free_rcu);
3843 - }
3844 -
3845 - static void tt_local_event(struct bat_priv *bat_priv, const uint8_t *addr,
3846 -@@ -686,6 +698,9 @@ void tt_global_del_orig(struct bat_priv *bat_priv,
3847 - struct hlist_head *head;
3848 - spinlock_t *list_lock; /* protects write access to the hash lists */
3849 -
3850 -+ if (!hash)
3851 -+ return;
3852 -+
3853 - for (i = 0; i < hash->size; i++) {
3854 - head = &hash->table[i];
3855 - list_lock = &hash->list_locks[i];
3856 -@@ -999,7 +1014,6 @@ static struct sk_buff *tt_response_fill_table(uint16_t tt_len, uint8_t ttvn,
3857 - tt_response = (struct tt_query_packet *)skb_put(skb,
3858 - tt_query_size + tt_len);
3859 - tt_response->ttvn = ttvn;
3860 -- tt_response->tt_data = htons(tt_tot);
3861 -
3862 - tt_change = (struct tt_change *)(skb->data + tt_query_size);
3863 - tt_count = 0;
3864 -@@ -1025,6 +1039,10 @@ static struct sk_buff *tt_response_fill_table(uint16_t tt_len, uint8_t ttvn,
3865 - }
3866 - rcu_read_unlock();
3867 -
3868 -+ /* store in the message the number of entries we have successfully
3869 -+ * copied */
3870 -+ tt_response->tt_data = htons(tt_count);
3871 -+
3872 - out:
3873 - return skb;
3874 - }
3875 -@@ -1668,6 +1686,8 @@ static void tt_local_reset_flags(struct bat_priv *bat_priv, uint16_t flags)
3876 - rcu_read_lock();
3877 - hlist_for_each_entry_rcu(tt_local_entry, node,
3878 - head, hash_entry) {
3879 -+ if (!(tt_local_entry->flags & flags))
3880 -+ continue;
3881 - tt_local_entry->flags &= ~flags;
3882 - atomic_inc(&bat_priv->num_local_tt);
3883 - }
3884 -diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
3885 -index 25bd1db..51a0db7 100644
3886 ---- a/net/batman-adv/types.h
3887 -+++ b/net/batman-adv/types.h
3888 -@@ -223,22 +223,22 @@ struct socket_packet {
3889 -
3890 - struct tt_local_entry {
3891 - uint8_t addr[ETH_ALEN];
3892 -+ struct hlist_node hash_entry;
3893 - unsigned long last_seen;
3894 - uint16_t flags;
3895 - atomic_t refcount;
3896 - struct rcu_head rcu;
3897 -- struct hlist_node hash_entry;
3898 - };
3899 -
3900 - struct tt_global_entry {
3901 - uint8_t addr[ETH_ALEN];
3902 -+ struct hlist_node hash_entry; /* entry in the global table */
3903 - struct orig_node *orig_node;
3904 - uint8_t ttvn;
3905 - uint16_t flags; /* only TT_GLOBAL_ROAM is used */
3906 - unsigned long roam_at; /* time at which TT_GLOBAL_ROAM was set */
3907 - atomic_t refcount;
3908 - struct rcu_head rcu;
3909 -- struct hlist_node hash_entry; /* entry in the global table */
3910 - };
3911 -
3912 - struct tt_change_node {
3913 -diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
3914 -index 0bc9888..4e6922f 100644
3915 ---- a/net/ipv6/ip6_tunnel.c
3916 -+++ b/net/ipv6/ip6_tunnel.c
3917 -@@ -289,6 +289,8 @@ static struct ip6_tnl *ip6_tnl_create(struct net *net, struct ip6_tnl_parm *p)
3918 - if ((err = register_netdevice(dev)) < 0)
3919 - goto failed_free;
3920 -
3921 -+ strcpy(t->parms.name, dev->name);
3922 -+
3923 - dev_hold(dev);
3924 - ip6_tnl_link(ip6n, t);
3925 - return t;
3926 -@@ -1397,7 +1399,6 @@ ip6_tnl_dev_init_gen(struct net_device *dev)
3927 - struct ip6_tnl *t = netdev_priv(dev);
3928 -
3929 - t->dev = dev;
3930 -- strcpy(t->parms.name, dev->name);
3931 - dev->tstats = alloc_percpu(struct pcpu_tstats);
3932 - if (!dev->tstats)
3933 - return -ENOMEM;
3934 -@@ -1477,6 +1478,7 @@ static void __net_exit ip6_tnl_destroy_tunnels(struct ip6_tnl_net *ip6n)
3935 - static int __net_init ip6_tnl_init_net(struct net *net)
3936 - {
3937 - struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id);
3938 -+ struct ip6_tnl *t = NULL;
3939 - int err;
3940 -
3941 - ip6n->tnls[0] = ip6n->tnls_wc;
3942 -@@ -1497,6 +1499,10 @@ static int __net_init ip6_tnl_init_net(struct net *net)
3943 - err = register_netdev(ip6n->fb_tnl_dev);
3944 - if (err < 0)
3945 - goto err_register;
3946 -+
3947 -+ t = netdev_priv(ip6n->fb_tnl_dev);
3948 -+
3949 -+ strcpy(t->parms.name, ip6n->fb_tnl_dev->name);
3950 - return 0;
3951 -
3952 - err_register:
3953 -diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
3954 -index fe2c2a7..a961003 100644
3955 ---- a/net/mac80211/rx.c
3956 -+++ b/net/mac80211/rx.c
3957 -@@ -140,8 +140,9 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
3958 - pos++;
3959 -
3960 - /* IEEE80211_RADIOTAP_RATE */
3961 -- if (status->flag & RX_FLAG_HT) {
3962 -+ if (!rate || status->flag & RX_FLAG_HT) {
3963 - /*
3964 -+ * Without rate information don't add it. If we have,
3965 - * MCS information is a separate field in radiotap,
3966 - * added below. The byte here is needed as padding
3967 - * for the channel though, so initialise it to 0.
3968 -@@ -162,12 +163,14 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
3969 - else if (status->flag & RX_FLAG_HT)
3970 - put_unaligned_le16(IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ,
3971 - pos);
3972 -- else if (rate->flags & IEEE80211_RATE_ERP_G)
3973 -+ else if (rate && rate->flags & IEEE80211_RATE_ERP_G)
3974 - put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ,
3975 - pos);
3976 -- else
3977 -+ else if (rate)
3978 - put_unaligned_le16(IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ,
3979 - pos);
3980 -+ else
3981 -+ put_unaligned_le16(IEEE80211_CHAN_2GHZ, pos);
3982 - pos += 2;
3983 -
3984 - /* IEEE80211_RADIOTAP_DBM_ANTSIGNAL */
3985 -diff --git a/net/mac80211/util.c b/net/mac80211/util.c
3986 -index ddeb1b9..fd031e8 100644
3987 ---- a/net/mac80211/util.c
3988 -+++ b/net/mac80211/util.c
3989 -@@ -1055,6 +1055,8 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
3990 - skb = ieee80211_probereq_get(&local->hw, &sdata->vif,
3991 - ssid, ssid_len,
3992 - buf, buf_len);
3993 -+ if (!skb)
3994 -+ goto out;
3995 -
3996 - if (dst) {
3997 - mgmt = (struct ieee80211_mgmt *) skb->data;
3998 -@@ -1063,6 +1065,8 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
3999 - }
4000 -
4001 - IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
4002 -+
4003 -+ out:
4004 - kfree(buf);
4005 -
4006 - return skb;
4007 -diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
4008 -index ea40d54..1308050 100644
4009 ---- a/net/wireless/nl80211.c
4010 -+++ b/net/wireless/nl80211.c
4011 -@@ -126,8 +126,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
4012 - [NL80211_ATTR_MESH_CONFIG] = { .type = NLA_NESTED },
4013 - [NL80211_ATTR_SUPPORT_MESH_AUTH] = { .type = NLA_FLAG },
4014 -
4015 -- [NL80211_ATTR_HT_CAPABILITY] = { .type = NLA_BINARY,
4016 -- .len = NL80211_HT_CAPABILITY_LEN },
4017 -+ [NL80211_ATTR_HT_CAPABILITY] = { .len = NL80211_HT_CAPABILITY_LEN },
4018 -
4019 - [NL80211_ATTR_MGMT_SUBTYPE] = { .type = NLA_U8 },
4020 - [NL80211_ATTR_IE] = { .type = NLA_BINARY,
4021 -diff --git a/net/wireless/reg.c b/net/wireless/reg.c
4022 -index 68a471b..1658eff 100644
4023 ---- a/net/wireless/reg.c
4024 -+++ b/net/wireless/reg.c
4025 -@@ -2254,6 +2254,9 @@ void /* __init_or_exit */ regulatory_exit(void)
4026 -
4027 - kfree(last_request);
4028 -
4029 -+ last_request = NULL;
4030 -+ dev_set_uevent_suppress(&reg_pdev->dev, true);
4031 -+
4032 - platform_device_unregister(reg_pdev);
4033 -
4034 - spin_lock_bh(&reg_pending_beacons_lock);
4035 -diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c
4036 -index c34f730..44f199c 100644
4037 ---- a/sound/pci/hda/hda_eld.c
4038 -+++ b/sound/pci/hda/hda_eld.c
4039 -@@ -297,10 +297,10 @@ static int hdmi_update_eld(struct hdmi_eld *e,
4040 - buf + ELD_FIXED_BYTES + mnl + 3 * i);
4041 - }
4042 -
4043 -+ e->eld_valid = true;
4044 - return 0;
4045 -
4046 - out_fail:
4047 -- e->eld_ver = 0;
4048 - return -EINVAL;
4049 - }
4050 -
4051 -@@ -318,9 +318,6 @@ int snd_hdmi_get_eld(struct hdmi_eld *eld,
4052 - int size;
4053 - unsigned char *buf;
4054 -
4055 -- if (!eld->eld_valid)
4056 -- return -ENOENT;
4057 --
4058 - size = snd_hdmi_get_eld_size(codec, nid);
4059 - if (size == 0) {
4060 - /* wfg: workaround for ASUS P5E-VM HDMI board */
4061 -diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
4062 -index c45f3e6..4346ad2 100644
4063 ---- a/sound/pci/hda/patch_cirrus.c
4064 -+++ b/sound/pci/hda/patch_cirrus.c
4065 -@@ -236,6 +236,15 @@ static int cs_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
4066 - return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
4067 - }
4068 -
4069 -+static void cs_update_input_select(struct hda_codec *codec)
4070 -+{
4071 -+ struct cs_spec *spec = codec->spec;
4072 -+ if (spec->cur_adc)
4073 -+ snd_hda_codec_write(codec, spec->cur_adc, 0,
4074 -+ AC_VERB_SET_CONNECT_SEL,
4075 -+ spec->adc_idx[spec->cur_input]);
4076 -+}
4077 -+
4078 - /*
4079 - * Analog capture
4080 - */
4081 -@@ -249,6 +258,7 @@ static int cs_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
4082 - spec->cur_adc = spec->adc_nid[spec->cur_input];
4083 - spec->cur_adc_stream_tag = stream_tag;
4084 - spec->cur_adc_format = format;
4085 -+ cs_update_input_select(codec);
4086 - snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format);
4087 - return 0;
4088 - }
4089 -@@ -688,10 +698,8 @@ static int change_cur_input(struct hda_codec *codec, unsigned int idx,
4090 - spec->cur_adc_stream_tag, 0,
4091 - spec->cur_adc_format);
4092 - }
4093 -- snd_hda_codec_write(codec, spec->cur_adc, 0,
4094 -- AC_VERB_SET_CONNECT_SEL,
4095 -- spec->adc_idx[idx]);
4096 - spec->cur_input = idx;
4097 -+ cs_update_input_select(codec);
4098 - return 1;
4099 - }
4100 -
4101 -@@ -972,10 +980,7 @@ static void cs_automic(struct hda_codec *codec)
4102 - } else {
4103 - spec->cur_input = spec->last_input;
4104 - }
4105 --
4106 -- snd_hda_codec_write_cache(codec, spec->cur_adc, 0,
4107 -- AC_VERB_SET_CONNECT_SEL,
4108 -- spec->adc_idx[spec->cur_input]);
4109 -+ cs_update_input_select(codec);
4110 - } else {
4111 - if (present)
4112 - change_cur_input(codec, spec->automic_idx, 0);
4113 -@@ -1072,9 +1077,7 @@ static void init_input(struct hda_codec *codec)
4114 - cs_automic(codec);
4115 - else {
4116 - spec->cur_adc = spec->adc_nid[spec->cur_input];
4117 -- snd_hda_codec_write(codec, spec->cur_adc, 0,
4118 -- AC_VERB_SET_CONNECT_SEL,
4119 -- spec->adc_idx[spec->cur_input]);
4120 -+ cs_update_input_select(codec);
4121 - }
4122 - } else {
4123 - change_cur_input(codec, spec->cur_input, 1);
4124 -diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
4125 -index 19cb72d..e287015 100644
4126 ---- a/sound/pci/hda/patch_hdmi.c
4127 -+++ b/sound/pci/hda/patch_hdmi.c
4128 -@@ -920,20 +920,23 @@ static void hdmi_present_sense(struct hda_codec *codec, hda_nid_t pin_nid,
4129 - * the unsolicited response to avoid custom WARs.
4130 - */
4131 - int present = snd_hda_pin_sense(codec, pin_nid);
4132 -+ bool eld_valid = false;
4133 -
4134 -- memset(eld, 0, sizeof(*eld));
4135 -+#ifdef CONFIG_PROC_FS
4136 -+ memset(eld, 0, offsetof(struct hdmi_eld, proc_entry));
4137 -+#else
4138 -+ memset(eld, 0, sizeof(struct hdmi_eld));
4139 -+#endif
4140 -
4141 - eld->monitor_present = !!(present & AC_PINSENSE_PRESENCE);
4142 - if (eld->monitor_present)
4143 -- eld->eld_valid = !!(present & AC_PINSENSE_ELDV);
4144 -- else
4145 -- eld->eld_valid = 0;
4146 -+ eld_valid = !!(present & AC_PINSENSE_ELDV);
4147 -
4148 - printk(KERN_INFO
4149 - "HDMI status: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n",
4150 -- codec->addr, pin_nid, eld->monitor_present, eld->eld_valid);
4151 -+ codec->addr, pin_nid, eld->monitor_present, eld_valid);
4152 -
4153 -- if (eld->eld_valid)
4154 -+ if (eld_valid)
4155 - if (!snd_hdmi_get_eld(eld, codec, pin_nid))
4156 - snd_hdmi_show_eld(eld);
4157 -