Gentoo Archives: gentoo-commits

From: "Tom Wijsman (tomwij)" <tomwij@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] linux-patches r2300 - in genpatches-2.6/trunk: 3.7 3.8
Date: Thu, 28 Feb 2013 23:25:11
Message-Id: 20130228232502.888572171D@flycatcher.gentoo.org
1 Author: tomwij
2 Date: 2013-02-28 23:23:58 +0000 (Thu, 28 Feb 2013)
3 New Revision: 2300
4
5 Added:
6 genpatches-2.6/trunk/3.8/1000_linux-3.8.1.patch
7 Modified:
8 genpatches-2.6/trunk/3.7/4200_fbcondecor-0.9.6.patch
9 genpatches-2.6/trunk/3.8/0000_README
10 genpatches-2.6/trunk/3.8/4200_fbcondecor-0.9.6.patch
11 Log:
12 Linux patch 3.8.1. Updated fbcondecor-0.9.6 to properly work with the 3.7 and 3.8 kernel branches according to bug #459060.
13
14 Modified: genpatches-2.6/trunk/3.7/4200_fbcondecor-0.9.6.patch
15 ===================================================================
16 --- genpatches-2.6/trunk/3.7/4200_fbcondecor-0.9.6.patch 2013-02-28 20:58:06 UTC (rev 2299)
17 +++ genpatches-2.6/trunk/3.7/4200_fbcondecor-0.9.6.patch 2013-02-28 23:23:58 UTC (rev 2300)
18 @@ -228,8 +228,7 @@
19 index 95952c8..b55db6d 100644
20 --- a/drivers/Makefile
21 +++ b/drivers/Makefile
22 -@@ -11,6 +11,10 @@ obj-y += gpio/
23 - obj-$(CONFIG_PCI) += pci/
24 +@@ -16,4 +16,8 @@ obj-$(CONFIG_PCI) += pci/
25 obj-$(CONFIG_PARISC) += parisc/
26 obj-$(CONFIG_RAPIDIO) += rapidio/
27 +# tty/ comes before char/ so that the VT console is the boot-time
28 @@ -238,8 +237,7 @@
29 +obj-y += char/
30 obj-y += video/
31 obj-y += idle/
32 - obj-$(CONFIG_ACPI) += acpi/
33 -@@ -29,11 +33,6 @@ obj-$(CONFIG_XEN) += xen/
34 +@@ -37,11 +41,6 @@ obj-$(CONFIG_XEN) += xen/
35 # regulators early, since some subsystems rely on them to initialize
36 obj-$(CONFIG_REGULATOR) += regulator/
37
38 @@ -255,7 +253,7 @@
39 index a290be5..3a4ca32 100644
40 --- a/drivers/video/Kconfig
41 +++ b/drivers/video/Kconfig
42 -@@ -1241,7 +1241,6 @@ config FB_MATROX
43 +@@ -1229,7 +1229,6 @@ config FB_MATROX
44 select FB_CFB_FILLRECT
45 select FB_CFB_COPYAREA
46 select FB_CFB_IMAGEBLIT
47 @@ -870,7 +868,7 @@
48 u16 c, int is_fg)
49 {
50 int depth = fb_get_color_depth(&info->var, &info->fix);
51 -@@ -458,7 +459,7 @@ static int __init fb_console_setup(char *this_opt)
52 +@@ -465,7 +466,7 @@ static int __init fb_console_setup(char *this_opt)
53 } else
54 return 1;
55 }
56 @@ -879,7 +877,7 @@
57 if (!strncmp(options, "map:", 4)) {
58 options += 4;
59 if (*options) {
60 -@@ -483,8 +484,8 @@ static int __init fb_console_setup(char *this_opt)
61 +@@ -490,8 +491,8 @@ static int __init fb_console_setup(char *this_opt)
62 first_fb_vc = 0;
63 if (*options++ == '-')
64 last_fb_vc = simple_strtoul(options, &options, 10) - 1;
65 @@ -890,7 +888,7 @@
66
67 if (!strncmp(options, "rotate:", 7)) {
68 options += 7;
69 -@@ -545,6 +546,9 @@ static int fbcon_takeover(int show_logo)
70 +@@ -552,6 +553,9 @@ static int fbcon_takeover(int show_logo)
71 info_idx = -1;
72 } else {
73 fbcon_has_console_bind = 1;
74 @@ -900,7 +898,7 @@
75 }
76
77 return err;
78 -@@ -935,7 +939,7 @@ static const char *fbcon_startup(void)
79 +@@ -942,7 +946,7 @@ static const char *fbcon_startup(void)
80 info = registered_fb[info_idx];
81 if (!info)
82 return NULL;
83 @@ -909,7 +907,7 @@
84 owner = info->fbops->owner;
85 if (!try_module_get(owner))
86 return NULL;
87 -@@ -999,6 +1003,12 @@ static const char *fbcon_startup(void)
88 +@@ -1006,6 +1010,12 @@ static const char *fbcon_startup(void)
89 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
90 cols /= vc->vc_font.width;
91 rows /= vc->vc_font.height;
92 @@ -922,7 +920,7 @@
93 vc_resize(vc, cols, rows);
94
95 DPRINTK("mode: %s\n", info->fix.id);
96 -@@ -1028,7 +1038,7 @@ static void fbcon_init(struct vc_data *vc, int init)
97 +@@ -1035,7 +1045,7 @@ static void fbcon_init(struct vc_data *vc, int init)
98 cap = info->flags;
99
100 if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW ||
101 @@ -931,7 +929,7 @@
102 logo = 0;
103
104 if (var_to_display(p, &info->var, info))
105 -@@ -1238,6 +1248,11 @@ static void fbcon_clear(struct vc_data *vc, int sy, int sx, int height,
106 +@@ -1245,6 +1255,11 @@ static void fbcon_clear(struct vc_data *vc, int sy, int sx, int height,
107 if (sy < vc->vc_top && vc->vc_top == logo_lines)
108 vc->vc_top = 0;
109
110 @@ -943,7 +941,7 @@
111 /* Split blits that cross physical y_wrap boundary */
112
113 y_break = p->vrows - p->yscroll;
114 -@@ -1257,10 +1272,15 @@ static void fbcon_putcs(struct vc_data *vc, const unsigned short *s,
115 +@@ -1264,10 +1279,15 @@ static void fbcon_putcs(struct vc_data *vc, const unsigned short *s,
116 struct display *p = &fb_display[vc->vc_num];
117 struct fbcon_ops *ops = info->fbcon_par;
118
119 @@ -963,7 +961,7 @@
120 }
121
122 static void fbcon_putc(struct vc_data *vc, int c, int ypos, int xpos)
123 -@@ -1276,8 +1296,13 @@ static void fbcon_clear_margins(struct vc_data *vc, int bottom_only)
124 +@@ -1283,8 +1303,13 @@ static void fbcon_clear_margins(struct vc_data *vc, int bottom_only)
125 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
126 struct fbcon_ops *ops = info->fbcon_par;
127
128 @@ -979,7 +977,7 @@
129 }
130
131 static void fbcon_cursor(struct vc_data *vc, int mode)
132 -@@ -1387,7 +1412,7 @@ static __inline__ void ywrap_up(struct vc_data *vc, int count)
133 +@@ -1394,7 +1419,7 @@ static __inline__ void ywrap_up(struct vc_data *vc, int count)
134 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
135 struct fbcon_ops *ops = info->fbcon_par;
136 struct display *p = &fb_display[vc->vc_num];
137 @@ -988,7 +986,7 @@
138 p->yscroll += count;
139 if (p->yscroll >= p->vrows) /* Deal with wrap */
140 p->yscroll -= p->vrows;
141 -@@ -1406,7 +1431,7 @@ static __inline__ void ywrap_down(struct vc_data *vc, int count)
142 +@@ -1413,7 +1438,7 @@ static __inline__ void ywrap_down(struct vc_data *vc, int count)
143 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
144 struct fbcon_ops *ops = info->fbcon_par;
145 struct display *p = &fb_display[vc->vc_num];
146 @@ -997,7 +995,7 @@
147 p->yscroll -= count;
148 if (p->yscroll < 0) /* Deal with wrap */
149 p->yscroll += p->vrows;
150 -@@ -1473,7 +1498,7 @@ static __inline__ void ypan_down(struct vc_data *vc, int count)
151 +@@ -1480,7 +1505,7 @@ static __inline__ void ypan_down(struct vc_data *vc, int count)
152 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
153 struct display *p = &fb_display[vc->vc_num];
154 struct fbcon_ops *ops = info->fbcon_par;
155 @@ -1006,7 +1004,7 @@
156 p->yscroll -= count;
157 if (p->yscroll < 0) {
158 ops->bmove(vc, info, 0, 0, p->vrows - vc->vc_rows,
159 -@@ -1797,7 +1822,7 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
160 +@@ -1804,7 +1829,7 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
161 count = vc->vc_rows;
162 if (softback_top)
163 fbcon_softback_note(vc, t, count);
164 @@ -1015,7 +1013,7 @@
165 goto redraw_up;
166 switch (p->scrollmode) {
167 case SCROLL_MOVE:
168 -@@ -1890,6 +1915,8 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
169 +@@ -1897,6 +1922,8 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
170 count = vc->vc_rows;
171 if (logo_shown >= 0)
172 goto redraw_down;
173 @@ -1024,7 +1022,7 @@
174 switch (p->scrollmode) {
175 case SCROLL_MOVE:
176 fbcon_redraw_blit(vc, info, p, b - 1, b - t - count,
177 -@@ -1982,7 +2009,7 @@ static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
178 +@@ -1989,7 +2016,7 @@ static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
179 {
180 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
181 struct display *p = &fb_display[vc->vc_num];
182 @@ -1033,7 +1031,7 @@
183 if (fbcon_is_inactive(vc, info))
184 return;
185
186 -@@ -2000,7 +2027,7 @@ static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
187 +@@ -2007,7 +2034,7 @@ static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
188 p->vrows - p->yscroll);
189 }
190
191 @@ -1042,7 +1040,7 @@
192 int dy, int dx, int height, int width, u_int y_break)
193 {
194 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
195 -@@ -2038,6 +2065,13 @@ static void fbcon_bmove_rec(struct vc_data *vc, struct display *p, int sy, int s
196 +@@ -2045,6 +2072,13 @@ static void fbcon_bmove_rec(struct vc_data *vc, struct display *p, int sy, int s
197 }
198 return;
199 }
200 @@ -1056,7 +1054,7 @@
201 ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx,
202 height, width);
203 }
204 -@@ -2089,7 +2123,7 @@ static void updatescrollmode(struct display *p,
205 +@@ -2096,7 +2130,7 @@ static void updatescrollmode(struct display *p,
206 }
207 }
208
209 @@ -1065,7 +1063,7 @@
210 unsigned int height, unsigned int user)
211 {
212 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
213 -@@ -2108,8 +2142,8 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width,
214 +@@ -2115,8 +2149,8 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width,
215 var.yres = virt_h * virt_fh;
216 x_diff = info->var.xres - var.xres;
217 y_diff = info->var.yres - var.yres;
218 @@ -1076,7 +1074,7 @@
219 const struct fb_videomode *mode;
220
221 DPRINTK("attempting resize %ix%i\n", var.xres, var.yres);
222 -@@ -2145,6 +2179,21 @@ static int fbcon_switch(struct vc_data *vc)
223 +@@ -2152,6 +2186,21 @@ static int fbcon_switch(struct vc_data *vc)
224
225 info = registered_fb[con2fb_map[vc->vc_num]];
226 ops = info->fbcon_par;
227 @@ -1098,7 +1096,7 @@
228
229 if (softback_top) {
230 if (softback_lines)
231 -@@ -2163,9 +2212,6 @@ static int fbcon_switch(struct vc_data *vc)
232 +@@ -2170,9 +2219,6 @@ static int fbcon_switch(struct vc_data *vc)
233 logo_shown = FBCON_LOGO_CANSHOW;
234 }
235
236 @@ -1108,7 +1106,7 @@
237 /*
238 * FIXME: If we have multiple fbdev's loaded, we need to
239 * update all info->currcon. Perhaps, we can place this
240 -@@ -2209,6 +2255,18 @@ static int fbcon_switch(struct vc_data *vc)
241 +@@ -2216,6 +2262,18 @@ static int fbcon_switch(struct vc_data *vc)
242 fbcon_del_cursor_timer(old_info);
243 }
244
245 @@ -1127,7 +1125,7 @@
246 if (fbcon_is_inactive(vc, info) ||
247 ops->blank_state != FB_BLANK_UNBLANK)
248 fbcon_del_cursor_timer(info);
249 -@@ -2257,11 +2315,10 @@ static int fbcon_switch(struct vc_data *vc)
250 +@@ -2264,11 +2322,10 @@ static int fbcon_switch(struct vc_data *vc)
251 ops->update_start(info);
252 }
253
254 @@ -1140,7 +1138,7 @@
255 logo_shown = fg_console;
256 /* This is protected above by initmem_freed */
257 fb_show_logo(info, ops->rotate);
258 -@@ -2317,15 +2374,20 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch)
259 +@@ -2324,15 +2381,20 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch)
260 }
261 }
262
263 @@ -1165,7 +1163,7 @@
264 }
265
266 if (!blank)
267 -@@ -2447,7 +2509,7 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
268 +@@ -2454,7 +2516,7 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
269 vc->vc_complement_mask >>= 1;
270 vc->vc_s_complement_mask >>= 1;
271 }
272 @@ -1174,7 +1172,7 @@
273 /* ++Edmund: reorder the attribute bits */
274 if (vc->vc_can_do_color) {
275 unsigned short *cp =
276 -@@ -2470,7 +2532,7 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
277 +@@ -2477,7 +2539,7 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
278 vc->vc_complement_mask <<= 1;
279 vc->vc_s_complement_mask <<= 1;
280 }
281 @@ -1183,7 +1181,7 @@
282 /* ++Edmund: reorder the attribute bits */
283 {
284 unsigned short *cp =
285 -@@ -2500,13 +2562,22 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
286 +@@ -2507,13 +2569,22 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
287 }
288
289 if (resize) {
290 @@ -1206,7 +1204,7 @@
291 if (CON_IS_VISIBLE(vc) && softback_buf)
292 fbcon_update_softback(vc);
293 } else if (CON_IS_VISIBLE(vc)
294 -@@ -2590,7 +2661,7 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font, unsigne
295 +@@ -2597,7 +2661,7 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font, unsigne
296 /* Check if the same font is on some other console already */
297 for (i = first_fb_vc; i <= last_fb_vc; i++) {
298 struct vc_data *tmp = vc_cons[i].d;
299 @@ -1215,7 +1213,7 @@
300 if (fb_display[i].userfont &&
301 fb_display[i].fontdata &&
302 FNTSUM(fb_display[i].fontdata) == csum &&
303 -@@ -2635,7 +2706,11 @@ static int fbcon_set_palette(struct vc_data *vc, unsigned char *table)
304 +@@ -2642,7 +2713,11 @@ static int fbcon_set_palette(struct vc_data *vc, unsigned char *table)
305 int i, j, k, depth;
306 u8 val;
307
308 @@ -1228,7 +1226,7 @@
309 return -EINVAL;
310
311 if (!CON_IS_VISIBLE(vc))
312 -@@ -2661,14 +2736,56 @@ static int fbcon_set_palette(struct vc_data *vc, unsigned char *table)
313 +@@ -2668,14 +2743,56 @@ static int fbcon_set_palette(struct vc_data *vc, unsigned char *table)
314 } else
315 fb_copy_cmap(fb_default_cmap(1 << depth), &palette_cmap);
316
317 @@ -1287,7 +1285,7 @@
318 if (vc->vc_num != fg_console || !softback_lines)
319 return (u16 *) (vc->vc_origin + offset);
320 line = offset / vc->vc_size_row;
321 -@@ -2887,7 +3004,14 @@ static void fbcon_modechanged(struct fb_info *info)
322 +@@ -2894,7 +3011,14 @@ static void fbcon_modechanged(struct fb_info *info)
323 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
324 cols /= vc->vc_font.width;
325 rows /= vc->vc_font.height;
326 @@ -1303,7 +1301,7 @@
327 updatescrollmode(p, info, vc);
328 scrollback_max = 0;
329 scrollback_current = 0;
330 -@@ -2932,7 +3056,9 @@ static void fbcon_set_all_vcs(struct fb_info *info)
331 +@@ -2939,7 +3063,9 @@ static void fbcon_set_all_vcs(struct fb_info *info)
332 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
333 cols /= vc->vc_font.width;
334 rows /= vc->vc_font.height;
335 @@ -1314,7 +1312,7 @@
336 }
337
338 if (fg != -1)
339 -@@ -3542,6 +3668,7 @@ static void fbcon_exit(void)
340 +@@ -3549,6 +3675,7 @@ static void fbcon_exit(void)
341 }
342 }
343
344 @@ -1322,7 +1320,7 @@
345 fbcon_has_exited = 1;
346 }
347
348 -@@ -3595,7 +3722,7 @@ static void __exit fb_console_exit(void)
349 +@@ -3602,7 +3729,7 @@ static void __exit fb_console_exit(void)
350 fbcon_exit();
351 console_unlock();
352 unregister_con_driver(&fb_con);
353 @@ -2014,7 +2012,7 @@
354 index c6ce416..7ce6640 100644
355 --- a/drivers/video/fbmem.c
356 +++ b/drivers/video/fbmem.c
357 -@@ -1222,15 +1222,6 @@ struct fb_fix_screeninfo32 {
358 +@@ -1231,15 +1231,6 @@ struct fb_fix_screeninfo32 {
359 u16 reserved[3];
360 };
361
362 @@ -2107,7 +2105,7 @@
363 index d31cb68..ad161bb 100644
364 --- a/include/uapi/linux/fb.h
365 +++ b/include/uapi/linux/fb.h
366 -@@ -11,6 +11,25 @@
367 +@@ -8,6 +8,25 @@
368
369 #define FB_MAX 32 /* sufficient for now */
370
371 @@ -2133,7 +2131,7 @@
372 /* ioctls
373 0x46 is 'F' */
374 #define FBIOGET_VSCREENINFO 0x4600
375 -@@ -39,6 +58,24 @@
376 +@@ -34,6 +53,24 @@
377 #define FBIOPUT_MODEINFO 0x4617
378 #define FBIOGET_DISPINFO 0x4618
379 #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
380 @@ -2158,7 +2156,7 @@
381
382 #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */
383 #define FB_TYPE_PLANES 1 /* Non interleaved planes */
384 -@@ -291,6 +328,28 @@ struct fb_cmap {
385 +@@ -286,6 +323,28 @@ struct fb_cmap {
386 __u16 *transp; /* transparency, can be NULL */
387 };
388
389 @@ -2187,11 +2185,7 @@
390 struct fb_con2fbmap {
391 __u32 console;
392 __u32 framebuffer;
393 -diff --git a/include/linux/fb.h b/include/linux/fb.h
394 -index d31cb68..ad161bb 100644
395 ---- a/include/linux/fb.h
396 -+++ b/include/linux/fb.h
397 -@@ -372,6 +431,34 @@ struct fb_image {
398 +@@ -367,6 +426,34 @@ struct fb_image {
399 struct fb_cmap cmap; /* color map info */
400 };
401
402 @@ -2226,8 +2220,12 @@
403 /*
404 * hardware cursor control
405 */
406 -@@ -881,6 +968,9 @@ struct fb_info {
407 - #define FBINFO_STATE_SUSPENDED 1
408 +
409 +diff --git a/include/linux/fb.h b/include/linux/fb.h
410 +index d31cb68..ad161bb 100644
411 +--- a/include/linux/fb.h
412 ++++ b/include/linux/fb.h
413 +@@ -488,5 +488,8 @@ #define FBINFO_STATE_SUSPENDED 1
414 u32 state; /* Hardware state i.e suspend */
415 void *fbcon_par; /* fbcon use-only private area */
416 +
417 @@ -2236,11 +2234,12 @@
418 /* From here on everything is device dependent */
419 void *par;
420 /* we need the PCI or similar aperture base/size not
421 +
422 diff --git a/kernel/sysctl.c b/kernel/sysctl.c
423 index 4ab1187..6561627 100644
424 --- a/kernel/sysctl.c
425 +++ b/kernel/sysctl.c
426 -@@ -142,6 +142,10 @@ static int min_percpu_pagelist_fract = 8;
427 +@@ -145,6 +145,10 @@ static int min_percpu_pagelist_fract = 8;
428 static int ngroups_max = NGROUPS_MAX;
429 static const int cap_last_cap = CAP_LAST_CAP;
430
431 @@ -2251,7 +2250,7 @@
432 #ifdef CONFIG_INOTIFY_USER
433 #include <linux/inotify.h>
434 #endif
435 -@@ -238,6 +242,15 @@ static struct ctl_table sysctl_base_table[] = {
436 +@@ -248,6 +252,15 @@ static struct ctl_table sysctl_base_table[] = {
437 .mode = 0555,
438 .child = dev_table,
439 },
440 @@ -2267,7 +2266,7 @@
441 { }
442 };
443
444 -@@ -1038,7 +1051,7 @@ static struct ctl_table vm_table[] = {
445 +@@ -1050,7 +1063,7 @@ static struct ctl_table vm_table[] = {
446 .proc_handler = proc_dointvec,
447 },
448 {
449 @@ -2276,7 +2275,7 @@
450 .data = &page_cluster,
451 .maxlen = sizeof(int),
452 .mode = 0644,
453 -@@ -1484,7 +1497,7 @@ static struct ctl_table fs_table[] = {
454 +@@ -1494,7 +1507,7 @@ static struct ctl_table fs_table[] = {
455 .mode = 0555,
456 .child = inotify_table,
457 },
458 @@ -2285,7 +2284,7 @@
459 #ifdef CONFIG_EPOLL
460 {
461 .procname = "epoll",
462 -@@ -1802,12 +1815,12 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
463 +@@ -1832,12 +1845,12 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
464 unsigned long page = 0;
465 size_t left;
466 char *kbuf;
467 @@ -2300,7 +2299,7 @@
468 i = (int *) tbl_data;
469 vleft = table->maxlen / sizeof(*i);
470 left = *lenp;
471 -@@ -1896,7 +1909,7 @@ static int do_proc_dointvec(struct ctl_table *table, int write,
472 +@@ -1926,7 +1939,7 @@ static int do_proc_dointvec(struct ctl_table *table, int write,
473 * @ppos: file position
474 *
475 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
476 @@ -2309,7 +2308,7 @@
477 *
478 * Returns 0 on success.
479 */
480 -@@ -2223,7 +2236,7 @@ static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
481 +@@ -2285,7 +2298,7 @@ static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
482 * @ppos: file position
483 *
484 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
485 @@ -2318,7 +2317,7 @@
486 * The values read are assumed to be in seconds, and are converted into
487 * jiffies.
488 *
489 -@@ -2245,8 +2258,8 @@ int proc_dointvec_jiffies(struct ctl_table *table, int write,
490 +@@ -2307,8 +2320,8 @@ int proc_dointvec_jiffies(struct ctl_table *table, int write,
491 * @ppos: pointer to the file position
492 *
493 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
494 @@ -2329,7 +2328,7 @@
495 * are converted into jiffies.
496 *
497 * Returns 0 on success.
498 -@@ -2268,8 +2281,8 @@ int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
499 +@@ -2330,8 +2343,8 @@ int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
500 * @ppos: the current position in the file
501 *
502 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
503
504 Modified: genpatches-2.6/trunk/3.8/0000_README
505 ===================================================================
506 --- genpatches-2.6/trunk/3.8/0000_README 2013-02-28 20:58:06 UTC (rev 2299)
507 +++ genpatches-2.6/trunk/3.8/0000_README 2013-02-28 23:23:58 UTC (rev 2300)
508 @@ -39,6 +39,10 @@
509
510 Individual Patch Descriptions:
511 --------------------------------------------------------------------------
512 +Patch: 1000_linux-3.8.1.patch
513 +From: http://www.kernel.org
514 +Desc: Linux 3.8.1
515 +
516 Patch: 1700_enable-thinkpad-micled.patch
517 From: https://bugs.gentoo.org/show_bug.cgi?id=449248
518 Desc: Enable mic mute led in thinkpads
519
520 Added: genpatches-2.6/trunk/3.8/1000_linux-3.8.1.patch
521 ===================================================================
522 --- genpatches-2.6/trunk/3.8/1000_linux-3.8.1.patch (rev 0)
523 +++ genpatches-2.6/trunk/3.8/1000_linux-3.8.1.patch 2013-02-28 23:23:58 UTC (rev 2300)
524 @@ -0,0 +1,6680 @@
525 +diff --git a/Makefile b/Makefile
526 +index d69266c..746c856 100644
527 +--- a/Makefile
528 ++++ b/Makefile
529 +@@ -1,6 +1,6 @@
530 + VERSION = 3
531 + PATCHLEVEL = 8
532 +-SUBLEVEL = 0
533 ++SUBLEVEL = 1
534 + EXTRAVERSION =
535 + NAME = Unicycling Gorilla
536 +
537 +diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi
538 +index 80e29c6..4801717 100644
539 +--- a/arch/arm/boot/dts/at91sam9n12.dtsi
540 ++++ b/arch/arm/boot/dts/at91sam9n12.dtsi
541 +@@ -324,8 +324,6 @@
542 + compatible = "atmel,at91sam9260-usart";
543 + reg = <0xf801c000 0x4000>;
544 + interrupts = <5 4 5>;
545 +- atmel,use-dma-rx;
546 +- atmel,use-dma-tx;
547 + pinctrl-names = "default";
548 + pinctrl-0 = <&pinctrl_usart0>;
549 + status = "disabled";
550 +@@ -335,8 +333,6 @@
551 + compatible = "atmel,at91sam9260-usart";
552 + reg = <0xf8020000 0x4000>;
553 + interrupts = <6 4 5>;
554 +- atmel,use-dma-rx;
555 +- atmel,use-dma-tx;
556 + pinctrl-names = "default";
557 + pinctrl-0 = <&pinctrl_usart1>;
558 + status = "disabled";
559 +@@ -346,8 +342,6 @@
560 + compatible = "atmel,at91sam9260-usart";
561 + reg = <0xf8024000 0x4000>;
562 + interrupts = <7 4 5>;
563 +- atmel,use-dma-rx;
564 +- atmel,use-dma-tx;
565 + pinctrl-names = "default";
566 + pinctrl-0 = <&pinctrl_usart2>;
567 + status = "disabled";
568 +@@ -357,8 +351,6 @@
569 + compatible = "atmel,at91sam9260-usart";
570 + reg = <0xf8028000 0x4000>;
571 + interrupts = <8 4 5>;
572 +- atmel,use-dma-rx;
573 +- atmel,use-dma-tx;
574 + pinctrl-names = "default";
575 + pinctrl-0 = <&pinctrl_usart3>;
576 + status = "disabled";
577 +diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
578 +index 8ecca69..c461e11 100644
579 +--- a/arch/arm/boot/dts/at91sam9x5.dtsi
580 ++++ b/arch/arm/boot/dts/at91sam9x5.dtsi
581 +@@ -402,8 +402,6 @@
582 + compatible = "atmel,at91sam9260-usart";
583 + reg = <0xf801c000 0x200>;
584 + interrupts = <5 4 5>;
585 +- atmel,use-dma-rx;
586 +- atmel,use-dma-tx;
587 + pinctrl-names = "default";
588 + pinctrl-0 = <&pinctrl_usart0>;
589 + status = "disabled";
590 +@@ -413,8 +411,6 @@
591 + compatible = "atmel,at91sam9260-usart";
592 + reg = <0xf8020000 0x200>;
593 + interrupts = <6 4 5>;
594 +- atmel,use-dma-rx;
595 +- atmel,use-dma-tx;
596 + pinctrl-names = "default";
597 + pinctrl-0 = <&pinctrl_usart1>;
598 + status = "disabled";
599 +@@ -424,8 +420,6 @@
600 + compatible = "atmel,at91sam9260-usart";
601 + reg = <0xf8024000 0x200>;
602 + interrupts = <7 4 5>;
603 +- atmel,use-dma-rx;
604 +- atmel,use-dma-tx;
605 + pinctrl-names = "default";
606 + pinctrl-0 = <&pinctrl_usart2>;
607 + status = "disabled";
608 +diff --git a/arch/arm/kernel/sched_clock.c b/arch/arm/kernel/sched_clock.c
609 +index fc6692e..bd6f56b 100644
610 +--- a/arch/arm/kernel/sched_clock.c
611 ++++ b/arch/arm/kernel/sched_clock.c
612 +@@ -93,11 +93,11 @@ static void notrace update_sched_clock(void)
613 + * detectable in cyc_to_fixed_sched_clock().
614 + */
615 + raw_local_irq_save(flags);
616 +- cd.epoch_cyc = cyc;
617 ++ cd.epoch_cyc_copy = cyc;
618 + smp_wmb();
619 + cd.epoch_ns = ns;
620 + smp_wmb();
621 +- cd.epoch_cyc_copy = cyc;
622 ++ cd.epoch_cyc = cyc;
623 + raw_local_irq_restore(flags);
624 + }
625 +
626 +diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c
627 +index 2c570cd..69858c7 100644
628 +--- a/arch/arm/mach-imx/clk-imx25.c
629 ++++ b/arch/arm/mach-imx/clk-imx25.c
630 +@@ -224,6 +224,9 @@ static int __init __mx25_clocks_init(unsigned long osc_rate)
631 +
632 + clk_prepare_enable(clk[emi_ahb]);
633 +
634 ++ /* Clock source for gpt must be derived from AHB */
635 ++ clk_set_parent(clk[per5_sel], clk[ahb]);
636 ++
637 + clk_register_clkdev(clk[ipg], "ipg", "imx-gpt.0");
638 + clk_register_clkdev(clk[gpt_ipg_per], "per", "imx-gpt.0");
639 +
640 +diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
641 +index 11e2a41..26762bf 100644
642 +--- a/arch/arm/mach-integrator/integrator_ap.c
643 ++++ b/arch/arm/mach-integrator/integrator_ap.c
644 +@@ -613,7 +613,6 @@ static struct map_desc ap_io_desc_atag[] __initdata = {
645 + static void __init ap_map_io_atag(void)
646 + {
647 + iotable_init(ap_io_desc_atag, ARRAY_SIZE(ap_io_desc_atag));
648 +- ap_syscon_base = __io_address(INTEGRATOR_SC_BASE);
649 + ap_map_io();
650 + }
651 +
652 +@@ -685,6 +684,7 @@ static void __init ap_init(void)
653 +
654 + platform_device_register(&cfi_flash_device);
655 +
656 ++ ap_syscon_base = __io_address(INTEGRATOR_SC_BASE);
657 + sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET);
658 + for (i = 0; i < 4; i++) {
659 + struct lm_device *lmdev;
660 +diff --git a/arch/arm/mach-pxa/include/mach/smemc.h b/arch/arm/mach-pxa/include/mach/smemc.h
661 +index b7de471..b802f28 100644
662 +--- a/arch/arm/mach-pxa/include/mach/smemc.h
663 ++++ b/arch/arm/mach-pxa/include/mach/smemc.h
664 +@@ -37,6 +37,7 @@
665 + #define CSADRCFG1 (SMEMC_VIRT + 0x84) /* Address Configuration Register for CS1 */
666 + #define CSADRCFG2 (SMEMC_VIRT + 0x88) /* Address Configuration Register for CS2 */
667 + #define CSADRCFG3 (SMEMC_VIRT + 0x8C) /* Address Configuration Register for CS3 */
668 ++#define CSMSADRCFG (SMEMC_VIRT + 0xA0) /* Chip Select Configuration Register */
669 +
670 + /*
671 + * More handy macros for PCMCIA
672 +diff --git a/arch/arm/mach-pxa/smemc.c b/arch/arm/mach-pxa/smemc.c
673 +index 7992305..f38aa89 100644
674 +--- a/arch/arm/mach-pxa/smemc.c
675 ++++ b/arch/arm/mach-pxa/smemc.c
676 +@@ -40,6 +40,8 @@ static void pxa3xx_smemc_resume(void)
677 + __raw_writel(csadrcfg[1], CSADRCFG1);
678 + __raw_writel(csadrcfg[2], CSADRCFG2);
679 + __raw_writel(csadrcfg[3], CSADRCFG3);
680 ++ /* CSMSADRCFG wakes up in its default state (0), so we need to set it */
681 ++ __raw_writel(0x2, CSMSADRCFG);
682 + }
683 +
684 + static struct syscore_ops smemc_syscore_ops = {
685 +@@ -49,8 +51,19 @@ static struct syscore_ops smemc_syscore_ops = {
686 +
687 + static int __init smemc_init(void)
688 + {
689 +- if (cpu_is_pxa3xx())
690 ++ if (cpu_is_pxa3xx()) {
691 ++ /*
692 ++ * The only documentation we have on the
693 ++ * Chip Select Configuration Register (CSMSADRCFG) is that
694 ++ * it must be programmed to 0x2.
695 ++ * Moreover, in the bit definitions, the second bit
696 ++ * (CSMSADRCFG[1]) is called "SETALWAYS".
697 ++ * Other bits are reserved in this register.
698 ++ */
699 ++ __raw_writel(0x2, CSMSADRCFG);
700 ++
701 + register_syscore_ops(&smemc_syscore_ops);
702 ++ }
703 +
704 + return 0;
705 + }
706 +diff --git a/arch/arm/mach-s3c24xx/include/mach/debug-macro.S b/arch/arm/mach-s3c24xx/include/mach/debug-macro.S
707 +index 4135de8..13ed33c 100644
708 +--- a/arch/arm/mach-s3c24xx/include/mach/debug-macro.S
709 ++++ b/arch/arm/mach-s3c24xx/include/mach/debug-macro.S
710 +@@ -40,17 +40,17 @@
711 + addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART)
712 + addne \rd, \rx, #(S3C24XX_VA_GPIO - S3C24XX_VA_UART)
713 + bic \rd, \rd, #0xff000
714 +- ldr \rd, [ \rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0) ]
715 ++ ldr \rd, [\rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0)]
716 + and \rd, \rd, #0x00ff0000
717 + teq \rd, #0x00440000 @ is it 2440?
718 + 1004:
719 +- ldr \rd, [ \rx, # S3C2410_UFSTAT ]
720 ++ ldr \rd, [\rx, # S3C2410_UFSTAT]
721 + moveq \rd, \rd, lsr #SHIFT_2440TXF
722 + tst \rd, #S3C2410_UFSTAT_TXFULL
723 + .endm
724 +
725 + .macro fifo_full_s3c2410 rd, rx
726 +- ldr \rd, [ \rx, # S3C2410_UFSTAT ]
727 ++ ldr \rd, [\rx, # S3C2410_UFSTAT]
728 + tst \rd, #S3C2410_UFSTAT_TXFULL
729 + .endm
730 +
731 +@@ -68,18 +68,18 @@
732 + addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART)
733 + addne \rd, \rx, #(S3C24XX_VA_GPIO - S3C24XX_VA_UART)
734 + bic \rd, \rd, #0xff000
735 +- ldr \rd, [ \rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0) ]
736 ++ ldr \rd, [\rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0)]
737 + and \rd, \rd, #0x00ff0000
738 + teq \rd, #0x00440000 @ is it 2440?
739 +
740 + 10000:
741 +- ldr \rd, [ \rx, # S3C2410_UFSTAT ]
742 ++ ldr \rd, [\rx, # S3C2410_UFSTAT]
743 + andne \rd, \rd, #S3C2410_UFSTAT_TXMASK
744 + andeq \rd, \rd, #S3C2440_UFSTAT_TXMASK
745 + .endm
746 +
747 + .macro fifo_level_s3c2410 rd, rx
748 +- ldr \rd, [ \rx, # S3C2410_UFSTAT ]
749 ++ ldr \rd, [\rx, # S3C2410_UFSTAT]
750 + and \rd, \rd, #S3C2410_UFSTAT_TXMASK
751 + .endm
752 +
753 +diff --git a/arch/arm/mach-s3c24xx/include/mach/entry-macro.S b/arch/arm/mach-s3c24xx/include/mach/entry-macro.S
754 +index 7615a14..6a21bee 100644
755 +--- a/arch/arm/mach-s3c24xx/include/mach/entry-macro.S
756 ++++ b/arch/arm/mach-s3c24xx/include/mach/entry-macro.S
757 +@@ -31,10 +31,10 @@
758 +
759 + @@ try the interrupt offset register, since it is there
760 +
761 +- ldr \irqstat, [ \base, #INTPND ]
762 ++ ldr \irqstat, [\base, #INTPND ]
763 + teq \irqstat, #0
764 + beq 1002f
765 +- ldr \irqnr, [ \base, #INTOFFSET ]
766 ++ ldr \irqnr, [\base, #INTOFFSET ]
767 + mov \tmp, #1
768 + tst \irqstat, \tmp, lsl \irqnr
769 + bne 1001f
770 +diff --git a/arch/arm/mach-s3c24xx/pm-h1940.S b/arch/arm/mach-s3c24xx/pm-h1940.S
771 +index c93bf2d..6183a68 100644
772 +--- a/arch/arm/mach-s3c24xx/pm-h1940.S
773 ++++ b/arch/arm/mach-s3c24xx/pm-h1940.S
774 +@@ -30,4 +30,4 @@
775 +
776 + h1940_pm_return:
777 + mov r0, #S3C2410_PA_GPIO
778 +- ldr pc, [ r0, #S3C2410_GSTATUS3 - S3C24XX_VA_GPIO ]
779 ++ ldr pc, [r0, #S3C2410_GSTATUS3 - S3C24XX_VA_GPIO]
780 +diff --git a/arch/arm/mach-s3c24xx/sleep-s3c2410.S b/arch/arm/mach-s3c24xx/sleep-s3c2410.S
781 +index dd5b638..65200ae 100644
782 +--- a/arch/arm/mach-s3c24xx/sleep-s3c2410.S
783 ++++ b/arch/arm/mach-s3c24xx/sleep-s3c2410.S
784 +@@ -45,9 +45,9 @@ ENTRY(s3c2410_cpu_suspend)
785 + ldr r4, =S3C2410_REFRESH
786 + ldr r5, =S3C24XX_MISCCR
787 + ldr r6, =S3C2410_CLKCON
788 +- ldr r7, [ r4 ] @ get REFRESH (and ensure in TLB)
789 +- ldr r8, [ r5 ] @ get MISCCR (and ensure in TLB)
790 +- ldr r9, [ r6 ] @ get CLKCON (and ensure in TLB)
791 ++ ldr r7, [r4] @ get REFRESH (and ensure in TLB)
792 ++ ldr r8, [r5] @ get MISCCR (and ensure in TLB)
793 ++ ldr r9, [r6] @ get CLKCON (and ensure in TLB)
794 +
795 + orr r7, r7, #S3C2410_REFRESH_SELF @ SDRAM sleep command
796 + orr r8, r8, #S3C2410_MISCCR_SDSLEEP @ SDRAM power-down signals
797 +@@ -61,8 +61,8 @@ ENTRY(s3c2410_cpu_suspend)
798 + @@ align next bit of code to cache line
799 + .align 5
800 + s3c2410_do_sleep:
801 +- streq r7, [ r4 ] @ SDRAM sleep command
802 +- streq r8, [ r5 ] @ SDRAM power-down config
803 +- streq r9, [ r6 ] @ CPU sleep
804 ++ streq r7, [r4] @ SDRAM sleep command
805 ++ streq r8, [r5] @ SDRAM power-down config
806 ++ streq r9, [r6] @ CPU sleep
807 + 1: beq 1b
808 + mov pc, r14
809 +diff --git a/arch/arm/mach-s3c24xx/sleep-s3c2412.S b/arch/arm/mach-s3c24xx/sleep-s3c2412.S
810 +index c82418e..5adaceb 100644
811 +--- a/arch/arm/mach-s3c24xx/sleep-s3c2412.S
812 ++++ b/arch/arm/mach-s3c24xx/sleep-s3c2412.S
813 +@@ -57,12 +57,12 @@ s3c2412_sleep_enter1:
814 + * retry, as simply returning causes the system to lock.
815 + */
816 +
817 +- ldrne r9, [ r1 ]
818 +- strne r9, [ r1 ]
819 +- ldrne r9, [ r2 ]
820 +- strne r9, [ r2 ]
821 +- ldrne r9, [ r3 ]
822 +- strne r9, [ r3 ]
823 ++ ldrne r9, [r1]
824 ++ strne r9, [r1]
825 ++ ldrne r9, [r2]
826 ++ strne r9, [r2]
827 ++ ldrne r9, [r3]
828 ++ strne r9, [r3]
829 + bne s3c2412_sleep_enter1
830 +
831 + mov pc, r14
832 +diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
833 +index 5d59294..a78827b 100644
834 +--- a/arch/arm/mach-versatile/core.c
835 ++++ b/arch/arm/mach-versatile/core.c
836 +@@ -36,6 +36,7 @@
837 + #include <linux/gfp.h>
838 + #include <linux/clkdev.h>
839 + #include <linux/mtd/physmap.h>
840 ++#include <linux/bitops.h>
841 +
842 + #include <asm/irq.h>
843 + #include <asm/hardware/arm_timer.h>
844 +@@ -65,16 +66,28 @@
845 + #define VA_VIC_BASE __io_address(VERSATILE_VIC_BASE)
846 + #define VA_SIC_BASE __io_address(VERSATILE_SIC_BASE)
847 +
848 ++/* These PIC IRQs are valid in each configuration */
849 ++#define PIC_VALID_ALL BIT(SIC_INT_KMI0) | BIT(SIC_INT_KMI1) | \
850 ++ BIT(SIC_INT_SCI3) | BIT(SIC_INT_UART3) | \
851 ++ BIT(SIC_INT_CLCD) | BIT(SIC_INT_TOUCH) | \
852 ++ BIT(SIC_INT_KEYPAD) | BIT(SIC_INT_DoC) | \
853 ++ BIT(SIC_INT_USB) | BIT(SIC_INT_PCI0) | \
854 ++ BIT(SIC_INT_PCI1) | BIT(SIC_INT_PCI2) | \
855 ++ BIT(SIC_INT_PCI3)
856 + #if 1
857 + #define IRQ_MMCI0A IRQ_VICSOURCE22
858 + #define IRQ_AACI IRQ_VICSOURCE24
859 + #define IRQ_ETH IRQ_VICSOURCE25
860 + #define PIC_MASK 0xFFD00000
861 ++#define PIC_VALID PIC_VALID_ALL
862 + #else
863 + #define IRQ_MMCI0A IRQ_SIC_MMCI0A
864 + #define IRQ_AACI IRQ_SIC_AACI
865 + #define IRQ_ETH IRQ_SIC_ETH
866 + #define PIC_MASK 0
867 ++#define PIC_VALID PIC_VALID_ALL | BIT(SIC_INT_MMCI0A) | \
868 ++ BIT(SIC_INT_MMCI1A) | BIT(SIC_INT_AACI) | \
869 ++ BIT(SIC_INT_ETH)
870 + #endif
871 +
872 + /* Lookup table for finding a DT node that represents the vic instance */
873 +@@ -102,7 +115,7 @@ void __init versatile_init_irq(void)
874 + VERSATILE_SIC_BASE);
875 +
876 + fpga_irq_init(VA_SIC_BASE, "SIC", IRQ_SIC_START,
877 +- IRQ_VICSOURCE31, ~PIC_MASK, np);
878 ++ IRQ_VICSOURCE31, PIC_VALID, np);
879 +
880 + /*
881 + * Interrupts on secondary controller from 0 to 8 are routed to
882 +diff --git a/arch/arm/mach-versatile/pci.c b/arch/arm/mach-versatile/pci.c
883 +index 2f84f40..e92e5e0 100644
884 +--- a/arch/arm/mach-versatile/pci.c
885 ++++ b/arch/arm/mach-versatile/pci.c
886 +@@ -23,6 +23,7 @@
887 + #include <linux/io.h>
888 +
889 + #include <mach/hardware.h>
890 ++#include <mach/irqs.h>
891 + #include <asm/irq.h>
892 + #include <asm/mach/pci.h>
893 +
894 +@@ -327,12 +328,12 @@ static int __init versatile_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
895 + int irq;
896 +
897 + /* slot, pin, irq
898 +- * 24 1 27
899 +- * 25 1 28
900 +- * 26 1 29
901 +- * 27 1 30
902 ++ * 24 1 IRQ_SIC_PCI0
903 ++ * 25 1 IRQ_SIC_PCI1
904 ++ * 26 1 IRQ_SIC_PCI2
905 ++ * 27 1 IRQ_SIC_PCI3
906 + */
907 +- irq = 27 + ((slot - 24 + pin - 1) & 3);
908 ++ irq = IRQ_SIC_PCI0 + ((slot - 24 + pin - 1) & 3);
909 +
910 + return irq;
911 + }
912 +diff --git a/arch/arm/plat-samsung/include/plat/debug-macro.S b/arch/arm/plat-samsung/include/plat/debug-macro.S
913 +index 207e275..f3a9cff 100644
914 +--- a/arch/arm/plat-samsung/include/plat/debug-macro.S
915 ++++ b/arch/arm/plat-samsung/include/plat/debug-macro.S
916 +@@ -14,12 +14,12 @@
917 + /* The S5PV210/S5PC110 implementations are as belows. */
918 +
919 + .macro fifo_level_s5pv210 rd, rx
920 +- ldr \rd, [ \rx, # S3C2410_UFSTAT ]
921 ++ ldr \rd, [\rx, # S3C2410_UFSTAT]
922 + and \rd, \rd, #S5PV210_UFSTAT_TXMASK
923 + .endm
924 +
925 + .macro fifo_full_s5pv210 rd, rx
926 +- ldr \rd, [ \rx, # S3C2410_UFSTAT ]
927 ++ ldr \rd, [\rx, # S3C2410_UFSTAT]
928 + tst \rd, #S5PV210_UFSTAT_TXFULL
929 + .endm
930 +
931 +@@ -27,7 +27,7 @@
932 + * most widely re-used */
933 +
934 + .macro fifo_level_s3c2440 rd, rx
935 +- ldr \rd, [ \rx, # S3C2410_UFSTAT ]
936 ++ ldr \rd, [\rx, # S3C2410_UFSTAT]
937 + and \rd, \rd, #S3C2440_UFSTAT_TXMASK
938 + .endm
939 +
940 +@@ -36,7 +36,7 @@
941 + #endif
942 +
943 + .macro fifo_full_s3c2440 rd, rx
944 +- ldr \rd, [ \rx, # S3C2410_UFSTAT ]
945 ++ ldr \rd, [\rx, # S3C2410_UFSTAT]
946 + tst \rd, #S3C2440_UFSTAT_TXFULL
947 + .endm
948 +
949 +@@ -45,11 +45,11 @@
950 + #endif
951 +
952 + .macro senduart,rd,rx
953 +- strb \rd, [\rx, # S3C2410_UTXH ]
954 ++ strb \rd, [\rx, # S3C2410_UTXH]
955 + .endm
956 +
957 + .macro busyuart, rd, rx
958 +- ldr \rd, [ \rx, # S3C2410_UFCON ]
959 ++ ldr \rd, [\rx, # S3C2410_UFCON]
960 + tst \rd, #S3C2410_UFCON_FIFOMODE @ fifo enabled?
961 + beq 1001f @
962 + @ FIFO enabled...
963 +@@ -60,7 +60,7 @@
964 +
965 + 1001:
966 + @ busy waiting for non fifo
967 +- ldr \rd, [ \rx, # S3C2410_UTRSTAT ]
968 ++ ldr \rd, [\rx, # S3C2410_UTRSTAT]
969 + tst \rd, #S3C2410_UTRSTAT_TXFE
970 + beq 1001b
971 +
972 +@@ -68,7 +68,7 @@
973 + .endm
974 +
975 + .macro waituart,rd,rx
976 +- ldr \rd, [ \rx, # S3C2410_UFCON ]
977 ++ ldr \rd, [\rx, # S3C2410_UFCON]
978 + tst \rd, #S3C2410_UFCON_FIFOMODE @ fifo enabled?
979 + beq 1001f @
980 + @ FIFO enabled...
981 +@@ -79,7 +79,7 @@
982 + b 1002f
983 + 1001:
984 + @ idle waiting for non fifo
985 +- ldr \rd, [ \rx, # S3C2410_UTRSTAT ]
986 ++ ldr \rd, [\rx, # S3C2410_UTRSTAT]
987 + tst \rd, #S3C2410_UTRSTAT_TXFE
988 + beq 1001b
989 +
990 +diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c
991 +index a4db3d2..41db148 100644
992 +--- a/arch/arm64/kernel/signal32.c
993 ++++ b/arch/arm64/kernel/signal32.c
994 +@@ -76,7 +76,7 @@ struct compat_sigcontext {
995 +
996 + struct compat_ucontext {
997 + compat_ulong_t uc_flags;
998 +- struct compat_ucontext *uc_link;
999 ++ compat_uptr_t uc_link;
1000 + compat_stack_t uc_stack;
1001 + struct compat_sigcontext uc_mcontext;
1002 + compat_sigset_t uc_sigmask;
1003 +@@ -703,7 +703,7 @@ int compat_setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
1004 + err |= copy_siginfo_to_user32(&frame->info, info);
1005 +
1006 + __put_user_error(0, &frame->sig.uc.uc_flags, err);
1007 +- __put_user_error(NULL, &frame->sig.uc.uc_link, err);
1008 ++ __put_user_error(0, &frame->sig.uc.uc_link, err);
1009 +
1010 + memset(&stack, 0, sizeof(stack));
1011 + stack.ss_sp = (compat_uptr_t)current->sas_ss_sp;
1012 +diff --git a/arch/parisc/include/asm/pgtable.h b/arch/parisc/include/asm/pgtable.h
1013 +index ee99f23..7df49fa 100644
1014 +--- a/arch/parisc/include/asm/pgtable.h
1015 ++++ b/arch/parisc/include/asm/pgtable.h
1016 +@@ -12,11 +12,10 @@
1017 +
1018 + #include <linux/bitops.h>
1019 + #include <linux/spinlock.h>
1020 ++#include <linux/mm_types.h>
1021 + #include <asm/processor.h>
1022 + #include <asm/cache.h>
1023 +
1024 +-struct vm_area_struct;
1025 +-
1026 + /*
1027 + * kern_addr_valid(ADDR) tests if ADDR is pointing to valid kernel
1028 + * memory. For the return value to be meaningful, ADDR must be >=
1029 +@@ -40,7 +39,14 @@ struct vm_area_struct;
1030 + do{ \
1031 + *(pteptr) = (pteval); \
1032 + } while(0)
1033 +-#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
1034 ++
1035 ++extern void purge_tlb_entries(struct mm_struct *, unsigned long);
1036 ++
1037 ++#define set_pte_at(mm, addr, ptep, pteval) \
1038 ++ do { \
1039 ++ set_pte(ptep, pteval); \
1040 ++ purge_tlb_entries(mm, addr); \
1041 ++ } while (0)
1042 +
1043 + #endif /* !__ASSEMBLY__ */
1044 +
1045 +@@ -466,6 +472,7 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
1046 + old = pte_val(*ptep);
1047 + new = pte_val(pte_wrprotect(__pte (old)));
1048 + } while (cmpxchg((unsigned long *) ptep, old, new) != old);
1049 ++ purge_tlb_entries(mm, addr);
1050 + #else
1051 + pte_t old_pte = *ptep;
1052 + set_pte_at(mm, addr, ptep, pte_wrprotect(old_pte));
1053 +diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c
1054 +index 48e16dc..b89a85a 100644
1055 +--- a/arch/parisc/kernel/cache.c
1056 ++++ b/arch/parisc/kernel/cache.c
1057 +@@ -419,6 +419,24 @@ void kunmap_parisc(void *addr)
1058 + EXPORT_SYMBOL(kunmap_parisc);
1059 + #endif
1060 +
1061 ++void purge_tlb_entries(struct mm_struct *mm, unsigned long addr)
1062 ++{
1063 ++ unsigned long flags;
1064 ++
1065 ++ /* Note: purge_tlb_entries can be called at startup with
1066 ++ no context. */
1067 ++
1068 ++ /* Disable preemption while we play with %sr1. */
1069 ++ preempt_disable();
1070 ++ mtsp(mm->context, 1);
1071 ++ purge_tlb_start(flags);
1072 ++ pdtlb(addr);
1073 ++ pitlb(addr);
1074 ++ purge_tlb_end(flags);
1075 ++ preempt_enable();
1076 ++}
1077 ++EXPORT_SYMBOL(purge_tlb_entries);
1078 ++
1079 + void __flush_tlb_range(unsigned long sid, unsigned long start,
1080 + unsigned long end)
1081 + {
1082 +diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
1083 +index 17903f1..dabe429 100644
1084 +--- a/arch/powerpc/Kconfig
1085 ++++ b/arch/powerpc/Kconfig
1086 +@@ -275,6 +275,10 @@ config PPC_ADV_DEBUG_DAC_RANGE
1087 + depends on PPC_ADV_DEBUG_REGS && 44x
1088 + default y
1089 +
1090 ++config PPC_EMULATE_SSTEP
1091 ++ bool
1092 ++ default y if KPROBES || UPROBES || XMON || HAVE_HW_BREAKPOINT
1093 ++
1094 + source "init/Kconfig"
1095 +
1096 + source "kernel/Kconfig.freezer"
1097 +diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
1098 +index a8fb03e..a80e32b 100644
1099 +--- a/arch/powerpc/include/asm/eeh.h
1100 ++++ b/arch/powerpc/include/asm/eeh.h
1101 +@@ -201,6 +201,7 @@ int eeh_dev_check_failure(struct eeh_dev *edev);
1102 + void __init eeh_addr_cache_build(void);
1103 + void eeh_add_device_tree_early(struct device_node *);
1104 + void eeh_add_device_tree_late(struct pci_bus *);
1105 ++void eeh_add_sysfs_files(struct pci_bus *);
1106 + void eeh_remove_bus_device(struct pci_dev *, int);
1107 +
1108 + /**
1109 +@@ -240,6 +241,8 @@ static inline void eeh_add_device_tree_early(struct device_node *dn) { }
1110 +
1111 + static inline void eeh_add_device_tree_late(struct pci_bus *bus) { }
1112 +
1113 ++static inline void eeh_add_sysfs_files(struct pci_bus *bus) { }
1114 ++
1115 + static inline void eeh_remove_bus_device(struct pci_dev *dev, int purge_pe) { }
1116 +
1117 + static inline void eeh_lock(void) { }
1118 +diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
1119 +index 7206701..466a290 100644
1120 +--- a/arch/powerpc/kernel/machine_kexec_64.c
1121 ++++ b/arch/powerpc/kernel/machine_kexec_64.c
1122 +@@ -162,6 +162,8 @@ static int kexec_all_irq_disabled = 0;
1123 + static void kexec_smp_down(void *arg)
1124 + {
1125 + local_irq_disable();
1126 ++ hard_irq_disable();
1127 ++
1128 + mb(); /* make sure our irqs are disabled before we say they are */
1129 + get_paca()->kexec_state = KEXEC_STATE_IRQS_OFF;
1130 + while(kexec_all_irq_disabled == 0)
1131 +@@ -244,6 +246,8 @@ static void kexec_prepare_cpus(void)
1132 + wake_offline_cpus();
1133 + smp_call_function(kexec_smp_down, NULL, /* wait */0);
1134 + local_irq_disable();
1135 ++ hard_irq_disable();
1136 ++
1137 + mb(); /* make sure IRQs are disabled before we say they are */
1138 + get_paca()->kexec_state = KEXEC_STATE_IRQS_OFF;
1139 +
1140 +@@ -281,6 +285,7 @@ static void kexec_prepare_cpus(void)
1141 + if (ppc_md.kexec_cpu_down)
1142 + ppc_md.kexec_cpu_down(0, 0);
1143 + local_irq_disable();
1144 ++ hard_irq_disable();
1145 + }
1146 +
1147 + #endif /* SMP */
1148 +diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c
1149 +index 07c1269..e51c89f 100644
1150 +--- a/arch/powerpc/kernel/of_platform.c
1151 ++++ b/arch/powerpc/kernel/of_platform.c
1152 +@@ -95,6 +95,9 @@ static int of_pci_phb_probe(struct platform_device *dev)
1153 + /* Add probed PCI devices to the device model */
1154 + pci_bus_add_devices(phb->bus);
1155 +
1156 ++ /* sysfs files should only be added after devices are added */
1157 ++ eeh_add_sysfs_files(phb->bus);
1158 ++
1159 + return 0;
1160 + }
1161 +
1162 +diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
1163 +index 7c37379..fa12ae4 100644
1164 +--- a/arch/powerpc/kernel/pci-common.c
1165 ++++ b/arch/powerpc/kernel/pci-common.c
1166 +@@ -1477,11 +1477,14 @@ void pcibios_finish_adding_to_bus(struct pci_bus *bus)
1167 + pcibios_allocate_bus_resources(bus);
1168 + pcibios_claim_one_bus(bus);
1169 +
1170 ++ /* Fixup EEH */
1171 ++ eeh_add_device_tree_late(bus);
1172 ++
1173 + /* Add new devices to global lists. Register in proc, sysfs. */
1174 + pci_bus_add_devices(bus);
1175 +
1176 +- /* Fixup EEH */
1177 +- eeh_add_device_tree_late(bus);
1178 ++ /* sysfs files should only be added after devices are added */
1179 ++ eeh_add_sysfs_files(bus);
1180 + }
1181 + EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus);
1182 +
1183 +diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
1184 +index 746e0c8..35baad9 100644
1185 +--- a/arch/powerpc/lib/Makefile
1186 ++++ b/arch/powerpc/lib/Makefile
1187 +@@ -19,9 +19,7 @@ obj-$(CONFIG_PPC64) += copypage_64.o copyuser_64.o \
1188 + checksum_wrappers_64.o hweight_64.o \
1189 + copyuser_power7.o string_64.o copypage_power7.o \
1190 + memcpy_power7.o
1191 +-obj-$(CONFIG_XMON) += sstep.o ldstfp.o
1192 +-obj-$(CONFIG_KPROBES) += sstep.o ldstfp.o
1193 +-obj-$(CONFIG_HAVE_HW_BREAKPOINT) += sstep.o ldstfp.o
1194 ++obj-$(CONFIG_PPC_EMULATE_SSTEP) += sstep.o ldstfp.o
1195 +
1196 + ifeq ($(CONFIG_PPC64),y)
1197 + obj-$(CONFIG_SMP) += locks.o
1198 +diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
1199 +index 9a04322..6b73d6c 100644
1200 +--- a/arch/powerpc/platforms/pseries/eeh.c
1201 ++++ b/arch/powerpc/platforms/pseries/eeh.c
1202 +@@ -788,7 +788,6 @@ static void eeh_add_device_late(struct pci_dev *dev)
1203 + dev->dev.archdata.edev = edev;
1204 +
1205 + eeh_addr_cache_insert_dev(dev);
1206 +- eeh_sysfs_add_device(dev);
1207 + }
1208 +
1209 + /**
1210 +@@ -815,6 +814,29 @@ void eeh_add_device_tree_late(struct pci_bus *bus)
1211 + EXPORT_SYMBOL_GPL(eeh_add_device_tree_late);
1212 +
1213 + /**
1214 ++ * eeh_add_sysfs_files - Add EEH sysfs files for the indicated PCI bus
1215 ++ * @bus: PCI bus
1216 ++ *
1217 ++ * This routine must be used to add EEH sysfs files for PCI
1218 ++ * devices which are attached to the indicated PCI bus. The PCI bus
1219 ++ * is added after system boot through hotplug or dlpar.
1220 ++ */
1221 ++void eeh_add_sysfs_files(struct pci_bus *bus)
1222 ++{
1223 ++ struct pci_dev *dev;
1224 ++
1225 ++ list_for_each_entry(dev, &bus->devices, bus_list) {
1226 ++ eeh_sysfs_add_device(dev);
1227 ++ if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
1228 ++ struct pci_bus *subbus = dev->subordinate;
1229 ++ if (subbus)
1230 ++ eeh_add_sysfs_files(subbus);
1231 ++ }
1232 ++ }
1233 ++}
1234 ++EXPORT_SYMBOL_GPL(eeh_add_sysfs_files);
1235 ++
1236 ++/**
1237 + * eeh_remove_device - Undo EEH setup for the indicated pci device
1238 + * @dev: pci device to be removed
1239 + * @purge_pe: remove the PE or not
1240 +diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
1241 +index f090e81..8bafa4f 100644
1242 +--- a/arch/s390/kvm/kvm-s390.c
1243 ++++ b/arch/s390/kvm/kvm-s390.c
1244 +@@ -766,6 +766,14 @@ int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr)
1245 + } else
1246 + prefix = 0;
1247 +
1248 ++ /*
1249 ++ * The guest FPRS and ACRS are in the host FPRS/ACRS due to the lazy
1250 ++ * copying in vcpu load/put. Lets update our copies before we save
1251 ++ * it into the save area
1252 ++ */
1253 ++ save_fp_regs(&vcpu->arch.guest_fpregs);
1254 ++ save_access_regs(vcpu->run->s.regs.acrs);
1255 ++
1256 + if (__guestcopy(vcpu, addr + offsetof(struct save_area, fp_regs),
1257 + vcpu->arch.guest_fpregs.fprs, 128, prefix))
1258 + return -EFAULT;
1259 +diff --git a/arch/sparc/include/asm/hugetlb.h b/arch/sparc/include/asm/hugetlb.h
1260 +index 9661e9b..7eb57d2 100644
1261 +--- a/arch/sparc/include/asm/hugetlb.h
1262 ++++ b/arch/sparc/include/asm/hugetlb.h
1263 +@@ -12,7 +12,6 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
1264 +
1265 + static inline void hugetlb_prefault_arch_hook(struct mm_struct *mm)
1266 + {
1267 +- hugetlb_setup(mm);
1268 + }
1269 +
1270 + static inline int is_hugepage_only_range(struct mm_struct *mm,
1271 +diff --git a/arch/sparc/include/asm/page_64.h b/arch/sparc/include/asm/page_64.h
1272 +index 4b39f74..e155388 100644
1273 +--- a/arch/sparc/include/asm/page_64.h
1274 ++++ b/arch/sparc/include/asm/page_64.h
1275 +@@ -27,8 +27,8 @@
1276 + #ifndef __ASSEMBLY__
1277 +
1278 + #if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
1279 +-struct mm_struct;
1280 +-extern void hugetlb_setup(struct mm_struct *mm);
1281 ++struct pt_regs;
1282 ++extern void hugetlb_setup(struct pt_regs *regs);
1283 + #endif
1284 +
1285 + #define WANT_PAGE_VIRTUAL
1286 +diff --git a/arch/sparc/include/asm/tsb.h b/arch/sparc/include/asm/tsb.h
1287 +index b4c258d..e696432 100644
1288 +--- a/arch/sparc/include/asm/tsb.h
1289 ++++ b/arch/sparc/include/asm/tsb.h
1290 +@@ -157,17 +157,26 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
1291 + andn REG2, 0x7, REG2; \
1292 + add REG1, REG2, REG1;
1293 +
1294 +- /* This macro exists only to make the PMD translator below easier
1295 +- * to read. It hides the ELF section switch for the sun4v code
1296 +- * patching.
1297 ++ /* These macros exists only to make the PMD translator below
1298 ++ * easier to read. It hides the ELF section switch for the
1299 ++ * sun4v code patching.
1300 + */
1301 +-#define OR_PTE_BIT(REG, NAME) \
1302 ++#define OR_PTE_BIT_1INSN(REG, NAME) \
1303 + 661: or REG, _PAGE_##NAME##_4U, REG; \
1304 + .section .sun4v_1insn_patch, "ax"; \
1305 + .word 661b; \
1306 + or REG, _PAGE_##NAME##_4V, REG; \
1307 + .previous;
1308 +
1309 ++#define OR_PTE_BIT_2INSN(REG, TMP, NAME) \
1310 ++661: sethi %hi(_PAGE_##NAME##_4U), TMP; \
1311 ++ or REG, TMP, REG; \
1312 ++ .section .sun4v_2insn_patch, "ax"; \
1313 ++ .word 661b; \
1314 ++ mov -1, TMP; \
1315 ++ or REG, _PAGE_##NAME##_4V, REG; \
1316 ++ .previous;
1317 ++
1318 + /* Load into REG the PTE value for VALID, CACHE, and SZHUGE. */
1319 + #define BUILD_PTE_VALID_SZHUGE_CACHE(REG) \
1320 + 661: sethi %uhi(_PAGE_VALID|_PAGE_SZHUGE_4U), REG; \
1321 +@@ -214,12 +223,13 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
1322 + andn REG1, PMD_HUGE_PROTBITS, REG2; \
1323 + sllx REG2, PMD_PADDR_SHIFT, REG2; \
1324 + /* REG2 now holds PFN << PAGE_SHIFT */ \
1325 +- andcc REG1, PMD_HUGE_EXEC, %g0; \
1326 +- bne,a,pt %xcc, 1f; \
1327 +- OR_PTE_BIT(REG2, EXEC); \
1328 +-1: andcc REG1, PMD_HUGE_WRITE, %g0; \
1329 ++ andcc REG1, PMD_HUGE_WRITE, %g0; \
1330 + bne,a,pt %xcc, 1f; \
1331 +- OR_PTE_BIT(REG2, W); \
1332 ++ OR_PTE_BIT_1INSN(REG2, W); \
1333 ++1: andcc REG1, PMD_HUGE_EXEC, %g0; \
1334 ++ be,pt %xcc, 1f; \
1335 ++ nop; \
1336 ++ OR_PTE_BIT_2INSN(REG2, REG1, EXEC); \
1337 + /* REG1 can now be clobbered, build final PTE */ \
1338 + 1: BUILD_PTE_VALID_SZHUGE_CACHE(REG1); \
1339 + ba,pt %xcc, PTE_LABEL; \
1340 +diff --git a/arch/sparc/kernel/tsb.S b/arch/sparc/kernel/tsb.S
1341 +index d4bdc7a..a313e4a 100644
1342 +--- a/arch/sparc/kernel/tsb.S
1343 ++++ b/arch/sparc/kernel/tsb.S
1344 +@@ -136,12 +136,43 @@ tsb_miss_page_table_walk_sun4v_fastpath:
1345 + nop
1346 +
1347 + /* It is a huge page, use huge page TSB entry address we
1348 +- * calculated above.
1349 ++ * calculated above. If the huge page TSB has not been
1350 ++ * allocated, setup a trap stack and call hugetlb_setup()
1351 ++ * to do so, then return from the trap to replay the TLB
1352 ++ * miss.
1353 ++ *
1354 ++ * This is necessary to handle the case of transparent huge
1355 ++ * pages where we don't really have a non-atomic context
1356 ++ * in which to allocate the hugepage TSB hash table. When
1357 ++ * the 'mm' faults in the hugepage for the first time, we
1358 ++ * thus handle it here. This also makes sure that we can
1359 ++ * allocate the TSB hash table on the correct NUMA node.
1360 + */
1361 + TRAP_LOAD_TRAP_BLOCK(%g7, %g2)
1362 +- ldx [%g7 + TRAP_PER_CPU_TSB_HUGE_TEMP], %g2
1363 +- cmp %g2, -1
1364 +- movne %xcc, %g2, %g1
1365 ++ ldx [%g7 + TRAP_PER_CPU_TSB_HUGE_TEMP], %g1
1366 ++ cmp %g1, -1
1367 ++ bne,pt %xcc, 60f
1368 ++ nop
1369 ++
1370 ++661: rdpr %pstate, %g5
1371 ++ wrpr %g5, PSTATE_AG | PSTATE_MG, %pstate
1372 ++ .section .sun4v_2insn_patch, "ax"
1373 ++ .word 661b
1374 ++ SET_GL(1)
1375 ++ nop
1376 ++ .previous
1377 ++
1378 ++ rdpr %tl, %g3
1379 ++ cmp %g3, 1
1380 ++ bne,pn %xcc, winfix_trampoline
1381 ++ nop
1382 ++ ba,pt %xcc, etrap
1383 ++ rd %pc, %g7
1384 ++ call hugetlb_setup
1385 ++ add %sp, PTREGS_OFF, %o0
1386 ++ ba,pt %xcc, rtrap
1387 ++ nop
1388 ++
1389 + 60:
1390 + #endif
1391 +
1392 +diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c
1393 +index 097aee7..5062ff3 100644
1394 +--- a/arch/sparc/mm/fault_64.c
1395 ++++ b/arch/sparc/mm/fault_64.c
1396 +@@ -472,8 +472,13 @@ good_area:
1397 + #if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
1398 + mm_rss = mm->context.huge_pte_count;
1399 + if (unlikely(mm_rss >
1400 +- mm->context.tsb_block[MM_TSB_HUGE].tsb_rss_limit))
1401 +- tsb_grow(mm, MM_TSB_HUGE, mm_rss);
1402 ++ mm->context.tsb_block[MM_TSB_HUGE].tsb_rss_limit)) {
1403 ++ if (mm->context.tsb_block[MM_TSB_HUGE].tsb)
1404 ++ tsb_grow(mm, MM_TSB_HUGE, mm_rss);
1405 ++ else
1406 ++ hugetlb_setup(regs);
1407 ++
1408 ++ }
1409 + #endif
1410 + return;
1411 +
1412 +diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
1413 +index c3b7242..82bbf04 100644
1414 +--- a/arch/sparc/mm/init_64.c
1415 ++++ b/arch/sparc/mm/init_64.c
1416 +@@ -314,16 +314,31 @@ static void __update_mmu_tsb_insert(struct mm_struct *mm, unsigned long tsb_inde
1417 + struct tsb *tsb = mm->context.tsb_block[tsb_index].tsb;
1418 + unsigned long tag;
1419 +
1420 ++ if (unlikely(!tsb))
1421 ++ return;
1422 ++
1423 + tsb += ((address >> tsb_hash_shift) &
1424 + (mm->context.tsb_block[tsb_index].tsb_nentries - 1UL));
1425 + tag = (address >> 22UL);
1426 + tsb_insert(tsb, tag, tte);
1427 + }
1428 +
1429 ++#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
1430 ++static inline bool is_hugetlb_pte(pte_t pte)
1431 ++{
1432 ++ if ((tlb_type == hypervisor &&
1433 ++ (pte_val(pte) & _PAGE_SZALL_4V) == _PAGE_SZHUGE_4V) ||
1434 ++ (tlb_type != hypervisor &&
1435 ++ (pte_val(pte) & _PAGE_SZALL_4U) == _PAGE_SZHUGE_4U))
1436 ++ return true;
1437 ++ return false;
1438 ++}
1439 ++#endif
1440 ++
1441 + void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep)
1442 + {
1443 +- unsigned long tsb_index, tsb_hash_shift, flags;
1444 + struct mm_struct *mm;
1445 ++ unsigned long flags;
1446 + pte_t pte = *ptep;
1447 +
1448 + if (tlb_type != hypervisor) {
1449 +@@ -335,25 +350,16 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *
1450 +
1451 + mm = vma->vm_mm;
1452 +
1453 +- tsb_index = MM_TSB_BASE;
1454 +- tsb_hash_shift = PAGE_SHIFT;
1455 +-
1456 + spin_lock_irqsave(&mm->context.lock, flags);
1457 +
1458 + #if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
1459 +- if (mm->context.tsb_block[MM_TSB_HUGE].tsb != NULL) {
1460 +- if ((tlb_type == hypervisor &&
1461 +- (pte_val(pte) & _PAGE_SZALL_4V) == _PAGE_SZHUGE_4V) ||
1462 +- (tlb_type != hypervisor &&
1463 +- (pte_val(pte) & _PAGE_SZALL_4U) == _PAGE_SZHUGE_4U)) {
1464 +- tsb_index = MM_TSB_HUGE;
1465 +- tsb_hash_shift = HPAGE_SHIFT;
1466 +- }
1467 +- }
1468 ++ if (mm->context.huge_pte_count && is_hugetlb_pte(pte))
1469 ++ __update_mmu_tsb_insert(mm, MM_TSB_HUGE, HPAGE_SHIFT,
1470 ++ address, pte_val(pte));
1471 ++ else
1472 + #endif
1473 +-
1474 +- __update_mmu_tsb_insert(mm, tsb_index, tsb_hash_shift,
1475 +- address, pte_val(pte));
1476 ++ __update_mmu_tsb_insert(mm, MM_TSB_BASE, PAGE_SHIFT,
1477 ++ address, pte_val(pte));
1478 +
1479 + spin_unlock_irqrestore(&mm->context.lock, flags);
1480 + }
1481 +@@ -2712,14 +2718,28 @@ static void context_reload(void *__data)
1482 + load_secondary_context(mm);
1483 + }
1484 +
1485 +-void hugetlb_setup(struct mm_struct *mm)
1486 ++void hugetlb_setup(struct pt_regs *regs)
1487 + {
1488 +- struct tsb_config *tp = &mm->context.tsb_block[MM_TSB_HUGE];
1489 ++ struct mm_struct *mm = current->mm;
1490 ++ struct tsb_config *tp;
1491 +
1492 +- if (likely(tp->tsb != NULL))
1493 +- return;
1494 ++ if (in_atomic() || !mm) {
1495 ++ const struct exception_table_entry *entry;
1496 ++
1497 ++ entry = search_exception_tables(regs->tpc);
1498 ++ if (entry) {
1499 ++ regs->tpc = entry->fixup;
1500 ++ regs->tnpc = regs->tpc + 4;
1501 ++ return;
1502 ++ }
1503 ++ pr_alert("Unexpected HugeTLB setup in atomic context.\n");
1504 ++ die_if_kernel("HugeTSB in atomic", regs);
1505 ++ }
1506 ++
1507 ++ tp = &mm->context.tsb_block[MM_TSB_HUGE];
1508 ++ if (likely(tp->tsb == NULL))
1509 ++ tsb_grow(mm, MM_TSB_HUGE, 0);
1510 +
1511 +- tsb_grow(mm, MM_TSB_HUGE, 0);
1512 + tsb_context_switch(mm);
1513 + smp_tsb_sync(mm);
1514 +
1515 +diff --git a/arch/sparc/mm/tlb.c b/arch/sparc/mm/tlb.c
1516 +index 3e8fec3..ba6ae7f 100644
1517 +--- a/arch/sparc/mm/tlb.c
1518 ++++ b/arch/sparc/mm/tlb.c
1519 +@@ -135,8 +135,15 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr,
1520 + mm->context.huge_pte_count++;
1521 + else
1522 + mm->context.huge_pte_count--;
1523 +- if (mm->context.huge_pte_count == 1)
1524 +- hugetlb_setup(mm);
1525 ++
1526 ++ /* Do not try to allocate the TSB hash table if we
1527 ++ * don't have one already. We have various locks held
1528 ++ * and thus we'll end up doing a GFP_KERNEL allocation
1529 ++ * in an atomic context.
1530 ++ *
1531 ++ * Instead, we let the first TLB miss on a hugepage
1532 ++ * take care of this.
1533 ++ */
1534 + }
1535 +
1536 + if (!pmd_none(orig)) {
1537 +diff --git a/arch/sparc/mm/tsb.c b/arch/sparc/mm/tsb.c
1538 +index 7f64743..428982b 100644
1539 +--- a/arch/sparc/mm/tsb.c
1540 ++++ b/arch/sparc/mm/tsb.c
1541 +@@ -314,7 +314,7 @@ void tsb_grow(struct mm_struct *mm, unsigned long tsb_index, unsigned long rss)
1542 + retry_tsb_alloc:
1543 + gfp_flags = GFP_KERNEL;
1544 + if (new_size > (PAGE_SIZE * 2))
1545 +- gfp_flags = __GFP_NOWARN | __GFP_NORETRY;
1546 ++ gfp_flags |= __GFP_NOWARN | __GFP_NORETRY;
1547 +
1548 + new_tsb = kmem_cache_alloc_node(tsb_caches[new_cache_index],
1549 + gfp_flags, numa_node_id());
1550 +diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
1551 +index 225543b..0694d09 100644
1552 +--- a/arch/x86/Kconfig
1553 ++++ b/arch/x86/Kconfig
1554 +@@ -1253,10 +1253,6 @@ config NODES_SHIFT
1555 + Specify the maximum number of NUMA Nodes available on the target
1556 + system. Increases memory reserved to accommodate various tables.
1557 +
1558 +-config HAVE_ARCH_ALLOC_REMAP
1559 +- def_bool y
1560 +- depends on X86_32 && NUMA
1561 +-
1562 + config ARCH_HAVE_MEMORY_PRESENT
1563 + def_bool y
1564 + depends on X86_32 && DISCONTIGMEM
1565 +diff --git a/arch/x86/include/asm/mmzone_32.h b/arch/x86/include/asm/mmzone_32.h
1566 +index eb05fb3..8a9b3e2 100644
1567 +--- a/arch/x86/include/asm/mmzone_32.h
1568 ++++ b/arch/x86/include/asm/mmzone_32.h
1569 +@@ -14,12 +14,6 @@ extern struct pglist_data *node_data[];
1570 +
1571 + #include <asm/numaq.h>
1572 +
1573 +-extern void resume_map_numa_kva(pgd_t *pgd);
1574 +-
1575 +-#else /* !CONFIG_NUMA */
1576 +-
1577 +-static inline void resume_map_numa_kva(pgd_t *pgd) {}
1578 +-
1579 + #endif /* CONFIG_NUMA */
1580 +
1581 + #ifdef CONFIG_DISCONTIGMEM
1582 +diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
1583 +index 0a630dd..646d192 100644
1584 +--- a/arch/x86/kernel/cpu/mshyperv.c
1585 ++++ b/arch/x86/kernel/cpu/mshyperv.c
1586 +@@ -68,7 +68,8 @@ static void __init ms_hyperv_init_platform(void)
1587 + printk(KERN_INFO "HyperV: features 0x%x, hints 0x%x\n",
1588 + ms_hyperv.features, ms_hyperv.hints);
1589 +
1590 +- clocksource_register_hz(&hyperv_cs, NSEC_PER_SEC/100);
1591 ++ if (ms_hyperv.features & HV_X64_MSR_TIME_REF_COUNT_AVAILABLE)
1592 ++ clocksource_register_hz(&hyperv_cs, NSEC_PER_SEC/100);
1593 + }
1594 +
1595 + const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = {
1596 +diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
1597 +index 2d125be..8504f36 100644
1598 +--- a/arch/x86/mm/numa.c
1599 ++++ b/arch/x86/mm/numa.c
1600 +@@ -193,7 +193,6 @@ int __init numa_add_memblk(int nid, u64 start, u64 end)
1601 + static void __init setup_node_data(int nid, u64 start, u64 end)
1602 + {
1603 + const size_t nd_size = roundup(sizeof(pg_data_t), PAGE_SIZE);
1604 +- bool remapped = false;
1605 + u64 nd_pa;
1606 + void *nd;
1607 + int tnid;
1608 +@@ -205,37 +204,28 @@ static void __init setup_node_data(int nid, u64 start, u64 end)
1609 + if (end && (end - start) < NODE_MIN_SIZE)
1610 + return;
1611 +
1612 +- /* initialize remap allocator before aligning to ZONE_ALIGN */
1613 +- init_alloc_remap(nid, start, end);
1614 +-
1615 + start = roundup(start, ZONE_ALIGN);
1616 +
1617 + printk(KERN_INFO "Initmem setup node %d [mem %#010Lx-%#010Lx]\n",
1618 + nid, start, end - 1);
1619 +
1620 + /*
1621 +- * Allocate node data. Try remap allocator first, node-local
1622 +- * memory and then any node. Never allocate in DMA zone.
1623 ++ * Allocate node data. Try node-local memory and then any node.
1624 ++ * Never allocate in DMA zone.
1625 + */
1626 +- nd = alloc_remap(nid, nd_size);
1627 +- if (nd) {
1628 +- nd_pa = __pa(nd);
1629 +- remapped = true;
1630 +- } else {
1631 +- nd_pa = memblock_alloc_nid(nd_size, SMP_CACHE_BYTES, nid);
1632 +- if (!nd_pa) {
1633 +- pr_err("Cannot find %zu bytes in node %d\n",
1634 +- nd_size, nid);
1635 +- return;
1636 +- }
1637 +- nd = __va(nd_pa);
1638 ++ nd_pa = memblock_alloc_nid(nd_size, SMP_CACHE_BYTES, nid);
1639 ++ if (!nd_pa) {
1640 ++ pr_err("Cannot find %zu bytes in node %d\n",
1641 ++ nd_size, nid);
1642 ++ return;
1643 + }
1644 ++ nd = __va(nd_pa);
1645 +
1646 + /* report and initialize */
1647 +- printk(KERN_INFO " NODE_DATA [mem %#010Lx-%#010Lx]%s\n",
1648 +- nd_pa, nd_pa + nd_size - 1, remapped ? " (remapped)" : "");
1649 ++ printk(KERN_INFO " NODE_DATA [mem %#010Lx-%#010Lx]\n",
1650 ++ nd_pa, nd_pa + nd_size - 1);
1651 + tnid = early_pfn_to_nid(nd_pa >> PAGE_SHIFT);
1652 +- if (!remapped && tnid != nid)
1653 ++ if (tnid != nid)
1654 + printk(KERN_INFO " NODE_DATA(%d) on node %d\n", nid, tnid);
1655 +
1656 + node_data[nid] = nd;
1657 +diff --git a/arch/x86/mm/numa_32.c b/arch/x86/mm/numa_32.c
1658 +index 534255a..73a6d73 100644
1659 +--- a/arch/x86/mm/numa_32.c
1660 ++++ b/arch/x86/mm/numa_32.c
1661 +@@ -73,167 +73,6 @@ unsigned long node_memmap_size_bytes(int nid, unsigned long start_pfn,
1662 +
1663 + extern unsigned long highend_pfn, highstart_pfn;
1664 +
1665 +-#define LARGE_PAGE_BYTES (PTRS_PER_PTE * PAGE_SIZE)
1666 +-
1667 +-static void *node_remap_start_vaddr[MAX_NUMNODES];
1668 +-void set_pmd_pfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags);
1669 +-
1670 +-/*
1671 +- * Remap memory allocator
1672 +- */
1673 +-static unsigned long node_remap_start_pfn[MAX_NUMNODES];
1674 +-static void *node_remap_end_vaddr[MAX_NUMNODES];
1675 +-static void *node_remap_alloc_vaddr[MAX_NUMNODES];
1676 +-
1677 +-/**
1678 +- * alloc_remap - Allocate remapped memory
1679 +- * @nid: NUMA node to allocate memory from
1680 +- * @size: The size of allocation
1681 +- *
1682 +- * Allocate @size bytes from the remap area of NUMA node @nid. The
1683 +- * size of the remap area is predetermined by init_alloc_remap() and
1684 +- * only the callers considered there should call this function. For
1685 +- * more info, please read the comment on top of init_alloc_remap().
1686 +- *
1687 +- * The caller must be ready to handle allocation failure from this
1688 +- * function and fall back to regular memory allocator in such cases.
1689 +- *
1690 +- * CONTEXT:
1691 +- * Single CPU early boot context.
1692 +- *
1693 +- * RETURNS:
1694 +- * Pointer to the allocated memory on success, %NULL on failure.
1695 +- */
1696 +-void *alloc_remap(int nid, unsigned long size)
1697 +-{
1698 +- void *allocation = node_remap_alloc_vaddr[nid];
1699 +-
1700 +- size = ALIGN(size, L1_CACHE_BYTES);
1701 +-
1702 +- if (!allocation || (allocation + size) > node_remap_end_vaddr[nid])
1703 +- return NULL;
1704 +-
1705 +- node_remap_alloc_vaddr[nid] += size;
1706 +- memset(allocation, 0, size);
1707 +-
1708 +- return allocation;
1709 +-}
1710 +-
1711 +-#ifdef CONFIG_HIBERNATION
1712 +-/**
1713 +- * resume_map_numa_kva - add KVA mapping to the temporary page tables created
1714 +- * during resume from hibernation
1715 +- * @pgd_base - temporary resume page directory
1716 +- */
1717 +-void resume_map_numa_kva(pgd_t *pgd_base)
1718 +-{
1719 +- int node;
1720 +-
1721 +- for_each_online_node(node) {
1722 +- unsigned long start_va, start_pfn, nr_pages, pfn;
1723 +-
1724 +- start_va = (unsigned long)node_remap_start_vaddr[node];
1725 +- start_pfn = node_remap_start_pfn[node];
1726 +- nr_pages = (node_remap_end_vaddr[node] -
1727 +- node_remap_start_vaddr[node]) >> PAGE_SHIFT;
1728 +-
1729 +- printk(KERN_DEBUG "%s: node %d\n", __func__, node);
1730 +-
1731 +- for (pfn = 0; pfn < nr_pages; pfn += PTRS_PER_PTE) {
1732 +- unsigned long vaddr = start_va + (pfn << PAGE_SHIFT);
1733 +- pgd_t *pgd = pgd_base + pgd_index(vaddr);
1734 +- pud_t *pud = pud_offset(pgd, vaddr);
1735 +- pmd_t *pmd = pmd_offset(pud, vaddr);
1736 +-
1737 +- set_pmd(pmd, pfn_pmd(start_pfn + pfn,
1738 +- PAGE_KERNEL_LARGE_EXEC));
1739 +-
1740 +- printk(KERN_DEBUG "%s: %08lx -> pfn %08lx\n",
1741 +- __func__, vaddr, start_pfn + pfn);
1742 +- }
1743 +- }
1744 +-}
1745 +-#endif
1746 +-
1747 +-/**
1748 +- * init_alloc_remap - Initialize remap allocator for a NUMA node
1749 +- * @nid: NUMA node to initizlie remap allocator for
1750 +- *
1751 +- * NUMA nodes may end up without any lowmem. As allocating pgdat and
1752 +- * memmap on a different node with lowmem is inefficient, a special
1753 +- * remap allocator is implemented which can be used by alloc_remap().
1754 +- *
1755 +- * For each node, the amount of memory which will be necessary for
1756 +- * pgdat and memmap is calculated and two memory areas of the size are
1757 +- * allocated - one in the node and the other in lowmem; then, the area
1758 +- * in the node is remapped to the lowmem area.
1759 +- *
1760 +- * As pgdat and memmap must be allocated in lowmem anyway, this
1761 +- * doesn't waste lowmem address space; however, the actual lowmem
1762 +- * which gets remapped over is wasted. The amount shouldn't be
1763 +- * problematic on machines this feature will be used.
1764 +- *
1765 +- * Initialization failure isn't fatal. alloc_remap() is used
1766 +- * opportunistically and the callers will fall back to other memory
1767 +- * allocation mechanisms on failure.
1768 +- */
1769 +-void __init init_alloc_remap(int nid, u64 start, u64 end)
1770 +-{
1771 +- unsigned long start_pfn = start >> PAGE_SHIFT;
1772 +- unsigned long end_pfn = end >> PAGE_SHIFT;
1773 +- unsigned long size, pfn;
1774 +- u64 node_pa, remap_pa;
1775 +- void *remap_va;
1776 +-
1777 +- /*
1778 +- * The acpi/srat node info can show hot-add memroy zones where
1779 +- * memory could be added but not currently present.
1780 +- */
1781 +- printk(KERN_DEBUG "node %d pfn: [%lx - %lx]\n",
1782 +- nid, start_pfn, end_pfn);
1783 +-
1784 +- /* calculate the necessary space aligned to large page size */
1785 +- size = node_memmap_size_bytes(nid, start_pfn, end_pfn);
1786 +- size += ALIGN(sizeof(pg_data_t), PAGE_SIZE);
1787 +- size = ALIGN(size, LARGE_PAGE_BYTES);
1788 +-
1789 +- /* allocate node memory and the lowmem remap area */
1790 +- node_pa = memblock_find_in_range(start, end, size, LARGE_PAGE_BYTES);
1791 +- if (!node_pa) {
1792 +- pr_warning("remap_alloc: failed to allocate %lu bytes for node %d\n",
1793 +- size, nid);
1794 +- return;
1795 +- }
1796 +- memblock_reserve(node_pa, size);
1797 +-
1798 +- remap_pa = memblock_find_in_range(min_low_pfn << PAGE_SHIFT,
1799 +- max_low_pfn << PAGE_SHIFT,
1800 +- size, LARGE_PAGE_BYTES);
1801 +- if (!remap_pa) {
1802 +- pr_warning("remap_alloc: failed to allocate %lu bytes remap area for node %d\n",
1803 +- size, nid);
1804 +- memblock_free(node_pa, size);
1805 +- return;
1806 +- }
1807 +- memblock_reserve(remap_pa, size);
1808 +- remap_va = phys_to_virt(remap_pa);
1809 +-
1810 +- /* perform actual remap */
1811 +- for (pfn = 0; pfn < size >> PAGE_SHIFT; pfn += PTRS_PER_PTE)
1812 +- set_pmd_pfn((unsigned long)remap_va + (pfn << PAGE_SHIFT),
1813 +- (node_pa >> PAGE_SHIFT) + pfn,
1814 +- PAGE_KERNEL_LARGE);
1815 +-
1816 +- /* initialize remap allocator parameters */
1817 +- node_remap_start_pfn[nid] = node_pa >> PAGE_SHIFT;
1818 +- node_remap_start_vaddr[nid] = remap_va;
1819 +- node_remap_end_vaddr[nid] = remap_va + size;
1820 +- node_remap_alloc_vaddr[nid] = remap_va;
1821 +-
1822 +- printk(KERN_DEBUG "remap_alloc: node %d [%08llx-%08llx) -> [%p-%p)\n",
1823 +- nid, node_pa, node_pa + size, remap_va, remap_va + size);
1824 +-}
1825 +-
1826 + void __init initmem_init(void)
1827 + {
1828 + x86_numa_init();
1829 +diff --git a/arch/x86/mm/numa_internal.h b/arch/x86/mm/numa_internal.h
1830 +index 7178c3a..ad86ec9 100644
1831 +--- a/arch/x86/mm/numa_internal.h
1832 ++++ b/arch/x86/mm/numa_internal.h
1833 +@@ -21,12 +21,6 @@ void __init numa_reset_distance(void);
1834 +
1835 + void __init x86_numa_init(void);
1836 +
1837 +-#ifdef CONFIG_X86_64
1838 +-static inline void init_alloc_remap(int nid, u64 start, u64 end) { }
1839 +-#else
1840 +-void __init init_alloc_remap(int nid, u64 start, u64 end);
1841 +-#endif
1842 +-
1843 + #ifdef CONFIG_NUMA_EMU
1844 + void __init numa_emulation(struct numa_meminfo *numa_meminfo,
1845 + int numa_dist_cnt);
1846 +diff --git a/arch/x86/power/hibernate_32.c b/arch/x86/power/hibernate_32.c
1847 +index 74202c1..7d28c88 100644
1848 +--- a/arch/x86/power/hibernate_32.c
1849 ++++ b/arch/x86/power/hibernate_32.c
1850 +@@ -129,8 +129,6 @@ static int resume_physical_mapping_init(pgd_t *pgd_base)
1851 + }
1852 + }
1853 +
1854 +- resume_map_numa_kva(pgd_base);
1855 +-
1856 + return 0;
1857 + }
1858 +
1859 +diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c
1860 +index 83e866d..f7a080e 100644
1861 +--- a/arch/x86/xen/spinlock.c
1862 ++++ b/arch/x86/xen/spinlock.c
1863 +@@ -328,7 +328,6 @@ static noinline void xen_spin_unlock_slow(struct xen_spinlock *xl)
1864 + if (per_cpu(lock_spinners, cpu) == xl) {
1865 + ADD_STATS(released_slow_kicked, 1);
1866 + xen_send_IPI_one(cpu, XEN_SPIN_UNLOCK_VECTOR);
1867 +- break;
1868 + }
1869 + }
1870 + }
1871 +diff --git a/drivers/base/bus.c b/drivers/base/bus.c
1872 +index 24eb078..6856303 100644
1873 +--- a/drivers/base/bus.c
1874 ++++ b/drivers/base/bus.c
1875 +@@ -290,7 +290,7 @@ int bus_for_each_dev(struct bus_type *bus, struct device *start,
1876 + struct device *dev;
1877 + int error = 0;
1878 +
1879 +- if (!bus)
1880 ++ if (!bus || !bus->p)
1881 + return -EINVAL;
1882 +
1883 + klist_iter_init_node(&bus->p->klist_devices, &i,
1884 +@@ -324,7 +324,7 @@ struct device *bus_find_device(struct bus_type *bus,
1885 + struct klist_iter i;
1886 + struct device *dev;
1887 +
1888 +- if (!bus)
1889 ++ if (!bus || !bus->p)
1890 + return NULL;
1891 +
1892 + klist_iter_init_node(&bus->p->klist_devices, &i,
1893 +diff --git a/drivers/base/dd.c b/drivers/base/dd.c
1894 +index e3bbed8..61d3e1b 100644
1895 +--- a/drivers/base/dd.c
1896 ++++ b/drivers/base/dd.c
1897 +@@ -172,6 +172,8 @@ static int deferred_probe_initcall(void)
1898 +
1899 + driver_deferred_probe_enable = true;
1900 + driver_deferred_probe_trigger();
1901 ++ /* Sort as many dependencies as possible before exiting initcalls */
1902 ++ flush_workqueue(deferred_wq);
1903 + return 0;
1904 + }
1905 + late_initcall(deferred_probe_initcall);
1906 +diff --git a/drivers/dca/dca-core.c b/drivers/dca/dca-core.c
1907 +index bc6f5fa..819dfda 100644
1908 +--- a/drivers/dca/dca-core.c
1909 ++++ b/drivers/dca/dca-core.c
1910 +@@ -420,6 +420,11 @@ void unregister_dca_provider(struct dca_provider *dca, struct device *dev)
1911 +
1912 + raw_spin_lock_irqsave(&dca_lock, flags);
1913 +
1914 ++ if (list_empty(&dca_domains)) {
1915 ++ raw_spin_unlock_irqrestore(&dca_lock, flags);
1916 ++ return;
1917 ++ }
1918 ++
1919 + list_del(&dca->node);
1920 +
1921 + pci_rc = dca_pci_rc_from_dev(dev);
1922 +diff --git a/drivers/dma/sh/shdma.c b/drivers/dma/sh/shdma.c
1923 +index 3315e4b..b70709b 100644
1924 +--- a/drivers/dma/sh/shdma.c
1925 ++++ b/drivers/dma/sh/shdma.c
1926 +@@ -326,7 +326,7 @@ static int sh_dmae_set_slave(struct shdma_chan *schan,
1927 + shdma_chan);
1928 + const struct sh_dmae_slave_config *cfg = dmae_find_slave(sh_chan, slave_id);
1929 + if (!cfg)
1930 +- return -ENODEV;
1931 ++ return -ENXIO;
1932 +
1933 + if (!try)
1934 + sh_chan->config = cfg;
1935 +diff --git a/drivers/gpio/gpio-em.c b/drivers/gpio/gpio-em.c
1936 +index bdc8302..deca78f 100644
1937 +--- a/drivers/gpio/gpio-em.c
1938 ++++ b/drivers/gpio/gpio-em.c
1939 +@@ -299,8 +299,9 @@ static int em_gio_probe(struct platform_device *pdev)
1940 + irq_chip->irq_set_type = em_gio_irq_set_type;
1941 + irq_chip->flags = IRQCHIP_SKIP_SET_WAKE;
1942 +
1943 +- p->irq_domain = irq_domain_add_linear(pdev->dev.of_node,
1944 ++ p->irq_domain = irq_domain_add_simple(pdev->dev.of_node,
1945 + pdata->number_of_pins,
1946 ++ pdata->irq_base,
1947 + &em_gio_irq_domain_ops, p);
1948 + if (!p->irq_domain) {
1949 + ret = -ENXIO;
1950 +diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
1951 +index f2d667b..bcb2c0a 100644
1952 +--- a/drivers/gpu/drm/drm_crtc.c
1953 ++++ b/drivers/gpu/drm/drm_crtc.c
1954 +@@ -2089,7 +2089,7 @@ uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth)
1955 +
1956 + switch (bpp) {
1957 + case 8:
1958 +- fmt = DRM_FORMAT_RGB332;
1959 ++ fmt = DRM_FORMAT_C8;
1960 + break;
1961 + case 16:
1962 + if (depth == 15)
1963 +@@ -3702,6 +3702,7 @@ void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
1964 + int *bpp)
1965 + {
1966 + switch (format) {
1967 ++ case DRM_FORMAT_C8:
1968 + case DRM_FORMAT_RGB332:
1969 + case DRM_FORMAT_BGR233:
1970 + *depth = 8;
1971 +diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
1972 +index 5a3770f..aaded22 100644
1973 +--- a/drivers/gpu/drm/drm_edid.c
1974 ++++ b/drivers/gpu/drm/drm_edid.c
1975 +@@ -87,9 +87,6 @@ static struct edid_quirk {
1976 + int product_id;
1977 + u32 quirks;
1978 + } edid_quirk_list[] = {
1979 +- /* ASUS VW222S */
1980 +- { "ACI", 0x22a2, EDID_QUIRK_FORCE_REDUCED_BLANKING },
1981 +-
1982 + /* Acer AL1706 */
1983 + { "ACR", 44358, EDID_QUIRK_PREFER_LARGE_60 },
1984 + /* Acer F51 */
1985 +@@ -357,10 +354,14 @@ drm_do_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter)
1986 + break;
1987 + }
1988 + }
1989 +- if (i == 4)
1990 ++
1991 ++ if (i == 4 && print_bad_edid) {
1992 + dev_warn(connector->dev->dev,
1993 + "%s: Ignoring invalid EDID block %d.\n",
1994 + drm_get_connector_name(connector), j);
1995 ++
1996 ++ connector->bad_edid_counter++;
1997 ++ }
1998 + }
1999 +
2000 + if (valid_extensions != block[0x7e]) {
2001 +@@ -2020,7 +2021,8 @@ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid)
2002 + num_modes += add_cvt_modes(connector, edid);
2003 + num_modes += add_standard_modes(connector, edid);
2004 + num_modes += add_established_modes(connector, edid);
2005 +- num_modes += add_inferred_modes(connector, edid);
2006 ++ if (edid->features & DRM_EDID_FEATURE_DEFAULT_GTF)
2007 ++ num_modes += add_inferred_modes(connector, edid);
2008 + num_modes += add_cea_modes(connector, edid);
2009 +
2010 + if (quirks & (EDID_QUIRK_PREFER_LARGE_60 | EDID_QUIRK_PREFER_LARGE_75))
2011 +diff --git a/drivers/gpu/drm/drm_usb.c b/drivers/gpu/drm/drm_usb.c
2012 +index 3cec306..34a156f 100644
2013 +--- a/drivers/gpu/drm/drm_usb.c
2014 ++++ b/drivers/gpu/drm/drm_usb.c
2015 +@@ -18,7 +18,7 @@ int drm_get_usb_dev(struct usb_interface *interface,
2016 +
2017 + usbdev = interface_to_usbdev(interface);
2018 + dev->usbdev = usbdev;
2019 +- dev->dev = &usbdev->dev;
2020 ++ dev->dev = &interface->dev;
2021 +
2022 + mutex_lock(&drm_global_mutex);
2023 +
2024 +diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
2025 +index 9d4a2c2..8a7c48b 100644
2026 +--- a/drivers/gpu/drm/i915/i915_debugfs.c
2027 ++++ b/drivers/gpu/drm/i915/i915_debugfs.c
2028 +@@ -691,7 +691,7 @@ static int i915_error_state(struct seq_file *m, void *unused)
2029 +
2030 + seq_printf(m, "Time: %ld s %ld us\n", error->time.tv_sec,
2031 + error->time.tv_usec);
2032 +- seq_printf(m, "Kernel: " UTS_RELEASE);
2033 ++ seq_printf(m, "Kernel: " UTS_RELEASE "\n");
2034 + seq_printf(m, "PCI ID: 0x%04x\n", dev->pci_device);
2035 + seq_printf(m, "EIR: 0x%08x\n", error->eir);
2036 + seq_printf(m, "IER: 0x%08x\n", error->ier);
2037 +@@ -888,7 +888,7 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
2038 + u32 gt_perf_status = I915_READ(GEN6_GT_PERF_STATUS);
2039 + u32 rp_state_limits = I915_READ(GEN6_RP_STATE_LIMITS);
2040 + u32 rp_state_cap = I915_READ(GEN6_RP_STATE_CAP);
2041 +- u32 rpstat;
2042 ++ u32 rpstat, cagf;
2043 + u32 rpupei, rpcurup, rpprevup;
2044 + u32 rpdownei, rpcurdown, rpprevdown;
2045 + int max_freq;
2046 +@@ -907,6 +907,11 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
2047 + rpdownei = I915_READ(GEN6_RP_CUR_DOWN_EI);
2048 + rpcurdown = I915_READ(GEN6_RP_CUR_DOWN);
2049 + rpprevdown = I915_READ(GEN6_RP_PREV_DOWN);
2050 ++ if (IS_HASWELL(dev))
2051 ++ cagf = (rpstat & HSW_CAGF_MASK) >> HSW_CAGF_SHIFT;
2052 ++ else
2053 ++ cagf = (rpstat & GEN6_CAGF_MASK) >> GEN6_CAGF_SHIFT;
2054 ++ cagf *= GT_FREQUENCY_MULTIPLIER;
2055 +
2056 + gen6_gt_force_wake_put(dev_priv);
2057 + mutex_unlock(&dev->struct_mutex);
2058 +@@ -919,8 +924,7 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
2059 + gt_perf_status & 0xff);
2060 + seq_printf(m, "Render p-state limit: %d\n",
2061 + rp_state_limits & 0xff);
2062 +- seq_printf(m, "CAGF: %dMHz\n", ((rpstat & GEN6_CAGF_MASK) >>
2063 +- GEN6_CAGF_SHIFT) * GT_FREQUENCY_MULTIPLIER);
2064 ++ seq_printf(m, "CAGF: %dMHz\n", cagf);
2065 + seq_printf(m, "RP CUR UP EI: %dus\n", rpupei &
2066 + GEN6_CURICONT_MASK);
2067 + seq_printf(m, "RP CUR UP: %dus\n", rpcurup &
2068 +diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
2069 +index 12ab3bd..7339a4b 100644
2070 +--- a/drivers/gpu/drm/i915/i915_drv.h
2071 ++++ b/drivers/gpu/drm/i915/i915_drv.h
2072 +@@ -919,7 +919,7 @@ typedef struct drm_i915_private {
2073 + bool hw_contexts_disabled;
2074 + uint32_t hw_context_size;
2075 +
2076 +- bool fdi_rx_polarity_reversed;
2077 ++ u32 fdi_rx_config;
2078 +
2079 + struct i915_suspend_saved_registers regfile;
2080 +
2081 +diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
2082 +index 8febea6..de45b60 100644
2083 +--- a/drivers/gpu/drm/i915/i915_gem.c
2084 ++++ b/drivers/gpu/drm/i915/i915_gem.c
2085 +@@ -1918,9 +1918,6 @@ i915_gem_object_move_to_inactive(struct drm_i915_gem_object *obj)
2086 + BUG_ON(obj->base.write_domain & ~I915_GEM_GPU_DOMAINS);
2087 + BUG_ON(!obj->active);
2088 +
2089 +- if (obj->pin_count) /* are we a framebuffer? */
2090 +- intel_mark_fb_idle(obj);
2091 +-
2092 + list_move_tail(&obj->mm_list, &dev_priv->mm.inactive_list);
2093 +
2094 + list_del_init(&obj->ring_list);
2095 +@@ -3848,7 +3845,7 @@ void i915_gem_l3_remap(struct drm_device *dev)
2096 + u32 misccpctl;
2097 + int i;
2098 +
2099 +- if (!IS_IVYBRIDGE(dev))
2100 ++ if (!HAS_L3_GPU_CACHE(dev))
2101 + return;
2102 +
2103 + if (!dev_priv->l3_parity.remap_info)
2104 +diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
2105 +index 59afb7e..2bfd05a 100644
2106 +--- a/drivers/gpu/drm/i915/i915_reg.h
2107 ++++ b/drivers/gpu/drm/i915/i915_reg.h
2108 +@@ -3927,7 +3927,7 @@
2109 + #define FDI_10BPC (1<<16)
2110 + #define FDI_6BPC (2<<16)
2111 + #define FDI_12BPC (3<<16)
2112 +-#define FDI_LINK_REVERSE_OVERWRITE (1<<15)
2113 ++#define FDI_RX_LINK_REVERSAL_OVERRIDE (1<<15)
2114 + #define FDI_DMI_LINK_REVERSE_MASK (1<<14)
2115 + #define FDI_RX_PLL_ENABLE (1<<13)
2116 + #define FDI_FS_ERR_CORRECT_ENABLE (1<<11)
2117 +@@ -4211,7 +4211,9 @@
2118 + #define GEN6_RP_INTERRUPT_LIMITS 0xA014
2119 + #define GEN6_RPSTAT1 0xA01C
2120 + #define GEN6_CAGF_SHIFT 8
2121 ++#define HSW_CAGF_SHIFT 7
2122 + #define GEN6_CAGF_MASK (0x7f << GEN6_CAGF_SHIFT)
2123 ++#define HSW_CAGF_MASK (0x7f << HSW_CAGF_SHIFT)
2124 + #define GEN6_RP_CONTROL 0xA024
2125 + #define GEN6_RP_MEDIA_TURBO (1<<11)
2126 + #define GEN6_RP_MEDIA_MODE_MASK (3<<9)
2127 +@@ -4280,8 +4282,8 @@
2128 + #define GEN6_PCODE_READ_MIN_FREQ_TABLE 0x9
2129 + #define GEN6_PCODE_WRITE_RC6VIDS 0x4
2130 + #define GEN6_PCODE_READ_RC6VIDS 0x5
2131 +-#define GEN6_ENCODE_RC6_VID(mv) (((mv) / 5) - 245) < 0 ?: 0
2132 +-#define GEN6_DECODE_RC6_VID(vids) (((vids) * 5) > 0 ? ((vids) * 5) + 245 : 0)
2133 ++#define GEN6_ENCODE_RC6_VID(mv) (((mv) - 245) / 5)
2134 ++#define GEN6_DECODE_RC6_VID(vids) (((vids) * 5) + 245)
2135 + #define GEN6_PCODE_DATA 0x138128
2136 + #define GEN6_PCODE_FREQ_IA_RATIO_SHIFT 8
2137 +
2138 +@@ -4524,6 +4526,7 @@
2139 + #define DDI_BUF_EMP_800MV_0DB_HSW (7<<24) /* Sel7 */
2140 + #define DDI_BUF_EMP_800MV_3_5DB_HSW (8<<24) /* Sel8 */
2141 + #define DDI_BUF_EMP_MASK (0xf<<24)
2142 ++#define DDI_BUF_PORT_REVERSAL (1<<16)
2143 + #define DDI_BUF_IS_IDLE (1<<7)
2144 + #define DDI_A_4_LANES (1<<4)
2145 + #define DDI_PORT_WIDTH_X1 (0<<1)
2146 +diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
2147 +index 9293878..06b1786 100644
2148 +--- a/drivers/gpu/drm/i915/intel_crt.c
2149 ++++ b/drivers/gpu/drm/i915/intel_crt.c
2150 +@@ -800,10 +800,14 @@ void intel_crt_init(struct drm_device *dev)
2151 + dev_priv->hotplug_supported_mask |= CRT_HOTPLUG_INT_STATUS;
2152 +
2153 + /*
2154 +- * TODO: find a proper way to discover whether we need to set the
2155 +- * polarity reversal bit or not, instead of relying on the BIOS.
2156 ++ * TODO: find a proper way to discover whether we need to set the the
2157 ++ * polarity and link reversal bits or not, instead of relying on the
2158 ++ * BIOS.
2159 + */
2160 +- if (HAS_PCH_LPT(dev))
2161 +- dev_priv->fdi_rx_polarity_reversed =
2162 +- !!(I915_READ(_FDI_RXA_CTL) & FDI_RX_POLARITY_REVERSED_LPT);
2163 ++ if (HAS_PCH_LPT(dev)) {
2164 ++ u32 fdi_config = FDI_RX_POLARITY_REVERSED_LPT |
2165 ++ FDI_RX_LINK_REVERSAL_OVERRIDE;
2166 ++
2167 ++ dev_priv->fdi_rx_config = I915_READ(_FDI_RXA_CTL) & fdi_config;
2168 ++ }
2169 + }
2170 +diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
2171 +index 4bad0f7..59b778d 100644
2172 +--- a/drivers/gpu/drm/i915/intel_ddi.c
2173 ++++ b/drivers/gpu/drm/i915/intel_ddi.c
2174 +@@ -178,10 +178,8 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)
2175 + FDI_RX_TP1_TO_TP2_48 | FDI_RX_FDI_DELAY_90);
2176 +
2177 + /* Enable the PCH Receiver FDI PLL */
2178 +- rx_ctl_val = FDI_RX_PLL_ENABLE | FDI_RX_ENHANCE_FRAME_ENABLE |
2179 +- ((intel_crtc->fdi_lanes - 1) << 19);
2180 +- if (dev_priv->fdi_rx_polarity_reversed)
2181 +- rx_ctl_val |= FDI_RX_POLARITY_REVERSED_LPT;
2182 ++ rx_ctl_val = dev_priv->fdi_rx_config | FDI_RX_ENHANCE_FRAME_ENABLE |
2183 ++ FDI_RX_PLL_ENABLE | ((intel_crtc->fdi_lanes - 1) << 19);
2184 + I915_WRITE(_FDI_RXA_CTL, rx_ctl_val);
2185 + POSTING_READ(_FDI_RXA_CTL);
2186 + udelay(220);
2187 +@@ -203,7 +201,10 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)
2188 + DP_TP_CTL_LINK_TRAIN_PAT1 |
2189 + DP_TP_CTL_ENABLE);
2190 +
2191 +- /* Configure and enable DDI_BUF_CTL for DDI E with next voltage */
2192 ++ /* Configure and enable DDI_BUF_CTL for DDI E with next voltage.
2193 ++ * DDI E does not support port reversal, the functionality is
2194 ++ * achieved on the PCH side in FDI_RX_CTL, so no need to set the
2195 ++ * port reversal bit */
2196 + I915_WRITE(DDI_BUF_CTL(PORT_E),
2197 + DDI_BUF_CTL_ENABLE |
2198 + ((intel_crtc->fdi_lanes - 1) << 1) |
2199 +@@ -677,8 +678,11 @@ static void intel_ddi_mode_set(struct drm_encoder *encoder,
2200 +
2201 + if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) {
2202 + struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
2203 ++ struct intel_digital_port *intel_dig_port =
2204 ++ enc_to_dig_port(encoder);
2205 +
2206 +- intel_dp->DP = DDI_BUF_CTL_ENABLE | DDI_BUF_EMP_400MV_0DB_HSW;
2207 ++ intel_dp->DP = intel_dig_port->port_reversal |
2208 ++ DDI_BUF_CTL_ENABLE | DDI_BUF_EMP_400MV_0DB_HSW;
2209 + switch (intel_dp->lane_count) {
2210 + case 1:
2211 + intel_dp->DP |= DDI_PORT_WIDTH_X1;
2212 +@@ -1291,11 +1295,15 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder)
2213 + int type = intel_encoder->type;
2214 +
2215 + if (type == INTEL_OUTPUT_HDMI) {
2216 ++ struct intel_digital_port *intel_dig_port =
2217 ++ enc_to_dig_port(encoder);
2218 ++
2219 + /* In HDMI/DVI mode, the port width, and swing/emphasis values
2220 + * are ignored so nothing special needs to be done besides
2221 + * enabling the port.
2222 + */
2223 +- I915_WRITE(DDI_BUF_CTL(port), DDI_BUF_CTL_ENABLE);
2224 ++ I915_WRITE(DDI_BUF_CTL(port),
2225 ++ intel_dig_port->port_reversal | DDI_BUF_CTL_ENABLE);
2226 + } else if (type == INTEL_OUTPUT_EDP) {
2227 + struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
2228 +
2229 +@@ -1457,6 +1465,7 @@ static const struct drm_encoder_helper_funcs intel_ddi_helper_funcs = {
2230 +
2231 + void intel_ddi_init(struct drm_device *dev, enum port port)
2232 + {
2233 ++ struct drm_i915_private *dev_priv = dev->dev_private;
2234 + struct intel_digital_port *intel_dig_port;
2235 + struct intel_encoder *intel_encoder;
2236 + struct drm_encoder *encoder;
2237 +@@ -1497,6 +1506,8 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
2238 + intel_encoder->get_hw_state = intel_ddi_get_hw_state;
2239 +
2240 + intel_dig_port->port = port;
2241 ++ intel_dig_port->port_reversal = I915_READ(DDI_BUF_CTL(port)) &
2242 ++ DDI_BUF_PORT_REVERSAL;
2243 + if (hdmi_connector)
2244 + intel_dig_port->hdmi.sdvox_reg = DDI_BUF_CTL(port);
2245 + else
2246 +diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
2247 +index da1ad9c..80aa1fc 100644
2248 +--- a/drivers/gpu/drm/i915/intel_display.c
2249 ++++ b/drivers/gpu/drm/i915/intel_display.c
2250 +@@ -154,8 +154,8 @@ static const intel_limit_t intel_limits_i9xx_sdvo = {
2251 + .vco = { .min = 1400000, .max = 2800000 },
2252 + .n = { .min = 1, .max = 6 },
2253 + .m = { .min = 70, .max = 120 },
2254 +- .m1 = { .min = 10, .max = 22 },
2255 +- .m2 = { .min = 5, .max = 9 },
2256 ++ .m1 = { .min = 8, .max = 18 },
2257 ++ .m2 = { .min = 3, .max = 7 },
2258 + .p = { .min = 5, .max = 80 },
2259 + .p1 = { .min = 1, .max = 8 },
2260 + .p2 = { .dot_limit = 200000,
2261 +@@ -2017,18 +2017,29 @@ void intel_unpin_fb_obj(struct drm_i915_gem_object *obj)
2262 +
2263 + /* Computes the linear offset to the base tile and adjusts x, y. bytes per pixel
2264 + * is assumed to be a power-of-two. */
2265 +-unsigned long intel_gen4_compute_offset_xtiled(int *x, int *y,
2266 +- unsigned int bpp,
2267 +- unsigned int pitch)
2268 ++unsigned long intel_gen4_compute_page_offset(int *x, int *y,
2269 ++ unsigned int tiling_mode,
2270 ++ unsigned int cpp,
2271 ++ unsigned int pitch)
2272 + {
2273 +- int tile_rows, tiles;
2274 ++ if (tiling_mode != I915_TILING_NONE) {
2275 ++ unsigned int tile_rows, tiles;
2276 ++
2277 ++ tile_rows = *y / 8;
2278 ++ *y %= 8;
2279 +
2280 +- tile_rows = *y / 8;
2281 +- *y %= 8;
2282 +- tiles = *x / (512/bpp);
2283 +- *x %= 512/bpp;
2284 ++ tiles = *x / (512/cpp);
2285 ++ *x %= 512/cpp;
2286 ++
2287 ++ return tile_rows * pitch * 8 + tiles * 4096;
2288 ++ } else {
2289 ++ unsigned int offset;
2290 +
2291 +- return tile_rows * pitch * 8 + tiles * 4096;
2292 ++ offset = *y * pitch + *x * cpp;
2293 ++ *y = 0;
2294 ++ *x = (offset & 4095) / cpp;
2295 ++ return offset & -4096;
2296 ++ }
2297 + }
2298 +
2299 + static int i9xx_update_plane(struct drm_crtc *crtc, struct drm_framebuffer *fb,
2300 +@@ -2105,9 +2116,9 @@ static int i9xx_update_plane(struct drm_crtc *crtc, struct drm_framebuffer *fb,
2301 +
2302 + if (INTEL_INFO(dev)->gen >= 4) {
2303 + intel_crtc->dspaddr_offset =
2304 +- intel_gen4_compute_offset_xtiled(&x, &y,
2305 +- fb->bits_per_pixel / 8,
2306 +- fb->pitches[0]);
2307 ++ intel_gen4_compute_page_offset(&x, &y, obj->tiling_mode,
2308 ++ fb->bits_per_pixel / 8,
2309 ++ fb->pitches[0]);
2310 + linear_offset -= intel_crtc->dspaddr_offset;
2311 + } else {
2312 + intel_crtc->dspaddr_offset = linear_offset;
2313 +@@ -2198,9 +2209,9 @@ static int ironlake_update_plane(struct drm_crtc *crtc,
2314 +
2315 + linear_offset = y * fb->pitches[0] + x * (fb->bits_per_pixel / 8);
2316 + intel_crtc->dspaddr_offset =
2317 +- intel_gen4_compute_offset_xtiled(&x, &y,
2318 +- fb->bits_per_pixel / 8,
2319 +- fb->pitches[0]);
2320 ++ intel_gen4_compute_page_offset(&x, &y, obj->tiling_mode,
2321 ++ fb->bits_per_pixel / 8,
2322 ++ fb->pitches[0]);
2323 + linear_offset -= intel_crtc->dspaddr_offset;
2324 +
2325 + DRM_DEBUG_KMS("Writing base %08X %08lX %d %d %d\n",
2326 +@@ -3686,6 +3697,7 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
2327 + struct intel_encoder *encoder;
2328 + int pipe = intel_crtc->pipe;
2329 + int plane = intel_crtc->plane;
2330 ++ u32 pctl;
2331 +
2332 +
2333 + if (!intel_crtc->active)
2334 +@@ -3705,6 +3717,13 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
2335 +
2336 + intel_disable_plane(dev_priv, plane, pipe);
2337 + intel_disable_pipe(dev_priv, pipe);
2338 ++
2339 ++ /* Disable pannel fitter if it is on this pipe. */
2340 ++ pctl = I915_READ(PFIT_CONTROL);
2341 ++ if ((pctl & PFIT_ENABLE) &&
2342 ++ ((pctl & PFIT_PIPE_MASK) >> PFIT_PIPE_SHIFT) == pipe)
2343 ++ I915_WRITE(PFIT_CONTROL, 0);
2344 ++
2345 + intel_disable_pll(dev_priv, pipe);
2346 +
2347 + intel_crtc->active = false;
2348 +@@ -6993,11 +7012,6 @@ void intel_mark_busy(struct drm_device *dev)
2349 +
2350 + void intel_mark_idle(struct drm_device *dev)
2351 + {
2352 +-}
2353 +-
2354 +-void intel_mark_fb_busy(struct drm_i915_gem_object *obj)
2355 +-{
2356 +- struct drm_device *dev = obj->base.dev;
2357 + struct drm_crtc *crtc;
2358 +
2359 + if (!i915_powersave)
2360 +@@ -7007,12 +7021,11 @@ void intel_mark_fb_busy(struct drm_i915_gem_object *obj)
2361 + if (!crtc->fb)
2362 + continue;
2363 +
2364 +- if (to_intel_framebuffer(crtc->fb)->obj == obj)
2365 +- intel_increase_pllclock(crtc);
2366 ++ intel_decrease_pllclock(crtc);
2367 + }
2368 + }
2369 +
2370 +-void intel_mark_fb_idle(struct drm_i915_gem_object *obj)
2371 ++void intel_mark_fb_busy(struct drm_i915_gem_object *obj)
2372 + {
2373 + struct drm_device *dev = obj->base.dev;
2374 + struct drm_crtc *crtc;
2375 +@@ -7025,7 +7038,7 @@ void intel_mark_fb_idle(struct drm_i915_gem_object *obj)
2376 + continue;
2377 +
2378 + if (to_intel_framebuffer(crtc->fb)->obj == obj)
2379 +- intel_decrease_pllclock(crtc);
2380 ++ intel_increase_pllclock(crtc);
2381 + }
2382 + }
2383 +
2384 +@@ -8888,6 +8901,9 @@ static struct intel_quirk intel_quirks[] = {
2385 +
2386 + /* Acer Aspire 5734Z must invert backlight brightness */
2387 + { 0x2a42, 0x1025, 0x0459, quirk_invert_brightness },
2388 ++
2389 ++ /* Acer Aspire 4736Z */
2390 ++ { 0x2a42, 0x1025, 0x0260, quirk_invert_brightness },
2391 + };
2392 +
2393 + static void intel_init_quirks(struct drm_device *dev)
2394 +diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
2395 +index 8a1bd4a..1c1840f 100644
2396 +--- a/drivers/gpu/drm/i915/intel_drv.h
2397 ++++ b/drivers/gpu/drm/i915/intel_drv.h
2398 +@@ -377,6 +377,7 @@ struct intel_dp {
2399 + struct intel_digital_port {
2400 + struct intel_encoder base;
2401 + enum port port;
2402 ++ u32 port_reversal;
2403 + struct intel_dp dp;
2404 + struct intel_hdmi hdmi;
2405 + };
2406 +@@ -439,9 +440,8 @@ extern bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg,
2407 + extern void intel_dvo_init(struct drm_device *dev);
2408 + extern void intel_tv_init(struct drm_device *dev);
2409 + extern void intel_mark_busy(struct drm_device *dev);
2410 +-extern void intel_mark_idle(struct drm_device *dev);
2411 + extern void intel_mark_fb_busy(struct drm_i915_gem_object *obj);
2412 +-extern void intel_mark_fb_idle(struct drm_i915_gem_object *obj);
2413 ++extern void intel_mark_idle(struct drm_device *dev);
2414 + extern bool intel_lvds_init(struct drm_device *dev);
2415 + extern void intel_dp_init(struct drm_device *dev, int output_reg,
2416 + enum port port);
2417 +@@ -627,9 +627,10 @@ extern void intel_update_sprite_watermarks(struct drm_device *dev, int pipe,
2418 + extern void intel_update_linetime_watermarks(struct drm_device *dev, int pipe,
2419 + struct drm_display_mode *mode);
2420 +
2421 +-extern unsigned long intel_gen4_compute_offset_xtiled(int *x, int *y,
2422 +- unsigned int bpp,
2423 +- unsigned int pitch);
2424 ++extern unsigned long intel_gen4_compute_page_offset(int *x, int *y,
2425 ++ unsigned int tiling_mode,
2426 ++ unsigned int bpp,
2427 ++ unsigned int pitch);
2428 +
2429 + extern int intel_sprite_set_colorkey(struct drm_device *dev, void *data,
2430 + struct drm_file *file_priv);
2431 +diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
2432 +index bee8cb6..a3730e0 100644
2433 +--- a/drivers/gpu/drm/i915/intel_panel.c
2434 ++++ b/drivers/gpu/drm/i915/intel_panel.c
2435 +@@ -321,6 +321,9 @@ void intel_panel_enable_backlight(struct drm_device *dev,
2436 + if (dev_priv->backlight_level == 0)
2437 + dev_priv->backlight_level = intel_panel_get_max_backlight(dev);
2438 +
2439 ++ dev_priv->backlight_enabled = true;
2440 ++ intel_panel_actually_set_backlight(dev, dev_priv->backlight_level);
2441 ++
2442 + if (INTEL_INFO(dev)->gen >= 4) {
2443 + uint32_t reg, tmp;
2444 +
2445 +@@ -356,12 +359,12 @@ void intel_panel_enable_backlight(struct drm_device *dev,
2446 + }
2447 +
2448 + set_level:
2449 +- /* Call below after setting BLC_PWM_CPU_CTL2 and BLC_PWM_PCH_CTL1.
2450 +- * BLC_PWM_CPU_CTL may be cleared to zero automatically when these
2451 +- * registers are set.
2452 ++ /* Check the current backlight level and try to set again if it's zero.
2453 ++ * On some machines, BLC_PWM_CPU_CTL is cleared to zero automatically
2454 ++ * when BLC_PWM_CPU_CTL2 and BLC_PWM_PCH_CTL1 are written.
2455 + */
2456 +- dev_priv->backlight_enabled = true;
2457 +- intel_panel_actually_set_backlight(dev, dev_priv->backlight_level);
2458 ++ if (!intel_panel_get_backlight(dev))
2459 ++ intel_panel_actually_set_backlight(dev, dev_priv->backlight_level);
2460 + }
2461 +
2462 + static void intel_panel_init_backlight(struct drm_device *dev)
2463 +diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
2464 +index d7b060e..9a8d667 100644
2465 +--- a/drivers/gpu/drm/i915/intel_sprite.c
2466 ++++ b/drivers/gpu/drm/i915/intel_sprite.c
2467 +@@ -122,8 +122,8 @@ ivb_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb,
2468 +
2469 + linear_offset = y * fb->pitches[0] + x * pixel_size;
2470 + sprsurf_offset =
2471 +- intel_gen4_compute_offset_xtiled(&x, &y,
2472 +- pixel_size, fb->pitches[0]);
2473 ++ intel_gen4_compute_page_offset(&x, &y, obj->tiling_mode,
2474 ++ pixel_size, fb->pitches[0]);
2475 + linear_offset -= sprsurf_offset;
2476 +
2477 + /* HSW consolidates SPRTILEOFF and SPRLINOFF into a single SPROFFSET
2478 +@@ -287,8 +287,8 @@ ilk_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb,
2479 +
2480 + linear_offset = y * fb->pitches[0] + x * pixel_size;
2481 + dvssurf_offset =
2482 +- intel_gen4_compute_offset_xtiled(&x, &y,
2483 +- pixel_size, fb->pitches[0]);
2484 ++ intel_gen4_compute_page_offset(&x, &y, obj->tiling_mode,
2485 ++ pixel_size, fb->pitches[0]);
2486 + linear_offset -= dvssurf_offset;
2487 +
2488 + if (obj->tiling_mode != I915_TILING_NONE)
2489 +diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/bios/dcb.h b/drivers/gpu/drm/nouveau/core/include/subdev/bios/dcb.h
2490 +index b79025d..123270e9 100644
2491 +--- a/drivers/gpu/drm/nouveau/core/include/subdev/bios/dcb.h
2492 ++++ b/drivers/gpu/drm/nouveau/core/include/subdev/bios/dcb.h
2493 +@@ -16,6 +16,8 @@ enum dcb_output_type {
2494 +
2495 + struct dcb_output {
2496 + int index; /* may not be raw dcb index if merging has happened */
2497 ++ u16 hasht;
2498 ++ u16 hashm;
2499 + enum dcb_output_type type;
2500 + uint8_t i2c_index;
2501 + uint8_t heads;
2502 +@@ -25,6 +27,7 @@ struct dcb_output {
2503 + uint8_t or;
2504 + uint8_t link;
2505 + bool duallink_possible;
2506 ++ uint8_t extdev;
2507 + union {
2508 + struct sor_conf {
2509 + int link;
2510 +diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c b/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c
2511 +index 0fd87df..2d9b9d7 100644
2512 +--- a/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c
2513 ++++ b/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c
2514 +@@ -107,6 +107,18 @@ dcb_outp(struct nouveau_bios *bios, u8 idx, u8 *ver, u8 *len)
2515 + return 0x0000;
2516 + }
2517 +
2518 ++static inline u16
2519 ++dcb_outp_hasht(struct dcb_output *outp)
2520 ++{
2521 ++ return (outp->extdev << 8) | (outp->location << 4) | outp->type;
2522 ++}
2523 ++
2524 ++static inline u16
2525 ++dcb_outp_hashm(struct dcb_output *outp)
2526 ++{
2527 ++ return (outp->heads << 8) | (outp->link << 6) | outp->or;
2528 ++}
2529 ++
2530 + u16
2531 + dcb_outp_parse(struct nouveau_bios *bios, u8 idx, u8 *ver, u8 *len,
2532 + struct dcb_output *outp)
2533 +@@ -135,34 +147,28 @@ dcb_outp_parse(struct nouveau_bios *bios, u8 idx, u8 *ver, u8 *len,
2534 + case DCB_OUTPUT_DP:
2535 + outp->link = (conf & 0x00000030) >> 4;
2536 + outp->sorconf.link = outp->link; /*XXX*/
2537 ++ outp->extdev = 0x00;
2538 ++ if (outp->location != 0)
2539 ++ outp->extdev = (conf & 0x0000ff00) >> 8;
2540 + break;
2541 + default:
2542 + break;
2543 + }
2544 + }
2545 ++
2546 ++ outp->hasht = dcb_outp_hasht(outp);
2547 ++ outp->hashm = dcb_outp_hashm(outp);
2548 + }
2549 + return dcb;
2550 + }
2551 +
2552 +-static inline u16
2553 +-dcb_outp_hasht(struct dcb_output *outp)
2554 +-{
2555 +- return outp->type;
2556 +-}
2557 +-
2558 +-static inline u16
2559 +-dcb_outp_hashm(struct dcb_output *outp)
2560 +-{
2561 +- return (outp->heads << 8) | (outp->link << 6) | outp->or;
2562 +-}
2563 +-
2564 + u16
2565 + dcb_outp_match(struct nouveau_bios *bios, u16 type, u16 mask,
2566 + u8 *ver, u8 *len, struct dcb_output *outp)
2567 + {
2568 + u16 dcb, idx = 0;
2569 + while ((dcb = dcb_outp_parse(bios, idx++, ver, len, outp))) {
2570 +- if (dcb_outp_hasht(outp) == type) {
2571 ++ if ((dcb_outp_hasht(outp) & 0x00ff) == (type & 0x00ff)) {
2572 + if ((dcb_outp_hashm(outp) & mask) == mask)
2573 + break;
2574 + }
2575 +diff --git a/drivers/gpu/drm/nouveau/core/subdev/devinit/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/devinit/nv50.c
2576 +index ae7249b..4a85778 100644
2577 +--- a/drivers/gpu/drm/nouveau/core/subdev/devinit/nv50.c
2578 ++++ b/drivers/gpu/drm/nouveau/core/subdev/devinit/nv50.c
2579 +@@ -78,12 +78,13 @@ nv50_devinit_init(struct nouveau_object *object)
2580 + if (ret)
2581 + return ret;
2582 +
2583 +- /* if we ran the init tables, execute first script pointer for each
2584 +- * display table output entry that has a matching dcb entry.
2585 ++ /* if we ran the init tables, we have to execute the first script
2586 ++ * pointer of each dcb entry's display encoder table in order
2587 ++ * to properly initialise each encoder.
2588 + */
2589 +- while (priv->base.post && ver) {
2590 +- u16 data = nvbios_outp_parse(bios, i++, &ver, &hdr, &cnt, &len, &info);
2591 +- if (data && dcb_outp_match(bios, info.type, info.mask, &ver, &len, &outp)) {
2592 ++ while (priv->base.post && dcb_outp_parse(bios, i, &ver, &hdr, &outp)) {
2593 ++ if (nvbios_outp_match(bios, outp.hasht, outp.hashm,
2594 ++ &ver, &hdr, &cnt, &len, &info)) {
2595 + struct nvbios_init init = {
2596 + .subdev = nv_subdev(priv),
2597 + .bios = bios,
2598 +@@ -95,7 +96,8 @@ nv50_devinit_init(struct nouveau_object *object)
2599 +
2600 + nvbios_exec(&init);
2601 + }
2602 +- };
2603 ++ i++;
2604 ++ }
2605 +
2606 + return 0;
2607 + }
2608 +diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
2609 +index 9175615..21a892c 100644
2610 +--- a/drivers/gpu/drm/radeon/atombios_crtc.c
2611 ++++ b/drivers/gpu/drm/radeon/atombios_crtc.c
2612 +@@ -252,8 +252,6 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode)
2613 + radeon_crtc->enabled = true;
2614 + /* adjust pm to dpms changes BEFORE enabling crtcs */
2615 + radeon_pm_compute_clocks(rdev);
2616 +- if (ASIC_IS_DCE6(rdev) && !radeon_crtc->in_mode_set)
2617 +- atombios_powergate_crtc(crtc, ATOM_DISABLE);
2618 + atombios_enable_crtc(crtc, ATOM_ENABLE);
2619 + if (ASIC_IS_DCE3(rdev) && !ASIC_IS_DCE6(rdev))
2620 + atombios_enable_crtc_memreq(crtc, ATOM_ENABLE);
2621 +@@ -271,8 +269,6 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode)
2622 + atombios_enable_crtc_memreq(crtc, ATOM_DISABLE);
2623 + atombios_enable_crtc(crtc, ATOM_DISABLE);
2624 + radeon_crtc->enabled = false;
2625 +- if (ASIC_IS_DCE6(rdev) && !radeon_crtc->in_mode_set)
2626 +- atombios_powergate_crtc(crtc, ATOM_ENABLE);
2627 + /* adjust pm to dpms changes AFTER disabling crtcs */
2628 + radeon_pm_compute_clocks(rdev);
2629 + break;
2630 +@@ -1844,6 +1840,8 @@ static void atombios_crtc_disable(struct drm_crtc *crtc)
2631 + int i;
2632 +
2633 + atombios_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
2634 ++ if (ASIC_IS_DCE6(rdev))
2635 ++ atombios_powergate_crtc(crtc, ATOM_ENABLE);
2636 +
2637 + for (i = 0; i < rdev->num_crtc; i++) {
2638 + if (rdev->mode_info.crtcs[i] &&
2639 +diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
2640 +index a2d478e..1b0a4ec 100644
2641 +--- a/drivers/gpu/drm/radeon/evergreen.c
2642 ++++ b/drivers/gpu/drm/radeon/evergreen.c
2643 +@@ -403,6 +403,19 @@ void evergreen_pm_misc(struct radeon_device *rdev)
2644 + rdev->pm.current_vddc = voltage->voltage;
2645 + DRM_DEBUG("Setting: vddc: %d\n", voltage->voltage);
2646 + }
2647 ++
2648 ++ /* starting with BTC, there is one state that is used for both
2649 ++ * MH and SH. Difference is that we always use the high clock index for
2650 ++ * mclk and vddci.
2651 ++ */
2652 ++ if ((rdev->pm.pm_method == PM_METHOD_PROFILE) &&
2653 ++ (rdev->family >= CHIP_BARTS) &&
2654 ++ rdev->pm.active_crtc_count &&
2655 ++ ((rdev->pm.profile_index == PM_PROFILE_MID_MH_IDX) ||
2656 ++ (rdev->pm.profile_index == PM_PROFILE_LOW_MH_IDX)))
2657 ++ voltage = &rdev->pm.power_state[req_ps_idx].
2658 ++ clock_info[rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_on_cm_idx].voltage;
2659 ++
2660 + /* 0xff01 is a flag rather then an actual voltage */
2661 + if (voltage->vddci == 0xff01)
2662 + return;
2663 +diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c
2664 +index ff80efe..95970ec 100644
2665 +--- a/drivers/gpu/drm/radeon/r600_hdmi.c
2666 ++++ b/drivers/gpu/drm/radeon/r600_hdmi.c
2667 +@@ -544,7 +544,6 @@ void r600_hdmi_disable(struct drm_encoder *encoder)
2668 +
2669 + /* Called for ATOM_ENCODER_MODE_HDMI only */
2670 + if (!dig || !dig->afmt) {
2671 +- WARN_ON(1);
2672 + return;
2673 + }
2674 + if (!dig->afmt->enabled)
2675 +diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
2676 +index 15f5ded..d96070b 100644
2677 +--- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c
2678 ++++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
2679 +@@ -43,6 +43,12 @@ struct atpx_verify_interface {
2680 + u32 function_bits; /* supported functions bit vector */
2681 + } __packed;
2682 +
2683 ++struct atpx_px_params {
2684 ++ u16 size; /* structure size in bytes (includes size field) */
2685 ++ u32 valid_flags; /* which flags are valid */
2686 ++ u32 flags; /* flags */
2687 ++} __packed;
2688 ++
2689 + struct atpx_power_control {
2690 + u16 size;
2691 + u8 dgpu_state;
2692 +@@ -123,9 +129,61 @@ static void radeon_atpx_parse_functions(struct radeon_atpx_functions *f, u32 mas
2693 + }
2694 +
2695 + /**
2696 ++ * radeon_atpx_validate_functions - validate ATPX functions
2697 ++ *
2698 ++ * @atpx: radeon atpx struct
2699 ++ *
2700 ++ * Validate that required functions are enabled (all asics).
2701 ++ * returns 0 on success, error on failure.
2702 ++ */
2703 ++static int radeon_atpx_validate(struct radeon_atpx *atpx)
2704 ++{
2705 ++ /* make sure required functions are enabled */
2706 ++ /* dGPU power control is required */
2707 ++ atpx->functions.power_cntl = true;
2708 ++
2709 ++ if (atpx->functions.px_params) {
2710 ++ union acpi_object *info;
2711 ++ struct atpx_px_params output;
2712 ++ size_t size;
2713 ++ u32 valid_bits;
2714 ++
2715 ++ info = radeon_atpx_call(atpx->handle, ATPX_FUNCTION_GET_PX_PARAMETERS, NULL);
2716 ++ if (!info)
2717 ++ return -EIO;
2718 ++
2719 ++ memset(&output, 0, sizeof(output));
2720 ++
2721 ++ size = *(u16 *) info->buffer.pointer;
2722 ++ if (size < 10) {
2723 ++ printk("ATPX buffer is too small: %zu\n", size);
2724 ++ kfree(info);
2725 ++ return -EINVAL;
2726 ++ }
2727 ++ size = min(sizeof(output), size);
2728 ++
2729 ++ memcpy(&output, info->buffer.pointer, size);
2730 ++
2731 ++ valid_bits = output.flags & output.valid_flags;
2732 ++ /* if separate mux flag is set, mux controls are required */
2733 ++ if (valid_bits & ATPX_SEPARATE_MUX_FOR_I2C) {
2734 ++ atpx->functions.i2c_mux_cntl = true;
2735 ++ atpx->functions.disp_mux_cntl = true;
2736 ++ }
2737 ++ /* if any outputs are muxed, mux controls are required */
2738 ++ if (valid_bits & (ATPX_CRT1_RGB_SIGNAL_MUXED |
2739 ++ ATPX_TV_SIGNAL_MUXED |
2740 ++ ATPX_DFP_SIGNAL_MUXED))
2741 ++ atpx->functions.disp_mux_cntl = true;
2742 ++
2743 ++ kfree(info);
2744 ++ }
2745 ++ return 0;
2746 ++}
2747 ++
2748 ++/**
2749 + * radeon_atpx_verify_interface - verify ATPX
2750 + *
2751 +- * @handle: acpi handle
2752 + * @atpx: radeon atpx struct
2753 + *
2754 + * Execute the ATPX_FUNCTION_VERIFY_INTERFACE ATPX function
2755 +@@ -406,8 +464,19 @@ static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev)
2756 + */
2757 + static int radeon_atpx_init(void)
2758 + {
2759 ++ int r;
2760 ++
2761 + /* set up the ATPX handle */
2762 +- return radeon_atpx_verify_interface(&radeon_atpx_priv.atpx);
2763 ++ r = radeon_atpx_verify_interface(&radeon_atpx_priv.atpx);
2764 ++ if (r)
2765 ++ return r;
2766 ++
2767 ++ /* validate the atpx setup */
2768 ++ r = radeon_atpx_validate(&radeon_atpx_priv.atpx);
2769 ++ if (r)
2770 ++ return r;
2771 ++
2772 ++ return 0;
2773 + }
2774 +
2775 + /**
2776 +diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
2777 +index 0bfa656..338fd6a 100644
2778 +--- a/drivers/gpu/drm/radeon/radeon_pm.c
2779 ++++ b/drivers/gpu/drm/radeon/radeon_pm.c
2780 +@@ -169,7 +169,7 @@ static void radeon_set_power_state(struct radeon_device *rdev)
2781 +
2782 + /* starting with BTC, there is one state that is used for both
2783 + * MH and SH. Difference is that we always use the high clock index for
2784 +- * mclk.
2785 ++ * mclk and vddci.
2786 + */
2787 + if ((rdev->pm.pm_method == PM_METHOD_PROFILE) &&
2788 + (rdev->family >= CHIP_BARTS) &&
2789 +diff --git a/drivers/gpu/drm/udl/udl_drv.h b/drivers/gpu/drm/udl/udl_drv.h
2790 +index 87aa5f5..cc6d90f 100644
2791 +--- a/drivers/gpu/drm/udl/udl_drv.h
2792 ++++ b/drivers/gpu/drm/udl/udl_drv.h
2793 +@@ -75,6 +75,8 @@ struct udl_framebuffer {
2794 + struct drm_framebuffer base;
2795 + struct udl_gem_object *obj;
2796 + bool active_16; /* active on the 16-bit channel */
2797 ++ int x1, y1, x2, y2; /* dirty rect */
2798 ++ spinlock_t dirty_lock;
2799 + };
2800 +
2801 + #define to_udl_fb(x) container_of(x, struct udl_framebuffer, base)
2802 +diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c
2803 +index d4ab3be..1eb060c 100644
2804 +--- a/drivers/gpu/drm/udl/udl_fb.c
2805 ++++ b/drivers/gpu/drm/udl/udl_fb.c
2806 +@@ -22,9 +22,9 @@
2807 +
2808 + #include <drm/drm_fb_helper.h>
2809 +
2810 +-#define DL_DEFIO_WRITE_DELAY 5 /* fb_deferred_io.delay in jiffies */
2811 ++#define DL_DEFIO_WRITE_DELAY (HZ/20) /* fb_deferred_io.delay in jiffies */
2812 +
2813 +-static int fb_defio = 1; /* Optionally enable experimental fb_defio mmap support */
2814 ++static int fb_defio = 0; /* Optionally enable experimental fb_defio mmap support */
2815 + static int fb_bpp = 16;
2816 +
2817 + module_param(fb_bpp, int, S_IWUSR | S_IRUSR | S_IWGRP | S_IRGRP);
2818 +@@ -153,6 +153,9 @@ int udl_handle_damage(struct udl_framebuffer *fb, int x, int y,
2819 + struct urb *urb;
2820 + int aligned_x;
2821 + int bpp = (fb->base.bits_per_pixel / 8);
2822 ++ int x2, y2;
2823 ++ bool store_for_later = false;
2824 ++ unsigned long flags;
2825 +
2826 + if (!fb->active_16)
2827 + return 0;
2828 +@@ -169,8 +172,6 @@ int udl_handle_damage(struct udl_framebuffer *fb, int x, int y,
2829 + }
2830 + }
2831 +
2832 +- start_cycles = get_cycles();
2833 +-
2834 + aligned_x = DL_ALIGN_DOWN(x, sizeof(unsigned long));
2835 + width = DL_ALIGN_UP(width + (x-aligned_x), sizeof(unsigned long));
2836 + x = aligned_x;
2837 +@@ -180,19 +181,53 @@ int udl_handle_damage(struct udl_framebuffer *fb, int x, int y,
2838 + (y + height > fb->base.height))
2839 + return -EINVAL;
2840 +
2841 ++ /* if we are in atomic just store the info
2842 ++ can't test inside spin lock */
2843 ++ if (in_atomic())
2844 ++ store_for_later = true;
2845 ++
2846 ++ x2 = x + width - 1;
2847 ++ y2 = y + height - 1;
2848 ++
2849 ++ spin_lock_irqsave(&fb->dirty_lock, flags);
2850 ++
2851 ++ if (fb->y1 < y)
2852 ++ y = fb->y1;
2853 ++ if (fb->y2 > y2)
2854 ++ y2 = fb->y2;
2855 ++ if (fb->x1 < x)
2856 ++ x = fb->x1;
2857 ++ if (fb->x2 > x2)
2858 ++ x2 = fb->x2;
2859 ++
2860 ++ if (store_for_later) {
2861 ++ fb->x1 = x;
2862 ++ fb->x2 = x2;
2863 ++ fb->y1 = y;
2864 ++ fb->y2 = y2;
2865 ++ spin_unlock_irqrestore(&fb->dirty_lock, flags);
2866 ++ return 0;
2867 ++ }
2868 ++
2869 ++ fb->x1 = fb->y1 = INT_MAX;
2870 ++ fb->x2 = fb->y2 = 0;
2871 ++
2872 ++ spin_unlock_irqrestore(&fb->dirty_lock, flags);
2873 ++ start_cycles = get_cycles();
2874 ++
2875 + urb = udl_get_urb(dev);
2876 + if (!urb)
2877 + return 0;
2878 + cmd = urb->transfer_buffer;
2879 +
2880 +- for (i = y; i < y + height ; i++) {
2881 ++ for (i = y; i <= y2 ; i++) {
2882 + const int line_offset = fb->base.pitches[0] * i;
2883 + const int byte_offset = line_offset + (x * bpp);
2884 + const int dev_byte_offset = (fb->base.width * bpp * i) + (x * bpp);
2885 + if (udl_render_hline(dev, bpp, &urb,
2886 + (char *) fb->obj->vmapping,
2887 + &cmd, byte_offset, dev_byte_offset,
2888 +- width * bpp,
2889 ++ (x2 - x + 1) * bpp,
2890 + &bytes_identical, &bytes_sent))
2891 + goto error;
2892 + }
2893 +@@ -434,6 +469,7 @@ udl_framebuffer_init(struct drm_device *dev,
2894 + {
2895 + int ret;
2896 +
2897 ++ spin_lock_init(&ufb->dirty_lock);
2898 + ufb->obj = obj;
2899 + ret = drm_framebuffer_init(dev, &ufb->base, &udlfb_funcs);
2900 + drm_helper_mode_fill_fb_struct(&ufb->base, mode_cmd);
2901 +diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
2902 +index fa60add..cf787e1 100644
2903 +--- a/drivers/gpu/vga/vga_switcheroo.c
2904 ++++ b/drivers/gpu/vga/vga_switcheroo.c
2905 +@@ -25,6 +25,7 @@
2906 + #include <linux/fb.h>
2907 +
2908 + #include <linux/pci.h>
2909 ++#include <linux/console.h>
2910 + #include <linux/vga_switcheroo.h>
2911 +
2912 + #include <linux/vgaarb.h>
2913 +@@ -337,8 +338,10 @@ static int vga_switchto_stage2(struct vga_switcheroo_client *new_client)
2914 +
2915 + if (new_client->fb_info) {
2916 + struct fb_event event;
2917 ++ console_lock();
2918 + event.info = new_client->fb_info;
2919 + fb_notifier_call_chain(FB_EVENT_REMAP_ALL_CONSOLE, &event);
2920 ++ console_unlock();
2921 + }
2922 +
2923 + ret = vgasr_priv.handler->switchto(new_client->id);
2924 +diff --git a/drivers/hid/hid-wiimote-ext.c b/drivers/hid/hid-wiimote-ext.c
2925 +index 38ae877..0472191 100644
2926 +--- a/drivers/hid/hid-wiimote-ext.c
2927 ++++ b/drivers/hid/hid-wiimote-ext.c
2928 +@@ -403,14 +403,14 @@ static void handler_nunchuck(struct wiimote_ext *ext, const __u8 *payload)
2929 +
2930 + if (ext->motionp) {
2931 + input_report_key(ext->input,
2932 +- wiiext_keymap[WIIEXT_KEY_Z], !!(payload[5] & 0x04));
2933 ++ wiiext_keymap[WIIEXT_KEY_Z], !(payload[5] & 0x04));
2934 + input_report_key(ext->input,
2935 +- wiiext_keymap[WIIEXT_KEY_C], !!(payload[5] & 0x08));
2936 ++ wiiext_keymap[WIIEXT_KEY_C], !(payload[5] & 0x08));
2937 + } else {
2938 + input_report_key(ext->input,
2939 +- wiiext_keymap[WIIEXT_KEY_Z], !!(payload[5] & 0x01));
2940 ++ wiiext_keymap[WIIEXT_KEY_Z], !(payload[5] & 0x01));
2941 + input_report_key(ext->input,
2942 +- wiiext_keymap[WIIEXT_KEY_C], !!(payload[5] & 0x02));
2943 ++ wiiext_keymap[WIIEXT_KEY_C], !(payload[5] & 0x02));
2944 + }
2945 +
2946 + input_sync(ext->input);
2947 +diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
2948 +index eca2801..f1e7b86 100644
2949 +--- a/drivers/iommu/intel-iommu.c
2950 ++++ b/drivers/iommu/intel-iommu.c
2951 +@@ -4253,13 +4253,19 @@ static void quirk_iommu_rwbf(struct pci_dev *dev)
2952 + {
2953 + /*
2954 + * Mobile 4 Series Chipset neglects to set RWBF capability,
2955 +- * but needs it:
2956 ++ * but needs it. Same seems to hold for the desktop versions.
2957 + */
2958 + printk(KERN_INFO "DMAR: Forcing write-buffer flush capability\n");
2959 + rwbf_quirk = 1;
2960 + }
2961 +
2962 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_rwbf);
2963 ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2e00, quirk_iommu_rwbf);
2964 ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2e10, quirk_iommu_rwbf);
2965 ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2e20, quirk_iommu_rwbf);
2966 ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2e30, quirk_iommu_rwbf);
2967 ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2e40, quirk_iommu_rwbf);
2968 ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2e90, quirk_iommu_rwbf);
2969 +
2970 + #define GGC 0x52
2971 + #define GGC_MEMORY_SIZE_MASK (0xf << 8)
2972 +diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
2973 +index e6e3911..089e8ea 100644
2974 +--- a/drivers/mmc/core/mmc.c
2975 ++++ b/drivers/mmc/core/mmc.c
2976 +@@ -496,7 +496,7 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
2977 + * RPMB regions are defined in multiples of 128K.
2978 + */
2979 + card->ext_csd.raw_rpmb_size_mult = ext_csd[EXT_CSD_RPMB_MULT];
2980 +- if (ext_csd[EXT_CSD_RPMB_MULT]) {
2981 ++ if (ext_csd[EXT_CSD_RPMB_MULT] && mmc_host_cmd23(card->host)) {
2982 + mmc_part_add(card, ext_csd[EXT_CSD_RPMB_MULT] << 17,
2983 + EXT_CSD_PART_CONFIG_ACC_RPMB,
2984 + "rpmb", 0, false,
2985 +diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
2986 +index e07df81..b503113 100644
2987 +--- a/drivers/mmc/host/sdhci-esdhc-imx.c
2988 ++++ b/drivers/mmc/host/sdhci-esdhc-imx.c
2989 +@@ -237,15 +237,18 @@ static void esdhc_writel_le(struct sdhci_host *host, u32 val, int reg)
2990 +
2991 + static u16 esdhc_readw_le(struct sdhci_host *host, int reg)
2992 + {
2993 ++ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
2994 ++ struct pltfm_imx_data *imx_data = pltfm_host->priv;
2995 ++
2996 + if (unlikely(reg == SDHCI_HOST_VERSION)) {
2997 +- u16 val = readw(host->ioaddr + (reg ^ 2));
2998 +- /*
2999 +- * uSDHC supports SDHCI v3.0, but it's encoded as value
3000 +- * 0x3 in host controller version register, which violates
3001 +- * SDHCI_SPEC_300 definition. Work it around here.
3002 +- */
3003 +- if ((val & SDHCI_SPEC_VER_MASK) == 3)
3004 +- return --val;
3005 ++ reg ^= 2;
3006 ++ if (is_imx6q_usdhc(imx_data)) {
3007 ++ /*
3008 ++ * The usdhc register returns a wrong host version.
3009 ++ * Correct it here.
3010 ++ */
3011 ++ return SDHCI_SPEC_300;
3012 ++ }
3013 + }
3014 +
3015 + return readw(host->ioaddr + reg);
3016 +diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
3017 +index 75a3f46..88291bb 100644
3018 +--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
3019 ++++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
3020 +@@ -1434,7 +1434,7 @@ int mlx4_en_alloc_resources(struct mlx4_en_priv *priv)
3021 + }
3022 +
3023 + #ifdef CONFIG_RFS_ACCEL
3024 +- priv->dev->rx_cpu_rmap = alloc_irq_cpu_rmap(priv->rx_ring_num);
3025 ++ priv->dev->rx_cpu_rmap = alloc_irq_cpu_rmap(priv->mdev->dev->caps.comp_pool);
3026 + if (!priv->dev->rx_cpu_rmap)
3027 + goto err;
3028 +
3029 +@@ -1597,7 +1597,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
3030 + err = -ENOMEM;
3031 + goto out;
3032 + }
3033 +- priv->tx_cq = kzalloc(sizeof(struct mlx4_en_cq) * MAX_RX_RINGS,
3034 ++ priv->tx_cq = kzalloc(sizeof(struct mlx4_en_cq) * MAX_TX_RINGS,
3035 + GFP_KERNEL);
3036 + if (!priv->tx_cq) {
3037 + err = -ENOMEM;
3038 +diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
3039 +index 0b2706a..508570e 100644
3040 +--- a/drivers/net/ppp/ppp_generic.c
3041 ++++ b/drivers/net/ppp/ppp_generic.c
3042 +@@ -1058,7 +1058,15 @@ ppp_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats64)
3043 + return stats64;
3044 + }
3045 +
3046 ++static struct lock_class_key ppp_tx_busylock;
3047 ++static int ppp_dev_init(struct net_device *dev)
3048 ++{
3049 ++ dev->qdisc_tx_busylock = &ppp_tx_busylock;
3050 ++ return 0;
3051 ++}
3052 ++
3053 + static const struct net_device_ops ppp_netdev_ops = {
3054 ++ .ndo_init = ppp_dev_init,
3055 + .ndo_start_xmit = ppp_start_xmit,
3056 + .ndo_do_ioctl = ppp_net_ioctl,
3057 + .ndo_get_stats64 = ppp_get_stats64,
3058 +diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
3059 +index 00d3b2d..6d25439 100644
3060 +--- a/drivers/net/usb/cdc_ncm.c
3061 ++++ b/drivers/net/usb/cdc_ncm.c
3062 +@@ -576,9 +576,14 @@ static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf)
3063 + if ((intf->num_altsetting == 2) &&
3064 + !usb_set_interface(dev->udev,
3065 + intf->cur_altsetting->desc.bInterfaceNumber,
3066 +- CDC_NCM_COMM_ALTSETTING_MBIM) &&
3067 +- cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting))
3068 +- return -ENODEV;
3069 ++ CDC_NCM_COMM_ALTSETTING_MBIM)) {
3070 ++ if (cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting))
3071 ++ return -ENODEV;
3072 ++ else
3073 ++ usb_set_interface(dev->udev,
3074 ++ intf->cur_altsetting->desc.bInterfaceNumber,
3075 ++ CDC_NCM_COMM_ALTSETTING_NCM);
3076 ++ }
3077 + #endif
3078 +
3079 + /* NCM data altsetting is always 1 */
3080 +diff --git a/drivers/net/wireless/b43/dma.h b/drivers/net/wireless/b43/dma.h
3081 +index 315b96e..9fdd198 100644
3082 +--- a/drivers/net/wireless/b43/dma.h
3083 ++++ b/drivers/net/wireless/b43/dma.h
3084 +@@ -169,7 +169,7 @@ struct b43_dmadesc_generic {
3085 +
3086 + /* DMA engine tuning knobs */
3087 + #define B43_TXRING_SLOTS 256
3088 +-#define B43_RXRING_SLOTS 64
3089 ++#define B43_RXRING_SLOTS 256
3090 + #define B43_DMA0_RX_FW598_BUFSIZE (B43_DMA0_RX_FW598_FO + IEEE80211_MAX_FRAME_LEN)
3091 + #define B43_DMA0_RX_FW351_BUFSIZE (B43_DMA0_RX_FW351_FO + IEEE80211_MAX_FRAME_LEN)
3092 +
3093 +diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
3094 +index 800a165..1f78585 100644
3095 +--- a/drivers/net/wireless/p54/p54usb.c
3096 ++++ b/drivers/net/wireless/p54/p54usb.c
3097 +@@ -84,8 +84,8 @@ static struct usb_device_id p54u_table[] = {
3098 + {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */
3099 + {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */
3100 + {USB_DEVICE(0x0803, 0x4310)}, /* Zoom 4410a */
3101 +- {USB_DEVICE(0x083a, 0x4503)}, /* T-Com Sinus 154 data II */
3102 + {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */
3103 ++ {USB_DEVICE(0x083a, 0x4531)}, /* T-Com Sinus 154 data II */
3104 + {USB_DEVICE(0x083a, 0xc501)}, /* Zoom Wireless-G 4410 */
3105 + {USB_DEVICE(0x083a, 0xf503)}, /* Accton FD7050E ver 1010ec */
3106 + {USB_DEVICE(0x0846, 0x4240)}, /* Netgear WG111 (v2) */
3107 +diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
3108 +index b7e6607..b450931 100644
3109 +--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
3110 ++++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
3111 +@@ -285,6 +285,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = {
3112 + {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x817f, rtl92cu_hal_cfg)},
3113 + /* RTL8188CUS-VL */
3114 + {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x818a, rtl92cu_hal_cfg)},
3115 ++ {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x819a, rtl92cu_hal_cfg)},
3116 + /* 8188 Combo for BC4 */
3117 + {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8754, rtl92cu_hal_cfg)},
3118 +
3119 +@@ -363,9 +364,15 @@ static struct usb_device_id rtl8192c_usb_ids[] = {
3120 +
3121 + MODULE_DEVICE_TABLE(usb, rtl8192c_usb_ids);
3122 +
3123 ++static int rtl8192cu_probe(struct usb_interface *intf,
3124 ++ const struct usb_device_id *id)
3125 ++{
3126 ++ return rtl_usb_probe(intf, id, &rtl92cu_hal_cfg);
3127 ++}
3128 ++
3129 + static struct usb_driver rtl8192cu_driver = {
3130 + .name = "rtl8192cu",
3131 +- .probe = rtl_usb_probe,
3132 ++ .probe = rtl8192cu_probe,
3133 + .disconnect = rtl_usb_disconnect,
3134 + .id_table = rtl8192c_usb_ids,
3135 +
3136 +diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c
3137 +index 1535efd..2106fcf 100644
3138 +--- a/drivers/net/wireless/rtlwifi/usb.c
3139 ++++ b/drivers/net/wireless/rtlwifi/usb.c
3140 +@@ -42,8 +42,12 @@
3141 +
3142 + static void usbctrl_async_callback(struct urb *urb)
3143 + {
3144 +- if (urb)
3145 +- kfree(urb->context);
3146 ++ if (urb) {
3147 ++ /* free dr */
3148 ++ kfree(urb->setup_packet);
3149 ++ /* free databuf */
3150 ++ kfree(urb->transfer_buffer);
3151 ++ }
3152 + }
3153 +
3154 + static int _usbctrl_vendorreq_async_write(struct usb_device *udev, u8 request,
3155 +@@ -55,39 +59,47 @@ static int _usbctrl_vendorreq_async_write(struct usb_device *udev, u8 request,
3156 + u8 reqtype;
3157 + struct usb_ctrlrequest *dr;
3158 + struct urb *urb;
3159 +- struct rtl819x_async_write_data {
3160 +- u8 data[REALTEK_USB_VENQT_MAX_BUF_SIZE];
3161 +- struct usb_ctrlrequest dr;
3162 +- } *buf;
3163 ++ const u16 databuf_maxlen = REALTEK_USB_VENQT_MAX_BUF_SIZE;
3164 ++ u8 *databuf;
3165 ++
3166 ++ if (WARN_ON_ONCE(len > databuf_maxlen))
3167 ++ len = databuf_maxlen;
3168 +
3169 + pipe = usb_sndctrlpipe(udev, 0); /* write_out */
3170 + reqtype = REALTEK_USB_VENQT_WRITE;
3171 +
3172 +- buf = kmalloc(sizeof(*buf), GFP_ATOMIC);
3173 +- if (!buf)
3174 ++ dr = kmalloc(sizeof(*dr), GFP_ATOMIC);
3175 ++ if (!dr)
3176 + return -ENOMEM;
3177 +
3178 ++ databuf = kmalloc(databuf_maxlen, GFP_ATOMIC);
3179 ++ if (!databuf) {
3180 ++ kfree(dr);
3181 ++ return -ENOMEM;
3182 ++ }
3183 ++
3184 + urb = usb_alloc_urb(0, GFP_ATOMIC);
3185 + if (!urb) {
3186 +- kfree(buf);
3187 ++ kfree(databuf);
3188 ++ kfree(dr);
3189 + return -ENOMEM;
3190 + }
3191 +
3192 +- dr = &buf->dr;
3193 +-
3194 + dr->bRequestType = reqtype;
3195 + dr->bRequest = request;
3196 + dr->wValue = cpu_to_le16(value);
3197 + dr->wIndex = cpu_to_le16(index);
3198 + dr->wLength = cpu_to_le16(len);
3199 + /* data are already in little-endian order */
3200 +- memcpy(buf, pdata, len);
3201 ++ memcpy(databuf, pdata, len);
3202 + usb_fill_control_urb(urb, udev, pipe,
3203 +- (unsigned char *)dr, buf, len,
3204 +- usbctrl_async_callback, buf);
3205 ++ (unsigned char *)dr, databuf, len,
3206 ++ usbctrl_async_callback, NULL);
3207 + rc = usb_submit_urb(urb, GFP_ATOMIC);
3208 +- if (rc < 0)
3209 +- kfree(buf);
3210 ++ if (rc < 0) {
3211 ++ kfree(databuf);
3212 ++ kfree(dr);
3213 ++ }
3214 + usb_free_urb(urb);
3215 + return rc;
3216 + }
3217 +@@ -941,7 +953,8 @@ static struct rtl_intf_ops rtl_usb_ops = {
3218 + };
3219 +
3220 + int rtl_usb_probe(struct usb_interface *intf,
3221 +- const struct usb_device_id *id)
3222 ++ const struct usb_device_id *id,
3223 ++ struct rtl_hal_cfg *rtl_hal_cfg)
3224 + {
3225 + int err;
3226 + struct ieee80211_hw *hw = NULL;
3227 +@@ -976,7 +989,7 @@ int rtl_usb_probe(struct usb_interface *intf,
3228 + usb_set_intfdata(intf, hw);
3229 + /* init cfg & intf_ops */
3230 + rtlpriv->rtlhal.interface = INTF_USB;
3231 +- rtlpriv->cfg = (struct rtl_hal_cfg *)(id->driver_info);
3232 ++ rtlpriv->cfg = rtl_hal_cfg;
3233 + rtlpriv->intf_ops = &rtl_usb_ops;
3234 + rtl_dbgp_flag_init(hw);
3235 + /* Init IO handler */
3236 +diff --git a/drivers/net/wireless/rtlwifi/usb.h b/drivers/net/wireless/rtlwifi/usb.h
3237 +index 5235136..fb986f9 100644
3238 +--- a/drivers/net/wireless/rtlwifi/usb.h
3239 ++++ b/drivers/net/wireless/rtlwifi/usb.h
3240 +@@ -157,7 +157,8 @@ struct rtl_usb_priv {
3241 +
3242 +
3243 + int rtl_usb_probe(struct usb_interface *intf,
3244 +- const struct usb_device_id *id);
3245 ++ const struct usb_device_id *id,
3246 ++ struct rtl_hal_cfg *rtl92cu_hal_cfg);
3247 + void rtl_usb_disconnect(struct usb_interface *intf);
3248 + int rtl_usb_suspend(struct usb_interface *pusb_intf, pm_message_t message);
3249 + int rtl_usb_resume(struct usb_interface *pusb_intf);
3250 +diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
3251 +index b8c5193..221f426 100644
3252 +--- a/drivers/net/xen-netback/interface.c
3253 ++++ b/drivers/net/xen-netback/interface.c
3254 +@@ -132,6 +132,7 @@ static void xenvif_up(struct xenvif *vif)
3255 + static void xenvif_down(struct xenvif *vif)
3256 + {
3257 + disable_irq(vif->irq);
3258 ++ del_timer_sync(&vif->credit_timeout);
3259 + xen_netbk_deschedule_xenvif(vif);
3260 + xen_netbk_remove_xenvif(vif);
3261 + }
3262 +@@ -363,8 +364,6 @@ void xenvif_disconnect(struct xenvif *vif)
3263 + atomic_dec(&vif->refcnt);
3264 + wait_event(vif->waiting_to_free, atomic_read(&vif->refcnt) == 0);
3265 +
3266 +- del_timer_sync(&vif->credit_timeout);
3267 +-
3268 + if (vif->irq)
3269 + unbind_from_irqhandler(vif->irq, vif);
3270 +
3271 +diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
3272 +index 2b9520c..cd49ba9 100644
3273 +--- a/drivers/net/xen-netback/netback.c
3274 ++++ b/drivers/net/xen-netback/netback.c
3275 +@@ -911,13 +911,13 @@ static int netbk_count_requests(struct xenvif *vif,
3276 + if (frags >= work_to_do) {
3277 + netdev_err(vif->dev, "Need more frags\n");
3278 + netbk_fatal_tx_err(vif);
3279 +- return -frags;
3280 ++ return -ENODATA;
3281 + }
3282 +
3283 + if (unlikely(frags >= MAX_SKB_FRAGS)) {
3284 + netdev_err(vif->dev, "Too many frags\n");
3285 + netbk_fatal_tx_err(vif);
3286 +- return -frags;
3287 ++ return -E2BIG;
3288 + }
3289 +
3290 + memcpy(txp, RING_GET_REQUEST(&vif->tx, cons + frags),
3291 +@@ -925,7 +925,7 @@ static int netbk_count_requests(struct xenvif *vif,
3292 + if (txp->size > first->size) {
3293 + netdev_err(vif->dev, "Frag is bigger than frame.\n");
3294 + netbk_fatal_tx_err(vif);
3295 +- return -frags;
3296 ++ return -EIO;
3297 + }
3298 +
3299 + first->size -= txp->size;
3300 +@@ -935,7 +935,7 @@ static int netbk_count_requests(struct xenvif *vif,
3301 + netdev_err(vif->dev, "txp->offset: %x, size: %u\n",
3302 + txp->offset, txp->size);
3303 + netbk_fatal_tx_err(vif);
3304 +- return -frags;
3305 ++ return -EINVAL;
3306 + }
3307 + } while ((txp++)->flags & XEN_NETTXF_more_data);
3308 + return frags;
3309 +diff --git a/drivers/pci/access.c b/drivers/pci/access.c
3310 +index 3af0478..32046c5 100644
3311 +--- a/drivers/pci/access.c
3312 ++++ b/drivers/pci/access.c
3313 +@@ -515,7 +515,7 @@ static bool pcie_capability_reg_implemented(struct pci_dev *dev, int pos)
3314 + return false;
3315 +
3316 + switch (pos) {
3317 +- case PCI_EXP_FLAGS_TYPE:
3318 ++ case PCI_EXP_FLAGS:
3319 + return true;
3320 + case PCI_EXP_DEVCAP:
3321 + case PCI_EXP_DEVCTL:
3322 +diff --git a/drivers/pcmcia/vrc4171_card.c b/drivers/pcmcia/vrc4171_card.c
3323 +index 75806be..d98a086 100644
3324 +--- a/drivers/pcmcia/vrc4171_card.c
3325 ++++ b/drivers/pcmcia/vrc4171_card.c
3326 +@@ -246,6 +246,7 @@ static int pccard_init(struct pcmcia_socket *sock)
3327 + socket = &vrc4171_sockets[slot];
3328 + socket->csc_irq = search_nonuse_irq();
3329 + socket->io_irq = search_nonuse_irq();
3330 ++ spin_lock_init(&socket->lock);
3331 +
3332 + return 0;
3333 + }
3334 +diff --git a/drivers/pps/clients/pps-ldisc.c b/drivers/pps/clients/pps-ldisc.c
3335 +index 79451f2..60cee9e 100644
3336 +--- a/drivers/pps/clients/pps-ldisc.c
3337 ++++ b/drivers/pps/clients/pps-ldisc.c
3338 +@@ -31,7 +31,7 @@
3339 + static void pps_tty_dcd_change(struct tty_struct *tty, unsigned int status,
3340 + struct pps_event_time *ts)
3341 + {
3342 +- struct pps_device *pps = (struct pps_device *)tty->disc_data;
3343 ++ struct pps_device *pps = pps_lookup_dev(tty);
3344 +
3345 + BUG_ON(pps == NULL);
3346 +
3347 +@@ -67,9 +67,9 @@ static int pps_tty_open(struct tty_struct *tty)
3348 + pr_err("cannot register PPS source \"%s\"\n", info.path);
3349 + return -ENOMEM;
3350 + }
3351 +- tty->disc_data = pps;
3352 ++ pps->lookup_cookie = tty;
3353 +
3354 +- /* Should open N_TTY ldisc too */
3355 ++ /* Now open the base class N_TTY ldisc */
3356 + ret = alias_n_tty_open(tty);
3357 + if (ret < 0) {
3358 + pr_err("cannot open tty ldisc \"%s\"\n", info.path);
3359 +@@ -81,7 +81,6 @@ static int pps_tty_open(struct tty_struct *tty)
3360 + return 0;
3361 +
3362 + err_unregister:
3363 +- tty->disc_data = NULL;
3364 + pps_unregister_source(pps);
3365 + return ret;
3366 + }
3367 +@@ -90,11 +89,10 @@ static void (*alias_n_tty_close)(struct tty_struct *tty);
3368 +
3369 + static void pps_tty_close(struct tty_struct *tty)
3370 + {
3371 +- struct pps_device *pps = (struct pps_device *)tty->disc_data;
3372 ++ struct pps_device *pps = pps_lookup_dev(tty);
3373 +
3374 + alias_n_tty_close(tty);
3375 +
3376 +- tty->disc_data = NULL;
3377 + dev_info(pps->dev, "removed\n");
3378 + pps_unregister_source(pps);
3379 + }
3380 +diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c
3381 +index 2420d5a..6437703 100644
3382 +--- a/drivers/pps/pps.c
3383 ++++ b/drivers/pps/pps.c
3384 +@@ -247,12 +247,15 @@ static int pps_cdev_open(struct inode *inode, struct file *file)
3385 + struct pps_device *pps = container_of(inode->i_cdev,
3386 + struct pps_device, cdev);
3387 + file->private_data = pps;
3388 +-
3389 ++ kobject_get(&pps->dev->kobj);
3390 + return 0;
3391 + }
3392 +
3393 + static int pps_cdev_release(struct inode *inode, struct file *file)
3394 + {
3395 ++ struct pps_device *pps = container_of(inode->i_cdev,
3396 ++ struct pps_device, cdev);
3397 ++ kobject_put(&pps->dev->kobj);
3398 + return 0;
3399 + }
3400 +
3401 +@@ -274,8 +277,10 @@ static void pps_device_destruct(struct device *dev)
3402 + {
3403 + struct pps_device *pps = dev_get_drvdata(dev);
3404 +
3405 +- /* release id here to protect others from using it while it's
3406 +- * still in use */
3407 ++ cdev_del(&pps->cdev);
3408 ++
3409 ++ /* Now we can release the ID for re-use */
3410 ++ pr_debug("deallocating pps%d\n", pps->id);
3411 + mutex_lock(&pps_idr_lock);
3412 + idr_remove(&pps_idr, pps->id);
3413 + mutex_unlock(&pps_idr_lock);
3414 +@@ -332,6 +337,7 @@ int pps_register_cdev(struct pps_device *pps)
3415 + goto del_cdev;
3416 + }
3417 +
3418 ++ /* Override the release function with our own */
3419 + pps->dev->release = pps_device_destruct;
3420 +
3421 + pr_debug("source %s got cdev (%d:%d)\n", pps->info.name,
3422 +@@ -352,11 +358,44 @@ free_idr:
3423 +
3424 + void pps_unregister_cdev(struct pps_device *pps)
3425 + {
3426 ++ pr_debug("unregistering pps%d\n", pps->id);
3427 ++ pps->lookup_cookie = NULL;
3428 + device_destroy(pps_class, pps->dev->devt);
3429 +- cdev_del(&pps->cdev);
3430 + }
3431 +
3432 + /*
3433 ++ * Look up a pps device by magic cookie.
3434 ++ * The cookie is usually a pointer to some enclosing device, but this
3435 ++ * code doesn't care; you should never be dereferencing it.
3436 ++ *
3437 ++ * This is a bit of a kludge that is currently used only by the PPS
3438 ++ * serial line discipline. It may need to be tweaked when a second user
3439 ++ * is found.
3440 ++ *
3441 ++ * There is no function interface for setting the lookup_cookie field.
3442 ++ * It's initialized to NULL when the pps device is created, and if a
3443 ++ * client wants to use it, just fill it in afterward.
3444 ++ *
3445 ++ * The cookie is automatically set to NULL in pps_unregister_source()
3446 ++ * so that it will not be used again, even if the pps device cannot
3447 ++ * be removed from the idr due to pending references holding the minor
3448 ++ * number in use.
3449 ++ */
3450 ++struct pps_device *pps_lookup_dev(void const *cookie)
3451 ++{
3452 ++ struct pps_device *pps;
3453 ++ unsigned id;
3454 ++
3455 ++ rcu_read_lock();
3456 ++ idr_for_each_entry(&pps_idr, pps, id)
3457 ++ if (cookie == pps->lookup_cookie)
3458 ++ break;
3459 ++ rcu_read_unlock();
3460 ++ return pps;
3461 ++}
3462 ++EXPORT_SYMBOL(pps_lookup_dev);
3463 ++
3464 ++/*
3465 + * Module stuff
3466 + */
3467 +
3468 +diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c
3469 +index 8491111..03a15e0 100644
3470 +--- a/drivers/s390/kvm/kvm_virtio.c
3471 ++++ b/drivers/s390/kvm/kvm_virtio.c
3472 +@@ -422,6 +422,26 @@ static void kvm_extint_handler(struct ext_code ext_code,
3473 + }
3474 +
3475 + /*
3476 ++ * For s390-virtio, we expect a page above main storage containing
3477 ++ * the virtio configuration. Try to actually load from this area
3478 ++ * in order to figure out if the host provides this page.
3479 ++ */
3480 ++static int __init test_devices_support(unsigned long addr)
3481 ++{
3482 ++ int ret = -EIO;
3483 ++
3484 ++ asm volatile(
3485 ++ "0: lura 0,%1\n"
3486 ++ "1: xgr %0,%0\n"
3487 ++ "2:\n"
3488 ++ EX_TABLE(0b,2b)
3489 ++ EX_TABLE(1b,2b)
3490 ++ : "+d" (ret)
3491 ++ : "a" (addr)
3492 ++ : "0", "cc");
3493 ++ return ret;
3494 ++}
3495 ++/*
3496 + * Init function for virtio
3497 + * devices are in a single page above top of "normal" mem
3498 + */
3499 +@@ -432,21 +452,23 @@ static int __init kvm_devices_init(void)
3500 + if (!MACHINE_IS_KVM)
3501 + return -ENODEV;
3502 +
3503 ++ if (test_devices_support(real_memory_size) < 0)
3504 ++ return -ENODEV;
3505 ++
3506 ++ rc = vmem_add_mapping(real_memory_size, PAGE_SIZE);
3507 ++ if (rc)
3508 ++ return rc;
3509 ++
3510 ++ kvm_devices = (void *) real_memory_size;
3511 ++
3512 + kvm_root = root_device_register("kvm_s390");
3513 + if (IS_ERR(kvm_root)) {
3514 + rc = PTR_ERR(kvm_root);
3515 + printk(KERN_ERR "Could not register kvm_s390 root device");
3516 ++ vmem_remove_mapping(real_memory_size, PAGE_SIZE);
3517 + return rc;
3518 + }
3519 +
3520 +- rc = vmem_add_mapping(real_memory_size, PAGE_SIZE);
3521 +- if (rc) {
3522 +- root_device_unregister(kvm_root);
3523 +- return rc;
3524 +- }
3525 +-
3526 +- kvm_devices = (void *) real_memory_size;
3527 +-
3528 + INIT_WORK(&hotplug_work, hotplug_devices);
3529 +
3530 + service_subclass_irq_register();
3531 +diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
3532 +index 9b038e4..8f14c42 100644
3533 +--- a/drivers/staging/comedi/comedi_fops.c
3534 ++++ b/drivers/staging/comedi/comedi_fops.c
3535 +@@ -1547,6 +1547,11 @@ static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd,
3536 + /* Device config is special, because it must work on
3537 + * an unconfigured device. */
3538 + if (cmd == COMEDI_DEVCONFIG) {
3539 ++ if (minor >= COMEDI_NUM_BOARD_MINORS) {
3540 ++ /* Device config not appropriate on non-board minors. */
3541 ++ rc = -ENOTTY;
3542 ++ goto done;
3543 ++ }
3544 + rc = do_devconfig_ioctl(dev,
3545 + (struct comedi_devconfig __user *)arg);
3546 + if (rc == 0)
3547 +diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c
3548 +index d29c4d7..d999053 100644
3549 +--- a/drivers/staging/comedi/drivers/ni_labpc.c
3550 ++++ b/drivers/staging/comedi/drivers/ni_labpc.c
3551 +@@ -1202,7 +1202,8 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
3552 + else
3553 + channel = CR_CHAN(cmd->chanlist[0]);
3554 + /* munge channel bits for differential / scan disabled mode */
3555 +- if (mode != MODE_SINGLE_CHAN && aref == AREF_DIFF)
3556 ++ if ((mode == MODE_SINGLE_CHAN || mode == MODE_SINGLE_CHAN_INTERVAL) &&
3557 ++ aref == AREF_DIFF)
3558 + channel *= 2;
3559 + devpriv->command1_bits |= ADC_CHAN_BITS(channel);
3560 + devpriv->command1_bits |= thisboard->ai_range_code[range];
3561 +@@ -1217,21 +1218,6 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
3562 + devpriv->write_byte(devpriv->command1_bits,
3563 + dev->iobase + COMMAND1_REG);
3564 + }
3565 +- /* setup any external triggering/pacing (command4 register) */
3566 +- devpriv->command4_bits = 0;
3567 +- if (cmd->convert_src != TRIG_EXT)
3568 +- devpriv->command4_bits |= EXT_CONVERT_DISABLE_BIT;
3569 +- /* XXX should discard first scan when using interval scanning
3570 +- * since manual says it is not synced with scan clock */
3571 +- if (labpc_use_continuous_mode(cmd, mode) == 0) {
3572 +- devpriv->command4_bits |= INTERVAL_SCAN_EN_BIT;
3573 +- if (cmd->scan_begin_src == TRIG_EXT)
3574 +- devpriv->command4_bits |= EXT_SCAN_EN_BIT;
3575 +- }
3576 +- /* single-ended/differential */
3577 +- if (aref == AREF_DIFF)
3578 +- devpriv->command4_bits |= ADC_DIFF_BIT;
3579 +- devpriv->write_byte(devpriv->command4_bits, dev->iobase + COMMAND4_REG);
3580 +
3581 + devpriv->write_byte(cmd->chanlist_len,
3582 + dev->iobase + INTERVAL_COUNT_REG);
3583 +@@ -1311,6 +1297,22 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
3584 + devpriv->command3_bits &= ~ADC_FNE_INTR_EN_BIT;
3585 + devpriv->write_byte(devpriv->command3_bits, dev->iobase + COMMAND3_REG);
3586 +
3587 ++ /* setup any external triggering/pacing (command4 register) */
3588 ++ devpriv->command4_bits = 0;
3589 ++ if (cmd->convert_src != TRIG_EXT)
3590 ++ devpriv->command4_bits |= EXT_CONVERT_DISABLE_BIT;
3591 ++ /* XXX should discard first scan when using interval scanning
3592 ++ * since manual says it is not synced with scan clock */
3593 ++ if (labpc_use_continuous_mode(cmd, mode) == 0) {
3594 ++ devpriv->command4_bits |= INTERVAL_SCAN_EN_BIT;
3595 ++ if (cmd->scan_begin_src == TRIG_EXT)
3596 ++ devpriv->command4_bits |= EXT_SCAN_EN_BIT;
3597 ++ }
3598 ++ /* single-ended/differential */
3599 ++ if (aref == AREF_DIFF)
3600 ++ devpriv->command4_bits |= ADC_DIFF_BIT;
3601 ++ devpriv->write_byte(devpriv->command4_bits, dev->iobase + COMMAND4_REG);
3602 ++
3603 + /* startup acquisition */
3604 +
3605 + /* command2 reg */
3606 +diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c
3607 +index e94f6a1..d409e14 100644
3608 +--- a/drivers/staging/vt6656/dpc.c
3609 ++++ b/drivers/staging/vt6656/dpc.c
3610 +@@ -1190,7 +1190,7 @@ static BOOL s_bHandleRxEncryption (
3611 + if (byDecMode == KEY_CTL_WEP) {
3612 + // handle WEP
3613 + if ((pDevice->byLocalID <= REV_ID_VT3253_A1) ||
3614 +- (((PSKeyTable)(&pKey->pvKeyTable))->bSoftWEP == TRUE)) {
3615 ++ (((PSKeyTable)(pKey->pvKeyTable))->bSoftWEP == TRUE)) {
3616 + // Software WEP
3617 + // 1. 3253A
3618 + // 2. WEP 256
3619 +@@ -1299,7 +1299,7 @@ static BOOL s_bHostWepRxEncryption (
3620 + // handle WEP
3621 + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"byDecMode == KEY_CTL_WEP\n");
3622 + if ((pDevice->byLocalID <= REV_ID_VT3253_A1) ||
3623 +- (((PSKeyTable)(&pKey->pvKeyTable))->bSoftWEP == TRUE) ||
3624 ++ (((PSKeyTable)(pKey->pvKeyTable))->bSoftWEP == TRUE) ||
3625 + (bOnFly == FALSE)) {
3626 + // Software WEP
3627 + // 1. 3253A
3628 +diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
3629 +index 83c04e1..9213d69 100644
3630 +--- a/drivers/staging/vt6656/rxtx.c
3631 ++++ b/drivers/staging/vt6656/rxtx.c
3632 +@@ -1454,7 +1454,7 @@ s_bPacketToWirelessUsb(
3633 +
3634 + pvRrvTime = pMICHDR = pvRTS = pvCTS = pvTxDataHd = NULL;
3635 + if (bNeedEncryption && pTransmitKey->pvKeyTable) {
3636 +- if (((PSKeyTable)&pTransmitKey->pvKeyTable)->bSoftWEP == TRUE)
3637 ++ if (((PSKeyTable)pTransmitKey->pvKeyTable)->bSoftWEP == TRUE)
3638 + bSoftWEP = TRUE; /* WEP 256 */
3639 + }
3640 +
3641 +diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c
3642 +index fc68518..87815c5 100644
3643 +--- a/drivers/staging/vt6656/usbpipe.c
3644 ++++ b/drivers/staging/vt6656/usbpipe.c
3645 +@@ -165,6 +165,11 @@ int PIPEnsControlOut(
3646 + if (pDevice->Flags & fMP_CONTROL_WRITES)
3647 + return STATUS_FAILURE;
3648 +
3649 ++ if (pDevice->Flags & fMP_CONTROL_READS)
3650 ++ return STATUS_FAILURE;
3651 ++
3652 ++ MP_SET_FLAG(pDevice, fMP_CONTROL_WRITES);
3653 ++
3654 + pDevice->sUsbCtlRequest.bRequestType = 0x40;
3655 + pDevice->sUsbCtlRequest.bRequest = byRequest;
3656 + pDevice->sUsbCtlRequest.wValue = cpu_to_le16p(&wValue);
3657 +@@ -179,12 +184,13 @@ int PIPEnsControlOut(
3658 +
3659 + ntStatus = usb_submit_urb(pDevice->pControlURB, GFP_ATOMIC);
3660 + if (ntStatus != 0) {
3661 +- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"control send request submission failed: %d\n", ntStatus);
3662 ++ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
3663 ++ "control send request submission failed: %d\n",
3664 ++ ntStatus);
3665 ++ MP_CLEAR_FLAG(pDevice, fMP_CONTROL_WRITES);
3666 + return STATUS_FAILURE;
3667 + }
3668 +- else {
3669 +- MP_SET_FLAG(pDevice, fMP_CONTROL_WRITES);
3670 +- }
3671 ++
3672 + spin_unlock_irq(&pDevice->lock);
3673 + for (ii = 0; ii <= USB_CTL_WAIT; ii ++) {
3674 +
3675 +@@ -224,6 +230,11 @@ int PIPEnsControlIn(
3676 + if (pDevice->Flags & fMP_CONTROL_READS)
3677 + return STATUS_FAILURE;
3678 +
3679 ++ if (pDevice->Flags & fMP_CONTROL_WRITES)
3680 ++ return STATUS_FAILURE;
3681 ++
3682 ++ MP_SET_FLAG(pDevice, fMP_CONTROL_READS);
3683 ++
3684 + pDevice->sUsbCtlRequest.bRequestType = 0xC0;
3685 + pDevice->sUsbCtlRequest.bRequest = byRequest;
3686 + pDevice->sUsbCtlRequest.wValue = cpu_to_le16p(&wValue);
3687 +@@ -237,10 +248,11 @@ int PIPEnsControlIn(
3688 +
3689 + ntStatus = usb_submit_urb(pDevice->pControlURB, GFP_ATOMIC);
3690 + if (ntStatus != 0) {
3691 +- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"control request submission failed: %d\n", ntStatus);
3692 +- }else {
3693 +- MP_SET_FLAG(pDevice, fMP_CONTROL_READS);
3694 +- }
3695 ++ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
3696 ++ "control request submission failed: %d\n", ntStatus);
3697 ++ MP_CLEAR_FLAG(pDevice, fMP_CONTROL_READS);
3698 ++ return STATUS_FAILURE;
3699 ++ }
3700 +
3701 + spin_unlock_irq(&pDevice->lock);
3702 + for (ii = 0; ii <= USB_CTL_WAIT; ii ++) {
3703 +diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
3704 +index f2a73bd..071e058 100644
3705 +--- a/drivers/staging/zram/zram_drv.c
3706 ++++ b/drivers/staging/zram/zram_drv.c
3707 +@@ -228,11 +228,12 @@ static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec,
3708 + return 0;
3709 + }
3710 +
3711 +- user_mem = kmap_atomic(page);
3712 + if (is_partial_io(bvec))
3713 + /* Use a temporary buffer to decompress the page */
3714 +- uncmem = kmalloc(PAGE_SIZE, GFP_KERNEL);
3715 +- else
3716 ++ uncmem = kmalloc(PAGE_SIZE, GFP_NOIO);
3717 ++
3718 ++ user_mem = kmap_atomic(page);
3719 ++ if (!is_partial_io(bvec))
3720 + uncmem = user_mem;
3721 +
3722 + if (!uncmem) {
3723 +@@ -279,7 +280,7 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
3724 + * This is a partial IO. We need to read the full page
3725 + * before to write the changes.
3726 + */
3727 +- uncmem = kmalloc(PAGE_SIZE, GFP_KERNEL);
3728 ++ uncmem = kmalloc(PAGE_SIZE, GFP_NOIO);
3729 + if (!uncmem) {
3730 + pr_info("Error allocating temp memory!\n");
3731 + ret = -ENOMEM;
3732 +diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c
3733 +index 09a9d35..223c736 100644
3734 +--- a/drivers/staging/zsmalloc/zsmalloc-main.c
3735 ++++ b/drivers/staging/zsmalloc/zsmalloc-main.c
3736 +@@ -222,11 +222,9 @@ struct zs_pool {
3737 + /*
3738 + * By default, zsmalloc uses a copy-based object mapping method to access
3739 + * allocations that span two pages. However, if a particular architecture
3740 +- * 1) Implements local_flush_tlb_kernel_range() and 2) Performs VM mapping
3741 +- * faster than copying, then it should be added here so that
3742 +- * USE_PGTABLE_MAPPING is defined. This causes zsmalloc to use page table
3743 +- * mapping rather than copying
3744 +- * for object mapping.
3745 ++ * performs VM mapping faster than copying, then it should be added here
3746 ++ * so that USE_PGTABLE_MAPPING is defined. This causes zsmalloc to use
3747 ++ * page table mapping rather than copying for object mapping.
3748 + */
3749 + #if defined(CONFIG_ARM)
3750 + #define USE_PGTABLE_MAPPING
3751 +@@ -663,7 +661,7 @@ static inline void __zs_unmap_object(struct mapping_area *area,
3752 +
3753 + flush_cache_vunmap(addr, end);
3754 + unmap_kernel_range_noflush(addr, PAGE_SIZE * 2);
3755 +- local_flush_tlb_kernel_range(addr, end);
3756 ++ flush_tlb_kernel_range(addr, end);
3757 + }
3758 +
3759 + #else /* USE_PGTABLE_MAPPING */
3760 +diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
3761 +index dcc0430..bfd6771 100644
3762 +--- a/drivers/tty/n_gsm.c
3763 ++++ b/drivers/tty/n_gsm.c
3764 +@@ -1689,6 +1689,8 @@ static inline void dlci_put(struct gsm_dlci *dlci)
3765 + tty_port_put(&dlci->port);
3766 + }
3767 +
3768 ++static void gsm_destroy_network(struct gsm_dlci *dlci);
3769 ++
3770 + /**
3771 + * gsm_dlci_release - release DLCI
3772 + * @dlci: DLCI to destroy
3773 +@@ -1702,9 +1704,19 @@ static void gsm_dlci_release(struct gsm_dlci *dlci)
3774 + {
3775 + struct tty_struct *tty = tty_port_tty_get(&dlci->port);
3776 + if (tty) {
3777 ++ mutex_lock(&dlci->mutex);
3778 ++ gsm_destroy_network(dlci);
3779 ++ mutex_unlock(&dlci->mutex);
3780 ++
3781 ++ /* tty_vhangup needs the tty_lock, so unlock and
3782 ++ relock after doing the hangup. */
3783 ++ tty_unlock(tty);
3784 + tty_vhangup(tty);
3785 ++ tty_lock(tty);
3786 ++ tty_port_tty_set(&dlci->port, NULL);
3787 + tty_kref_put(tty);
3788 + }
3789 ++ dlci->state = DLCI_CLOSED;
3790 + dlci_put(dlci);
3791 + }
3792 +
3793 +@@ -2947,6 +2959,8 @@ static void gsmtty_close(struct tty_struct *tty, struct file *filp)
3794 +
3795 + if (dlci == NULL)
3796 + return;
3797 ++ if (dlci->state == DLCI_CLOSED)
3798 ++ return;
3799 + mutex_lock(&dlci->mutex);
3800 + gsm_destroy_network(dlci);
3801 + mutex_unlock(&dlci->mutex);
3802 +@@ -2965,6 +2979,8 @@ out:
3803 + static void gsmtty_hangup(struct tty_struct *tty)
3804 + {
3805 + struct gsm_dlci *dlci = tty->driver_data;
3806 ++ if (dlci->state == DLCI_CLOSED)
3807 ++ return;
3808 + tty_port_hangup(&dlci->port);
3809 + gsm_dlci_begin_close(dlci);
3810 + }
3811 +@@ -2972,9 +2988,12 @@ static void gsmtty_hangup(struct tty_struct *tty)
3812 + static int gsmtty_write(struct tty_struct *tty, const unsigned char *buf,
3813 + int len)
3814 + {
3815 ++ int sent;
3816 + struct gsm_dlci *dlci = tty->driver_data;
3817 ++ if (dlci->state == DLCI_CLOSED)
3818 ++ return -EINVAL;
3819 + /* Stuff the bytes into the fifo queue */
3820 +- int sent = kfifo_in_locked(dlci->fifo, buf, len, &dlci->lock);
3821 ++ sent = kfifo_in_locked(dlci->fifo, buf, len, &dlci->lock);
3822 + /* Need to kick the channel */
3823 + gsm_dlci_data_kick(dlci);
3824 + return sent;
3825 +@@ -2983,18 +3002,24 @@ static int gsmtty_write(struct tty_struct *tty, const unsigned char *buf,
3826 + static int gsmtty_write_room(struct tty_struct *tty)
3827 + {
3828 + struct gsm_dlci *dlci = tty->driver_data;
3829 ++ if (dlci->state == DLCI_CLOSED)
3830 ++ return -EINVAL;
3831 + return TX_SIZE - kfifo_len(dlci->fifo);
3832 + }
3833 +
3834 + static int gsmtty_chars_in_buffer(struct tty_struct *tty)
3835 + {
3836 + struct gsm_dlci *dlci = tty->driver_data;
3837 ++ if (dlci->state == DLCI_CLOSED)
3838 ++ return -EINVAL;
3839 + return kfifo_len(dlci->fifo);
3840 + }
3841 +
3842 + static void gsmtty_flush_buffer(struct tty_struct *tty)
3843 + {
3844 + struct gsm_dlci *dlci = tty->driver_data;
3845 ++ if (dlci->state == DLCI_CLOSED)
3846 ++ return;
3847 + /* Caution needed: If we implement reliable transport classes
3848 + then the data being transmitted can't simply be junked once
3849 + it has first hit the stack. Until then we can just blow it
3850 +@@ -3013,6 +3038,8 @@ static void gsmtty_wait_until_sent(struct tty_struct *tty, int timeout)
3851 + static int gsmtty_tiocmget(struct tty_struct *tty)
3852 + {
3853 + struct gsm_dlci *dlci = tty->driver_data;
3854 ++ if (dlci->state == DLCI_CLOSED)
3855 ++ return -EINVAL;
3856 + return dlci->modem_rx;
3857 + }
3858 +
3859 +@@ -3022,6 +3049,8 @@ static int gsmtty_tiocmset(struct tty_struct *tty,
3860 + struct gsm_dlci *dlci = tty->driver_data;
3861 + unsigned int modem_tx = dlci->modem_tx;
3862 +
3863 ++ if (dlci->state == DLCI_CLOSED)
3864 ++ return -EINVAL;
3865 + modem_tx &= ~clear;
3866 + modem_tx |= set;
3867 +
3868 +@@ -3040,6 +3069,8 @@ static int gsmtty_ioctl(struct tty_struct *tty,
3869 + struct gsm_netconfig nc;
3870 + int index;
3871 +
3872 ++ if (dlci->state == DLCI_CLOSED)
3873 ++ return -EINVAL;
3874 + switch (cmd) {
3875 + case GSMIOC_ENABLE_NET:
3876 + if (copy_from_user(&nc, (void __user *)arg, sizeof(nc)))
3877 +@@ -3066,6 +3097,9 @@ static int gsmtty_ioctl(struct tty_struct *tty,
3878 +
3879 + static void gsmtty_set_termios(struct tty_struct *tty, struct ktermios *old)
3880 + {
3881 ++ struct gsm_dlci *dlci = tty->driver_data;
3882 ++ if (dlci->state == DLCI_CLOSED)
3883 ++ return;
3884 + /* For the moment its fixed. In actual fact the speed information
3885 + for the virtual channel can be propogated in both directions by
3886 + the RPN control message. This however rapidly gets nasty as we
3887 +@@ -3077,6 +3111,8 @@ static void gsmtty_set_termios(struct tty_struct *tty, struct ktermios *old)
3888 + static void gsmtty_throttle(struct tty_struct *tty)
3889 + {
3890 + struct gsm_dlci *dlci = tty->driver_data;
3891 ++ if (dlci->state == DLCI_CLOSED)
3892 ++ return;
3893 + if (tty->termios.c_cflag & CRTSCTS)
3894 + dlci->modem_tx &= ~TIOCM_DTR;
3895 + dlci->throttled = 1;
3896 +@@ -3087,6 +3123,8 @@ static void gsmtty_throttle(struct tty_struct *tty)
3897 + static void gsmtty_unthrottle(struct tty_struct *tty)
3898 + {
3899 + struct gsm_dlci *dlci = tty->driver_data;
3900 ++ if (dlci->state == DLCI_CLOSED)
3901 ++ return;
3902 + if (tty->termios.c_cflag & CRTSCTS)
3903 + dlci->modem_tx |= TIOCM_DTR;
3904 + dlci->throttled = 0;
3905 +@@ -3098,6 +3136,8 @@ static int gsmtty_break_ctl(struct tty_struct *tty, int state)
3906 + {
3907 + struct gsm_dlci *dlci = tty->driver_data;
3908 + int encode = 0; /* Off */
3909 ++ if (dlci->state == DLCI_CLOSED)
3910 ++ return -EINVAL;
3911 +
3912 + if (state == -1) /* "On indefinitely" - we can't encode this
3913 + properly */
3914 +diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
3915 +index 5981912..5c110c8 100644
3916 +--- a/drivers/tty/serial/imx.c
3917 ++++ b/drivers/tty/serial/imx.c
3918 +@@ -1213,8 +1213,14 @@ imx_console_write(struct console *co, const char *s, unsigned int count)
3919 + struct imx_port_ucrs old_ucr;
3920 + unsigned int ucr1;
3921 + unsigned long flags;
3922 ++ int locked = 1;
3923 +
3924 +- spin_lock_irqsave(&sport->port.lock, flags);
3925 ++ if (sport->port.sysrq)
3926 ++ locked = 0;
3927 ++ else if (oops_in_progress)
3928 ++ locked = spin_trylock_irqsave(&sport->port.lock, flags);
3929 ++ else
3930 ++ spin_lock_irqsave(&sport->port.lock, flags);
3931 +
3932 + /*
3933 + * First, save UCR1/2/3 and then disable interrupts
3934 +@@ -1241,7 +1247,8 @@ imx_console_write(struct console *co, const char *s, unsigned int count)
3935 +
3936 + imx_port_ucrs_restore(&sport->port, &old_ucr);
3937 +
3938 +- spin_unlock_irqrestore(&sport->port.lock, flags);
3939 ++ if (locked)
3940 ++ spin_unlock_irqrestore(&sport->port.lock, flags);
3941 + }
3942 +
3943 + /*
3944 +diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c
3945 +index 8481b29..e4455e0 100644
3946 +--- a/drivers/tty/tty_ioctl.c
3947 ++++ b/drivers/tty/tty_ioctl.c
3948 +@@ -617,7 +617,7 @@ static int set_termios(struct tty_struct *tty, void __user *arg, int opt)
3949 + if (opt & TERMIOS_WAIT) {
3950 + tty_wait_until_sent(tty, 0);
3951 + if (signal_pending(current))
3952 +- return -EINTR;
3953 ++ return -ERESTARTSYS;
3954 + }
3955 +
3956 + tty_set_termios(tty, &tmp_termios);
3957 +@@ -684,7 +684,7 @@ static int set_termiox(struct tty_struct *tty, void __user *arg, int opt)
3958 + if (opt & TERMIOS_WAIT) {
3959 + tty_wait_until_sent(tty, 0);
3960 + if (signal_pending(current))
3961 +- return -EINTR;
3962 ++ return -ERESTARTSYS;
3963 + }
3964 +
3965 + mutex_lock(&tty->termios_mutex);
3966 +diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
3967 +index 8fd8968..3b1d6bf 100644
3968 +--- a/drivers/tty/vt/vt.c
3969 ++++ b/drivers/tty/vt/vt.c
3970 +@@ -539,7 +539,7 @@ static void insert_char(struct vc_data *vc, unsigned int nr)
3971 + {
3972 + unsigned short *p = (unsigned short *) vc->vc_pos;
3973 +
3974 +- scr_memmovew(p + nr, p, (vc->vc_cols - vc->vc_x) * 2);
3975 ++ scr_memmovew(p + nr, p, (vc->vc_cols - vc->vc_x - nr) * 2);
3976 + scr_memsetw(p, vc->vc_video_erase_char, nr * 2);
3977 + vc->vc_need_wrap = 0;
3978 + if (DO_UPDATE(vc))
3979 +@@ -638,7 +638,7 @@ static inline void save_screen(struct vc_data *vc)
3980 + * Redrawing of screen
3981 + */
3982 +
3983 +-static void clear_buffer_attributes(struct vc_data *vc)
3984 ++void clear_buffer_attributes(struct vc_data *vc)
3985 + {
3986 + unsigned short *p = (unsigned short *)vc->vc_origin;
3987 + int count = vc->vc_screenbuf_size / 2;
3988 +@@ -2987,7 +2987,7 @@ int __init vty_init(const struct file_operations *console_fops)
3989 +
3990 + static struct class *vtconsole_class;
3991 +
3992 +-static int bind_con_driver(const struct consw *csw, int first, int last,
3993 ++static int do_bind_con_driver(const struct consw *csw, int first, int last,
3994 + int deflt)
3995 + {
3996 + struct module *owner = csw->owner;
3997 +@@ -2998,7 +2998,7 @@ static int bind_con_driver(const struct consw *csw, int first, int last,
3998 + if (!try_module_get(owner))
3999 + return -ENODEV;
4000 +
4001 +- console_lock();
4002 ++ WARN_CONSOLE_UNLOCKED();
4003 +
4004 + /* check if driver is registered */
4005 + for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
4006 +@@ -3083,11 +3083,22 @@ static int bind_con_driver(const struct consw *csw, int first, int last,
4007 +
4008 + retval = 0;
4009 + err:
4010 +- console_unlock();
4011 + module_put(owner);
4012 + return retval;
4013 + };
4014 +
4015 ++
4016 ++static int bind_con_driver(const struct consw *csw, int first, int last,
4017 ++ int deflt)
4018 ++{
4019 ++ int ret;
4020 ++
4021 ++ console_lock();
4022 ++ ret = do_bind_con_driver(csw, first, last, deflt);
4023 ++ console_unlock();
4024 ++ return ret;
4025 ++}
4026 ++
4027 + #ifdef CONFIG_VT_HW_CONSOLE_BINDING
4028 + static int con_is_graphics(const struct consw *csw, int first, int last)
4029 + {
4030 +@@ -3124,6 +3135,18 @@ static int con_is_graphics(const struct consw *csw, int first, int last)
4031 + */
4032 + int unbind_con_driver(const struct consw *csw, int first, int last, int deflt)
4033 + {
4034 ++ int retval;
4035 ++
4036 ++ console_lock();
4037 ++ retval = do_unbind_con_driver(csw, first, last, deflt);
4038 ++ console_unlock();
4039 ++ return retval;
4040 ++}
4041 ++EXPORT_SYMBOL(unbind_con_driver);
4042 ++
4043 ++/* unlocked version of unbind_con_driver() */
4044 ++int do_unbind_con_driver(const struct consw *csw, int first, int last, int deflt)
4045 ++{
4046 + struct module *owner = csw->owner;
4047 + const struct consw *defcsw = NULL;
4048 + struct con_driver *con_driver = NULL, *con_back = NULL;
4049 +@@ -3132,7 +3155,7 @@ int unbind_con_driver(const struct consw *csw, int first, int last, int deflt)
4050 + if (!try_module_get(owner))
4051 + return -ENODEV;
4052 +
4053 +- console_lock();
4054 ++ WARN_CONSOLE_UNLOCKED();
4055 +
4056 + /* check if driver is registered and if it is unbindable */
4057 + for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
4058 +@@ -3145,10 +3168,8 @@ int unbind_con_driver(const struct consw *csw, int first, int last, int deflt)
4059 + }
4060 + }
4061 +
4062 +- if (retval) {
4063 +- console_unlock();
4064 ++ if (retval)
4065 + goto err;
4066 +- }
4067 +
4068 + retval = -ENODEV;
4069 +
4070 +@@ -3164,15 +3185,11 @@ int unbind_con_driver(const struct consw *csw, int first, int last, int deflt)
4071 + }
4072 + }
4073 +
4074 +- if (retval) {
4075 +- console_unlock();
4076 ++ if (retval)
4077 + goto err;
4078 +- }
4079 +
4080 +- if (!con_is_bound(csw)) {
4081 +- console_unlock();
4082 ++ if (!con_is_bound(csw))
4083 + goto err;
4084 +- }
4085 +
4086 + first = max(first, con_driver->first);
4087 + last = min(last, con_driver->last);
4088 +@@ -3199,15 +3216,14 @@ int unbind_con_driver(const struct consw *csw, int first, int last, int deflt)
4089 + if (!con_is_bound(csw))
4090 + con_driver->flag &= ~CON_DRIVER_FLAG_INIT;
4091 +
4092 +- console_unlock();
4093 + /* ignore return value, binding should not fail */
4094 +- bind_con_driver(defcsw, first, last, deflt);
4095 ++ do_bind_con_driver(defcsw, first, last, deflt);
4096 + err:
4097 + module_put(owner);
4098 + return retval;
4099 +
4100 + }
4101 +-EXPORT_SYMBOL(unbind_con_driver);
4102 ++EXPORT_SYMBOL_GPL(do_unbind_con_driver);
4103 +
4104 + static int vt_bind(struct con_driver *con)
4105 + {
4106 +@@ -3492,28 +3508,18 @@ int con_debug_leave(void)
4107 + }
4108 + EXPORT_SYMBOL_GPL(con_debug_leave);
4109 +
4110 +-/**
4111 +- * register_con_driver - register console driver to console layer
4112 +- * @csw: console driver
4113 +- * @first: the first console to take over, minimum value is 0
4114 +- * @last: the last console to take over, maximum value is MAX_NR_CONSOLES -1
4115 +- *
4116 +- * DESCRIPTION: This function registers a console driver which can later
4117 +- * bind to a range of consoles specified by @first and @last. It will
4118 +- * also initialize the console driver by calling con_startup().
4119 +- */
4120 +-int register_con_driver(const struct consw *csw, int first, int last)
4121 ++static int do_register_con_driver(const struct consw *csw, int first, int last)
4122 + {
4123 + struct module *owner = csw->owner;
4124 + struct con_driver *con_driver;
4125 + const char *desc;
4126 + int i, retval = 0;
4127 +
4128 ++ WARN_CONSOLE_UNLOCKED();
4129 ++
4130 + if (!try_module_get(owner))
4131 + return -ENODEV;
4132 +
4133 +- console_lock();
4134 +-
4135 + for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
4136 + con_driver = &registered_con_driver[i];
4137 +
4138 +@@ -3566,10 +3572,29 @@ int register_con_driver(const struct consw *csw, int first, int last)
4139 + }
4140 +
4141 + err:
4142 +- console_unlock();
4143 + module_put(owner);
4144 + return retval;
4145 + }
4146 ++
4147 ++/**
4148 ++ * register_con_driver - register console driver to console layer
4149 ++ * @csw: console driver
4150 ++ * @first: the first console to take over, minimum value is 0
4151 ++ * @last: the last console to take over, maximum value is MAX_NR_CONSOLES -1
4152 ++ *
4153 ++ * DESCRIPTION: This function registers a console driver which can later
4154 ++ * bind to a range of consoles specified by @first and @last. It will
4155 ++ * also initialize the console driver by calling con_startup().
4156 ++ */
4157 ++int register_con_driver(const struct consw *csw, int first, int last)
4158 ++{
4159 ++ int retval;
4160 ++
4161 ++ console_lock();
4162 ++ retval = do_register_con_driver(csw, first, last);
4163 ++ console_unlock();
4164 ++ return retval;
4165 ++}
4166 + EXPORT_SYMBOL(register_con_driver);
4167 +
4168 + /**
4169 +@@ -3585,9 +3610,18 @@ EXPORT_SYMBOL(register_con_driver);
4170 + */
4171 + int unregister_con_driver(const struct consw *csw)
4172 + {
4173 +- int i, retval = -ENODEV;
4174 ++ int retval;
4175 +
4176 + console_lock();
4177 ++ retval = do_unregister_con_driver(csw);
4178 ++ console_unlock();
4179 ++ return retval;
4180 ++}
4181 ++EXPORT_SYMBOL(unregister_con_driver);
4182 ++
4183 ++int do_unregister_con_driver(const struct consw *csw)
4184 ++{
4185 ++ int i, retval = -ENODEV;
4186 +
4187 + /* cannot unregister a bound driver */
4188 + if (con_is_bound(csw))
4189 +@@ -3613,27 +3647,53 @@ int unregister_con_driver(const struct consw *csw)
4190 + }
4191 + }
4192 + err:
4193 +- console_unlock();
4194 + return retval;
4195 + }
4196 +-EXPORT_SYMBOL(unregister_con_driver);
4197 ++EXPORT_SYMBOL_GPL(do_unregister_con_driver);
4198 +
4199 + /*
4200 + * If we support more console drivers, this function is used
4201 + * when a driver wants to take over some existing consoles
4202 + * and become default driver for newly opened ones.
4203 + *
4204 +- * take_over_console is basically a register followed by unbind
4205 ++ * take_over_console is basically a register followed by unbind
4206 ++ */
4207 ++int do_take_over_console(const struct consw *csw, int first, int last, int deflt)
4208 ++{
4209 ++ int err;
4210 ++
4211 ++ err = do_register_con_driver(csw, first, last);
4212 ++ /*
4213 ++ * If we get an busy error we still want to bind the console driver
4214 ++ * and return success, as we may have unbound the console driver
4215 ++ * but not unregistered it.
4216 ++ */
4217 ++ if (err == -EBUSY)
4218 ++ err = 0;
4219 ++ if (!err)
4220 ++ do_bind_con_driver(csw, first, last, deflt);
4221 ++
4222 ++ return err;
4223 ++}
4224 ++EXPORT_SYMBOL_GPL(do_take_over_console);
4225 ++
4226 ++/*
4227 ++ * If we support more console drivers, this function is used
4228 ++ * when a driver wants to take over some existing consoles
4229 ++ * and become default driver for newly opened ones.
4230 ++ *
4231 ++ * take_over_console is basically a register followed by unbind
4232 + */
4233 + int take_over_console(const struct consw *csw, int first, int last, int deflt)
4234 + {
4235 + int err;
4236 +
4237 + err = register_con_driver(csw, first, last);
4238 +- /* if we get an busy error we still want to bind the console driver
4239 ++ /*
4240 ++ * If we get an busy error we still want to bind the console driver
4241 + * and return success, as we may have unbound the console driver
4242 +-  * but not unregistered it.
4243 +- */
4244 ++ * but not unregistered it.
4245 ++ */
4246 + if (err == -EBUSY)
4247 + err = 0;
4248 + if (!err)
4249 +diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
4250 +index ac17a7c..99899e8 100644
4251 +--- a/drivers/usb/host/ehci-omap.c
4252 ++++ b/drivers/usb/host/ehci-omap.c
4253 +@@ -288,7 +288,6 @@ static int ehci_hcd_omap_remove(struct platform_device *pdev)
4254 + {
4255 + struct device *dev = &pdev->dev;
4256 + struct usb_hcd *hcd = dev_get_drvdata(dev);
4257 +- struct ehci_hcd_omap_platform_data *pdata = dev->platform_data;
4258 +
4259 + usb_remove_hcd(hcd);
4260 + disable_put_regulator(dev->platform_data);
4261 +@@ -298,13 +297,6 @@ static int ehci_hcd_omap_remove(struct platform_device *pdev)
4262 + pm_runtime_put_sync(dev);
4263 + pm_runtime_disable(dev);
4264 +
4265 +- if (pdata->phy_reset) {
4266 +- if (gpio_is_valid(pdata->reset_gpio_port[0]))
4267 +- gpio_free(pdata->reset_gpio_port[0]);
4268 +-
4269 +- if (gpio_is_valid(pdata->reset_gpio_port[1]))
4270 +- gpio_free(pdata->reset_gpio_port[1]);
4271 +- }
4272 + return 0;
4273 + }
4274 +
4275 +@@ -372,7 +364,7 @@ static const struct hc_driver ehci_omap_hc_driver = {
4276 + .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
4277 + };
4278 +
4279 +-MODULE_ALIAS("platform:omap-ehci");
4280 ++MODULE_ALIAS("platform:ehci-omap");
4281 + MODULE_AUTHOR("Texas Instruments, Inc.");
4282 + MODULE_AUTHOR("Felipe Balbi <felipe.balbi@×××××.com>");
4283 +
4284 +diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
4285 +index c107d7c..59eea21 100644
4286 +--- a/drivers/usb/musb/am35x.c
4287 ++++ b/drivers/usb/musb/am35x.c
4288 +@@ -365,7 +365,7 @@ static int am35x_musb_init(struct musb *musb)
4289 + usb_nop_xceiv_register();
4290 + musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
4291 + if (IS_ERR_OR_NULL(musb->xceiv))
4292 +- return -ENODEV;
4293 ++ return -EPROBE_DEFER;
4294 +
4295 + setup_timer(&otg_workaround, otg_timer, (unsigned long) musb);
4296 +
4297 +diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
4298 +index 14dab9f..dbb31b3 100644
4299 +--- a/drivers/usb/musb/blackfin.c
4300 ++++ b/drivers/usb/musb/blackfin.c
4301 +@@ -406,7 +406,7 @@ static int bfin_musb_init(struct musb *musb)
4302 + musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
4303 + if (IS_ERR_OR_NULL(musb->xceiv)) {
4304 + gpio_free(musb->config->gpio_vrsel);
4305 +- return -ENODEV;
4306 ++ return -EPROBE_DEFER;
4307 + }
4308 +
4309 + bfin_musb_reg_init(musb);
4310 +diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
4311 +index 97996af..7c71769d 100644
4312 +--- a/drivers/usb/musb/da8xx.c
4313 ++++ b/drivers/usb/musb/da8xx.c
4314 +@@ -410,6 +410,7 @@ static int da8xx_musb_init(struct musb *musb)
4315 + {
4316 + void __iomem *reg_base = musb->ctrl_base;
4317 + u32 rev;
4318 ++ int ret = -ENODEV;
4319 +
4320 + musb->mregs += DA8XX_MENTOR_CORE_OFFSET;
4321 +
4322 +@@ -420,8 +421,10 @@ static int da8xx_musb_init(struct musb *musb)
4323 +
4324 + usb_nop_xceiv_register();
4325 + musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
4326 +- if (IS_ERR_OR_NULL(musb->xceiv))
4327 ++ if (IS_ERR_OR_NULL(musb->xceiv)) {
4328 ++ ret = -EPROBE_DEFER;
4329 + goto fail;
4330 ++ }
4331 +
4332 + setup_timer(&otg_workaround, otg_timer, (unsigned long)musb);
4333 +
4334 +@@ -441,7 +444,7 @@ static int da8xx_musb_init(struct musb *musb)
4335 + musb->isr = da8xx_musb_interrupt;
4336 + return 0;
4337 + fail:
4338 +- return -ENODEV;
4339 ++ return ret;
4340 + }
4341 +
4342 + static int da8xx_musb_exit(struct musb *musb)
4343 +diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
4344 +index b1c01ca..e040d91 100644
4345 +--- a/drivers/usb/musb/davinci.c
4346 ++++ b/drivers/usb/musb/davinci.c
4347 +@@ -380,11 +380,14 @@ static int davinci_musb_init(struct musb *musb)
4348 + {
4349 + void __iomem *tibase = musb->ctrl_base;
4350 + u32 revision;
4351 ++ int ret = -ENODEV;
4352 +
4353 + usb_nop_xceiv_register();
4354 + musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
4355 +- if (IS_ERR_OR_NULL(musb->xceiv))
4356 ++ if (IS_ERR_OR_NULL(musb->xceiv)) {
4357 ++ ret = -EPROBE_DEFER;
4358 + goto unregister;
4359 ++ }
4360 +
4361 + musb->mregs += DAVINCI_BASE_OFFSET;
4362 +
4363 +@@ -438,7 +441,7 @@ fail:
4364 + usb_put_phy(musb->xceiv);
4365 + unregister:
4366 + usb_nop_xceiv_unregister();
4367 +- return -ENODEV;
4368 ++ return ret;
4369 + }
4370 +
4371 + static int davinci_musb_exit(struct musb *musb)
4372 +diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
4373 +index fd34867..60b41cc 100644
4374 +--- a/drivers/usb/musb/musb_core.c
4375 ++++ b/drivers/usb/musb/musb_core.c
4376 +@@ -1993,6 +1993,7 @@ fail2:
4377 + musb_platform_exit(musb);
4378 +
4379 + fail1:
4380 ++ pm_runtime_disable(musb->controller);
4381 + dev_err(musb->controller,
4382 + "musb_init_controller failed with status %d\n", status);
4383 +
4384 +diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
4385 +index f7d764d..341a4b5 100644
4386 +--- a/drivers/usb/musb/musb_dsps.c
4387 ++++ b/drivers/usb/musb/musb_dsps.c
4388 +@@ -419,7 +419,7 @@ static int dsps_musb_init(struct musb *musb)
4389 + usb_nop_xceiv_register();
4390 + musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
4391 + if (IS_ERR_OR_NULL(musb->xceiv))
4392 +- return -ENODEV;
4393 ++ return -EPROBE_DEFER;
4394 +
4395 + /* Returns zero if e.g. not clocked */
4396 + rev = dsps_readl(reg_base, wrp->revision);
4397 +diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
4398 +index da00af4..d7772856 100644
4399 +--- a/drivers/usb/musb/omap2430.c
4400 ++++ b/drivers/usb/musb/omap2430.c
4401 +@@ -369,7 +369,7 @@ static int omap2430_musb_init(struct musb *musb)
4402 + musb->xceiv = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
4403 + if (IS_ERR_OR_NULL(musb->xceiv)) {
4404 + pr_err("HS USB OTG: no transceiver configured\n");
4405 +- return -ENODEV;
4406 ++ return -EPROBE_DEFER;
4407 + }
4408 +
4409 + musb->isr = omap2430_musb_interrupt;
4410 +diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
4411 +index 3969813..464bd23 100644
4412 +--- a/drivers/usb/musb/tusb6010.c
4413 ++++ b/drivers/usb/musb/tusb6010.c
4414 +@@ -1069,7 +1069,7 @@ static int tusb_musb_init(struct musb *musb)
4415 + usb_nop_xceiv_register();
4416 + musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
4417 + if (IS_ERR_OR_NULL(musb->xceiv))
4418 +- return -ENODEV;
4419 ++ return -EPROBE_DEFER;
4420 +
4421 + pdev = to_platform_device(musb->controller);
4422 +
4423 +diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c
4424 +index a27ca1a..13a3929 100644
4425 +--- a/drivers/usb/musb/ux500.c
4426 ++++ b/drivers/usb/musb/ux500.c
4427 +@@ -61,7 +61,7 @@ static int ux500_musb_init(struct musb *musb)
4428 + musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
4429 + if (IS_ERR_OR_NULL(musb->xceiv)) {
4430 + pr_err("HS USB OTG: no transceiver configured\n");
4431 +- return -ENODEV;
4432 ++ return -EPROBE_DEFER;
4433 + }
4434 +
4435 + musb->isr = ux500_musb_interrupt;
4436 +@@ -108,7 +108,7 @@ static int ux500_probe(struct platform_device *pdev)
4437 + goto err3;
4438 + }
4439 +
4440 +- ret = clk_enable(clk);
4441 ++ ret = clk_prepare_enable(clk);
4442 + if (ret) {
4443 + dev_err(&pdev->dev, "failed to enable clock\n");
4444 + goto err4;
4445 +@@ -148,7 +148,7 @@ static int ux500_probe(struct platform_device *pdev)
4446 + return 0;
4447 +
4448 + err5:
4449 +- clk_disable(clk);
4450 ++ clk_disable_unprepare(clk);
4451 +
4452 + err4:
4453 + clk_put(clk);
4454 +@@ -168,7 +168,7 @@ static int ux500_remove(struct platform_device *pdev)
4455 + struct ux500_glue *glue = platform_get_drvdata(pdev);
4456 +
4457 + platform_device_unregister(glue->musb);
4458 +- clk_disable(glue->clk);
4459 ++ clk_disable_unprepare(glue->clk);
4460 + clk_put(glue->clk);
4461 + kfree(glue);
4462 +
4463 +@@ -182,7 +182,7 @@ static int ux500_suspend(struct device *dev)
4464 + struct musb *musb = glue_to_musb(glue);
4465 +
4466 + usb_phy_set_suspend(musb->xceiv, 1);
4467 +- clk_disable(glue->clk);
4468 ++ clk_disable_unprepare(glue->clk);
4469 +
4470 + return 0;
4471 + }
4472 +@@ -193,7 +193,7 @@ static int ux500_resume(struct device *dev)
4473 + struct musb *musb = glue_to_musb(glue);
4474 + int ret;
4475 +
4476 +- ret = clk_enable(glue->clk);
4477 ++ ret = clk_prepare_enable(glue->clk);
4478 + if (ret) {
4479 + dev_err(dev, "failed to enable clock\n");
4480 + return ret;
4481 +diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
4482 +index 90ceef1..d07fccf 100644
4483 +--- a/drivers/usb/serial/ftdi_sio.c
4484 ++++ b/drivers/usb/serial/ftdi_sio.c
4485 +@@ -1886,24 +1886,22 @@ static void ftdi_dtr_rts(struct usb_serial_port *port, int on)
4486 + {
4487 + struct ftdi_private *priv = usb_get_serial_port_data(port);
4488 +
4489 +- mutex_lock(&port->serial->disc_mutex);
4490 +- if (!port->serial->disconnected) {
4491 +- /* Disable flow control */
4492 +- if (!on && usb_control_msg(port->serial->dev,
4493 ++ /* Disable flow control */
4494 ++ if (!on) {
4495 ++ if (usb_control_msg(port->serial->dev,
4496 + usb_sndctrlpipe(port->serial->dev, 0),
4497 + FTDI_SIO_SET_FLOW_CTRL_REQUEST,
4498 + FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
4499 + 0, priv->interface, NULL, 0,
4500 + WDR_TIMEOUT) < 0) {
4501 +- dev_err(&port->dev, "error from flowcontrol urb\n");
4502 ++ dev_err(&port->dev, "error from flowcontrol urb\n");
4503 + }
4504 +- /* drop RTS and DTR */
4505 +- if (on)
4506 +- set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
4507 +- else
4508 +- clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
4509 + }
4510 +- mutex_unlock(&port->serial->disc_mutex);
4511 ++ /* drop RTS and DTR */
4512 ++ if (on)
4513 ++ set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
4514 ++ else
4515 ++ clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
4516 + }
4517 +
4518 + /*
4519 +diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
4520 +index b691175..d9c8651 100644
4521 +--- a/drivers/usb/serial/mct_u232.c
4522 ++++ b/drivers/usb/serial/mct_u232.c
4523 +@@ -499,19 +499,15 @@ static void mct_u232_dtr_rts(struct usb_serial_port *port, int on)
4524 + unsigned int control_state;
4525 + struct mct_u232_private *priv = usb_get_serial_port_data(port);
4526 +
4527 +- mutex_lock(&port->serial->disc_mutex);
4528 +- if (!port->serial->disconnected) {
4529 +- /* drop DTR and RTS */
4530 +- spin_lock_irq(&priv->lock);
4531 +- if (on)
4532 +- priv->control_state |= TIOCM_DTR | TIOCM_RTS;
4533 +- else
4534 +- priv->control_state &= ~(TIOCM_DTR | TIOCM_RTS);
4535 +- control_state = priv->control_state;
4536 +- spin_unlock_irq(&priv->lock);
4537 +- mct_u232_set_modem_ctrl(port, control_state);
4538 +- }
4539 +- mutex_unlock(&port->serial->disc_mutex);
4540 ++ spin_lock_irq(&priv->lock);
4541 ++ if (on)
4542 ++ priv->control_state |= TIOCM_DTR | TIOCM_RTS;
4543 ++ else
4544 ++ priv->control_state &= ~(TIOCM_DTR | TIOCM_RTS);
4545 ++ control_state = priv->control_state;
4546 ++ spin_unlock_irq(&priv->lock);
4547 ++
4548 ++ mct_u232_set_modem_ctrl(port, control_state);
4549 + }
4550 +
4551 + static void mct_u232_close(struct usb_serial_port *port)
4552 +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
4553 +index 567bc77..f7d339d 100644
4554 +--- a/drivers/usb/serial/option.c
4555 ++++ b/drivers/usb/serial/option.c
4556 +@@ -479,6 +479,7 @@ static const struct option_blacklist_info four_g_w14_blacklist = {
4557 +
4558 + static const struct option_blacklist_info alcatel_x200_blacklist = {
4559 + .sendsetup = BIT(0) | BIT(1),
4560 ++ .reserved = BIT(4),
4561 + };
4562 +
4563 + static const struct option_blacklist_info zte_0037_blacklist = {
4564 +@@ -575,8 +576,14 @@ static const struct usb_device_id option_ids[] = {
4565 + { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLX) },
4566 + { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GKE) },
4567 + { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLE) },
4568 ++ { USB_DEVICE(QUANTA_VENDOR_ID, 0xea42),
4569 ++ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
4570 ++ { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c05, USB_CLASS_COMM, 0x02, 0xff) },
4571 ++ { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c23, USB_CLASS_COMM, 0x02, 0xff) },
4572 + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173, 0xff, 0xff, 0xff),
4573 + .driver_info = (kernel_ulong_t) &net_intf1_blacklist },
4574 ++ { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1441, USB_CLASS_COMM, 0x02, 0xff) },
4575 ++ { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1442, USB_CLASS_COMM, 0x02, 0xff) },
4576 + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff),
4577 + .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist },
4578 + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff),
4579 +@@ -1215,7 +1222,14 @@ static const struct usb_device_id option_ids[] = {
4580 + { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S_X200),
4581 + .driver_info = (kernel_ulong_t)&alcatel_x200_blacklist
4582 + },
4583 +- { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X220_X500D) },
4584 ++ { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X220_X500D),
4585 ++ .driver_info = (kernel_ulong_t)&net_intf6_blacklist },
4586 ++ { USB_DEVICE(ALCATEL_VENDOR_ID, 0x0052),
4587 ++ .driver_info = (kernel_ulong_t)&net_intf6_blacklist },
4588 ++ { USB_DEVICE(ALCATEL_VENDOR_ID, 0x00b6),
4589 ++ .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
4590 ++ { USB_DEVICE(ALCATEL_VENDOR_ID, 0x00b7),
4591 ++ .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
4592 + { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_L100V),
4593 + .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
4594 + { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) },
4595 +diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c
4596 +index d152be9..a8d5110 100644
4597 +--- a/drivers/usb/serial/quatech2.c
4598 ++++ b/drivers/usb/serial/quatech2.c
4599 +@@ -945,19 +945,17 @@ static void qt2_dtr_rts(struct usb_serial_port *port, int on)
4600 + struct usb_device *dev = port->serial->dev;
4601 + struct qt2_port_private *port_priv = usb_get_serial_port_data(port);
4602 +
4603 +- mutex_lock(&port->serial->disc_mutex);
4604 +- if (!port->serial->disconnected) {
4605 +- /* Disable flow control */
4606 +- if (!on && qt2_setregister(dev, port_priv->device_port,
4607 ++ /* Disable flow control */
4608 ++ if (!on) {
4609 ++ if (qt2_setregister(dev, port_priv->device_port,
4610 + UART_MCR, 0) < 0)
4611 + dev_warn(&port->dev, "error from flowcontrol urb\n");
4612 +- /* drop RTS and DTR */
4613 +- if (on)
4614 +- update_mctrl(port_priv, TIOCM_DTR | TIOCM_RTS, 0);
4615 +- else
4616 +- update_mctrl(port_priv, 0, TIOCM_DTR | TIOCM_RTS);
4617 + }
4618 +- mutex_unlock(&port->serial->disc_mutex);
4619 ++ /* drop RTS and DTR */
4620 ++ if (on)
4621 ++ update_mctrl(port_priv, TIOCM_DTR | TIOCM_RTS, 0);
4622 ++ else
4623 ++ update_mctrl(port_priv, 0, TIOCM_DTR | TIOCM_RTS);
4624 + }
4625 +
4626 + static void qt2_update_msr(struct usb_serial_port *port, unsigned char *ch)
4627 +diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
4628 +index af06f2f..d4426c0 100644
4629 +--- a/drivers/usb/serial/sierra.c
4630 ++++ b/drivers/usb/serial/sierra.c
4631 +@@ -861,19 +861,13 @@ static int sierra_open(struct tty_struct *tty, struct usb_serial_port *port)
4632 +
4633 + static void sierra_dtr_rts(struct usb_serial_port *port, int on)
4634 + {
4635 +- struct usb_serial *serial = port->serial;
4636 + struct sierra_port_private *portdata;
4637 +
4638 + portdata = usb_get_serial_port_data(port);
4639 + portdata->rts_state = on;
4640 + portdata->dtr_state = on;
4641 +
4642 +- if (serial->dev) {
4643 +- mutex_lock(&serial->disc_mutex);
4644 +- if (!serial->disconnected)
4645 +- sierra_send_setup(port);
4646 +- mutex_unlock(&serial->disc_mutex);
4647 +- }
4648 ++ sierra_send_setup(port);
4649 + }
4650 +
4651 + static int sierra_startup(struct usb_serial *serial)
4652 +diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c
4653 +index 4543ea3..d938396 100644
4654 +--- a/drivers/usb/serial/ssu100.c
4655 ++++ b/drivers/usb/serial/ssu100.c
4656 +@@ -506,19 +506,16 @@ static void ssu100_dtr_rts(struct usb_serial_port *port, int on)
4657 + {
4658 + struct usb_device *dev = port->serial->dev;
4659 +
4660 +- mutex_lock(&port->serial->disc_mutex);
4661 +- if (!port->serial->disconnected) {
4662 +- /* Disable flow control */
4663 +- if (!on &&
4664 +- ssu100_setregister(dev, 0, UART_MCR, 0) < 0)
4665 ++ /* Disable flow control */
4666 ++ if (!on) {
4667 ++ if (ssu100_setregister(dev, 0, UART_MCR, 0) < 0)
4668 + dev_err(&port->dev, "error from flowcontrol urb\n");
4669 +- /* drop RTS and DTR */
4670 +- if (on)
4671 +- set_mctrl(dev, TIOCM_DTR | TIOCM_RTS);
4672 +- else
4673 +- clear_mctrl(dev, TIOCM_DTR | TIOCM_RTS);
4674 + }
4675 +- mutex_unlock(&port->serial->disc_mutex);
4676 ++ /* drop RTS and DTR */
4677 ++ if (on)
4678 ++ set_mctrl(dev, TIOCM_DTR | TIOCM_RTS);
4679 ++ else
4680 ++ clear_mctrl(dev, TIOCM_DTR | TIOCM_RTS);
4681 + }
4682 +
4683 + static void ssu100_update_msr(struct usb_serial_port *port, u8 msr)
4684 +diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
4685 +index 64bda13..15af799 100644
4686 +--- a/drivers/usb/serial/usb-serial.c
4687 ++++ b/drivers/usb/serial/usb-serial.c
4688 +@@ -688,10 +688,20 @@ static int serial_carrier_raised(struct tty_port *port)
4689 + static void serial_dtr_rts(struct tty_port *port, int on)
4690 + {
4691 + struct usb_serial_port *p = container_of(port, struct usb_serial_port, port);
4692 +- struct usb_serial_driver *drv = p->serial->type;
4693 ++ struct usb_serial *serial = p->serial;
4694 ++ struct usb_serial_driver *drv = serial->type;
4695 +
4696 +- if (drv->dtr_rts)
4697 ++ if (!drv->dtr_rts)
4698 ++ return;
4699 ++ /*
4700 ++ * Work-around bug in the tty-layer which can result in dtr_rts
4701 ++ * being called after a disconnect (and tty_unregister_device
4702 ++ * has returned). Remove once bug has been squashed.
4703 ++ */
4704 ++ mutex_lock(&serial->disc_mutex);
4705 ++ if (!serial->disconnected)
4706 + drv->dtr_rts(p, on);
4707 ++ mutex_unlock(&serial->disc_mutex);
4708 + }
4709 +
4710 + static const struct tty_port_operations serial_port_ops = {
4711 +diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
4712 +index 01c94aa..1355a6c 100644
4713 +--- a/drivers/usb/serial/usb_wwan.c
4714 ++++ b/drivers/usb/serial/usb_wwan.c
4715 +@@ -38,7 +38,6 @@
4716 +
4717 + void usb_wwan_dtr_rts(struct usb_serial_port *port, int on)
4718 + {
4719 +- struct usb_serial *serial = port->serial;
4720 + struct usb_wwan_port_private *portdata;
4721 + struct usb_wwan_intf_private *intfdata;
4722 +
4723 +@@ -48,12 +47,11 @@ void usb_wwan_dtr_rts(struct usb_serial_port *port, int on)
4724 + return;
4725 +
4726 + portdata = usb_get_serial_port_data(port);
4727 +- mutex_lock(&serial->disc_mutex);
4728 ++ /* FIXME: locking */
4729 + portdata->rts_state = on;
4730 + portdata->dtr_state = on;
4731 +- if (serial->dev)
4732 +- intfdata->send_setup(port);
4733 +- mutex_unlock(&serial->disc_mutex);
4734 ++
4735 ++ intfdata->send_setup(port);
4736 + }
4737 + EXPORT_SYMBOL(usb_wwan_dtr_rts);
4738 +
4739 +diff --git a/drivers/usb/storage/initializers.c b/drivers/usb/storage/initializers.c
4740 +index 16b0bf0..7ab9046 100644
4741 +--- a/drivers/usb/storage/initializers.c
4742 ++++ b/drivers/usb/storage/initializers.c
4743 +@@ -147,7 +147,7 @@ static int usb_stor_huawei_dongles_pid(struct us_data *us)
4744 + int idProduct;
4745 +
4746 + idesc = &us->pusb_intf->cur_altsetting->desc;
4747 +- idProduct = us->pusb_dev->descriptor.idProduct;
4748 ++ idProduct = le16_to_cpu(us->pusb_dev->descriptor.idProduct);
4749 + /* The first port is CDROM,
4750 + * means the dongle in the single port mode,
4751 + * and a switch command is required to be sent. */
4752 +@@ -169,7 +169,7 @@ int usb_stor_huawei_init(struct us_data *us)
4753 + int result = 0;
4754 +
4755 + if (usb_stor_huawei_dongles_pid(us)) {
4756 +- if (us->pusb_dev->descriptor.idProduct >= 0x1446)
4757 ++ if (le16_to_cpu(us->pusb_dev->descriptor.idProduct) >= 0x1446)
4758 + result = usb_stor_huawei_scsi_init(us);
4759 + else
4760 + result = usb_stor_huawei_feature_init(us);
4761 +diff --git a/drivers/usb/storage/unusual_cypress.h b/drivers/usb/storage/unusual_cypress.h
4762 +index 2c85530..65a6a75 100644
4763 +--- a/drivers/usb/storage/unusual_cypress.h
4764 ++++ b/drivers/usb/storage/unusual_cypress.h
4765 +@@ -31,7 +31,7 @@ UNUSUAL_DEV( 0x04b4, 0x6831, 0x0000, 0x9999,
4766 + "Cypress ISD-300LP",
4767 + USB_SC_CYP_ATACB, USB_PR_DEVICE, NULL, 0),
4768 +
4769 +-UNUSUAL_DEV( 0x14cd, 0x6116, 0x0000, 0x9999,
4770 ++UNUSUAL_DEV( 0x14cd, 0x6116, 0x0000, 0x0219,
4771 + "Super Top",
4772 + "USB 2.0 SATA BRIDGE",
4773 + USB_SC_CYP_ATACB, USB_PR_DEVICE, NULL, 0),
4774 +diff --git a/drivers/video/backlight/adp8860_bl.c b/drivers/video/backlight/adp8860_bl.c
4775 +index 6bb72c0..a77c9ca 100644
4776 +--- a/drivers/video/backlight/adp8860_bl.c
4777 ++++ b/drivers/video/backlight/adp8860_bl.c
4778 +@@ -783,7 +783,7 @@ static int adp8860_i2c_suspend(struct i2c_client *client, pm_message_t message)
4779 +
4780 + static int adp8860_i2c_resume(struct i2c_client *client)
4781 + {
4782 +- adp8860_set_bits(client, ADP8860_MDCR, NSTBY);
4783 ++ adp8860_set_bits(client, ADP8860_MDCR, NSTBY | BLEN);
4784 +
4785 + return 0;
4786 + }
4787 +diff --git a/drivers/video/backlight/adp8870_bl.c b/drivers/video/backlight/adp8870_bl.c
4788 +index 63c882b..712c25a 100644
4789 +--- a/drivers/video/backlight/adp8870_bl.c
4790 ++++ b/drivers/video/backlight/adp8870_bl.c
4791 +@@ -957,7 +957,7 @@ static int adp8870_i2c_suspend(struct i2c_client *client, pm_message_t message)
4792 +
4793 + static int adp8870_i2c_resume(struct i2c_client *client)
4794 + {
4795 +- adp8870_set_bits(client, ADP8870_MDCR, NSTBY);
4796 ++ adp8870_set_bits(client, ADP8870_MDCR, NSTBY | BLEN);
4797 +
4798 + return 0;
4799 + }
4800 +diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
4801 +index fdefa8f..501c599 100644
4802 +--- a/drivers/video/console/fbcon.c
4803 ++++ b/drivers/video/console/fbcon.c
4804 +@@ -529,6 +529,33 @@ static int search_for_mapped_con(void)
4805 + return retval;
4806 + }
4807 +
4808 ++static int do_fbcon_takeover(int show_logo)
4809 ++{
4810 ++ int err, i;
4811 ++
4812 ++ if (!num_registered_fb)
4813 ++ return -ENODEV;
4814 ++
4815 ++ if (!show_logo)
4816 ++ logo_shown = FBCON_LOGO_DONTSHOW;
4817 ++
4818 ++ for (i = first_fb_vc; i <= last_fb_vc; i++)
4819 ++ con2fb_map[i] = info_idx;
4820 ++
4821 ++ err = do_take_over_console(&fb_con, first_fb_vc, last_fb_vc,
4822 ++ fbcon_is_default);
4823 ++
4824 ++ if (err) {
4825 ++ for (i = first_fb_vc; i <= last_fb_vc; i++)
4826 ++ con2fb_map[i] = -1;
4827 ++ info_idx = -1;
4828 ++ } else {
4829 ++ fbcon_has_console_bind = 1;
4830 ++ }
4831 ++
4832 ++ return err;
4833 ++}
4834 ++
4835 + static int fbcon_takeover(int show_logo)
4836 + {
4837 + int err, i;
4838 +@@ -815,6 +842,8 @@ static void con2fb_init_display(struct vc_data *vc, struct fb_info *info,
4839 + *
4840 + * Maps a virtual console @unit to a frame buffer device
4841 + * @newidx.
4842 ++ *
4843 ++ * This should be called with the console lock held.
4844 + */
4845 + static int set_con2fb_map(int unit, int newidx, int user)
4846 + {
4847 +@@ -832,7 +861,7 @@ static int set_con2fb_map(int unit, int newidx, int user)
4848 +
4849 + if (!search_for_mapped_con() || !con_is_bound(&fb_con)) {
4850 + info_idx = newidx;
4851 +- return fbcon_takeover(0);
4852 ++ return do_fbcon_takeover(0);
4853 + }
4854 +
4855 + if (oldidx != -1)
4856 +@@ -840,7 +869,6 @@ static int set_con2fb_map(int unit, int newidx, int user)
4857 +
4858 + found = search_fb_in_map(newidx);
4859 +
4860 +- console_lock();
4861 + con2fb_map[unit] = newidx;
4862 + if (!err && !found)
4863 + err = con2fb_acquire_newinfo(vc, info, unit, oldidx);
4864 +@@ -867,7 +895,6 @@ static int set_con2fb_map(int unit, int newidx, int user)
4865 + if (!search_fb_in_map(info_idx))
4866 + info_idx = newidx;
4867 +
4868 +- console_unlock();
4869 + return err;
4870 + }
4871 +
4872 +@@ -990,7 +1017,7 @@ static const char *fbcon_startup(void)
4873 + }
4874 +
4875 + /* Setup default font */
4876 +- if (!p->fontdata) {
4877 ++ if (!p->fontdata && !vc->vc_font.data) {
4878 + if (!fontname[0] || !(font = find_font(fontname)))
4879 + font = get_default_font(info->var.xres,
4880 + info->var.yres,
4881 +@@ -1000,6 +1027,8 @@ static const char *fbcon_startup(void)
4882 + vc->vc_font.height = font->height;
4883 + vc->vc_font.data = (void *)(p->fontdata = font->data);
4884 + vc->vc_font.charcount = 256; /* FIXME Need to support more fonts */
4885 ++ } else {
4886 ++ p->fontdata = vc->vc_font.data;
4887 + }
4888 +
4889 + cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres);
4890 +@@ -1159,9 +1188,9 @@ static void fbcon_init(struct vc_data *vc, int init)
4891 + ops->p = &fb_display[fg_console];
4892 + }
4893 +
4894 +-static void fbcon_free_font(struct display *p)
4895 ++static void fbcon_free_font(struct display *p, bool freefont)
4896 + {
4897 +- if (p->userfont && p->fontdata && (--REFCOUNT(p->fontdata) == 0))
4898 ++ if (freefont && p->userfont && p->fontdata && (--REFCOUNT(p->fontdata) == 0))
4899 + kfree(p->fontdata - FONT_EXTRA_WORDS * sizeof(int));
4900 + p->fontdata = NULL;
4901 + p->userfont = 0;
4902 +@@ -1173,8 +1202,8 @@ static void fbcon_deinit(struct vc_data *vc)
4903 + struct fb_info *info;
4904 + struct fbcon_ops *ops;
4905 + int idx;
4906 ++ bool free_font = true;
4907 +
4908 +- fbcon_free_font(p);
4909 + idx = con2fb_map[vc->vc_num];
4910 +
4911 + if (idx == -1)
4912 +@@ -1185,6 +1214,8 @@ static void fbcon_deinit(struct vc_data *vc)
4913 + if (!info)
4914 + goto finished;
4915 +
4916 ++ if (info->flags & FBINFO_MISC_FIRMWARE)
4917 ++ free_font = false;
4918 + ops = info->fbcon_par;
4919 +
4920 + if (!ops)
4921 +@@ -1196,6 +1227,8 @@ static void fbcon_deinit(struct vc_data *vc)
4922 + ops->flags &= ~FBCON_FLAGS_INIT;
4923 + finished:
4924 +
4925 ++ fbcon_free_font(p, free_font);
4926 ++
4927 + if (!con_is_bound(&fb_con))
4928 + fbcon_exit();
4929 +
4930 +@@ -2977,7 +3010,7 @@ static int fbcon_unbind(void)
4931 + {
4932 + int ret;
4933 +
4934 +- ret = unbind_con_driver(&fb_con, first_fb_vc, last_fb_vc,
4935 ++ ret = do_unbind_con_driver(&fb_con, first_fb_vc, last_fb_vc,
4936 + fbcon_is_default);
4937 +
4938 + if (!ret)
4939 +@@ -2992,6 +3025,7 @@ static inline int fbcon_unbind(void)
4940 + }
4941 + #endif /* CONFIG_VT_HW_CONSOLE_BINDING */
4942 +
4943 ++/* called with console_lock held */
4944 + static int fbcon_fb_unbind(int idx)
4945 + {
4946 + int i, new_idx = -1, ret = 0;
4947 +@@ -3018,6 +3052,7 @@ static int fbcon_fb_unbind(int idx)
4948 + return ret;
4949 + }
4950 +
4951 ++/* called with console_lock held */
4952 + static int fbcon_fb_unregistered(struct fb_info *info)
4953 + {
4954 + int i, idx;
4955 +@@ -3050,11 +3085,12 @@ static int fbcon_fb_unregistered(struct fb_info *info)
4956 + primary_device = -1;
4957 +
4958 + if (!num_registered_fb)
4959 +- unregister_con_driver(&fb_con);
4960 ++ do_unregister_con_driver(&fb_con);
4961 +
4962 + return 0;
4963 + }
4964 +
4965 ++/* called with console_lock held */
4966 + static void fbcon_remap_all(int idx)
4967 + {
4968 + int i;
4969 +@@ -3099,6 +3135,7 @@ static inline void fbcon_select_primary(struct fb_info *info)
4970 + }
4971 + #endif /* CONFIG_FRAMEBUFFER_DETECT_PRIMARY */
4972 +
4973 ++/* called with console_lock held */
4974 + static int fbcon_fb_registered(struct fb_info *info)
4975 + {
4976 + int ret = 0, i, idx;
4977 +@@ -3115,7 +3152,7 @@ static int fbcon_fb_registered(struct fb_info *info)
4978 + }
4979 +
4980 + if (info_idx != -1)
4981 +- ret = fbcon_takeover(1);
4982 ++ ret = do_fbcon_takeover(1);
4983 + } else {
4984 + for (i = first_fb_vc; i <= last_fb_vc; i++) {
4985 + if (con2fb_map_boot[i] == idx)
4986 +@@ -3251,6 +3288,7 @@ static int fbcon_event_notify(struct notifier_block *self,
4987 + ret = fbcon_fb_unregistered(info);
4988 + break;
4989 + case FB_EVENT_SET_CONSOLE_MAP:
4990 ++ /* called with console lock held */
4991 + con2fb = event->data;
4992 + ret = set_con2fb_map(con2fb->console - 1,
4993 + con2fb->framebuffer, 1);
4994 +diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
4995 +index d449a74..5855d17 100644
4996 +--- a/drivers/video/console/vgacon.c
4997 ++++ b/drivers/video/console/vgacon.c
4998 +@@ -1064,7 +1064,7 @@ static int vgacon_do_font_op(struct vgastate *state,char *arg,int set,int ch512)
4999 + unsigned short video_port_status = vga_video_port_reg + 6;
5000 + int font_select = 0x00, beg, i;
5001 + char *charmap;
5002 +-
5003 ++ bool clear_attribs = false;
5004 + if (vga_video_type != VIDEO_TYPE_EGAM) {
5005 + charmap = (char *) VGA_MAP_MEM(colourmap, 0);
5006 + beg = 0x0e;
5007 +@@ -1169,12 +1169,6 @@ static int vgacon_do_font_op(struct vgastate *state,char *arg,int set,int ch512)
5008 +
5009 + /* if 512 char mode is already enabled don't re-enable it. */
5010 + if ((set) && (ch512 != vga_512_chars)) {
5011 +- /* attribute controller */
5012 +- for (i = 0; i < MAX_NR_CONSOLES; i++) {
5013 +- struct vc_data *c = vc_cons[i].d;
5014 +- if (c && c->vc_sw == &vga_con)
5015 +- c->vc_hi_font_mask = ch512 ? 0x0800 : 0;
5016 +- }
5017 + vga_512_chars = ch512;
5018 + /* 256-char: enable intensity bit
5019 + 512-char: disable intensity bit */
5020 +@@ -1185,8 +1179,22 @@ static int vgacon_do_font_op(struct vgastate *state,char *arg,int set,int ch512)
5021 + it means, but it works, and it appears necessary */
5022 + inb_p(video_port_status);
5023 + vga_wattr(state->vgabase, VGA_AR_ENABLE_DISPLAY, 0);
5024 ++ clear_attribs = true;
5025 + }
5026 + raw_spin_unlock_irq(&vga_lock);
5027 ++
5028 ++ if (clear_attribs) {
5029 ++ for (i = 0; i < MAX_NR_CONSOLES; i++) {
5030 ++ struct vc_data *c = vc_cons[i].d;
5031 ++ if (c && c->vc_sw == &vga_con) {
5032 ++ /* force hi font mask to 0, so we always clear
5033 ++ the bit on either transition */
5034 ++ c->vc_hi_font_mask = 0x00;
5035 ++ clear_buffer_attributes(c);
5036 ++ c->vc_hi_font_mask = ch512 ? 0x0800 : 0;
5037 ++ }
5038 ++ }
5039 ++ }
5040 + return 0;
5041 + }
5042 +
5043 +diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
5044 +index 3ff0105..dc61c12 100644
5045 +--- a/drivers/video/fbmem.c
5046 ++++ b/drivers/video/fbmem.c
5047 +@@ -1177,8 +1177,10 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
5048 + event.data = &con2fb;
5049 + if (!lock_fb_info(info))
5050 + return -ENODEV;
5051 ++ console_lock();
5052 + event.info = info;
5053 + ret = fb_notifier_call_chain(FB_EVENT_SET_CONSOLE_MAP, &event);
5054 ++ console_unlock();
5055 + unlock_fb_info(info);
5056 + break;
5057 + case FBIOBLANK:
5058 +@@ -1650,7 +1652,9 @@ static int do_register_framebuffer(struct fb_info *fb_info)
5059 + event.info = fb_info;
5060 + if (!lock_fb_info(fb_info))
5061 + return -ENODEV;
5062 ++ console_lock();
5063 + fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event);
5064 ++ console_unlock();
5065 + unlock_fb_info(fb_info);
5066 + return 0;
5067 + }
5068 +@@ -1666,8 +1670,10 @@ static int do_unregister_framebuffer(struct fb_info *fb_info)
5069 +
5070 + if (!lock_fb_info(fb_info))
5071 + return -ENODEV;
5072 ++ console_lock();
5073 + event.info = fb_info;
5074 + ret = fb_notifier_call_chain(FB_EVENT_FB_UNBIND, &event);
5075 ++ console_unlock();
5076 + unlock_fb_info(fb_info);
5077 +
5078 + if (ret)
5079 +@@ -1682,7 +1688,9 @@ static int do_unregister_framebuffer(struct fb_info *fb_info)
5080 + num_registered_fb--;
5081 + fb_cleanup_device(fb_info);
5082 + event.info = fb_info;
5083 ++ console_lock();
5084 + fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event);
5085 ++ console_unlock();
5086 +
5087 + /* this may free fb info */
5088 + put_fb_info(fb_info);
5089 +@@ -1853,11 +1861,8 @@ int fb_new_modelist(struct fb_info *info)
5090 + err = 1;
5091 +
5092 + if (!list_empty(&info->modelist)) {
5093 +- if (!lock_fb_info(info))
5094 +- return -ENODEV;
5095 + event.info = info;
5096 + err = fb_notifier_call_chain(FB_EVENT_NEW_MODELIST, &event);
5097 +- unlock_fb_info(info);
5098 + }
5099 +
5100 + return err;
5101 +diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c
5102 +index a55e366..ef476b0 100644
5103 +--- a/drivers/video/fbsysfs.c
5104 ++++ b/drivers/video/fbsysfs.c
5105 +@@ -177,6 +177,8 @@ static ssize_t store_modes(struct device *device,
5106 + if (i * sizeof(struct fb_videomode) != count)
5107 + return -EINVAL;
5108 +
5109 ++ if (!lock_fb_info(fb_info))
5110 ++ return -ENODEV;
5111 + console_lock();
5112 + list_splice(&fb_info->modelist, &old_list);
5113 + fb_videomode_to_modelist((const struct fb_videomode *)buf, i,
5114 +@@ -188,6 +190,7 @@ static ssize_t store_modes(struct device *device,
5115 + fb_destroy_modelist(&old_list);
5116 +
5117 + console_unlock();
5118 ++ unlock_fb_info(fb_info);
5119 +
5120 + return 0;
5121 + }
5122 +diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c
5123 +index 19cfd7a..41fbd94 100644
5124 +--- a/drivers/video/fsl-diu-fb.c
5125 ++++ b/drivers/video/fsl-diu-fb.c
5126 +@@ -944,7 +944,7 @@ static u32 fsl_diu_get_pixel_format(unsigned int bits_per_pixel)
5127 + #define PF_COMP_0_MASK 0x0000000F
5128 + #define PF_COMP_0_SHIFT 0
5129 +
5130 +-#define MAKE_PF(alpha, red, blue, green, size, c0, c1, c2, c3) \
5131 ++#define MAKE_PF(alpha, red, green, blue, size, c0, c1, c2, c3) \
5132 + cpu_to_le32(PF_BYTE_F | (alpha << PF_ALPHA_C_SHIFT) | \
5133 + (blue << PF_BLUE_C_SHIFT) | (green << PF_GREEN_C_SHIFT) | \
5134 + (red << PF_RED_C_SHIFT) | (c3 << PF_COMP_3_SHIFT) | \
5135 +@@ -954,10 +954,10 @@ static u32 fsl_diu_get_pixel_format(unsigned int bits_per_pixel)
5136 + switch (bits_per_pixel) {
5137 + case 32:
5138 + /* 0x88883316 */
5139 +- return MAKE_PF(3, 2, 0, 1, 3, 8, 8, 8, 8);
5140 ++ return MAKE_PF(3, 2, 1, 0, 3, 8, 8, 8, 8);
5141 + case 24:
5142 + /* 0x88082219 */
5143 +- return MAKE_PF(4, 0, 1, 2, 2, 0, 8, 8, 8);
5144 ++ return MAKE_PF(4, 0, 1, 2, 2, 8, 8, 8, 0);
5145 + case 16:
5146 + /* 0x65053118 */
5147 + return MAKE_PF(4, 2, 1, 0, 1, 5, 6, 5, 0);
5148 +@@ -1232,6 +1232,16 @@ static int fsl_diu_ioctl(struct fb_info *info, unsigned int cmd,
5149 + return 0;
5150 + }
5151 +
5152 ++static inline void fsl_diu_enable_interrupts(struct fsl_diu_data *data)
5153 ++{
5154 ++ u32 int_mask = INT_UNDRUN; /* enable underrun detection */
5155 ++
5156 ++ if (IS_ENABLED(CONFIG_NOT_COHERENT_CACHE))
5157 ++ int_mask |= INT_VSYNC; /* enable vertical sync */
5158 ++
5159 ++ clrbits32(&data->diu_reg->int_mask, int_mask);
5160 ++}
5161 ++
5162 + /* turn on fb if count == 1
5163 + */
5164 + static int fsl_diu_open(struct fb_info *info, int user)
5165 +@@ -1251,19 +1261,7 @@ static int fsl_diu_open(struct fb_info *info, int user)
5166 + if (res < 0)
5167 + mfbi->count--;
5168 + else {
5169 +- struct fsl_diu_data *data = mfbi->parent;
5170 +-
5171 +-#ifdef CONFIG_NOT_COHERENT_CACHE
5172 +- /*
5173 +- * Enable underrun detection and vertical sync
5174 +- * interrupts.
5175 +- */
5176 +- clrbits32(&data->diu_reg->int_mask,
5177 +- INT_UNDRUN | INT_VSYNC);
5178 +-#else
5179 +- /* Enable underrun detection */
5180 +- clrbits32(&data->diu_reg->int_mask, INT_UNDRUN);
5181 +-#endif
5182 ++ fsl_diu_enable_interrupts(mfbi->parent);
5183 + fsl_diu_enable_panel(info);
5184 + }
5185 + }
5186 +@@ -1283,9 +1281,18 @@ static int fsl_diu_release(struct fb_info *info, int user)
5187 + mfbi->count--;
5188 + if (mfbi->count == 0) {
5189 + struct fsl_diu_data *data = mfbi->parent;
5190 ++ bool disable = true;
5191 ++ int i;
5192 +
5193 +- /* Disable interrupts */
5194 +- out_be32(&data->diu_reg->int_mask, 0xffffffff);
5195 ++ /* Disable interrupts only if all AOIs are closed */
5196 ++ for (i = 0; i < NUM_AOIS; i++) {
5197 ++ struct mfb_info *mi = data->fsl_diu_info[i].par;
5198 ++
5199 ++ if (mi->count)
5200 ++ disable = false;
5201 ++ }
5202 ++ if (disable)
5203 ++ out_be32(&data->diu_reg->int_mask, 0xffffffff);
5204 + fsl_diu_disable_panel(info);
5205 + }
5206 +
5207 +@@ -1614,14 +1621,6 @@ static int fsl_diu_probe(struct platform_device *pdev)
5208 + out_be32(&data->diu_reg->desc[1], data->dummy_ad.paddr);
5209 + out_be32(&data->diu_reg->desc[2], data->dummy_ad.paddr);
5210 +
5211 +- for (i = 0; i < NUM_AOIS; i++) {
5212 +- ret = install_fb(&data->fsl_diu_info[i]);
5213 +- if (ret) {
5214 +- dev_err(&pdev->dev, "could not register fb %d\n", i);
5215 +- goto error;
5216 +- }
5217 +- }
5218 +-
5219 + /*
5220 + * Older versions of U-Boot leave interrupts enabled, so disable
5221 + * all of them and clear the status register.
5222 +@@ -1630,12 +1629,21 @@ static int fsl_diu_probe(struct platform_device *pdev)
5223 + in_be32(&data->diu_reg->int_status);
5224 +
5225 + ret = request_irq(data->irq, fsl_diu_isr, 0, "fsl-diu-fb",
5226 +- &data->diu_reg);
5227 ++ data->diu_reg);
5228 + if (ret) {
5229 + dev_err(&pdev->dev, "could not claim irq\n");
5230 + goto error;
5231 + }
5232 +
5233 ++ for (i = 0; i < NUM_AOIS; i++) {
5234 ++ ret = install_fb(&data->fsl_diu_info[i]);
5235 ++ if (ret) {
5236 ++ dev_err(&pdev->dev, "could not register fb %d\n", i);
5237 ++ free_irq(data->irq, data->diu_reg);
5238 ++ goto error;
5239 ++ }
5240 ++ }
5241 ++
5242 + sysfs_attr_init(&data->dev_attr.attr);
5243 + data->dev_attr.attr.name = "monitor";
5244 + data->dev_attr.attr.mode = S_IRUGO|S_IWUSR;
5245 +@@ -1667,7 +1675,7 @@ static int fsl_diu_remove(struct platform_device *pdev)
5246 + data = dev_get_drvdata(&pdev->dev);
5247 + disable_lcdc(&data->fsl_diu_info[0]);
5248 +
5249 +- free_irq(data->irq, &data->diu_reg);
5250 ++ free_irq(data->irq, data->diu_reg);
5251 +
5252 + for (i = 0; i < NUM_AOIS; i++)
5253 + uninstall_fb(&data->fsl_diu_info[i]);
5254 +diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c
5255 +index b1f60a0..b2db77e 100644
5256 +--- a/drivers/xen/evtchn.c
5257 ++++ b/drivers/xen/evtchn.c
5258 +@@ -269,6 +269,14 @@ static int evtchn_bind_to_user(struct per_user_data *u, int port)
5259 + u->name, (void *)(unsigned long)port);
5260 + if (rc >= 0)
5261 + rc = evtchn_make_refcounted(port);
5262 ++ else {
5263 ++ /* bind failed, should close the port now */
5264 ++ struct evtchn_close close;
5265 ++ close.port = port;
5266 ++ if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0)
5267 ++ BUG();
5268 ++ set_port_user(port, NULL);
5269 ++ }
5270 +
5271 + return rc;
5272 + }
5273 +@@ -277,6 +285,8 @@ static void evtchn_unbind_from_user(struct per_user_data *u, int port)
5274 + {
5275 + int irq = irq_from_evtchn(port);
5276 +
5277 ++ BUG_ON(irq < 0);
5278 ++
5279 + unbind_from_irqhandler(irq, (void *)(unsigned long)port);
5280 +
5281 + set_port_user(port, NULL);
5282 +diff --git a/fs/block_dev.c b/fs/block_dev.c
5283 +index 172f849..78333a3 100644
5284 +--- a/fs/block_dev.c
5285 ++++ b/fs/block_dev.c
5286 +@@ -994,6 +994,7 @@ int revalidate_disk(struct gendisk *disk)
5287 +
5288 + mutex_lock(&bdev->bd_mutex);
5289 + check_disk_size_change(disk, bdev);
5290 ++ bdev->bd_invalidated = 0;
5291 + mutex_unlock(&bdev->bd_mutex);
5292 + bdput(bdev);
5293 + return ret;
5294 +diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
5295 +index a68e91b..9a3945a 100644
5296 +--- a/fs/gfs2/bmap.c
5297 ++++ b/fs/gfs2/bmap.c
5298 +@@ -1286,6 +1286,10 @@ int gfs2_setattr_size(struct inode *inode, u64 newsize)
5299 +
5300 + inode_dio_wait(inode);
5301 +
5302 ++ ret = gfs2_rs_alloc(GFS2_I(inode));
5303 ++ if (ret)
5304 ++ return ret;
5305 ++
5306 + oldsize = inode->i_size;
5307 + if (newsize >= oldsize)
5308 + return do_grow(inode, newsize);
5309 +diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
5310 +index 54f9e6c..52e5120 100644
5311 +--- a/fs/lockd/clntproc.c
5312 ++++ b/fs/lockd/clntproc.c
5313 +@@ -550,6 +550,9 @@ again:
5314 + status = nlmclnt_block(block, req, NLMCLNT_POLL_TIMEOUT);
5315 + if (status < 0)
5316 + break;
5317 ++ /* Resend the blocking lock request after a server reboot */
5318 ++ if (resp->status == nlm_lck_denied_grace_period)
5319 ++ continue;
5320 + if (resp->status != nlm_lck_blocked)
5321 + break;
5322 + }
5323 +diff --git a/fs/namespace.c b/fs/namespace.c
5324 +index 55605c5..a51054f 100644
5325 +--- a/fs/namespace.c
5326 ++++ b/fs/namespace.c
5327 +@@ -1238,6 +1238,14 @@ static int do_umount(struct mount *mnt, int flags)
5328 + }
5329 +
5330 + /*
5331 ++ * Is the caller allowed to modify his namespace?
5332 ++ */
5333 ++static inline bool may_mount(void)
5334 ++{
5335 ++ return ns_capable(current->nsproxy->mnt_ns->user_ns, CAP_SYS_ADMIN);
5336 ++}
5337 ++
5338 ++/*
5339 + * Now umount can handle mount points as well as block devices.
5340 + * This is important for filesystems which use unnamed block devices.
5341 + *
5342 +@@ -1255,6 +1263,9 @@ SYSCALL_DEFINE2(umount, char __user *, name, int, flags)
5343 + if (flags & ~(MNT_FORCE | MNT_DETACH | MNT_EXPIRE | UMOUNT_NOFOLLOW))
5344 + return -EINVAL;
5345 +
5346 ++ if (!may_mount())
5347 ++ return -EPERM;
5348 ++
5349 + if (!(flags & UMOUNT_NOFOLLOW))
5350 + lookup_flags |= LOOKUP_FOLLOW;
5351 +
5352 +@@ -1268,10 +1279,6 @@ SYSCALL_DEFINE2(umount, char __user *, name, int, flags)
5353 + if (!check_mnt(mnt))
5354 + goto dput_and_out;
5355 +
5356 +- retval = -EPERM;
5357 +- if (!ns_capable(mnt->mnt_ns->user_ns, CAP_SYS_ADMIN))
5358 +- goto dput_and_out;
5359 +-
5360 + retval = do_umount(mnt, flags);
5361 + dput_and_out:
5362 + /* we mustn't call path_put() as that would clear mnt_expiry_mark */
5363 +@@ -1295,7 +1302,7 @@ SYSCALL_DEFINE1(oldumount, char __user *, name)
5364 +
5365 + static int mount_is_safe(struct path *path)
5366 + {
5367 +- if (ns_capable(real_mount(path->mnt)->mnt_ns->user_ns, CAP_SYS_ADMIN))
5368 ++ if (may_mount())
5369 + return 0;
5370 + return -EPERM;
5371 + #ifdef notyet
5372 +@@ -1633,7 +1640,7 @@ static int do_change_type(struct path *path, int flag)
5373 + int type;
5374 + int err = 0;
5375 +
5376 +- if (!ns_capable(mnt->mnt_ns->user_ns, CAP_SYS_ADMIN))
5377 ++ if (!may_mount())
5378 + return -EPERM;
5379 +
5380 + if (path->dentry != path->mnt->mnt_root)
5381 +@@ -1797,7 +1804,7 @@ static int do_move_mount(struct path *path, const char *old_name)
5382 + struct mount *p;
5383 + struct mount *old;
5384 + int err = 0;
5385 +- if (!ns_capable(real_mount(path->mnt)->mnt_ns->user_ns, CAP_SYS_ADMIN))
5386 ++ if (!may_mount())
5387 + return -EPERM;
5388 + if (!old_name || !*old_name)
5389 + return -EINVAL;
5390 +@@ -1933,16 +1940,14 @@ static int do_new_mount(struct path *path, const char *fstype, int flags,
5391 + int mnt_flags, const char *name, void *data)
5392 + {
5393 + struct file_system_type *type;
5394 +- struct user_namespace *user_ns;
5395 ++ struct user_namespace *user_ns = current->nsproxy->mnt_ns->user_ns;
5396 + struct vfsmount *mnt;
5397 + int err;
5398 +
5399 + if (!fstype)
5400 + return -EINVAL;
5401 +
5402 +- /* we need capabilities... */
5403 +- user_ns = real_mount(path->mnt)->mnt_ns->user_ns;
5404 +- if (!ns_capable(user_ns, CAP_SYS_ADMIN))
5405 ++ if (!may_mount())
5406 + return -EPERM;
5407 +
5408 + type = get_fs_type(fstype);
5409 +@@ -2567,7 +2572,7 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,
5410 + struct mount *new_mnt, *root_mnt;
5411 + int error;
5412 +
5413 +- if (!ns_capable(current->nsproxy->mnt_ns->user_ns, CAP_SYS_ADMIN))
5414 ++ if (!may_mount())
5415 + return -EPERM;
5416 +
5417 + error = user_path_dir(new_root, &new);
5418 +diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c
5419 +index 4fa788c..434b93e 100644
5420 +--- a/fs/nfs/blocklayout/blocklayout.c
5421 ++++ b/fs/nfs/blocklayout/blocklayout.c
5422 +@@ -1273,6 +1273,7 @@ static const struct nfs_pageio_ops bl_pg_write_ops = {
5423 + static struct pnfs_layoutdriver_type blocklayout_type = {
5424 + .id = LAYOUT_BLOCK_VOLUME,
5425 + .name = "LAYOUT_BLOCK_VOLUME",
5426 ++ .owner = THIS_MODULE,
5427 + .read_pagelist = bl_read_pagelist,
5428 + .write_pagelist = bl_write_pagelist,
5429 + .alloc_layout_hdr = bl_alloc_layout_hdr,
5430 +diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
5431 +index 264d1aa..2960512 100644
5432 +--- a/fs/nfs/callback_proc.c
5433 ++++ b/fs/nfs/callback_proc.c
5434 +@@ -183,60 +183,15 @@ static u32 initiate_file_draining(struct nfs_client *clp,
5435 + static u32 initiate_bulk_draining(struct nfs_client *clp,
5436 + struct cb_layoutrecallargs *args)
5437 + {
5438 +- struct nfs_server *server;
5439 +- struct pnfs_layout_hdr *lo;
5440 +- struct inode *ino;
5441 +- u32 rv = NFS4ERR_NOMATCHING_LAYOUT;
5442 +- struct pnfs_layout_hdr *tmp;
5443 +- LIST_HEAD(recall_list);
5444 +- LIST_HEAD(free_me_list);
5445 +- struct pnfs_layout_range range = {
5446 +- .iomode = IOMODE_ANY,
5447 +- .offset = 0,
5448 +- .length = NFS4_MAX_UINT64,
5449 +- };
5450 +-
5451 +- spin_lock(&clp->cl_lock);
5452 +- rcu_read_lock();
5453 +- list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) {
5454 +- if ((args->cbl_recall_type == RETURN_FSID) &&
5455 +- memcmp(&server->fsid, &args->cbl_fsid,
5456 +- sizeof(struct nfs_fsid)))
5457 +- continue;
5458 ++ int stat;
5459 +
5460 +- list_for_each_entry(lo, &server->layouts, plh_layouts) {
5461 +- ino = igrab(lo->plh_inode);
5462 +- if (!ino)
5463 +- continue;
5464 +- spin_lock(&ino->i_lock);
5465 +- /* Is this layout in the process of being freed? */
5466 +- if (NFS_I(ino)->layout != lo) {
5467 +- spin_unlock(&ino->i_lock);
5468 +- iput(ino);
5469 +- continue;
5470 +- }
5471 +- pnfs_get_layout_hdr(lo);
5472 +- spin_unlock(&ino->i_lock);
5473 +- list_add(&lo->plh_bulk_recall, &recall_list);
5474 +- }
5475 +- }
5476 +- rcu_read_unlock();
5477 +- spin_unlock(&clp->cl_lock);
5478 +-
5479 +- list_for_each_entry_safe(lo, tmp,
5480 +- &recall_list, plh_bulk_recall) {
5481 +- ino = lo->plh_inode;
5482 +- spin_lock(&ino->i_lock);
5483 +- set_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags);
5484 +- if (pnfs_mark_matching_lsegs_invalid(lo, &free_me_list, &range))
5485 +- rv = NFS4ERR_DELAY;
5486 +- list_del_init(&lo->plh_bulk_recall);
5487 +- spin_unlock(&ino->i_lock);
5488 +- pnfs_free_lseg_list(&free_me_list);
5489 +- pnfs_put_layout_hdr(lo);
5490 +- iput(ino);
5491 +- }
5492 +- return rv;
5493 ++ if (args->cbl_recall_type == RETURN_FSID)
5494 ++ stat = pnfs_destroy_layouts_byfsid(clp, &args->cbl_fsid, true);
5495 ++ else
5496 ++ stat = pnfs_destroy_layouts_byclid(clp, true);
5497 ++ if (stat != 0)
5498 ++ return NFS4ERR_DELAY;
5499 ++ return NFS4ERR_NOMATCHING_LAYOUT;
5500 + }
5501 +
5502 + static u32 do_callback_layoutrecall(struct nfs_client *clp,
5503 +diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
5504 +index cf747ef..efda60d 100644
5505 +--- a/fs/nfs/nfs4proc.c
5506 ++++ b/fs/nfs/nfs4proc.c
5507 +@@ -1463,7 +1463,7 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata)
5508 + struct nfs4_state_owner *sp = data->owner;
5509 +
5510 + if (nfs_wait_on_sequence(data->o_arg.seqid, task) != 0)
5511 +- return;
5512 ++ goto out_wait;
5513 + /*
5514 + * Check if we still need to send an OPEN call, or if we can use
5515 + * a delegation instead.
5516 +@@ -1498,6 +1498,7 @@ unlock_no_action:
5517 + rcu_read_unlock();
5518 + out_no_action:
5519 + task->tk_action = NULL;
5520 ++out_wait:
5521 + nfs4_sequence_done(task, &data->o_res.seq_res);
5522 + }
5523 +
5524 +@@ -2150,7 +2151,7 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data)
5525 +
5526 + dprintk("%s: begin!\n", __func__);
5527 + if (nfs_wait_on_sequence(calldata->arg.seqid, task) != 0)
5528 +- return;
5529 ++ goto out_wait;
5530 +
5531 + task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_DOWNGRADE];
5532 + calldata->arg.fmode = FMODE_READ|FMODE_WRITE;
5533 +@@ -2172,16 +2173,14 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data)
5534 +
5535 + if (!call_close) {
5536 + /* Note: exit _without_ calling nfs4_close_done */
5537 +- task->tk_action = NULL;
5538 +- nfs4_sequence_done(task, &calldata->res.seq_res);
5539 +- goto out;
5540 ++ goto out_no_action;
5541 + }
5542 +
5543 + if (calldata->arg.fmode == 0) {
5544 + task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_CLOSE];
5545 + if (calldata->roc &&
5546 + pnfs_roc_drain(inode, &calldata->roc_barrier, task))
5547 +- goto out;
5548 ++ goto out_wait;
5549 + }
5550 +
5551 + nfs_fattr_init(calldata->res.fattr);
5552 +@@ -2191,8 +2190,12 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data)
5553 + &calldata->res.seq_res,
5554 + task) != 0)
5555 + nfs_release_seqid(calldata->arg.seqid);
5556 +-out:
5557 + dprintk("%s: done!\n", __func__);
5558 ++ return;
5559 ++out_no_action:
5560 ++ task->tk_action = NULL;
5561 ++out_wait:
5562 ++ nfs4_sequence_done(task, &calldata->res.seq_res);
5563 + }
5564 +
5565 + static const struct rpc_call_ops nfs4_close_ops = {
5566 +@@ -4423,12 +4426,10 @@ static void nfs4_locku_prepare(struct rpc_task *task, void *data)
5567 + struct nfs4_unlockdata *calldata = data;
5568 +
5569 + if (nfs_wait_on_sequence(calldata->arg.seqid, task) != 0)
5570 +- return;
5571 ++ goto out_wait;
5572 + if (test_bit(NFS_LOCK_INITIALIZED, &calldata->lsp->ls_flags) == 0) {
5573 + /* Note: exit _without_ running nfs4_locku_done */
5574 +- task->tk_action = NULL;
5575 +- nfs4_sequence_done(task, &calldata->res.seq_res);
5576 +- return;
5577 ++ goto out_no_action;
5578 + }
5579 + calldata->timestamp = jiffies;
5580 + if (nfs4_setup_sequence(calldata->server,
5581 +@@ -4436,6 +4437,11 @@ static void nfs4_locku_prepare(struct rpc_task *task, void *data)
5582 + &calldata->res.seq_res,
5583 + task) != 0)
5584 + nfs_release_seqid(calldata->arg.seqid);
5585 ++ return;
5586 ++out_no_action:
5587 ++ task->tk_action = NULL;
5588 ++out_wait:
5589 ++ nfs4_sequence_done(task, &calldata->res.seq_res);
5590 + }
5591 +
5592 + static const struct rpc_call_ops nfs4_locku_ops = {
5593 +@@ -4576,7 +4582,7 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata)
5594 +
5595 + dprintk("%s: begin!\n", __func__);
5596 + if (nfs_wait_on_sequence(data->arg.lock_seqid, task) != 0)
5597 +- return;
5598 ++ goto out_wait;
5599 + /* Do we need to do an open_to_lock_owner? */
5600 + if (!(data->arg.lock_seqid->sequence->flags & NFS_SEQID_CONFIRMED)) {
5601 + if (nfs_wait_on_sequence(data->arg.open_seqid, task) != 0) {
5602 +@@ -4596,6 +4602,8 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata)
5603 + nfs_release_seqid(data->arg.open_seqid);
5604 + out_release_lock_seqid:
5605 + nfs_release_seqid(data->arg.lock_seqid);
5606 ++out_wait:
5607 ++ nfs4_sequence_done(task, &data->res.seq_res);
5608 + dprintk("%s: done!, ret = %d\n", __func__, data->rpc_status);
5609 + }
5610 +
5611 +@@ -6134,7 +6142,8 @@ nfs4_proc_layoutget(struct nfs4_layoutget *lgp, gfp_t gfp_flags)
5612 + status = nfs4_wait_for_completion_rpc_task(task);
5613 + if (status == 0)
5614 + status = task->tk_status;
5615 +- if (status == 0)
5616 ++ /* if layoutp->len is 0, nfs4_layoutget_prepare called rpc_exit */
5617 ++ if (status == 0 && lgp->res.layoutp->len)
5618 + lseg = pnfs_layout_process(lgp);
5619 + rpc_put_task(task);
5620 + dprintk("<-- %s status=%d\n", __func__, status);
5621 +diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c
5622 +index c6f9906..88f9611 100644
5623 +--- a/fs/nfs/objlayout/objio_osd.c
5624 ++++ b/fs/nfs/objlayout/objio_osd.c
5625 +@@ -647,6 +647,7 @@ static struct pnfs_layoutdriver_type objlayout_type = {
5626 + .flags = PNFS_LAYOUTRET_ON_SETATTR |
5627 + PNFS_LAYOUTRET_ON_ERROR,
5628 +
5629 ++ .owner = THIS_MODULE,
5630 + .alloc_layout_hdr = objlayout_alloc_layout_hdr,
5631 + .free_layout_hdr = objlayout_free_layout_hdr,
5632 +
5633 +diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
5634 +index d00260b..6be70f6 100644
5635 +--- a/fs/nfs/pnfs.c
5636 ++++ b/fs/nfs/pnfs.c
5637 +@@ -505,37 +505,147 @@ pnfs_destroy_layout(struct nfs_inode *nfsi)
5638 + }
5639 + EXPORT_SYMBOL_GPL(pnfs_destroy_layout);
5640 +
5641 +-/*
5642 +- * Called by the state manger to remove all layouts established under an
5643 +- * expired lease.
5644 +- */
5645 +-void
5646 +-pnfs_destroy_all_layouts(struct nfs_client *clp)
5647 ++static bool
5648 ++pnfs_layout_add_bulk_destroy_list(struct inode *inode,
5649 ++ struct list_head *layout_list)
5650 + {
5651 +- struct nfs_server *server;
5652 + struct pnfs_layout_hdr *lo;
5653 +- LIST_HEAD(tmp_list);
5654 ++ bool ret = false;
5655 +
5656 +- nfs4_deviceid_mark_client_invalid(clp);
5657 +- nfs4_deviceid_purge_client(clp);
5658 ++ spin_lock(&inode->i_lock);
5659 ++ lo = NFS_I(inode)->layout;
5660 ++ if (lo != NULL && list_empty(&lo->plh_bulk_destroy)) {
5661 ++ pnfs_get_layout_hdr(lo);
5662 ++ list_add(&lo->plh_bulk_destroy, layout_list);
5663 ++ ret = true;
5664 ++ }
5665 ++ spin_unlock(&inode->i_lock);
5666 ++ return ret;
5667 ++}
5668 ++
5669 ++/* Caller must hold rcu_read_lock and clp->cl_lock */
5670 ++static int
5671 ++pnfs_layout_bulk_destroy_byserver_locked(struct nfs_client *clp,
5672 ++ struct nfs_server *server,
5673 ++ struct list_head *layout_list)
5674 ++{
5675 ++ struct pnfs_layout_hdr *lo, *next;
5676 ++ struct inode *inode;
5677 ++
5678 ++ list_for_each_entry_safe(lo, next, &server->layouts, plh_layouts) {
5679 ++ inode = igrab(lo->plh_inode);
5680 ++ if (inode == NULL)
5681 ++ continue;
5682 ++ list_del_init(&lo->plh_layouts);
5683 ++ if (pnfs_layout_add_bulk_destroy_list(inode, layout_list))
5684 ++ continue;
5685 ++ rcu_read_unlock();
5686 ++ spin_unlock(&clp->cl_lock);
5687 ++ iput(inode);
5688 ++ spin_lock(&clp->cl_lock);
5689 ++ rcu_read_lock();
5690 ++ return -EAGAIN;
5691 ++ }
5692 ++ return 0;
5693 ++}
5694 ++
5695 ++static int
5696 ++pnfs_layout_free_bulk_destroy_list(struct list_head *layout_list,
5697 ++ bool is_bulk_recall)
5698 ++{
5699 ++ struct pnfs_layout_hdr *lo;
5700 ++ struct inode *inode;
5701 ++ struct pnfs_layout_range range = {
5702 ++ .iomode = IOMODE_ANY,
5703 ++ .offset = 0,
5704 ++ .length = NFS4_MAX_UINT64,
5705 ++ };
5706 ++ LIST_HEAD(lseg_list);
5707 ++ int ret = 0;
5708 ++
5709 ++ while (!list_empty(layout_list)) {
5710 ++ lo = list_entry(layout_list->next, struct pnfs_layout_hdr,
5711 ++ plh_bulk_destroy);
5712 ++ dprintk("%s freeing layout for inode %lu\n", __func__,
5713 ++ lo->plh_inode->i_ino);
5714 ++ inode = lo->plh_inode;
5715 ++ spin_lock(&inode->i_lock);
5716 ++ list_del_init(&lo->plh_bulk_destroy);
5717 ++ lo->plh_block_lgets++; /* permanently block new LAYOUTGETs */
5718 ++ if (is_bulk_recall)
5719 ++ set_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags);
5720 ++ if (pnfs_mark_matching_lsegs_invalid(lo, &lseg_list, &range))
5721 ++ ret = -EAGAIN;
5722 ++ spin_unlock(&inode->i_lock);
5723 ++ pnfs_free_lseg_list(&lseg_list);
5724 ++ pnfs_put_layout_hdr(lo);
5725 ++ iput(inode);
5726 ++ }
5727 ++ return ret;
5728 ++}
5729 ++
5730 ++int
5731 ++pnfs_destroy_layouts_byfsid(struct nfs_client *clp,
5732 ++ struct nfs_fsid *fsid,
5733 ++ bool is_recall)
5734 ++{
5735 ++ struct nfs_server *server;
5736 ++ LIST_HEAD(layout_list);
5737 +
5738 + spin_lock(&clp->cl_lock);
5739 + rcu_read_lock();
5740 ++restart:
5741 + list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) {
5742 +- if (!list_empty(&server->layouts))
5743 +- list_splice_init(&server->layouts, &tmp_list);
5744 ++ if (memcmp(&server->fsid, fsid, sizeof(*fsid)) != 0)
5745 ++ continue;
5746 ++ if (pnfs_layout_bulk_destroy_byserver_locked(clp,
5747 ++ server,
5748 ++ &layout_list) != 0)
5749 ++ goto restart;
5750 + }
5751 + rcu_read_unlock();
5752 + spin_unlock(&clp->cl_lock);
5753 +
5754 +- while (!list_empty(&tmp_list)) {
5755 +- lo = list_entry(tmp_list.next, struct pnfs_layout_hdr,
5756 +- plh_layouts);
5757 +- dprintk("%s freeing layout for inode %lu\n", __func__,
5758 +- lo->plh_inode->i_ino);
5759 +- list_del_init(&lo->plh_layouts);
5760 +- pnfs_destroy_layout(NFS_I(lo->plh_inode));
5761 ++ if (list_empty(&layout_list))
5762 ++ return 0;
5763 ++ return pnfs_layout_free_bulk_destroy_list(&layout_list, is_recall);
5764 ++}
5765 ++
5766 ++int
5767 ++pnfs_destroy_layouts_byclid(struct nfs_client *clp,
5768 ++ bool is_recall)
5769 ++{
5770 ++ struct nfs_server *server;
5771 ++ LIST_HEAD(layout_list);
5772 ++
5773 ++ spin_lock(&clp->cl_lock);
5774 ++ rcu_read_lock();
5775 ++restart:
5776 ++ list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) {
5777 ++ if (pnfs_layout_bulk_destroy_byserver_locked(clp,
5778 ++ server,
5779 ++ &layout_list) != 0)
5780 ++ goto restart;
5781 + }
5782 ++ rcu_read_unlock();
5783 ++ spin_unlock(&clp->cl_lock);
5784 ++
5785 ++ if (list_empty(&layout_list))
5786 ++ return 0;
5787 ++ return pnfs_layout_free_bulk_destroy_list(&layout_list, is_recall);
5788 ++}
5789 ++
5790 ++/*
5791 ++ * Called by the state manger to remove all layouts established under an
5792 ++ * expired lease.
5793 ++ */
5794 ++void
5795 ++pnfs_destroy_all_layouts(struct nfs_client *clp)
5796 ++{
5797 ++ nfs4_deviceid_mark_client_invalid(clp);
5798 ++ nfs4_deviceid_purge_client(clp);
5799 ++
5800 ++ pnfs_destroy_layouts_byclid(clp, false);
5801 + }
5802 +
5803 + /*
5804 +@@ -888,7 +998,7 @@ alloc_init_layout_hdr(struct inode *ino,
5805 + atomic_set(&lo->plh_refcount, 1);
5806 + INIT_LIST_HEAD(&lo->plh_layouts);
5807 + INIT_LIST_HEAD(&lo->plh_segs);
5808 +- INIT_LIST_HEAD(&lo->plh_bulk_recall);
5809 ++ INIT_LIST_HEAD(&lo->plh_bulk_destroy);
5810 + lo->plh_inode = ino;
5811 + lo->plh_lc_cred = get_rpccred(ctx->state->owner->so_cred);
5812 + return lo;
5813 +diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
5814 +index dbf7bba..97cb358 100644
5815 +--- a/fs/nfs/pnfs.h
5816 ++++ b/fs/nfs/pnfs.h
5817 +@@ -132,7 +132,7 @@ struct pnfs_layoutdriver_type {
5818 + struct pnfs_layout_hdr {
5819 + atomic_t plh_refcount;
5820 + struct list_head plh_layouts; /* other client layouts */
5821 +- struct list_head plh_bulk_recall; /* clnt list of bulk recalls */
5822 ++ struct list_head plh_bulk_destroy;
5823 + struct list_head plh_segs; /* layout segments list */
5824 + nfs4_stateid plh_stateid;
5825 + atomic_t plh_outstanding; /* number of RPCs out */
5826 +@@ -196,6 +196,11 @@ struct pnfs_layout_segment *pnfs_layout_process(struct nfs4_layoutget *lgp);
5827 + void pnfs_free_lseg_list(struct list_head *tmp_list);
5828 + void pnfs_destroy_layout(struct nfs_inode *);
5829 + void pnfs_destroy_all_layouts(struct nfs_client *);
5830 ++int pnfs_destroy_layouts_byfsid(struct nfs_client *clp,
5831 ++ struct nfs_fsid *fsid,
5832 ++ bool is_recall);
5833 ++int pnfs_destroy_layouts_byclid(struct nfs_client *clp,
5834 ++ bool is_recall);
5835 + void pnfs_put_layout_hdr(struct pnfs_layout_hdr *lo);
5836 + void pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo,
5837 + const nfs4_stateid *new,
5838 +diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
5839 +index 228a2c2..07f7a92 100644
5840 +--- a/fs/notify/inotify/inotify_user.c
5841 ++++ b/fs/notify/inotify/inotify_user.c
5842 +@@ -576,8 +576,6 @@ static int inotify_update_existing_watch(struct fsnotify_group *group,
5843 +
5844 + /* don't allow invalid bits: we don't want flags set */
5845 + mask = inotify_arg_to_mask(arg);
5846 +- if (unlikely(!(mask & IN_ALL_EVENTS)))
5847 +- return -EINVAL;
5848 +
5849 + fsn_mark = fsnotify_find_inode_mark(group, inode);
5850 + if (!fsn_mark)
5851 +@@ -629,8 +627,6 @@ static int inotify_new_watch(struct fsnotify_group *group,
5852 +
5853 + /* don't allow invalid bits: we don't want flags set */
5854 + mask = inotify_arg_to_mask(arg);
5855 +- if (unlikely(!(mask & IN_ALL_EVENTS)))
5856 +- return -EINVAL;
5857 +
5858 + tmp_i_mark = kmem_cache_alloc(inotify_inode_mark_cachep, GFP_KERNEL);
5859 + if (unlikely(!tmp_i_mark))
5860 +diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
5861 +index 4f7795f..88577eb 100644
5862 +--- a/fs/ocfs2/dlmglue.c
5863 ++++ b/fs/ocfs2/dlmglue.c
5864 +@@ -2545,6 +2545,7 @@ int ocfs2_super_lock(struct ocfs2_super *osb,
5865 + * everything is up to the caller :) */
5866 + status = ocfs2_should_refresh_lock_res(lockres);
5867 + if (status < 0) {
5868 ++ ocfs2_cluster_unlock(osb, lockres, level);
5869 + mlog_errno(status);
5870 + goto bail;
5871 + }
5872 +@@ -2553,8 +2554,10 @@ int ocfs2_super_lock(struct ocfs2_super *osb,
5873 +
5874 + ocfs2_complete_lock_res_refresh(lockres, status);
5875 +
5876 +- if (status < 0)
5877 ++ if (status < 0) {
5878 ++ ocfs2_cluster_unlock(osb, lockres, level);
5879 + mlog_errno(status);
5880 ++ }
5881 + ocfs2_track_lock_refresh(lockres);
5882 + }
5883 + bail:
5884 +diff --git a/include/linux/console.h b/include/linux/console.h
5885 +index dedb082..47b858c 100644
5886 +--- a/include/linux/console.h
5887 ++++ b/include/linux/console.h
5888 +@@ -77,7 +77,9 @@ extern const struct consw prom_con; /* SPARC PROM console */
5889 + int con_is_bound(const struct consw *csw);
5890 + int register_con_driver(const struct consw *csw, int first, int last);
5891 + int unregister_con_driver(const struct consw *csw);
5892 ++int do_unregister_con_driver(const struct consw *csw);
5893 + int take_over_console(const struct consw *sw, int first, int last, int deflt);
5894 ++int do_take_over_console(const struct consw *sw, int first, int last, int deflt);
5895 + void give_up_console(const struct consw *sw);
5896 + #ifdef CONFIG_HW_CONSOLE
5897 + int con_debug_enter(struct vc_data *vc);
5898 +diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
5899 +index d06cc5c..218a3b6 100644
5900 +--- a/include/linux/if_vlan.h
5901 ++++ b/include/linux/if_vlan.h
5902 +@@ -331,7 +331,7 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb,
5903 + struct vlan_hdr *vhdr)
5904 + {
5905 + __be16 proto;
5906 +- unsigned char *rawp;
5907 ++ unsigned short *rawp;
5908 +
5909 + /*
5910 + * Was a VLAN packet, grab the encapsulated protocol, which the layer
5911 +@@ -344,8 +344,8 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb,
5912 + return;
5913 + }
5914 +
5915 +- rawp = skb->data;
5916 +- if (*(unsigned short *) rawp == 0xFFFF)
5917 ++ rawp = (unsigned short *)(vhdr + 1);
5918 ++ if (*rawp == 0xFFFF)
5919 + /*
5920 + * This is a magic hack to spot IPX packets. Older Novell
5921 + * breaks the protocol design and runs IPX over 802.3 without
5922 +diff --git a/include/linux/pps_kernel.h b/include/linux/pps_kernel.h
5923 +index 0cc45ae..7db3eb9 100644
5924 +--- a/include/linux/pps_kernel.h
5925 ++++ b/include/linux/pps_kernel.h
5926 +@@ -43,7 +43,7 @@ struct pps_source_info {
5927 + int event, void *data); /* PPS echo function */
5928 +
5929 + struct module *owner;
5930 +- struct device *dev;
5931 ++ struct device *dev; /* Parent device for device_create */
5932 + };
5933 +
5934 + struct pps_event_time {
5935 +@@ -69,6 +69,7 @@ struct pps_device {
5936 + wait_queue_head_t queue; /* PPS event queue */
5937 +
5938 + unsigned int id; /* PPS source unique ID */
5939 ++ void const *lookup_cookie; /* pps_lookup_dev only */
5940 + struct cdev cdev;
5941 + struct device *dev;
5942 + struct fasync_struct *async_queue; /* fasync method */
5943 +@@ -82,16 +83,26 @@ struct pps_device {
5944 + extern struct device_attribute pps_attrs[];
5945 +
5946 + /*
5947 ++ * Internal functions.
5948 ++ *
5949 ++ * These are not actually part of the exported API, but this is a
5950 ++ * convenient header file to put them in.
5951 ++ */
5952 ++
5953 ++extern int pps_register_cdev(struct pps_device *pps);
5954 ++extern void pps_unregister_cdev(struct pps_device *pps);
5955 ++
5956 ++/*
5957 + * Exported functions
5958 + */
5959 +
5960 + extern struct pps_device *pps_register_source(
5961 + struct pps_source_info *info, int default_params);
5962 + extern void pps_unregister_source(struct pps_device *pps);
5963 +-extern int pps_register_cdev(struct pps_device *pps);
5964 +-extern void pps_unregister_cdev(struct pps_device *pps);
5965 + extern void pps_event(struct pps_device *pps,
5966 + struct pps_event_time *ts, int event, void *data);
5967 ++/* Look up a pps device by magic cookie */
5968 ++struct pps_device *pps_lookup_dev(void const *cookie);
5969 +
5970 + static inline void timespec_to_pps_ktime(struct pps_ktime *kt,
5971 + struct timespec ts)
5972 +diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
5973 +index 50ae7d0..e8d6571 100644
5974 +--- a/include/linux/vt_kern.h
5975 ++++ b/include/linux/vt_kern.h
5976 +@@ -47,6 +47,7 @@ int con_set_cmap(unsigned char __user *cmap);
5977 + int con_get_cmap(unsigned char __user *cmap);
5978 + void scrollback(struct vc_data *vc, int lines);
5979 + void scrollfront(struct vc_data *vc, int lines);
5980 ++void clear_buffer_attributes(struct vc_data *vc);
5981 + void update_region(struct vc_data *vc, unsigned long start, int count);
5982 + void redraw_screen(struct vc_data *vc, int is_switch);
5983 + #define update_screen(x) redraw_screen(x, 0)
5984 +@@ -130,6 +131,8 @@ void vt_event_post(unsigned int event, unsigned int old, unsigned int new);
5985 + int vt_waitactive(int n);
5986 + void change_console(struct vc_data *new_vc);
5987 + void reset_vc(struct vc_data *vc);
5988 ++extern int do_unbind_con_driver(const struct consw *csw, int first, int last,
5989 ++ int deflt);
5990 + extern int unbind_con_driver(const struct consw *csw, int first, int last,
5991 + int deflt);
5992 + int vty_init(const struct file_operations *console_fops);
5993 +diff --git a/include/net/dst.h b/include/net/dst.h
5994 +index 9a78810..b3ebe17 100644
5995 +--- a/include/net/dst.h
5996 ++++ b/include/net/dst.h
5997 +@@ -36,13 +36,9 @@ struct dst_entry {
5998 + struct net_device *dev;
5999 + struct dst_ops *ops;
6000 + unsigned long _metrics;
6001 +- union {
6002 +- unsigned long expires;
6003 +- /* point to where the dst_entry copied from */
6004 +- struct dst_entry *from;
6005 +- };
6006 ++ unsigned long expires;
6007 + struct dst_entry *path;
6008 +- void *__pad0;
6009 ++ struct dst_entry *from;
6010 + #ifdef CONFIG_XFRM
6011 + struct xfrm_state *xfrm;
6012 + #else
6013 +diff --git a/include/net/icmp.h b/include/net/icmp.h
6014 +index 9ac2524..081439f 100644
6015 +--- a/include/net/icmp.h
6016 ++++ b/include/net/icmp.h
6017 +@@ -41,6 +41,7 @@ struct net;
6018 +
6019 + extern void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info);
6020 + extern int icmp_rcv(struct sk_buff *skb);
6021 ++extern void icmp_err(struct sk_buff *, u32 info);
6022 + extern int icmp_init(void);
6023 + extern void icmp_out_count(struct net *net, unsigned char type);
6024 +
6025 +diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
6026 +index 9e34c87..f071f50 100644
6027 +--- a/include/net/inet6_hashtables.h
6028 ++++ b/include/net/inet6_hashtables.h
6029 +@@ -28,16 +28,16 @@
6030 +
6031 + struct inet_hashinfo;
6032 +
6033 +-/* I have no idea if this is a good hash for v6 or not. -DaveM */
6034 + static inline unsigned int inet6_ehashfn(struct net *net,
6035 + const struct in6_addr *laddr, const u16 lport,
6036 + const struct in6_addr *faddr, const __be16 fport)
6037 + {
6038 +- u32 ports = (lport ^ (__force u16)fport);
6039 ++ u32 ports = (((u32)lport) << 16) | (__force u32)fport;
6040 +
6041 + return jhash_3words((__force u32)laddr->s6_addr32[3],
6042 +- (__force u32)faddr->s6_addr32[3],
6043 +- ports, inet_ehash_secret + net_hash_mix(net));
6044 ++ ipv6_addr_jhash(faddr),
6045 ++ ports,
6046 ++ inet_ehash_secret + net_hash_mix(net));
6047 + }
6048 +
6049 + static inline int inet6_sk_ehashfn(const struct sock *sk)
6050 +diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
6051 +index a4196cb..7235ae7 100644
6052 +--- a/include/net/inet_sock.h
6053 ++++ b/include/net/inet_sock.h
6054 +@@ -203,6 +203,7 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to,
6055 + extern int inet_sk_rebuild_header(struct sock *sk);
6056 +
6057 + extern u32 inet_ehash_secret;
6058 ++extern u32 ipv6_hash_secret;
6059 + extern void build_ehash_secret(void);
6060 +
6061 + static inline unsigned int inet_ehashfn(struct net *net,
6062 +diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
6063 +index fdc48a9..28d27a6 100644
6064 +--- a/include/net/ip6_fib.h
6065 ++++ b/include/net/ip6_fib.h
6066 +@@ -166,50 +166,35 @@ static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst)
6067 +
6068 + static inline void rt6_clean_expires(struct rt6_info *rt)
6069 + {
6070 +- if (!(rt->rt6i_flags & RTF_EXPIRES) && rt->dst.from)
6071 +- dst_release(rt->dst.from);
6072 +-
6073 + rt->rt6i_flags &= ~RTF_EXPIRES;
6074 +- rt->dst.from = NULL;
6075 + }
6076 +
6077 + static inline void rt6_set_expires(struct rt6_info *rt, unsigned long expires)
6078 + {
6079 +- if (!(rt->rt6i_flags & RTF_EXPIRES) && rt->dst.from)
6080 +- dst_release(rt->dst.from);
6081 +-
6082 +- rt->rt6i_flags |= RTF_EXPIRES;
6083 + rt->dst.expires = expires;
6084 ++ rt->rt6i_flags |= RTF_EXPIRES;
6085 + }
6086 +
6087 +-static inline void rt6_update_expires(struct rt6_info *rt, int timeout)
6088 ++static inline void rt6_update_expires(struct rt6_info *rt0, int timeout)
6089 + {
6090 +- if (!(rt->rt6i_flags & RTF_EXPIRES)) {
6091 +- if (rt->dst.from)
6092 +- dst_release(rt->dst.from);
6093 +- /* dst_set_expires relies on expires == 0
6094 +- * if it has not been set previously.
6095 +- */
6096 +- rt->dst.expires = 0;
6097 +- }
6098 +-
6099 +- dst_set_expires(&rt->dst, timeout);
6100 +- rt->rt6i_flags |= RTF_EXPIRES;
6101 ++ struct rt6_info *rt;
6102 ++
6103 ++ for (rt = rt0; rt && !(rt->rt6i_flags & RTF_EXPIRES);
6104 ++ rt = (struct rt6_info *)rt->dst.from);
6105 ++ if (rt && rt != rt0)
6106 ++ rt0->dst.expires = rt->dst.expires;
6107 ++
6108 ++ dst_set_expires(&rt0->dst, timeout);
6109 ++ rt0->rt6i_flags |= RTF_EXPIRES;
6110 + }
6111 +
6112 + static inline void rt6_set_from(struct rt6_info *rt, struct rt6_info *from)
6113 + {
6114 + struct dst_entry *new = (struct dst_entry *) from;
6115 +
6116 +- if (!(rt->rt6i_flags & RTF_EXPIRES) && rt->dst.from) {
6117 +- if (new == rt->dst.from)
6118 +- return;
6119 +- dst_release(rt->dst.from);
6120 +- }
6121 +-
6122 + rt->rt6i_flags &= ~RTF_EXPIRES;
6123 +- rt->dst.from = new;
6124 + dst_hold(new);
6125 ++ rt->dst.from = new;
6126 + }
6127 +
6128 + static inline void ip6_rt_put(struct rt6_info *rt)
6129 +diff --git a/include/net/ipv6.h b/include/net/ipv6.h
6130 +index 5af66b2..5a67919 100644
6131 +--- a/include/net/ipv6.h
6132 ++++ b/include/net/ipv6.h
6133 +@@ -15,6 +15,7 @@
6134 +
6135 + #include <linux/ipv6.h>
6136 + #include <linux/hardirq.h>
6137 ++#include <linux/jhash.h>
6138 + #include <net/if_inet6.h>
6139 + #include <net/ndisc.h>
6140 + #include <net/flow.h>
6141 +@@ -473,6 +474,17 @@ static inline u32 ipv6_addr_hash(const struct in6_addr *a)
6142 + #endif
6143 + }
6144 +
6145 ++/* more secured version of ipv6_addr_hash() */
6146 ++static inline u32 ipv6_addr_jhash(const struct in6_addr *a)
6147 ++{
6148 ++ u32 v = (__force u32)a->s6_addr32[0] ^ (__force u32)a->s6_addr32[1];
6149 ++
6150 ++ return jhash_3words(v,
6151 ++ (__force u32)a->s6_addr32[2],
6152 ++ (__force u32)a->s6_addr32[3],
6153 ++ ipv6_hash_secret);
6154 ++}
6155 ++
6156 + static inline bool ipv6_addr_loopback(const struct in6_addr *a)
6157 + {
6158 + return (a->s6_addr32[0] | a->s6_addr32[1] |
6159 +diff --git a/include/net/sock.h b/include/net/sock.h
6160 +index 182ca99..25afaa0 100644
6161 +--- a/include/net/sock.h
6162 ++++ b/include/net/sock.h
6163 +@@ -1037,7 +1037,7 @@ static inline void sk_refcnt_debug_dec(struct sock *sk)
6164 + sk->sk_prot->name, sk, atomic_read(&sk->sk_prot->socks));
6165 + }
6166 +
6167 +-inline void sk_refcnt_debug_release(const struct sock *sk)
6168 ++static inline void sk_refcnt_debug_release(const struct sock *sk)
6169 + {
6170 + if (atomic_read(&sk->sk_refcnt) != 1)
6171 + printk(KERN_DEBUG "Destruction of the %s socket %p delayed, refcnt=%d\n",
6172 +diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h
6173 +index 2c6c85f..8f6e50a 100644
6174 +--- a/include/uapi/linux/serial_core.h
6175 ++++ b/include/uapi/linux/serial_core.h
6176 +@@ -50,7 +50,7 @@
6177 + #define PORT_LPC3220 22 /* NXP LPC32xx SoC "Standard" UART */
6178 + #define PORT_8250_CIR 23 /* CIR infrared port, has its own driver */
6179 + #define PORT_XR17V35X 24 /* Exar XR17V35x UARTs */
6180 +-#define PORT_BRCM_TRUMANAGE 24
6181 ++#define PORT_BRCM_TRUMANAGE 25
6182 + #define PORT_MAX_8250 25 /* max port ID */
6183 +
6184 + /*
6185 +diff --git a/include/uapi/linux/usb/audio.h b/include/uapi/linux/usb/audio.h
6186 +index ac90037..d2314be 100644
6187 +--- a/include/uapi/linux/usb/audio.h
6188 ++++ b/include/uapi/linux/usb/audio.h
6189 +@@ -384,14 +384,16 @@ static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_de
6190 + int protocol)
6191 + {
6192 + __u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
6193 +- return desc->baSourceID[desc->bNrInPins + control_size];
6194 ++ return *(uac_processing_unit_bmControls(desc, protocol)
6195 ++ + control_size);
6196 + }
6197 +
6198 + static inline __u8 *uac_processing_unit_specific(struct uac_processing_unit_descriptor *desc,
6199 + int protocol)
6200 + {
6201 + __u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
6202 +- return &desc->baSourceID[desc->bNrInPins + control_size + 1];
6203 ++ return uac_processing_unit_bmControls(desc, protocol)
6204 ++ + control_size + 1;
6205 + }
6206 +
6207 + /* 4.5.2 Class-Specific AS Interface Descriptor */
6208 +diff --git a/kernel/futex.c b/kernel/futex.c
6209 +index 19eb089..8879430 100644
6210 +--- a/kernel/futex.c
6211 ++++ b/kernel/futex.c
6212 +@@ -2471,8 +2471,6 @@ SYSCALL_DEFINE3(get_robust_list, int, pid,
6213 + if (!futex_cmpxchg_enabled)
6214 + return -ENOSYS;
6215 +
6216 +- WARN_ONCE(1, "deprecated: get_robust_list will be deleted in 2013.\n");
6217 +-
6218 + rcu_read_lock();
6219 +
6220 + ret = -ESRCH;
6221 +diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c
6222 +index 83e368b..a9642d5 100644
6223 +--- a/kernel/futex_compat.c
6224 ++++ b/kernel/futex_compat.c
6225 +@@ -142,8 +142,6 @@ compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
6226 + if (!futex_cmpxchg_enabled)
6227 + return -ENOSYS;
6228 +
6229 +- WARN_ONCE(1, "deprecated: get_robust_list will be deleted in 2013.\n");
6230 +-
6231 + rcu_read_lock();
6232 +
6233 + ret = -ESRCH;
6234 +diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
6235 +index 6db7a5e..cdd5607 100644
6236 +--- a/kernel/hrtimer.c
6237 ++++ b/kernel/hrtimer.c
6238 +@@ -640,21 +640,9 @@ static inline void hrtimer_init_hres(struct hrtimer_cpu_base *base)
6239 + * and expiry check is done in the hrtimer_interrupt or in the softirq.
6240 + */
6241 + static inline int hrtimer_enqueue_reprogram(struct hrtimer *timer,
6242 +- struct hrtimer_clock_base *base,
6243 +- int wakeup)
6244 ++ struct hrtimer_clock_base *base)
6245 + {
6246 +- if (base->cpu_base->hres_active && hrtimer_reprogram(timer, base)) {
6247 +- if (wakeup) {
6248 +- raw_spin_unlock(&base->cpu_base->lock);
6249 +- raise_softirq_irqoff(HRTIMER_SOFTIRQ);
6250 +- raw_spin_lock(&base->cpu_base->lock);
6251 +- } else
6252 +- __raise_softirq_irqoff(HRTIMER_SOFTIRQ);
6253 +-
6254 +- return 1;
6255 +- }
6256 +-
6257 +- return 0;
6258 ++ return base->cpu_base->hres_active && hrtimer_reprogram(timer, base);
6259 + }
6260 +
6261 + static inline ktime_t hrtimer_update_base(struct hrtimer_cpu_base *base)
6262 +@@ -735,8 +723,7 @@ static inline int hrtimer_switch_to_hres(void) { return 0; }
6263 + static inline void
6264 + hrtimer_force_reprogram(struct hrtimer_cpu_base *base, int skip_equal) { }
6265 + static inline int hrtimer_enqueue_reprogram(struct hrtimer *timer,
6266 +- struct hrtimer_clock_base *base,
6267 +- int wakeup)
6268 ++ struct hrtimer_clock_base *base)
6269 + {
6270 + return 0;
6271 + }
6272 +@@ -995,8 +982,21 @@ int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,
6273 + *
6274 + * XXX send_remote_softirq() ?
6275 + */
6276 +- if (leftmost && new_base->cpu_base == &__get_cpu_var(hrtimer_bases))
6277 +- hrtimer_enqueue_reprogram(timer, new_base, wakeup);
6278 ++ if (leftmost && new_base->cpu_base == &__get_cpu_var(hrtimer_bases)
6279 ++ && hrtimer_enqueue_reprogram(timer, new_base)) {
6280 ++ if (wakeup) {
6281 ++ /*
6282 ++ * We need to drop cpu_base->lock to avoid a
6283 ++ * lock ordering issue vs. rq->lock.
6284 ++ */
6285 ++ raw_spin_unlock(&new_base->cpu_base->lock);
6286 ++ raise_softirq_irqoff(HRTIMER_SOFTIRQ);
6287 ++ local_irq_restore(flags);
6288 ++ return ret;
6289 ++ } else {
6290 ++ __raise_softirq_irqoff(HRTIMER_SOFTIRQ);
6291 ++ }
6292 ++ }
6293 +
6294 + unlock_hrtimer_base(timer, &flags);
6295 +
6296 +diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
6297 +index 611cd60..7b5f012 100644
6298 +--- a/kernel/irq/spurious.c
6299 ++++ b/kernel/irq/spurious.c
6300 +@@ -80,13 +80,11 @@ static int try_one_irq(int irq, struct irq_desc *desc, bool force)
6301 +
6302 + /*
6303 + * All handlers must agree on IRQF_SHARED, so we test just the
6304 +- * first. Check for action->next as well.
6305 ++ * first.
6306 + */
6307 + action = desc->action;
6308 + if (!action || !(action->flags & IRQF_SHARED) ||
6309 +- (action->flags & __IRQF_TIMER) ||
6310 +- (action->handler(irq, action->dev_id) == IRQ_HANDLED) ||
6311 +- !action->next)
6312 ++ (action->flags & __IRQF_TIMER))
6313 + goto out;
6314 +
6315 + /* Already running on another processor */
6316 +@@ -104,6 +102,7 @@ static int try_one_irq(int irq, struct irq_desc *desc, bool force)
6317 + do {
6318 + if (handle_irq_event(desc) == IRQ_HANDLED)
6319 + ret = IRQ_HANDLED;
6320 ++ /* Make sure that there is still a valid action */
6321 + action = desc->action;
6322 + } while ((desc->istate & IRQS_PENDING) && action);
6323 + desc->istate &= ~IRQS_POLL_INPROGRESS;
6324 +diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
6325 +index a278cad..942ca27 100644
6326 +--- a/kernel/posix-cpu-timers.c
6327 ++++ b/kernel/posix-cpu-timers.c
6328 +@@ -1401,8 +1401,10 @@ static int do_cpu_nanosleep(const clockid_t which_clock, int flags,
6329 + while (!signal_pending(current)) {
6330 + if (timer.it.cpu.expires.sched == 0) {
6331 + /*
6332 +- * Our timer fired and was reset.
6333 ++ * Our timer fired and was reset, below
6334 ++ * deletion can not fail.
6335 + */
6336 ++ posix_cpu_timer_del(&timer);
6337 + spin_unlock_irq(&timer.it_lock);
6338 + return 0;
6339 + }
6340 +@@ -1420,9 +1422,26 @@ static int do_cpu_nanosleep(const clockid_t which_clock, int flags,
6341 + * We were interrupted by a signal.
6342 + */
6343 + sample_to_timespec(which_clock, timer.it.cpu.expires, rqtp);
6344 +- posix_cpu_timer_set(&timer, 0, &zero_it, it);
6345 ++ error = posix_cpu_timer_set(&timer, 0, &zero_it, it);
6346 ++ if (!error) {
6347 ++ /*
6348 ++ * Timer is now unarmed, deletion can not fail.
6349 ++ */
6350 ++ posix_cpu_timer_del(&timer);
6351 ++ }
6352 + spin_unlock_irq(&timer.it_lock);
6353 +
6354 ++ while (error == TIMER_RETRY) {
6355 ++ /*
6356 ++ * We need to handle case when timer was or is in the
6357 ++ * middle of firing. In other cases we already freed
6358 ++ * resources.
6359 ++ */
6360 ++ spin_lock_irq(&timer.it_lock);
6361 ++ error = posix_cpu_timer_del(&timer);
6362 ++ spin_unlock_irq(&timer.it_lock);
6363 ++ }
6364 ++
6365 + if ((it->it_value.tv_sec | it->it_value.tv_nsec) == 0) {
6366 + /*
6367 + * It actually did fire already.
6368 +diff --git a/kernel/timeconst.pl b/kernel/timeconst.pl
6369 +index eb51d76..3f42652 100644
6370 +--- a/kernel/timeconst.pl
6371 ++++ b/kernel/timeconst.pl
6372 +@@ -369,10 +369,8 @@ if ($hz eq '--can') {
6373 + die "Usage: $0 HZ\n";
6374 + }
6375 +
6376 +- @val = @{$canned_values{$hz}};
6377 +- if (!defined(@val)) {
6378 +- @val = compute_values($hz);
6379 +- }
6380 ++ $cv = $canned_values{$hz};
6381 ++ @val = defined($cv) ? @$cv : compute_values($hz);
6382 + output($hz, @val);
6383 + }
6384 + exit 0;
6385 +diff --git a/kernel/workqueue.c b/kernel/workqueue.c
6386 +index fbc6576..033ad5b 100644
6387 +--- a/kernel/workqueue.c
6388 ++++ b/kernel/workqueue.c
6389 +@@ -1352,7 +1352,7 @@ void delayed_work_timer_fn(unsigned long __data)
6390 + /* should have been called from irqsafe timer with irq already off */
6391 + __queue_work(dwork->cpu, cwq->wq, &dwork->work);
6392 + }
6393 +-EXPORT_SYMBOL_GPL(delayed_work_timer_fn);
6394 ++EXPORT_SYMBOL(delayed_work_timer_fn);
6395 +
6396 + static void __queue_delayed_work(int cpu, struct workqueue_struct *wq,
6397 + struct delayed_work *dwork, unsigned long delay)
6398 +diff --git a/mm/fadvise.c b/mm/fadvise.c
6399 +index a47f0f5..909ec55 100644
6400 +--- a/mm/fadvise.c
6401 ++++ b/mm/fadvise.c
6402 +@@ -17,6 +17,7 @@
6403 + #include <linux/fadvise.h>
6404 + #include <linux/writeback.h>
6405 + #include <linux/syscalls.h>
6406 ++#include <linux/swap.h>
6407 +
6408 + #include <asm/unistd.h>
6409 +
6410 +@@ -120,9 +121,22 @@ SYSCALL_DEFINE(fadvise64_64)(int fd, loff_t offset, loff_t len, int advice)
6411 + start_index = (offset+(PAGE_CACHE_SIZE-1)) >> PAGE_CACHE_SHIFT;
6412 + end_index = (endbyte >> PAGE_CACHE_SHIFT);
6413 +
6414 +- if (end_index >= start_index)
6415 +- invalidate_mapping_pages(mapping, start_index,
6416 ++ if (end_index >= start_index) {
6417 ++ unsigned long count = invalidate_mapping_pages(mapping,
6418 ++ start_index, end_index);
6419 ++
6420 ++ /*
6421 ++ * If fewer pages were invalidated than expected then
6422 ++ * it is possible that some of the pages were on
6423 ++ * a per-cpu pagevec for a remote CPU. Drain all
6424 ++ * pagevecs and try again.
6425 ++ */
6426 ++ if (count < (end_index - start_index + 1)) {
6427 ++ lru_add_drain_all();
6428 ++ invalidate_mapping_pages(mapping, start_index,
6429 + end_index);
6430 ++ }
6431 ++ }
6432 + break;
6433 + default:
6434 + ret = -EINVAL;
6435 +diff --git a/mm/mmu_notifier.c b/mm/mmu_notifier.c
6436 +index 8a5ac8c..f5c3d96 100644
6437 +--- a/mm/mmu_notifier.c
6438 ++++ b/mm/mmu_notifier.c
6439 +@@ -37,49 +37,51 @@ static struct srcu_struct srcu;
6440 + void __mmu_notifier_release(struct mm_struct *mm)
6441 + {
6442 + struct mmu_notifier *mn;
6443 +- struct hlist_node *n;
6444 + int id;
6445 +
6446 + /*
6447 +- * SRCU here will block mmu_notifier_unregister until
6448 +- * ->release returns.
6449 ++ * srcu_read_lock() here will block synchronize_srcu() in
6450 ++ * mmu_notifier_unregister() until all registered
6451 ++ * ->release() callouts this function makes have
6452 ++ * returned.
6453 + */
6454 + id = srcu_read_lock(&srcu);
6455 +- hlist_for_each_entry_rcu(mn, n, &mm->mmu_notifier_mm->list, hlist)
6456 +- /*
6457 +- * if ->release runs before mmu_notifier_unregister it
6458 +- * must be handled as it's the only way for the driver
6459 +- * to flush all existing sptes and stop the driver
6460 +- * from establishing any more sptes before all the
6461 +- * pages in the mm are freed.
6462 +- */
6463 +- if (mn->ops->release)
6464 +- mn->ops->release(mn, mm);
6465 +- srcu_read_unlock(&srcu, id);
6466 +-
6467 + spin_lock(&mm->mmu_notifier_mm->lock);
6468 + while (unlikely(!hlist_empty(&mm->mmu_notifier_mm->list))) {
6469 + mn = hlist_entry(mm->mmu_notifier_mm->list.first,
6470 + struct mmu_notifier,
6471 + hlist);
6472 ++
6473 + /*
6474 +- * We arrived before mmu_notifier_unregister so
6475 +- * mmu_notifier_unregister will do nothing other than
6476 +- * to wait ->release to finish and
6477 +- * mmu_notifier_unregister to return.
6478 ++ * Unlink. This will prevent mmu_notifier_unregister()
6479 ++ * from also making the ->release() callout.
6480 + */
6481 + hlist_del_init_rcu(&mn->hlist);
6482 ++ spin_unlock(&mm->mmu_notifier_mm->lock);
6483 ++
6484 ++ /*
6485 ++ * Clear sptes. (see 'release' description in mmu_notifier.h)
6486 ++ */
6487 ++ if (mn->ops->release)
6488 ++ mn->ops->release(mn, mm);
6489 ++
6490 ++ spin_lock(&mm->mmu_notifier_mm->lock);
6491 + }
6492 + spin_unlock(&mm->mmu_notifier_mm->lock);
6493 +
6494 + /*
6495 +- * synchronize_srcu here prevents mmu_notifier_release to
6496 +- * return to exit_mmap (which would proceed freeing all pages
6497 +- * in the mm) until the ->release method returns, if it was
6498 +- * invoked by mmu_notifier_unregister.
6499 +- *
6500 +- * The mmu_notifier_mm can't go away from under us because one
6501 +- * mm_count is hold by exit_mmap.
6502 ++ * All callouts to ->release() which we have done are complete.
6503 ++ * Allow synchronize_srcu() in mmu_notifier_unregister() to complete
6504 ++ */
6505 ++ srcu_read_unlock(&srcu, id);
6506 ++
6507 ++ /*
6508 ++ * mmu_notifier_unregister() may have unlinked a notifier and may
6509 ++ * still be calling out to it. Additionally, other notifiers
6510 ++ * may have been active via vmtruncate() et. al. Block here
6511 ++ * to ensure that all notifier callouts for this mm have been
6512 ++ * completed and the sptes are really cleaned up before returning
6513 ++ * to exit_mmap().
6514 + */
6515 + synchronize_srcu(&srcu);
6516 + }
6517 +@@ -294,31 +296,31 @@ void mmu_notifier_unregister(struct mmu_notifier *mn, struct mm_struct *mm)
6518 + {
6519 + BUG_ON(atomic_read(&mm->mm_count) <= 0);
6520 +
6521 ++ spin_lock(&mm->mmu_notifier_mm->lock);
6522 + if (!hlist_unhashed(&mn->hlist)) {
6523 +- /*
6524 +- * SRCU here will force exit_mmap to wait ->release to finish
6525 +- * before freeing the pages.
6526 +- */
6527 + int id;
6528 +
6529 +- id = srcu_read_lock(&srcu);
6530 + /*
6531 +- * exit_mmap will block in mmu_notifier_release to
6532 +- * guarantee ->release is called before freeing the
6533 +- * pages.
6534 ++ * Ensure we synchronize up with __mmu_notifier_release().
6535 + */
6536 ++ id = srcu_read_lock(&srcu);
6537 ++
6538 ++ hlist_del_rcu(&mn->hlist);
6539 ++ spin_unlock(&mm->mmu_notifier_mm->lock);
6540 ++
6541 + if (mn->ops->release)
6542 + mn->ops->release(mn, mm);
6543 +- srcu_read_unlock(&srcu, id);
6544 +
6545 +- spin_lock(&mm->mmu_notifier_mm->lock);
6546 +- hlist_del_rcu(&mn->hlist);
6547 ++ /*
6548 ++ * Allow __mmu_notifier_release() to complete.
6549 ++ */
6550 ++ srcu_read_unlock(&srcu, id);
6551 ++ } else
6552 + spin_unlock(&mm->mmu_notifier_mm->lock);
6553 +- }
6554 +
6555 + /*
6556 +- * Wait any running method to finish, of course including
6557 +- * ->release if it was run by mmu_notifier_relase instead of us.
6558 ++ * Wait for any running method to finish, including ->release() if it
6559 ++ * was run by __mmu_notifier_release() instead of us.
6560 + */
6561 + synchronize_srcu(&srcu);
6562 +
6563 +diff --git a/mm/shmem.c b/mm/shmem.c
6564 +index 5dd56f6..efd0b3a 100644
6565 +--- a/mm/shmem.c
6566 ++++ b/mm/shmem.c
6567 +@@ -2487,6 +2487,7 @@ static int shmem_remount_fs(struct super_block *sb, int *flags, char *data)
6568 + unsigned long inodes;
6569 + int error = -EINVAL;
6570 +
6571 ++ config.mpol = NULL;
6572 + if (shmem_parse_options(data, &config, true))
6573 + return error;
6574 +
6575 +@@ -2511,8 +2512,13 @@ static int shmem_remount_fs(struct super_block *sb, int *flags, char *data)
6576 + sbinfo->max_inodes = config.max_inodes;
6577 + sbinfo->free_inodes = config.max_inodes - inodes;
6578 +
6579 +- mpol_put(sbinfo->mpol);
6580 +- sbinfo->mpol = config.mpol; /* transfers initial ref */
6581 ++ /*
6582 ++ * Preserve previous mempolicy unless mpol remount option was specified.
6583 ++ */
6584 ++ if (config.mpol) {
6585 ++ mpol_put(sbinfo->mpol);
6586 ++ sbinfo->mpol = config.mpol; /* transfers initial ref */
6587 ++ }
6588 + out:
6589 + spin_unlock(&sbinfo->stat_lock);
6590 + return error;
6591 +diff --git a/net/core/dst.c b/net/core/dst.c
6592 +index ee6153e..35fd12f 100644
6593 +--- a/net/core/dst.c
6594 ++++ b/net/core/dst.c
6595 +@@ -179,6 +179,7 @@ void *dst_alloc(struct dst_ops *ops, struct net_device *dev,
6596 + dst_init_metrics(dst, dst_default_metrics, true);
6597 + dst->expires = 0UL;
6598 + dst->path = dst;
6599 ++ dst->from = NULL;
6600 + #ifdef CONFIG_XFRM
6601 + dst->xfrm = NULL;
6602 + #endif
6603 +diff --git a/net/core/sock_diag.c b/net/core/sock_diag.c
6604 +index 602cd63..750f44f 100644
6605 +--- a/net/core/sock_diag.c
6606 ++++ b/net/core/sock_diag.c
6607 +@@ -121,6 +121,9 @@ static int __sock_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
6608 + if (nlmsg_len(nlh) < sizeof(*req))
6609 + return -EINVAL;
6610 +
6611 ++ if (req->sdiag_family >= AF_MAX)
6612 ++ return -EINVAL;
6613 ++
6614 + hndl = sock_diag_lock_handler(req->sdiag_family);
6615 + if (hndl == NULL)
6616 + err = -ENOENT;
6617 +diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
6618 +index 24b384b..fcf104e 100644
6619 +--- a/net/ipv4/af_inet.c
6620 ++++ b/net/ipv4/af_inet.c
6621 +@@ -248,8 +248,12 @@ EXPORT_SYMBOL(inet_listen);
6622 + u32 inet_ehash_secret __read_mostly;
6623 + EXPORT_SYMBOL(inet_ehash_secret);
6624 +
6625 ++u32 ipv6_hash_secret __read_mostly;
6626 ++EXPORT_SYMBOL(ipv6_hash_secret);
6627 ++
6628 + /*
6629 +- * inet_ehash_secret must be set exactly once
6630 ++ * inet_ehash_secret must be set exactly once, and to a non nul value
6631 ++ * ipv6_hash_secret must be set exactly once.
6632 + */
6633 + void build_ehash_secret(void)
6634 + {
6635 +@@ -259,7 +263,8 @@ void build_ehash_secret(void)
6636 + get_random_bytes(&rnd, sizeof(rnd));
6637 + } while (rnd == 0);
6638 +
6639 +- cmpxchg(&inet_ehash_secret, 0, rnd);
6640 ++ if (cmpxchg(&inet_ehash_secret, 0, rnd) == 0)
6641 ++ get_random_bytes(&ipv6_hash_secret, sizeof(ipv6_hash_secret));
6642 + }
6643 + EXPORT_SYMBOL(build_ehash_secret);
6644 +
6645 +@@ -1590,7 +1595,7 @@ static const struct net_offload udp_offload = {
6646 +
6647 + static const struct net_protocol icmp_protocol = {
6648 + .handler = icmp_rcv,
6649 +- .err_handler = ping_err,
6650 ++ .err_handler = icmp_err,
6651 + .no_policy = 1,
6652 + .netns_ok = 1,
6653 + };
6654 +diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
6655 +index 17ff9fd..3ac5dff 100644
6656 +--- a/net/ipv4/icmp.c
6657 ++++ b/net/ipv4/icmp.c
6658 +@@ -934,6 +934,29 @@ error:
6659 + goto drop;
6660 + }
6661 +
6662 ++void icmp_err(struct sk_buff *skb, u32 info)
6663 ++{
6664 ++ struct iphdr *iph = (struct iphdr *)skb->data;
6665 ++ struct icmphdr *icmph = (struct icmphdr *)(skb->data+(iph->ihl<<2));
6666 ++ int type = icmp_hdr(skb)->type;
6667 ++ int code = icmp_hdr(skb)->code;
6668 ++ struct net *net = dev_net(skb->dev);
6669 ++
6670 ++ /*
6671 ++ * Use ping_err to handle all icmp errors except those
6672 ++ * triggered by ICMP_ECHOREPLY which sent from kernel.
6673 ++ */
6674 ++ if (icmph->type != ICMP_ECHOREPLY) {
6675 ++ ping_err(skb, info);
6676 ++ return;
6677 ++ }
6678 ++
6679 ++ if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED)
6680 ++ ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_ICMP, 0);
6681 ++ else if (type == ICMP_REDIRECT)
6682 ++ ipv4_redirect(skb, net, 0, 0, IPPROTO_ICMP, 0);
6683 ++}
6684 ++
6685 + /*
6686 + * This table is the definition of how we handle ICMP.
6687 + */
6688 +diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
6689 +index 6f9c072..dc454cc 100644
6690 +--- a/net/ipv4/ping.c
6691 ++++ b/net/ipv4/ping.c
6692 +@@ -322,8 +322,8 @@ void ping_err(struct sk_buff *skb, u32 info)
6693 + struct iphdr *iph = (struct iphdr *)skb->data;
6694 + struct icmphdr *icmph = (struct icmphdr *)(skb->data+(iph->ihl<<2));
6695 + struct inet_sock *inet_sock;
6696 +- int type = icmph->type;
6697 +- int code = icmph->code;
6698 ++ int type = icmp_hdr(skb)->type;
6699 ++ int code = icmp_hdr(skb)->code;
6700 + struct net *net = dev_net(skb->dev);
6701 + struct sock *sk;
6702 + int harderr;
6703 +diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
6704 +index 5d45159..ff031a5 100644
6705 +--- a/net/ipv4/tcp_output.c
6706 ++++ b/net/ipv4/tcp_output.c
6707 +@@ -1351,8 +1351,8 @@ int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len)
6708 + return 0;
6709 + }
6710 +
6711 +-/* Calculate MSS. Not accounting for SACKs here. */
6712 +-int tcp_mtu_to_mss(struct sock *sk, int pmtu)
6713 ++/* Calculate MSS not accounting any TCP options. */
6714 ++static inline int __tcp_mtu_to_mss(struct sock *sk, int pmtu)
6715 + {
6716 + const struct tcp_sock *tp = tcp_sk(sk);
6717 + const struct inet_connection_sock *icsk = inet_csk(sk);
6718 +@@ -1381,13 +1381,17 @@ int tcp_mtu_to_mss(struct sock *sk, int pmtu)
6719 + /* Then reserve room for full set of TCP options and 8 bytes of data */
6720 + if (mss_now < 48)
6721 + mss_now = 48;
6722 +-
6723 +- /* Now subtract TCP options size, not including SACKs */
6724 +- mss_now -= tp->tcp_header_len - sizeof(struct tcphdr);
6725 +-
6726 + return mss_now;
6727 + }
6728 +
6729 ++/* Calculate MSS. Not accounting for SACKs here. */
6730 ++int tcp_mtu_to_mss(struct sock *sk, int pmtu)
6731 ++{
6732 ++ /* Subtract TCP options size, not including SACKs */
6733 ++ return __tcp_mtu_to_mss(sk, pmtu) -
6734 ++ (tcp_sk(sk)->tcp_header_len - sizeof(struct tcphdr));
6735 ++}
6736 ++
6737 + /* Inverse of above */
6738 + int tcp_mss_to_mtu(struct sock *sk, int mss)
6739 + {
6740 +@@ -2930,7 +2934,7 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn)
6741 + */
6742 + if (tp->rx_opt.user_mss && tp->rx_opt.user_mss < tp->rx_opt.mss_clamp)
6743 + tp->rx_opt.mss_clamp = tp->rx_opt.user_mss;
6744 +- space = tcp_mtu_to_mss(sk, inet_csk(sk)->icsk_pmtu_cookie) -
6745 ++ space = __tcp_mtu_to_mss(sk, inet_csk(sk)->icsk_pmtu_cookie) -
6746 + MAX_TCP_OPTION_SPACE;
6747 +
6748 + syn_data = skb_copy_expand(syn, skb_headroom(syn), space,
6749 +diff --git a/net/ipv6/route.c b/net/ipv6/route.c
6750 +index 363d8b7..6f9f7b6 100644
6751 +--- a/net/ipv6/route.c
6752 ++++ b/net/ipv6/route.c
6753 +@@ -300,6 +300,7 @@ static void ip6_dst_destroy(struct dst_entry *dst)
6754 + {
6755 + struct rt6_info *rt = (struct rt6_info *)dst;
6756 + struct inet6_dev *idev = rt->rt6i_idev;
6757 ++ struct dst_entry *from = dst->from;
6758 +
6759 + if (rt->n)
6760 + neigh_release(rt->n);
6761 +@@ -312,8 +313,8 @@ static void ip6_dst_destroy(struct dst_entry *dst)
6762 + in6_dev_put(idev);
6763 + }
6764 +
6765 +- if (!(rt->rt6i_flags & RTF_EXPIRES) && dst->from)
6766 +- dst_release(dst->from);
6767 ++ dst->from = NULL;
6768 ++ dst_release(from);
6769 +
6770 + if (rt6_has_peer(rt)) {
6771 + struct inet_peer *peer = rt6_peer_ptr(rt);
6772 +@@ -1054,7 +1055,6 @@ struct dst_entry *ip6_blackhole_route(struct net *net, struct dst_entry *dst_ori
6773 +
6774 + rt->rt6i_gateway = ort->rt6i_gateway;
6775 + rt->rt6i_flags = ort->rt6i_flags;
6776 +- rt6_clean_expires(rt);
6777 + rt->rt6i_metric = 0;
6778 +
6779 + memcpy(&rt->rt6i_dst, &ort->rt6i_dst, sizeof(struct rt6key));
6780 +@@ -1859,8 +1859,6 @@ static struct rt6_info *ip6_rt_copy(struct rt6_info *ort,
6781 + if ((ort->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) ==
6782 + (RTF_DEFAULT | RTF_ADDRCONF))
6783 + rt6_set_from(rt, ort);
6784 +- else
6785 +- rt6_clean_expires(rt);
6786 + rt->rt6i_metric = 0;
6787 +
6788 + #ifdef CONFIG_IPV6_SUBTREES
6789 +diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
6790 +index c984413..8f32718 100644
6791 +--- a/net/ipv6/xfrm6_policy.c
6792 ++++ b/net/ipv6/xfrm6_policy.c
6793 +@@ -236,6 +236,8 @@ static void xfrm6_dst_destroy(struct dst_entry *dst)
6794 + {
6795 + struct xfrm_dst *xdst = (struct xfrm_dst *)dst;
6796 +
6797 ++ if (likely(xdst->u.rt6.n))
6798 ++ neigh_release(xdst->u.rt6.n);
6799 + if (likely(xdst->u.rt6.rt6i_idev))
6800 + in6_dev_put(xdst->u.rt6.rt6i_idev);
6801 + dst_destroy_metrics_generic(dst);
6802 +diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
6803 +index 5107248..f75ba1a 100644
6804 +--- a/net/mac80211/mlme.c
6805 ++++ b/net/mac80211/mlme.c
6806 +@@ -1812,6 +1812,8 @@ static void __ieee80211_disconnect(struct ieee80211_sub_if_data *sdata,
6807 + WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY,
6808 + transmit_frame, frame_buf);
6809 + ifmgd->flags &= ~IEEE80211_STA_CSA_RECEIVED;
6810 ++ ieee80211_wake_queues_by_reason(&sdata->local->hw,
6811 ++ IEEE80211_QUEUE_STOP_REASON_CSA);
6812 + mutex_unlock(&ifmgd->mtx);
6813 +
6814 + /*
6815 +@@ -1856,8 +1858,6 @@ static void ieee80211_csa_connection_drop_work(struct work_struct *work)
6816 + container_of(work, struct ieee80211_sub_if_data,
6817 + u.mgd.csa_connection_drop_work);
6818 +
6819 +- ieee80211_wake_queues_by_reason(&sdata->local->hw,
6820 +- IEEE80211_QUEUE_STOP_REASON_CSA);
6821 + __ieee80211_disconnect(sdata, true);
6822 + }
6823 +
6824 +diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
6825 +index 20e4bf5..58dfe08 100644
6826 +--- a/security/keys/process_keys.c
6827 ++++ b/security/keys/process_keys.c
6828 +@@ -367,6 +367,8 @@ key_ref_t search_my_process_keyrings(struct key_type *type,
6829 +
6830 + switch (PTR_ERR(key_ref)) {
6831 + case -EAGAIN: /* no key */
6832 ++ if (ret)
6833 ++ break;
6834 + case -ENOKEY: /* negative key */
6835 + ret = key_ref;
6836 + break;
6837 +diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c
6838 +index 3d82232..64d5347 100644
6839 +--- a/sound/drivers/aloop.c
6840 ++++ b/sound/drivers/aloop.c
6841 +@@ -286,12 +286,14 @@ static int loopback_trigger(struct snd_pcm_substream *substream, int cmd)
6842 + loopback_active_notify(dpcm);
6843 + break;
6844 + case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
6845 ++ case SNDRV_PCM_TRIGGER_SUSPEND:
6846 + spin_lock(&cable->lock);
6847 + cable->pause |= stream;
6848 + loopback_timer_stop(dpcm);
6849 + spin_unlock(&cable->lock);
6850 + break;
6851 + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
6852 ++ case SNDRV_PCM_TRIGGER_RESUME:
6853 + spin_lock(&cable->lock);
6854 + dpcm->last_jiffies = jiffies;
6855 + cable->pause &= ~stream;
6856 +@@ -563,7 +565,8 @@ static snd_pcm_uframes_t loopback_pointer(struct snd_pcm_substream *substream)
6857 + static struct snd_pcm_hardware loopback_pcm_hardware =
6858 + {
6859 + .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP |
6860 +- SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_PAUSE),
6861 ++ SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_PAUSE |
6862 ++ SNDRV_PCM_INFO_RESUME),
6863 + .formats = (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE |
6864 + SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S32_BE |
6865 + SNDRV_PCM_FMTBIT_FLOAT_LE | SNDRV_PCM_FMTBIT_FLOAT_BE),
6866 +diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
6867 +index 136a393..e760af9 100644
6868 +--- a/sound/pci/ali5451/ali5451.c
6869 ++++ b/sound/pci/ali5451/ali5451.c
6870 +@@ -1435,7 +1435,7 @@ static snd_pcm_uframes_t snd_ali_pointer(struct snd_pcm_substream *substream)
6871 +
6872 + spin_lock(&codec->reg_lock);
6873 + if (!pvoice->running) {
6874 +- spin_unlock_irq(&codec->reg_lock);
6875 ++ spin_unlock(&codec->reg_lock);
6876 + return 0;
6877 + }
6878 + outb(pvoice->number, ALI_REG(codec, ALI_GC_CIR));
6879 +diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
6880 +index 822df97..713e9af 100644
6881 +--- a/sound/pci/hda/hda_codec.c
6882 ++++ b/sound/pci/hda/hda_codec.c
6883 +@@ -2160,11 +2160,12 @@ struct snd_kcontrol *snd_hda_find_mixer_ctl(struct hda_codec *codec,
6884 + EXPORT_SYMBOL_HDA(snd_hda_find_mixer_ctl);
6885 +
6886 + static int find_empty_mixer_ctl_idx(struct hda_codec *codec, const char *name,
6887 +- int dev)
6888 ++ int start_idx)
6889 + {
6890 +- int idx;
6891 +- for (idx = 0; idx < 16; idx++) { /* 16 ctlrs should be large enough */
6892 +- if (!find_mixer_ctl(codec, name, dev, idx))
6893 ++ int i, idx;
6894 ++ /* 16 ctlrs should be large enough */
6895 ++ for (i = 0, idx = start_idx; i < 16; i++, idx++) {
6896 ++ if (!find_mixer_ctl(codec, name, 0, idx))
6897 + return idx;
6898 + }
6899 + return -EBUSY;
6900 +@@ -3132,30 +3133,29 @@ int snd_hda_create_dig_out_ctls(struct hda_codec *codec,
6901 + int err;
6902 + struct snd_kcontrol *kctl;
6903 + struct snd_kcontrol_new *dig_mix;
6904 +- int idx, dev = 0;
6905 +- const int spdif_pcm_dev = 1;
6906 ++ int idx = 0;
6907 ++ const int spdif_index = 16;
6908 + struct hda_spdif_out *spdif;
6909 ++ struct hda_bus *bus = codec->bus;
6910 +
6911 +- if (codec->primary_dig_out_type == HDA_PCM_TYPE_HDMI &&
6912 ++ if (bus->primary_dig_out_type == HDA_PCM_TYPE_HDMI &&
6913 + type == HDA_PCM_TYPE_SPDIF) {
6914 +- dev = spdif_pcm_dev;
6915 +- } else if (codec->primary_dig_out_type == HDA_PCM_TYPE_SPDIF &&
6916 ++ idx = spdif_index;
6917 ++ } else if (bus->primary_dig_out_type == HDA_PCM_TYPE_SPDIF &&
6918 + type == HDA_PCM_TYPE_HDMI) {
6919 +- for (idx = 0; idx < codec->spdif_out.used; idx++) {
6920 +- spdif = snd_array_elem(&codec->spdif_out, idx);
6921 +- for (dig_mix = dig_mixes; dig_mix->name; dig_mix++) {
6922 +- kctl = find_mixer_ctl(codec, dig_mix->name, 0, idx);
6923 +- if (!kctl)
6924 +- break;
6925 +- kctl->id.device = spdif_pcm_dev;
6926 +- }
6927 ++ /* suppose a single SPDIF device */
6928 ++ for (dig_mix = dig_mixes; dig_mix->name; dig_mix++) {
6929 ++ kctl = find_mixer_ctl(codec, dig_mix->name, 0, 0);
6930 ++ if (!kctl)
6931 ++ break;
6932 ++ kctl->id.index = spdif_index;
6933 + }
6934 +- codec->primary_dig_out_type = HDA_PCM_TYPE_HDMI;
6935 ++ bus->primary_dig_out_type = HDA_PCM_TYPE_HDMI;
6936 + }
6937 +- if (!codec->primary_dig_out_type)
6938 +- codec->primary_dig_out_type = type;
6939 ++ if (!bus->primary_dig_out_type)
6940 ++ bus->primary_dig_out_type = type;
6941 +
6942 +- idx = find_empty_mixer_ctl_idx(codec, "IEC958 Playback Switch", dev);
6943 ++ idx = find_empty_mixer_ctl_idx(codec, "IEC958 Playback Switch", idx);
6944 + if (idx < 0) {
6945 + printk(KERN_ERR "hda_codec: too many IEC958 outputs\n");
6946 + return -EBUSY;
6947 +@@ -3165,7 +3165,6 @@ int snd_hda_create_dig_out_ctls(struct hda_codec *codec,
6948 + kctl = snd_ctl_new1(dig_mix, codec);
6949 + if (!kctl)
6950 + return -ENOMEM;
6951 +- kctl->id.device = dev;
6952 + kctl->id.index = idx;
6953 + kctl->private_value = codec->spdif_out.used - 1;
6954 + err = snd_hda_ctl_add(codec, associated_nid, kctl);
6955 +diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
6956 +index 8665540..a35cf09 100644
6957 +--- a/sound/pci/hda/hda_codec.h
6958 ++++ b/sound/pci/hda/hda_codec.h
6959 +@@ -671,6 +671,8 @@ struct hda_bus {
6960 + unsigned int response_reset:1; /* controller was reset */
6961 + unsigned int in_reset:1; /* during reset operation */
6962 + unsigned int power_keep_link_on:1; /* don't power off HDA link */
6963 ++
6964 ++ int primary_dig_out_type; /* primary digital out PCM type */
6965 + };
6966 +
6967 + /*
6968 +@@ -837,7 +839,6 @@ struct hda_codec {
6969 + struct mutex hash_mutex;
6970 + struct snd_array spdif_out;
6971 + unsigned int spdif_in_enable; /* SPDIF input enable? */
6972 +- int primary_dig_out_type; /* primary digital out PCM type */
6973 + const hda_nid_t *slave_dig_outs; /* optional digital out slave widgets */
6974 + struct snd_array init_pins; /* initial (BIOS) pin configurations */
6975 + struct snd_array driver_pins; /* pin configs set by codec parser */
6976 +diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
6977 +index c78286f..63607da 100644
6978 +--- a/sound/pci/hda/hda_intel.c
6979 ++++ b/sound/pci/hda/hda_intel.c
6980 +@@ -3624,7 +3624,7 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = {
6981 + .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH },
6982 + /* 5 Series/3400 */
6983 + { PCI_DEVICE(0x8086, 0x3b56),
6984 +- .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH },
6985 ++ .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM },
6986 + /* Poulsbo */
6987 + { PCI_DEVICE(0x8086, 0x811b),
6988 + .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM },
6989 +diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
6990 +index 807a2aa..b14813d 100644
6991 +--- a/sound/pci/hda/patch_hdmi.c
6992 ++++ b/sound/pci/hda/patch_hdmi.c
6993 +@@ -714,9 +714,10 @@ static void hdmi_setup_fake_chmap(unsigned char *map, int ca)
6994 +
6995 + static void hdmi_setup_channel_mapping(struct hda_codec *codec,
6996 + hda_nid_t pin_nid, bool non_pcm, int ca,
6997 +- int channels, unsigned char *map)
6998 ++ int channels, unsigned char *map,
6999 ++ bool chmap_set)
7000 + {
7001 +- if (!non_pcm && map) {
7002 ++ if (!non_pcm && chmap_set) {
7003 + hdmi_manual_setup_channel_mapping(codec, pin_nid,
7004 + channels, map);
7005 + } else {
7006 +@@ -905,7 +906,8 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, int pin_idx,
7007 + pin_nid,
7008 + channels);
7009 + hdmi_setup_channel_mapping(codec, pin_nid, non_pcm, ca,
7010 +- channels, per_pin->chmap);
7011 ++ channels, per_pin->chmap,
7012 ++ per_pin->chmap_set);
7013 + hdmi_stop_infoframe_trans(codec, pin_nid);
7014 + hdmi_fill_audio_infoframe(codec, pin_nid,
7015 + ai.bytes, sizeof(ai));
7016 +@@ -915,7 +917,8 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, int pin_idx,
7017 + * accordingly */
7018 + if (per_pin->non_pcm != non_pcm)
7019 + hdmi_setup_channel_mapping(codec, pin_nid, non_pcm, ca,
7020 +- channels, per_pin->chmap);
7021 ++ channels, per_pin->chmap,
7022 ++ per_pin->chmap_set);
7023 + }
7024 +
7025 + per_pin->non_pcm = non_pcm;
7026 +@@ -1100,8 +1103,12 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
7027 + if (!static_hdmi_pcm && eld->eld_valid) {
7028 + snd_hdmi_eld_update_pcm_info(eld, hinfo);
7029 + if (hinfo->channels_min > hinfo->channels_max ||
7030 +- !hinfo->rates || !hinfo->formats)
7031 ++ !hinfo->rates || !hinfo->formats) {
7032 ++ per_cvt->assigned = 0;
7033 ++ hinfo->nid = 0;
7034 ++ snd_hda_spdif_ctls_unassign(codec, pin_idx);
7035 + return -ENODEV;
7036 ++ }
7037 + }
7038 +
7039 + /* Store the updated parameters */
7040 +@@ -1165,6 +1172,7 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
7041 + "HDMI status: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n",
7042 + codec->addr, pin_nid, eld->monitor_present, eld_valid);
7043 +
7044 ++ eld->eld_valid = false;
7045 + if (eld_valid) {
7046 + if (!snd_hdmi_get_eld(eld, codec, pin_nid))
7047 + snd_hdmi_show_eld(eld);
7048 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
7049 +index 5faaad2..47fb18d 100644
7050 +--- a/sound/pci/hda/patch_realtek.c
7051 ++++ b/sound/pci/hda/patch_realtek.c
7052 +@@ -5394,6 +5394,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
7053 + SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
7054 + SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
7055 + SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
7056 ++ SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
7057 +
7058 + /* All Apple entries are in codec SSIDs */
7059 + SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
7060 +diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c
7061 +index 2450663..0ecd410 100644
7062 +--- a/sound/pci/rme32.c
7063 ++++ b/sound/pci/rme32.c
7064 +@@ -1017,7 +1017,7 @@ static int snd_rme32_capture_close(struct snd_pcm_substream *substream)
7065 + spin_lock_irq(&rme32->lock);
7066 + rme32->capture_substream = NULL;
7067 + rme32->capture_periodsize = 0;
7068 +- spin_unlock(&rme32->lock);
7069 ++ spin_unlock_irq(&rme32->lock);
7070 + return 0;
7071 + }
7072 +
7073 +diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
7074 +index ef62c43..2899cb9 100644
7075 +--- a/sound/soc/codecs/arizona.c
7076 ++++ b/sound/soc/codecs/arizona.c
7077 +@@ -910,7 +910,7 @@ static int arizona_calc_fll(struct arizona_fll *fll,
7078 +
7079 + cfg->n = target / (ratio * Fref);
7080 +
7081 +- if (target % Fref) {
7082 ++ if (target % (ratio * Fref)) {
7083 + gcd_fll = gcd(target, ratio * Fref);
7084 + arizona_fll_dbg(fll, "GCD=%u\n", gcd_fll);
7085 +
7086 +@@ -922,6 +922,15 @@ static int arizona_calc_fll(struct arizona_fll *fll,
7087 + cfg->lambda = 0;
7088 + }
7089 +
7090 ++ /* Round down to 16bit range with cost of accuracy lost.
7091 ++ * Denominator must be bigger than numerator so we only
7092 ++ * take care of it.
7093 ++ */
7094 ++ while (cfg->lambda >= (1 << 16)) {
7095 ++ cfg->theta >>= 1;
7096 ++ cfg->lambda >>= 1;
7097 ++ }
7098 ++
7099 + arizona_fll_dbg(fll, "N=%x THETA=%x LAMBDA=%x\n",
7100 + cfg->n, cfg->theta, cfg->lambda);
7101 + arizona_fll_dbg(fll, "FRATIO=%x(%d) OUTDIV=%x REFCLK_DIV=%x\n",
7102 +diff --git a/sound/soc/codecs/wm2200.c b/sound/soc/codecs/wm2200.c
7103 +index d8c65f5..d5371e0 100644
7104 +--- a/sound/soc/codecs/wm2200.c
7105 ++++ b/sound/soc/codecs/wm2200.c
7106 +@@ -1126,9 +1126,9 @@ SOC_DOUBLE_R_TLV("IN3 Volume", WM2200_IN3L_CONTROL, WM2200_IN3R_CONTROL,
7107 +
7108 + SOC_DOUBLE_R("IN1 Digital Switch", WM2200_ADC_DIGITAL_VOLUME_1L,
7109 + WM2200_ADC_DIGITAL_VOLUME_1R, WM2200_IN1L_MUTE_SHIFT, 1, 1),
7110 +-SOC_DOUBLE_R("IN2 Digital Switch", WM2200_ADC_DIGITAL_VOLUME_1L,
7111 ++SOC_DOUBLE_R("IN2 Digital Switch", WM2200_ADC_DIGITAL_VOLUME_2L,
7112 + WM2200_ADC_DIGITAL_VOLUME_2R, WM2200_IN2L_MUTE_SHIFT, 1, 1),
7113 +-SOC_DOUBLE_R("IN3 Digital Switch", WM2200_ADC_DIGITAL_VOLUME_1L,
7114 ++SOC_DOUBLE_R("IN3 Digital Switch", WM2200_ADC_DIGITAL_VOLUME_3L,
7115 + WM2200_ADC_DIGITAL_VOLUME_3R, WM2200_IN3L_MUTE_SHIFT, 1, 1),
7116 +
7117 + SOC_DOUBLE_R_TLV("IN1 Digital Volume", WM2200_ADC_DIGITAL_VOLUME_1L,
7118 +diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
7119 +index 64d25a7..820580a 100644
7120 +--- a/sound/usb/quirks-table.h
7121 ++++ b/sound/usb/quirks-table.h
7122 +@@ -1750,7 +1750,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
7123 + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
7124 + /* .vendor_name = "Roland", */
7125 + /* .product_name = "A-PRO", */
7126 +- .ifnum = 1,
7127 ++ .ifnum = 0,
7128 + .type = QUIRK_MIDI_FIXED_ENDPOINT,
7129 + .data = & (const struct snd_usb_midi_endpoint_info) {
7130 + .out_cables = 0x0003,
7131 +diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
7132 +index 2c97185..0115289 100644
7133 +--- a/sound/usb/quirks.c
7134 ++++ b/sound/usb/quirks.c
7135 +@@ -533,7 +533,7 @@ static int snd_usb_mbox2_boot_quirk(struct usb_device *dev)
7136 + {
7137 + struct usb_host_config *config = dev->actconfig;
7138 + int err;
7139 +- u8 bootresponse[12];
7140 ++ u8 bootresponse[0x12];
7141 + int fwsize;
7142 + int count;
7143 +
7144 +diff --git a/tools/perf/Makefile b/tools/perf/Makefile
7145 +index 8ab05e5..fb1b1c4 100644
7146 +--- a/tools/perf/Makefile
7147 ++++ b/tools/perf/Makefile
7148 +@@ -276,13 +276,13 @@ $(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-event
7149 + $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c
7150 +
7151 + $(OUTPUT)util/parse-events-bison.c: util/parse-events.y
7152 +- $(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c
7153 ++ $(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c -p parse_events_
7154 +
7155 + $(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c
7156 + $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c
7157 +
7158 + $(OUTPUT)util/pmu-bison.c: util/pmu.y
7159 +- $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c
7160 ++ $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c -p perf_pmu_
7161 +
7162 + $(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c
7163 + $(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c
7164 +diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
7165 +index aa84130..6416580 100644
7166 +--- a/tools/perf/ui/hist.c
7167 ++++ b/tools/perf/ui/hist.c
7168 +@@ -463,11 +463,15 @@ int hist_entry__period_snprintf(struct perf_hpp *hpp, struct hist_entry *he,
7169 + if (!perf_hpp__format[i].cond)
7170 + continue;
7171 +
7172 ++ /*
7173 ++ * If there's no field_sep, we still need
7174 ++ * to display initial ' '.
7175 ++ */
7176 + if (!sep || !first) {
7177 + ret = scnprintf(hpp->buf, hpp->size, "%s", sep ?: " ");
7178 + advance_hpp(hpp, ret);
7179 ++ } else
7180 + first = false;
7181 +- }
7182 +
7183 + if (color && perf_hpp__format[i].color)
7184 + ret = perf_hpp__format[i].color(hpp, he);
7185 +diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
7186 +index 0f9914a..7bf890e 100644
7187 +--- a/tools/perf/util/parse-events.y
7188 ++++ b/tools/perf/util/parse-events.y
7189 +@@ -1,5 +1,4 @@
7190 + %pure-parser
7191 +-%name-prefix "parse_events_"
7192 + %parse-param {void *_data}
7193 + %parse-param {void *scanner}
7194 + %lex-param {void* scanner}
7195 +diff --git a/tools/perf/util/pmu.y b/tools/perf/util/pmu.y
7196 +index ec89804..bfd7e85 100644
7197 +--- a/tools/perf/util/pmu.y
7198 ++++ b/tools/perf/util/pmu.y
7199 +@@ -1,5 +1,4 @@
7200 +
7201 +-%name-prefix "perf_pmu_"
7202 + %parse-param {struct list_head *format}
7203 + %parse-param {char *name}
7204 +
7205
7206 Modified: genpatches-2.6/trunk/3.8/4200_fbcondecor-0.9.6.patch
7207 ===================================================================
7208 --- genpatches-2.6/trunk/3.8/4200_fbcondecor-0.9.6.patch 2013-02-28 20:58:06 UTC (rev 2299)
7209 +++ genpatches-2.6/trunk/3.8/4200_fbcondecor-0.9.6.patch 2013-02-28 23:23:58 UTC (rev 2300)
7210 @@ -228,8 +228,7 @@
7211 index 95952c8..b55db6d 100644
7212 --- a/drivers/Makefile
7213 +++ b/drivers/Makefile
7214 -@@ -11,6 +11,10 @@ obj-y += gpio/
7215 - obj-$(CONFIG_PCI) += pci/
7216 +@@ -16,4 +16,8 @@ obj-$(CONFIG_PCI) += pci/
7217 obj-$(CONFIG_PARISC) += parisc/
7218 obj-$(CONFIG_RAPIDIO) += rapidio/
7219 +# tty/ comes before char/ so that the VT console is the boot-time
7220 @@ -238,8 +237,7 @@
7221 +obj-y += char/
7222 obj-y += video/
7223 obj-y += idle/
7224 - obj-$(CONFIG_ACPI) += acpi/
7225 -@@ -29,11 +33,6 @@ obj-$(CONFIG_XEN) += xen/
7226 +@@ -37,11 +41,6 @@ obj-$(CONFIG_XEN) += xen/
7227 # regulators early, since some subsystems rely on them to initialize
7228 obj-$(CONFIG_REGULATOR) += regulator/
7229
7230 @@ -255,7 +253,7 @@
7231 index a290be5..3a4ca32 100644
7232 --- a/drivers/video/Kconfig
7233 +++ b/drivers/video/Kconfig
7234 -@@ -1241,7 +1241,6 @@ config FB_MATROX
7235 +@@ -1229,7 +1229,6 @@ config FB_MATROX
7236 select FB_CFB_FILLRECT
7237 select FB_CFB_COPYAREA
7238 select FB_CFB_IMAGEBLIT
7239 @@ -870,7 +868,7 @@
7240 u16 c, int is_fg)
7241 {
7242 int depth = fb_get_color_depth(&info->var, &info->fix);
7243 -@@ -458,7 +459,7 @@ static int __init fb_console_setup(char *this_opt)
7244 +@@ -465,7 +466,7 @@ static int __init fb_console_setup(char *this_opt)
7245 } else
7246 return 1;
7247 }
7248 @@ -879,7 +877,7 @@
7249 if (!strncmp(options, "map:", 4)) {
7250 options += 4;
7251 if (*options) {
7252 -@@ -483,8 +484,8 @@ static int __init fb_console_setup(char *this_opt)
7253 +@@ -490,8 +491,8 @@ static int __init fb_console_setup(char *this_opt)
7254 first_fb_vc = 0;
7255 if (*options++ == '-')
7256 last_fb_vc = simple_strtoul(options, &options, 10) - 1;
7257 @@ -890,7 +888,7 @@
7258
7259 if (!strncmp(options, "rotate:", 7)) {
7260 options += 7;
7261 -@@ -545,6 +546,9 @@ static int fbcon_takeover(int show_logo)
7262 +@@ -552,6 +553,9 @@ static int fbcon_takeover(int show_logo)
7263 info_idx = -1;
7264 } else {
7265 fbcon_has_console_bind = 1;
7266 @@ -900,7 +898,7 @@
7267 }
7268
7269 return err;
7270 -@@ -935,7 +939,7 @@ static const char *fbcon_startup(void)
7271 +@@ -942,7 +946,7 @@ static const char *fbcon_startup(void)
7272 info = registered_fb[info_idx];
7273 if (!info)
7274 return NULL;
7275 @@ -909,7 +907,7 @@
7276 owner = info->fbops->owner;
7277 if (!try_module_get(owner))
7278 return NULL;
7279 -@@ -999,6 +1003,12 @@ static const char *fbcon_startup(void)
7280 +@@ -1006,6 +1010,12 @@ static const char *fbcon_startup(void)
7281 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
7282 cols /= vc->vc_font.width;
7283 rows /= vc->vc_font.height;
7284 @@ -922,7 +920,7 @@
7285 vc_resize(vc, cols, rows);
7286
7287 DPRINTK("mode: %s\n", info->fix.id);
7288 -@@ -1028,7 +1038,7 @@ static void fbcon_init(struct vc_data *vc, int init)
7289 +@@ -1035,7 +1045,7 @@ static void fbcon_init(struct vc_data *vc, int init)
7290 cap = info->flags;
7291
7292 if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW ||
7293 @@ -931,7 +929,7 @@
7294 logo = 0;
7295
7296 if (var_to_display(p, &info->var, info))
7297 -@@ -1238,6 +1248,11 @@ static void fbcon_clear(struct vc_data *vc, int sy, int sx, int height,
7298 +@@ -1245,6 +1255,11 @@ static void fbcon_clear(struct vc_data *vc, int sy, int sx, int height,
7299 if (sy < vc->vc_top && vc->vc_top == logo_lines)
7300 vc->vc_top = 0;
7301
7302 @@ -943,7 +941,7 @@
7303 /* Split blits that cross physical y_wrap boundary */
7304
7305 y_break = p->vrows - p->yscroll;
7306 -@@ -1257,10 +1272,15 @@ static void fbcon_putcs(struct vc_data *vc, const unsigned short *s,
7307 +@@ -1264,10 +1279,15 @@ static void fbcon_putcs(struct vc_data *vc, const unsigned short *s,
7308 struct display *p = &fb_display[vc->vc_num];
7309 struct fbcon_ops *ops = info->fbcon_par;
7310
7311 @@ -963,7 +961,7 @@
7312 }
7313
7314 static void fbcon_putc(struct vc_data *vc, int c, int ypos, int xpos)
7315 -@@ -1276,8 +1296,13 @@ static void fbcon_clear_margins(struct vc_data *vc, int bottom_only)
7316 +@@ -1283,8 +1303,13 @@ static void fbcon_clear_margins(struct vc_data *vc, int bottom_only)
7317 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
7318 struct fbcon_ops *ops = info->fbcon_par;
7319
7320 @@ -979,7 +977,7 @@
7321 }
7322
7323 static void fbcon_cursor(struct vc_data *vc, int mode)
7324 -@@ -1387,7 +1412,7 @@ static __inline__ void ywrap_up(struct vc_data *vc, int count)
7325 +@@ -1394,7 +1419,7 @@ static __inline__ void ywrap_up(struct vc_data *vc, int count)
7326 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
7327 struct fbcon_ops *ops = info->fbcon_par;
7328 struct display *p = &fb_display[vc->vc_num];
7329 @@ -988,7 +986,7 @@
7330 p->yscroll += count;
7331 if (p->yscroll >= p->vrows) /* Deal with wrap */
7332 p->yscroll -= p->vrows;
7333 -@@ -1406,7 +1431,7 @@ static __inline__ void ywrap_down(struct vc_data *vc, int count)
7334 +@@ -1413,7 +1438,7 @@ static __inline__ void ywrap_down(struct vc_data *vc, int count)
7335 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
7336 struct fbcon_ops *ops = info->fbcon_par;
7337 struct display *p = &fb_display[vc->vc_num];
7338 @@ -997,7 +995,7 @@
7339 p->yscroll -= count;
7340 if (p->yscroll < 0) /* Deal with wrap */
7341 p->yscroll += p->vrows;
7342 -@@ -1473,7 +1498,7 @@ static __inline__ void ypan_down(struct vc_data *vc, int count)
7343 +@@ -1480,7 +1505,7 @@ static __inline__ void ypan_down(struct vc_data *vc, int count)
7344 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
7345 struct display *p = &fb_display[vc->vc_num];
7346 struct fbcon_ops *ops = info->fbcon_par;
7347 @@ -1006,7 +1004,7 @@
7348 p->yscroll -= count;
7349 if (p->yscroll < 0) {
7350 ops->bmove(vc, info, 0, 0, p->vrows - vc->vc_rows,
7351 -@@ -1797,7 +1822,7 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
7352 +@@ -1804,7 +1829,7 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
7353 count = vc->vc_rows;
7354 if (softback_top)
7355 fbcon_softback_note(vc, t, count);
7356 @@ -1015,7 +1013,7 @@
7357 goto redraw_up;
7358 switch (p->scrollmode) {
7359 case SCROLL_MOVE:
7360 -@@ -1890,6 +1915,8 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
7361 +@@ -1897,6 +1922,8 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
7362 count = vc->vc_rows;
7363 if (logo_shown >= 0)
7364 goto redraw_down;
7365 @@ -1024,7 +1022,7 @@
7366 switch (p->scrollmode) {
7367 case SCROLL_MOVE:
7368 fbcon_redraw_blit(vc, info, p, b - 1, b - t - count,
7369 -@@ -1982,7 +2009,7 @@ static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
7370 +@@ -1989,7 +2016,7 @@ static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
7371 {
7372 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
7373 struct display *p = &fb_display[vc->vc_num];
7374 @@ -1033,7 +1031,7 @@
7375 if (fbcon_is_inactive(vc, info))
7376 return;
7377
7378 -@@ -2000,7 +2027,7 @@ static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
7379 +@@ -2007,7 +2034,7 @@ static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
7380 p->vrows - p->yscroll);
7381 }
7382
7383 @@ -1042,7 +1040,7 @@
7384 int dy, int dx, int height, int width, u_int y_break)
7385 {
7386 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
7387 -@@ -2038,6 +2065,13 @@ static void fbcon_bmove_rec(struct vc_data *vc, struct display *p, int sy, int s
7388 +@@ -2045,6 +2072,13 @@ static void fbcon_bmove_rec(struct vc_data *vc, struct display *p, int sy, int s
7389 }
7390 return;
7391 }
7392 @@ -1056,7 +1054,7 @@
7393 ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx,
7394 height, width);
7395 }
7396 -@@ -2089,7 +2123,7 @@ static void updatescrollmode(struct display *p,
7397 +@@ -2096,7 +2130,7 @@ static void updatescrollmode(struct display *p,
7398 }
7399 }
7400
7401 @@ -1065,7 +1063,7 @@
7402 unsigned int height, unsigned int user)
7403 {
7404 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
7405 -@@ -2108,8 +2142,8 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width,
7406 +@@ -2115,8 +2149,8 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width,
7407 var.yres = virt_h * virt_fh;
7408 x_diff = info->var.xres - var.xres;
7409 y_diff = info->var.yres - var.yres;
7410 @@ -1076,7 +1074,7 @@
7411 const struct fb_videomode *mode;
7412
7413 DPRINTK("attempting resize %ix%i\n", var.xres, var.yres);
7414 -@@ -2145,6 +2179,21 @@ static int fbcon_switch(struct vc_data *vc)
7415 +@@ -2152,6 +2186,21 @@ static int fbcon_switch(struct vc_data *vc)
7416
7417 info = registered_fb[con2fb_map[vc->vc_num]];
7418 ops = info->fbcon_par;
7419 @@ -1098,7 +1096,7 @@
7420
7421 if (softback_top) {
7422 if (softback_lines)
7423 -@@ -2163,9 +2212,6 @@ static int fbcon_switch(struct vc_data *vc)
7424 +@@ -2170,9 +2219,6 @@ static int fbcon_switch(struct vc_data *vc)
7425 logo_shown = FBCON_LOGO_CANSHOW;
7426 }
7427
7428 @@ -1108,7 +1106,7 @@
7429 /*
7430 * FIXME: If we have multiple fbdev's loaded, we need to
7431 * update all info->currcon. Perhaps, we can place this
7432 -@@ -2209,6 +2255,18 @@ static int fbcon_switch(struct vc_data *vc)
7433 +@@ -2216,6 +2262,18 @@ static int fbcon_switch(struct vc_data *vc)
7434 fbcon_del_cursor_timer(old_info);
7435 }
7436
7437 @@ -1127,7 +1125,7 @@
7438 if (fbcon_is_inactive(vc, info) ||
7439 ops->blank_state != FB_BLANK_UNBLANK)
7440 fbcon_del_cursor_timer(info);
7441 -@@ -2257,11 +2315,10 @@ static int fbcon_switch(struct vc_data *vc)
7442 +@@ -2264,11 +2322,10 @@ static int fbcon_switch(struct vc_data *vc)
7443 ops->update_start(info);
7444 }
7445
7446 @@ -1140,7 +1138,7 @@
7447 logo_shown = fg_console;
7448 /* This is protected above by initmem_freed */
7449 fb_show_logo(info, ops->rotate);
7450 -@@ -2317,15 +2374,20 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch)
7451 +@@ -2324,15 +2381,20 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch)
7452 }
7453 }
7454
7455 @@ -1165,7 +1163,7 @@
7456 }
7457
7458 if (!blank)
7459 -@@ -2447,7 +2509,7 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
7460 +@@ -2454,7 +2516,7 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
7461 vc->vc_complement_mask >>= 1;
7462 vc->vc_s_complement_mask >>= 1;
7463 }
7464 @@ -1174,7 +1172,7 @@
7465 /* ++Edmund: reorder the attribute bits */
7466 if (vc->vc_can_do_color) {
7467 unsigned short *cp =
7468 -@@ -2470,7 +2532,7 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
7469 +@@ -2477,7 +2539,7 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
7470 vc->vc_complement_mask <<= 1;
7471 vc->vc_s_complement_mask <<= 1;
7472 }
7473 @@ -1183,7 +1181,7 @@
7474 /* ++Edmund: reorder the attribute bits */
7475 {
7476 unsigned short *cp =
7477 -@@ -2500,13 +2562,22 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
7478 +@@ -2507,13 +2569,22 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
7479 }
7480
7481 if (resize) {
7482 @@ -1206,7 +1204,7 @@
7483 if (CON_IS_VISIBLE(vc) && softback_buf)
7484 fbcon_update_softback(vc);
7485 } else if (CON_IS_VISIBLE(vc)
7486 -@@ -2590,7 +2661,7 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font, unsigne
7487 +@@ -2597,7 +2661,7 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font, unsigne
7488 /* Check if the same font is on some other console already */
7489 for (i = first_fb_vc; i <= last_fb_vc; i++) {
7490 struct vc_data *tmp = vc_cons[i].d;
7491 @@ -1215,7 +1213,7 @@
7492 if (fb_display[i].userfont &&
7493 fb_display[i].fontdata &&
7494 FNTSUM(fb_display[i].fontdata) == csum &&
7495 -@@ -2635,7 +2706,11 @@ static int fbcon_set_palette(struct vc_data *vc, unsigned char *table)
7496 +@@ -2642,7 +2713,11 @@ static int fbcon_set_palette(struct vc_data *vc, unsigned char *table)
7497 int i, j, k, depth;
7498 u8 val;
7499
7500 @@ -1228,7 +1226,7 @@
7501 return -EINVAL;
7502
7503 if (!CON_IS_VISIBLE(vc))
7504 -@@ -2661,14 +2736,56 @@ static int fbcon_set_palette(struct vc_data *vc, unsigned char *table)
7505 +@@ -2668,14 +2743,56 @@ static int fbcon_set_palette(struct vc_data *vc, unsigned char *table)
7506 } else
7507 fb_copy_cmap(fb_default_cmap(1 << depth), &palette_cmap);
7508
7509 @@ -1287,7 +1285,7 @@
7510 if (vc->vc_num != fg_console || !softback_lines)
7511 return (u16 *) (vc->vc_origin + offset);
7512 line = offset / vc->vc_size_row;
7513 -@@ -2887,7 +3004,14 @@ static void fbcon_modechanged(struct fb_info *info)
7514 +@@ -2894,7 +3011,14 @@ static void fbcon_modechanged(struct fb_info *info)
7515 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
7516 cols /= vc->vc_font.width;
7517 rows /= vc->vc_font.height;
7518 @@ -1303,7 +1301,7 @@
7519 updatescrollmode(p, info, vc);
7520 scrollback_max = 0;
7521 scrollback_current = 0;
7522 -@@ -2932,7 +3056,9 @@ static void fbcon_set_all_vcs(struct fb_info *info)
7523 +@@ -2939,7 +3063,9 @@ static void fbcon_set_all_vcs(struct fb_info *info)
7524 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
7525 cols /= vc->vc_font.width;
7526 rows /= vc->vc_font.height;
7527 @@ -1314,7 +1312,7 @@
7528 }
7529
7530 if (fg != -1)
7531 -@@ -3542,6 +3668,7 @@ static void fbcon_exit(void)
7532 +@@ -3549,6 +3675,7 @@ static void fbcon_exit(void)
7533 }
7534 }
7535
7536 @@ -1322,7 +1320,7 @@
7537 fbcon_has_exited = 1;
7538 }
7539
7540 -@@ -3595,7 +3722,7 @@ static void __exit fb_console_exit(void)
7541 +@@ -3602,7 +3729,7 @@ static void __exit fb_console_exit(void)
7542 fbcon_exit();
7543 console_unlock();
7544 unregister_con_driver(&fb_con);
7545 @@ -2014,7 +2012,7 @@
7546 index c6ce416..7ce6640 100644
7547 --- a/drivers/video/fbmem.c
7548 +++ b/drivers/video/fbmem.c
7549 -@@ -1222,15 +1222,6 @@ struct fb_fix_screeninfo32 {
7550 +@@ -1231,15 +1231,6 @@ struct fb_fix_screeninfo32 {
7551 u16 reserved[3];
7552 };
7553
7554 @@ -2107,7 +2105,7 @@
7555 index d31cb68..ad161bb 100644
7556 --- a/include/uapi/linux/fb.h
7557 +++ b/include/uapi/linux/fb.h
7558 -@@ -11,6 +11,25 @@
7559 +@@ -8,6 +8,25 @@
7560
7561 #define FB_MAX 32 /* sufficient for now */
7562
7563 @@ -2133,7 +2131,7 @@
7564 /* ioctls
7565 0x46 is 'F' */
7566 #define FBIOGET_VSCREENINFO 0x4600
7567 -@@ -39,6 +58,24 @@
7568 +@@ -34,6 +53,24 @@
7569 #define FBIOPUT_MODEINFO 0x4617
7570 #define FBIOGET_DISPINFO 0x4618
7571 #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
7572 @@ -2158,7 +2156,7 @@
7573
7574 #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */
7575 #define FB_TYPE_PLANES 1 /* Non interleaved planes */
7576 -@@ -291,6 +328,28 @@ struct fb_cmap {
7577 +@@ -286,6 +323,28 @@ struct fb_cmap {
7578 __u16 *transp; /* transparency, can be NULL */
7579 };
7580
7581 @@ -2187,11 +2185,7 @@
7582 struct fb_con2fbmap {
7583 __u32 console;
7584 __u32 framebuffer;
7585 -diff --git a/include/linux/fb.h b/include/linux/fb.h
7586 -index d31cb68..ad161bb 100644
7587 ---- a/include/linux/fb.h
7588 -+++ b/include/linux/fb.h
7589 -@@ -372,6 +431,34 @@ struct fb_image {
7590 +@@ -367,6 +426,34 @@ struct fb_image {
7591 struct fb_cmap cmap; /* color map info */
7592 };
7593
7594 @@ -2226,8 +2220,12 @@
7595 /*
7596 * hardware cursor control
7597 */
7598 -@@ -881,6 +968,9 @@ struct fb_info {
7599 - #define FBINFO_STATE_SUSPENDED 1
7600 +
7601 +diff --git a/include/linux/fb.h b/include/linux/fb.h
7602 +index d31cb68..ad161bb 100644
7603 +--- a/include/linux/fb.h
7604 ++++ b/include/linux/fb.h
7605 +@@ -488,5 +488,8 @@ #define FBINFO_STATE_SUSPENDED 1
7606 u32 state; /* Hardware state i.e suspend */
7607 void *fbcon_par; /* fbcon use-only private area */
7608 +
7609 @@ -2236,11 +2234,12 @@
7610 /* From here on everything is device dependent */
7611 void *par;
7612 /* we need the PCI or similar aperture base/size not
7613 +
7614 diff --git a/kernel/sysctl.c b/kernel/sysctl.c
7615 index 4ab1187..6561627 100644
7616 --- a/kernel/sysctl.c
7617 +++ b/kernel/sysctl.c
7618 -@@ -142,6 +142,10 @@ static int min_percpu_pagelist_fract = 8;
7619 +@@ -145,6 +145,10 @@ static int min_percpu_pagelist_fract = 8;
7620 static int ngroups_max = NGROUPS_MAX;
7621 static const int cap_last_cap = CAP_LAST_CAP;
7622
7623 @@ -2251,7 +2250,7 @@
7624 #ifdef CONFIG_INOTIFY_USER
7625 #include <linux/inotify.h>
7626 #endif
7627 -@@ -238,6 +242,15 @@ static struct ctl_table sysctl_base_table[] = {
7628 +@@ -248,6 +252,15 @@ static struct ctl_table sysctl_base_table[] = {
7629 .mode = 0555,
7630 .child = dev_table,
7631 },
7632 @@ -2267,7 +2266,7 @@
7633 { }
7634 };
7635
7636 -@@ -1038,7 +1051,7 @@ static struct ctl_table vm_table[] = {
7637 +@@ -1091,7 +1104,7 @@ static struct ctl_table vm_table[] = {
7638 .proc_handler = proc_dointvec,
7639 },
7640 {
7641 @@ -2276,7 +2275,7 @@
7642 .data = &page_cluster,
7643 .maxlen = sizeof(int),
7644 .mode = 0644,
7645 -@@ -1484,7 +1497,7 @@ static struct ctl_table fs_table[] = {
7646 +@@ -1535,7 +1548,7 @@ static struct ctl_table fs_table[] = {
7647 .mode = 0555,
7648 .child = inotify_table,
7649 },
7650 @@ -2285,7 +2284,7 @@
7651 #ifdef CONFIG_EPOLL
7652 {
7653 .procname = "epoll",
7654 -@@ -1802,12 +1815,12 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
7655 +@@ -1873,12 +1886,12 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
7656 unsigned long page = 0;
7657 size_t left;
7658 char *kbuf;
7659 @@ -2300,7 +2299,7 @@
7660 i = (int *) tbl_data;
7661 vleft = table->maxlen / sizeof(*i);
7662 left = *lenp;
7663 -@@ -1896,7 +1909,7 @@ static int do_proc_dointvec(struct ctl_table *table, int write,
7664 +@@ -1967,7 +1980,7 @@ static int do_proc_dointvec(struct ctl_table *table, int write,
7665 * @ppos: file position
7666 *
7667 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
7668 @@ -2309,7 +2308,7 @@
7669 *
7670 * Returns 0 on success.
7671 */
7672 -@@ -2223,7 +2236,7 @@ static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
7673 +@@ -2326,7 +2339,7 @@ static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
7674 * @ppos: file position
7675 *
7676 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
7677 @@ -2318,7 +2317,7 @@
7678 * The values read are assumed to be in seconds, and are converted into
7679 * jiffies.
7680 *
7681 -@@ -2245,8 +2258,8 @@ int proc_dointvec_jiffies(struct ctl_table *table, int write,
7682 +@@ -2348,8 +2361,8 @@ int proc_dointvec_jiffies(struct ctl_table *table, int write,
7683 * @ppos: pointer to the file position
7684 *
7685 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
7686 @@ -2329,7 +2328,7 @@
7687 * are converted into jiffies.
7688 *
7689 * Returns 0 on success.
7690 -@@ -2268,8 +2281,8 @@ int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
7691 +@@ -2371,8 +2384,8 @@ int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
7692 * @ppos: the current position in the file
7693 *
7694 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer