Gentoo Archives: gentoo-commits

From: "Stratos Psomadakis (psomas)" <psomas@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] linux-patches r2035 - genpatches-2.6/trunk/3.0
Date: Thu, 22 Dec 2011 12:04:15
Message-Id: 20111222120405.552512004B@flycatcher.gentoo.org
1 Author: psomas
2 Date: 2011-12-22 12:04:04 +0000 (Thu, 22 Dec 2011)
3 New Revision: 2035
4
5 Added:
6 genpatches-2.6/trunk/3.0/1013_linux-3.0.14.patch
7 Modified:
8 genpatches-2.6/trunk/3.0/0000_README
9 Log:
10 Linux patch 3.0.14
11
12 Modified: genpatches-2.6/trunk/3.0/0000_README
13 ===================================================================
14 --- genpatches-2.6/trunk/3.0/0000_README 2011-12-22 12:03:42 UTC (rev 2034)
15 +++ genpatches-2.6/trunk/3.0/0000_README 2011-12-22 12:04:04 UTC (rev 2035)
16 @@ -91,6 +91,10 @@
17 From: http://www.kernel.org
18 Desc: Linux 3.0.13
19
20 +Patch: 1013_linux-3.0.14.patch
21 +From: http://www.kernel.org
22 +Desc: Linux 3.0.14
23 +
24 Patch: 1800_fix-zcache-build.patch
25 From: http://bugs.gentoo.org/show_bug.cgi?id=376325
26 Desc: Fix zcache build error
27
28 Added: genpatches-2.6/trunk/3.0/1013_linux-3.0.14.patch
29 ===================================================================
30 --- genpatches-2.6/trunk/3.0/1013_linux-3.0.14.patch (rev 0)
31 +++ genpatches-2.6/trunk/3.0/1013_linux-3.0.14.patch 2011-12-22 12:04:04 UTC (rev 2035)
32 @@ -0,0 +1,1891 @@
33 +diff --git a/Makefile b/Makefile
34 +index 5ccc962..f4f577b 100644
35 +--- a/Makefile
36 ++++ b/Makefile
37 +@@ -1,6 +1,6 @@
38 + VERSION = 3
39 + PATCHLEVEL = 0
40 +-SUBLEVEL = 13
41 ++SUBLEVEL = 14
42 + EXTRAVERSION =
43 + NAME = Sneaky Weasel
44 +
45 +diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
46 +index 7d606b0..eeb9478 100644
47 +--- a/arch/arm/mach-at91/at91sam9260.c
48 ++++ b/arch/arm/mach-at91/at91sam9260.c
49 +@@ -237,9 +237,9 @@ static struct clk_lookup periph_clocks_lookups[] = {
50 + CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk),
51 + CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.0", &tc1_clk),
52 + CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.0", &tc2_clk),
53 +- CLKDEV_CON_DEV_ID("t3_clk", "atmel_tcb.1", &tc3_clk),
54 +- CLKDEV_CON_DEV_ID("t4_clk", "atmel_tcb.1", &tc4_clk),
55 +- CLKDEV_CON_DEV_ID("t5_clk", "atmel_tcb.1", &tc5_clk),
56 ++ CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tc3_clk),
57 ++ CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.1", &tc4_clk),
58 ++ CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.1", &tc5_clk),
59 + CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc_clk),
60 + };
61 +
62 +diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
63 +index e83cc86..f893617 100644
64 +--- a/arch/arm/mach-davinci/board-da850-evm.c
65 ++++ b/arch/arm/mach-davinci/board-da850-evm.c
66 +@@ -748,7 +748,7 @@ static struct snd_platform_data da850_evm_snd_data = {
67 + .num_serializer = ARRAY_SIZE(da850_iis_serializer_direction),
68 + .tdm_slots = 2,
69 + .serial_dir = da850_iis_serializer_direction,
70 +- .asp_chan_q = EVENTQ_1,
71 ++ .asp_chan_q = EVENTQ_0,
72 + .version = MCASP_VERSION_2,
73 + .txnumevt = 1,
74 + .rxnumevt = 1,
75 +diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c
76 +index f6ac9ba..3cdd237 100644
77 +--- a/arch/arm/mach-davinci/board-dm646x-evm.c
78 ++++ b/arch/arm/mach-davinci/board-dm646x-evm.c
79 +@@ -563,7 +563,7 @@ static int setup_vpif_input_channel_mode(int mux_mode)
80 + int val;
81 + u32 value;
82 +
83 +- if (!vpif_vsclkdis_reg || !cpld_client)
84 ++ if (!vpif_vidclkctl_reg || !cpld_client)
85 + return -ENXIO;
86 +
87 + val = i2c_smbus_read_byte(cpld_client);
88 +@@ -571,7 +571,7 @@ static int setup_vpif_input_channel_mode(int mux_mode)
89 + return val;
90 +
91 + spin_lock_irqsave(&vpif_reg_lock, flags);
92 +- value = __raw_readl(vpif_vsclkdis_reg);
93 ++ value = __raw_readl(vpif_vidclkctl_reg);
94 + if (mux_mode) {
95 + val &= VPIF_INPUT_TWO_CHANNEL;
96 + value |= VIDCH1CLK;
97 +@@ -579,7 +579,7 @@ static int setup_vpif_input_channel_mode(int mux_mode)
98 + val |= VPIF_INPUT_ONE_CHANNEL;
99 + value &= ~VIDCH1CLK;
100 + }
101 +- __raw_writel(value, vpif_vsclkdis_reg);
102 ++ __raw_writel(value, vpif_vidclkctl_reg);
103 + spin_unlock_irqrestore(&vpif_reg_lock, flags);
104 +
105 + err = i2c_smbus_write_byte(cpld_client, val);
106 +diff --git a/arch/arm/mach-mxs/include/mach/mxs.h b/arch/arm/mach-mxs/include/mach/mxs.h
107 +index 35a89dd..1332f73 100644
108 +--- a/arch/arm/mach-mxs/include/mach/mxs.h
109 ++++ b/arch/arm/mach-mxs/include/mach/mxs.h
110 +@@ -30,6 +30,7 @@
111 + */
112 + #define cpu_is_mx23() ( \
113 + machine_is_mx23evk() || \
114 ++ machine_is_stmp378x() || \
115 + 0)
116 + #define cpu_is_mx28() ( \
117 + machine_is_mx28evk() || \
118 +diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
119 +index 6781765..aa083d3 100644
120 +--- a/arch/x86/kernel/hpet.c
121 ++++ b/arch/x86/kernel/hpet.c
122 +@@ -1054,6 +1054,14 @@ int hpet_rtc_timer_init(void)
123 + }
124 + EXPORT_SYMBOL_GPL(hpet_rtc_timer_init);
125 +
126 ++static void hpet_disable_rtc_channel(void)
127 ++{
128 ++ unsigned long cfg;
129 ++ cfg = hpet_readl(HPET_T1_CFG);
130 ++ cfg &= ~HPET_TN_ENABLE;
131 ++ hpet_writel(cfg, HPET_T1_CFG);
132 ++}
133 ++
134 + /*
135 + * The functions below are called from rtc driver.
136 + * Return 0 if HPET is not being used.
137 +@@ -1065,6 +1073,9 @@ int hpet_mask_rtc_irq_bit(unsigned long bit_mask)
138 + return 0;
139 +
140 + hpet_rtc_flags &= ~bit_mask;
141 ++ if (unlikely(!hpet_rtc_flags))
142 ++ hpet_disable_rtc_channel();
143 ++
144 + return 1;
145 + }
146 + EXPORT_SYMBOL_GPL(hpet_mask_rtc_irq_bit);
147 +@@ -1130,15 +1141,11 @@ EXPORT_SYMBOL_GPL(hpet_rtc_dropped_irq);
148 +
149 + static void hpet_rtc_timer_reinit(void)
150 + {
151 +- unsigned int cfg, delta;
152 ++ unsigned int delta;
153 + int lost_ints = -1;
154 +
155 +- if (unlikely(!hpet_rtc_flags)) {
156 +- cfg = hpet_readl(HPET_T1_CFG);
157 +- cfg &= ~HPET_TN_ENABLE;
158 +- hpet_writel(cfg, HPET_T1_CFG);
159 +- return;
160 +- }
161 ++ if (unlikely(!hpet_rtc_flags))
162 ++ hpet_disable_rtc_channel();
163 +
164 + if (!(hpet_rtc_flags & RTC_PIE) || hpet_pie_limit)
165 + delta = hpet_default_delta;
166 +diff --git a/arch/x86/mm/gup.c b/arch/x86/mm/gup.c
167 +index ea30585..dd74e46 100644
168 +--- a/arch/x86/mm/gup.c
169 ++++ b/arch/x86/mm/gup.c
170 +@@ -201,6 +201,8 @@ static noinline int gup_huge_pud(pud_t pud, unsigned long addr,
171 + do {
172 + VM_BUG_ON(compound_head(page) != head);
173 + pages[*nr] = page;
174 ++ if (PageTail(page))
175 ++ get_huge_page_tail(page);
176 + (*nr)++;
177 + page++;
178 + refs++;
179 +diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
180 +index acea42e..f8dcda4 100644
181 +--- a/arch/x86/xen/setup.c
182 ++++ b/arch/x86/xen/setup.c
183 +@@ -192,9 +192,21 @@ static unsigned long __init xen_get_max_pages(void)
184 + domid_t domid = DOMID_SELF;
185 + int ret;
186 +
187 +- ret = HYPERVISOR_memory_op(XENMEM_maximum_reservation, &domid);
188 +- if (ret > 0)
189 +- max_pages = ret;
190 ++ /*
191 ++ * For the initial domain we use the maximum reservation as
192 ++ * the maximum page.
193 ++ *
194 ++ * For guest domains the current maximum reservation reflects
195 ++ * the current maximum rather than the static maximum. In this
196 ++ * case the e820 map provided to us will cover the static
197 ++ * maximum region.
198 ++ */
199 ++ if (xen_initial_domain()) {
200 ++ ret = HYPERVISOR_memory_op(XENMEM_maximum_reservation, &domid);
201 ++ if (ret > 0)
202 ++ max_pages = ret;
203 ++ }
204 ++
205 + return min(max_pages, MAX_DOMAIN_PAGES);
206 + }
207 +
208 +diff --git a/drivers/firmware/iscsi_ibft.c b/drivers/firmware/iscsi_ibft.c
209 +index ce33f46..2763643 100644
210 +--- a/drivers/firmware/iscsi_ibft.c
211 ++++ b/drivers/firmware/iscsi_ibft.c
212 +@@ -738,6 +738,37 @@ static void __exit ibft_exit(void)
213 + ibft_cleanup();
214 + }
215 +
216 ++#ifdef CONFIG_ACPI
217 ++static const struct {
218 ++ char *sign;
219 ++} ibft_signs[] = {
220 ++ /*
221 ++ * One spec says "IBFT", the other says "iBFT". We have to check
222 ++ * for both.
223 ++ */
224 ++ { ACPI_SIG_IBFT },
225 ++ { "iBFT" },
226 ++};
227 ++
228 ++static void __init acpi_find_ibft_region(void)
229 ++{
230 ++ int i;
231 ++ struct acpi_table_header *table = NULL;
232 ++
233 ++ if (acpi_disabled)
234 ++ return;
235 ++
236 ++ for (i = 0; i < ARRAY_SIZE(ibft_signs) && !ibft_addr; i++) {
237 ++ acpi_get_table(ibft_signs[i].sign, 0, &table);
238 ++ ibft_addr = (struct acpi_table_ibft *)table;
239 ++ }
240 ++}
241 ++#else
242 ++static void __init acpi_find_ibft_region(void)
243 ++{
244 ++}
245 ++#endif
246 ++
247 + /*
248 + * ibft_init() - creates sysfs tree entries for the iBFT data.
249 + */
250 +@@ -745,9 +776,16 @@ static int __init ibft_init(void)
251 + {
252 + int rc = 0;
253 +
254 ++ /*
255 ++ As on UEFI systems the setup_arch()/find_ibft_region()
256 ++ is called before ACPI tables are parsed and it only does
257 ++ legacy finding.
258 ++ */
259 ++ if (!ibft_addr)
260 ++ acpi_find_ibft_region();
261 ++
262 + if (ibft_addr) {
263 +- printk(KERN_INFO "iBFT detected at 0x%llx.\n",
264 +- (u64)isa_virt_to_bus(ibft_addr));
265 ++ pr_info("iBFT detected.\n");
266 +
267 + rc = ibft_check_device();
268 + if (rc)
269 +diff --git a/drivers/firmware/iscsi_ibft_find.c b/drivers/firmware/iscsi_ibft_find.c
270 +index bfe7232..4da4eb9 100644
271 +--- a/drivers/firmware/iscsi_ibft_find.c
272 ++++ b/drivers/firmware/iscsi_ibft_find.c
273 +@@ -45,13 +45,6 @@ EXPORT_SYMBOL_GPL(ibft_addr);
274 + static const struct {
275 + char *sign;
276 + } ibft_signs[] = {
277 +-#ifdef CONFIG_ACPI
278 +- /*
279 +- * One spec says "IBFT", the other says "iBFT". We have to check
280 +- * for both.
281 +- */
282 +- { ACPI_SIG_IBFT },
283 +-#endif
284 + { "iBFT" },
285 + { "BIFT" }, /* Broadcom iSCSI Offload */
286 + };
287 +@@ -62,14 +55,6 @@ static const struct {
288 + #define VGA_MEM 0xA0000 /* VGA buffer */
289 + #define VGA_SIZE 0x20000 /* 128kB */
290 +
291 +-#ifdef CONFIG_ACPI
292 +-static int __init acpi_find_ibft(struct acpi_table_header *header)
293 +-{
294 +- ibft_addr = (struct acpi_table_ibft *)header;
295 +- return 0;
296 +-}
297 +-#endif /* CONFIG_ACPI */
298 +-
299 + static int __init find_ibft_in_mem(void)
300 + {
301 + unsigned long pos;
302 +@@ -94,6 +79,7 @@ static int __init find_ibft_in_mem(void)
303 + * the table cannot be valid. */
304 + if (pos + len <= (IBFT_END-1)) {
305 + ibft_addr = (struct acpi_table_ibft *)virt;
306 ++ pr_info("iBFT found at 0x%lx.\n", pos);
307 + goto done;
308 + }
309 + }
310 +@@ -108,20 +94,12 @@ done:
311 + */
312 + unsigned long __init find_ibft_region(unsigned long *sizep)
313 + {
314 +-#ifdef CONFIG_ACPI
315 +- int i;
316 +-#endif
317 + ibft_addr = NULL;
318 +
319 +-#ifdef CONFIG_ACPI
320 +- for (i = 0; i < ARRAY_SIZE(ibft_signs) && !ibft_addr; i++)
321 +- acpi_table_parse(ibft_signs[i].sign, acpi_find_ibft);
322 +-#endif /* CONFIG_ACPI */
323 +-
324 + /* iBFT 1.03 section 1.4.3.1 mandates that UEFI machines will
325 + * only use ACPI for this */
326 +
327 +- if (!ibft_addr && !efi_enabled)
328 ++ if (!efi_enabled)
329 + find_ibft_in_mem();
330 +
331 + if (ibft_addr) {
332 +diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
333 +index 835ae42..6163cfa 100644
334 +--- a/drivers/hwmon/coretemp.c
335 ++++ b/drivers/hwmon/coretemp.c
336 +@@ -747,6 +747,8 @@ static void __cpuinit put_core_offline(unsigned int cpu)
337 + return;
338 +
339 + pdata = platform_get_drvdata(pdev);
340 ++ if (!pdata)
341 ++ return;
342 +
343 + indx = TO_ATTR_NO(cpu);
344 +
345 +diff --git a/drivers/hwmon/jz4740-hwmon.c b/drivers/hwmon/jz4740-hwmon.c
346 +index fea292d..b65a4da 100644
347 +--- a/drivers/hwmon/jz4740-hwmon.c
348 ++++ b/drivers/hwmon/jz4740-hwmon.c
349 +@@ -59,7 +59,7 @@ static ssize_t jz4740_hwmon_read_adcin(struct device *dev,
350 + {
351 + struct jz4740_hwmon *hwmon = dev_get_drvdata(dev);
352 + struct completion *completion = &hwmon->read_completion;
353 +- unsigned long t;
354 ++ long t;
355 + unsigned long val;
356 + int ret;
357 +
358 +diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
359 +index cbb50d3..1f6c68d 100644
360 +--- a/drivers/md/raid5.c
361 ++++ b/drivers/md/raid5.c
362 +@@ -3078,7 +3078,7 @@ static void handle_stripe5(struct stripe_head *sh)
363 + /* Not in-sync */;
364 + else if (test_bit(In_sync, &rdev->flags))
365 + set_bit(R5_Insync, &dev->flags);
366 +- else {
367 ++ else if (!test_bit(Faulty, &rdev->flags)) {
368 + /* could be in-sync depending on recovery/reshape status */
369 + if (sh->sector + STRIPE_SECTORS <= rdev->recovery_offset)
370 + set_bit(R5_Insync, &dev->flags);
371 +diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
372 +index cc20e02..e12fbc5 100644
373 +--- a/drivers/mmc/host/mxcmmc.c
374 ++++ b/drivers/mmc/host/mxcmmc.c
375 +@@ -731,6 +731,7 @@ static void mxcmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
376 + "failed to config DMA channel. Falling back to PIO\n");
377 + dma_release_channel(host->dma);
378 + host->do_dma = 0;
379 ++ host->dma = NULL;
380 + }
381 + }
382 +
383 +diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
384 +index 09f679d..b849ad7 100644
385 +--- a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
386 ++++ b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
387 +@@ -411,6 +411,24 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
388 + return 0;
389 + }
390 +
391 ++void iwlagn_config_ht40(struct ieee80211_conf *conf,
392 ++ struct iwl_rxon_context *ctx)
393 ++{
394 ++ if (conf_is_ht40_minus(conf)) {
395 ++ ctx->ht.extension_chan_offset =
396 ++ IEEE80211_HT_PARAM_CHA_SEC_BELOW;
397 ++ ctx->ht.is_40mhz = true;
398 ++ } else if (conf_is_ht40_plus(conf)) {
399 ++ ctx->ht.extension_chan_offset =
400 ++ IEEE80211_HT_PARAM_CHA_SEC_ABOVE;
401 ++ ctx->ht.is_40mhz = true;
402 ++ } else {
403 ++ ctx->ht.extension_chan_offset =
404 ++ IEEE80211_HT_PARAM_CHA_SEC_NONE;
405 ++ ctx->ht.is_40mhz = false;
406 ++ }
407 ++}
408 ++
409 + int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
410 + {
411 + struct iwl_priv *priv = hw->priv;
412 +@@ -470,19 +488,11 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
413 + ctx->ht.enabled = conf_is_ht(conf);
414 +
415 + if (ctx->ht.enabled) {
416 +- if (conf_is_ht40_minus(conf)) {
417 +- ctx->ht.extension_chan_offset =
418 +- IEEE80211_HT_PARAM_CHA_SEC_BELOW;
419 +- ctx->ht.is_40mhz = true;
420 +- } else if (conf_is_ht40_plus(conf)) {
421 +- ctx->ht.extension_chan_offset =
422 +- IEEE80211_HT_PARAM_CHA_SEC_ABOVE;
423 +- ctx->ht.is_40mhz = true;
424 +- } else {
425 +- ctx->ht.extension_chan_offset =
426 +- IEEE80211_HT_PARAM_CHA_SEC_NONE;
427 +- ctx->ht.is_40mhz = false;
428 +- }
429 ++ /* if HT40 is used, it should not change
430 ++ * after associated except channel switch */
431 ++ if (iwl_is_associated_ctx(ctx) &&
432 ++ !ctx->ht.is_40mhz)
433 ++ iwlagn_config_ht40(conf, ctx);
434 + } else
435 + ctx->ht.is_40mhz = false;
436 +
437 +diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
438 +index baec52d..67d4c2d 100644
439 +--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
440 ++++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
441 +@@ -2872,21 +2872,9 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw,
442 +
443 + /* Configure HT40 channels */
444 + ctx->ht.enabled = conf_is_ht(conf);
445 +- if (ctx->ht.enabled) {
446 +- if (conf_is_ht40_minus(conf)) {
447 +- ctx->ht.extension_chan_offset =
448 +- IEEE80211_HT_PARAM_CHA_SEC_BELOW;
449 +- ctx->ht.is_40mhz = true;
450 +- } else if (conf_is_ht40_plus(conf)) {
451 +- ctx->ht.extension_chan_offset =
452 +- IEEE80211_HT_PARAM_CHA_SEC_ABOVE;
453 +- ctx->ht.is_40mhz = true;
454 +- } else {
455 +- ctx->ht.extension_chan_offset =
456 +- IEEE80211_HT_PARAM_CHA_SEC_NONE;
457 +- ctx->ht.is_40mhz = false;
458 +- }
459 +- } else
460 ++ if (ctx->ht.enabled)
461 ++ iwlagn_config_ht40(conf, ctx);
462 ++ else
463 + ctx->ht.is_40mhz = false;
464 +
465 + if ((le16_to_cpu(ctx->staging.channel) != ch))
466 +diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h
467 +index d171684..5a0acab 100644
468 +--- a/drivers/net/wireless/iwlwifi/iwl-agn.h
469 ++++ b/drivers/net/wireless/iwlwifi/iwl-agn.h
470 +@@ -152,6 +152,8 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw,
471 + struct ieee80211_vif *vif,
472 + struct ieee80211_bss_conf *bss_conf,
473 + u32 changes);
474 ++void iwlagn_config_ht40(struct ieee80211_conf *conf,
475 ++ struct iwl_rxon_context *ctx);
476 +
477 + /* uCode */
478 + void iwlagn_rx_calib_result(struct iwl_priv *priv,
479 +diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
480 +index f02c34d..0ec8930 100644
481 +--- a/drivers/pci/intel-iommu.c
482 ++++ b/drivers/pci/intel-iommu.c
483 +@@ -307,6 +307,11 @@ static inline bool dma_pte_present(struct dma_pte *pte)
484 + return (pte->val & 3) != 0;
485 + }
486 +
487 ++static inline bool dma_pte_superpage(struct dma_pte *pte)
488 ++{
489 ++ return (pte->val & (1 << 7));
490 ++}
491 ++
492 + static inline int first_pte_in_page(struct dma_pte *pte)
493 + {
494 + return !((unsigned long)pte & ~VTD_PAGE_MASK);
495 +@@ -578,17 +583,18 @@ static void domain_update_iommu_snooping(struct dmar_domain *domain)
496 +
497 + static void domain_update_iommu_superpage(struct dmar_domain *domain)
498 + {
499 +- int i, mask = 0xf;
500 ++ struct dmar_drhd_unit *drhd;
501 ++ struct intel_iommu *iommu = NULL;
502 ++ int mask = 0xf;
503 +
504 + if (!intel_iommu_superpage) {
505 + domain->iommu_superpage = 0;
506 + return;
507 + }
508 +
509 +- domain->iommu_superpage = 4; /* 1TiB */
510 +-
511 +- for_each_set_bit(i, &domain->iommu_bmp, g_num_of_iommus) {
512 +- mask |= cap_super_page_val(g_iommus[i]->cap);
513 ++ /* set iommu_superpage to the smallest common denominator */
514 ++ for_each_active_iommu(iommu, drhd) {
515 ++ mask &= cap_super_page_val(iommu->cap);
516 + if (!mask) {
517 + break;
518 + }
519 +@@ -731,29 +737,23 @@ out:
520 + }
521 +
522 + static struct dma_pte *pfn_to_dma_pte(struct dmar_domain *domain,
523 +- unsigned long pfn, int large_level)
524 ++ unsigned long pfn, int target_level)
525 + {
526 + int addr_width = agaw_to_width(domain->agaw) - VTD_PAGE_SHIFT;
527 + struct dma_pte *parent, *pte = NULL;
528 + int level = agaw_to_level(domain->agaw);
529 +- int offset, target_level;
530 ++ int offset;
531 +
532 + BUG_ON(!domain->pgd);
533 + BUG_ON(addr_width < BITS_PER_LONG && pfn >> addr_width);
534 + parent = domain->pgd;
535 +
536 +- /* Search pte */
537 +- if (!large_level)
538 +- target_level = 1;
539 +- else
540 +- target_level = large_level;
541 +-
542 + while (level > 0) {
543 + void *tmp_page;
544 +
545 + offset = pfn_level_offset(pfn, level);
546 + pte = &parent[offset];
547 +- if (!large_level && (pte->val & DMA_PTE_LARGE_PAGE))
548 ++ if (!target_level && (dma_pte_superpage(pte) || !dma_pte_present(pte)))
549 + break;
550 + if (level == target_level)
551 + break;
552 +@@ -817,13 +817,14 @@ static struct dma_pte *dma_pfn_level_pte(struct dmar_domain *domain,
553 + }
554 +
555 + /* clear last level pte, a tlb flush should be followed */
556 +-static void dma_pte_clear_range(struct dmar_domain *domain,
557 ++static int dma_pte_clear_range(struct dmar_domain *domain,
558 + unsigned long start_pfn,
559 + unsigned long last_pfn)
560 + {
561 + int addr_width = agaw_to_width(domain->agaw) - VTD_PAGE_SHIFT;
562 + unsigned int large_page = 1;
563 + struct dma_pte *first_pte, *pte;
564 ++ int order;
565 +
566 + BUG_ON(addr_width < BITS_PER_LONG && start_pfn >> addr_width);
567 + BUG_ON(addr_width < BITS_PER_LONG && last_pfn >> addr_width);
568 +@@ -847,6 +848,9 @@ static void dma_pte_clear_range(struct dmar_domain *domain,
569 + (void *)pte - (void *)first_pte);
570 +
571 + } while (start_pfn && start_pfn <= last_pfn);
572 ++
573 ++ order = (large_page - 1) * 9;
574 ++ return order;
575 + }
576 +
577 + /* free page table pages. last level pte should already be cleared */
578 +@@ -3740,6 +3744,7 @@ static int intel_iommu_domain_init(struct iommu_domain *domain)
579 + vm_domain_exit(dmar_domain);
580 + return -ENOMEM;
581 + }
582 ++ domain_update_iommu_cap(dmar_domain);
583 + domain->priv = dmar_domain;
584 +
585 + return 0;
586 +@@ -3865,14 +3870,15 @@ static int intel_iommu_unmap(struct iommu_domain *domain,
587 + {
588 + struct dmar_domain *dmar_domain = domain->priv;
589 + size_t size = PAGE_SIZE << gfp_order;
590 ++ int order;
591 +
592 +- dma_pte_clear_range(dmar_domain, iova >> VTD_PAGE_SHIFT,
593 ++ order = dma_pte_clear_range(dmar_domain, iova >> VTD_PAGE_SHIFT,
594 + (iova + size - 1) >> VTD_PAGE_SHIFT);
595 +
596 + if (dmar_domain->max_addr == iova + size)
597 + dmar_domain->max_addr = iova;
598 +
599 +- return gfp_order;
600 ++ return order;
601 + }
602 +
603 + static phys_addr_t intel_iommu_iova_to_phys(struct iommu_domain *domain,
604 +diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
605 +index cf3f999..10451a1 100644
606 +--- a/drivers/ptp/ptp_clock.c
607 ++++ b/drivers/ptp/ptp_clock.c
608 +@@ -101,7 +101,9 @@ static s32 scaled_ppm_to_ppb(long ppm)
609 +
610 + static int ptp_clock_getres(struct posix_clock *pc, struct timespec *tp)
611 + {
612 +- return 1; /* always round timer functions to one nanosecond */
613 ++ tp->tv_sec = 0;
614 ++ tp->tv_nsec = 1;
615 ++ return 0;
616 + }
617 +
618 + static int ptp_clock_settime(struct posix_clock *pc, const struct timespec *tp)
619 +diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c
620 +index 21ce2af..6cb7e28 100644
621 +--- a/drivers/staging/rtl8712/usb_intf.c
622 ++++ b/drivers/staging/rtl8712/usb_intf.c
623 +@@ -86,6 +86,7 @@ static struct usb_device_id rtl871x_usb_id_tbl[] = {
624 + {USB_DEVICE(0x0DF6, 0x0045)},
625 + {USB_DEVICE(0x0DF6, 0x0059)}, /* 11n mode disable */
626 + {USB_DEVICE(0x0DF6, 0x004B)},
627 ++ {USB_DEVICE(0x0DF6, 0x005D)},
628 + {USB_DEVICE(0x0DF6, 0x0063)},
629 + /* Sweex */
630 + {USB_DEVICE(0x177F, 0x0154)},
631 +diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
632 +index 4b9b716..1340ffd 100644
633 +--- a/drivers/target/target_core_transport.c
634 ++++ b/drivers/target/target_core_transport.c
635 +@@ -2777,10 +2777,15 @@ static inline u32 transport_get_sectors_6(
636 +
637 + /*
638 + * Everything else assume TYPE_DISK Sector CDB location.
639 +- * Use 8-bit sector value.
640 ++ * Use 8-bit sector value. SBC-3 says:
641 ++ *
642 ++ * A TRANSFER LENGTH field set to zero specifies that 256
643 ++ * logical blocks shall be written. Any other value
644 ++ * specifies the number of logical blocks that shall be
645 ++ * written.
646 + */
647 + type_disk:
648 +- return (u32)cdb[4];
649 ++ return cdb[4] ? : 256;
650 + }
651 +
652 + static inline u32 transport_get_sectors_10(
653 +diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
654 +index 2ffcaa0..8faa23c 100644
655 +--- a/drivers/usb/class/cdc-acm.c
656 ++++ b/drivers/usb/class/cdc-acm.c
657 +@@ -1458,6 +1458,16 @@ static const struct usb_device_id acm_ids[] = {
658 + },
659 + { USB_DEVICE(0x22b8, 0x6425), /* Motorola MOTOMAGX phones */
660 + },
661 ++ /* Motorola H24 HSPA module: */
662 ++ { USB_DEVICE(0x22b8, 0x2d91) }, /* modem */
663 ++ { USB_DEVICE(0x22b8, 0x2d92) }, /* modem + diagnostics */
664 ++ { USB_DEVICE(0x22b8, 0x2d93) }, /* modem + AT port */
665 ++ { USB_DEVICE(0x22b8, 0x2d95) }, /* modem + AT port + diagnostics */
666 ++ { USB_DEVICE(0x22b8, 0x2d96) }, /* modem + NMEA */
667 ++ { USB_DEVICE(0x22b8, 0x2d97) }, /* modem + diagnostics + NMEA */
668 ++ { USB_DEVICE(0x22b8, 0x2d99) }, /* modem + AT port + NMEA */
669 ++ { USB_DEVICE(0x22b8, 0x2d9a) }, /* modem + AT port + diagnostics + NMEA */
670 ++
671 + { USB_DEVICE(0x0572, 0x1329), /* Hummingbird huc56s (Conexant) */
672 + .driver_info = NO_UNION_NORMAL, /* union descriptor misplaced on
673 + data interface instead of
674 +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
675 +index e98a1e1..d2becb9 100644
676 +--- a/drivers/usb/serial/option.c
677 ++++ b/drivers/usb/serial/option.c
678 +@@ -659,7 +659,12 @@ static const struct usb_device_id option_ids[] = {
679 + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x01) },
680 + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x02) },
681 + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x03) },
682 +- { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x08) },
683 ++ { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x10) },
684 ++ { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x12) },
685 ++ { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x13) },
686 ++ { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x02, 0x01) }, /* E398 3G Modem */
687 ++ { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x02, 0x02) }, /* E398 3G PC UI Interface */
688 ++ { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x02, 0x03) }, /* E398 3G Application Interface */
689 + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) },
690 + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) },
691 + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) },
692 +diff --git a/fs/dcache.c b/fs/dcache.c
693 +index fbdcbca..d2f8feb 100644
694 +--- a/fs/dcache.c
695 ++++ b/fs/dcache.c
696 +@@ -2487,16 +2487,14 @@ static int prepend_name(char **buffer, int *buflen, struct qstr *name)
697 + /**
698 + * prepend_path - Prepend path string to a buffer
699 + * @path: the dentry/vfsmount to report
700 +- * @root: root vfsmnt/dentry (may be modified by this function)
701 ++ * @root: root vfsmnt/dentry
702 + * @buffer: pointer to the end of the buffer
703 + * @buflen: pointer to buffer length
704 + *
705 + * Caller holds the rename_lock.
706 +- *
707 +- * If path is not reachable from the supplied root, then the value of
708 +- * root is changed (without modifying refcounts).
709 + */
710 +-static int prepend_path(const struct path *path, struct path *root,
711 ++static int prepend_path(const struct path *path,
712 ++ const struct path *root,
713 + char **buffer, int *buflen)
714 + {
715 + struct dentry *dentry = path->dentry;
716 +@@ -2531,10 +2529,10 @@ static int prepend_path(const struct path *path, struct path *root,
717 + dentry = parent;
718 + }
719 +
720 +-out:
721 + if (!error && !slash)
722 + error = prepend(buffer, buflen, "/", 1);
723 +
724 ++out:
725 + br_read_unlock(vfsmount_lock);
726 + return error;
727 +
728 +@@ -2548,15 +2546,17 @@ global_root:
729 + WARN(1, "Root dentry has weird name <%.*s>\n",
730 + (int) dentry->d_name.len, dentry->d_name.name);
731 + }
732 +- root->mnt = vfsmnt;
733 +- root->dentry = dentry;
734 ++ if (!slash)
735 ++ error = prepend(buffer, buflen, "/", 1);
736 ++ if (!error)
737 ++ error = vfsmnt->mnt_ns ? 1 : 2;
738 + goto out;
739 + }
740 +
741 + /**
742 + * __d_path - return the path of a dentry
743 + * @path: the dentry/vfsmount to report
744 +- * @root: root vfsmnt/dentry (may be modified by this function)
745 ++ * @root: root vfsmnt/dentry
746 + * @buf: buffer to return value in
747 + * @buflen: buffer length
748 + *
749 +@@ -2567,10 +2567,10 @@ global_root:
750 + *
751 + * "buflen" should be positive.
752 + *
753 +- * If path is not reachable from the supplied root, then the value of
754 +- * root is changed (without modifying refcounts).
755 ++ * If the path is not reachable from the supplied root, return %NULL.
756 + */
757 +-char *__d_path(const struct path *path, struct path *root,
758 ++char *__d_path(const struct path *path,
759 ++ const struct path *root,
760 + char *buf, int buflen)
761 + {
762 + char *res = buf + buflen;
763 +@@ -2581,7 +2581,28 @@ char *__d_path(const struct path *path, struct path *root,
764 + error = prepend_path(path, root, &res, &buflen);
765 + write_sequnlock(&rename_lock);
766 +
767 +- if (error)
768 ++ if (error < 0)
769 ++ return ERR_PTR(error);
770 ++ if (error > 0)
771 ++ return NULL;
772 ++ return res;
773 ++}
774 ++
775 ++char *d_absolute_path(const struct path *path,
776 ++ char *buf, int buflen)
777 ++{
778 ++ struct path root = {};
779 ++ char *res = buf + buflen;
780 ++ int error;
781 ++
782 ++ prepend(&res, &buflen, "\0", 1);
783 ++ write_seqlock(&rename_lock);
784 ++ error = prepend_path(path, &root, &res, &buflen);
785 ++ write_sequnlock(&rename_lock);
786 ++
787 ++ if (error > 1)
788 ++ error = -EINVAL;
789 ++ if (error < 0)
790 + return ERR_PTR(error);
791 + return res;
792 + }
793 +@@ -2589,8 +2610,9 @@ char *__d_path(const struct path *path, struct path *root,
794 + /*
795 + * same as __d_path but appends "(deleted)" for unlinked files.
796 + */
797 +-static int path_with_deleted(const struct path *path, struct path *root,
798 +- char **buf, int *buflen)
799 ++static int path_with_deleted(const struct path *path,
800 ++ const struct path *root,
801 ++ char **buf, int *buflen)
802 + {
803 + prepend(buf, buflen, "\0", 1);
804 + if (d_unlinked(path->dentry)) {
805 +@@ -2627,7 +2649,6 @@ char *d_path(const struct path *path, char *buf, int buflen)
806 + {
807 + char *res = buf + buflen;
808 + struct path root;
809 +- struct path tmp;
810 + int error;
811 +
812 + /*
813 +@@ -2642,9 +2663,8 @@ char *d_path(const struct path *path, char *buf, int buflen)
814 +
815 + get_fs_root(current->fs, &root);
816 + write_seqlock(&rename_lock);
817 +- tmp = root;
818 +- error = path_with_deleted(path, &tmp, &res, &buflen);
819 +- if (error)
820 ++ error = path_with_deleted(path, &root, &res, &buflen);
821 ++ if (error < 0)
822 + res = ERR_PTR(error);
823 + write_sequnlock(&rename_lock);
824 + path_put(&root);
825 +@@ -2665,7 +2685,6 @@ char *d_path_with_unreachable(const struct path *path, char *buf, int buflen)
826 + {
827 + char *res = buf + buflen;
828 + struct path root;
829 +- struct path tmp;
830 + int error;
831 +
832 + if (path->dentry->d_op && path->dentry->d_op->d_dname)
833 +@@ -2673,9 +2692,8 @@ char *d_path_with_unreachable(const struct path *path, char *buf, int buflen)
834 +
835 + get_fs_root(current->fs, &root);
836 + write_seqlock(&rename_lock);
837 +- tmp = root;
838 +- error = path_with_deleted(path, &tmp, &res, &buflen);
839 +- if (!error && !path_equal(&tmp, &root))
840 ++ error = path_with_deleted(path, &root, &res, &buflen);
841 ++ if (error > 0)
842 + error = prepend_unreachable(&res, &buflen);
843 + write_sequnlock(&rename_lock);
844 + path_put(&root);
845 +@@ -2806,19 +2824,18 @@ SYSCALL_DEFINE2(getcwd, char __user *, buf, unsigned long, size)
846 + write_seqlock(&rename_lock);
847 + if (!d_unlinked(pwd.dentry)) {
848 + unsigned long len;
849 +- struct path tmp = root;
850 + char *cwd = page + PAGE_SIZE;
851 + int buflen = PAGE_SIZE;
852 +
853 + prepend(&cwd, &buflen, "\0", 1);
854 +- error = prepend_path(&pwd, &tmp, &cwd, &buflen);
855 ++ error = prepend_path(&pwd, &root, &cwd, &buflen);
856 + write_sequnlock(&rename_lock);
857 +
858 +- if (error)
859 ++ if (error < 0)
860 + goto out;
861 +
862 + /* Unreachable from current root */
863 +- if (!path_equal(&tmp, &root)) {
864 ++ if (error > 0) {
865 + error = prepend_unreachable(&cwd, &buflen);
866 + if (error)
867 + goto out;
868 +diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
869 +index 1265904..af09060 100644
870 +--- a/fs/ext4/inode.c
871 ++++ b/fs/ext4/inode.c
872 +@@ -2126,8 +2126,11 @@ static int mpage_da_submit_io(struct mpage_da_data *mpd,
873 + clear_buffer_unwritten(bh);
874 + }
875 +
876 +- /* skip page if block allocation undone */
877 +- if (buffer_delay(bh) || buffer_unwritten(bh))
878 ++ /*
879 ++ * skip page if block allocation undone and
880 ++ * block is dirty
881 ++ */
882 ++ if (ext4_bh_delay_or_unwritten(NULL, bh))
883 + skip_page = 1;
884 + bh = bh->b_this_page;
885 + block_start += bh->b_size;
886 +@@ -3231,7 +3234,7 @@ static int ext4_da_write_end(struct file *file,
887 + */
888 +
889 + new_i_size = pos + copied;
890 +- if (new_i_size > EXT4_I(inode)->i_disksize) {
891 ++ if (copied && new_i_size > EXT4_I(inode)->i_disksize) {
892 + if (ext4_da_should_update_i_disksize(page, end)) {
893 + down_write(&EXT4_I(inode)->i_data_sem);
894 + if (new_i_size > EXT4_I(inode)->i_disksize) {
895 +diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c
896 +index bd6a85e..d99d74a 100644
897 +--- a/fs/ext4/page-io.c
898 ++++ b/fs/ext4/page-io.c
899 +@@ -405,6 +405,18 @@ int ext4_bio_write_page(struct ext4_io_submit *io,
900 +
901 + block_end = block_start + blocksize;
902 + if (block_start >= len) {
903 ++ /*
904 ++ * Comments copied from block_write_full_page_endio:
905 ++ *
906 ++ * The page straddles i_size. It must be zeroed out on
907 ++ * each and every writepage invocation because it may
908 ++ * be mmapped. "A file is mapped in multiples of the
909 ++ * page size. For a file that is not a multiple of
910 ++ * the page size, the remaining memory is zeroed when
911 ++ * mapped, and writes to that region are not written
912 ++ * out to the file."
913 ++ */
914 ++ zero_user_segment(page, block_start, block_end);
915 + clear_buffer_dirty(bh);
916 + set_buffer_uptodate(bh);
917 + continue;
918 +diff --git a/fs/ext4/super.c b/fs/ext4/super.c
919 +index 111ed9d..7aa77f0 100644
920 +--- a/fs/ext4/super.c
921 ++++ b/fs/ext4/super.c
922 +@@ -1113,9 +1113,9 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)
923 + seq_puts(seq, ",block_validity");
924 +
925 + if (!test_opt(sb, INIT_INODE_TABLE))
926 +- seq_puts(seq, ",noinit_inode_table");
927 ++ seq_puts(seq, ",noinit_itable");
928 + else if (sbi->s_li_wait_mult != EXT4_DEF_LI_WAIT_MULT)
929 +- seq_printf(seq, ",init_inode_table=%u",
930 ++ seq_printf(seq, ",init_itable=%u",
931 + (unsigned) sbi->s_li_wait_mult);
932 +
933 + ext4_show_quota_options(seq, sb);
934 +@@ -1291,8 +1291,7 @@ enum {
935 + Opt_nomblk_io_submit, Opt_block_validity, Opt_noblock_validity,
936 + Opt_inode_readahead_blks, Opt_journal_ioprio,
937 + Opt_dioread_nolock, Opt_dioread_lock,
938 +- Opt_discard, Opt_nodiscard,
939 +- Opt_init_inode_table, Opt_noinit_inode_table,
940 ++ Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
941 + };
942 +
943 + static const match_table_t tokens = {
944 +@@ -1365,9 +1364,9 @@ static const match_table_t tokens = {
945 + {Opt_dioread_lock, "dioread_lock"},
946 + {Opt_discard, "discard"},
947 + {Opt_nodiscard, "nodiscard"},
948 +- {Opt_init_inode_table, "init_itable=%u"},
949 +- {Opt_init_inode_table, "init_itable"},
950 +- {Opt_noinit_inode_table, "noinit_itable"},
951 ++ {Opt_init_itable, "init_itable=%u"},
952 ++ {Opt_init_itable, "init_itable"},
953 ++ {Opt_noinit_itable, "noinit_itable"},
954 + {Opt_err, NULL},
955 + };
956 +
957 +@@ -1844,7 +1843,7 @@ set_qf_format:
958 + case Opt_dioread_lock:
959 + clear_opt(sb, DIOREAD_NOLOCK);
960 + break;
961 +- case Opt_init_inode_table:
962 ++ case Opt_init_itable:
963 + set_opt(sb, INIT_INODE_TABLE);
964 + if (args[0].from) {
965 + if (match_int(&args[0], &option))
966 +@@ -1855,7 +1854,7 @@ set_qf_format:
967 + return 0;
968 + sbi->s_li_wait_mult = option;
969 + break;
970 +- case Opt_noinit_inode_table:
971 ++ case Opt_noinit_itable:
972 + clear_opt(sb, INIT_INODE_TABLE);
973 + break;
974 + default:
975 +diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
976 +index 5cb8614..2aaf3ea 100644
977 +--- a/fs/fuse/dev.c
978 ++++ b/fs/fuse/dev.c
979 +@@ -1512,7 +1512,7 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode,
980 + else if (outarg->offset + num > file_size)
981 + num = file_size - outarg->offset;
982 +
983 +- while (num) {
984 ++ while (num && req->num_pages < FUSE_MAX_PAGES_PER_REQ) {
985 + struct page *page;
986 + unsigned int this_num;
987 +
988 +@@ -1526,6 +1526,7 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode,
989 +
990 + num -= this_num;
991 + total_len += this_num;
992 ++ index++;
993 + }
994 + req->misc.retrieve_in.offset = outarg->offset;
995 + req->misc.retrieve_in.size = total_len;
996 +diff --git a/fs/hfs/btree.c b/fs/hfs/btree.c
997 +index 3ebc437..1cbdeea 100644
998 +--- a/fs/hfs/btree.c
999 ++++ b/fs/hfs/btree.c
1000 +@@ -46,11 +46,26 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke
1001 + case HFS_EXT_CNID:
1002 + hfs_inode_read_fork(tree->inode, mdb->drXTExtRec, mdb->drXTFlSize,
1003 + mdb->drXTFlSize, be32_to_cpu(mdb->drXTClpSiz));
1004 ++ if (HFS_I(tree->inode)->alloc_blocks >
1005 ++ HFS_I(tree->inode)->first_blocks) {
1006 ++ printk(KERN_ERR "hfs: invalid btree extent records\n");
1007 ++ unlock_new_inode(tree->inode);
1008 ++ goto free_inode;
1009 ++ }
1010 ++
1011 + tree->inode->i_mapping->a_ops = &hfs_btree_aops;
1012 + break;
1013 + case HFS_CAT_CNID:
1014 + hfs_inode_read_fork(tree->inode, mdb->drCTExtRec, mdb->drCTFlSize,
1015 + mdb->drCTFlSize, be32_to_cpu(mdb->drCTClpSiz));
1016 ++
1017 ++ if (!HFS_I(tree->inode)->first_blocks) {
1018 ++ printk(KERN_ERR "hfs: invalid btree extent records "
1019 ++ "(0 size).\n");
1020 ++ unlock_new_inode(tree->inode);
1021 ++ goto free_inode;
1022 ++ }
1023 ++
1024 + tree->inode->i_mapping->a_ops = &hfs_btree_aops;
1025 + break;
1026 + default:
1027 +@@ -59,11 +74,6 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke
1028 + }
1029 + unlock_new_inode(tree->inode);
1030 +
1031 +- if (!HFS_I(tree->inode)->first_blocks) {
1032 +- printk(KERN_ERR "hfs: invalid btree extent records (0 size).\n");
1033 +- goto free_inode;
1034 +- }
1035 +-
1036 + mapping = tree->inode->i_mapping;
1037 + page = read_mapping_page(mapping, 0, NULL);
1038 + if (IS_ERR(page))
1039 +diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
1040 +index e2d4285..9f36384 100644
1041 +--- a/fs/jbd/journal.c
1042 ++++ b/fs/jbd/journal.c
1043 +@@ -1131,6 +1131,14 @@ static int journal_get_superblock(journal_t *journal)
1044 + goto out;
1045 + }
1046 +
1047 ++ if (be32_to_cpu(sb->s_first) == 0 ||
1048 ++ be32_to_cpu(sb->s_first) >= journal->j_maxlen) {
1049 ++ printk(KERN_WARNING
1050 ++ "JBD: Invalid start block of journal: %u\n",
1051 ++ be32_to_cpu(sb->s_first));
1052 ++ goto out;
1053 ++ }
1054 ++
1055 + return 0;
1056 +
1057 + out:
1058 +diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
1059 +index 0dfa5b5..40c5fb7 100644
1060 +--- a/fs/jbd2/journal.c
1061 ++++ b/fs/jbd2/journal.c
1062 +@@ -1251,6 +1251,14 @@ static int journal_get_superblock(journal_t *journal)
1063 + goto out;
1064 + }
1065 +
1066 ++ if (be32_to_cpu(sb->s_first) == 0 ||
1067 ++ be32_to_cpu(sb->s_first) >= journal->j_maxlen) {
1068 ++ printk(KERN_WARNING
1069 ++ "JBD2: Invalid start block of journal: %u\n",
1070 ++ be32_to_cpu(sb->s_first));
1071 ++ goto out;
1072 ++ }
1073 ++
1074 + return 0;
1075 +
1076 + out:
1077 +diff --git a/fs/namespace.c b/fs/namespace.c
1078 +index 537dd96..edc1c4a 100644
1079 +--- a/fs/namespace.c
1080 ++++ b/fs/namespace.c
1081 +@@ -1048,15 +1048,12 @@ static int show_mountinfo(struct seq_file *m, void *v)
1082 + if (err)
1083 + goto out;
1084 + seq_putc(m, ' ');
1085 +- seq_path_root(m, &mnt_path, &root, " \t\n\\");
1086 +- if (root.mnt != p->root.mnt || root.dentry != p->root.dentry) {
1087 +- /*
1088 +- * Mountpoint is outside root, discard that one. Ugly,
1089 +- * but less so than trying to do that in iterator in a
1090 +- * race-free way (due to renames).
1091 +- */
1092 +- return SEQ_SKIP;
1093 +- }
1094 ++
1095 ++ /* mountpoints outside of chroot jail will give SEQ_SKIP on this */
1096 ++ err = seq_path_root(m, &mnt_path, &root, " \t\n\\");
1097 ++ if (err)
1098 ++ goto out;
1099 ++
1100 + seq_puts(m, mnt->mnt_flags & MNT_READONLY ? " ro" : " rw");
1101 + show_mnt_opts(m, mnt);
1102 +
1103 +@@ -2725,3 +2722,8 @@ struct vfsmount *kern_mount_data(struct file_system_type *type, void *data)
1104 + return vfs_kern_mount(type, MS_KERNMOUNT, type->name, data);
1105 + }
1106 + EXPORT_SYMBOL_GPL(kern_mount_data);
1107 ++
1108 ++bool our_mnt(struct vfsmount *mnt)
1109 ++{
1110 ++ return check_mnt(mnt);
1111 ++}
1112 +diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
1113 +index ed257d1..a962827 100644
1114 +--- a/fs/proc/meminfo.c
1115 ++++ b/fs/proc/meminfo.c
1116 +@@ -131,12 +131,13 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
1117 + K(i.freeswap),
1118 + K(global_page_state(NR_FILE_DIRTY)),
1119 + K(global_page_state(NR_WRITEBACK)),
1120 +- K(global_page_state(NR_ANON_PAGES)
1121 + #ifdef CONFIG_TRANSPARENT_HUGEPAGE
1122 ++ K(global_page_state(NR_ANON_PAGES)
1123 + + global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) *
1124 +- HPAGE_PMD_NR
1125 ++ HPAGE_PMD_NR),
1126 ++#else
1127 ++ K(global_page_state(NR_ANON_PAGES)),
1128 + #endif
1129 +- ),
1130 + K(global_page_state(NR_FILE_MAPPED)),
1131 + K(global_page_state(NR_SHMEM)),
1132 + K(global_page_state(NR_SLAB_RECLAIMABLE) +
1133 +diff --git a/fs/seq_file.c b/fs/seq_file.c
1134 +index 05d6b0e..dba43c3 100644
1135 +--- a/fs/seq_file.c
1136 ++++ b/fs/seq_file.c
1137 +@@ -449,8 +449,6 @@ EXPORT_SYMBOL(seq_path);
1138 +
1139 + /*
1140 + * Same as seq_path, but relative to supplied root.
1141 +- *
1142 +- * root may be changed, see __d_path().
1143 + */
1144 + int seq_path_root(struct seq_file *m, struct path *path, struct path *root,
1145 + char *esc)
1146 +@@ -463,6 +461,8 @@ int seq_path_root(struct seq_file *m, struct path *path, struct path *root,
1147 + char *p;
1148 +
1149 + p = __d_path(path, root, buf, size);
1150 ++ if (!p)
1151 ++ return SEQ_SKIP;
1152 + res = PTR_ERR(p);
1153 + if (!IS_ERR(p)) {
1154 + char *end = mangle_path(buf, p, esc);
1155 +@@ -474,7 +474,7 @@ int seq_path_root(struct seq_file *m, struct path *path, struct path *root,
1156 + }
1157 + seq_commit(m, res);
1158 +
1159 +- return res < 0 ? res : 0;
1160 ++ return res < 0 && res != -ENAMETOOLONG ? res : 0;
1161 + }
1162 +
1163 + /*
1164 +diff --git a/fs/xfs/linux-2.6/xfs_export.c b/fs/xfs/linux-2.6/xfs_export.c
1165 +index f4f878f..fed3f3c 100644
1166 +--- a/fs/xfs/linux-2.6/xfs_export.c
1167 ++++ b/fs/xfs/linux-2.6/xfs_export.c
1168 +@@ -98,22 +98,22 @@ xfs_fs_encode_fh(
1169 + switch (fileid_type) {
1170 + case FILEID_INO32_GEN_PARENT:
1171 + spin_lock(&dentry->d_lock);
1172 +- fid->i32.parent_ino = dentry->d_parent->d_inode->i_ino;
1173 ++ fid->i32.parent_ino = XFS_I(dentry->d_parent->d_inode)->i_ino;
1174 + fid->i32.parent_gen = dentry->d_parent->d_inode->i_generation;
1175 + spin_unlock(&dentry->d_lock);
1176 + /*FALLTHRU*/
1177 + case FILEID_INO32_GEN:
1178 +- fid->i32.ino = inode->i_ino;
1179 ++ fid->i32.ino = XFS_I(inode)->i_ino;
1180 + fid->i32.gen = inode->i_generation;
1181 + break;
1182 + case FILEID_INO32_GEN_PARENT | XFS_FILEID_TYPE_64FLAG:
1183 + spin_lock(&dentry->d_lock);
1184 +- fid64->parent_ino = dentry->d_parent->d_inode->i_ino;
1185 ++ fid64->parent_ino = XFS_I(dentry->d_parent->d_inode)->i_ino;
1186 + fid64->parent_gen = dentry->d_parent->d_inode->i_generation;
1187 + spin_unlock(&dentry->d_lock);
1188 + /*FALLTHRU*/
1189 + case FILEID_INO32_GEN | XFS_FILEID_TYPE_64FLAG:
1190 +- fid64->ino = inode->i_ino;
1191 ++ fid64->ino = XFS_I(inode)->i_ino;
1192 + fid64->gen = inode->i_generation;
1193 + break;
1194 + }
1195 +diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c
1196 +index 01d2072..99d4011 100644
1197 +--- a/fs/xfs/xfs_attr.c
1198 ++++ b/fs/xfs/xfs_attr.c
1199 +@@ -822,17 +822,9 @@ xfs_attr_inactive(xfs_inode_t *dp)
1200 + error = xfs_attr_root_inactive(&trans, dp);
1201 + if (error)
1202 + goto out;
1203 +- /*
1204 +- * signal synchronous inactive transactions unless this
1205 +- * is a synchronous mount filesystem in which case we
1206 +- * know that we're here because we've been called out of
1207 +- * xfs_inactive which means that the last reference is gone
1208 +- * and the unlink transaction has already hit the disk so
1209 +- * async inactive transactions are safe.
1210 +- */
1211 +- if ((error = xfs_itruncate_finish(&trans, dp, 0LL, XFS_ATTR_FORK,
1212 +- (!(mp->m_flags & XFS_MOUNT_WSYNC)
1213 +- ? 1 : 0))))
1214 ++
1215 ++ error = xfs_itruncate_finish(&trans, dp, 0LL, XFS_ATTR_FORK, 0);
1216 ++ if (error)
1217 + goto out;
1218 +
1219 + /*
1220 +diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
1221 +index e546a33..a175933 100644
1222 +--- a/fs/xfs/xfs_bmap.c
1223 ++++ b/fs/xfs/xfs_bmap.c
1224 +@@ -3785,19 +3785,11 @@ xfs_bmap_compute_maxlevels(
1225 + * Routine to be called at transaction's end by xfs_bmapi, xfs_bunmapi
1226 + * caller. Frees all the extents that need freeing, which must be done
1227 + * last due to locking considerations. We never free any extents in
1228 +- * the first transaction. This is to allow the caller to make the first
1229 +- * transaction a synchronous one so that the pointers to the data being
1230 +- * broken in this transaction will be permanent before the data is actually
1231 +- * freed. This is necessary to prevent blocks from being reallocated
1232 +- * and written to before the free and reallocation are actually permanent.
1233 +- * We do not just make the first transaction synchronous here, because
1234 +- * there are more efficient ways to gain the same protection in some cases
1235 +- * (see the file truncation code).
1236 ++ * the first transaction.
1237 + *
1238 + * Return 1 if the given transaction was committed and a new one
1239 + * started, and 0 otherwise in the committed parameter.
1240 + */
1241 +-/*ARGSUSED*/
1242 + int /* error */
1243 + xfs_bmap_finish(
1244 + xfs_trans_t **tp, /* transaction pointer addr */
1245 +diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
1246 +index c6888a4..5715279 100644
1247 +--- a/fs/xfs/xfs_inode.c
1248 ++++ b/fs/xfs/xfs_inode.c
1249 +@@ -1528,15 +1528,7 @@ xfs_itruncate_finish(
1250 + xfs_trans_log_inode(ntp, ip, XFS_ILOG_CORE);
1251 + }
1252 + }
1253 +- } else if (sync) {
1254 +- ASSERT(!(mp->m_flags & XFS_MOUNT_WSYNC));
1255 +- if (ip->i_d.di_anextents > 0)
1256 +- xfs_trans_set_sync(ntp);
1257 + }
1258 +- ASSERT(fork == XFS_DATA_FORK ||
1259 +- (fork == XFS_ATTR_FORK &&
1260 +- ((sync && !(mp->m_flags & XFS_MOUNT_WSYNC)) ||
1261 +- (sync == 0 && (mp->m_flags & XFS_MOUNT_WSYNC)))));
1262 +
1263 + /*
1264 + * Since it is possible for space to become allocated beyond
1265 +diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
1266 +index 4e4fbb8..14b6cd0 100644
1267 +--- a/include/drm/drm_pciids.h
1268 ++++ b/include/drm/drm_pciids.h
1269 +@@ -182,8 +182,11 @@
1270 + {0x1002, 0x6748, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
1271 + {0x1002, 0x6749, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
1272 + {0x1002, 0x6750, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
1273 ++ {0x1002, 0x6751, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
1274 + {0x1002, 0x6758, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
1275 + {0x1002, 0x6759, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
1276 ++ {0x1002, 0x675B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
1277 ++ {0x1002, 0x675D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
1278 + {0x1002, 0x675F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
1279 + {0x1002, 0x6760, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
1280 + {0x1002, 0x6761, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
1281 +@@ -195,8 +198,10 @@
1282 + {0x1002, 0x6767, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
1283 + {0x1002, 0x6768, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
1284 + {0x1002, 0x6770, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
1285 ++ {0x1002, 0x6772, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
1286 + {0x1002, 0x6778, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
1287 + {0x1002, 0x6779, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
1288 ++ {0x1002, 0x677B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
1289 + {0x1002, 0x6840, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
1290 + {0x1002, 0x6841, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
1291 + {0x1002, 0x6842, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
1292 +@@ -246,6 +251,7 @@
1293 + {0x1002, 0x68f2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
1294 + {0x1002, 0x68f8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
1295 + {0x1002, 0x68f9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
1296 ++ {0x1002, 0x68fa, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
1297 + {0x1002, 0x68fe, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \
1298 + {0x1002, 0x7100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
1299 + {0x1002, 0x7101, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
1300 +@@ -488,6 +494,8 @@
1301 + {0x1002, 0x9647, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\
1302 + {0x1002, 0x9648, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\
1303 + {0x1002, 0x964a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
1304 ++ {0x1002, 0x964b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
1305 ++ {0x1002, 0x964c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
1306 + {0x1002, 0x964e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\
1307 + {0x1002, 0x964f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\
1308 + {0x1002, 0x9710, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
1309 +@@ -502,6 +510,8 @@
1310 + {0x1002, 0x9805, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
1311 + {0x1002, 0x9806, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
1312 + {0x1002, 0x9807, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
1313 ++ {0x1002, 0x9808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
1314 ++ {0x1002, 0x9809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
1315 + {0, 0, 0}
1316 +
1317 + #define r128_PCI_IDS \
1318 +diff --git a/include/linux/dcache.h b/include/linux/dcache.h
1319 +index 19d90a5..8f848e4 100644
1320 +--- a/include/linux/dcache.h
1321 ++++ b/include/linux/dcache.h
1322 +@@ -340,7 +340,8 @@ extern int d_validate(struct dentry *, struct dentry *);
1323 + */
1324 + extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...);
1325 +
1326 +-extern char *__d_path(const struct path *path, struct path *root, char *, int);
1327 ++extern char *__d_path(const struct path *, const struct path *, char *, int);
1328 ++extern char *d_absolute_path(const struct path *, char *, int);
1329 + extern char *d_path(const struct path *, char *, int);
1330 + extern char *d_path_with_unreachable(const struct path *, char *, int);
1331 + extern char *dentry_path_raw(struct dentry *, char *, int);
1332 +diff --git a/include/linux/fs.h b/include/linux/fs.h
1333 +index b5b9792..7b17db7 100644
1334 +--- a/include/linux/fs.h
1335 ++++ b/include/linux/fs.h
1336 +@@ -1882,6 +1882,7 @@ extern int fd_statfs(int, struct kstatfs *);
1337 + extern int statfs_by_dentry(struct dentry *, struct kstatfs *);
1338 + extern int freeze_super(struct super_block *super);
1339 + extern int thaw_super(struct super_block *super);
1340 ++extern bool our_mnt(struct vfsmount *mnt);
1341 +
1342 + extern int current_umask(void);
1343 +
1344 +diff --git a/include/linux/log2.h b/include/linux/log2.h
1345 +index 25b8086..fd7ff3d 100644
1346 +--- a/include/linux/log2.h
1347 ++++ b/include/linux/log2.h
1348 +@@ -185,7 +185,6 @@ unsigned long __rounddown_pow_of_two(unsigned long n)
1349 + #define rounddown_pow_of_two(n) \
1350 + ( \
1351 + __builtin_constant_p(n) ? ( \
1352 +- (n == 1) ? 0 : \
1353 + (1UL << ilog2(n))) : \
1354 + __rounddown_pow_of_two(n) \
1355 + )
1356 +diff --git a/kernel/taskstats.c b/kernel/taskstats.c
1357 +index fc0f220..8d597b1 100644
1358 +--- a/kernel/taskstats.c
1359 ++++ b/kernel/taskstats.c
1360 +@@ -657,6 +657,7 @@ static struct genl_ops taskstats_ops = {
1361 + .cmd = TASKSTATS_CMD_GET,
1362 + .doit = taskstats_user_cmd,
1363 + .policy = taskstats_cmd_get_policy,
1364 ++ .flags = GENL_ADMIN_PERM,
1365 + };
1366 +
1367 + static struct genl_ops cgroupstats_ops = {
1368 +diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
1369 +index ea5e1a9..8b70c76 100644
1370 +--- a/kernel/time/alarmtimer.c
1371 ++++ b/kernel/time/alarmtimer.c
1372 +@@ -181,7 +181,7 @@ static enum hrtimer_restart alarmtimer_fired(struct hrtimer *timer)
1373 + struct alarm *alarm;
1374 + ktime_t expired = next->expires;
1375 +
1376 +- if (expired.tv64 >= now.tv64)
1377 ++ if (expired.tv64 > now.tv64)
1378 + break;
1379 +
1380 + alarm = container_of(next, struct alarm, node);
1381 +diff --git a/mm/hugetlb.c b/mm/hugetlb.c
1382 +index 2b57cd9..80936a1 100644
1383 +--- a/mm/hugetlb.c
1384 ++++ b/mm/hugetlb.c
1385 +@@ -575,6 +575,7 @@ static void prep_compound_gigantic_page(struct page *page, unsigned long order)
1386 + __SetPageHead(page);
1387 + for (i = 1; i < nr_pages; i++, p = mem_map_next(p, page, i)) {
1388 + __SetPageTail(p);
1389 ++ set_page_count(p, 0);
1390 + p->first_page = page;
1391 + }
1392 + }
1393 +diff --git a/mm/page_alloc.c b/mm/page_alloc.c
1394 +index 0f50cdb..8439d2a 100644
1395 +--- a/mm/page_alloc.c
1396 ++++ b/mm/page_alloc.c
1397 +@@ -355,8 +355,8 @@ void prep_compound_page(struct page *page, unsigned long order)
1398 + __SetPageHead(page);
1399 + for (i = 1; i < nr_pages; i++) {
1400 + struct page *p = page + i;
1401 +-
1402 + __SetPageTail(p);
1403 ++ set_page_count(p, 0);
1404 + p->first_page = page;
1405 + }
1406 + }
1407 +@@ -3388,9 +3388,15 @@ static void setup_zone_migrate_reserve(struct zone *zone)
1408 + unsigned long block_migratetype;
1409 + int reserve;
1410 +
1411 +- /* Get the start pfn, end pfn and the number of blocks to reserve */
1412 ++ /*
1413 ++ * Get the start pfn, end pfn and the number of blocks to reserve
1414 ++ * We have to be careful to be aligned to pageblock_nr_pages to
1415 ++ * make sure that we always check pfn_valid for the first page in
1416 ++ * the block.
1417 ++ */
1418 + start_pfn = zone->zone_start_pfn;
1419 + end_pfn = start_pfn + zone->spanned_pages;
1420 ++ start_pfn = roundup(start_pfn, pageblock_nr_pages);
1421 + reserve = roundup(min_wmark_pages(zone), pageblock_nr_pages) >>
1422 + pageblock_order;
1423 +
1424 +diff --git a/mm/percpu-vm.c b/mm/percpu-vm.c
1425 +index ea53496..bfad724 100644
1426 +--- a/mm/percpu-vm.c
1427 ++++ b/mm/percpu-vm.c
1428 +@@ -143,8 +143,8 @@ static void pcpu_pre_unmap_flush(struct pcpu_chunk *chunk,
1429 + int page_start, int page_end)
1430 + {
1431 + flush_cache_vunmap(
1432 +- pcpu_chunk_addr(chunk, pcpu_first_unit_cpu, page_start),
1433 +- pcpu_chunk_addr(chunk, pcpu_last_unit_cpu, page_end));
1434 ++ pcpu_chunk_addr(chunk, pcpu_low_unit_cpu, page_start),
1435 ++ pcpu_chunk_addr(chunk, pcpu_high_unit_cpu, page_end));
1436 + }
1437 +
1438 + static void __pcpu_unmap_pages(unsigned long addr, int nr_pages)
1439 +@@ -206,8 +206,8 @@ static void pcpu_post_unmap_tlb_flush(struct pcpu_chunk *chunk,
1440 + int page_start, int page_end)
1441 + {
1442 + flush_tlb_kernel_range(
1443 +- pcpu_chunk_addr(chunk, pcpu_first_unit_cpu, page_start),
1444 +- pcpu_chunk_addr(chunk, pcpu_last_unit_cpu, page_end));
1445 ++ pcpu_chunk_addr(chunk, pcpu_low_unit_cpu, page_start),
1446 ++ pcpu_chunk_addr(chunk, pcpu_high_unit_cpu, page_end));
1447 + }
1448 +
1449 + static int __pcpu_map_pages(unsigned long addr, struct page **pages,
1450 +@@ -284,8 +284,8 @@ static void pcpu_post_map_flush(struct pcpu_chunk *chunk,
1451 + int page_start, int page_end)
1452 + {
1453 + flush_cache_vmap(
1454 +- pcpu_chunk_addr(chunk, pcpu_first_unit_cpu, page_start),
1455 +- pcpu_chunk_addr(chunk, pcpu_last_unit_cpu, page_end));
1456 ++ pcpu_chunk_addr(chunk, pcpu_low_unit_cpu, page_start),
1457 ++ pcpu_chunk_addr(chunk, pcpu_high_unit_cpu, page_end));
1458 + }
1459 +
1460 + /**
1461 +diff --git a/mm/percpu.c b/mm/percpu.c
1462 +index bf80e55..93b5a7c 100644
1463 +--- a/mm/percpu.c
1464 ++++ b/mm/percpu.c
1465 +@@ -116,9 +116,9 @@ static int pcpu_atom_size __read_mostly;
1466 + static int pcpu_nr_slots __read_mostly;
1467 + static size_t pcpu_chunk_struct_size __read_mostly;
1468 +
1469 +-/* cpus with the lowest and highest unit numbers */
1470 +-static unsigned int pcpu_first_unit_cpu __read_mostly;
1471 +-static unsigned int pcpu_last_unit_cpu __read_mostly;
1472 ++/* cpus with the lowest and highest unit addresses */
1473 ++static unsigned int pcpu_low_unit_cpu __read_mostly;
1474 ++static unsigned int pcpu_high_unit_cpu __read_mostly;
1475 +
1476 + /* the address of the first chunk which starts with the kernel static area */
1477 + void *pcpu_base_addr __read_mostly;
1478 +@@ -984,19 +984,19 @@ phys_addr_t per_cpu_ptr_to_phys(void *addr)
1479 + {
1480 + void __percpu *base = __addr_to_pcpu_ptr(pcpu_base_addr);
1481 + bool in_first_chunk = false;
1482 +- unsigned long first_start, first_end;
1483 ++ unsigned long first_low, first_high;
1484 + unsigned int cpu;
1485 +
1486 + /*
1487 +- * The following test on first_start/end isn't strictly
1488 ++ * The following test on unit_low/high isn't strictly
1489 + * necessary but will speed up lookups of addresses which
1490 + * aren't in the first chunk.
1491 + */
1492 +- first_start = pcpu_chunk_addr(pcpu_first_chunk, pcpu_first_unit_cpu, 0);
1493 +- first_end = pcpu_chunk_addr(pcpu_first_chunk, pcpu_last_unit_cpu,
1494 +- pcpu_unit_pages);
1495 +- if ((unsigned long)addr >= first_start &&
1496 +- (unsigned long)addr < first_end) {
1497 ++ first_low = pcpu_chunk_addr(pcpu_first_chunk, pcpu_low_unit_cpu, 0);
1498 ++ first_high = pcpu_chunk_addr(pcpu_first_chunk, pcpu_high_unit_cpu,
1499 ++ pcpu_unit_pages);
1500 ++ if ((unsigned long)addr >= first_low &&
1501 ++ (unsigned long)addr < first_high) {
1502 + for_each_possible_cpu(cpu) {
1503 + void *start = per_cpu_ptr(base, cpu);
1504 +
1505 +@@ -1233,7 +1233,9 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
1506 +
1507 + for (cpu = 0; cpu < nr_cpu_ids; cpu++)
1508 + unit_map[cpu] = UINT_MAX;
1509 +- pcpu_first_unit_cpu = NR_CPUS;
1510 ++
1511 ++ pcpu_low_unit_cpu = NR_CPUS;
1512 ++ pcpu_high_unit_cpu = NR_CPUS;
1513 +
1514 + for (group = 0, unit = 0; group < ai->nr_groups; group++, unit += i) {
1515 + const struct pcpu_group_info *gi = &ai->groups[group];
1516 +@@ -1253,9 +1255,13 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
1517 + unit_map[cpu] = unit + i;
1518 + unit_off[cpu] = gi->base_offset + i * ai->unit_size;
1519 +
1520 +- if (pcpu_first_unit_cpu == NR_CPUS)
1521 +- pcpu_first_unit_cpu = cpu;
1522 +- pcpu_last_unit_cpu = cpu;
1523 ++ /* determine low/high unit_cpu */
1524 ++ if (pcpu_low_unit_cpu == NR_CPUS ||
1525 ++ unit_off[cpu] < unit_off[pcpu_low_unit_cpu])
1526 ++ pcpu_low_unit_cpu = cpu;
1527 ++ if (pcpu_high_unit_cpu == NR_CPUS ||
1528 ++ unit_off[cpu] > unit_off[pcpu_high_unit_cpu])
1529 ++ pcpu_high_unit_cpu = cpu;
1530 + }
1531 + }
1532 + pcpu_nr_units = unit;
1533 +diff --git a/mm/vmalloc.c b/mm/vmalloc.c
1534 +index 65d5fd2..43b44db 100644
1535 +--- a/mm/vmalloc.c
1536 ++++ b/mm/vmalloc.c
1537 +@@ -1648,6 +1648,8 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align,
1538 + return NULL;
1539 +
1540 + addr = __vmalloc_area_node(area, gfp_mask, prot, node, caller);
1541 ++ if (!addr)
1542 ++ return NULL;
1543 +
1544 + /*
1545 + * In this function, newly allocated vm_struct is not added
1546 +diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
1547 +index 42a59c2..db7db43 100644
1548 +--- a/net/mac80211/agg-tx.c
1549 ++++ b/net/mac80211/agg-tx.c
1550 +@@ -792,12 +792,27 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local,
1551 + goto out;
1552 + }
1553 +
1554 +- del_timer(&tid_tx->addba_resp_timer);
1555 ++ del_timer_sync(&tid_tx->addba_resp_timer);
1556 +
1557 + #ifdef CONFIG_MAC80211_HT_DEBUG
1558 + printk(KERN_DEBUG "switched off addBA timer for tid %d\n", tid);
1559 + #endif
1560 +
1561 ++ /*
1562 ++ * addba_resp_timer may have fired before we got here, and
1563 ++ * caused WANT_STOP to be set. If the stop then was already
1564 ++ * processed further, STOPPING might be set.
1565 ++ */
1566 ++ if (test_bit(HT_AGG_STATE_WANT_STOP, &tid_tx->state) ||
1567 ++ test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) {
1568 ++#ifdef CONFIG_MAC80211_HT_DEBUG
1569 ++ printk(KERN_DEBUG
1570 ++ "got addBA resp for tid %d but we already gave up\n",
1571 ++ tid);
1572 ++#endif
1573 ++ goto out;
1574 ++ }
1575 ++
1576 + if (le16_to_cpu(mgmt->u.action.u.addba_resp.status)
1577 + == WLAN_STATUS_SUCCESS) {
1578 + /*
1579 +diff --git a/security/apparmor/path.c b/security/apparmor/path.c
1580 +index 36cc0cc..b566eba 100644
1581 +--- a/security/apparmor/path.c
1582 ++++ b/security/apparmor/path.c
1583 +@@ -57,23 +57,44 @@ static int prepend(char **buffer, int buflen, const char *str, int namelen)
1584 + static int d_namespace_path(struct path *path, char *buf, int buflen,
1585 + char **name, int flags)
1586 + {
1587 +- struct path root, tmp;
1588 + char *res;
1589 +- int connected, error = 0;
1590 ++ int error = 0;
1591 ++ int connected = 1;
1592 ++
1593 ++ if (path->mnt->mnt_flags & MNT_INTERNAL) {
1594 ++ /* it's not mounted anywhere */
1595 ++ res = dentry_path(path->dentry, buf, buflen);
1596 ++ *name = res;
1597 ++ if (IS_ERR(res)) {
1598 ++ *name = buf;
1599 ++ return PTR_ERR(res);
1600 ++ }
1601 ++ if (path->dentry->d_sb->s_magic == PROC_SUPER_MAGIC &&
1602 ++ strncmp(*name, "/sys/", 5) == 0) {
1603 ++ /* TODO: convert over to using a per namespace
1604 ++ * control instead of hard coded /proc
1605 ++ */
1606 ++ return prepend(name, *name - buf, "/proc", 5);
1607 ++ }
1608 ++ return 0;
1609 ++ }
1610 +
1611 +- /* Get the root we want to resolve too, released below */
1612 ++ /* resolve paths relative to chroot?*/
1613 + if (flags & PATH_CHROOT_REL) {
1614 +- /* resolve paths relative to chroot */
1615 ++ struct path root;
1616 + get_fs_root(current->fs, &root);
1617 +- } else {
1618 +- /* resolve paths relative to namespace */
1619 +- root.mnt = current->nsproxy->mnt_ns->root;
1620 +- root.dentry = root.mnt->mnt_root;
1621 +- path_get(&root);
1622 ++ res = __d_path(path, &root, buf, buflen);
1623 ++ if (res && !IS_ERR(res)) {
1624 ++ /* everything's fine */
1625 ++ *name = res;
1626 ++ path_put(&root);
1627 ++ goto ok;
1628 ++ }
1629 ++ path_put(&root);
1630 ++ connected = 0;
1631 + }
1632 +
1633 +- tmp = root;
1634 +- res = __d_path(path, &tmp, buf, buflen);
1635 ++ res = d_absolute_path(path, buf, buflen);
1636 +
1637 + *name = res;
1638 + /* handle error conditions - and still allow a partial path to
1639 +@@ -84,7 +105,10 @@ static int d_namespace_path(struct path *path, char *buf, int buflen,
1640 + *name = buf;
1641 + goto out;
1642 + }
1643 ++ if (!our_mnt(path->mnt))
1644 ++ connected = 0;
1645 +
1646 ++ok:
1647 + /* Handle two cases:
1648 + * 1. A deleted dentry && profile is not allowing mediation of deleted
1649 + * 2. On some filesystems, newly allocated dentries appear to the
1650 +@@ -97,10 +121,7 @@ static int d_namespace_path(struct path *path, char *buf, int buflen,
1651 + goto out;
1652 + }
1653 +
1654 +- /* Determine if the path is connected to the expected root */
1655 +- connected = tmp.dentry == root.dentry && tmp.mnt == root.mnt;
1656 +-
1657 +- /* If the path is not connected,
1658 ++ /* If the path is not connected to the expected root,
1659 + * check if it is a sysctl and handle specially else remove any
1660 + * leading / that __d_path may have returned.
1661 + * Unless
1662 +@@ -112,17 +133,9 @@ static int d_namespace_path(struct path *path, char *buf, int buflen,
1663 + * namespace root.
1664 + */
1665 + if (!connected) {
1666 +- /* is the disconnect path a sysctl? */
1667 +- if (tmp.dentry->d_sb->s_magic == PROC_SUPER_MAGIC &&
1668 +- strncmp(*name, "/sys/", 5) == 0) {
1669 +- /* TODO: convert over to using a per namespace
1670 +- * control instead of hard coded /proc
1671 +- */
1672 +- error = prepend(name, *name - buf, "/proc", 5);
1673 +- } else if (!(flags & PATH_CONNECT_PATH) &&
1674 ++ if (!(flags & PATH_CONNECT_PATH) &&
1675 + !(((flags & CHROOT_NSCONNECT) == CHROOT_NSCONNECT) &&
1676 +- (tmp.mnt == current->nsproxy->mnt_ns->root &&
1677 +- tmp.dentry == tmp.mnt->mnt_root))) {
1678 ++ our_mnt(path->mnt))) {
1679 + /* disconnected path, don't return pathname starting
1680 + * with '/'
1681 + */
1682 +@@ -133,8 +146,6 @@ static int d_namespace_path(struct path *path, char *buf, int buflen,
1683 + }
1684 +
1685 + out:
1686 +- path_put(&root);
1687 +-
1688 + return error;
1689 + }
1690 +
1691 +diff --git a/security/tomoyo/realpath.c b/security/tomoyo/realpath.c
1692 +index d1e05b0..a339187 100644
1693 +--- a/security/tomoyo/realpath.c
1694 ++++ b/security/tomoyo/realpath.c
1695 +@@ -95,7 +95,6 @@ char *tomoyo_realpath_from_path(struct path *path)
1696 + return NULL;
1697 + is_dir = dentry->d_inode && S_ISDIR(dentry->d_inode->i_mode);
1698 + while (1) {
1699 +- struct path ns_root = { .mnt = NULL, .dentry = NULL };
1700 + char *pos;
1701 + buf_len <<= 1;
1702 + kfree(buf);
1703 +@@ -128,8 +127,12 @@ char *tomoyo_realpath_from_path(struct path *path)
1704 + /* If we don't have a vfsmount, we can't calculate. */
1705 + if (!path->mnt)
1706 + break;
1707 +- /* go to whatever namespace root we are under */
1708 +- pos = __d_path(path, &ns_root, buf, buf_len);
1709 ++ pos = d_absolute_path(path, buf, buf_len - 1);
1710 ++ /* If path is disconnected, use "[unknown]" instead. */
1711 ++ if (pos == ERR_PTR(-EINVAL)) {
1712 ++ name = tomoyo_encode("[unknown]");
1713 ++ break;
1714 ++ }
1715 + /* Prepend "/proc" prefix if using internal proc vfs mount. */
1716 + if (!IS_ERR(pos) && (path->mnt->mnt_flags & MNT_INTERNAL) &&
1717 + (path->mnt->mnt_sb->s_magic == PROC_SUPER_MAGIC)) {
1718 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
1719 +index e7dc034..eb0a141 100644
1720 +--- a/sound/pci/hda/patch_realtek.c
1721 ++++ b/sound/pci/hda/patch_realtek.c
1722 +@@ -509,6 +509,8 @@ static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
1723 + imux = &spec->input_mux[mux_idx];
1724 + if (!imux->num_items && mux_idx > 0)
1725 + imux = &spec->input_mux[0];
1726 ++ if (!imux->num_items)
1727 ++ return 0;
1728 +
1729 + type = get_wcaps_type(get_wcaps(codec, nid));
1730 + if (type == AC_WID_AUD_MIX) {
1731 +diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c
1732 +index 2b5c7a95..5fe840b 100644
1733 +--- a/sound/pci/sis7019.c
1734 ++++ b/sound/pci/sis7019.c
1735 +@@ -41,6 +41,7 @@ MODULE_SUPPORTED_DEVICE("{{SiS,SiS7019 Audio Accelerator}}");
1736 + static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */
1737 + static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */
1738 + static int enable = 1;
1739 ++static int codecs = 1;
1740 +
1741 + module_param(index, int, 0444);
1742 + MODULE_PARM_DESC(index, "Index value for SiS7019 Audio Accelerator.");
1743 +@@ -48,6 +49,8 @@ module_param(id, charp, 0444);
1744 + MODULE_PARM_DESC(id, "ID string for SiS7019 Audio Accelerator.");
1745 + module_param(enable, bool, 0444);
1746 + MODULE_PARM_DESC(enable, "Enable SiS7019 Audio Accelerator.");
1747 ++module_param(codecs, int, 0444);
1748 ++MODULE_PARM_DESC(codecs, "Set bit to indicate that codec number is expected to be present (default 1)");
1749 +
1750 + static DEFINE_PCI_DEVICE_TABLE(snd_sis7019_ids) = {
1751 + { PCI_DEVICE(PCI_VENDOR_ID_SI, 0x7019) },
1752 +@@ -140,6 +143,9 @@ struct sis7019 {
1753 + dma_addr_t silence_dma_addr;
1754 + };
1755 +
1756 ++/* These values are also used by the module param 'codecs' to indicate
1757 ++ * which codecs should be present.
1758 ++ */
1759 + #define SIS_PRIMARY_CODEC_PRESENT 0x0001
1760 + #define SIS_SECONDARY_CODEC_PRESENT 0x0002
1761 + #define SIS_TERTIARY_CODEC_PRESENT 0x0004
1762 +@@ -1078,6 +1084,7 @@ static int sis_chip_init(struct sis7019 *sis)
1763 + {
1764 + unsigned long io = sis->ioport;
1765 + void __iomem *ioaddr = sis->ioaddr;
1766 ++ unsigned long timeout;
1767 + u16 status;
1768 + int count;
1769 + int i;
1770 +@@ -1104,21 +1111,45 @@ static int sis_chip_init(struct sis7019 *sis)
1771 + while ((inw(io + SIS_AC97_STATUS) & SIS_AC97_STATUS_BUSY) && --count)
1772 + udelay(1);
1773 +
1774 ++ /* Command complete, we can let go of the semaphore now.
1775 ++ */
1776 ++ outl(SIS_AC97_SEMA_RELEASE, io + SIS_AC97_SEMA);
1777 ++ if (!count)
1778 ++ return -EIO;
1779 ++
1780 + /* Now that we've finished the reset, find out what's attached.
1781 ++ * There are some codec/board combinations that take an extremely
1782 ++ * long time to come up. 350+ ms has been observed in the field,
1783 ++ * so we'll give them up to 500ms.
1784 + */
1785 +- status = inl(io + SIS_AC97_STATUS);
1786 +- if (status & SIS_AC97_STATUS_CODEC_READY)
1787 +- sis->codecs_present |= SIS_PRIMARY_CODEC_PRESENT;
1788 +- if (status & SIS_AC97_STATUS_CODEC2_READY)
1789 +- sis->codecs_present |= SIS_SECONDARY_CODEC_PRESENT;
1790 +- if (status & SIS_AC97_STATUS_CODEC3_READY)
1791 +- sis->codecs_present |= SIS_TERTIARY_CODEC_PRESENT;
1792 +-
1793 +- /* All done, let go of the semaphore, and check for errors
1794 ++ sis->codecs_present = 0;
1795 ++ timeout = msecs_to_jiffies(500) + jiffies;
1796 ++ while (time_before_eq(jiffies, timeout)) {
1797 ++ status = inl(io + SIS_AC97_STATUS);
1798 ++ if (status & SIS_AC97_STATUS_CODEC_READY)
1799 ++ sis->codecs_present |= SIS_PRIMARY_CODEC_PRESENT;
1800 ++ if (status & SIS_AC97_STATUS_CODEC2_READY)
1801 ++ sis->codecs_present |= SIS_SECONDARY_CODEC_PRESENT;
1802 ++ if (status & SIS_AC97_STATUS_CODEC3_READY)
1803 ++ sis->codecs_present |= SIS_TERTIARY_CODEC_PRESENT;
1804 ++
1805 ++ if (sis->codecs_present == codecs)
1806 ++ break;
1807 ++
1808 ++ msleep(1);
1809 ++ }
1810 ++
1811 ++ /* All done, check for errors.
1812 + */
1813 +- outl(SIS_AC97_SEMA_RELEASE, io + SIS_AC97_SEMA);
1814 +- if (!sis->codecs_present || !count)
1815 ++ if (!sis->codecs_present) {
1816 ++ printk(KERN_ERR "sis7019: could not find any codecs\n");
1817 + return -EIO;
1818 ++ }
1819 ++
1820 ++ if (sis->codecs_present != codecs) {
1821 ++ printk(KERN_WARNING "sis7019: missing codecs, found %0x, expected %0x\n",
1822 ++ sis->codecs_present, codecs);
1823 ++ }
1824 +
1825 + /* Let the hardware know that the audio driver is alive,
1826 + * and enable PCM slots on the AC-link for L/R playback (3 & 4) and
1827 +@@ -1390,6 +1421,17 @@ static int __devinit snd_sis7019_probe(struct pci_dev *pci,
1828 + if (!enable)
1829 + goto error_out;
1830 +
1831 ++ /* The user can specify which codecs should be present so that we
1832 ++ * can wait for them to show up if they are slow to recover from
1833 ++ * the AC97 cold reset. We default to a single codec, the primary.
1834 ++ *
1835 ++ * We assume that SIS_PRIMARY_*_PRESENT matches bits 0-2.
1836 ++ */
1837 ++ codecs &= SIS_PRIMARY_CODEC_PRESENT | SIS_SECONDARY_CODEC_PRESENT |
1838 ++ SIS_TERTIARY_CODEC_PRESENT;
1839 ++ if (!codecs)
1840 ++ codecs = SIS_PRIMARY_CODEC_PRESENT;
1841 ++
1842 + rc = snd_card_create(index, id, THIS_MODULE, sizeof(*sis), &card);
1843 + if (rc < 0)
1844 + goto error_out;
1845 +diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
1846 +index 59abd84..493ae7c 100644
1847 +--- a/sound/soc/soc-core.c
1848 ++++ b/sound/soc/soc-core.c
1849 +@@ -1257,7 +1257,7 @@ static void soc_resume_deferred(struct work_struct *work)
1850 + int snd_soc_resume(struct device *dev)
1851 + {
1852 + struct snd_soc_card *card = dev_get_drvdata(dev);
1853 +- int i;
1854 ++ int i, ac97_control = 0;
1855 +
1856 + /* AC97 devices might have other drivers hanging off them so
1857 + * need to resume immediately. Other drivers don't have that
1858 +@@ -1266,14 +1266,15 @@ int snd_soc_resume(struct device *dev)
1859 + */
1860 + for (i = 0; i < card->num_rtd; i++) {
1861 + struct snd_soc_dai *cpu_dai = card->rtd[i].cpu_dai;
1862 +- if (cpu_dai->driver->ac97_control) {
1863 +- dev_dbg(dev, "Resuming AC97 immediately\n");
1864 +- soc_resume_deferred(&card->deferred_resume_work);
1865 +- } else {
1866 +- dev_dbg(dev, "Scheduling resume work\n");
1867 +- if (!schedule_work(&card->deferred_resume_work))
1868 +- dev_err(dev, "resume work item may be lost\n");
1869 +- }
1870 ++ ac97_control |= cpu_dai->driver->ac97_control;
1871 ++ }
1872 ++ if (ac97_control) {
1873 ++ dev_dbg(dev, "Resuming AC97 immediately\n");
1874 ++ soc_resume_deferred(&card->deferred_resume_work);
1875 ++ } else {
1876 ++ dev_dbg(dev, "Scheduling resume work\n");
1877 ++ if (!schedule_work(&card->deferred_resume_work))
1878 ++ dev_err(dev, "resume work item may be lost\n");
1879 + }
1880 +
1881 + return 0;
1882 +diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c
1883 +index ec921ec..cd987de 100644
1884 +--- a/sound/soc/soc-utils.c
1885 ++++ b/sound/soc/soc-utils.c
1886 +@@ -57,7 +57,36 @@ int snd_soc_params_to_bclk(struct snd_pcm_hw_params *params)
1887 + }
1888 + EXPORT_SYMBOL_GPL(snd_soc_params_to_bclk);
1889 +
1890 +-static struct snd_soc_platform_driver dummy_platform;
1891 ++static const struct snd_pcm_hardware dummy_dma_hardware = {
1892 ++ .formats = 0xffffffff,
1893 ++ .channels_min = 1,
1894 ++ .channels_max = UINT_MAX,
1895 ++
1896 ++ /* Random values to keep userspace happy when checking constraints */
1897 ++ .info = SNDRV_PCM_INFO_INTERLEAVED |
1898 ++ SNDRV_PCM_INFO_BLOCK_TRANSFER,
1899 ++ .buffer_bytes_max = 128*1024,
1900 ++ .period_bytes_min = PAGE_SIZE,
1901 ++ .period_bytes_max = PAGE_SIZE*2,
1902 ++ .periods_min = 2,
1903 ++ .periods_max = 128,
1904 ++};
1905 ++
1906 ++static int dummy_dma_open(struct snd_pcm_substream *substream)
1907 ++{
1908 ++ snd_soc_set_runtime_hwparams(substream, &dummy_dma_hardware);
1909 ++
1910 ++ return 0;
1911 ++}
1912 ++
1913 ++static struct snd_pcm_ops dummy_dma_ops = {
1914 ++ .open = dummy_dma_open,
1915 ++ .ioctl = snd_pcm_lib_ioctl,
1916 ++};
1917 ++
1918 ++static struct snd_soc_platform_driver dummy_platform = {
1919 ++ .ops = &dummy_dma_ops,
1920 ++};
1921 +
1922 + static __devinit int snd_soc_dummy_probe(struct platform_device *pdev)
1923 + {