Gentoo Archives: gentoo-commits

From: "Daniel Drake (dsd)" <dsd@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] linux-patches r1418 - genpatches-2.6/trunk/2.6.28
Date: Fri, 05 Dec 2008 00:43:30
Message-Id: E1L8Omj-0002NP-Sj@stork.gentoo.org
1 Author: dsd
2 Date: 2008-12-05 00:43:09 +0000 (Fri, 05 Dec 2008)
3 New Revision: 1418
4
5 Removed:
6 genpatches-2.6/trunk/2.6.28/1000_linux-2.6.27.1.patch
7 genpatches-2.6/trunk/2.6.28/1001_linux-2.6.27.2.patch
8 genpatches-2.6/trunk/2.6.28/1002_linux-2.6.27.3.patch
9 genpatches-2.6/trunk/2.6.28/1003_linux-2.6.27.4.patch
10 genpatches-2.6/trunk/2.6.28/1004_linux-2.6.27.5.patch
11 genpatches-2.6/trunk/2.6.28/1005_linux-2.6.27.6.patch
12 genpatches-2.6/trunk/2.6.28/1006_linux-2.6.27.7.patch
13 genpatches-2.6/trunk/2.6.28/1500_inotify-watch-removal-race.patch
14 genpatches-2.6/trunk/2.6.28/1700_HP-laptop-dmi-quirk-fix.patch
15 genpatches-2.6/trunk/2.6.28/2001_setkey-policy-breakage-fix.patch
16 genpatches-2.6/trunk/2.6.28/2200_sb600-acpi-irq0-override.patch
17 Modified:
18 genpatches-2.6/trunk/2.6.28/0000_README
19 Log:
20 remove merged patches
21
22 Modified: genpatches-2.6/trunk/2.6.28/0000_README
23 ===================================================================
24 --- genpatches-2.6/trunk/2.6.28/0000_README 2008-12-05 00:39:44 UTC (rev 1417)
25 +++ genpatches-2.6/trunk/2.6.28/0000_README 2008-12-05 00:43:09 UTC (rev 1418)
26 @@ -39,50 +39,6 @@
27 Individual Patch Descriptions:
28 --------------------------------------------------------------------------
29
30 -Patch: 1000_linux-2.6.27.1.patch
31 -From: http://www.kernel.org
32 -Desc: Linux 2.6.27.1
33 -
34 -Patch: 1001_linux-2.6.27.2.patch
35 -From: http://www.kernel.org
36 -Desc: Linux 2.6.27.2
37 -
38 -Patch: 1002_linux-2.6.27.3.patch
39 -From: http://www.kernel.org
40 -Desc: Linux 2.6.27.3
41 -
42 -Patch: 1003_linux-2.6.27.4.patch
43 -From: http://www.kernel.org
44 -Desc: Linux 2.6.27.4
45 -
46 -Patch: 1004_linux-2.6.27.5.patch
47 -From: http://www.kernel.org
48 -Desc: Linux 2.6.27.5
49 -
50 -Patch: 1005_linux-2.6.27.6.patch
51 -From: http://www.kernel.org
52 -Desc: Linux 2.6.27.6
53 -
54 -Patch: 1006_linux-2.6.27.7.patch
55 -From: http://www.kernel.org
56 -Desc: Linux 2.6.27.7
57 -
58 -Patch: 1500_inotify-watch-removal-race.patch
59 -From: http://bugs.gentoo.org/248754
60 -Desc: Fix potential inotify watch removal race
61 -
62 -Patch: 1700_HP-laptop-dmi-quirk-fix.patch
63 -From: http://bugs.gentoo.org/show_bug.cgi?id=245158
64 -Desc: dmi quirk call fix for HP laptops
65 -
66 -Patch: 2001_setkey-policy-breakage-fix.patch
67 -From: http://bugs.gentoo.org/show_bug.cgi?id=245369
68 -Desc: Patch to fix setkey policy breakage
69 -
70 -Patch: 2200_sb600-acpi-irq0-override.patch
71 -From: http://bugs.gentoo.org/245158
72 -Desc: Fix ACPI-related performance degradation on HP laptops
73 -
74 Patch: 2700_hda-asus-mic-input.patch
75 From: http://bugs.gentoo.org/235732
76 Desc: Fix microphone input regression on Asus laptops
77
78 Deleted: genpatches-2.6/trunk/2.6.28/1000_linux-2.6.27.1.patch
79 ===================================================================
80 --- genpatches-2.6/trunk/2.6.28/1000_linux-2.6.27.1.patch 2008-12-05 00:39:44 UTC (rev 1417)
81 +++ genpatches-2.6/trunk/2.6.28/1000_linux-2.6.27.1.patch 2008-12-05 00:43:09 UTC (rev 1418)
82 @@ -1,14 +0,0 @@
83 -diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
84 -index 263e9e6..aa53fdd 100644
85 ---- a/kernel/trace/Kconfig
86 -+++ b/kernel/trace/Kconfig
87 -@@ -103,7 +103,8 @@ config CONTEXT_SWITCH_TRACER
88 - all switching of tasks.
89 -
90 - config DYNAMIC_FTRACE
91 -- bool "enable/disable ftrace tracepoints dynamically"
92 -+ bool "enable/disable ftrace tracepoints dynamically (BROKEN)"
93 -+ depends on BROKEN
94 - depends on FTRACE
95 - depends on HAVE_DYNAMIC_FTRACE
96 - default y
97
98 Deleted: genpatches-2.6/trunk/2.6.28/1001_linux-2.6.27.2.patch
99 ===================================================================
100 --- genpatches-2.6/trunk/2.6.28/1001_linux-2.6.27.2.patch 2008-12-05 00:39:44 UTC (rev 1417)
101 +++ genpatches-2.6/trunk/2.6.28/1001_linux-2.6.27.2.patch 2008-12-05 00:43:09 UTC (rev 1418)
102 @@ -1,567 +0,0 @@
103 -diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
104 -index 65a0c1b..f509cfc 100644
105 ---- a/arch/x86/kernel/alternative.c
106 -+++ b/arch/x86/kernel/alternative.c
107 -@@ -444,7 +444,7 @@ void __init alternative_instructions(void)
108 - _text, _etext);
109 -
110 - /* Only switch to UP mode if we don't immediately boot others */
111 -- if (num_possible_cpus() == 1 || setup_max_cpus <= 1)
112 -+ if (num_present_cpus() == 1 || setup_max_cpus <= 1)
113 - alternatives_smp_switch(0);
114 - }
115 - #endif
116 -diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
117 -index 4353cf5..6b839b1 100644
118 ---- a/arch/x86/kernel/early-quirks.c
119 -+++ b/arch/x86/kernel/early-quirks.c
120 -@@ -95,6 +95,52 @@ static void __init nvidia_bugs(int num, int slot, int func)
121 -
122 - }
123 -
124 -+static u32 ati_ixp4x0_rev(int num, int slot, int func)
125 -+{
126 -+ u32 d;
127 -+ u8 b;
128 -+
129 -+ b = read_pci_config_byte(num, slot, func, 0xac);
130 -+ b &= ~(1<<5);
131 -+ write_pci_config_byte(num, slot, func, 0xac, b);
132 -+
133 -+ d = read_pci_config(num, slot, func, 0x70);
134 -+ d |= 1<<8;
135 -+ write_pci_config(num, slot, func, 0x70, d);
136 -+
137 -+ d = read_pci_config(num, slot, func, 0x8);
138 -+ d &= 0xff;
139 -+ return d;
140 -+}
141 -+
142 -+static void __init ati_bugs(int num, int slot, int func)
143 -+{
144 -+#if defined(CONFIG_ACPI) && defined (CONFIG_X86_IO_APIC)
145 -+ u32 d;
146 -+ u8 b;
147 -+
148 -+ if (acpi_use_timer_override)
149 -+ return;
150 -+
151 -+ d = ati_ixp4x0_rev(num, slot, func);
152 -+ if (d < 0x82)
153 -+ acpi_skip_timer_override = 1;
154 -+ else {
155 -+ /* check for IRQ0 interrupt swap */
156 -+ outb(0x72, 0xcd6); b = inb(0xcd7);
157 -+ if (!(b & 0x2))
158 -+ acpi_skip_timer_override = 1;
159 -+ }
160 -+
161 -+ if (acpi_skip_timer_override) {
162 -+ printk(KERN_INFO "SB4X0 revision 0x%x\n", d);
163 -+ printk(KERN_INFO "Ignoring ACPI timer override.\n");
164 -+ printk(KERN_INFO "If you got timer trouble "
165 -+ "try acpi_use_timer_override\n");
166 -+ }
167 -+#endif
168 -+}
169 -+
170 - #define QFLAG_APPLY_ONCE 0x1
171 - #define QFLAG_APPLIED 0x2
172 - #define QFLAG_DONE (QFLAG_APPLY_ONCE|QFLAG_APPLIED)
173 -@@ -114,6 +160,8 @@ static struct chipset early_qrk[] __initdata = {
174 - PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, QFLAG_APPLY_ONCE, via_bugs },
175 - { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB,
176 - PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, fix_hypertransport_config },
177 -+ { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_SMBUS,
178 -+ PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs },
179 - {}
180 - };
181 -
182 -diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
183 -index 09cddb5..bfd9fc5 100644
184 ---- a/arch/x86/kernel/io_apic_32.c
185 -+++ b/arch/x86/kernel/io_apic_32.c
186 -@@ -2314,6 +2314,9 @@ void __init setup_IO_APIC(void)
187 - for (i = first_system_vector; i < NR_VECTORS; i++)
188 - set_bit(i, used_vectors);
189 -
190 -+ /* Mark FIRST_DEVICE_VECTOR which is assigned to IRQ0 as used. */
191 -+ set_bit(FIRST_DEVICE_VECTOR, used_vectors);
192 -+
193 - enable_IO_APIC();
194 -
195 - io_apic_irqs = ~PIC_IRQS;
196 -diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
197 -index d4b6e6a..d0975fc 100644
198 ---- a/arch/x86/mm/ioremap.c
199 -+++ b/arch/x86/mm/ioremap.c
200 -@@ -595,7 +595,7 @@ void __init *early_ioremap(unsigned long phys_addr, unsigned long size)
201 - */
202 - offset = phys_addr & ~PAGE_MASK;
203 - phys_addr &= PAGE_MASK;
204 -- size = PAGE_ALIGN(last_addr) - phys_addr;
205 -+ size = PAGE_ALIGN(last_addr + 1) - phys_addr;
206 -
207 - /*
208 - * Mappings have to fit in the FIX_BTMAP area.
209 -diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
210 -index e4dce87..0232485 100644
211 ---- a/drivers/char/tty_io.c
212 -+++ b/drivers/char/tty_io.c
213 -@@ -2996,7 +2996,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
214 - case TIOCSTI:
215 - return tiocsti(tty, p);
216 - case TIOCGWINSZ:
217 -- return tiocgwinsz(tty, p);
218 -+ return tiocgwinsz(real_tty, p);
219 - case TIOCSWINSZ:
220 - return tiocswinsz(tty, real_tty, p);
221 - case TIOCCONS:
222 -diff --git a/drivers/net/atl1e/atl1e_main.c b/drivers/net/atl1e/atl1e_main.c
223 -index 7685b99..9b60352 100644
224 ---- a/drivers/net/atl1e/atl1e_main.c
225 -+++ b/drivers/net/atl1e/atl1e_main.c
226 -@@ -2390,9 +2390,7 @@ static int __devinit atl1e_probe(struct pci_dev *pdev,
227 - }
228 -
229 - /* Init GPHY as early as possible due to power saving issue */
230 -- spin_lock(&adapter->mdio_lock);
231 - atl1e_phy_init(&adapter->hw);
232 -- spin_unlock(&adapter->mdio_lock);
233 - /* reset the controller to
234 - * put the device in a known good starting state */
235 - err = atl1e_reset_hw(&adapter->hw);
236 -diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
237 -index e24b25c..b4be33a 100644
238 ---- a/drivers/net/sky2.c
239 -+++ b/drivers/net/sky2.c
240 -@@ -3034,7 +3034,8 @@ static int sky2_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
241 - struct sky2_port *sky2 = netdev_priv(dev);
242 - struct sky2_hw *hw = sky2->hw;
243 -
244 -- if (wol->wolopts & ~sky2_wol_supported(sky2->hw))
245 -+ if ((wol->wolopts & ~sky2_wol_supported(sky2->hw))
246 -+ || !device_can_wakeup(&hw->pdev->dev))
247 - return -EOPNOTSUPP;
248 -
249 - sky2->wol = wol->wolopts;
250 -@@ -3045,6 +3046,8 @@ static int sky2_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
251 - sky2_write32(hw, B0_CTST, sky2->wol
252 - ? Y2_HW_WOL_ON : Y2_HW_WOL_OFF);
253 -
254 -+ device_set_wakeup_enable(&hw->pdev->dev, sky2->wol);
255 -+
256 - if (!netif_running(dev))
257 - sky2_wol_init(sky2);
258 - return 0;
259 -@@ -4166,18 +4169,6 @@ static int __devinit sky2_test_msi(struct sky2_hw *hw)
260 - return err;
261 - }
262 -
263 --static int __devinit pci_wake_enabled(struct pci_dev *dev)
264 --{
265 -- int pm = pci_find_capability(dev, PCI_CAP_ID_PM);
266 -- u16 value;
267 --
268 -- if (!pm)
269 -- return 0;
270 -- if (pci_read_config_word(dev, pm + PCI_PM_CTRL, &value))
271 -- return 0;
272 -- return value & PCI_PM_CTRL_PME_ENABLE;
273 --}
274 --
275 - /* This driver supports yukon2 chipset only */
276 - static const char *sky2_name(u8 chipid, char *buf, int sz)
277 - {
278 -@@ -4238,7 +4229,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
279 - }
280 - }
281 -
282 -- wol_default = pci_wake_enabled(pdev) ? WAKE_MAGIC : 0;
283 -+ wol_default = device_may_wakeup(&pdev->dev) ? WAKE_MAGIC : 0;
284 -
285 - err = -ENOMEM;
286 - hw = kzalloc(sizeof(*hw), GFP_KERNEL);
287 -diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c
288 -index 68e1f8c..8d5ff62 100644
289 ---- a/drivers/net/wireless/b43legacy/xmit.c
290 -+++ b/drivers/net/wireless/b43legacy/xmit.c
291 -@@ -626,7 +626,7 @@ void b43legacy_handle_hwtxstatus(struct b43legacy_wldev *dev,
292 - tmp = hw->count;
293 - status.frame_count = (tmp >> 4);
294 - status.rts_count = (tmp & 0x0F);
295 -- tmp = hw->flags;
296 -+ tmp = hw->flags << 1;
297 - status.supp_reason = ((tmp & 0x1C) >> 2);
298 - status.pm_indicated = !!(tmp & 0x80);
299 - status.intermediate = !!(tmp & 0x40);
300 -diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
301 -index bd32ac0..5bcf561 100644
302 ---- a/drivers/net/wireless/libertas/main.c
303 -+++ b/drivers/net/wireless/libertas/main.c
304 -@@ -1196,7 +1196,13 @@ void lbs_remove_card(struct lbs_private *priv)
305 - cancel_delayed_work_sync(&priv->scan_work);
306 - cancel_delayed_work_sync(&priv->assoc_work);
307 - cancel_work_sync(&priv->mcast_work);
308 -+
309 -+ /* worker thread destruction blocks on the in-flight command which
310 -+ * should have been cleared already in lbs_stop_card().
311 -+ */
312 -+ lbs_deb_main("destroying worker thread\n");
313 - destroy_workqueue(priv->work_thread);
314 -+ lbs_deb_main("done destroying worker thread\n");
315 -
316 - if (priv->psmode == LBS802_11POWERMODEMAX_PSP) {
317 - priv->psmode = LBS802_11POWERMODECAM;
318 -@@ -1314,14 +1320,26 @@ void lbs_stop_card(struct lbs_private *priv)
319 - device_remove_file(&dev->dev, &dev_attr_lbs_rtap);
320 - }
321 -
322 -- /* Flush pending command nodes */
323 -+ /* Delete the timeout of the currently processing command */
324 - del_timer_sync(&priv->command_timer);
325 -+
326 -+ /* Flush pending command nodes */
327 - spin_lock_irqsave(&priv->driver_lock, flags);
328 -+ lbs_deb_main("clearing pending commands\n");
329 - list_for_each_entry(cmdnode, &priv->cmdpendingq, list) {
330 - cmdnode->result = -ENOENT;
331 - cmdnode->cmdwaitqwoken = 1;
332 - wake_up_interruptible(&cmdnode->cmdwait_q);
333 - }
334 -+
335 -+ /* Flush the command the card is currently processing */
336 -+ if (priv->cur_cmd) {
337 -+ lbs_deb_main("clearing current command\n");
338 -+ priv->cur_cmd->result = -ENOENT;
339 -+ priv->cur_cmd->cmdwaitqwoken = 1;
340 -+ wake_up_interruptible(&priv->cur_cmd->cmdwait_q);
341 -+ }
342 -+ lbs_deb_main("done clearing commands\n");
343 - spin_unlock_irqrestore(&priv->driver_lock, flags);
344 -
345 - unregister_netdev(dev);
346 -diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
347 -index 8dfd6f2..0d22479 100644
348 ---- a/fs/cifs/cifsglob.h
349 -+++ b/fs/cifs/cifsglob.h
350 -@@ -309,6 +309,7 @@ struct cifs_search_info {
351 - __u32 resume_key;
352 - char *ntwrk_buf_start;
353 - char *srch_entries_start;
354 -+ char *last_entry;
355 - char *presume_name;
356 - unsigned int resume_name_len;
357 - bool endOfSearch:1;
358 -diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
359 -index 994de7c..77a0d1f 100644
360 ---- a/fs/cifs/cifssmb.c
361 -+++ b/fs/cifs/cifssmb.c
362 -@@ -3636,6 +3636,8 @@ findFirstRetry:
363 - le16_to_cpu(parms->SearchCount);
364 - psrch_inf->index_of_last_entry = 2 /* skip . and .. */ +
365 - psrch_inf->entries_in_buffer;
366 -+ psrch_inf->last_entry = psrch_inf->srch_entries_start +
367 -+ le16_to_cpu(parms->LastNameOffset);
368 - *pnetfid = parms->SearchHandle;
369 - } else {
370 - cifs_buf_release(pSMB);
371 -@@ -3751,6 +3753,8 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
372 - le16_to_cpu(parms->SearchCount);
373 - psrch_inf->index_of_last_entry +=
374 - psrch_inf->entries_in_buffer;
375 -+ psrch_inf->last_entry = psrch_inf->srch_entries_start +
376 -+ le16_to_cpu(parms->LastNameOffset);
377 - /* cFYI(1,("fnxt2 entries in buf %d index_of_last %d",
378 - psrch_inf->entries_in_buffer, psrch_inf->index_of_last_entry)); */
379 -
380 -diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
381 -index 5f40ed3..765adf1 100644
382 ---- a/fs/cifs/readdir.c
383 -+++ b/fs/cifs/readdir.c
384 -@@ -640,6 +640,70 @@ static int is_dir_changed(struct file *file)
385 -
386 - }
387 -
388 -+static int cifs_save_resume_key(const char *current_entry,
389 -+ struct cifsFileInfo *cifsFile)
390 -+{
391 -+ int rc = 0;
392 -+ unsigned int len = 0;
393 -+ __u16 level;
394 -+ char *filename;
395 -+
396 -+ if ((cifsFile == NULL) || (current_entry == NULL))
397 -+ return -EINVAL;
398 -+
399 -+ level = cifsFile->srch_inf.info_level;
400 -+
401 -+ if (level == SMB_FIND_FILE_UNIX) {
402 -+ FILE_UNIX_INFO *pFindData = (FILE_UNIX_INFO *)current_entry;
403 -+
404 -+ filename = &pFindData->FileName[0];
405 -+ if (cifsFile->srch_inf.unicode) {
406 -+ len = cifs_unicode_bytelen(filename);
407 -+ } else {
408 -+ /* BB should we make this strnlen of PATH_MAX? */
409 -+ len = strnlen(filename, PATH_MAX);
410 -+ }
411 -+ cifsFile->srch_inf.resume_key = pFindData->ResumeKey;
412 -+ } else if (level == SMB_FIND_FILE_DIRECTORY_INFO) {
413 -+ FILE_DIRECTORY_INFO *pFindData =
414 -+ (FILE_DIRECTORY_INFO *)current_entry;
415 -+ filename = &pFindData->FileName[0];
416 -+ len = le32_to_cpu(pFindData->FileNameLength);
417 -+ cifsFile->srch_inf.resume_key = pFindData->FileIndex;
418 -+ } else if (level == SMB_FIND_FILE_FULL_DIRECTORY_INFO) {
419 -+ FILE_FULL_DIRECTORY_INFO *pFindData =
420 -+ (FILE_FULL_DIRECTORY_INFO *)current_entry;
421 -+ filename = &pFindData->FileName[0];
422 -+ len = le32_to_cpu(pFindData->FileNameLength);
423 -+ cifsFile->srch_inf.resume_key = pFindData->FileIndex;
424 -+ } else if (level == SMB_FIND_FILE_ID_FULL_DIR_INFO) {
425 -+ SEARCH_ID_FULL_DIR_INFO *pFindData =
426 -+ (SEARCH_ID_FULL_DIR_INFO *)current_entry;
427 -+ filename = &pFindData->FileName[0];
428 -+ len = le32_to_cpu(pFindData->FileNameLength);
429 -+ cifsFile->srch_inf.resume_key = pFindData->FileIndex;
430 -+ } else if (level == SMB_FIND_FILE_BOTH_DIRECTORY_INFO) {
431 -+ FILE_BOTH_DIRECTORY_INFO *pFindData =
432 -+ (FILE_BOTH_DIRECTORY_INFO *)current_entry;
433 -+ filename = &pFindData->FileName[0];
434 -+ len = le32_to_cpu(pFindData->FileNameLength);
435 -+ cifsFile->srch_inf.resume_key = pFindData->FileIndex;
436 -+ } else if (level == SMB_FIND_FILE_INFO_STANDARD) {
437 -+ FIND_FILE_STANDARD_INFO *pFindData =
438 -+ (FIND_FILE_STANDARD_INFO *)current_entry;
439 -+ filename = &pFindData->FileName[0];
440 -+ /* one byte length, no name conversion */
441 -+ len = (unsigned int)pFindData->FileNameLength;
442 -+ cifsFile->srch_inf.resume_key = pFindData->ResumeKey;
443 -+ } else {
444 -+ cFYI(1, ("Unknown findfirst level %d", level));
445 -+ return -EINVAL;
446 -+ }
447 -+ cifsFile->srch_inf.resume_name_len = len;
448 -+ cifsFile->srch_inf.presume_name = filename;
449 -+ return rc;
450 -+}
451 -+
452 - /* find the corresponding entry in the search */
453 - /* Note that the SMB server returns search entries for . and .. which
454 - complicates logic here if we choose to parse for them and we do not
455 -@@ -703,6 +767,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
456 - while ((index_to_find >= cifsFile->srch_inf.index_of_last_entry) &&
457 - (rc == 0) && !cifsFile->srch_inf.endOfSearch) {
458 - cFYI(1, ("calling findnext2"));
459 -+ cifs_save_resume_key(cifsFile->srch_inf.last_entry, cifsFile);
460 - rc = CIFSFindNext(xid, pTcon, cifsFile->netfid,
461 - &cifsFile->srch_inf);
462 - if (rc)
463 -@@ -919,69 +984,6 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
464 - return rc;
465 - }
466 -
467 --static int cifs_save_resume_key(const char *current_entry,
468 -- struct cifsFileInfo *cifsFile)
469 --{
470 -- int rc = 0;
471 -- unsigned int len = 0;
472 -- __u16 level;
473 -- char *filename;
474 --
475 -- if ((cifsFile == NULL) || (current_entry == NULL))
476 -- return -EINVAL;
477 --
478 -- level = cifsFile->srch_inf.info_level;
479 --
480 -- if (level == SMB_FIND_FILE_UNIX) {
481 -- FILE_UNIX_INFO *pFindData = (FILE_UNIX_INFO *)current_entry;
482 --
483 -- filename = &pFindData->FileName[0];
484 -- if (cifsFile->srch_inf.unicode) {
485 -- len = cifs_unicode_bytelen(filename);
486 -- } else {
487 -- /* BB should we make this strnlen of PATH_MAX? */
488 -- len = strnlen(filename, PATH_MAX);
489 -- }
490 -- cifsFile->srch_inf.resume_key = pFindData->ResumeKey;
491 -- } else if (level == SMB_FIND_FILE_DIRECTORY_INFO) {
492 -- FILE_DIRECTORY_INFO *pFindData =
493 -- (FILE_DIRECTORY_INFO *)current_entry;
494 -- filename = &pFindData->FileName[0];
495 -- len = le32_to_cpu(pFindData->FileNameLength);
496 -- cifsFile->srch_inf.resume_key = pFindData->FileIndex;
497 -- } else if (level == SMB_FIND_FILE_FULL_DIRECTORY_INFO) {
498 -- FILE_FULL_DIRECTORY_INFO *pFindData =
499 -- (FILE_FULL_DIRECTORY_INFO *)current_entry;
500 -- filename = &pFindData->FileName[0];
501 -- len = le32_to_cpu(pFindData->FileNameLength);
502 -- cifsFile->srch_inf.resume_key = pFindData->FileIndex;
503 -- } else if (level == SMB_FIND_FILE_ID_FULL_DIR_INFO) {
504 -- SEARCH_ID_FULL_DIR_INFO *pFindData =
505 -- (SEARCH_ID_FULL_DIR_INFO *)current_entry;
506 -- filename = &pFindData->FileName[0];
507 -- len = le32_to_cpu(pFindData->FileNameLength);
508 -- cifsFile->srch_inf.resume_key = pFindData->FileIndex;
509 -- } else if (level == SMB_FIND_FILE_BOTH_DIRECTORY_INFO) {
510 -- FILE_BOTH_DIRECTORY_INFO *pFindData =
511 -- (FILE_BOTH_DIRECTORY_INFO *)current_entry;
512 -- filename = &pFindData->FileName[0];
513 -- len = le32_to_cpu(pFindData->FileNameLength);
514 -- cifsFile->srch_inf.resume_key = pFindData->FileIndex;
515 -- } else if (level == SMB_FIND_FILE_INFO_STANDARD) {
516 -- FIND_FILE_STANDARD_INFO *pFindData =
517 -- (FIND_FILE_STANDARD_INFO *)current_entry;
518 -- filename = &pFindData->FileName[0];
519 -- /* one byte length, no name conversion */
520 -- len = (unsigned int)pFindData->FileNameLength;
521 -- cifsFile->srch_inf.resume_key = pFindData->ResumeKey;
522 -- } else {
523 -- cFYI(1, ("Unknown findfirst level %d", level));
524 -- return -EINVAL;
525 -- }
526 -- cifsFile->srch_inf.resume_name_len = len;
527 -- cifsFile->srch_inf.presume_name = filename;
528 -- return rc;
529 --}
530 -
531 - int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
532 - {
533 -diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
534 -index 986061a..36d5fcd 100644
535 ---- a/fs/xfs/linux-2.6/xfs_buf.c
536 -+++ b/fs/xfs/linux-2.6/xfs_buf.c
537 -@@ -1001,12 +1001,13 @@ xfs_buf_iodone_work(
538 - * We can get an EOPNOTSUPP to ordered writes. Here we clear the
539 - * ordered flag and reissue them. Because we can't tell the higher
540 - * layers directly that they should not issue ordered I/O anymore, they
541 -- * need to check if the ordered flag was cleared during I/O completion.
542 -+ * need to check if the _XFS_BARRIER_FAILED flag was set during I/O completion.
543 - */
544 - if ((bp->b_error == EOPNOTSUPP) &&
545 - (bp->b_flags & (XBF_ORDERED|XBF_ASYNC)) == (XBF_ORDERED|XBF_ASYNC)) {
546 - XB_TRACE(bp, "ordered_retry", bp->b_iodone);
547 - bp->b_flags &= ~XBF_ORDERED;
548 -+ bp->b_flags |= _XFS_BARRIER_FAILED;
549 - xfs_buf_iorequest(bp);
550 - } else if (bp->b_iodone)
551 - (*(bp->b_iodone))(bp);
552 -diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/linux-2.6/xfs_buf.h
553 -index fe01099..456519a 100644
554 ---- a/fs/xfs/linux-2.6/xfs_buf.h
555 -+++ b/fs/xfs/linux-2.6/xfs_buf.h
556 -@@ -85,6 +85,14 @@ typedef enum {
557 - * modifications being lost.
558 - */
559 - _XBF_PAGE_LOCKED = (1 << 22),
560 -+
561 -+ /*
562 -+ * If we try a barrier write, but it fails we have to communicate
563 -+ * this to the upper layers. Unfortunately b_error gets overwritten
564 -+ * when the buffer is re-issued so we have to add another flag to
565 -+ * keep this information.
566 -+ */
567 -+ _XFS_BARRIER_FAILED = (1 << 23),
568 - } xfs_buf_flags_t;
569 -
570 - typedef enum {
571 -diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
572 -index 503ea89..0b02c64 100644
573 ---- a/fs/xfs/xfs_log.c
574 -+++ b/fs/xfs/xfs_log.c
575 -@@ -1033,11 +1033,12 @@ xlog_iodone(xfs_buf_t *bp)
576 - l = iclog->ic_log;
577 -
578 - /*
579 -- * If the ordered flag has been removed by a lower
580 -- * layer, it means the underlyin device no longer supports
581 -+ * If the _XFS_BARRIER_FAILED flag was set by a lower
582 -+ * layer, it means the underlying device no longer supports
583 - * barrier I/O. Warn loudly and turn off barriers.
584 - */
585 -- if ((l->l_mp->m_flags & XFS_MOUNT_BARRIER) && !XFS_BUF_ISORDERED(bp)) {
586 -+ if (bp->b_flags & _XFS_BARRIER_FAILED) {
587 -+ bp->b_flags &= ~_XFS_BARRIER_FAILED;
588 - l->l_mp->m_flags &= ~XFS_MOUNT_BARRIER;
589 - xfs_fs_cmn_err(CE_WARN, l->l_mp,
590 - "xlog_iodone: Barriers are no longer supported"
591 -diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
592 -index 1113157..37f0721 100644
593 ---- a/kernel/sched_rt.c
594 -+++ b/kernel/sched_rt.c
595 -@@ -102,12 +102,12 @@ static void dequeue_rt_entity(struct sched_rt_entity *rt_se);
596 -
597 - static void sched_rt_rq_enqueue(struct rt_rq *rt_rq)
598 - {
599 -+ struct task_struct *curr = rq_of_rt_rq(rt_rq)->curr;
600 - struct sched_rt_entity *rt_se = rt_rq->rt_se;
601 -
602 -- if (rt_se && !on_rt_rq(rt_se) && rt_rq->rt_nr_running) {
603 -- struct task_struct *curr = rq_of_rt_rq(rt_rq)->curr;
604 --
605 -- enqueue_rt_entity(rt_se);
606 -+ if (rt_rq->rt_nr_running) {
607 -+ if (rt_se && !on_rt_rq(rt_se))
608 -+ enqueue_rt_entity(rt_se);
609 - if (rt_rq->highest_prio < curr->prio)
610 - resched_task(curr);
611 - }
612 -diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
613 -index 8165df5..5c7bbe0 100644
614 ---- a/net/mac80211/debugfs_netdev.c
615 -+++ b/net/mac80211/debugfs_netdev.c
616 -@@ -537,6 +537,7 @@ static int netdev_notify(struct notifier_block *nb,
617 - {
618 - struct net_device *dev = ndev;
619 - struct dentry *dir;
620 -+ struct ieee80211_local *local;
621 - struct ieee80211_sub_if_data *sdata;
622 - char buf[10+IFNAMSIZ];
623 -
624 -@@ -549,10 +550,19 @@ static int netdev_notify(struct notifier_block *nb,
625 - if (dev->ieee80211_ptr->wiphy->privid != mac80211_wiphy_privid)
626 - return 0;
627 -
628 -- sdata = IEEE80211_DEV_TO_SUB_IF(dev);
629 -+ /*
630 -+ * Do not use IEEE80211_DEV_TO_SUB_IF because that
631 -+ * BUG_ONs for the master netdev which we need to
632 -+ * handle here.
633 -+ */
634 -+ sdata = netdev_priv(dev);
635 -
636 -- sprintf(buf, "netdev:%s", dev->name);
637 - dir = sdata->debugfsdir;
638 -+
639 -+ if (!dir)
640 -+ return 0;
641 -+
642 -+ sprintf(buf, "netdev:%s", dev->name);
643 - if (!debugfs_rename(dir->d_parent, dir, dir->d_parent, buf))
644 - printk(KERN_ERR "mac80211: debugfs: failed to rename debugfs "
645 - "dir to %s\n", buf);
646 -diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
647 -index 74aecc0..10b05ce 100644
648 ---- a/net/rfkill/rfkill.c
649 -+++ b/net/rfkill/rfkill.c
650 -@@ -117,6 +117,7 @@ static void rfkill_led_trigger_activate(struct led_classdev *led)
651 -
652 - static void notify_rfkill_state_change(struct rfkill *rfkill)
653 - {
654 -+ rfkill_led_trigger(rfkill, rfkill->state);
655 - blocking_notifier_call_chain(&rfkill_notifier_list,
656 - RFKILL_STATE_CHANGED,
657 - rfkill);
658 -@@ -204,10 +205,8 @@ static int rfkill_toggle_radio(struct rfkill *rfkill,
659 - rfkill->state = state;
660 - }
661 -
662 -- if (force || rfkill->state != oldstate) {
663 -- rfkill_led_trigger(rfkill, rfkill->state);
664 -+ if (force || rfkill->state != oldstate)
665 - notify_rfkill_state_change(rfkill);
666 -- }
667 -
668 - return retval;
669 - }
670
671 Deleted: genpatches-2.6/trunk/2.6.28/1002_linux-2.6.27.3.patch
672 ===================================================================
673 --- genpatches-2.6/trunk/2.6.28/1002_linux-2.6.27.3.patch 2008-12-05 00:39:44 UTC (rev 1417)
674 +++ genpatches-2.6/trunk/2.6.28/1002_linux-2.6.27.3.patch 2008-12-05 00:43:09 UTC (rev 1418)
675 @@ -1,739 +0,0 @@
676 -diff --git a/Documentation/video4linux/CARDLIST.au0828 b/Documentation/video4linux/CARDLIST.au0828
677 -index aa05e5b..d5cb4ea 100644
678 ---- a/Documentation/video4linux/CARDLIST.au0828
679 -+++ b/Documentation/video4linux/CARDLIST.au0828
680 -@@ -1,5 +1,5 @@
681 - 0 -> Unknown board (au0828)
682 -- 1 -> Hauppauge HVR950Q (au0828) [2040:7200,2040:7210,2040:7217,2040:721b,2040:721f,2040:7280,0fd9:0008]
683 -+ 1 -> Hauppauge HVR950Q (au0828) [2040:7200,2040:7210,2040:7217,2040:721b,2040:721e,2040:721f,2040:7280,0fd9:0008]
684 - 2 -> Hauppauge HVR850 (au0828) [2040:7240]
685 - 3 -> DViCO FusionHDTV USB (au0828) [0fe9:d620]
686 - 4 -> Hauppauge HVR950Q rev xxF8 (au0828) [2040:7201,2040:7211,2040:7281]
687 -diff --git a/drivers/base/core.c b/drivers/base/core.c
688 -index d021c98..473c323 100644
689 ---- a/drivers/base/core.c
690 -+++ b/drivers/base/core.c
691 -@@ -523,11 +523,16 @@ static void klist_children_put(struct klist_node *n)
692 - * device_initialize - init device structure.
693 - * @dev: device.
694 - *
695 -- * This prepares the device for use by other layers,
696 -- * including adding it to the device hierarchy.
697 -+ * This prepares the device for use by other layers by initializing
698 -+ * its fields.
699 - * It is the first half of device_register(), if called by
700 -- * that, though it can also be called separately, so one
701 -- * may use @dev's fields (e.g. the refcount).
702 -+ * that function, though it can also be called separately, so one
703 -+ * may use @dev's fields. In particular, get_device()/put_device()
704 -+ * may be used for reference counting of @dev after calling this
705 -+ * function.
706 -+ *
707 -+ * NOTE: Use put_device() to give up your reference instead of freeing
708 -+ * @dev directly once you have called this function.
709 - */
710 - void device_initialize(struct device *dev)
711 - {
712 -@@ -836,9 +841,13 @@ static void device_remove_sys_dev_entry(struct device *dev)
713 - * This is part 2 of device_register(), though may be called
714 - * separately _iff_ device_initialize() has been called separately.
715 - *
716 -- * This adds it to the kobject hierarchy via kobject_add(), adds it
717 -+ * This adds @dev to the kobject hierarchy via kobject_add(), adds it
718 - * to the global and sibling lists for the device, then
719 - * adds it to the other relevant subsystems of the driver model.
720 -+ *
721 -+ * NOTE: _Never_ directly free @dev after calling this function, even
722 -+ * if it returned an error! Always use put_device() to give up your
723 -+ * reference instead.
724 - */
725 - int device_add(struct device *dev)
726 - {
727 -@@ -965,6 +974,10 @@ done:
728 - * I.e. you should only call the two helpers separately if
729 - * have a clearly defined need to use and refcount the device
730 - * before it is added to the hierarchy.
731 -+ *
732 -+ * NOTE: _Never_ directly free @dev after calling this function, even
733 -+ * if it returned an error! Always use put_device() to give up the
734 -+ * reference initialized in this function instead.
735 - */
736 - int device_register(struct device *dev)
737 - {
738 -@@ -1243,7 +1256,7 @@ struct device *device_create_vargs(struct class *class, struct device *parent,
739 - return dev;
740 -
741 - error:
742 -- kfree(dev);
743 -+ put_device(dev);
744 - return ERR_PTR(retval);
745 - }
746 - EXPORT_SYMBOL_GPL(device_create_vargs);
747 -diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
748 -index 8897434..a219ae4 100644
749 ---- a/drivers/gpu/drm/i915/i915_dma.c
750 -+++ b/drivers/gpu/drm/i915/i915_dma.c
751 -@@ -836,7 +836,7 @@ struct drm_ioctl_desc i915_ioctls[] = {
752 - DRM_IOCTL_DEF(DRM_I915_SET_VBLANK_PIPE, i915_vblank_pipe_set, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY ),
753 - DRM_IOCTL_DEF(DRM_I915_GET_VBLANK_PIPE, i915_vblank_pipe_get, DRM_AUTH ),
754 - DRM_IOCTL_DEF(DRM_I915_VBLANK_SWAP, i915_vblank_swap, DRM_AUTH),
755 -- DRM_IOCTL_DEF(DRM_I915_HWS_ADDR, i915_set_status_page, DRM_AUTH),
756 -+ DRM_IOCTL_DEF(DRM_I915_HWS_ADDR, i915_set_status_page, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
757 - };
758 -
759 - int i915_max_ioctl = DRM_ARRAY_SIZE(i915_ioctls);
760 -diff --git a/drivers/md/md.c b/drivers/md/md.c
761 -index deeac4b..fe6eccd 100644
762 ---- a/drivers/md/md.c
763 -+++ b/drivers/md/md.c
764 -@@ -2109,8 +2109,6 @@ rdev_size_store(mdk_rdev_t *rdev, const char *buf, size_t len)
765 -
766 - if (strict_strtoull(buf, 10, &size) < 0)
767 - return -EINVAL;
768 -- if (size < my_mddev->size)
769 -- return -EINVAL;
770 - if (my_mddev->pers && rdev->raid_disk >= 0) {
771 - if (my_mddev->persistent) {
772 - size = super_types[my_mddev->major_version].
773 -@@ -2121,9 +2119,9 @@ rdev_size_store(mdk_rdev_t *rdev, const char *buf, size_t len)
774 - size = (rdev->bdev->bd_inode->i_size >> 10);
775 - size -= rdev->data_offset/2;
776 - }
777 -- if (size < my_mddev->size)
778 -- return -EINVAL; /* component must fit device */
779 - }
780 -+ if (size < my_mddev->size)
781 -+ return -EINVAL; /* component must fit device */
782 -
783 - rdev->size = size;
784 - if (size > oldsize && my_mddev->external) {
785 -diff --git a/drivers/media/dvb/siano/sms-cards.c b/drivers/media/dvb/siano/sms-cards.c
786 -index 9da260f..6f9b773 100644
787 ---- a/drivers/media/dvb/siano/sms-cards.c
788 -+++ b/drivers/media/dvb/siano/sms-cards.c
789 -@@ -42,6 +42,10 @@ struct usb_device_id smsusb_id_table[] = {
790 - .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
791 - { USB_DEVICE(0x2040, 0x5510),
792 - .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
793 -+ { USB_DEVICE(0x2040, 0x5520),
794 -+ .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
795 -+ { USB_DEVICE(0x2040, 0x5530),
796 -+ .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
797 - { USB_DEVICE(0x2040, 0x5580),
798 - .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
799 - { USB_DEVICE(0x2040, 0x5590),
800 -diff --git a/drivers/media/video/au0828/au0828-cards.c b/drivers/media/video/au0828/au0828-cards.c
801 -index ed48908..6294938 100644
802 ---- a/drivers/media/video/au0828/au0828-cards.c
803 -+++ b/drivers/media/video/au0828/au0828-cards.c
804 -@@ -90,6 +90,7 @@ static void hauppauge_eeprom(struct au0828_dev *dev, u8 *eeprom_data)
805 - case 72221: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and basic analog video */
806 - case 72231: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and basic analog video */
807 - case 72241: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM and basic analog video */
808 -+ case 72251: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and basic analog video */
809 - case 72301: /* WinTV-HVR850 (Retail, IR, ATSC and basic analog video */
810 - case 72500: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM */
811 - break;
812 -@@ -198,6 +199,8 @@ struct usb_device_id au0828_usb_id_table [] = {
813 - .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
814 - { USB_DEVICE(0x2040, 0x721b),
815 - .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
816 -+ { USB_DEVICE(0x2040, 0x721e),
817 -+ .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
818 - { USB_DEVICE(0x2040, 0x721f),
819 - .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
820 - { USB_DEVICE(0x2040, 0x7280),
821 -diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
822 -index 463680b..b59e472 100644
823 ---- a/drivers/media/video/tvaudio.c
824 -+++ b/drivers/media/video/tvaudio.c
825 -@@ -1792,7 +1792,7 @@ static int chip_command(struct i2c_client *client,
826 - break;
827 - case VIDIOC_S_FREQUENCY:
828 - chip->mode = 0; /* automatic */
829 -- if (desc->checkmode) {
830 -+ if (desc->checkmode && desc->setmode) {
831 - desc->setmode(chip,V4L2_TUNER_MODE_MONO);
832 - if (chip->prevmode != V4L2_TUNER_MODE_MONO)
833 - chip->prevmode = -1; /* reset previous mode */
834 -diff --git a/drivers/net/wireless/ath9k/core.h b/drivers/net/wireless/ath9k/core.h
835 -index 2f84093..88f4cc3 100644
836 ---- a/drivers/net/wireless/ath9k/core.h
837 -+++ b/drivers/net/wireless/ath9k/core.h
838 -@@ -316,7 +316,7 @@ void ath_descdma_cleanup(struct ath_softc *sc,
839 - #define ATH_RX_TIMEOUT 40 /* 40 milliseconds */
840 - #define WME_NUM_TID 16
841 - #define IEEE80211_BAR_CTL_TID_M 0xF000 /* tid mask */
842 --#define IEEE80211_BAR_CTL_TID_S 2 /* tid shift */
843 -+#define IEEE80211_BAR_CTL_TID_S 12 /* tid shift */
844 -
845 - enum ATH_RX_TYPE {
846 - ATH_RX_NON_CONSUMED = 0,
847 -diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
848 -index acebdf1..b4c7174 100644
849 ---- a/drivers/net/wireless/ath9k/main.c
850 -+++ b/drivers/net/wireless/ath9k/main.c
851 -@@ -1007,6 +1007,11 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw,
852 - return ret;
853 - }
854 -
855 -+static int ath9k_no_fragmentation(struct ieee80211_hw *hw, u32 value)
856 -+{
857 -+ return -EOPNOTSUPP;
858 -+}
859 -+
860 - static struct ieee80211_ops ath9k_ops = {
861 - .tx = ath9k_tx,
862 - .start = ath9k_start,
863 -@@ -1031,7 +1036,8 @@ static struct ieee80211_ops ath9k_ops = {
864 - .get_tsf = ath9k_get_tsf,
865 - .reset_tsf = ath9k_reset_tsf,
866 - .tx_last_beacon = NULL,
867 -- .ampdu_action = ath9k_ampdu_action
868 -+ .ampdu_action = ath9k_ampdu_action,
869 -+ .set_frag_threshold = ath9k_no_fragmentation,
870 - };
871 -
872 - void ath_get_beaconconfig(struct ath_softc *sc,
873 -diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
874 -index 8ab389d..706f3e6 100644
875 ---- a/drivers/usb/core/hcd.c
876 -+++ b/drivers/usb/core/hcd.c
877 -@@ -81,6 +81,10 @@
878 -
879 - /*-------------------------------------------------------------------------*/
880 -
881 -+/* Keep track of which host controller drivers are loaded */
882 -+unsigned long usb_hcds_loaded;
883 -+EXPORT_SYMBOL_GPL(usb_hcds_loaded);
884 -+
885 - /* host controllers we manage */
886 - LIST_HEAD (usb_bus_list);
887 - EXPORT_SYMBOL_GPL (usb_bus_list);
888 -diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
889 -index e710ce0..2dcde61 100644
890 ---- a/drivers/usb/core/hcd.h
891 -+++ b/drivers/usb/core/hcd.h
892 -@@ -482,4 +482,10 @@ static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb,
893 - */
894 - extern struct rw_semaphore ehci_cf_port_reset_rwsem;
895 -
896 -+/* Keep track of which host controller drivers are loaded */
897 -+#define USB_UHCI_LOADED 0
898 -+#define USB_OHCI_LOADED 1
899 -+#define USB_EHCI_LOADED 2
900 -+extern unsigned long usb_hcds_loaded;
901 -+
902 - #endif /* __KERNEL__ */
903 -diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c
904 -index 29d13eb..48f51b1 100644
905 ---- a/drivers/usb/gadget/s3c2410_udc.c
906 -+++ b/drivers/usb/gadget/s3c2410_udc.c
907 -@@ -1651,7 +1651,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
908 - return -EBUSY;
909 -
910 - if (!driver->bind || !driver->setup
911 -- || driver->speed != USB_SPEED_FULL) {
912 -+ || driver->speed < USB_SPEED_FULL) {
913 - printk(KERN_ERR "Invalid driver: bind %p setup %p speed %d\n",
914 - driver->bind, driver->setup, driver->speed);
915 - return -EINVAL;
916 -diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c
917 -index 3791e62..38a55af 100644
918 ---- a/drivers/usb/gadget/u_ether.c
919 -+++ b/drivers/usb/gadget/u_ether.c
920 -@@ -873,6 +873,13 @@ struct net_device *gether_connect(struct gether *link)
921 - spin_lock(&dev->lock);
922 - dev->port_usb = link;
923 - link->ioport = dev;
924 -+ if (netif_running(dev->net)) {
925 -+ if (link->open)
926 -+ link->open(link);
927 -+ } else {
928 -+ if (link->close)
929 -+ link->close(link);
930 -+ }
931 - spin_unlock(&dev->lock);
932 -
933 - netif_carrier_on(dev->net);
934 -diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
935 -index 8409e07..86e38b0 100644
936 ---- a/drivers/usb/host/ehci-hcd.c
937 -+++ b/drivers/usb/host/ehci-hcd.c
938 -@@ -1049,6 +1049,12 @@ static int __init ehci_hcd_init(void)
939 - {
940 - int retval = 0;
941 -
942 -+ set_bit(USB_EHCI_LOADED, &usb_hcds_loaded);
943 -+ if (test_bit(USB_UHCI_LOADED, &usb_hcds_loaded) ||
944 -+ test_bit(USB_OHCI_LOADED, &usb_hcds_loaded))
945 -+ printk(KERN_WARNING "Warning! ehci_hcd should always be loaded"
946 -+ " before uhci_hcd and ohci_hcd, not after\n");
947 -+
948 - pr_debug("%s: block sizes: qh %Zd qtd %Zd itd %Zd sitd %Zd\n",
949 - hcd_name,
950 - sizeof(struct ehci_qh), sizeof(struct ehci_qtd),
951 -@@ -1056,8 +1062,10 @@ static int __init ehci_hcd_init(void)
952 -
953 - #ifdef DEBUG
954 - ehci_debug_root = debugfs_create_dir("ehci", NULL);
955 -- if (!ehci_debug_root)
956 -- return -ENOENT;
957 -+ if (!ehci_debug_root) {
958 -+ retval = -ENOENT;
959 -+ goto err_debug;
960 -+ }
961 - #endif
962 -
963 - #ifdef PLATFORM_DRIVER
964 -@@ -1104,7 +1112,9 @@ clean0:
965 - #ifdef DEBUG
966 - debugfs_remove(ehci_debug_root);
967 - ehci_debug_root = NULL;
968 -+err_debug:
969 - #endif
970 -+ clear_bit(USB_EHCI_LOADED, &usb_hcds_loaded);
971 - return retval;
972 - }
973 - module_init(ehci_hcd_init);
974 -@@ -1126,6 +1136,7 @@ static void __exit ehci_hcd_cleanup(void)
975 - #ifdef DEBUG
976 - debugfs_remove(ehci_debug_root);
977 - #endif
978 -+ clear_bit(USB_EHCI_LOADED, &usb_hcds_loaded);
979 - }
980 - module_exit(ehci_hcd_cleanup);
981 -
982 -diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
983 -index 8990196..8bec02c 100644
984 ---- a/drivers/usb/host/ohci-hcd.c
985 -+++ b/drivers/usb/host/ohci-hcd.c
986 -@@ -1098,6 +1098,7 @@ static int __init ohci_hcd_mod_init(void)
987 - printk (KERN_DEBUG "%s: " DRIVER_INFO "\n", hcd_name);
988 - pr_debug ("%s: block sizes: ed %Zd td %Zd\n", hcd_name,
989 - sizeof (struct ed), sizeof (struct td));
990 -+ set_bit(USB_OHCI_LOADED, &usb_hcds_loaded);
991 -
992 - #ifdef DEBUG
993 - ohci_debug_root = debugfs_create_dir("ohci", NULL);
994 -@@ -1184,6 +1185,7 @@ static int __init ohci_hcd_mod_init(void)
995 - error_debug:
996 - #endif
997 -
998 -+ clear_bit(USB_OHCI_LOADED, &usb_hcds_loaded);
999 - return retval;
1000 - }
1001 - module_init(ohci_hcd_mod_init);
1002 -@@ -1214,6 +1216,7 @@ static void __exit ohci_hcd_mod_exit(void)
1003 - #ifdef DEBUG
1004 - debugfs_remove(ohci_debug_root);
1005 - #endif
1006 -+ clear_bit(USB_OHCI_LOADED, &usb_hcds_loaded);
1007 - }
1008 - module_exit(ohci_hcd_mod_exit);
1009 -
1010 -diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
1011 -index 7ea9a7b..32bbce9 100644
1012 ---- a/drivers/usb/host/ohci-hub.c
1013 -+++ b/drivers/usb/host/ohci-hub.c
1014 -@@ -359,21 +359,24 @@ static void ohci_finish_controller_resume(struct usb_hcd *hcd)
1015 -
1016 - /* Carry out polling-, autostop-, and autoresume-related state changes */
1017 - static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
1018 -- int any_connected)
1019 -+ int any_connected, int rhsc_status)
1020 - {
1021 - int poll_rh = 1;
1022 -- int rhsc;
1023 -+ int rhsc_enable;
1024 -
1025 -- rhsc = ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC;
1026 -- switch (ohci->hc_control & OHCI_CTRL_HCFS) {
1027 -+ /* Some broken controllers never turn off RHCS in the interrupt
1028 -+ * status register. For their sake we won't re-enable RHSC
1029 -+ * interrupts if the interrupt bit is already active.
1030 -+ */
1031 -+ rhsc_enable = ohci_readl(ohci, &ohci->regs->intrenable) &
1032 -+ OHCI_INTR_RHSC;
1033 -
1034 -+ switch (ohci->hc_control & OHCI_CTRL_HCFS) {
1035 - case OHCI_USB_OPER:
1036 -- /* If no status changes are pending, enable status-change
1037 -- * interrupts.
1038 -- */
1039 -- if (!rhsc && !changed) {
1040 -- rhsc = OHCI_INTR_RHSC;
1041 -- ohci_writel(ohci, rhsc, &ohci->regs->intrenable);
1042 -+ /* If no status changes are pending, enable RHSC interrupts. */
1043 -+ if (!rhsc_enable && !rhsc_status && !changed) {
1044 -+ rhsc_enable = OHCI_INTR_RHSC;
1045 -+ ohci_writel(ohci, rhsc_enable, &ohci->regs->intrenable);
1046 - }
1047 -
1048 - /* Keep on polling until we know a device is connected
1049 -@@ -383,7 +386,7 @@ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
1050 - if (any_connected ||
1051 - !device_may_wakeup(&ohci_to_hcd(ohci)
1052 - ->self.root_hub->dev)) {
1053 -- if (rhsc)
1054 -+ if (rhsc_enable)
1055 - poll_rh = 0;
1056 - } else {
1057 - ohci->autostop = 1;
1058 -@@ -396,34 +399,45 @@ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
1059 - ohci->autostop = 0;
1060 - ohci->next_statechange = jiffies +
1061 - STATECHANGE_DELAY;
1062 -- } else if (rhsc && time_after_eq(jiffies,
1063 -+ } else if (time_after_eq(jiffies,
1064 - ohci->next_statechange)
1065 - && !ohci->ed_rm_list
1066 - && !(ohci->hc_control &
1067 - OHCI_SCHED_ENABLES)) {
1068 - ohci_rh_suspend(ohci, 1);
1069 -- poll_rh = 0;
1070 -+ if (rhsc_enable)
1071 -+ poll_rh = 0;
1072 - }
1073 - }
1074 - break;
1075 -
1076 -- /* if there is a port change, autostart or ask to be resumed */
1077 - case OHCI_USB_SUSPEND:
1078 - case OHCI_USB_RESUME:
1079 -+ /* if there is a port change, autostart or ask to be resumed */
1080 - if (changed) {
1081 - if (ohci->autostop)
1082 - ohci_rh_resume(ohci);
1083 - else
1084 - usb_hcd_resume_root_hub(ohci_to_hcd(ohci));
1085 -- } else {
1086 -- if (!rhsc && (ohci->autostop ||
1087 -- ohci_to_hcd(ohci)->self.root_hub->
1088 -- do_remote_wakeup))
1089 -- ohci_writel(ohci, OHCI_INTR_RHSC,
1090 -- &ohci->regs->intrenable);
1091 -
1092 -- /* everything is idle, no need for polling */
1093 -+ /* If remote wakeup is disabled, stop polling */
1094 -+ } else if (!ohci->autostop &&
1095 -+ !ohci_to_hcd(ohci)->self.root_hub->
1096 -+ do_remote_wakeup) {
1097 - poll_rh = 0;
1098 -+
1099 -+ } else {
1100 -+ /* If no status changes are pending,
1101 -+ * enable RHSC interrupts
1102 -+ */
1103 -+ if (!rhsc_enable && !rhsc_status) {
1104 -+ rhsc_enable = OHCI_INTR_RHSC;
1105 -+ ohci_writel(ohci, rhsc_enable,
1106 -+ &ohci->regs->intrenable);
1107 -+ }
1108 -+ /* Keep polling until RHSC is enabled */
1109 -+ if (rhsc_enable)
1110 -+ poll_rh = 0;
1111 - }
1112 - break;
1113 - }
1114 -@@ -441,18 +455,22 @@ static inline int ohci_rh_resume(struct ohci_hcd *ohci)
1115 - * autostop isn't used when CONFIG_PM is turned off.
1116 - */
1117 - static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
1118 -- int any_connected)
1119 -+ int any_connected, int rhsc_status)
1120 - {
1121 - /* If RHSC is enabled, don't poll */
1122 - if (ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC)
1123 - return 0;
1124 -
1125 -- /* If no status changes are pending, enable status-change interrupts */
1126 -- if (!changed) {
1127 -- ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable);
1128 -- return 0;
1129 -- }
1130 -- return 1;
1131 -+ /* If status changes are pending, continue polling.
1132 -+ * Conversely, if no status changes are pending but the RHSC
1133 -+ * status bit was set, then RHSC may be broken so continue polling.
1134 -+ */
1135 -+ if (changed || rhsc_status)
1136 -+ return 1;
1137 -+
1138 -+ /* It's safe to re-enable RHSC interrupts */
1139 -+ ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable);
1140 -+ return 0;
1141 - }
1142 -
1143 - #endif /* CONFIG_PM */
1144 -@@ -467,6 +485,7 @@ ohci_hub_status_data (struct usb_hcd *hcd, char *buf)
1145 - struct ohci_hcd *ohci = hcd_to_ohci (hcd);
1146 - int i, changed = 0, length = 1;
1147 - int any_connected = 0;
1148 -+ int rhsc_status;
1149 - unsigned long flags;
1150 -
1151 - spin_lock_irqsave (&ohci->lock, flags);
1152 -@@ -492,12 +511,10 @@ ohci_hub_status_data (struct usb_hcd *hcd, char *buf)
1153 - length++;
1154 - }
1155 -
1156 -- /* Some broken controllers never turn off RHCS in the interrupt
1157 -- * status register. For their sake we won't re-enable RHSC
1158 -- * interrupts if the flag is already set.
1159 -- */
1160 -- if (ohci_readl(ohci, &ohci->regs->intrstatus) & OHCI_INTR_RHSC)
1161 -- changed = 1;
1162 -+ /* Clear the RHSC status flag before reading the port statuses */
1163 -+ ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrstatus);
1164 -+ rhsc_status = ohci_readl(ohci, &ohci->regs->intrstatus) &
1165 -+ OHCI_INTR_RHSC;
1166 -
1167 - /* look at each port */
1168 - for (i = 0; i < ohci->num_ports; i++) {
1169 -@@ -517,7 +534,7 @@ ohci_hub_status_data (struct usb_hcd *hcd, char *buf)
1170 - }
1171 -
1172 - hcd->poll_rh = ohci_root_hub_state_changes(ohci, changed,
1173 -- any_connected);
1174 -+ any_connected, rhsc_status);
1175 -
1176 - done:
1177 - spin_unlock_irqrestore (&ohci->lock, flags);
1178 -diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
1179 -index 3a7bfe7..59bed3c 100644
1180 ---- a/drivers/usb/host/uhci-hcd.c
1181 -+++ b/drivers/usb/host/uhci-hcd.c
1182 -@@ -953,6 +953,7 @@ static int __init uhci_hcd_init(void)
1183 -
1184 - printk(KERN_INFO DRIVER_DESC " " DRIVER_VERSION "%s\n",
1185 - ignore_oc ? ", overcurrent ignored" : "");
1186 -+ set_bit(USB_UHCI_LOADED, &usb_hcds_loaded);
1187 -
1188 - if (usb_disabled())
1189 - return -ENODEV;
1190 -@@ -988,6 +989,7 @@ debug_failed:
1191 -
1192 - errbuf_failed:
1193 -
1194 -+ clear_bit(USB_UHCI_LOADED, &usb_hcds_loaded);
1195 - return retval;
1196 - }
1197 -
1198 -@@ -997,6 +999,7 @@ static void __exit uhci_hcd_cleanup(void)
1199 - kmem_cache_destroy(uhci_up_cachep);
1200 - debugfs_remove(uhci_debugfs_root);
1201 - kfree(errbuf);
1202 -+ clear_bit(USB_UHCI_LOADED, &usb_hcds_loaded);
1203 - }
1204 -
1205 - module_init(uhci_hcd_init);
1206 -diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
1207 -index 58b2b8f..4b9542b 100644
1208 ---- a/drivers/usb/musb/Kconfig
1209 -+++ b/drivers/usb/musb/Kconfig
1210 -@@ -33,10 +33,6 @@ config USB_MUSB_SOC
1211 - default y if ARCH_DAVINCI
1212 - default y if ARCH_OMAP2430
1213 - default y if ARCH_OMAP34XX
1214 -- help
1215 -- Use a static <asm/arch/hdrc_cnf.h> file to describe how the
1216 -- controller is configured (endpoints, mechanisms, etc) on the
1217 -- current iteration of a given system-on-chip.
1218 -
1219 - comment "DaVinci 644x USB support"
1220 - depends on USB_MUSB_HDRC && ARCH_DAVINCI
1221 -diff --git a/drivers/usb/musb/cppi_dma.h b/drivers/usb/musb/cppi_dma.h
1222 -index fc5216b..729b407 100644
1223 ---- a/drivers/usb/musb/cppi_dma.h
1224 -+++ b/drivers/usb/musb/cppi_dma.h
1225 -@@ -119,8 +119,8 @@ struct cppi {
1226 - void __iomem *mregs; /* Mentor regs */
1227 - void __iomem *tibase; /* TI/CPPI regs */
1228 -
1229 -- struct cppi_channel tx[MUSB_C_NUM_EPT - 1];
1230 -- struct cppi_channel rx[MUSB_C_NUM_EPR - 1];
1231 -+ struct cppi_channel tx[4];
1232 -+ struct cppi_channel rx[4];
1233 -
1234 - struct dma_pool *pool;
1235 -
1236 -diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
1237 -index 75baf18..dfb3bcb 100644
1238 ---- a/drivers/usb/musb/davinci.c
1239 -+++ b/drivers/usb/musb/davinci.c
1240 -@@ -30,6 +30,7 @@
1241 - #include <linux/delay.h>
1242 - #include <linux/clk.h>
1243 - #include <linux/io.h>
1244 -+#include <linux/gpio.h>
1245 -
1246 - #include <asm/arch/hardware.h>
1247 - #include <asm/arch/memory.h>
1248 -@@ -39,7 +40,7 @@
1249 - #include "musb_core.h"
1250 -
1251 - #ifdef CONFIG_MACH_DAVINCI_EVM
1252 --#include <asm/arch/i2c-client.h>
1253 -+#define GPIO_nVBUS_DRV 87
1254 - #endif
1255 -
1256 - #include "davinci.h"
1257 -@@ -138,7 +139,6 @@ static int vbus_state = -1;
1258 - /* VBUS SWITCHING IS BOARD-SPECIFIC */
1259 -
1260 - #ifdef CONFIG_MACH_DAVINCI_EVM
1261 --#ifndef CONFIG_MACH_DAVINCI_EVM_OTG
1262 -
1263 - /* I2C operations are always synchronous, and require a task context.
1264 - * With unloaded systems, using the shared workqueue seems to suffice
1265 -@@ -146,12 +146,11 @@ static int vbus_state = -1;
1266 - */
1267 - static void evm_deferred_drvvbus(struct work_struct *ignored)
1268 - {
1269 -- davinci_i2c_expander_op(0x3a, USB_DRVVBUS, vbus_state);
1270 -+ gpio_set_value_cansleep(GPIO_nVBUS_DRV, vbus_state);
1271 - vbus_state = !vbus_state;
1272 - }
1273 - static DECLARE_WORK(evm_vbus_work, evm_deferred_drvvbus);
1274 -
1275 --#endif /* modified board */
1276 - #endif /* EVM */
1277 -
1278 - static void davinci_source_power(struct musb *musb, int is_on, int immediate)
1279 -@@ -165,21 +164,10 @@ static void davinci_source_power(struct musb *musb, int is_on, int immediate)
1280 -
1281 - #ifdef CONFIG_MACH_DAVINCI_EVM
1282 - if (machine_is_davinci_evm()) {
1283 --#ifdef CONFIG_MACH_DAVINCI_EVM_OTG
1284 -- /* modified EVM board switching VBUS with GPIO(6) not I2C
1285 -- * NOTE: PINMUX0.RGB888 (bit23) must be clear
1286 -- */
1287 -- if (is_on)
1288 -- gpio_set(GPIO(6));
1289 -- else
1290 -- gpio_clear(GPIO(6));
1291 -- immediate = 1;
1292 --#else
1293 - if (immediate)
1294 -- davinci_i2c_expander_op(0x3a, USB_DRVVBUS, !is_on);
1295 -+ gpio_set_value_cansleep(GPIO_nVBUS_DRV, vbus_state);
1296 - else
1297 - schedule_work(&evm_vbus_work);
1298 --#endif
1299 - }
1300 - #endif
1301 - if (immediate)
1302 -diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
1303 -index 128e949..5c5bc1a 100644
1304 ---- a/drivers/usb/musb/musb_core.c
1305 -+++ b/drivers/usb/musb/musb_core.c
1306 -@@ -82,9 +82,9 @@
1307 - /*
1308 - * This gets many kinds of configuration information:
1309 - * - Kconfig for everything user-configurable
1310 -- * - <asm/arch/hdrc_cnf.h> for SOC or family details
1311 - * - platform_device for addressing, irq, and platform_data
1312 - * - platform_data is mostly for board-specific informarion
1313 -+ * (plus recentrly, SOC or family details)
1314 - *
1315 - * Most of the conditional compilation will (someday) vanish.
1316 - */
1317 -@@ -974,9 +974,9 @@ static void musb_shutdown(struct platform_device *pdev)
1318 - /*
1319 - * The silicon either has hard-wired endpoint configurations, or else
1320 - * "dynamic fifo" sizing. The driver has support for both, though at this
1321 -- * writing only the dynamic sizing is very well tested. We use normal
1322 -- * idioms to so both modes are compile-tested, but dead code elimination
1323 -- * leaves only the relevant one in the object file.
1324 -+ * writing only the dynamic sizing is very well tested. Since we switched
1325 -+ * away from compile-time hardware parameters, we can no longer rely on
1326 -+ * dead code elimination to leave only the relevant one in the object file.
1327 - *
1328 - * We don't currently use dynamic fifo setup capability to do anything
1329 - * more than selecting one of a bunch of predefined configurations.
1330 -diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
1331 -index 8b4be01..13205fe 100644
1332 ---- a/drivers/usb/musb/musb_host.c
1333 -+++ b/drivers/usb/musb/musb_host.c
1334 -@@ -108,7 +108,7 @@ static void musb_ep_program(struct musb *musb, u8 epnum,
1335 - /*
1336 - * Clear TX fifo. Needed to avoid BABBLE errors.
1337 - */
1338 --static inline void musb_h_tx_flush_fifo(struct musb_hw_ep *ep)
1339 -+static void musb_h_tx_flush_fifo(struct musb_hw_ep *ep)
1340 - {
1341 - void __iomem *epio = ep->regs;
1342 - u16 csr;
1343 -@@ -436,7 +436,7 @@ musb_advance_schedule(struct musb *musb, struct urb *urb,
1344 - }
1345 - }
1346 -
1347 --static inline u16 musb_h_flush_rxfifo(struct musb_hw_ep *hw_ep, u16 csr)
1348 -+static u16 musb_h_flush_rxfifo(struct musb_hw_ep *hw_ep, u16 csr)
1349 - {
1350 - /* we don't want fifo to fill itself again;
1351 - * ignore dma (various models),
1352 -@@ -1005,7 +1005,7 @@ static bool musb_h_ep0_continue(struct musb *musb, u16 len, struct urb *urb)
1353 -
1354 - /*
1355 - * Handle default endpoint interrupt as host. Only called in IRQ time
1356 -- * from the LinuxIsr() interrupt service routine.
1357 -+ * from musb_interrupt().
1358 - *
1359 - * called with controller irqlocked
1360 - */
1361 -diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
1362 -index 9cbff84..038ea62 100644
1363 ---- a/drivers/video/console/fbcon.c
1364 -+++ b/drivers/video/console/fbcon.c
1365 -@@ -2996,8 +2996,8 @@ static void fbcon_set_all_vcs(struct fb_info *info)
1366 - p = &fb_display[vc->vc_num];
1367 - set_blitting_type(vc, info);
1368 - var_to_display(p, &info->var, info);
1369 -- cols = FBCON_SWAP(p->rotate, info->var.xres, info->var.yres);
1370 -- rows = FBCON_SWAP(p->rotate, info->var.yres, info->var.xres);
1371 -+ cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres);
1372 -+ rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
1373 - cols /= vc->vc_font.width;
1374 - rows /= vc->vc_font.height;
1375 - vc_resize(vc, cols, rows);
1376 -diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
1377 -index 18d3c84..cbdf97d 100644
1378 ---- a/fs/xfs/linux-2.6/xfs_super.c
1379 -+++ b/fs/xfs/linux-2.6/xfs_super.c
1380 -@@ -1323,7 +1323,7 @@ xfs_fs_remount(
1381 - "XFS: mount option \"%s\" not supported for remount\n", p);
1382 - return -EINVAL;
1383 - #else
1384 -- return 0;
1385 -+ break;
1386 - #endif
1387 - }
1388 - }
1389 -diff --git a/kernel/module.c b/kernel/module.c
1390 -index 9db1191..d5fcd24 100644
1391 ---- a/kernel/module.c
1392 -+++ b/kernel/module.c
1393 -@@ -1173,7 +1173,7 @@ static void free_notes_attrs(struct module_notes_attrs *notes_attrs,
1394 - while (i-- > 0)
1395 - sysfs_remove_bin_file(notes_attrs->dir,
1396 - &notes_attrs->attrs[i]);
1397 -- kobject_del(notes_attrs->dir);
1398 -+ kobject_put(notes_attrs->dir);
1399 - }
1400 - kfree(notes_attrs);
1401 - }
1402 -diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c
1403 -index 34fa8ed..48db9bb 100644
1404 ---- a/net/mac80211/wext.c
1405 -+++ b/net/mac80211/wext.c
1406 -@@ -804,7 +804,7 @@ static int ieee80211_ioctl_siwfrag(struct net_device *dev,
1407 - * configure it here */
1408 -
1409 - if (local->ops->set_frag_threshold)
1410 -- local->ops->set_frag_threshold(
1411 -+ return local->ops->set_frag_threshold(
1412 - local_to_hw(local),
1413 - local->fragmentation_threshold);
1414 -
1415
1416 Deleted: genpatches-2.6/trunk/2.6.28/1003_linux-2.6.27.4.patch
1417 ===================================================================
1418 --- genpatches-2.6/trunk/2.6.28/1003_linux-2.6.27.4.patch 2008-12-05 00:39:44 UTC (rev 1417)
1419 +++ genpatches-2.6/trunk/2.6.28/1003_linux-2.6.27.4.patch 2008-12-05 00:43:09 UTC (rev 1418)
1420 @@ -1,855 +0,0 @@
1421 -diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
1422 -index 426e5d9..c44cd6d 100644
1423 ---- a/arch/x86/kernel/acpi/sleep.c
1424 -+++ b/arch/x86/kernel/acpi/sleep.c
1425 -@@ -10,6 +10,7 @@
1426 - #include <linux/dmi.h>
1427 - #include <linux/cpumask.h>
1428 - #include <asm/segment.h>
1429 -+#include <asm/desc.h>
1430 -
1431 - #include "realmode/wakeup.h"
1432 - #include "sleep.h"
1433 -@@ -98,6 +99,8 @@ int acpi_save_state_mem(void)
1434 - header->trampoline_segment = setup_trampoline() >> 4;
1435 - #ifdef CONFIG_SMP
1436 - stack_start.sp = temp_stack + 4096;
1437 -+ early_gdt_descr.address =
1438 -+ (unsigned long)get_cpu_gdt_table(smp_processor_id());
1439 - #endif
1440 - initial_code = (unsigned long)wakeup_long64;
1441 - saved_magic = 0x123456789abcdef0;
1442 -diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
1443 -index a69cc0f..bccd0ef 100644
1444 ---- a/arch/x86/kernel/amd_iommu_init.c
1445 -+++ b/arch/x86/kernel/amd_iommu_init.c
1446 -@@ -210,7 +210,7 @@ static void __init iommu_set_exclusion_range(struct amd_iommu *iommu)
1447 - /* Programs the physical address of the device table into the IOMMU hardware */
1448 - static void __init iommu_set_device_table(struct amd_iommu *iommu)
1449 - {
1450 -- u32 entry;
1451 -+ u64 entry;
1452 -
1453 - BUG_ON(iommu->mmio_base == NULL);
1454 -
1455 -diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c
1456 -index dba3cfb..ecb6ace 100644
1457 ---- a/drivers/acpi/hardware/hwsleep.c
1458 -+++ b/drivers/acpi/hardware/hwsleep.c
1459 -@@ -78,19 +78,17 @@ acpi_set_firmware_waking_vector(acpi_physical_address physical_address)
1460 - return_ACPI_STATUS(status);
1461 - }
1462 -
1463 -- /* Set the vector */
1464 -+ /*
1465 -+ * According to the ACPI specification 2.0c and later, the 64-bit
1466 -+ * waking vector should be cleared and the 32-bit waking vector should
1467 -+ * be used, unless we want the wake-up code to be called by the BIOS in
1468 -+ * Protected Mode. Some systems (for example HP dv5-1004nr) are known
1469 -+ * to fail to resume if the 64-bit vector is used.
1470 -+ */
1471 -+ if (facs->version >= 1)
1472 -+ facs->xfirmware_waking_vector = 0;
1473 -
1474 -- if ((facs->length < 32) || (!(facs->xfirmware_waking_vector))) {
1475 -- /*
1476 -- * ACPI 1.0 FACS or short table or optional X_ field is zero
1477 -- */
1478 -- facs->firmware_waking_vector = (u32) physical_address;
1479 -- } else {
1480 -- /*
1481 -- * ACPI 2.0 FACS with valid X_ field
1482 -- */
1483 -- facs->xfirmware_waking_vector = physical_address;
1484 -- }
1485 -+ facs->firmware_waking_vector = (u32)physical_address;
1486 -
1487 - return_ACPI_STATUS(AE_OK);
1488 - }
1489 -@@ -134,20 +132,7 @@ acpi_get_firmware_waking_vector(acpi_physical_address * physical_address)
1490 - }
1491 -
1492 - /* Get the vector */
1493 --
1494 -- if ((facs->length < 32) || (!(facs->xfirmware_waking_vector))) {
1495 -- /*
1496 -- * ACPI 1.0 FACS or short table or optional X_ field is zero
1497 -- */
1498 -- *physical_address =
1499 -- (acpi_physical_address) facs->firmware_waking_vector;
1500 -- } else {
1501 -- /*
1502 -- * ACPI 2.0 FACS with valid X_ field
1503 -- */
1504 -- *physical_address =
1505 -- (acpi_physical_address) facs->xfirmware_waking_vector;
1506 -- }
1507 -+ *physical_address = (acpi_physical_address)facs->firmware_waking_vector;
1508 -
1509 - return_ACPI_STATUS(AE_OK);
1510 - }
1511 -diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c
1512 -index d13194a..4751909 100644
1513 ---- a/drivers/acpi/sleep/main.c
1514 -+++ b/drivers/acpi/sleep/main.c
1515 -@@ -200,6 +200,8 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
1516 - break;
1517 - }
1518 -
1519 -+ /* If ACPI is not enabled by the BIOS, we need to enable it here. */
1520 -+ acpi_enable();
1521 - /* Reprogram control registers and execute _BFS */
1522 - acpi_leave_sleep_state_prep(acpi_state);
1523 -
1524 -@@ -296,6 +298,14 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
1525 - DMI_MATCH(DMI_BOARD_NAME, "KN9 Series(NF-CK804)"),
1526 - },
1527 - },
1528 -+ {
1529 -+ .callback = init_old_suspend_ordering,
1530 -+ .ident = "HP xw4600 Workstation",
1531 -+ .matches = {
1532 -+ DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
1533 -+ DMI_MATCH(DMI_PRODUCT_NAME, "HP xw4600 Workstation"),
1534 -+ },
1535 -+ },
1536 - {},
1537 - };
1538 - #endif /* CONFIG_SUSPEND */
1539 -diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c
1540 -index fd64137..f2e4caf 100644
1541 ---- a/drivers/char/hvc_console.c
1542 -+++ b/drivers/char/hvc_console.c
1543 -@@ -367,13 +367,13 @@ static void hvc_close(struct tty_struct *tty, struct file * filp)
1544 - spin_lock_irqsave(&hp->lock, flags);
1545 -
1546 - if (--hp->count == 0) {
1547 -- if (hp->ops->notifier_del)
1548 -- hp->ops->notifier_del(hp, hp->data);
1549 --
1550 - /* We are done with the tty pointer now. */
1551 - hp->tty = NULL;
1552 - spin_unlock_irqrestore(&hp->lock, flags);
1553 -
1554 -+ if (hp->ops->notifier_del)
1555 -+ hp->ops->notifier_del(hp, hp->data);
1556 -+
1557 - /*
1558 - * Chain calls chars_in_buffer() and returns immediately if
1559 - * there is no buffered data otherwise sleeps on a wait queue
1560 -@@ -416,11 +416,11 @@ static void hvc_hangup(struct tty_struct *tty)
1561 - hp->n_outbuf = 0;
1562 - hp->tty = NULL;
1563 -
1564 -+ spin_unlock_irqrestore(&hp->lock, flags);
1565 -+
1566 - if (hp->ops->notifier_del)
1567 - hp->ops->notifier_del(hp, hp->data);
1568 -
1569 -- spin_unlock_irqrestore(&hp->lock, flags);
1570 --
1571 - while(temp_open_count) {
1572 - --temp_open_count;
1573 - kref_put(&hp->kref, destroy_hvc_struct);
1574 -diff --git a/drivers/edac/cell_edac.c b/drivers/edac/cell_edac.c
1575 -index 0e024fe..887072f 100644
1576 ---- a/drivers/edac/cell_edac.c
1577 -+++ b/drivers/edac/cell_edac.c
1578 -@@ -142,7 +142,7 @@ static void __devinit cell_edac_init_csrows(struct mem_ctl_info *mci)
1579 - csrow->nr_pages = (r.end - r.start + 1) >> PAGE_SHIFT;
1580 - csrow->last_page = csrow->first_page + csrow->nr_pages - 1;
1581 - csrow->mtype = MEM_XDR;
1582 -- csrow->edac_mode = EDAC_FLAG_EC | EDAC_FLAG_SECDED;
1583 -+ csrow->edac_mode = EDAC_SECDED;
1584 - dev_dbg(mci->dev,
1585 - "Initialized on node %d, chanmask=0x%x,"
1586 - " first_page=0x%lx, nr_pages=0x%x\n",
1587 -diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
1588 -index 8d29405..59f6ad8 100644
1589 ---- a/drivers/gpio/gpiolib.c
1590 -+++ b/drivers/gpio/gpiolib.c
1591 -@@ -1020,7 +1020,7 @@ int gpio_get_value_cansleep(unsigned gpio)
1592 -
1593 - might_sleep_if(extra_checks);
1594 - chip = gpio_to_chip(gpio);
1595 -- return chip->get(chip, gpio - chip->base);
1596 -+ return chip->get ? chip->get(chip, gpio - chip->base) : 0;
1597 - }
1598 - EXPORT_SYMBOL_GPL(gpio_get_value_cansleep);
1599 -
1600 -diff --git a/drivers/md/dm-kcopyd.c b/drivers/md/dm-kcopyd.c
1601 -index 996802b..8f15353 100644
1602 ---- a/drivers/md/dm-kcopyd.c
1603 -+++ b/drivers/md/dm-kcopyd.c
1604 -@@ -268,6 +268,17 @@ static void push(struct list_head *jobs, struct kcopyd_job *job)
1605 - spin_unlock_irqrestore(&kc->job_lock, flags);
1606 - }
1607 -
1608 -+
1609 -+static void push_head(struct list_head *jobs, struct kcopyd_job *job)
1610 -+{
1611 -+ unsigned long flags;
1612 -+ struct dm_kcopyd_client *kc = job->kc;
1613 -+
1614 -+ spin_lock_irqsave(&kc->job_lock, flags);
1615 -+ list_add(&job->list, jobs);
1616 -+ spin_unlock_irqrestore(&kc->job_lock, flags);
1617 -+}
1618 -+
1619 - /*
1620 - * These three functions process 1 item from the corresponding
1621 - * job list.
1622 -@@ -398,7 +409,7 @@ static int process_jobs(struct list_head *jobs, struct dm_kcopyd_client *kc,
1623 - * We couldn't service this job ATM, so
1624 - * push this job back onto the list.
1625 - */
1626 -- push(jobs, job);
1627 -+ push_head(jobs, job);
1628 - break;
1629 - }
1630 -
1631 -diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
1632 -index 6e5528a..4ed9b7a 100644
1633 ---- a/drivers/md/dm-snap.c
1634 -+++ b/drivers/md/dm-snap.c
1635 -@@ -824,8 +824,10 @@ static struct bio *put_pending_exception(struct dm_snap_pending_exception *pe)
1636 - * the bios for the original write to the origin.
1637 - */
1638 - if (primary_pe &&
1639 -- atomic_dec_and_test(&primary_pe->ref_count))
1640 -+ atomic_dec_and_test(&primary_pe->ref_count)) {
1641 - origin_bios = bio_list_get(&primary_pe->origin_bios);
1642 -+ free_pending_exception(primary_pe);
1643 -+ }
1644 -
1645 - /*
1646 - * Free the pe if it's not linked to an origin write or if
1647 -@@ -834,12 +836,6 @@ static struct bio *put_pending_exception(struct dm_snap_pending_exception *pe)
1648 - if (!primary_pe || primary_pe != pe)
1649 - free_pending_exception(pe);
1650 -
1651 -- /*
1652 -- * Free the primary pe if nothing references it.
1653 -- */
1654 -- if (primary_pe && !atomic_read(&primary_pe->ref_count))
1655 -- free_pending_exception(primary_pe);
1656 --
1657 - return origin_bios;
1658 - }
1659 -
1660 -diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
1661 -index f051c6a..7412258 100644
1662 ---- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
1663 -+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
1664 -@@ -60,7 +60,6 @@ static struct pvr2_hdw *unit_pointers[PVR_NUM] = {[ 0 ... PVR_NUM-1 ] = NULL};
1665 - static DEFINE_MUTEX(pvr2_unit_mtx);
1666 -
1667 - static int ctlchg;
1668 --static int initusbreset = 1;
1669 - static int procreload;
1670 - static int tuner[PVR_NUM] = { [0 ... PVR_NUM-1] = -1 };
1671 - static int tolerance[PVR_NUM] = { [0 ... PVR_NUM-1] = 0 };
1672 -@@ -71,8 +70,6 @@ module_param(ctlchg, int, S_IRUGO|S_IWUSR);
1673 - MODULE_PARM_DESC(ctlchg, "0=optimize ctl change 1=always accept new ctl value");
1674 - module_param(init_pause_msec, int, S_IRUGO|S_IWUSR);
1675 - MODULE_PARM_DESC(init_pause_msec, "hardware initialization settling delay");
1676 --module_param(initusbreset, int, S_IRUGO|S_IWUSR);
1677 --MODULE_PARM_DESC(initusbreset, "Do USB reset device on probe");
1678 - module_param(procreload, int, S_IRUGO|S_IWUSR);
1679 - MODULE_PARM_DESC(procreload,
1680 - "Attempt init failure recovery with firmware reload");
1681 -@@ -1698,9 +1695,6 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw)
1682 - }
1683 - hdw->fw1_state = FW1_STATE_OK;
1684 -
1685 -- if (initusbreset) {
1686 -- pvr2_hdw_device_reset(hdw);
1687 -- }
1688 - if (!pvr2_hdw_dev_ok(hdw)) return;
1689 -
1690 - for (idx = 0; idx < hdw->hdw_desc->client_modules.cnt; idx++) {
1691 -diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c
1692 -index 54defec..87a68d2 100644
1693 ---- a/drivers/pci/hotplug/cpqphp_core.c
1694 -+++ b/drivers/pci/hotplug/cpqphp_core.c
1695 -@@ -435,7 +435,7 @@ static int ctrl_slot_setup(struct controller *ctrl,
1696 - slot->number, ctrl->slot_device_offset,
1697 - slot_number);
1698 - result = pci_hp_register(hotplug_slot,
1699 -- ctrl->pci_dev->subordinate,
1700 -+ ctrl->pci_dev->bus,
1701 - slot->device);
1702 - if (result) {
1703 - err("pci_hp_register failed with error %d\n", result);
1704 -diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c
1705 -index 6e2f130..d576d4c 100644
1706 ---- a/drivers/scsi/device_handler/scsi_dh_rdac.c
1707 -+++ b/drivers/scsi/device_handler/scsi_dh_rdac.c
1708 -@@ -590,6 +590,8 @@ static const struct scsi_dh_devlist rdac_dev_list[] = {
1709 - {"STK", "OPENstorage D280"},
1710 - {"SUN", "CSM200_R"},
1711 - {"SUN", "LCSM100_F"},
1712 -+ {"DELL", "MD3000"},
1713 -+ {"DELL", "MD3000i"},
1714 - {NULL, NULL},
1715 - };
1716 -
1717 -diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c
1718 -index 76fce44..3e86240 100644
1719 ---- a/drivers/usb/atm/speedtch.c
1720 -+++ b/drivers/usb/atm/speedtch.c
1721 -@@ -722,6 +722,16 @@ static void speedtch_atm_stop(struct usbatm_data *usbatm, struct atm_dev *atm_de
1722 - flush_scheduled_work();
1723 - }
1724 -
1725 -+static int speedtch_pre_reset(struct usb_interface *intf)
1726 -+{
1727 -+ return 0;
1728 -+}
1729 -+
1730 -+static int speedtch_post_reset(struct usb_interface *intf)
1731 -+{
1732 -+ return 0;
1733 -+}
1734 -+
1735 -
1736 - /**********
1737 - ** USB **
1738 -@@ -740,6 +750,8 @@ static struct usb_driver speedtch_usb_driver = {
1739 - .name = speedtch_driver_name,
1740 - .probe = speedtch_usb_probe,
1741 - .disconnect = usbatm_usb_disconnect,
1742 -+ .pre_reset = speedtch_pre_reset,
1743 -+ .post_reset = speedtch_post_reset,
1744 - .id_table = speedtch_usb_ids
1745 - };
1746 -
1747 -diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
1748 -index c257453..d996a61 100644
1749 ---- a/drivers/usb/class/cdc-acm.c
1750 -+++ b/drivers/usb/class/cdc-acm.c
1751 -@@ -849,9 +849,10 @@ static void acm_write_buffers_free(struct acm *acm)
1752 - {
1753 - int i;
1754 - struct acm_wb *wb;
1755 -+ struct usb_device *usb_dev = interface_to_usbdev(acm->control);
1756 -
1757 - for (wb = &acm->wb[0], i = 0; i < ACM_NW; i++, wb++) {
1758 -- usb_buffer_free(acm->dev, acm->writesize, wb->buf, wb->dmah);
1759 -+ usb_buffer_free(usb_dev, acm->writesize, wb->buf, wb->dmah);
1760 - }
1761 - }
1762 -
1763 -diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
1764 -index 7e8e123..023a4e9 100644
1765 ---- a/drivers/usb/class/cdc-wdm.c
1766 -+++ b/drivers/usb/class/cdc-wdm.c
1767 -@@ -42,6 +42,8 @@ static struct usb_device_id wdm_ids[] = {
1768 - { }
1769 - };
1770 -
1771 -+MODULE_DEVICE_TABLE (usb, wdm_ids);
1772 -+
1773 - #define WDM_MINOR_BASE 176
1774 -
1775 -
1776 -diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
1777 -index 5a7fa6f..9f42cb8 100644
1778 ---- a/drivers/usb/core/driver.c
1779 -+++ b/drivers/usb/core/driver.c
1780 -@@ -1609,7 +1609,8 @@ int usb_external_resume_device(struct usb_device *udev)
1781 - status = usb_resume_both(udev);
1782 - udev->last_busy = jiffies;
1783 - usb_pm_unlock(udev);
1784 -- do_unbind_rebind(udev, DO_REBIND);
1785 -+ if (status == 0)
1786 -+ do_unbind_rebind(udev, DO_REBIND);
1787 -
1788 - /* Now that the device is awake, we can start trying to autosuspend
1789 - * it again. */
1790 -diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
1791 -index d999638..875de9a 100644
1792 ---- a/drivers/usb/core/hub.c
1793 -+++ b/drivers/usb/core/hub.c
1794 -@@ -3424,7 +3424,7 @@ int usb_reset_device(struct usb_device *udev)
1795 - USB_INTERFACE_BOUND)
1796 - rebind = 1;
1797 - }
1798 -- if (rebind)
1799 -+ if (ret == 0 && rebind)
1800 - usb_rebind_intf(cintf);
1801 - }
1802 - }
1803 -diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
1804 -index 765adf1..58d5729 100644
1805 ---- a/fs/cifs/readdir.c
1806 -+++ b/fs/cifs/readdir.c
1807 -@@ -762,14 +762,15 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
1808 - rc));
1809 - return rc;
1810 - }
1811 -+ cifs_save_resume_key(cifsFile->srch_inf.last_entry, cifsFile);
1812 - }
1813 -
1814 - while ((index_to_find >= cifsFile->srch_inf.index_of_last_entry) &&
1815 - (rc == 0) && !cifsFile->srch_inf.endOfSearch) {
1816 - cFYI(1, ("calling findnext2"));
1817 -- cifs_save_resume_key(cifsFile->srch_inf.last_entry, cifsFile);
1818 - rc = CIFSFindNext(xid, pTcon, cifsFile->netfid,
1819 - &cifsFile->srch_inf);
1820 -+ cifs_save_resume_key(cifsFile->srch_inf.last_entry, cifsFile);
1821 - if (rc)
1822 - return -ENOENT;
1823 - }
1824 -diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
1825 -index a78c6b4..11a49ce 100644
1826 ---- a/fs/ext2/dir.c
1827 -+++ b/fs/ext2/dir.c
1828 -@@ -103,7 +103,7 @@ static int ext2_commit_chunk(struct page *page, loff_t pos, unsigned len)
1829 - return err;
1830 - }
1831 -
1832 --static void ext2_check_page(struct page *page)
1833 -+static void ext2_check_page(struct page *page, int quiet)
1834 - {
1835 - struct inode *dir = page->mapping->host;
1836 - struct super_block *sb = dir->i_sb;
1837 -@@ -146,10 +146,10 @@ out:
1838 - /* Too bad, we had an error */
1839 -
1840 - Ebadsize:
1841 -- ext2_error(sb, "ext2_check_page",
1842 -- "size of directory #%lu is not a multiple of chunk size",
1843 -- dir->i_ino
1844 -- );
1845 -+ if (!quiet)
1846 -+ ext2_error(sb, __func__,
1847 -+ "size of directory #%lu is not a multiple "
1848 -+ "of chunk size", dir->i_ino);
1849 - goto fail;
1850 - Eshort:
1851 - error = "rec_len is smaller than minimal";
1852 -@@ -166,32 +166,36 @@ Espan:
1853 - Einumber:
1854 - error = "inode out of bounds";
1855 - bad_entry:
1856 -- ext2_error (sb, "ext2_check_page", "bad entry in directory #%lu: %s - "
1857 -- "offset=%lu, inode=%lu, rec_len=%d, name_len=%d",
1858 -- dir->i_ino, error, (page->index<<PAGE_CACHE_SHIFT)+offs,
1859 -- (unsigned long) le32_to_cpu(p->inode),
1860 -- rec_len, p->name_len);
1861 -+ if (!quiet)
1862 -+ ext2_error(sb, __func__, "bad entry in directory #%lu: : %s - "
1863 -+ "offset=%lu, inode=%lu, rec_len=%d, name_len=%d",
1864 -+ dir->i_ino, error, (page->index<<PAGE_CACHE_SHIFT)+offs,
1865 -+ (unsigned long) le32_to_cpu(p->inode),
1866 -+ rec_len, p->name_len);
1867 - goto fail;
1868 - Eend:
1869 -- p = (ext2_dirent *)(kaddr + offs);
1870 -- ext2_error (sb, "ext2_check_page",
1871 -- "entry in directory #%lu spans the page boundary"
1872 -- "offset=%lu, inode=%lu",
1873 -- dir->i_ino, (page->index<<PAGE_CACHE_SHIFT)+offs,
1874 -- (unsigned long) le32_to_cpu(p->inode));
1875 -+ if (!quiet) {
1876 -+ p = (ext2_dirent *)(kaddr + offs);
1877 -+ ext2_error(sb, "ext2_check_page",
1878 -+ "entry in directory #%lu spans the page boundary"
1879 -+ "offset=%lu, inode=%lu",
1880 -+ dir->i_ino, (page->index<<PAGE_CACHE_SHIFT)+offs,
1881 -+ (unsigned long) le32_to_cpu(p->inode));
1882 -+ }
1883 - fail:
1884 - SetPageChecked(page);
1885 - SetPageError(page);
1886 - }
1887 -
1888 --static struct page * ext2_get_page(struct inode *dir, unsigned long n)
1889 -+static struct page * ext2_get_page(struct inode *dir, unsigned long n,
1890 -+ int quiet)
1891 - {
1892 - struct address_space *mapping = dir->i_mapping;
1893 - struct page *page = read_mapping_page(mapping, n, NULL);
1894 - if (!IS_ERR(page)) {
1895 - kmap(page);
1896 - if (!PageChecked(page))
1897 -- ext2_check_page(page);
1898 -+ ext2_check_page(page, quiet);
1899 - if (PageError(page))
1900 - goto fail;
1901 - }
1902 -@@ -292,7 +296,7 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
1903 - for ( ; n < npages; n++, offset = 0) {
1904 - char *kaddr, *limit;
1905 - ext2_dirent *de;
1906 -- struct page *page = ext2_get_page(inode, n);
1907 -+ struct page *page = ext2_get_page(inode, n, 0);
1908 -
1909 - if (IS_ERR(page)) {
1910 - ext2_error(sb, __func__,
1911 -@@ -361,6 +365,7 @@ struct ext2_dir_entry_2 * ext2_find_entry (struct inode * dir,
1912 - struct page *page = NULL;
1913 - struct ext2_inode_info *ei = EXT2_I(dir);
1914 - ext2_dirent * de;
1915 -+ int dir_has_error = 0;
1916 -
1917 - if (npages == 0)
1918 - goto out;
1919 -@@ -374,7 +379,7 @@ struct ext2_dir_entry_2 * ext2_find_entry (struct inode * dir,
1920 - n = start;
1921 - do {
1922 - char *kaddr;
1923 -- page = ext2_get_page(dir, n);
1924 -+ page = ext2_get_page(dir, n, dir_has_error);
1925 - if (!IS_ERR(page)) {
1926 - kaddr = page_address(page);
1927 - de = (ext2_dirent *) kaddr;
1928 -@@ -391,7 +396,9 @@ struct ext2_dir_entry_2 * ext2_find_entry (struct inode * dir,
1929 - de = ext2_next_entry(de);
1930 - }
1931 - ext2_put_page(page);
1932 -- }
1933 -+ } else
1934 -+ dir_has_error = 1;
1935 -+
1936 - if (++n >= npages)
1937 - n = 0;
1938 - /* next page is past the blocks we've got */
1939 -@@ -414,7 +421,7 @@ found:
1940 -
1941 - struct ext2_dir_entry_2 * ext2_dotdot (struct inode *dir, struct page **p)
1942 - {
1943 -- struct page *page = ext2_get_page(dir, 0);
1944 -+ struct page *page = ext2_get_page(dir, 0, 0);
1945 - ext2_dirent *de = NULL;
1946 -
1947 - if (!IS_ERR(page)) {
1948 -@@ -487,7 +494,7 @@ int ext2_add_link (struct dentry *dentry, struct inode *inode)
1949 - for (n = 0; n <= npages; n++) {
1950 - char *dir_end;
1951 -
1952 -- page = ext2_get_page(dir, n);
1953 -+ page = ext2_get_page(dir, n, 0);
1954 - err = PTR_ERR(page);
1955 - if (IS_ERR(page))
1956 - goto out;
1957 -@@ -655,14 +662,17 @@ int ext2_empty_dir (struct inode * inode)
1958 - {
1959 - struct page *page = NULL;
1960 - unsigned long i, npages = dir_pages(inode);
1961 -+ int dir_has_error = 0;
1962 -
1963 - for (i = 0; i < npages; i++) {
1964 - char *kaddr;
1965 - ext2_dirent * de;
1966 -- page = ext2_get_page(inode, i);
1967 -+ page = ext2_get_page(inode, i, dir_has_error);
1968 -
1969 -- if (IS_ERR(page))
1970 -+ if (IS_ERR(page)) {
1971 -+ dir_has_error = 1;
1972 - continue;
1973 -+ }
1974 -
1975 - kaddr = page_address(page);
1976 - de = (ext2_dirent *)kaddr;
1977 -diff --git a/fs/ext3/dir.c b/fs/ext3/dir.c
1978 -index 2eea96e..1b80f1c 100644
1979 ---- a/fs/ext3/dir.c
1980 -+++ b/fs/ext3/dir.c
1981 -@@ -102,6 +102,7 @@ static int ext3_readdir(struct file * filp,
1982 - int err;
1983 - struct inode *inode = filp->f_path.dentry->d_inode;
1984 - int ret = 0;
1985 -+ int dir_has_error = 0;
1986 -
1987 - sb = inode->i_sb;
1988 -
1989 -@@ -148,9 +149,12 @@ static int ext3_readdir(struct file * filp,
1990 - * of recovering data when there's a bad sector
1991 - */
1992 - if (!bh) {
1993 -- ext3_error (sb, "ext3_readdir",
1994 -- "directory #%lu contains a hole at offset %lu",
1995 -- inode->i_ino, (unsigned long)filp->f_pos);
1996 -+ if (!dir_has_error) {
1997 -+ ext3_error(sb, __func__, "directory #%lu "
1998 -+ "contains a hole at offset %lld",
1999 -+ inode->i_ino, filp->f_pos);
2000 -+ dir_has_error = 1;
2001 -+ }
2002 - /* corrupt size? Maybe no more blocks to read */
2003 - if (filp->f_pos > inode->i_blocks << 9)
2004 - break;
2005 -diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
2006 -index ec8e33b..d1d6487 100644
2007 ---- a/fs/ext4/dir.c
2008 -+++ b/fs/ext4/dir.c
2009 -@@ -102,6 +102,7 @@ static int ext4_readdir(struct file * filp,
2010 - int err;
2011 - struct inode *inode = filp->f_path.dentry->d_inode;
2012 - int ret = 0;
2013 -+ int dir_has_error = 0;
2014 -
2015 - sb = inode->i_sb;
2016 -
2017 -@@ -148,9 +149,13 @@ static int ext4_readdir(struct file * filp,
2018 - * of recovering data when there's a bad sector
2019 - */
2020 - if (!bh) {
2021 -- ext4_error (sb, "ext4_readdir",
2022 -- "directory #%lu contains a hole at offset %lu",
2023 -- inode->i_ino, (unsigned long)filp->f_pos);
2024 -+ if (!dir_has_error) {
2025 -+ ext4_error(sb, __func__, "directory #%lu "
2026 -+ "contains a hole at offset %Lu",
2027 -+ inode->i_ino,
2028 -+ (unsigned long long) filp->f_pos);
2029 -+ dir_has_error = 1;
2030 -+ }
2031 - /* corrupt size? Maybe no more blocks to read */
2032 - if (filp->f_pos > inode->i_blocks << 9)
2033 - break;
2034 -diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
2035 -index 73d1891..f3ada04 100644
2036 ---- a/fs/proc/task_mmu.c
2037 -+++ b/fs/proc/task_mmu.c
2038 -@@ -198,11 +198,8 @@ static int do_maps_open(struct inode *inode, struct file *file,
2039 - return ret;
2040 - }
2041 -
2042 --static int show_map(struct seq_file *m, void *v)
2043 -+static void show_map_vma(struct seq_file *m, struct vm_area_struct *vma)
2044 - {
2045 -- struct proc_maps_private *priv = m->private;
2046 -- struct task_struct *task = priv->task;
2047 -- struct vm_area_struct *vma = v;
2048 - struct mm_struct *mm = vma->vm_mm;
2049 - struct file *file = vma->vm_file;
2050 - int flags = vma->vm_flags;
2051 -@@ -210,9 +207,6 @@ static int show_map(struct seq_file *m, void *v)
2052 - dev_t dev = 0;
2053 - int len;
2054 -
2055 -- if (maps_protect && !ptrace_may_access(task, PTRACE_MODE_READ))
2056 -- return -EACCES;
2057 --
2058 - if (file) {
2059 - struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
2060 - dev = inode->i_sb->s_dev;
2061 -@@ -257,6 +251,18 @@ static int show_map(struct seq_file *m, void *v)
2062 - }
2063 - }
2064 - seq_putc(m, '\n');
2065 -+}
2066 -+
2067 -+static int show_map(struct seq_file *m, void *v)
2068 -+{
2069 -+ struct vm_area_struct *vma = v;
2070 -+ struct proc_maps_private *priv = m->private;
2071 -+ struct task_struct *task = priv->task;
2072 -+
2073 -+ if (maps_protect && !ptrace_may_access(task, PTRACE_MODE_READ))
2074 -+ return -EACCES;
2075 -+
2076 -+ show_map_vma(m, vma);
2077 -
2078 - if (m->count < m->size) /* vma is copied successfully */
2079 - m->version = (vma != get_gate_vma(task))? vma->vm_start: 0;
2080 -@@ -367,23 +373,25 @@ static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
2081 -
2082 - static int show_smap(struct seq_file *m, void *v)
2083 - {
2084 -+ struct proc_maps_private *priv = m->private;
2085 -+ struct task_struct *task = priv->task;
2086 - struct vm_area_struct *vma = v;
2087 - struct mem_size_stats mss;
2088 -- int ret;
2089 - struct mm_walk smaps_walk = {
2090 - .pmd_entry = smaps_pte_range,
2091 - .mm = vma->vm_mm,
2092 - .private = &mss,
2093 - };
2094 -
2095 -+ if (maps_protect && !ptrace_may_access(task, PTRACE_MODE_READ))
2096 -+ return -EACCES;
2097 -+
2098 - memset(&mss, 0, sizeof mss);
2099 - mss.vma = vma;
2100 - if (vma->vm_mm && !is_vm_hugetlb_page(vma))
2101 - walk_page_range(vma->vm_start, vma->vm_end, &smaps_walk);
2102 -
2103 -- ret = show_map(m, v);
2104 -- if (ret)
2105 -- return ret;
2106 -+ show_map_vma(m, vma);
2107 -
2108 - seq_printf(m,
2109 - "Size: %8lu kB\n"
2110 -@@ -405,7 +413,9 @@ static int show_smap(struct seq_file *m, void *v)
2111 - mss.referenced >> 10,
2112 - mss.swap >> 10);
2113 -
2114 -- return ret;
2115 -+ if (m->count < m->size) /* vma is copied successfully */
2116 -+ m->version = (vma != get_gate_vma(task)) ? vma->vm_start : 0;
2117 -+ return 0;
2118 - }
2119 -
2120 - static const struct seq_operations proc_pid_smaps_op = {
2121 -diff --git a/kernel/sched_stats.h b/kernel/sched_stats.h
2122 -index 8385d43..81365b3 100644
2123 ---- a/kernel/sched_stats.h
2124 -+++ b/kernel/sched_stats.h
2125 -@@ -9,7 +9,7 @@
2126 - static int show_schedstat(struct seq_file *seq, void *v)
2127 - {
2128 - int cpu;
2129 -- int mask_len = NR_CPUS/32 * 9;
2130 -+ int mask_len = (NR_CPUS/32 + 1) * 9;
2131 - char *mask_str = kmalloc(mask_len, GFP_KERNEL);
2132 -
2133 - if (mask_str == NULL)
2134 -diff --git a/mm/rmap.c b/mm/rmap.c
2135 -index 0383acf..e8d639b 100644
2136 ---- a/mm/rmap.c
2137 -+++ b/mm/rmap.c
2138 -@@ -55,7 +55,33 @@
2139 -
2140 - struct kmem_cache *anon_vma_cachep;
2141 -
2142 --/* This must be called under the mmap_sem. */
2143 -+/**
2144 -+ * anon_vma_prepare - attach an anon_vma to a memory region
2145 -+ * @vma: the memory region in question
2146 -+ *
2147 -+ * This makes sure the memory mapping described by 'vma' has
2148 -+ * an 'anon_vma' attached to it, so that we can associate the
2149 -+ * anonymous pages mapped into it with that anon_vma.
2150 -+ *
2151 -+ * The common case will be that we already have one, but if
2152 -+ * if not we either need to find an adjacent mapping that we
2153 -+ * can re-use the anon_vma from (very common when the only
2154 -+ * reason for splitting a vma has been mprotect()), or we
2155 -+ * allocate a new one.
2156 -+ *
2157 -+ * Anon-vma allocations are very subtle, because we may have
2158 -+ * optimistically looked up an anon_vma in page_lock_anon_vma()
2159 -+ * and that may actually touch the spinlock even in the newly
2160 -+ * allocated vma (it depends on RCU to make sure that the
2161 -+ * anon_vma isn't actually destroyed).
2162 -+ *
2163 -+ * As a result, we need to do proper anon_vma locking even
2164 -+ * for the new allocation. At the same time, we do not want
2165 -+ * to do any locking for the common case of already having
2166 -+ * an anon_vma.
2167 -+ *
2168 -+ * This must be called with the mmap_sem held for reading.
2169 -+ */
2170 - int anon_vma_prepare(struct vm_area_struct *vma)
2171 - {
2172 - struct anon_vma *anon_vma = vma->anon_vma;
2173 -@@ -63,20 +89,17 @@ int anon_vma_prepare(struct vm_area_struct *vma)
2174 - might_sleep();
2175 - if (unlikely(!anon_vma)) {
2176 - struct mm_struct *mm = vma->vm_mm;
2177 -- struct anon_vma *allocated, *locked;
2178 -+ struct anon_vma *allocated;
2179 -
2180 - anon_vma = find_mergeable_anon_vma(vma);
2181 -- if (anon_vma) {
2182 -- allocated = NULL;
2183 -- locked = anon_vma;
2184 -- spin_lock(&locked->lock);
2185 -- } else {
2186 -+ allocated = NULL;
2187 -+ if (!anon_vma) {
2188 - anon_vma = anon_vma_alloc();
2189 - if (unlikely(!anon_vma))
2190 - return -ENOMEM;
2191 - allocated = anon_vma;
2192 -- locked = NULL;
2193 - }
2194 -+ spin_lock(&anon_vma->lock);
2195 -
2196 - /* page_table_lock to protect against threads */
2197 - spin_lock(&mm->page_table_lock);
2198 -@@ -87,8 +110,7 @@ int anon_vma_prepare(struct vm_area_struct *vma)
2199 - }
2200 - spin_unlock(&mm->page_table_lock);
2201 -
2202 -- if (locked)
2203 -- spin_unlock(&locked->lock);
2204 -+ spin_unlock(&anon_vma->lock);
2205 - if (unlikely(allocated))
2206 - anon_vma_free(allocated);
2207 - }
2208 -diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
2209 -index 5a955c4..7eb0b61 100644
2210 ---- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
2211 -+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
2212 -@@ -150,10 +150,12 @@ static unsigned int ipv4_conntrack_defrag(unsigned int hooknum,
2213 - const struct net_device *out,
2214 - int (*okfn)(struct sk_buff *))
2215 - {
2216 -+#if !defined(CONFIG_NF_NAT) && !defined(CONFIG_NF_NAT_MODULE)
2217 - /* Previously seen (loopback)? Ignore. Do this before
2218 - fragment check. */
2219 - if (skb->nfct)
2220 - return NF_ACCEPT;
2221 -+#endif
2222 -
2223 - /* Gather fragments. */
2224 - if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) {
2225 -diff --git a/net/ipv4/netfilter/nf_nat_snmp_basic.c b/net/ipv4/netfilter/nf_nat_snmp_basic.c
2226 -index ffeaffc..8303e4b 100644
2227 ---- a/net/ipv4/netfilter/nf_nat_snmp_basic.c
2228 -+++ b/net/ipv4/netfilter/nf_nat_snmp_basic.c
2229 -@@ -742,6 +742,7 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx,
2230 - *obj = kmalloc(sizeof(struct snmp_object) + len,
2231 - GFP_ATOMIC);
2232 - if (*obj == NULL) {
2233 -+ kfree(p);
2234 - kfree(id);
2235 - if (net_ratelimit())
2236 - printk("OOM in bsalg (%d)\n", __LINE__);
2237 -diff --git a/net/netfilter/xt_iprange.c b/net/netfilter/xt_iprange.c
2238 -index c63e933..4b5741b 100644
2239 ---- a/net/netfilter/xt_iprange.c
2240 -+++ b/net/netfilter/xt_iprange.c
2241 -@@ -67,7 +67,7 @@ iprange_mt4(const struct sk_buff *skb, const struct net_device *in,
2242 - if (info->flags & IPRANGE_SRC) {
2243 - m = ntohl(iph->saddr) < ntohl(info->src_min.ip);
2244 - m |= ntohl(iph->saddr) > ntohl(info->src_max.ip);
2245 -- m ^= info->flags & IPRANGE_SRC_INV;
2246 -+ m ^= !!(info->flags & IPRANGE_SRC_INV);
2247 - if (m) {
2248 - pr_debug("src IP " NIPQUAD_FMT " NOT in range %s"
2249 - NIPQUAD_FMT "-" NIPQUAD_FMT "\n",
2250 -@@ -81,7 +81,7 @@ iprange_mt4(const struct sk_buff *skb, const struct net_device *in,
2251 - if (info->flags & IPRANGE_DST) {
2252 - m = ntohl(iph->daddr) < ntohl(info->dst_min.ip);
2253 - m |= ntohl(iph->daddr) > ntohl(info->dst_max.ip);
2254 -- m ^= info->flags & IPRANGE_DST_INV;
2255 -+ m ^= !!(info->flags & IPRANGE_DST_INV);
2256 - if (m) {
2257 - pr_debug("dst IP " NIPQUAD_FMT " NOT in range %s"
2258 - NIPQUAD_FMT "-" NIPQUAD_FMT "\n",
2259 -@@ -123,14 +123,14 @@ iprange_mt6(const struct sk_buff *skb, const struct net_device *in,
2260 - if (info->flags & IPRANGE_SRC) {
2261 - m = iprange_ipv6_sub(&iph->saddr, &info->src_min.in6) < 0;
2262 - m |= iprange_ipv6_sub(&iph->saddr, &info->src_max.in6) > 0;
2263 -- m ^= info->flags & IPRANGE_SRC_INV;
2264 -+ m ^= !!(info->flags & IPRANGE_SRC_INV);
2265 - if (m)
2266 - return false;
2267 - }
2268 - if (info->flags & IPRANGE_DST) {
2269 - m = iprange_ipv6_sub(&iph->daddr, &info->dst_min.in6) < 0;
2270 - m |= iprange_ipv6_sub(&iph->daddr, &info->dst_max.in6) > 0;
2271 -- m ^= info->flags & IPRANGE_DST_INV;
2272 -+ m ^= !!(info->flags & IPRANGE_DST_INV);
2273 - if (m)
2274 - return false;
2275 - }
2276
2277 Deleted: genpatches-2.6/trunk/2.6.28/1004_linux-2.6.27.5.patch
2278 ===================================================================
2279 --- genpatches-2.6/trunk/2.6.28/1004_linux-2.6.27.5.patch 2008-12-05 00:39:44 UTC (rev 1417)
2280 +++ genpatches-2.6/trunk/2.6.28/1004_linux-2.6.27.5.patch 2008-12-05 00:43:09 UTC (rev 1418)
2281 @@ -1,2543 +0,0 @@
2282 -diff --git a/Documentation/i2c/busses/i2c-sis96x b/Documentation/i2c/busses/i2c-sis96x
2283 -index 266481f..70e6a0c 100644
2284 ---- a/Documentation/i2c/busses/i2c-sis96x
2285 -+++ b/Documentation/i2c/busses/i2c-sis96x
2286 -@@ -42,7 +42,7 @@ I suspect that this driver could be made to work for the following SiS
2287 - chipsets as well: 635, and 635T. If anyone owns a board with those chips
2288 - AND is willing to risk crashing & burning an otherwise well-behaved kernel
2289 - in the name of progress... please contact me at <mhoffman@×××××××××.com> or
2290 --via the project's mailing list: <i2c@××××××××××.org>. Please send bug
2291 -+via the linux-i2c mailing list: <linux-i2c@×××××××××××.org>. Please send bug
2292 - reports and/or success stories as well.
2293 -
2294 -
2295 -diff --git a/MAINTAINERS b/MAINTAINERS
2296 -index 8dae455..ff24d01 100644
2297 ---- a/MAINTAINERS
2298 -+++ b/MAINTAINERS
2299 -@@ -360,7 +360,7 @@ S: Maintained
2300 - ALI1563 I2C DRIVER
2301 - P: Rudolf Marek
2302 - M: r.marek@×××××××××.cz
2303 --L: i2c@××××××××××.org
2304 -+L: linux-i2c@×××××××××××.org
2305 - S: Maintained
2306 -
2307 - ALPHA PORT
2308 -@@ -1681,7 +1681,7 @@ FREESCALE I2C CPM DRIVER
2309 - P: Jochen Friedrich
2310 - M: jochen@×××××.de
2311 - L: linuxppc-dev@××××××.org
2312 --L: i2c@××××××××××.org
2313 -+L: linux-i2c@×××××××××××.org
2314 - S: Maintained
2315 -
2316 - FREESCALE SOC FS_ENET DRIVER
2317 -@@ -1982,7 +1982,7 @@ S: Maintained
2318 - I2C/SMBUS STUB DRIVER
2319 - P: Mark M. Hoffman
2320 - M: mhoffman@×××××××××.com
2321 --L: i2c@××××××××××.org
2322 -+L: linux-i2c@×××××××××××.org
2323 - S: Maintained
2324 -
2325 - I2C SUBSYSTEM
2326 -@@ -1990,14 +1990,14 @@ P: Jean Delvare (PC drivers, core)
2327 - M: khali@××××××××.org
2328 - P: Ben Dooks (embedded platforms)
2329 - M: ben-linux@×××××.org
2330 --L: i2c@××××××××××.org
2331 -+L: linux-i2c@×××××××××××.org
2332 - T: quilt http://khali.linux-fr.org/devel/linux-2.6/jdelvare-i2c/
2333 - S: Maintained
2334 -
2335 - I2C-TINY-USB DRIVER
2336 - P: Till Harbaum
2337 - M: till@×××××××.org
2338 --L: i2c@××××××××××.org
2339 -+L: linux-i2c@×××××××××××.org
2340 - T: http://www.harbaum.org/till/i2c_tiny_usb
2341 - S: Maintained
2342 -
2343 -@@ -3070,7 +3070,7 @@ S: Maintained
2344 - OPENCORES I2C BUS DRIVER
2345 - P: Peter Korsgaard
2346 - M: jacmet@×××××××.dk
2347 --L: i2c@××××××××××.org
2348 -+L: linux-i2c@×××××××××××.org
2349 - S: Maintained
2350 -
2351 - ORACLE CLUSTER FILESYSTEM 2 (OCFS2)
2352 -@@ -3144,7 +3144,7 @@ S: Maintained
2353 - PA SEMI SMBUS DRIVER
2354 - P: Olof Johansson
2355 - M: olof@×××××.net
2356 --L: i2c@××××××××××.org
2357 -+L: linux-i2c@×××××××××××.org
2358 - S: Maintained
2359 -
2360 - PARALLEL PORT SUPPORT
2361 -@@ -3280,7 +3280,7 @@ S: Maintained
2362 - PNXxxxx I2C DRIVER
2363 - P: Vitaly Wool
2364 - M: vitalywool@×××××.com
2365 --L: i2c@××××××××××.org
2366 -+L: linux-i2c@×××××××××××.org
2367 - S: Maintained
2368 -
2369 - PPP PROTOCOL DRIVERS AND COMPRESSORS
2370 -@@ -3725,7 +3725,7 @@ S: Maintained
2371 - SIS 96X I2C/SMBUS DRIVER
2372 - P: Mark M. Hoffman
2373 - M: mhoffman@×××××××××.com
2374 --L: i2c@××××××××××.org
2375 -+L: linux-i2c@×××××××××××.org
2376 - S: Maintained
2377 -
2378 - SIS FRAMEBUFFER DRIVER
2379 -@@ -4445,7 +4445,7 @@ S: Maintained
2380 - VIAPRO SMBUS DRIVER
2381 - P: Jean Delvare
2382 - M: khali@××××××××.org
2383 --L: i2c@××××××××××.org
2384 -+L: linux-i2c@×××××××××××.org
2385 - S: Maintained
2386 -
2387 - VIA VELOCITY NETWORK DRIVER
2388 -diff --git a/arch/powerpc/configs/linkstation_defconfig b/arch/powerpc/configs/linkstation_defconfig
2389 -index 6fc4c21..d0846ec 100644
2390 ---- a/arch/powerpc/configs/linkstation_defconfig
2391 -+++ b/arch/powerpc/configs/linkstation_defconfig
2392 -@@ -1,7 +1,7 @@
2393 - #
2394 - # Automatically generated make config: don't edit
2395 --# Linux kernel version: 2.6.27-rc4
2396 --# Thu Aug 21 00:52:05 2008
2397 -+# Linux kernel version: 2.6.27
2398 -+# Fri Oct 24 00:42:39 2008
2399 - #
2400 - # CONFIG_PPC64 is not set
2401 -
2402 -@@ -934,7 +934,7 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=4
2403 - CONFIG_SERIAL_CORE=y
2404 - CONFIG_SERIAL_CORE_CONSOLE=y
2405 - # CONFIG_SERIAL_JSM is not set
2406 --CONFIG_SERIAL_OF_PLATFORM=y
2407 -+# CONFIG_SERIAL_OF_PLATFORM is not set
2408 - CONFIG_UNIX98_PTYS=y
2409 - CONFIG_LEGACY_PTYS=y
2410 - CONFIG_LEGACY_PTY_COUNT=256
2411 -@@ -1211,7 +1211,6 @@ CONFIG_USB_STORAGE=m
2412 - # CONFIG_USB_STORAGE_ALAUDA is not set
2413 - # CONFIG_USB_STORAGE_ONETOUCH is not set
2414 - # CONFIG_USB_STORAGE_KARMA is not set
2415 --# CONFIG_USB_STORAGE_SIERRA is not set
2416 - # CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
2417 - # CONFIG_USB_LIBUSUAL is not set
2418 -
2419 -diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
2420 -index 8920eea..16319a5 100644
2421 ---- a/arch/powerpc/mm/hash_utils_64.c
2422 -+++ b/arch/powerpc/mm/hash_utils_64.c
2423 -@@ -381,8 +381,10 @@ static int __init htab_dt_scan_hugepage_blocks(unsigned long node,
2424 - printk(KERN_INFO "Huge page(16GB) memory: "
2425 - "addr = 0x%lX size = 0x%lX pages = %d\n",
2426 - phys_addr, block_size, expected_pages);
2427 -- lmb_reserve(phys_addr, block_size * expected_pages);
2428 -- add_gpage(phys_addr, block_size, expected_pages);
2429 -+ if (phys_addr + (16 * GB) <= lmb_end_of_DRAM()) {
2430 -+ lmb_reserve(phys_addr, block_size * expected_pages);
2431 -+ add_gpage(phys_addr, block_size, expected_pages);
2432 -+ }
2433 - return 0;
2434 - }
2435 -
2436 -diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
2437 -index d9a1813..b5ae97e 100644
2438 ---- a/arch/powerpc/mm/numa.c
2439 -+++ b/arch/powerpc/mm/numa.c
2440 -@@ -89,6 +89,48 @@ static int __cpuinit fake_numa_create_new_node(unsigned long end_pfn,
2441 - return 0;
2442 - }
2443 -
2444 -+/*
2445 -+ * get_active_region_work_fn - A helper function for get_node_active_region
2446 -+ * Returns datax set to the start_pfn and end_pfn if they contain
2447 -+ * the initial value of datax->start_pfn between them
2448 -+ * @start_pfn: start page(inclusive) of region to check
2449 -+ * @end_pfn: end page(exclusive) of region to check
2450 -+ * @datax: comes in with ->start_pfn set to value to search for and
2451 -+ * goes out with active range if it contains it
2452 -+ * Returns 1 if search value is in range else 0
2453 -+ */
2454 -+static int __init get_active_region_work_fn(unsigned long start_pfn,
2455 -+ unsigned long end_pfn, void *datax)
2456 -+{
2457 -+ struct node_active_region *data;
2458 -+ data = (struct node_active_region *)datax;
2459 -+
2460 -+ if (start_pfn <= data->start_pfn && end_pfn > data->start_pfn) {
2461 -+ data->start_pfn = start_pfn;
2462 -+ data->end_pfn = end_pfn;
2463 -+ return 1;
2464 -+ }
2465 -+ return 0;
2466 -+
2467 -+}
2468 -+
2469 -+/*
2470 -+ * get_node_active_region - Return active region containing start_pfn
2471 -+ * Active range returned is empty if none found.
2472 -+ * @start_pfn: The page to return the region for.
2473 -+ * @node_ar: Returned set to the active region containing start_pfn
2474 -+ */
2475 -+static void __init get_node_active_region(unsigned long start_pfn,
2476 -+ struct node_active_region *node_ar)
2477 -+{
2478 -+ int nid = early_pfn_to_nid(start_pfn);
2479 -+
2480 -+ node_ar->nid = nid;
2481 -+ node_ar->start_pfn = start_pfn;
2482 -+ node_ar->end_pfn = start_pfn;
2483 -+ work_with_active_regions(nid, get_active_region_work_fn, node_ar);
2484 -+}
2485 -+
2486 - static void __cpuinit map_cpu_to_node(int cpu, int node)
2487 - {
2488 - numa_cpu_lookup_table[cpu] = node;
2489 -@@ -837,38 +879,53 @@ void __init do_init_bootmem(void)
2490 - start_pfn, end_pfn);
2491 -
2492 - free_bootmem_with_active_regions(nid, end_pfn);
2493 -+ }
2494 -
2495 -- /* Mark reserved regions on this node */
2496 -- for (i = 0; i < lmb.reserved.cnt; i++) {
2497 -- unsigned long physbase = lmb.reserved.region[i].base;
2498 -- unsigned long size = lmb.reserved.region[i].size;
2499 -- unsigned long start_paddr = start_pfn << PAGE_SHIFT;
2500 -- unsigned long end_paddr = end_pfn << PAGE_SHIFT;
2501 --
2502 -- if (early_pfn_to_nid(physbase >> PAGE_SHIFT) != nid &&
2503 -- early_pfn_to_nid((physbase+size-1) >> PAGE_SHIFT) != nid)
2504 -- continue;
2505 --
2506 -- if (physbase < end_paddr &&
2507 -- (physbase+size) > start_paddr) {
2508 -- /* overlaps */
2509 -- if (physbase < start_paddr) {
2510 -- size -= start_paddr - physbase;
2511 -- physbase = start_paddr;
2512 -- }
2513 --
2514 -- if (size > end_paddr - physbase)
2515 -- size = end_paddr - physbase;
2516 --
2517 -- dbg("reserve_bootmem %lx %lx\n", physbase,
2518 -- size);
2519 -- reserve_bootmem_node(NODE_DATA(nid), physbase,
2520 -- size, BOOTMEM_DEFAULT);
2521 -- }
2522 -+ /* Mark reserved regions */
2523 -+ for (i = 0; i < lmb.reserved.cnt; i++) {
2524 -+ unsigned long physbase = lmb.reserved.region[i].base;
2525 -+ unsigned long size = lmb.reserved.region[i].size;
2526 -+ unsigned long start_pfn = physbase >> PAGE_SHIFT;
2527 -+ unsigned long end_pfn = ((physbase + size) >> PAGE_SHIFT);
2528 -+ struct node_active_region node_ar;
2529 -+
2530 -+ get_node_active_region(start_pfn, &node_ar);
2531 -+ while (start_pfn < end_pfn &&
2532 -+ node_ar.start_pfn < node_ar.end_pfn) {
2533 -+ unsigned long reserve_size = size;
2534 -+ /*
2535 -+ * if reserved region extends past active region
2536 -+ * then trim size to active region
2537 -+ */
2538 -+ if (end_pfn > node_ar.end_pfn)
2539 -+ reserve_size = (node_ar.end_pfn << PAGE_SHIFT)
2540 -+ - (start_pfn << PAGE_SHIFT);
2541 -+ dbg("reserve_bootmem %lx %lx nid=%d\n", physbase,
2542 -+ reserve_size, node_ar.nid);
2543 -+ reserve_bootmem_node(NODE_DATA(node_ar.nid), physbase,
2544 -+ reserve_size, BOOTMEM_DEFAULT);
2545 -+ /*
2546 -+ * if reserved region is contained in the active region
2547 -+ * then done.
2548 -+ */
2549 -+ if (end_pfn <= node_ar.end_pfn)
2550 -+ break;
2551 -+
2552 -+ /*
2553 -+ * reserved region extends past the active region
2554 -+ * get next active region that contains this
2555 -+ * reserved region
2556 -+ */
2557 -+ start_pfn = node_ar.end_pfn;
2558 -+ physbase = start_pfn << PAGE_SHIFT;
2559 -+ size = size - reserve_size;
2560 -+ get_node_active_region(start_pfn, &node_ar);
2561 - }
2562 -
2563 -- sparse_memory_present_with_active_regions(nid);
2564 - }
2565 -+
2566 -+ for_each_online_node(nid)
2567 -+ sparse_memory_present_with_active_regions(nid);
2568 - }
2569 -
2570 - void __init paging_init(void)
2571 -diff --git a/arch/powerpc/platforms/embedded6xx/linkstation.c b/arch/powerpc/platforms/embedded6xx/linkstation.c
2572 -index eb5d74e..2ca7be6 100644
2573 ---- a/arch/powerpc/platforms/embedded6xx/linkstation.c
2574 -+++ b/arch/powerpc/platforms/embedded6xx/linkstation.c
2575 -@@ -13,6 +13,7 @@
2576 - #include <linux/kernel.h>
2577 - #include <linux/initrd.h>
2578 - #include <linux/mtd/physmap.h>
2579 -+#include <linux/of_platform.h>
2580 -
2581 - #include <asm/time.h>
2582 - #include <asm/prom.h>
2583 -@@ -54,6 +55,19 @@ static struct mtd_partition linkstation_physmap_partitions[] = {
2584 - },
2585 - };
2586 -
2587 -+static __initdata struct of_device_id of_bus_ids[] = {
2588 -+ { .type = "soc", },
2589 -+ { .compatible = "simple-bus", },
2590 -+ {},
2591 -+};
2592 -+
2593 -+static int __init declare_of_platform_devices(void)
2594 -+{
2595 -+ of_platform_bus_probe(NULL, of_bus_ids, NULL);
2596 -+ return 0;
2597 -+}
2598 -+machine_device_initcall(linkstation, declare_of_platform_devices);
2599 -+
2600 - static int __init linkstation_add_bridge(struct device_node *dev)
2601 - {
2602 - #ifdef CONFIG_PCI
2603 -diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
2604 -index 00b9b4d..fdfca4f 100644
2605 ---- a/arch/s390/kernel/smp.c
2606 -+++ b/arch/s390/kernel/smp.c
2607 -@@ -1117,9 +1117,7 @@ out:
2608 - return rc;
2609 - }
2610 -
2611 --static ssize_t __ref rescan_store(struct sys_device *dev,
2612 -- struct sysdev_attribute *attr,
2613 -- const char *buf,
2614 -+static ssize_t __ref rescan_store(struct sysdev_class *class, const char *buf,
2615 - size_t count)
2616 - {
2617 - int rc;
2618 -@@ -1127,12 +1125,10 @@ static ssize_t __ref rescan_store(struct sys_device *dev,
2619 - rc = smp_rescan_cpus();
2620 - return rc ? rc : count;
2621 - }
2622 --static SYSDEV_ATTR(rescan, 0200, NULL, rescan_store);
2623 -+static SYSDEV_CLASS_ATTR(rescan, 0200, NULL, rescan_store);
2624 - #endif /* CONFIG_HOTPLUG_CPU */
2625 -
2626 --static ssize_t dispatching_show(struct sys_device *dev,
2627 -- struct sysdev_attribute *attr,
2628 -- char *buf)
2629 -+static ssize_t dispatching_show(struct sysdev_class *class, char *buf)
2630 - {
2631 - ssize_t count;
2632 -
2633 -@@ -1142,9 +1138,8 @@ static ssize_t dispatching_show(struct sys_device *dev,
2634 - return count;
2635 - }
2636 -
2637 --static ssize_t dispatching_store(struct sys_device *dev,
2638 -- struct sysdev_attribute *attr,
2639 -- const char *buf, size_t count)
2640 -+static ssize_t dispatching_store(struct sysdev_class *dev, const char *buf,
2641 -+ size_t count)
2642 - {
2643 - int val, rc;
2644 - char delim;
2645 -@@ -1166,7 +1161,8 @@ out:
2646 - put_online_cpus();
2647 - return rc ? rc : count;
2648 - }
2649 --static SYSDEV_ATTR(dispatching, 0644, dispatching_show, dispatching_store);
2650 -+static SYSDEV_CLASS_ATTR(dispatching, 0644, dispatching_show,
2651 -+ dispatching_store);
2652 -
2653 - static int __init topology_init(void)
2654 - {
2655 -@@ -1176,13 +1172,11 @@ static int __init topology_init(void)
2656 - register_cpu_notifier(&smp_cpu_nb);
2657 -
2658 - #ifdef CONFIG_HOTPLUG_CPU
2659 -- rc = sysfs_create_file(&cpu_sysdev_class.kset.kobj,
2660 -- &attr_rescan.attr);
2661 -+ rc = sysdev_class_create_file(&cpu_sysdev_class, &attr_rescan);
2662 - if (rc)
2663 - return rc;
2664 - #endif
2665 -- rc = sysfs_create_file(&cpu_sysdev_class.kset.kobj,
2666 -- &attr_dispatching.attr);
2667 -+ rc = sysdev_class_create_file(&cpu_sysdev_class, &attr_dispatching);
2668 - if (rc)
2669 - return rc;
2670 - for_each_present_cpu(cpu) {
2671 -diff --git a/arch/sparc64/kernel/trampoline.S b/arch/sparc64/kernel/trampoline.S
2672 -index 704a3af..83abd5a 100644
2673 ---- a/arch/sparc64/kernel/trampoline.S
2674 -+++ b/arch/sparc64/kernel/trampoline.S
2675 -@@ -328,6 +328,12 @@ after_lock_tlb:
2676 -
2677 - wrpr %g0, 0, %wstate
2678 -
2679 -+ sethi %hi(prom_entry_lock), %g2
2680 -+1: ldstub [%g2 + %lo(prom_entry_lock)], %g1
2681 -+ membar #StoreLoad | #StoreStore
2682 -+ brnz,pn %g1, 1b
2683 -+ nop
2684 -+
2685 - /* As a hack, put &init_thread_union into %g6.
2686 - * prom_world() loads from here to restore the %asi
2687 - * register.
2688 -@@ -337,7 +343,7 @@ after_lock_tlb:
2689 -
2690 - sethi %hi(is_sun4v), %o0
2691 - lduw [%o0 + %lo(is_sun4v)], %o0
2692 -- brz,pt %o0, 1f
2693 -+ brz,pt %o0, 2f
2694 - nop
2695 -
2696 - TRAP_LOAD_TRAP_BLOCK(%g2, %g3)
2697 -@@ -369,10 +375,10 @@ after_lock_tlb:
2698 - call %o1
2699 - add %sp, (2047 + 128), %o0
2700 -
2701 -- ba,pt %xcc, 2f
2702 -+ ba,pt %xcc, 3f
2703 - nop
2704 -
2705 --1: sethi %hi(sparc64_ttable_tl0), %o0
2706 -+2: sethi %hi(sparc64_ttable_tl0), %o0
2707 - set prom_set_trap_table_name, %g2
2708 - stx %g2, [%sp + 2047 + 128 + 0x00]
2709 - mov 1, %g2
2710 -@@ -386,7 +392,11 @@ after_lock_tlb:
2711 - call %o1
2712 - add %sp, (2047 + 128), %o0
2713 -
2714 --2: ldx [%l0], %g6
2715 -+3: sethi %hi(prom_entry_lock), %g2
2716 -+ stb %g0, [%g2 + %lo(prom_entry_lock)]
2717 -+ membar #StoreStore | #StoreLoad
2718 -+
2719 -+ ldx [%l0], %g6
2720 - ldx [%g6 + TI_TASK], %g4
2721 -
2722 - mov 1, %g5
2723 -diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
2724 -index e12e0e4..5a7c539 100644
2725 ---- a/arch/x86/kernel/process_64.c
2726 -+++ b/arch/x86/kernel/process_64.c
2727 -@@ -729,12 +729,12 @@ unsigned long get_wchan(struct task_struct *p)
2728 - if (!p || p == current || p->state==TASK_RUNNING)
2729 - return 0;
2730 - stack = (unsigned long)task_stack_page(p);
2731 -- if (p->thread.sp < stack || p->thread.sp > stack+THREAD_SIZE)
2732 -+ if (p->thread.sp < stack || p->thread.sp >= stack+THREAD_SIZE)
2733 - return 0;
2734 - fp = *(u64 *)(p->thread.sp);
2735 - do {
2736 - if (fp < (unsigned long)stack ||
2737 -- fp > (unsigned long)stack+THREAD_SIZE)
2738 -+ fp >= (unsigned long)stack+THREAD_SIZE)
2739 - return 0;
2740 - ip = *(u64 *)(fp+8);
2741 - if (!in_sched_functions(ip))
2742 -diff --git a/arch/x86/kernel/rtc.c b/arch/x86/kernel/rtc.c
2743 -index 05191bb..0a23b57 100644
2744 ---- a/arch/x86/kernel/rtc.c
2745 -+++ b/arch/x86/kernel/rtc.c
2746 -@@ -223,11 +223,25 @@ static struct platform_device rtc_device = {
2747 - static __init int add_rtc_cmos(void)
2748 - {
2749 - #ifdef CONFIG_PNP
2750 -- if (!pnp_platform_devices)
2751 -- platform_device_register(&rtc_device);
2752 --#else
2753 -+ static const char *ids[] __initconst =
2754 -+ { "PNP0b00", "PNP0b01", "PNP0b02", };
2755 -+ struct pnp_dev *dev;
2756 -+ struct pnp_id *id;
2757 -+ int i;
2758 -+
2759 -+ pnp_for_each_dev(dev) {
2760 -+ for (id = dev->id; id; id = id->next) {
2761 -+ for (i = 0; i < ARRAY_SIZE(ids); i++) {
2762 -+ if (compare_pnp_id(id, ids[i]) != 0)
2763 -+ return 0;
2764 -+ }
2765 -+ }
2766 -+ }
2767 -+#endif
2768 -+
2769 - platform_device_register(&rtc_device);
2770 --#endif /* CONFIG_PNP */
2771 -+ dev_info(&rtc_device.dev,
2772 -+ "registered platform RTC device (no PNP device found)\n");
2773 - return 0;
2774 - }
2775 - device_initcall(add_rtc_cmos);
2776 -diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
2777 -index 2a50e0f..ac144c2 100644
2778 ---- a/arch/x86/mm/pat.c
2779 -+++ b/arch/x86/mm/pat.c
2780 -@@ -403,12 +403,16 @@ static inline int range_is_allowed(unsigned long pfn, unsigned long size)
2781 - return 1;
2782 - }
2783 - #else
2784 -+/* This check is needed to avoid cache aliasing when PAT is enabled */
2785 - static inline int range_is_allowed(unsigned long pfn, unsigned long size)
2786 - {
2787 - u64 from = ((u64)pfn) << PAGE_SHIFT;
2788 - u64 to = from + size;
2789 - u64 cursor = from;
2790 -
2791 -+ if (!pat_enabled)
2792 -+ return 1;
2793 -+
2794 - while (cursor < to) {
2795 - if (!devmem_is_allowed(pfn)) {
2796 - printk(KERN_INFO
2797 -diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
2798 -index 1dfec41..59352d9 100644
2799 ---- a/drivers/acpi/button.c
2800 -+++ b/drivers/acpi/button.c
2801 -@@ -262,6 +262,7 @@ static int acpi_lid_send_state(struct acpi_button *button)
2802 - return -ENODEV;
2803 - /* input layer checks if event is redundant */
2804 - input_report_switch(button->input, SW_LID, !state);
2805 -+ input_sync(button->input);
2806 - return 0;
2807 - }
2808 -
2809 -@@ -285,8 +286,8 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
2810 - input_report_key(input, keycode, 1);
2811 - input_sync(input);
2812 - input_report_key(input, keycode, 0);
2813 -+ input_sync(input);
2814 - }
2815 -- input_sync(input);
2816 -
2817 - acpi_bus_generate_proc_event(button->device, event,
2818 - ++button->pushed);
2819 -diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
2820 -index 13593f9..444cd9e 100644
2821 ---- a/drivers/acpi/ec.c
2822 -+++ b/drivers/acpi/ec.c
2823 -@@ -1,7 +1,7 @@
2824 - /*
2825 -- * ec.c - ACPI Embedded Controller Driver (v2.0)
2826 -+ * ec.c - ACPI Embedded Controller Driver (v2.1)
2827 - *
2828 -- * Copyright (C) 2006, 2007 Alexey Starikovskiy <alexey.y.starikovskiy@×××××.com>
2829 -+ * Copyright (C) 2006-2008 Alexey Starikovskiy <astarikovskiy@××××.de>
2830 - * Copyright (C) 2006 Denis Sadykov <denis.m.sadykov@×××××.com>
2831 - * Copyright (C) 2004 Luming Yu <luming.yu@×××××.com>
2832 - * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@×××××.com>
2833 -@@ -26,7 +26,7 @@
2834 - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2835 - */
2836 -
2837 --/* Uncomment next line to get verbose print outs*/
2838 -+/* Uncomment next line to get verbose printout */
2839 - /* #define DEBUG */
2840 -
2841 - #include <linux/kernel.h>
2842 -@@ -38,6 +38,7 @@
2843 - #include <linux/seq_file.h>
2844 - #include <linux/interrupt.h>
2845 - #include <linux/list.h>
2846 -+#include <linux/spinlock.h>
2847 - #include <asm/io.h>
2848 - #include <acpi/acpi_bus.h>
2849 - #include <acpi/acpi_drivers.h>
2850 -@@ -65,22 +66,21 @@ enum ec_command {
2851 - ACPI_EC_COMMAND_QUERY = 0x84,
2852 - };
2853 -
2854 --/* EC events */
2855 --enum ec_event {
2856 -- ACPI_EC_EVENT_OBF_1 = 1, /* Output buffer full */
2857 -- ACPI_EC_EVENT_IBF_0, /* Input buffer empty */
2858 --};
2859 --
2860 - #define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */
2861 - #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */
2862 - #define ACPI_EC_UDELAY 100 /* Wait 100us before polling EC again */
2863 -
2864 -+#define ACPI_EC_STORM_THRESHOLD 20 /* number of false interrupts
2865 -+ per one transaction */
2866 -+
2867 - enum {
2868 -- EC_FLAGS_WAIT_GPE = 0, /* Don't check status until GPE arrives */
2869 - EC_FLAGS_QUERY_PENDING, /* Query is pending */
2870 -- EC_FLAGS_GPE_MODE, /* Expect GPE to be sent for status change */
2871 -+ EC_FLAGS_GPE_MODE, /* Expect GPE to be sent
2872 -+ * for status change */
2873 - EC_FLAGS_NO_GPE, /* Don't use GPE mode */
2874 -- EC_FLAGS_RESCHEDULE_POLL /* Re-schedule poll */
2875 -+ EC_FLAGS_GPE_STORM, /* GPE storm detected */
2876 -+ EC_FLAGS_HANDLERS_INSTALLED /* Handlers for GPE and
2877 -+ * OpReg are installed */
2878 - };
2879 -
2880 - /* If we find an EC via the ECDT, we need to keep a ptr to its context */
2881 -@@ -95,6 +95,15 @@ struct acpi_ec_query_handler {
2882 - u8 query_bit;
2883 - };
2884 -
2885 -+struct transaction {
2886 -+ const u8 *wdata;
2887 -+ u8 *rdata;
2888 -+ unsigned short irq_count;
2889 -+ u8 command;
2890 -+ u8 wlen;
2891 -+ u8 rlen;
2892 -+};
2893 -+
2894 - static struct acpi_ec {
2895 - acpi_handle handle;
2896 - unsigned long gpe;
2897 -@@ -105,9 +114,8 @@ static struct acpi_ec {
2898 - struct mutex lock;
2899 - wait_queue_head_t wait;
2900 - struct list_head list;
2901 -- struct delayed_work work;
2902 -- atomic_t irq_count;
2903 -- u8 handlers_installed;
2904 -+ struct transaction *curr;
2905 -+ spinlock_t curr_lock;
2906 - } *boot_ec, *first_ec;
2907 -
2908 - /*
2909 -@@ -150,7 +158,7 @@ static inline u8 acpi_ec_read_data(struct acpi_ec *ec)
2910 - {
2911 - u8 x = inb(ec->data_addr);
2912 - pr_debug(PREFIX "---> data = 0x%2.2x\n", x);
2913 -- return inb(ec->data_addr);
2914 -+ return x;
2915 - }
2916 -
2917 - static inline void acpi_ec_write_cmd(struct acpi_ec *ec, u8 command)
2918 -@@ -165,158 +173,172 @@ static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data)
2919 - outb(data, ec->data_addr);
2920 - }
2921 -
2922 --static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event)
2923 -+static int ec_transaction_done(struct acpi_ec *ec)
2924 - {
2925 -- if (test_bit(EC_FLAGS_WAIT_GPE, &ec->flags))
2926 -- return 0;
2927 -- if (event == ACPI_EC_EVENT_OBF_1) {
2928 -- if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_OBF)
2929 -- return 1;
2930 -- } else if (event == ACPI_EC_EVENT_IBF_0) {
2931 -- if (!(acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF))
2932 -- return 1;
2933 -- }
2934 --
2935 -- return 0;
2936 -+ unsigned long flags;
2937 -+ int ret = 0;
2938 -+ spin_lock_irqsave(&ec->curr_lock, flags);
2939 -+ if (!ec->curr || (!ec->curr->wlen && !ec->curr->rlen))
2940 -+ ret = 1;
2941 -+ spin_unlock_irqrestore(&ec->curr_lock, flags);
2942 -+ return ret;
2943 - }
2944 -
2945 --static void ec_schedule_ec_poll(struct acpi_ec *ec)
2946 -+static void gpe_transaction(struct acpi_ec *ec, u8 status)
2947 - {
2948 -- if (test_bit(EC_FLAGS_RESCHEDULE_POLL, &ec->flags))
2949 -- schedule_delayed_work(&ec->work,
2950 -- msecs_to_jiffies(ACPI_EC_DELAY));
2951 -+ unsigned long flags;
2952 -+ spin_lock_irqsave(&ec->curr_lock, flags);
2953 -+ if (!ec->curr)
2954 -+ goto unlock;
2955 -+ if (ec->curr->wlen > 0) {
2956 -+ if ((status & ACPI_EC_FLAG_IBF) == 0) {
2957 -+ acpi_ec_write_data(ec, *(ec->curr->wdata++));
2958 -+ --ec->curr->wlen;
2959 -+ } else
2960 -+ /* false interrupt, state didn't change */
2961 -+ ++ec->curr->irq_count;
2962 -+
2963 -+ } else if (ec->curr->rlen > 0) {
2964 -+ if ((status & ACPI_EC_FLAG_OBF) == 1) {
2965 -+ *(ec->curr->rdata++) = acpi_ec_read_data(ec);
2966 -+ --ec->curr->rlen;
2967 -+ } else
2968 -+ /* false interrupt, state didn't change */
2969 -+ ++ec->curr->irq_count;
2970 -+ }
2971 -+unlock:
2972 -+ spin_unlock_irqrestore(&ec->curr_lock, flags);
2973 - }
2974 -
2975 --static void ec_switch_to_poll_mode(struct acpi_ec *ec)
2976 -+static int acpi_ec_wait(struct acpi_ec *ec)
2977 - {
2978 -+ if (wait_event_timeout(ec->wait, ec_transaction_done(ec),
2979 -+ msecs_to_jiffies(ACPI_EC_DELAY)))
2980 -+ return 0;
2981 -+ /* missing GPEs, switch back to poll mode */
2982 -+ if (printk_ratelimit())
2983 -+ pr_info(PREFIX "missing confirmations, "
2984 -+ "switch off interrupt mode.\n");
2985 - set_bit(EC_FLAGS_NO_GPE, &ec->flags);
2986 - clear_bit(EC_FLAGS_GPE_MODE, &ec->flags);
2987 -- acpi_disable_gpe(NULL, ec->gpe, ACPI_NOT_ISR);
2988 -- set_bit(EC_FLAGS_RESCHEDULE_POLL, &ec->flags);
2989 -+ return 1;
2990 - }
2991 -
2992 --static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll)
2993 -+static void acpi_ec_gpe_query(void *ec_cxt);
2994 -+
2995 -+static int ec_check_sci(struct acpi_ec *ec, u8 state)
2996 - {
2997 -- atomic_set(&ec->irq_count, 0);
2998 -- if (likely(test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) &&
2999 -- likely(!force_poll)) {
3000 -- if (wait_event_timeout(ec->wait, acpi_ec_check_status(ec, event),
3001 -- msecs_to_jiffies(ACPI_EC_DELAY)))
3002 -- return 0;
3003 -- clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
3004 -- if (acpi_ec_check_status(ec, event)) {
3005 -- /* missing GPEs, switch back to poll mode */
3006 -- if (printk_ratelimit())
3007 -- pr_info(PREFIX "missing confirmations, "
3008 -- "switch off interrupt mode.\n");
3009 -- ec_switch_to_poll_mode(ec);
3010 -- ec_schedule_ec_poll(ec);
3011 -- return 0;
3012 -- }
3013 -- } else {
3014 -- unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY);
3015 -- clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
3016 -- while (time_before(jiffies, delay)) {
3017 -- if (acpi_ec_check_status(ec, event))
3018 -- return 0;
3019 -- msleep(1);
3020 -- }
3021 -- if (acpi_ec_check_status(ec,event))
3022 -+ if (state & ACPI_EC_FLAG_SCI) {
3023 -+ if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags))
3024 -+ return acpi_os_execute(OSL_EC_BURST_HANDLER,
3025 -+ acpi_ec_gpe_query, ec);
3026 -+ }
3027 -+ return 0;
3028 -+}
3029 -+
3030 -+static int ec_poll(struct acpi_ec *ec)
3031 -+{
3032 -+ unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY);
3033 -+ msleep(1);
3034 -+ while (time_before(jiffies, delay)) {
3035 -+ gpe_transaction(ec, acpi_ec_read_status(ec));
3036 -+ msleep(1);
3037 -+ if (ec_transaction_done(ec))
3038 - return 0;
3039 - }
3040 -- pr_err(PREFIX "acpi_ec_wait timeout, status = 0x%2.2x, event = %s\n",
3041 -- acpi_ec_read_status(ec),
3042 -- (event == ACPI_EC_EVENT_OBF_1) ? "\"b0=1\"" : "\"b1=0\"");
3043 - return -ETIME;
3044 - }
3045 -
3046 --static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command,
3047 -- const u8 * wdata, unsigned wdata_len,
3048 -- u8 * rdata, unsigned rdata_len,
3049 -+static int acpi_ec_transaction_unlocked(struct acpi_ec *ec,
3050 -+ struct transaction *t,
3051 - int force_poll)
3052 - {
3053 -- int result = 0;
3054 -- set_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
3055 -+ unsigned long tmp;
3056 -+ int ret = 0;
3057 - pr_debug(PREFIX "transaction start\n");
3058 -- acpi_ec_write_cmd(ec, command);
3059 -- for (; wdata_len > 0; --wdata_len) {
3060 -- result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll);
3061 -- if (result) {
3062 -- pr_err(PREFIX
3063 -- "write_cmd timeout, command = %d\n", command);
3064 -- goto end;
3065 -- }
3066 -- set_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
3067 -- acpi_ec_write_data(ec, *(wdata++));
3068 -+ /* disable GPE during transaction if storm is detected */
3069 -+ if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) {
3070 -+ clear_bit(EC_FLAGS_GPE_MODE, &ec->flags);
3071 -+ acpi_disable_gpe(NULL, ec->gpe, ACPI_NOT_ISR);
3072 - }
3073 --
3074 -- if (!rdata_len) {
3075 -- result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll);
3076 -- if (result) {
3077 -- pr_err(PREFIX
3078 -- "finish-write timeout, command = %d\n", command);
3079 -- goto end;
3080 -- }
3081 -- } else if (command == ACPI_EC_COMMAND_QUERY)
3082 -+ /* start transaction */
3083 -+ spin_lock_irqsave(&ec->curr_lock, tmp);
3084 -+ /* following two actions should be kept atomic */
3085 -+ t->irq_count = 0;
3086 -+ ec->curr = t;
3087 -+ acpi_ec_write_cmd(ec, ec->curr->command);
3088 -+ if (ec->curr->command == ACPI_EC_COMMAND_QUERY)
3089 - clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
3090 --
3091 -- for (; rdata_len > 0; --rdata_len) {
3092 -- result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1, force_poll);
3093 -- if (result) {
3094 -- pr_err(PREFIX "read timeout, command = %d\n", command);
3095 -- goto end;
3096 -- }
3097 -- /* Don't expect GPE after last read */
3098 -- if (rdata_len > 1)
3099 -- set_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
3100 -- *(rdata++) = acpi_ec_read_data(ec);
3101 -- }
3102 -- end:
3103 -+ spin_unlock_irqrestore(&ec->curr_lock, tmp);
3104 -+ /* if we selected poll mode or failed in GPE-mode do a poll loop */
3105 -+ if (force_poll ||
3106 -+ !test_bit(EC_FLAGS_GPE_MODE, &ec->flags) ||
3107 -+ acpi_ec_wait(ec))
3108 -+ ret = ec_poll(ec);
3109 - pr_debug(PREFIX "transaction end\n");
3110 -- return result;
3111 -+ spin_lock_irqsave(&ec->curr_lock, tmp);
3112 -+ ec->curr = NULL;
3113 -+ spin_unlock_irqrestore(&ec->curr_lock, tmp);
3114 -+ if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) {
3115 -+ /* check if we received SCI during transaction */
3116 -+ ec_check_sci(ec, acpi_ec_read_status(ec));
3117 -+ /* it is safe to enable GPE outside of transaction */
3118 -+ acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR);
3119 -+ } else if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags) &&
3120 -+ t->irq_count > ACPI_EC_STORM_THRESHOLD) {
3121 -+ pr_debug(PREFIX "GPE storm detected\n");
3122 -+ set_bit(EC_FLAGS_GPE_STORM, &ec->flags);
3123 -+ }
3124 -+ return ret;
3125 -+}
3126 -+
3127 -+static int ec_check_ibf0(struct acpi_ec *ec)
3128 -+{
3129 -+ u8 status = acpi_ec_read_status(ec);
3130 -+ return (status & ACPI_EC_FLAG_IBF) == 0;
3131 - }
3132 -
3133 --static int acpi_ec_transaction(struct acpi_ec *ec, u8 command,
3134 -- const u8 * wdata, unsigned wdata_len,
3135 -- u8 * rdata, unsigned rdata_len,
3136 -+static int ec_wait_ibf0(struct acpi_ec *ec)
3137 -+{
3138 -+ unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY);
3139 -+ /* interrupt wait manually if GPE mode is not active */
3140 -+ unsigned long timeout = test_bit(EC_FLAGS_GPE_MODE, &ec->flags) ?
3141 -+ msecs_to_jiffies(ACPI_EC_DELAY) : msecs_to_jiffies(1);
3142 -+ while (time_before(jiffies, delay))
3143 -+ if (wait_event_timeout(ec->wait, ec_check_ibf0(ec), timeout))
3144 -+ return 0;
3145 -+ return -ETIME;
3146 -+}
3147 -+
3148 -+static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t,
3149 - int force_poll)
3150 - {
3151 - int status;
3152 - u32 glk;
3153 --
3154 -- if (!ec || (wdata_len && !wdata) || (rdata_len && !rdata))
3155 -+ if (!ec || (!t) || (t->wlen && !t->wdata) || (t->rlen && !t->rdata))
3156 - return -EINVAL;
3157 --
3158 -- if (rdata)
3159 -- memset(rdata, 0, rdata_len);
3160 --
3161 -+ if (t->rdata)
3162 -+ memset(t->rdata, 0, t->rlen);
3163 - mutex_lock(&ec->lock);
3164 - if (ec->global_lock) {
3165 - status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);
3166 - if (ACPI_FAILURE(status)) {
3167 -- mutex_unlock(&ec->lock);
3168 -- return -ENODEV;
3169 -+ status = -ENODEV;
3170 -+ goto unlock;
3171 - }
3172 - }
3173 --
3174 -- status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, 0);
3175 -- if (status) {
3176 -+ if (ec_wait_ibf0(ec)) {
3177 - pr_err(PREFIX "input buffer is not empty, "
3178 - "aborting transaction\n");
3179 -+ status = -ETIME;
3180 - goto end;
3181 - }
3182 --
3183 -- status = acpi_ec_transaction_unlocked(ec, command,
3184 -- wdata, wdata_len,
3185 -- rdata, rdata_len,
3186 -- force_poll);
3187 --
3188 -- end:
3189 --
3190 -+ status = acpi_ec_transaction_unlocked(ec, t, force_poll);
3191 -+end:
3192 - if (ec->global_lock)
3193 - acpi_release_global_lock(glk);
3194 -+unlock:
3195 - mutex_unlock(&ec->lock);
3196 --
3197 - return status;
3198 - }
3199 -
3200 -@@ -327,21 +349,32 @@ static int acpi_ec_transaction(struct acpi_ec *ec, u8 command,
3201 - int acpi_ec_burst_enable(struct acpi_ec *ec)
3202 - {
3203 - u8 d;
3204 -- return acpi_ec_transaction(ec, ACPI_EC_BURST_ENABLE, NULL, 0, &d, 1, 0);
3205 -+ struct transaction t = {.command = ACPI_EC_BURST_ENABLE,
3206 -+ .wdata = NULL, .rdata = &d,
3207 -+ .wlen = 0, .rlen = 1};
3208 -+
3209 -+ return acpi_ec_transaction(ec, &t, 0);
3210 - }
3211 -
3212 - int acpi_ec_burst_disable(struct acpi_ec *ec)
3213 - {
3214 -- return acpi_ec_transaction(ec, ACPI_EC_BURST_DISABLE, NULL, 0, NULL, 0, 0);
3215 -+ struct transaction t = {.command = ACPI_EC_BURST_DISABLE,
3216 -+ .wdata = NULL, .rdata = NULL,
3217 -+ .wlen = 0, .rlen = 0};
3218 -+
3219 -+ return (acpi_ec_read_status(ec) & ACPI_EC_FLAG_BURST) ?
3220 -+ acpi_ec_transaction(ec, &t, 0) : 0;
3221 - }
3222 -
3223 - static int acpi_ec_read(struct acpi_ec *ec, u8 address, u8 * data)
3224 - {
3225 - int result;
3226 - u8 d;
3227 -+ struct transaction t = {.command = ACPI_EC_COMMAND_READ,
3228 -+ .wdata = &address, .rdata = &d,
3229 -+ .wlen = 1, .rlen = 1};
3230 -
3231 -- result = acpi_ec_transaction(ec, ACPI_EC_COMMAND_READ,
3232 -- &address, 1, &d, 1, 0);
3233 -+ result = acpi_ec_transaction(ec, &t, 0);
3234 - *data = d;
3235 - return result;
3236 - }
3237 -@@ -349,8 +382,11 @@ static int acpi_ec_read(struct acpi_ec *ec, u8 address, u8 * data)
3238 - static int acpi_ec_write(struct acpi_ec *ec, u8 address, u8 data)
3239 - {
3240 - u8 wdata[2] = { address, data };
3241 -- return acpi_ec_transaction(ec, ACPI_EC_COMMAND_WRITE,
3242 -- wdata, 2, NULL, 0, 0);
3243 -+ struct transaction t = {.command = ACPI_EC_COMMAND_WRITE,
3244 -+ .wdata = wdata, .rdata = NULL,
3245 -+ .wlen = 2, .rlen = 0};
3246 -+
3247 -+ return acpi_ec_transaction(ec, &t, 0);
3248 - }
3249 -
3250 - /*
3251 -@@ -412,12 +448,13 @@ int ec_transaction(u8 command,
3252 - u8 * rdata, unsigned rdata_len,
3253 - int force_poll)
3254 - {
3255 -+ struct transaction t = {.command = command,
3256 -+ .wdata = wdata, .rdata = rdata,
3257 -+ .wlen = wdata_len, .rlen = rdata_len};
3258 - if (!first_ec)
3259 - return -ENODEV;
3260 -
3261 -- return acpi_ec_transaction(first_ec, command, wdata,
3262 -- wdata_len, rdata, rdata_len,
3263 -- force_poll);
3264 -+ return acpi_ec_transaction(first_ec, &t, force_poll);
3265 - }
3266 -
3267 - EXPORT_SYMBOL(ec_transaction);
3268 -@@ -426,7 +463,9 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 * data)
3269 - {
3270 - int result;
3271 - u8 d;
3272 --
3273 -+ struct transaction t = {.command = ACPI_EC_COMMAND_QUERY,
3274 -+ .wdata = NULL, .rdata = &d,
3275 -+ .wlen = 0, .rlen = 1};
3276 - if (!ec || !data)
3277 - return -EINVAL;
3278 -
3279 -@@ -436,7 +475,7 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 * data)
3280 - * bit to be cleared (and thus clearing the interrupt source).
3281 - */
3282 -
3283 -- result = acpi_ec_transaction(ec, ACPI_EC_COMMAND_QUERY, NULL, 0, &d, 1, 0);
3284 -+ result = acpi_ec_transaction(ec, &t, 0);
3285 - if (result)
3286 - return result;
3287 -
3288 -@@ -513,46 +552,26 @@ static void acpi_ec_gpe_query(void *ec_cxt)
3289 -
3290 - static u32 acpi_ec_gpe_handler(void *data)
3291 - {
3292 -- acpi_status status = AE_OK;
3293 - struct acpi_ec *ec = data;
3294 -- u8 state = acpi_ec_read_status(ec);
3295 -+ u8 status;
3296 -
3297 - pr_debug(PREFIX "~~~> interrupt\n");
3298 -- atomic_inc(&ec->irq_count);
3299 -- if (atomic_read(&ec->irq_count) > 5) {
3300 -- pr_err(PREFIX "GPE storm detected, disabling EC GPE\n");
3301 -- ec_switch_to_poll_mode(ec);
3302 -- goto end;
3303 -- }
3304 -- clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
3305 -- if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags))
3306 -+ status = acpi_ec_read_status(ec);
3307 -+
3308 -+ gpe_transaction(ec, status);
3309 -+ if (ec_transaction_done(ec) && (status & ACPI_EC_FLAG_IBF) == 0)
3310 - wake_up(&ec->wait);
3311 -
3312 -- if (state & ACPI_EC_FLAG_SCI) {
3313 -- if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags))
3314 -- status = acpi_os_execute(OSL_EC_BURST_HANDLER,
3315 -- acpi_ec_gpe_query, ec);
3316 -- } else if (!test_bit(EC_FLAGS_GPE_MODE, &ec->flags) &&
3317 -- !test_bit(EC_FLAGS_NO_GPE, &ec->flags) &&
3318 -- in_interrupt()) {
3319 -+ ec_check_sci(ec, status);
3320 -+ if (!test_bit(EC_FLAGS_GPE_MODE, &ec->flags) &&
3321 -+ !test_bit(EC_FLAGS_NO_GPE, &ec->flags)) {
3322 - /* this is non-query, must be confirmation */
3323 - if (printk_ratelimit())
3324 - pr_info(PREFIX "non-query interrupt received,"
3325 - " switching to interrupt mode\n");
3326 - set_bit(EC_FLAGS_GPE_MODE, &ec->flags);
3327 -- clear_bit(EC_FLAGS_RESCHEDULE_POLL, &ec->flags);
3328 - }
3329 --end:
3330 -- ec_schedule_ec_poll(ec);
3331 -- return ACPI_SUCCESS(status) ?
3332 -- ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED;
3333 --}
3334 --
3335 --static void do_ec_poll(struct work_struct *work)
3336 --{
3337 -- struct acpi_ec *ec = container_of(work, struct acpi_ec, work.work);
3338 -- atomic_set(&ec->irq_count, 0);
3339 -- (void)acpi_ec_gpe_handler(ec);
3340 -+ return ACPI_INTERRUPT_HANDLED;
3341 - }
3342 -
3343 - /* --------------------------------------------------------------------------
3344 -@@ -696,8 +715,7 @@ static struct acpi_ec *make_acpi_ec(void)
3345 - mutex_init(&ec->lock);
3346 - init_waitqueue_head(&ec->wait);
3347 - INIT_LIST_HEAD(&ec->list);
3348 -- INIT_DELAYED_WORK_DEFERRABLE(&ec->work, do_ec_poll);
3349 -- atomic_set(&ec->irq_count, 0);
3350 -+ spin_lock_init(&ec->curr_lock);
3351 - return ec;
3352 - }
3353 -
3354 -@@ -736,22 +754,15 @@ ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval)
3355 - return AE_CTRL_TERMINATE;
3356 - }
3357 -
3358 --static void ec_poll_stop(struct acpi_ec *ec)
3359 --{
3360 -- clear_bit(EC_FLAGS_RESCHEDULE_POLL, &ec->flags);
3361 -- cancel_delayed_work(&ec->work);
3362 --}
3363 --
3364 - static void ec_remove_handlers(struct acpi_ec *ec)
3365 - {
3366 -- ec_poll_stop(ec);
3367 - if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle,
3368 - ACPI_ADR_SPACE_EC, &acpi_ec_space_handler)))
3369 - pr_err(PREFIX "failed to remove space handler\n");
3370 - if (ACPI_FAILURE(acpi_remove_gpe_handler(NULL, ec->gpe,
3371 - &acpi_ec_gpe_handler)))
3372 - pr_err(PREFIX "failed to remove gpe handler\n");
3373 -- ec->handlers_installed = 0;
3374 -+ clear_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags);
3375 - }
3376 -
3377 - static int acpi_ec_add(struct acpi_device *device)
3378 -@@ -846,17 +857,15 @@ ec_parse_io_ports(struct acpi_resource *resource, void *context)
3379 - static int ec_install_handlers(struct acpi_ec *ec)
3380 - {
3381 - acpi_status status;
3382 -- if (ec->handlers_installed)
3383 -+ if (test_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags))
3384 - return 0;
3385 - status = acpi_install_gpe_handler(NULL, ec->gpe,
3386 -- ACPI_GPE_EDGE_TRIGGERED,
3387 -- &acpi_ec_gpe_handler, ec);
3388 -+ ACPI_GPE_EDGE_TRIGGERED,
3389 -+ &acpi_ec_gpe_handler, ec);
3390 - if (ACPI_FAILURE(status))
3391 - return -ENODEV;
3392 --
3393 - acpi_set_gpe_type(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME);
3394 - acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR);
3395 --
3396 - status = acpi_install_address_space_handler(ec->handle,
3397 - ACPI_ADR_SPACE_EC,
3398 - &acpi_ec_space_handler,
3399 -@@ -866,7 +875,7 @@ static int ec_install_handlers(struct acpi_ec *ec)
3400 - return -ENODEV;
3401 - }
3402 -
3403 -- ec->handlers_installed = 1;
3404 -+ set_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags);
3405 - return 0;
3406 - }
3407 -
3408 -@@ -887,7 +896,6 @@ static int acpi_ec_start(struct acpi_device *device)
3409 -
3410 - /* EC is fully operational, allow queries */
3411 - clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
3412 -- ec_schedule_ec_poll(ec);
3413 - return ret;
3414 - }
3415 -
3416 -@@ -906,7 +914,7 @@ static int acpi_ec_stop(struct acpi_device *device, int type)
3417 -
3418 - int __init acpi_boot_ec_enable(void)
3419 - {
3420 -- if (!boot_ec || boot_ec->handlers_installed)
3421 -+ if (!boot_ec || test_bit(EC_FLAGS_HANDLERS_INSTALLED, &boot_ec->flags))
3422 - return 0;
3423 - if (!ec_install_handlers(boot_ec)) {
3424 - first_ec = boot_ec;
3425 -diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c
3426 -index ecb6ace..25dccdf 100644
3427 ---- a/drivers/acpi/hardware/hwsleep.c
3428 -+++ b/drivers/acpi/hardware/hwsleep.c
3429 -@@ -612,6 +612,13 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state)
3430 - }
3431 - /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */
3432 -
3433 -+ /*
3434 -+ * Some BIOSes assume that WAK_STS will be cleared on resume and use
3435 -+ * it to determine whether the system is rebooting or resuming. Clear
3436 -+ * it for compatibility.
3437 -+ */
3438 -+ acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1);
3439 -+
3440 - acpi_gbl_system_awake_and_running = TRUE;
3441 -
3442 - /* Enable power button */
3443 -diff --git a/drivers/acpi/reboot.c b/drivers/acpi/reboot.c
3444 -index a6b662c..755baf2 100644
3445 ---- a/drivers/acpi/reboot.c
3446 -+++ b/drivers/acpi/reboot.c
3447 -@@ -15,9 +15,28 @@ void acpi_reboot(void)
3448 -
3449 - rr = &acpi_gbl_FADT.reset_register;
3450 -
3451 -- /* Is the reset register supported? */
3452 -- if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER) ||
3453 -- rr->bit_width != 8 || rr->bit_offset != 0)
3454 -+ /*
3455 -+ * Is the ACPI reset register supported?
3456 -+ *
3457 -+ * According to ACPI 3.0, FADT.flags.RESET_REG_SUP indicates
3458 -+ * whether the ACPI reset mechanism is supported.
3459 -+ *
3460 -+ * However, some boxes have this bit clear, yet a valid
3461 -+ * ACPI_RESET_REG & RESET_VALUE, and ACPI reboot is the only
3462 -+ * mechanism that works for them after S3.
3463 -+ *
3464 -+ * This suggests that other operating systems may not be checking
3465 -+ * the RESET_REG_SUP bit, and are using other means to decide
3466 -+ * whether to use the ACPI reboot mechanism or not.
3467 -+ *
3468 -+ * So when acpi reboot is requested,
3469 -+ * only the reset_register is checked. If the following
3470 -+ * conditions are met, it indicates that the reset register is supported.
3471 -+ * a. reset_register is not zero
3472 -+ * b. the access width is eight
3473 -+ * c. the bit_offset is zero
3474 -+ */
3475 -+ if (!(rr->address) || rr->bit_width != 8 || rr->bit_offset != 0)
3476 - return;
3477 -
3478 - reset_value = acpi_gbl_FADT.reset_value;
3479 -diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
3480 -index 79e3a8e..8228ae3 100644
3481 ---- a/drivers/ata/libata-core.c
3482 -+++ b/drivers/ata/libata-core.c
3483 -@@ -5259,6 +5259,8 @@ struct ata_port *ata_port_alloc(struct ata_host *host)
3484 -
3485 - #ifdef CONFIG_ATA_SFF
3486 - INIT_DELAYED_WORK(&ap->port_task, ata_pio_task);
3487 -+#else
3488 -+ INIT_DELAYED_WORK(&ap->port_task, NULL);
3489 - #endif
3490 - INIT_DELAYED_WORK(&ap->hotplug_task, ata_scsi_hotplug);
3491 - INIT_WORK(&ap->scsi_rescan_task, ata_scsi_dev_rescan);
3492 -diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
3493 -index 0221c9a..35fd67d 100644
3494 ---- a/drivers/ata/pata_it821x.c
3495 -+++ b/drivers/ata/pata_it821x.c
3496 -@@ -557,9 +557,8 @@ static unsigned int it821x_read_id(struct ata_device *adev,
3497 - if (strstr(model_num, "Integrated Technology Express")) {
3498 - /* Set feature bits the firmware neglects */
3499 - id[49] |= 0x0300; /* LBA, DMA */
3500 -- id[82] |= 0x0400; /* LBA48 */
3501 - id[83] &= 0x7FFF;
3502 -- id[83] |= 0x4000; /* Word 83 is valid */
3503 -+ id[83] |= 0x4400; /* Word 83 is valid and LBA48 */
3504 - id[86] |= 0x0400; /* LBA48 on */
3505 - id[ATA_ID_MAJOR_VER] |= 0x1F;
3506 - }
3507 -diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
3508 -index 14601dc..8714c36 100644
3509 ---- a/drivers/ata/sata_nv.c
3510 -+++ b/drivers/ata/sata_nv.c
3511 -@@ -307,10 +307,10 @@ static int nv_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val);
3512 -
3513 - static void nv_nf2_freeze(struct ata_port *ap);
3514 - static void nv_nf2_thaw(struct ata_port *ap);
3515 -+static int nv_nf2_hardreset(struct ata_link *link, unsigned int *class,
3516 -+ unsigned long deadline);
3517 - static void nv_ck804_freeze(struct ata_port *ap);
3518 - static void nv_ck804_thaw(struct ata_port *ap);
3519 --static int nv_hardreset(struct ata_link *link, unsigned int *class,
3520 -- unsigned long deadline);
3521 - static int nv_adma_slave_config(struct scsi_device *sdev);
3522 - static int nv_adma_check_atapi_dma(struct ata_queued_cmd *qc);
3523 - static void nv_adma_qc_prep(struct ata_queued_cmd *qc);
3524 -@@ -405,17 +405,8 @@ static struct scsi_host_template nv_swncq_sht = {
3525 - .slave_configure = nv_swncq_slave_config,
3526 - };
3527 -
3528 --/* OSDL bz3352 reports that some nv controllers can't determine device
3529 -- * signature reliably and nv_hardreset is implemented to work around
3530 -- * the problem. This was reported on nf3 and it's unclear whether any
3531 -- * other controllers are affected. However, the workaround has been
3532 -- * applied to all variants and there isn't much to gain by trying to
3533 -- * find out exactly which ones are affected at this point especially
3534 -- * because NV has moved over to ahci for newer controllers.
3535 -- */
3536 - static struct ata_port_operations nv_common_ops = {
3537 - .inherits = &ata_bmdma_port_ops,
3538 -- .hardreset = nv_hardreset,
3539 - .scr_read = nv_scr_read,
3540 - .scr_write = nv_scr_write,
3541 - };
3542 -@@ -429,12 +420,22 @@ static struct ata_port_operations nv_generic_ops = {
3543 - .hardreset = ATA_OP_NULL,
3544 - };
3545 -
3546 -+/* OSDL bz3352 reports that nf2/3 controllers can't determine device
3547 -+ * signature reliably. Also, the following thread reports detection
3548 -+ * failure on cold boot with the standard debouncing timing.
3549 -+ *
3550 -+ * http://thread.gmane.org/gmane.linux.ide/34098
3551 -+ *
3552 -+ * Debounce with hotplug timing and request follow-up SRST.
3553 -+ */
3554 - static struct ata_port_operations nv_nf2_ops = {
3555 - .inherits = &nv_common_ops,
3556 - .freeze = nv_nf2_freeze,
3557 - .thaw = nv_nf2_thaw,
3558 -+ .hardreset = nv_nf2_hardreset,
3559 - };
3560 -
3561 -+/* CK804 finally gets hardreset right */
3562 - static struct ata_port_operations nv_ck804_ops = {
3563 - .inherits = &nv_common_ops,
3564 - .freeze = nv_ck804_freeze,
3565 -@@ -443,7 +444,7 @@ static struct ata_port_operations nv_ck804_ops = {
3566 - };
3567 -
3568 - static struct ata_port_operations nv_adma_ops = {
3569 -- .inherits = &nv_common_ops,
3570 -+ .inherits = &nv_ck804_ops,
3571 -
3572 - .check_atapi_dma = nv_adma_check_atapi_dma,
3573 - .sff_tf_read = nv_adma_tf_read,
3574 -@@ -467,7 +468,7 @@ static struct ata_port_operations nv_adma_ops = {
3575 - };
3576 -
3577 - static struct ata_port_operations nv_swncq_ops = {
3578 -- .inherits = &nv_common_ops,
3579 -+ .inherits = &nv_generic_ops,
3580 -
3581 - .qc_defer = ata_std_qc_defer,
3582 - .qc_prep = nv_swncq_qc_prep,
3583 -@@ -1553,6 +1554,17 @@ static void nv_nf2_thaw(struct ata_port *ap)
3584 - iowrite8(mask, scr_addr + NV_INT_ENABLE);
3585 - }
3586 -
3587 -+static int nv_nf2_hardreset(struct ata_link *link, unsigned int *class,
3588 -+ unsigned long deadline)
3589 -+{
3590 -+ bool online;
3591 -+ int rc;
3592 -+
3593 -+ rc = sata_link_hardreset(link, sata_deb_timing_hotplug, deadline,
3594 -+ &online, NULL);
3595 -+ return online ? -EAGAIN : rc;
3596 -+}
3597 -+
3598 - static void nv_ck804_freeze(struct ata_port *ap)
3599 - {
3600 - void __iomem *mmio_base = ap->host->iomap[NV_MMIO_BAR];
3601 -@@ -1605,21 +1617,6 @@ static void nv_mcp55_thaw(struct ata_port *ap)
3602 - ata_sff_thaw(ap);
3603 - }
3604 -
3605 --static int nv_hardreset(struct ata_link *link, unsigned int *class,
3606 -- unsigned long deadline)
3607 --{
3608 -- int rc;
3609 --
3610 -- /* SATA hardreset fails to retrieve proper device signature on
3611 -- * some controllers. Request follow up SRST. For more info,
3612 -- * see http://bugzilla.kernel.org/show_bug.cgi?id=3352
3613 -- */
3614 -- rc = sata_sff_hardreset(link, class, deadline);
3615 -- if (rc)
3616 -- return rc;
3617 -- return -EAGAIN;
3618 --}
3619 --
3620 - static void nv_adma_error_handler(struct ata_port *ap)
3621 - {
3622 - struct nv_adma_port_priv *pp = ap->private_data;
3623 -diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
3624 -index 030665b..b26885f 100644
3625 ---- a/drivers/ata/sata_promise.c
3626 -+++ b/drivers/ata/sata_promise.c
3627 -@@ -153,6 +153,10 @@ static void pdc_freeze(struct ata_port *ap);
3628 - static void pdc_sata_freeze(struct ata_port *ap);
3629 - static void pdc_thaw(struct ata_port *ap);
3630 - static void pdc_sata_thaw(struct ata_port *ap);
3631 -+static int pdc_pata_softreset(struct ata_link *link, unsigned int *class,
3632 -+ unsigned long deadline);
3633 -+static int pdc_sata_hardreset(struct ata_link *link, unsigned int *class,
3634 -+ unsigned long deadline);
3635 - static void pdc_error_handler(struct ata_port *ap);
3636 - static void pdc_post_internal_cmd(struct ata_queued_cmd *qc);
3637 - static int pdc_pata_cable_detect(struct ata_port *ap);
3638 -@@ -186,6 +190,7 @@ static struct ata_port_operations pdc_sata_ops = {
3639 - .scr_read = pdc_sata_scr_read,
3640 - .scr_write = pdc_sata_scr_write,
3641 - .port_start = pdc_sata_port_start,
3642 -+ .hardreset = pdc_sata_hardreset,
3643 - };
3644 -
3645 - /* First-generation chips need a more restrictive ->check_atapi_dma op */
3646 -@@ -200,6 +205,7 @@ static struct ata_port_operations pdc_pata_ops = {
3647 - .freeze = pdc_freeze,
3648 - .thaw = pdc_thaw,
3649 - .port_start = pdc_common_port_start,
3650 -+ .softreset = pdc_pata_softreset,
3651 - };
3652 -
3653 - static const struct ata_port_info pdc_port_info[] = {
3654 -@@ -691,6 +697,20 @@ static void pdc_sata_thaw(struct ata_port *ap)
3655 - readl(host_mmio + hotplug_offset); /* flush */
3656 - }
3657 -
3658 -+static int pdc_pata_softreset(struct ata_link *link, unsigned int *class,
3659 -+ unsigned long deadline)
3660 -+{
3661 -+ pdc_reset_port(link->ap);
3662 -+ return ata_sff_softreset(link, class, deadline);
3663 -+}
3664 -+
3665 -+static int pdc_sata_hardreset(struct ata_link *link, unsigned int *class,
3666 -+ unsigned long deadline)
3667 -+{
3668 -+ pdc_reset_port(link->ap);
3669 -+ return sata_sff_hardreset(link, class, deadline);
3670 -+}
3671 -+
3672 - static void pdc_error_handler(struct ata_port *ap)
3673 - {
3674 - if (!(ap->pflags & ATA_PFLAG_FROZEN))
3675 -diff --git a/drivers/base/sys.c b/drivers/base/sys.c
3676 -index 75dd6e2..70499cb 100644
3677 ---- a/drivers/base/sys.c
3678 -+++ b/drivers/base/sys.c
3679 -@@ -488,7 +488,8 @@ ssize_t sysdev_store_ulong(struct sys_device *sysdev,
3680 - if (end == buf)
3681 - return -EINVAL;
3682 - *(unsigned long *)(ea->var) = new;
3683 -- return end - buf;
3684 -+ /* Always return full write size even if we didn't consume all */
3685 -+ return size;
3686 - }
3687 - EXPORT_SYMBOL_GPL(sysdev_store_ulong);
3688 -
3689 -@@ -511,7 +512,8 @@ ssize_t sysdev_store_int(struct sys_device *sysdev,
3690 - if (end == buf || new > INT_MAX || new < INT_MIN)
3691 - return -EINVAL;
3692 - *(int *)(ea->var) = new;
3693 -- return end - buf;
3694 -+ /* Always return full write size even if we didn't consume all */
3695 -+ return size;
3696 - }
3697 - EXPORT_SYMBOL_GPL(sysdev_store_int);
3698 -
3699 -diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
3700 -index 016fdf0..f1fe749 100644
3701 ---- a/drivers/char/agp/intel-agp.c
3702 -+++ b/drivers/char/agp/intel-agp.c
3703 -@@ -54,8 +54,7 @@
3704 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965Q_HB || \
3705 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_HB || \
3706 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GM_HB || \
3707 -- agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GME_HB || \
3708 -- agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_GM45_HB)
3709 -+ agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GME_HB)
3710 -
3711 - #define IS_G33 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G33_HB || \
3712 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q35_HB || \
3713 -@@ -63,7 +62,8 @@
3714 -
3715 - #define IS_G4X (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGD_E_HB || \
3716 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q45_HB || \
3717 -- agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G45_HB)
3718 -+ agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G45_HB || \
3719 -+ agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_GM45_HB)
3720 -
3721 - extern int agp_memory_reserved;
3722 -
3723 -@@ -525,8 +525,10 @@ static void intel_i830_init_gtt_entries(void)
3724 - size += 4;
3725 - } else if (IS_G4X) {
3726 - /* On 4 series hardware, GTT stolen is separate from graphics
3727 -- * stolen, ignore it in stolen gtt entries counting */
3728 -- size = 0;
3729 -+ * stolen, ignore it in stolen gtt entries counting. However,
3730 -+ * 4KB of the stolen memory doesn't get mapped to the GTT.
3731 -+ */
3732 -+ size = 4;
3733 - } else {
3734 - /* On previous hardware, the GTT size was just what was
3735 - * required to map the aperture.
3736 -diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c
3737 -index 64e1c16..ecaf369 100644
3738 ---- a/drivers/char/ipmi/ipmi_devintf.c
3739 -+++ b/drivers/char/ipmi/ipmi_devintf.c
3740 -@@ -957,3 +957,4 @@ module_exit(cleanup_ipmi);
3741 - MODULE_LICENSE("GPL");
3742 - MODULE_AUTHOR("Corey Minyard <minyard@××××××.com>");
3743 - MODULE_DESCRIPTION("Linux device interface for the IPMI message handler.");
3744 -+MODULE_ALIAS("platform:ipmi_si");
3745 -diff --git a/drivers/firewire/fw-cdev.c b/drivers/firewire/fw-cdev.c
3746 -index 2e6d584..ed03234 100644
3747 ---- a/drivers/firewire/fw-cdev.c
3748 -+++ b/drivers/firewire/fw-cdev.c
3749 -@@ -720,8 +720,8 @@ static int ioctl_create_iso_context(struct client *client, void *buffer)
3750 - #define GET_PAYLOAD_LENGTH(v) ((v) & 0xffff)
3751 - #define GET_INTERRUPT(v) (((v) >> 16) & 0x01)
3752 - #define GET_SKIP(v) (((v) >> 17) & 0x01)
3753 --#define GET_TAG(v) (((v) >> 18) & 0x02)
3754 --#define GET_SY(v) (((v) >> 20) & 0x04)
3755 -+#define GET_TAG(v) (((v) >> 18) & 0x03)
3756 -+#define GET_SY(v) (((v) >> 20) & 0x0f)
3757 - #define GET_HEADER_LENGTH(v) (((v) >> 24) & 0xff)
3758 -
3759 - static int ioctl_queue_iso(struct client *client, void *buffer)
3760 -@@ -913,7 +913,7 @@ dispatch_ioctl(struct client *client, unsigned int cmd, void __user *arg)
3761 - return -EFAULT;
3762 - }
3763 -
3764 -- return 0;
3765 -+ return retval;
3766 - }
3767 -
3768 - static long
3769 -diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
3770 -index aaff50e..4f73537 100644
3771 ---- a/drivers/firewire/fw-sbp2.c
3772 -+++ b/drivers/firewire/fw-sbp2.c
3773 -@@ -172,6 +172,9 @@ struct sbp2_target {
3774 - int blocked; /* ditto */
3775 - };
3776 -
3777 -+/* Impossible login_id, to detect logout attempt before successful login */
3778 -+#define INVALID_LOGIN_ID 0x10000
3779 -+
3780 - /*
3781 - * Per section 7.4.8 of the SBP-2 spec, a mgt_ORB_timeout value can be
3782 - * provided in the config rom. Most devices do provide a value, which
3783 -@@ -791,9 +794,20 @@ static void sbp2_release_target(struct kref *kref)
3784 - scsi_remove_device(sdev);
3785 - scsi_device_put(sdev);
3786 - }
3787 -- sbp2_send_management_orb(lu, tgt->node_id, lu->generation,
3788 -- SBP2_LOGOUT_REQUEST, lu->login_id, NULL);
3789 --
3790 -+ if (lu->login_id != INVALID_LOGIN_ID) {
3791 -+ int generation, node_id;
3792 -+ /*
3793 -+ * tgt->node_id may be obsolete here if we failed
3794 -+ * during initial login or after a bus reset where
3795 -+ * the topology changed.
3796 -+ */
3797 -+ generation = device->generation;
3798 -+ smp_rmb(); /* node_id vs. generation */
3799 -+ node_id = device->node_id;
3800 -+ sbp2_send_management_orb(lu, node_id, generation,
3801 -+ SBP2_LOGOUT_REQUEST,
3802 -+ lu->login_id, NULL);
3803 -+ }
3804 - fw_core_remove_address_handler(&lu->address_handler);
3805 - list_del(&lu->link);
3806 - kfree(lu);
3807 -@@ -808,19 +822,20 @@ static void sbp2_release_target(struct kref *kref)
3808 -
3809 - static struct workqueue_struct *sbp2_wq;
3810 -
3811 -+static void sbp2_target_put(struct sbp2_target *tgt)
3812 -+{
3813 -+ kref_put(&tgt->kref, sbp2_release_target);
3814 -+}
3815 -+
3816 - /*
3817 - * Always get the target's kref when scheduling work on one its units.
3818 - * Each workqueue job is responsible to call sbp2_target_put() upon return.
3819 - */
3820 - static void sbp2_queue_work(struct sbp2_logical_unit *lu, unsigned long delay)
3821 - {
3822 -- if (queue_delayed_work(sbp2_wq, &lu->work, delay))
3823 -- kref_get(&lu->tgt->kref);
3824 --}
3825 --
3826 --static void sbp2_target_put(struct sbp2_target *tgt)
3827 --{
3828 -- kref_put(&tgt->kref, sbp2_release_target);
3829 -+ kref_get(&lu->tgt->kref);
3830 -+ if (!queue_delayed_work(sbp2_wq, &lu->work, delay))
3831 -+ sbp2_target_put(lu->tgt);
3832 - }
3833 -
3834 - static void
3835 -@@ -993,6 +1008,7 @@ static int sbp2_add_logical_unit(struct sbp2_target *tgt, int lun_entry)
3836 -
3837 - lu->tgt = tgt;
3838 - lu->lun = lun_entry & 0xffff;
3839 -+ lu->login_id = INVALID_LOGIN_ID;
3840 - lu->retries = 0;
3841 - lu->has_sdev = false;
3842 - lu->blocked = false;
3843 -@@ -1158,7 +1174,7 @@ static int sbp2_probe(struct device *dev)
3844 -
3845 - /* Do the login in a workqueue so we can easily reschedule retries. */
3846 - list_for_each_entry(lu, &tgt->lu_list, link)
3847 -- sbp2_queue_work(lu, 0);
3848 -+ sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5));
3849 - return 0;
3850 -
3851 - fail_tgt_put:
3852 -diff --git a/drivers/firewire/fw-topology.c b/drivers/firewire/fw-topology.c
3853 -index c1b8107..5e20471 100644
3854 ---- a/drivers/firewire/fw-topology.c
3855 -+++ b/drivers/firewire/fw-topology.c
3856 -@@ -413,7 +413,7 @@ static void
3857 - update_tree(struct fw_card *card, struct fw_node *root)
3858 - {
3859 - struct list_head list0, list1;
3860 -- struct fw_node *node0, *node1;
3861 -+ struct fw_node *node0, *node1, *next1;
3862 - int i, event;
3863 -
3864 - INIT_LIST_HEAD(&list0);
3865 -@@ -485,7 +485,9 @@ update_tree(struct fw_card *card, struct fw_node *root)
3866 - }
3867 -
3868 - node0 = fw_node(node0->link.next);
3869 -- node1 = fw_node(node1->link.next);
3870 -+ next1 = fw_node(node1->link.next);
3871 -+ fw_node_put(node1);
3872 -+ node1 = next1;
3873 - }
3874 - }
3875 -
3876 -diff --git a/drivers/firewire/fw-transaction.h b/drivers/firewire/fw-transaction.h
3877 -index 2ae1b0d..81b15ba 100644
3878 ---- a/drivers/firewire/fw-transaction.h
3879 -+++ b/drivers/firewire/fw-transaction.h
3880 -@@ -248,7 +248,7 @@ struct fw_card {
3881 - struct fw_node *local_node;
3882 - struct fw_node *root_node;
3883 - struct fw_node *irm_node;
3884 -- int color;
3885 -+ u8 color; /* must be u8 to match the definition in struct fw_node */
3886 - int gap_count;
3887 - bool beta_repeaters_present;
3888 -
3889 -diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
3890 -index b15f882..49144cb 100644
3891 ---- a/drivers/hid/usbhid/hid-quirks.c
3892 -+++ b/drivers/hid/usbhid/hid-quirks.c
3893 -@@ -247,8 +247,6 @@
3894 - #define USB_DEVICE_ID_LD_MACHINETEST 0x2040
3895 -
3896 - #define USB_VENDOR_ID_LOGITECH 0x046d
3897 --#define USB_DEVICE_ID_LOGITECH_LX3 0xc044
3898 --#define USB_DEVICE_ID_LOGITECH_V150 0xc047
3899 - #define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101
3900 - #define USB_DEVICE_ID_LOGITECH_HARMONY 0xc110
3901 - #define USB_DEVICE_ID_LOGITECH_HARMONY_2 0xc111
3902 -@@ -603,8 +601,6 @@ static const struct hid_blacklist {
3903 -
3904 - { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD, HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL | HID_QUIRK_LOGITECH_EXPANDED_KEYMAP },
3905 - { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500, HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL | HID_QUIRK_LOGITECH_EXPANDED_KEYMAP },
3906 -- { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_LX3, HID_QUIRK_INVERT_HWHEEL },
3907 -- { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_V150, HID_QUIRK_INVERT_HWHEEL },
3908 -
3909 - { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K, HID_QUIRK_MICROSOFT_KEYS },
3910 - { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K, HID_QUIRK_MICROSOFT_KEYS },
3911 -diff --git a/drivers/i2c/busses/scx200_i2c.c b/drivers/i2c/busses/scx200_i2c.c
3912 -index c3022a0..e4c9853 100644
3913 ---- a/drivers/i2c/busses/scx200_i2c.c
3914 -+++ b/drivers/i2c/busses/scx200_i2c.c
3915 -@@ -81,6 +81,7 @@ static struct i2c_algo_bit_data scx200_i2c_data = {
3916 -
3917 - static struct i2c_adapter scx200_i2c_ops = {
3918 - .owner = THIS_MODULE,
3919 -+ .class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
3920 - .id = I2C_HW_B_SCX200,
3921 - .algo_data = &scx200_i2c_data,
3922 - .name = "NatSemi SCx200 I2C",
3923 -diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
3924 -index b1ce10f..e32c24d 100644
3925 ---- a/drivers/input/keyboard/atkbd.c
3926 -+++ b/drivers/input/keyboard/atkbd.c
3927 -@@ -834,10 +834,10 @@ static void atkbd_disconnect(struct serio *serio)
3928 - }
3929 -
3930 - /*
3931 -- * Most special keys (Fn+F?) on Dell Latitudes do not generate release
3932 -+ * Most special keys (Fn+F?) on Dell laptops do not generate release
3933 - * events so we have to do it ourselves.
3934 - */
3935 --static void atkbd_latitude_keymap_fixup(struct atkbd *atkbd)
3936 -+static void atkbd_dell_laptop_keymap_fixup(struct atkbd *atkbd)
3937 - {
3938 - const unsigned int forced_release_keys[] = {
3939 - 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8f, 0x93,
3940 -@@ -1461,13 +1461,13 @@ static int __init atkbd_setup_fixup(const struct dmi_system_id *id)
3941 -
3942 - static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
3943 - {
3944 -- .ident = "Dell Latitude series",
3945 -+ .ident = "Dell Laptop",
3946 - .matches = {
3947 - DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
3948 -- DMI_MATCH(DMI_PRODUCT_NAME, "Latitude"),
3949 -+ DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */
3950 - },
3951 - .callback = atkbd_setup_fixup,
3952 -- .driver_data = atkbd_latitude_keymap_fixup,
3953 -+ .driver_data = atkbd_dell_laptop_keymap_fixup,
3954 - },
3955 - {
3956 - .ident = "HP 2133",
3957 -diff --git a/drivers/media/dvb/frontends/s5h1411.c b/drivers/media/dvb/frontends/s5h1411.c
3958 -index 2da1a37..a92ee16 100644
3959 ---- a/drivers/media/dvb/frontends/s5h1411.c
3960 -+++ b/drivers/media/dvb/frontends/s5h1411.c
3961 -@@ -471,6 +471,20 @@ static int s5h1411_set_spectralinversion(struct dvb_frontend *fe, int inversion)
3962 - return s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0x24, val);
3963 - }
3964 -
3965 -+static int s5h1411_set_serialmode(struct dvb_frontend *fe, int serial)
3966 -+{
3967 -+ struct s5h1411_state *state = fe->demodulator_priv;
3968 -+ u16 val;
3969 -+
3970 -+ dprintk("%s(%d)\n", __func__, serial);
3971 -+ val = s5h1411_readreg(state, S5H1411_I2C_TOP_ADDR, 0xbd) & ~0x100;
3972 -+
3973 -+ if (serial == 1)
3974 -+ val |= 0x100;
3975 -+
3976 -+ return s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0xbd, val);
3977 -+}
3978 -+
3979 - static int s5h1411_enable_modulation(struct dvb_frontend *fe,
3980 - fe_modulation_t m)
3981 - {
3982 -@@ -535,7 +549,7 @@ static int s5h1411_set_gpio(struct dvb_frontend *fe, int enable)
3983 - return s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0xe0, val);
3984 - }
3985 -
3986 --static int s5h1411_sleep(struct dvb_frontend *fe, int enable)
3987 -+static int s5h1411_set_powerstate(struct dvb_frontend *fe, int enable)
3988 - {
3989 - struct s5h1411_state *state = fe->demodulator_priv;
3990 -
3991 -@@ -551,6 +565,11 @@ static int s5h1411_sleep(struct dvb_frontend *fe, int enable)
3992 - return 0;
3993 - }
3994 -
3995 -+static int s5h1411_sleep(struct dvb_frontend *fe)
3996 -+{
3997 -+ return s5h1411_set_powerstate(fe, 1);
3998 -+}
3999 -+
4000 - static int s5h1411_register_reset(struct dvb_frontend *fe)
4001 - {
4002 - struct s5h1411_state *state = fe->demodulator_priv;
4003 -@@ -574,9 +593,6 @@ static int s5h1411_set_frontend(struct dvb_frontend *fe,
4004 -
4005 - s5h1411_enable_modulation(fe, p->u.vsb.modulation);
4006 -
4007 -- /* Allow the demod to settle */
4008 -- msleep(100);
4009 --
4010 - if (fe->ops.tuner_ops.set_params) {
4011 - if (fe->ops.i2c_gate_ctrl)
4012 - fe->ops.i2c_gate_ctrl(fe, 1);
4013 -@@ -587,6 +603,10 @@ static int s5h1411_set_frontend(struct dvb_frontend *fe,
4014 - fe->ops.i2c_gate_ctrl(fe, 0);
4015 - }
4016 -
4017 -+ /* Issue a reset to the demod so it knows to resync against the
4018 -+ newly tuned frequency */
4019 -+ s5h1411_softreset(fe);
4020 -+
4021 - return 0;
4022 - }
4023 -
4024 -@@ -599,7 +619,7 @@ static int s5h1411_init(struct dvb_frontend *fe)
4025 -
4026 - dprintk("%s()\n", __func__);
4027 -
4028 -- s5h1411_sleep(fe, 0);
4029 -+ s5h1411_set_powerstate(fe, 0);
4030 - s5h1411_register_reset(fe);
4031 -
4032 - for (i = 0; i < ARRAY_SIZE(init_tab); i++)
4033 -@@ -612,10 +632,10 @@ static int s5h1411_init(struct dvb_frontend *fe)
4034 -
4035 - if (state->config->output_mode == S5H1411_SERIAL_OUTPUT)
4036 - /* Serial */
4037 -- s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0xbd, 0x1101);
4038 -+ s5h1411_set_serialmode(fe, 1);
4039 - else
4040 - /* Parallel */
4041 -- s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0xbd, 0x1001);
4042 -+ s5h1411_set_serialmode(fe, 0);
4043 -
4044 - s5h1411_set_spectralinversion(fe, state->config->inversion);
4045 - s5h1411_set_if_freq(fe, state->config->vsb_if);
4046 -@@ -863,6 +883,7 @@ static struct dvb_frontend_ops s5h1411_ops = {
4047 - },
4048 -
4049 - .init = s5h1411_init,
4050 -+ .sleep = s5h1411_sleep,
4051 - .i2c_gate_ctrl = s5h1411_i2c_gate_ctrl,
4052 - .set_frontend = s5h1411_set_frontend,
4053 - .get_frontend = s5h1411_get_frontend,
4054 -diff --git a/drivers/media/video/pvrusb2/pvrusb2-encoder.c b/drivers/media/video/pvrusb2/pvrusb2-encoder.c
4055 -index a1252d6..273d2a1 100644
4056 ---- a/drivers/media/video/pvrusb2/pvrusb2-encoder.c
4057 -+++ b/drivers/media/video/pvrusb2/pvrusb2-encoder.c
4058 -@@ -402,6 +402,10 @@ static int pvr2_encoder_prep_config(struct pvr2_hdw *hdw)
4059 - ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_MISC,4, 0,3,0,0);
4060 - ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_MISC,4,15,0,0,0);
4061 -
4062 -+ /* prevent the PTSs from slowly drifting away in the generated
4063 -+ MPEG stream */
4064 -+ ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_MISC, 2, 4, 1);
4065 -+
4066 - return ret;
4067 - }
4068 -
4069 -diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
4070 -index e23ce77..b46e599 100644
4071 ---- a/drivers/net/atlx/atl1.c
4072 -+++ b/drivers/net/atlx/atl1.c
4073 -@@ -2317,7 +2317,8 @@ static void atl1_tx_queue(struct atl1_adapter *adapter, u16 count,
4074 - if (tpd != ptpd)
4075 - memcpy(tpd, ptpd, sizeof(struct tx_packet_desc));
4076 - tpd->buffer_addr = cpu_to_le64(buffer_info->dma);
4077 -- tpd->word2 = (cpu_to_le16(buffer_info->length) &
4078 -+ tpd->word2 &= ~(TPD_BUFLEN_MASK << TPD_BUFLEN_SHIFT);
4079 -+ tpd->word2 |= (cpu_to_le16(buffer_info->length) &
4080 - TPD_BUFLEN_MASK) << TPD_BUFLEN_SHIFT;
4081 -
4082 - /*
4083 -@@ -2426,8 +2427,8 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
4084 - vlan_tag = (vlan_tag << 4) | (vlan_tag >> 13) |
4085 - ((vlan_tag >> 9) & 0x8);
4086 - ptpd->word3 |= 1 << TPD_INS_VL_TAG_SHIFT;
4087 -- ptpd->word3 |= (vlan_tag & TPD_VL_TAGGED_MASK) <<
4088 -- TPD_VL_TAGGED_SHIFT;
4089 -+ ptpd->word2 |= (vlan_tag & TPD_VLANTAG_MASK) <<
4090 -+ TPD_VLANTAG_SHIFT;
4091 - }
4092 -
4093 - tso = atl1_tso(adapter, skb, ptpd);
4094 -diff --git a/drivers/net/atlx/atl1.h b/drivers/net/atlx/atl1.h
4095 -index a5015b1..ffa73fc 100644
4096 ---- a/drivers/net/atlx/atl1.h
4097 -+++ b/drivers/net/atlx/atl1.h
4098 -@@ -504,7 +504,7 @@ struct rx_free_desc {
4099 - #define TPD_PKTNT_MASK 0x0001
4100 - #define TPD_PKTINT_SHIFT 15
4101 - #define TPD_VLANTAG_MASK 0xFFFF
4102 --#define TPD_VLAN_SHIFT 16
4103 -+#define TPD_VLANTAG_SHIFT 16
4104 -
4105 - /* tpd word 3 bits 0:13 */
4106 - #define TPD_EOP_MASK 0x0001
4107 -diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
4108 -index b211486..4489e58 100644
4109 ---- a/drivers/net/bonding/bond_alb.c
4110 -+++ b/drivers/net/bonding/bond_alb.c
4111 -@@ -167,11 +167,14 @@ static void tlb_clear_slave(struct bonding *bond, struct slave *slave, int save_
4112 - /* clear slave from tx_hashtbl */
4113 - tx_hash_table = BOND_ALB_INFO(bond).tx_hashtbl;
4114 -
4115 -- index = SLAVE_TLB_INFO(slave).head;
4116 -- while (index != TLB_NULL_INDEX) {
4117 -- u32 next_index = tx_hash_table[index].next;
4118 -- tlb_init_table_entry(&tx_hash_table[index], save_load);
4119 -- index = next_index;
4120 -+ /* skip this if we've already freed the tx hash table */
4121 -+ if (tx_hash_table) {
4122 -+ index = SLAVE_TLB_INFO(slave).head;
4123 -+ while (index != TLB_NULL_INDEX) {
4124 -+ u32 next_index = tx_hash_table[index].next;
4125 -+ tlb_init_table_entry(&tx_hash_table[index], save_load);
4126 -+ index = next_index;
4127 -+ }
4128 - }
4129 -
4130 - tlb_init_slave(slave);
4131 -diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
4132 -index 4b27456..50927ea 100644
4133 ---- a/drivers/net/wireless/libertas/scan.c
4134 -+++ b/drivers/net/wireless/libertas/scan.c
4135 -@@ -598,8 +598,8 @@ static int lbs_process_bss(struct bss_descriptor *bss,
4136 -
4137 - switch (elem->id) {
4138 - case MFIE_TYPE_SSID:
4139 -- bss->ssid_len = elem->len;
4140 -- memcpy(bss->ssid, elem->data, elem->len);
4141 -+ bss->ssid_len = min_t(int, 32, elem->len);
4142 -+ memcpy(bss->ssid, elem->data, bss->ssid_len);
4143 - lbs_deb_scan("got SSID IE: '%s', len %u\n",
4144 - escape_essid(bss->ssid, bss->ssid_len),
4145 - bss->ssid_len);
4146 -diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
4147 -index 36698e5..bcafbd6 100644
4148 ---- a/drivers/pci/probe.c
4149 -+++ b/drivers/pci/probe.c
4150 -@@ -219,7 +219,7 @@ static inline enum pci_bar_type decode_bar(struct resource *res, u32 bar)
4151 -
4152 - res->flags = bar & ~PCI_BASE_ADDRESS_MEM_MASK;
4153 -
4154 -- if (res->flags == PCI_BASE_ADDRESS_MEM_TYPE_64)
4155 -+ if (res->flags & PCI_BASE_ADDRESS_MEM_TYPE_64)
4156 - return pci_bar_mem64;
4157 - return pci_bar_mem32;
4158 - }
4159 -diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
4160 -index b184367..6ad46d7 100644
4161 ---- a/drivers/rtc/rtc-cmos.c
4162 -+++ b/drivers/rtc/rtc-cmos.c
4163 -@@ -1030,29 +1030,32 @@ static struct platform_driver cmos_platform_driver = {
4164 -
4165 - static int __init cmos_init(void)
4166 - {
4167 -+ int retval = 0;
4168 -+
4169 - #ifdef CONFIG_PNP
4170 -- if (pnp_platform_devices)
4171 -- return pnp_register_driver(&cmos_pnp_driver);
4172 -- else
4173 -- return platform_driver_probe(&cmos_platform_driver,
4174 -- cmos_platform_probe);
4175 --#else
4176 -- return platform_driver_probe(&cmos_platform_driver,
4177 -- cmos_platform_probe);
4178 --#endif /* CONFIG_PNP */
4179 -+ pnp_register_driver(&cmos_pnp_driver);
4180 -+#endif
4181 -+
4182 -+ if (!cmos_rtc.dev)
4183 -+ retval = platform_driver_probe(&cmos_platform_driver,
4184 -+ cmos_platform_probe);
4185 -+
4186 -+ if (retval == 0)
4187 -+ return 0;
4188 -+
4189 -+#ifdef CONFIG_PNP
4190 -+ pnp_unregister_driver(&cmos_pnp_driver);
4191 -+#endif
4192 -+ return retval;
4193 - }
4194 - module_init(cmos_init);
4195 -
4196 - static void __exit cmos_exit(void)
4197 - {
4198 - #ifdef CONFIG_PNP
4199 -- if (pnp_platform_devices)
4200 -- pnp_unregister_driver(&cmos_pnp_driver);
4201 -- else
4202 -- platform_driver_unregister(&cmos_platform_driver);
4203 --#else
4204 -+ pnp_unregister_driver(&cmos_pnp_driver);
4205 -+#endif
4206 - platform_driver_unregister(&cmos_platform_driver);
4207 --#endif /* CONFIG_PNP */
4208 - }
4209 - module_exit(cmos_exit);
4210 -
4211 -diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
4212 -index e5e7d78..b7ea69c 100644
4213 ---- a/drivers/scsi/sd.c
4214 -+++ b/drivers/scsi/sd.c
4215 -@@ -1047,7 +1047,6 @@ static int sd_done(struct scsi_cmnd *SCpnt)
4216 - good_bytes = sd_completed_bytes(SCpnt);
4217 - break;
4218 - case RECOVERED_ERROR:
4219 -- case NO_SENSE:
4220 - /* Inform the user, but make sure that it's not treated
4221 - * as a hard error.
4222 - */
4223 -@@ -1056,6 +1055,15 @@ static int sd_done(struct scsi_cmnd *SCpnt)
4224 - memset(SCpnt->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
4225 - good_bytes = scsi_bufflen(SCpnt);
4226 - break;
4227 -+ case NO_SENSE:
4228 -+ /* This indicates a false check condition, so ignore it. An
4229 -+ * unknown amount of data was transferred so treat it as an
4230 -+ * error.
4231 -+ */
4232 -+ scsi_print_sense("sd", SCpnt);
4233 -+ SCpnt->result = 0;
4234 -+ memset(SCpnt->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
4235 -+ break;
4236 - case ABORTED_COMMAND:
4237 - if (sshdr.asc == 0x10) { /* DIF: Disk detected corruption */
4238 - scsi_print_result(SCpnt);
4239 -diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
4240 -index 706f3e6..7a4ccf5 100644
4241 ---- a/drivers/usb/core/hcd.c
4242 -+++ b/drivers/usb/core/hcd.c
4243 -@@ -106,6 +106,9 @@ static DEFINE_SPINLOCK(hcd_root_hub_lock);
4244 - /* used when updating an endpoint's URB list */
4245 - static DEFINE_SPINLOCK(hcd_urb_list_lock);
4246 -
4247 -+/* used to protect against unlinking URBs after the device is gone */
4248 -+static DEFINE_SPINLOCK(hcd_urb_unlink_lock);
4249 -+
4250 - /* wait queue for synchronous unlinks */
4251 - DECLARE_WAIT_QUEUE_HEAD(usb_kill_urb_queue);
4252 -
4253 -@@ -1377,10 +1380,25 @@ static int unlink1(struct usb_hcd *hcd, struct urb *urb, int status)
4254 - int usb_hcd_unlink_urb (struct urb *urb, int status)
4255 - {
4256 - struct usb_hcd *hcd;
4257 -- int retval;
4258 -+ int retval = -EIDRM;
4259 -+ unsigned long flags;
4260 -
4261 -- hcd = bus_to_hcd(urb->dev->bus);
4262 -- retval = unlink1(hcd, urb, status);
4263 -+ /* Prevent the device and bus from going away while
4264 -+ * the unlink is carried out. If they are already gone
4265 -+ * then urb->use_count must be 0, since disconnected
4266 -+ * devices can't have any active URBs.
4267 -+ */
4268 -+ spin_lock_irqsave(&hcd_urb_unlink_lock, flags);
4269 -+ if (atomic_read(&urb->use_count) > 0) {
4270 -+ retval = 0;
4271 -+ usb_get_dev(urb->dev);
4272 -+ }
4273 -+ spin_unlock_irqrestore(&hcd_urb_unlink_lock, flags);
4274 -+ if (retval == 0) {
4275 -+ hcd = bus_to_hcd(urb->dev->bus);
4276 -+ retval = unlink1(hcd, urb, status);
4277 -+ usb_put_dev(urb->dev);
4278 -+ }
4279 -
4280 - if (retval == 0)
4281 - retval = -EINPROGRESS;
4282 -@@ -1529,6 +1547,17 @@ void usb_hcd_disable_endpoint(struct usb_device *udev,
4283 - hcd->driver->endpoint_disable(hcd, ep);
4284 - }
4285 -
4286 -+/* Protect against drivers that try to unlink URBs after the device
4287 -+ * is gone, by waiting until all unlinks for @udev are finished.
4288 -+ * Since we don't currently track URBs by device, simply wait until
4289 -+ * nothing is running in the locked region of usb_hcd_unlink_urb().
4290 -+ */
4291 -+void usb_hcd_synchronize_unlinks(struct usb_device *udev)
4292 -+{
4293 -+ spin_lock_irq(&hcd_urb_unlink_lock);
4294 -+ spin_unlock_irq(&hcd_urb_unlink_lock);
4295 -+}
4296 -+
4297 - /*-------------------------------------------------------------------------*/
4298 -
4299 - /* called in any context */
4300 -diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
4301 -index 2dcde61..9465e70 100644
4302 ---- a/drivers/usb/core/hcd.h
4303 -+++ b/drivers/usb/core/hcd.h
4304 -@@ -232,6 +232,7 @@ extern void usb_hcd_flush_endpoint(struct usb_device *udev,
4305 - struct usb_host_endpoint *ep);
4306 - extern void usb_hcd_disable_endpoint(struct usb_device *udev,
4307 - struct usb_host_endpoint *ep);
4308 -+extern void usb_hcd_synchronize_unlinks(struct usb_device *udev);
4309 - extern int usb_hcd_get_frame_number(struct usb_device *udev);
4310 -
4311 - extern struct usb_hcd *usb_create_hcd(const struct hc_driver *driver,
4312 -diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
4313 -index 875de9a..769f80f 100644
4314 ---- a/drivers/usb/core/hub.c
4315 -+++ b/drivers/usb/core/hub.c
4316 -@@ -1349,6 +1349,7 @@ void usb_disconnect(struct usb_device **pdev)
4317 - */
4318 - dev_dbg (&udev->dev, "unregistering device\n");
4319 - usb_disable_device(udev, 0);
4320 -+ usb_hcd_synchronize_unlinks(udev);
4321 -
4322 - usb_unlock_device(udev);
4323 -
4324 -diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
4325 -index 47111e8..db72269 100644
4326 ---- a/drivers/usb/core/urb.c
4327 -+++ b/drivers/usb/core/urb.c
4328 -@@ -465,6 +465,12 @@ EXPORT_SYMBOL_GPL(usb_submit_urb);
4329 - * indicating that the request has been canceled (rather than any other
4330 - * code).
4331 - *
4332 -+ * Drivers should not call this routine or related routines, such as
4333 -+ * usb_kill_urb() or usb_unlink_anchored_urbs(), after their disconnect
4334 -+ * method has returned. The disconnect function should synchronize with
4335 -+ * a driver's I/O routines to insure that all URB-related activity has
4336 -+ * completed before it returns.
4337 -+ *
4338 - * This request is always asynchronous. Success is indicated by
4339 - * returning -EINPROGRESS, at which time the URB will probably not yet
4340 - * have been given back to the device driver. When it is eventually
4341 -@@ -541,6 +547,9 @@ EXPORT_SYMBOL_GPL(usb_unlink_urb);
4342 - * This routine may not be used in an interrupt context (such as a bottom
4343 - * half or a completion handler), or when holding a spinlock, or in other
4344 - * situations where the caller can't schedule().
4345 -+ *
4346 -+ * This routine should not be called by a driver after its disconnect
4347 -+ * method has returned.
4348 - */
4349 - void usb_kill_urb(struct urb *urb)
4350 - {
4351 -@@ -568,6 +577,9 @@ EXPORT_SYMBOL_GPL(usb_kill_urb);
4352 - *
4353 - * this allows all outstanding URBs to be killed starting
4354 - * from the back of the queue
4355 -+ *
4356 -+ * This routine should not be called by a driver after its disconnect
4357 -+ * method has returned.
4358 - */
4359 - void usb_kill_anchored_urbs(struct usb_anchor *anchor)
4360 - {
4361 -@@ -597,6 +609,9 @@ EXPORT_SYMBOL_GPL(usb_kill_anchored_urbs);
4362 - * from the back of the queue. This function is asynchronous.
4363 - * The unlinking is just tiggered. It may happen after this
4364 - * function has returned.
4365 -+ *
4366 -+ * This routine should not be called by a driver after its disconnect
4367 -+ * method has returned.
4368 - */
4369 - void usb_unlink_anchored_urbs(struct usb_anchor *anchor)
4370 - {
4371 -diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
4372 -index cd15547..061df9b 100644
4373 ---- a/drivers/usb/storage/unusual_devs.h
4374 -+++ b/drivers/usb/storage/unusual_devs.h
4375 -@@ -1745,6 +1745,15 @@ UNUSUAL_DEV( 0x14cd, 0x6600, 0x0201, 0x0201,
4376 - US_SC_DEVICE, US_PR_DEVICE, NULL,
4377 - US_FL_IGNORE_RESIDUE ),
4378 -
4379 -+/* Reported by Alexandre Oliva <oliva@××××××××××××××.br>
4380 -+ * JMicron responds to USN and several other SCSI ioctls with a
4381 -+ * residue that causes subsequent I/O requests to fail. */
4382 -+UNUSUAL_DEV( 0x152d, 0x2329, 0x0100, 0x0100,
4383 -+ "JMicron",
4384 -+ "USB to ATA/ATAPI Bridge",
4385 -+ US_SC_DEVICE, US_PR_DEVICE, NULL,
4386 -+ US_FL_IGNORE_RESIDUE ),
4387 -+
4388 - /* Reported by Robert Schedel <r.schedel@×××××.de>
4389 - * Note: this is a 'super top' device like the above 14cd/6600 device */
4390 - UNUSUAL_DEV( 0x1652, 0x6600, 0x0201, 0x0201,
4391 -diff --git a/fs/hfsplus/bitmap.c b/fs/hfsplus/bitmap.c
4392 -index d128a25..ea30afc 100644
4393 ---- a/fs/hfsplus/bitmap.c
4394 -+++ b/fs/hfsplus/bitmap.c
4395 -@@ -32,6 +32,10 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *ma
4396 - mutex_lock(&HFSPLUS_SB(sb).alloc_file->i_mutex);
4397 - mapping = HFSPLUS_SB(sb).alloc_file->i_mapping;
4398 - page = read_mapping_page(mapping, offset / PAGE_CACHE_BITS, NULL);
4399 -+ if (IS_ERR(page)) {
4400 -+ start = size;
4401 -+ goto out;
4402 -+ }
4403 - pptr = kmap(page);
4404 - curr = pptr + (offset & (PAGE_CACHE_BITS - 1)) / 32;
4405 - i = offset % 32;
4406 -@@ -73,6 +77,10 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *ma
4407 - break;
4408 - page = read_mapping_page(mapping, offset / PAGE_CACHE_BITS,
4409 - NULL);
4410 -+ if (IS_ERR(page)) {
4411 -+ start = size;
4412 -+ goto out;
4413 -+ }
4414 - curr = pptr = kmap(page);
4415 - if ((size ^ offset) / PAGE_CACHE_BITS)
4416 - end = pptr + PAGE_CACHE_BITS / 32;
4417 -@@ -120,6 +128,10 @@ found:
4418 - offset += PAGE_CACHE_BITS;
4419 - page = read_mapping_page(mapping, offset / PAGE_CACHE_BITS,
4420 - NULL);
4421 -+ if (IS_ERR(page)) {
4422 -+ start = size;
4423 -+ goto out;
4424 -+ }
4425 - pptr = kmap(page);
4426 - curr = pptr;
4427 - end = pptr + PAGE_CACHE_BITS / 32;
4428 -diff --git a/fs/hfsplus/catalog.c b/fs/hfsplus/catalog.c
4429 -index ba117c4..f6874ac 100644
4430 ---- a/fs/hfsplus/catalog.c
4431 -+++ b/fs/hfsplus/catalog.c
4432 -@@ -168,6 +168,11 @@ int hfsplus_find_cat(struct super_block *sb, u32 cnid,
4433 - return -EIO;
4434 - }
4435 -
4436 -+ if (be16_to_cpu(tmp.thread.nodeName.length) > 255) {
4437 -+ printk(KERN_ERR "hfs: catalog name length corrupted\n");
4438 -+ return -EIO;
4439 -+ }
4440 -+
4441 - hfsplus_cat_build_key_uni(fd->search_key, be32_to_cpu(tmp.thread.parentID),
4442 - &tmp.thread.nodeName);
4443 - return hfs_brec_find(fd);
4444 -diff --git a/include/linux/sched.h b/include/linux/sched.h
4445 -index 3d9120c..6bfb849 100644
4446 ---- a/include/linux/sched.h
4447 -+++ b/include/linux/sched.h
4448 -@@ -1286,7 +1286,9 @@ struct task_struct {
4449 - atomic_t fs_excl; /* holding fs exclusive resources */
4450 - struct rcu_head rcu;
4451 -
4452 -- /*
4453 -+ struct list_head *scm_work_list;
4454 -+
4455 -+/*
4456 - * cache last used pipe for splice
4457 - */
4458 - struct pipe_inode_info *splice_pipe;
4459 -diff --git a/include/math-emu/op-common.h b/include/math-emu/op-common.h
4460 -index bb46e76..408f743 100644
4461 ---- a/include/math-emu/op-common.h
4462 -+++ b/include/math-emu/op-common.h
4463 -@@ -139,18 +139,27 @@ do { \
4464 - if (X##_e <= _FP_WFRACBITS_##fs) \
4465 - { \
4466 - _FP_FRAC_SRS_##wc(X, X##_e, _FP_WFRACBITS_##fs); \
4467 -- _FP_ROUND(wc, X); \
4468 - if (_FP_FRAC_HIGH_##fs(X) \
4469 - & (_FP_OVERFLOW_##fs >> 1)) \
4470 - { \
4471 - X##_e = 1; \
4472 - _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
4473 -- FP_SET_EXCEPTION(FP_EX_INEXACT); \
4474 - } \
4475 - else \
4476 - { \
4477 -- X##_e = 0; \
4478 -- _FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \
4479 -+ _FP_ROUND(wc, X); \
4480 -+ if (_FP_FRAC_HIGH_##fs(X) \
4481 -+ & (_FP_OVERFLOW_##fs >> 1)) \
4482 -+ { \
4483 -+ X##_e = 1; \
4484 -+ _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
4485 -+ FP_SET_EXCEPTION(FP_EX_INEXACT); \
4486 -+ } \
4487 -+ else \
4488 -+ { \
4489 -+ X##_e = 0; \
4490 -+ _FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \
4491 -+ } \
4492 - } \
4493 - if ((FP_CUR_EXCEPTIONS & FP_EX_INEXACT) || \
4494 - (FP_TRAPPING_EXCEPTIONS & FP_EX_UNDERFLOW)) \
4495 -diff --git a/include/net/scm.h b/include/net/scm.h
4496 -index 06df126..33e9986 100644
4497 ---- a/include/net/scm.h
4498 -+++ b/include/net/scm.h
4499 -@@ -14,8 +14,9 @@
4500 -
4501 - struct scm_fp_list
4502 - {
4503 -- int count;
4504 -- struct file *fp[SCM_MAX_FD];
4505 -+ struct list_head list;
4506 -+ int count;
4507 -+ struct file *fp[SCM_MAX_FD];
4508 - };
4509 -
4510 - struct scm_cookie
4511 -diff --git a/kernel/sched_clock.c b/kernel/sched_clock.c
4512 -index e8ab096..8178724 100644
4513 ---- a/kernel/sched_clock.c
4514 -+++ b/kernel/sched_clock.c
4515 -@@ -118,13 +118,13 @@ static u64 __update_sched_clock(struct sched_clock_data *scd, u64 now)
4516 -
4517 - /*
4518 - * scd->clock = clamp(scd->tick_gtod + delta,
4519 -- * max(scd->tick_gtod, scd->clock),
4520 -- * scd->tick_gtod + TICK_NSEC);
4521 -+ * max(scd->tick_gtod, scd->clock),
4522 -+ * max(scd->clock, scd->tick_gtod + TICK_NSEC));
4523 - */
4524 -
4525 - clock = scd->tick_gtod + delta;
4526 - min_clock = wrap_max(scd->tick_gtod, scd->clock);
4527 -- max_clock = scd->tick_gtod + TICK_NSEC;
4528 -+ max_clock = wrap_max(scd->clock, scd->tick_gtod + TICK_NSEC);
4529 -
4530 - clock = wrap_max(clock, min_clock);
4531 - clock = wrap_min(clock, max_clock);
4532 -diff --git a/kernel/sched_features.h b/kernel/sched_features.h
4533 -index 9353ca7..c4c88ae 100644
4534 ---- a/kernel/sched_features.h
4535 -+++ b/kernel/sched_features.h
4536 -@@ -5,7 +5,7 @@ SCHED_FEAT(START_DEBIT, 1)
4537 - SCHED_FEAT(AFFINE_WAKEUPS, 1)
4538 - SCHED_FEAT(CACHE_HOT_BUDDY, 1)
4539 - SCHED_FEAT(SYNC_WAKEUPS, 1)
4540 --SCHED_FEAT(HRTICK, 1)
4541 -+SCHED_FEAT(HRTICK, 0)
4542 - SCHED_FEAT(DOUBLE_TICK, 0)
4543 - SCHED_FEAT(ASYM_GRAN, 1)
4544 - SCHED_FEAT(LB_BIAS, 1)
4545 -diff --git a/net/core/scm.c b/net/core/scm.c
4546 -index 10f5c65..ab242cc 100644
4547 ---- a/net/core/scm.c
4548 -+++ b/net/core/scm.c
4549 -@@ -75,6 +75,7 @@ static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp)
4550 - if (!fpl)
4551 - return -ENOMEM;
4552 - *fplp = fpl;
4553 -+ INIT_LIST_HEAD(&fpl->list);
4554 - fpl->count = 0;
4555 - }
4556 - fpp = &fpl->fp[fpl->count];
4557 -@@ -106,9 +107,25 @@ void __scm_destroy(struct scm_cookie *scm)
4558 -
4559 - if (fpl) {
4560 - scm->fp = NULL;
4561 -- for (i=fpl->count-1; i>=0; i--)
4562 -- fput(fpl->fp[i]);
4563 -- kfree(fpl);
4564 -+ if (current->scm_work_list) {
4565 -+ list_add_tail(&fpl->list, current->scm_work_list);
4566 -+ } else {
4567 -+ LIST_HEAD(work_list);
4568 -+
4569 -+ current->scm_work_list = &work_list;
4570 -+
4571 -+ list_add(&fpl->list, &work_list);
4572 -+ while (!list_empty(&work_list)) {
4573 -+ fpl = list_first_entry(&work_list, struct scm_fp_list, list);
4574 -+
4575 -+ list_del(&fpl->list);
4576 -+ for (i=fpl->count-1; i>=0; i--)
4577 -+ fput(fpl->fp[i]);
4578 -+ kfree(fpl);
4579 -+ }
4580 -+
4581 -+ current->scm_work_list = NULL;
4582 -+ }
4583 - }
4584 - }
4585 -
4586 -@@ -284,6 +301,7 @@ struct scm_fp_list *scm_fp_dup(struct scm_fp_list *fpl)
4587 -
4588 - new_fpl = kmalloc(sizeof(*fpl), GFP_KERNEL);
4589 - if (new_fpl) {
4590 -+ INIT_LIST_HEAD(&new_fpl->list);
4591 - for (i=fpl->count-1; i>=0; i--)
4592 - get_file(fpl->fp[i]);
4593 - memcpy(new_fpl, fpl, sizeof(*fpl));
4594 -diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
4595 -index 8165f5a..d083f9a 100644
4596 ---- a/net/ipv4/tcp_output.c
4597 -+++ b/net/ipv4/tcp_output.c
4598 -@@ -357,6 +357,17 @@ struct tcp_out_options {
4599 - __u32 tsval, tsecr; /* need to include OPTION_TS */
4600 - };
4601 -
4602 -+/* Beware: Something in the Internet is very sensitive to the ordering of
4603 -+ * TCP options, we learned this through the hard way, so be careful here.
4604 -+ * Luckily we can at least blame others for their non-compliance but from
4605 -+ * inter-operatibility perspective it seems that we're somewhat stuck with
4606 -+ * the ordering which we have been using if we want to keep working with
4607 -+ * those broken things (not that it currently hurts anybody as there isn't
4608 -+ * particular reason why the ordering would need to be changed).
4609 -+ *
4610 -+ * At least SACK_PERM as the first option is known to lead to a disaster
4611 -+ * (but it may well be that other scenarios fail similarly).
4612 -+ */
4613 - static void tcp_options_write(__be32 *ptr, struct tcp_sock *tp,
4614 - const struct tcp_out_options *opts,
4615 - __u8 **md5_hash) {
4616 -@@ -371,6 +382,12 @@ static void tcp_options_write(__be32 *ptr, struct tcp_sock *tp,
4617 - *md5_hash = NULL;
4618 - }
4619 -
4620 -+ if (unlikely(opts->mss)) {
4621 -+ *ptr++ = htonl((TCPOPT_MSS << 24) |
4622 -+ (TCPOLEN_MSS << 16) |
4623 -+ opts->mss);
4624 -+ }
4625 -+
4626 - if (likely(OPTION_TS & opts->options)) {
4627 - if (unlikely(OPTION_SACK_ADVERTISE & opts->options)) {
4628 - *ptr++ = htonl((TCPOPT_SACK_PERM << 24) |
4629 -@@ -387,12 +404,6 @@ static void tcp_options_write(__be32 *ptr, struct tcp_sock *tp,
4630 - *ptr++ = htonl(opts->tsecr);
4631 - }
4632 -
4633 -- if (unlikely(opts->mss)) {
4634 -- *ptr++ = htonl((TCPOPT_MSS << 24) |
4635 -- (TCPOLEN_MSS << 16) |
4636 -- opts->mss);
4637 -- }
4638 --
4639 - if (unlikely(OPTION_SACK_ADVERTISE & opts->options &&
4640 - !(OPTION_TS & opts->options))) {
4641 - *ptr++ = htonl((TCPOPT_NOP << 24) |
4642 -@@ -2266,6 +2277,11 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst,
4643 - }
4644 -
4645 - memset(&opts, 0, sizeof(opts));
4646 -+#ifdef CONFIG_SYN_COOKIES
4647 -+ if (unlikely(req->cookie_ts))
4648 -+ TCP_SKB_CB(skb)->when = cookie_init_timestamp(req);
4649 -+ else
4650 -+#endif
4651 - TCP_SKB_CB(skb)->when = tcp_time_stamp;
4652 - tcp_header_size = tcp_synack_options(sk, req,
4653 - dst_metric(dst, RTAX_ADVMSS),
4654 -@@ -2292,11 +2308,6 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst,
4655 -
4656 - /* RFC1323: The window in SYN & SYN/ACK segments is never scaled. */
4657 - th->window = htons(min(req->rcv_wnd, 65535U));
4658 --#ifdef CONFIG_SYN_COOKIES
4659 -- if (unlikely(req->cookie_ts))
4660 -- TCP_SKB_CB(skb)->when = cookie_init_timestamp(req);
4661 -- else
4662 --#endif
4663 - tcp_options_write((__be32 *)(th + 1), tp, &opts, &md5_hash_location);
4664 - th->doff = (tcp_header_size >> 2);
4665 - TCP_INC_STATS(sock_net(sk), TCP_MIB_OUTSEGS);
4666 -diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
4667 -index 10e22fd..245cbc5 100644
4668 ---- a/net/ipv6/tcp_ipv6.c
4669 -+++ b/net/ipv6/tcp_ipv6.c
4670 -@@ -1087,7 +1087,7 @@ static void tcp_v6_send_ack(struct sk_buff *skb, u32 seq, u32 ack, u32 win, u32
4671 - *topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
4672 - (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP);
4673 - *topt++ = htonl(tcp_time_stamp);
4674 -- *topt = htonl(ts);
4675 -+ *topt++ = htonl(ts);
4676 - }
4677 -
4678 - #ifdef CONFIG_TCP_MD5SIG
4679 -diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
4680 -index ec0a083..700ae9e 100644
4681 ---- a/net/sched/sch_generic.c
4682 -+++ b/net/sched/sch_generic.c
4683 -@@ -319,6 +319,7 @@ struct Qdisc_ops noop_qdisc_ops __read_mostly = {
4684 -
4685 - static struct netdev_queue noop_netdev_queue = {
4686 - .qdisc = &noop_qdisc,
4687 -+ .qdisc_sleeping = &noop_qdisc,
4688 - };
4689 -
4690 - struct Qdisc noop_qdisc = {
4691 -@@ -344,6 +345,7 @@ static struct Qdisc_ops noqueue_qdisc_ops __read_mostly = {
4692 - static struct Qdisc noqueue_qdisc;
4693 - static struct netdev_queue noqueue_netdev_queue = {
4694 - .qdisc = &noqueue_qdisc,
4695 -+ .qdisc_sleeping = &noqueue_qdisc,
4696 - };
4697 -
4698 - static struct Qdisc noqueue_qdisc = {
4699 -diff --git a/scripts/package/mkspec b/scripts/package/mkspec
4700 -index ffd61fe..62c5ffd 100755
4701 ---- a/scripts/package/mkspec
4702 -+++ b/scripts/package/mkspec
4703 -@@ -64,8 +64,10 @@ fi
4704 - echo "%install"
4705 - echo "%ifarch ia64"
4706 - echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules'
4707 -+echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'
4708 - echo "%else"
4709 - echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules'
4710 -+echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'
4711 - echo "%endif"
4712 -
4713 - echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} modules_install'
4714 -@@ -92,5 +94,6 @@ echo "%files"
4715 - echo '%defattr (-, root, root)'
4716 - echo "%dir /lib/modules"
4717 - echo "/lib/modules/$KERNELRELEASE"
4718 -+echo "/lib/firmware"
4719 - echo "/boot/*"
4720 - echo ""
4721 -diff --git a/security/commoncap.c b/security/commoncap.c
4722 -index e4c4b3f..378172b 100644
4723 ---- a/security/commoncap.c
4724 -+++ b/security/commoncap.c
4725 -@@ -279,10 +279,10 @@ static int get_file_caps(struct linux_binprm *bprm)
4726 - struct vfs_cap_data vcaps;
4727 - struct inode *inode;
4728 -
4729 -- if (bprm->file->f_vfsmnt->mnt_flags & MNT_NOSUID) {
4730 -- bprm_clear_caps(bprm);
4731 -+ bprm_clear_caps(bprm);
4732 -+
4733 -+ if (bprm->file->f_vfsmnt->mnt_flags & MNT_NOSUID)
4734 - return 0;
4735 -- }
4736 -
4737 - dentry = dget(bprm->file->f_dentry);
4738 - inode = dentry->d_inode;
4739 -diff --git a/sound/core/control.c b/sound/core/control.c
4740 -index 281b2e2..236bbb1 100644
4741 ---- a/sound/core/control.c
4742 -+++ b/sound/core/control.c
4743 -@@ -1427,12 +1427,12 @@ static int snd_ctl_dev_disconnect(struct snd_device *device)
4744 - cardnum = card->number;
4745 - snd_assert(cardnum >= 0 && cardnum < SNDRV_CARDS, return -ENXIO);
4746 -
4747 -- down_read(&card->controls_rwsem);
4748 -+ read_lock(&card->ctl_files_rwlock);
4749 - list_for_each_entry(ctl, &card->ctl_files, list) {
4750 - wake_up(&ctl->change_sleep);
4751 - kill_fasync(&ctl->fasync, SIGIO, POLL_ERR);
4752 - }
4753 -- up_read(&card->controls_rwsem);
4754 -+ read_unlock(&card->ctl_files_rwlock);
4755 -
4756 - if ((err = snd_unregister_device(SNDRV_DEVICE_TYPE_CONTROL,
4757 - card, -1)) < 0)
4758 -diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
4759 -index 1c53e33..0f014b1 100644
4760 ---- a/sound/pci/hda/hda_intel.c
4761 -+++ b/sound/pci/hda/hda_intel.c
4762 -@@ -45,6 +45,7 @@
4763 - #include <linux/slab.h>
4764 - #include <linux/pci.h>
4765 - #include <linux/mutex.h>
4766 -+#include <linux/reboot.h>
4767 - #include <sound/core.h>
4768 - #include <sound/initval.h>
4769 - #include "hda_codec.h"
4770 -@@ -385,6 +386,9 @@ struct azx {
4771 -
4772 - /* for pending irqs */
4773 - struct work_struct irq_pending_work;
4774 -+
4775 -+ /* reboot notifier (for mysterious hangup problem at power-down) */
4776 -+ struct notifier_block reboot_notifier;
4777 - };
4778 -
4779 - /* driver types */
4780 -@@ -1890,12 +1894,36 @@ static int azx_resume(struct pci_dev *pci)
4781 -
4782 -
4783 - /*
4784 -+ * reboot notifier for hang-up problem at power-down
4785 -+ */
4786 -+static int azx_halt(struct notifier_block *nb, unsigned long event, void *buf)
4787 -+{
4788 -+ struct azx *chip = container_of(nb, struct azx, reboot_notifier);
4789 -+ azx_stop_chip(chip);
4790 -+ return NOTIFY_OK;
4791 -+}
4792 -+
4793 -+static void azx_notifier_register(struct azx *chip)
4794 -+{
4795 -+ chip->reboot_notifier.notifier_call = azx_halt;
4796 -+ register_reboot_notifier(&chip->reboot_notifier);
4797 -+}
4798 -+
4799 -+static void azx_notifier_unregister(struct azx *chip)
4800 -+{
4801 -+ if (chip->reboot_notifier.notifier_call)
4802 -+ unregister_reboot_notifier(&chip->reboot_notifier);
4803 -+}
4804 -+
4805 -+/*
4806 - * destructor
4807 - */
4808 - static int azx_free(struct azx *chip)
4809 - {
4810 - int i;
4811 -
4812 -+ azx_notifier_unregister(chip);
4813 -+
4814 - if (chip->initialized) {
4815 - azx_clear_irq_pending(chip);
4816 - for (i = 0; i < chip->num_streams; i++)
4817 -@@ -2250,6 +2278,7 @@ static int __devinit azx_probe(struct pci_dev *pci,
4818 - pci_set_drvdata(pci, card);
4819 - chip->running = 1;
4820 - power_down_all_codecs(chip);
4821 -+ azx_notifier_register(chip);
4822 -
4823 - dev++;
4824 - return err;
4825
4826 Deleted: genpatches-2.6/trunk/2.6.28/1005_linux-2.6.27.6.patch
4827 ===================================================================
4828 --- genpatches-2.6/trunk/2.6.28/1005_linux-2.6.27.6.patch 2008-12-05 00:39:44 UTC (rev 1417)
4829 +++ genpatches-2.6/trunk/2.6.28/1005_linux-2.6.27.6.patch 2008-12-05 00:43:09 UTC (rev 1418)
4830 @@ -1,2220 +0,0 @@
4831 -diff --git a/Documentation/cciss.txt b/Documentation/cciss.txt
4832 -index 8244c64..48d80d9 100644
4833 ---- a/Documentation/cciss.txt
4834 -+++ b/Documentation/cciss.txt
4835 -@@ -26,6 +26,8 @@ This driver is known to work with the following cards:
4836 - * SA P410i
4837 - * SA P411
4838 - * SA P812
4839 -+ * SA P712m
4840 -+ * SA P711m
4841 -
4842 - Detecting drive failures:
4843 - -------------------------
4844 -diff --git a/arch/arm/mach-pxa/include/mach/reset.h b/arch/arm/mach-pxa/include/mach/reset.h
4845 -index 9489a48..7b8842c 100644
4846 ---- a/arch/arm/mach-pxa/include/mach/reset.h
4847 -+++ b/arch/arm/mach-pxa/include/mach/reset.h
4848 -@@ -10,9 +10,12 @@
4849 - extern unsigned int reset_status;
4850 - extern void clear_reset_status(unsigned int mask);
4851 -
4852 --/*
4853 -- * register GPIO as reset generator
4854 -+/**
4855 -+ * init_gpio_reset() - register GPIO as reset generator
4856 -+ *
4857 -+ * @gpio - gpio nr
4858 -+ * @output - set gpio as out/low instead of input during normal work
4859 - */
4860 --extern int init_gpio_reset(int gpio);
4861 -+extern int init_gpio_reset(int gpio, int output);
4862 -
4863 - #endif /* __ASM_ARCH_RESET_H */
4864 -diff --git a/arch/arm/mach-pxa/reset.c b/arch/arm/mach-pxa/reset.c
4865 -index 9996c61..1b236a6 100644
4866 ---- a/arch/arm/mach-pxa/reset.c
4867 -+++ b/arch/arm/mach-pxa/reset.c
4868 -@@ -20,7 +20,7 @@ static void do_hw_reset(void);
4869 -
4870 - static int reset_gpio = -1;
4871 -
4872 --int init_gpio_reset(int gpio)
4873 -+int init_gpio_reset(int gpio, int output)
4874 - {
4875 - int rc;
4876 -
4877 -@@ -30,9 +30,12 @@ int init_gpio_reset(int gpio)
4878 - goto out;
4879 - }
4880 -
4881 -- rc = gpio_direction_input(gpio);
4882 -+ if (output)
4883 -+ rc = gpio_direction_output(gpio, 0);
4884 -+ else
4885 -+ rc = gpio_direction_input(gpio);
4886 - if (rc) {
4887 -- printk(KERN_ERR "Can't configure reset_gpio for input\n");
4888 -+ printk(KERN_ERR "Can't configure reset_gpio\n");
4889 - gpio_free(gpio);
4890 - goto out;
4891 - }
4892 -diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
4893 -index b569f3b..32cee4c 100644
4894 ---- a/arch/arm/mach-pxa/spitz.c
4895 -+++ b/arch/arm/mach-pxa/spitz.c
4896 -@@ -548,7 +548,7 @@ static void spitz_restart(char mode)
4897 -
4898 - static void __init common_init(void)
4899 - {
4900 -- init_gpio_reset(SPITZ_GPIO_ON_RESET);
4901 -+ init_gpio_reset(SPITZ_GPIO_ON_RESET, 1);
4902 - pm_power_off = spitz_poweroff;
4903 - arm_pm_restart = spitz_restart;
4904 -
4905 -diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
4906 -index 9f3ef9e..130e37e 100644
4907 ---- a/arch/arm/mach-pxa/tosa.c
4908 -+++ b/arch/arm/mach-pxa/tosa.c
4909 -@@ -781,7 +781,7 @@ static void __init tosa_init(void)
4910 - gpio_set_wake(MFP_PIN_GPIO1, 1);
4911 - /* We can't pass to gpio-keys since it will drop the Reset altfunc */
4912 -
4913 -- init_gpio_reset(TOSA_GPIO_ON_RESET);
4914 -+ init_gpio_reset(TOSA_GPIO_ON_RESET, 0);
4915 -
4916 - pm_power_off = tosa_poweroff;
4917 - arm_pm_restart = tosa_restart;
4918 -diff --git a/arch/arm/mm/cache-xsc3l2.c b/arch/arm/mm/cache-xsc3l2.c
4919 -index 158bd96..99ec030 100644
4920 ---- a/arch/arm/mm/cache-xsc3l2.c
4921 -+++ b/arch/arm/mm/cache-xsc3l2.c
4922 -@@ -97,7 +97,7 @@ static void xsc3_l2_inv_range(unsigned long start, unsigned long end)
4923 - /*
4924 - * Clean and invalidate partial last cache line.
4925 - */
4926 -- if (end & (CACHE_LINE_SIZE - 1)) {
4927 -+ if (start < end && (end & (CACHE_LINE_SIZE - 1))) {
4928 - xsc3_l2_clean_pa(end & ~(CACHE_LINE_SIZE - 1));
4929 - xsc3_l2_inv_pa(end & ~(CACHE_LINE_SIZE - 1));
4930 - end &= ~(CACHE_LINE_SIZE - 1);
4931 -@@ -106,7 +106,7 @@ static void xsc3_l2_inv_range(unsigned long start, unsigned long end)
4932 - /*
4933 - * Invalidate all full cache lines between 'start' and 'end'.
4934 - */
4935 -- while (start != end) {
4936 -+ while (start < end) {
4937 - xsc3_l2_inv_pa(start);
4938 - start += CACHE_LINE_SIZE;
4939 - }
4940 -diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
4941 -index ed92864..552d2b7 100644
4942 ---- a/arch/x86/Kconfig
4943 -+++ b/arch/x86/Kconfig
4944 -@@ -1059,6 +1059,26 @@ config HIGHPTE
4945 - low memory. Setting this option will put user-space page table
4946 - entries in high memory.
4947 -
4948 -+config X86_RESERVE_LOW_64K
4949 -+ bool "Reserve low 64K of RAM on AMI/Phoenix BIOSen"
4950 -+ default y
4951 -+ help
4952 -+ Reserve the first 64K of physical RAM on BIOSes that are known
4953 -+ to potentially corrupt that memory range. A numbers of BIOSes are
4954 -+ known to utilize this area during suspend/resume, so it must not
4955 -+ be used by the kernel.
4956 -+
4957 -+ Set this to N if you are absolutely sure that you trust the BIOS
4958 -+ to get all its memory reservations and usages right.
4959 -+
4960 -+ If you have doubts about the BIOS (e.g. suspend/resume does not
4961 -+ work or there's kernel crashes after certain hardware hotplug
4962 -+ events) and it's not AMI or Phoenix, then you might want to enable
4963 -+ X86_CHECK_BIOS_CORRUPTION=y to allow the kernel to check typical
4964 -+ corruption patterns.
4965 -+
4966 -+ Say Y if unsure.
4967 -+
4968 - config MATH_EMULATION
4969 - bool
4970 - prompt "Math emulation" if X86_32
4971 -diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
4972 -index 9838f25..64b5c42 100644
4973 ---- a/arch/x86/kernel/setup.c
4974 -+++ b/arch/x86/kernel/setup.c
4975 -@@ -578,6 +578,39 @@ static struct x86_quirks default_x86_quirks __initdata;
4976 -
4977 - struct x86_quirks *x86_quirks __initdata = &default_x86_quirks;
4978 -
4979 -+static int __init dmi_low_memory_corruption(const struct dmi_system_id *d)
4980 -+{
4981 -+ printk(KERN_NOTICE
4982 -+ "%s detected: BIOS may corrupt low RAM, working it around.\n",
4983 -+ d->ident);
4984 -+
4985 -+ e820_update_range(0, 0x10000, E820_RAM, E820_RESERVED);
4986 -+ sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
4987 -+
4988 -+ return 0;
4989 -+}
4990 -+
4991 -+/* List of systems that have known low memory corruption BIOS problems */
4992 -+static struct dmi_system_id __initdata bad_bios_dmi_table[] = {
4993 -+#ifdef CONFIG_X86_RESERVE_LOW_64K
4994 -+ {
4995 -+ .callback = dmi_low_memory_corruption,
4996 -+ .ident = "AMI BIOS",
4997 -+ .matches = {
4998 -+ DMI_MATCH(DMI_BIOS_VENDOR, "American Megatrends Inc."),
4999 -+ },
5000 -+ },
5001 -+ {
5002 -+ .callback = dmi_low_memory_corruption,
5003 -+ .ident = "Phoenix BIOS",
5004 -+ .matches = {
5005 -+ DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies, LTD"),
5006 -+ },
5007 -+ },
5008 -+#endif
5009 -+ {}
5010 -+};
5011 -+
5012 - /*
5013 - * Determine if we were loaded by an EFI loader. If so, then we have also been
5014 - * passed the efi memmap, systab, etc., so we should use these data structures
5015 -@@ -699,6 +732,10 @@ void __init setup_arch(char **cmdline_p)
5016 -
5017 - finish_e820_parsing();
5018 -
5019 -+ dmi_scan_machine();
5020 -+
5021 -+ dmi_check_system(bad_bios_dmi_table);
5022 -+
5023 - #ifdef CONFIG_X86_32
5024 - probe_roms();
5025 - #endif
5026 -@@ -781,8 +818,6 @@ void __init setup_arch(char **cmdline_p)
5027 - vsmp_init();
5028 - #endif
5029 -
5030 -- dmi_scan_machine();
5031 --
5032 - io_delay_init();
5033 -
5034 - /*
5035 -@@ -885,3 +920,5 @@ void __init setup_arch(char **cmdline_p)
5036 - #endif
5037 - #endif
5038 - }
5039 -+
5040 -+
5041 -diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
5042 -index 8f98e9d..de850e9 100644
5043 ---- a/arch/x86/kernel/tsc.c
5044 -+++ b/arch/x86/kernel/tsc.c
5045 -@@ -639,10 +639,6 @@ void __init tsc_init(void)
5046 - cpu_khz = calibrate_cpu();
5047 - #endif
5048 -
5049 -- lpj = ((u64)tsc_khz * 1000);
5050 -- do_div(lpj, HZ);
5051 -- lpj_fine = lpj;
5052 --
5053 - printk("Detected %lu.%03lu MHz processor.\n",
5054 - (unsigned long)cpu_khz / 1000,
5055 - (unsigned long)cpu_khz % 1000);
5056 -@@ -662,6 +658,10 @@ void __init tsc_init(void)
5057 - /* now allow native_sched_clock() to use rdtsc */
5058 - tsc_disabled = 0;
5059 -
5060 -+ lpj = ((u64)tsc_khz * 1000);
5061 -+ do_div(lpj, HZ);
5062 -+ lpj_fine = lpj;
5063 -+
5064 - use_tsc_delay();
5065 - /* Check and install the TSC clocksource */
5066 - dmi_check_system(bad_tsc_dmi_table);
5067 -diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
5068 -index 7d2edf1..25d2161 100644
5069 ---- a/drivers/acpi/dock.c
5070 -+++ b/drivers/acpi/dock.c
5071 -@@ -604,14 +604,17 @@ static int handle_eject_request(struct dock_station *ds, u32 event)
5072 - static void dock_notify(acpi_handle handle, u32 event, void *data)
5073 - {
5074 - struct dock_station *ds = data;
5075 -+ struct acpi_device *tmp;
5076 -
5077 - switch (event) {
5078 - case ACPI_NOTIFY_BUS_CHECK:
5079 -- if (!dock_in_progress(ds) && dock_present(ds)) {
5080 -+ if (!dock_in_progress(ds) && acpi_bus_get_device(ds->handle,
5081 -+ &tmp)) {
5082 - begin_dock(ds);
5083 - dock(ds);
5084 - if (!dock_present(ds)) {
5085 - printk(KERN_ERR PREFIX "Unable to dock!\n");
5086 -+ complete_dock(ds);
5087 - break;
5088 - }
5089 - atomic_notifier_call_chain(&dock_notifier_list,
5090 -diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
5091 -index c1db2f2..2c4ccec 100644
5092 ---- a/drivers/ata/libata-eh.c
5093 -+++ b/drivers/ata/libata-eh.c
5094 -@@ -604,9 +604,6 @@ void ata_scsi_error(struct Scsi_Host *host)
5095 - if (ata_ncq_enabled(dev))
5096 - ehc->saved_ncq_enabled |= 1 << devno;
5097 - }
5098 --
5099 -- /* set last reset timestamp to some time in the past */
5100 -- ehc->last_reset = jiffies - 60 * HZ;
5101 - }
5102 -
5103 - ap->pflags |= ATA_PFLAG_EH_IN_PROGRESS;
5104 -@@ -2209,17 +2206,21 @@ int ata_eh_reset(struct ata_link *link, int classify,
5105 - if (link->flags & ATA_LFLAG_NO_SRST)
5106 - softreset = NULL;
5107 -
5108 -- now = jiffies;
5109 -- deadline = ata_deadline(ehc->last_reset, ATA_EH_RESET_COOL_DOWN);
5110 -- if (time_before(now, deadline))
5111 -- schedule_timeout_uninterruptible(deadline - now);
5112 -+ /* make sure each reset attemp is at least COOL_DOWN apart */
5113 -+ if (ehc->i.flags & ATA_EHI_DID_RESET) {
5114 -+ now = jiffies;
5115 -+ WARN_ON(time_after(ehc->last_reset, now));
5116 -+ deadline = ata_deadline(ehc->last_reset,
5117 -+ ATA_EH_RESET_COOL_DOWN);
5118 -+ if (time_before(now, deadline))
5119 -+ schedule_timeout_uninterruptible(deadline - now);
5120 -+ }
5121 -
5122 - spin_lock_irqsave(ap->lock, flags);
5123 - ap->pflags |= ATA_PFLAG_RESETTING;
5124 - spin_unlock_irqrestore(ap->lock, flags);
5125 -
5126 - ata_eh_about_to_do(link, NULL, ATA_EH_RESET);
5127 -- ehc->last_reset = jiffies;
5128 -
5129 - ata_link_for_each_dev(dev, link) {
5130 - /* If we issue an SRST then an ATA drive (not ATAPI)
5131 -@@ -2285,7 +2286,6 @@ int ata_eh_reset(struct ata_link *link, int classify,
5132 - /*
5133 - * Perform reset
5134 - */
5135 -- ehc->last_reset = jiffies;
5136 - if (ata_is_host_link(link))
5137 - ata_eh_freeze_port(ap);
5138 -
5139 -@@ -2297,6 +2297,7 @@ int ata_eh_reset(struct ata_link *link, int classify,
5140 - reset == softreset ? "soft" : "hard");
5141 -
5142 - /* mark that this EH session started with reset */
5143 -+ ehc->last_reset = jiffies;
5144 - if (reset == hardreset)
5145 - ehc->i.flags |= ATA_EHI_DID_HARDRESET;
5146 - else
5147 -@@ -2404,7 +2405,7 @@ int ata_eh_reset(struct ata_link *link, int classify,
5148 -
5149 - /* reset successful, schedule revalidation */
5150 - ata_eh_done(link, NULL, ATA_EH_RESET);
5151 -- ehc->last_reset = jiffies;
5152 -+ ehc->last_reset = jiffies; /* update to completion time */
5153 - ehc->i.action |= ATA_EH_REVALIDATE;
5154 -
5155 - rc = 0;
5156 -diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
5157 -index b73116e..2ac91b8 100644
5158 ---- a/drivers/block/cciss.c
5159 -+++ b/drivers/block/cciss.c
5160 -@@ -96,6 +96,8 @@ static const struct pci_device_id cciss_pci_device_id[] = {
5161 - {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3245},
5162 - {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3247},
5163 - {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3249},
5164 -+ {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x324A},
5165 -+ {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x324B},
5166 - {PCI_VENDOR_ID_HP, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
5167 - PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0},
5168 - {0,}
5169 -@@ -133,6 +135,8 @@ static struct board_type products[] = {
5170 - {0x3245103C, "Smart Array P410i", &SA5_access},
5171 - {0x3247103C, "Smart Array P411", &SA5_access},
5172 - {0x3249103C, "Smart Array P812", &SA5_access},
5173 -+ {0x324A103C, "Smart Array P712m", &SA5_access},
5174 -+ {0x324B103C, "Smart Array P711m", &SA5_access},
5175 - {0xFFFF103C, "Unknown Smart Array", &SA5_access},
5176 - };
5177 -
5178 -@@ -1365,6 +1369,7 @@ static void cciss_add_disk(ctlr_info_t *h, struct gendisk *disk,
5179 - disk->first_minor = drv_index << NWD_SHIFT;
5180 - disk->fops = &cciss_fops;
5181 - disk->private_data = &h->drv[drv_index];
5182 -+ disk->driverfs_dev = &h->pdev->dev;
5183 -
5184 - /* Set up queue information */
5185 - blk_queue_bounce_limit(disk->queue, h->pdev->dma_mask);
5186 -@@ -3403,7 +3408,8 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
5187 - int i;
5188 - int j = 0;
5189 - int rc;
5190 -- int dac;
5191 -+ int dac, return_code;
5192 -+ InquiryData_struct *inq_buff = NULL;
5193 -
5194 - i = alloc_cciss_hba();
5195 - if (i < 0)
5196 -@@ -3509,6 +3515,25 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
5197 - /* Turn the interrupts on so we can service requests */
5198 - hba[i]->access.set_intr_mask(hba[i], CCISS_INTR_ON);
5199 -
5200 -+ /* Get the firmware version */
5201 -+ inq_buff = kzalloc(sizeof(InquiryData_struct), GFP_KERNEL);
5202 -+ if (inq_buff == NULL) {
5203 -+ printk(KERN_ERR "cciss: out of memory\n");
5204 -+ goto clean4;
5205 -+ }
5206 -+
5207 -+ return_code = sendcmd_withirq(CISS_INQUIRY, i, inq_buff,
5208 -+ sizeof(InquiryData_struct), 0, 0 , 0, TYPE_CMD);
5209 -+ if (return_code == IO_OK) {
5210 -+ hba[i]->firm_ver[0] = inq_buff->data_byte[32];
5211 -+ hba[i]->firm_ver[1] = inq_buff->data_byte[33];
5212 -+ hba[i]->firm_ver[2] = inq_buff->data_byte[34];
5213 -+ hba[i]->firm_ver[3] = inq_buff->data_byte[35];
5214 -+ } else { /* send command failed */
5215 -+ printk(KERN_WARNING "cciss: unable to determine firmware"
5216 -+ " version of controller\n");
5217 -+ }
5218 -+
5219 - cciss_procinit(i);
5220 -
5221 - hba[i]->cciss_max_sectors = 2048;
5222 -@@ -3519,6 +3544,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
5223 - return 1;
5224 -
5225 - clean4:
5226 -+ kfree(inq_buff);
5227 - #ifdef CONFIG_CISS_SCSI_TAPE
5228 - kfree(hba[i]->scsi_rejects.complete);
5229 - #endif
5230 -diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c
5231 -index 09c1434..f5d2e54 100644
5232 ---- a/drivers/block/cpqarray.c
5233 -+++ b/drivers/block/cpqarray.c
5234 -@@ -567,7 +567,12 @@ static int __init cpqarray_init(void)
5235 - num_cntlrs_reg++;
5236 - }
5237 -
5238 -- return(num_cntlrs_reg);
5239 -+ if (num_cntlrs_reg)
5240 -+ return 0;
5241 -+ else {
5242 -+ pci_unregister_driver(&cpqarray_pci_driver);
5243 -+ return -ENODEV;
5244 -+ }
5245 - }
5246 -
5247 - /* Function to find the first free pointer into our hba[] array */
5248 -diff --git a/drivers/dca/dca-core.c b/drivers/dca/dca-core.c
5249 -index ec249d2..d883e1b 100644
5250 ---- a/drivers/dca/dca-core.c
5251 -+++ b/drivers/dca/dca-core.c
5252 -@@ -270,6 +270,6 @@ static void __exit dca_exit(void)
5253 - dca_sysfs_exit();
5254 - }
5255 -
5256 --module_init(dca_init);
5257 -+subsys_initcall(dca_init);
5258 - module_exit(dca_exit);
5259 -
5260 -diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c
5261 -index bc8c6e3..3f4db54 100644
5262 ---- a/drivers/dma/ioat_dma.c
5263 -+++ b/drivers/dma/ioat_dma.c
5264 -@@ -519,7 +519,7 @@ static dma_cookie_t ioat1_tx_submit(struct dma_async_tx_descriptor *tx)
5265 - }
5266 -
5267 - hw->ctl = IOAT_DMA_DESCRIPTOR_CTL_CP_STS;
5268 -- if (new->async_tx.callback) {
5269 -+ if (first->async_tx.callback) {
5270 - hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_INT_GN;
5271 - if (first != new) {
5272 - /* move callback into to last desc */
5273 -@@ -611,7 +611,7 @@ static dma_cookie_t ioat2_tx_submit(struct dma_async_tx_descriptor *tx)
5274 - }
5275 -
5276 - hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_CP_STS;
5277 -- if (new->async_tx.callback) {
5278 -+ if (first->async_tx.callback) {
5279 - hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_INT_GN;
5280 - if (first != new) {
5281 - /* move callback into to last desc */
5282 -@@ -801,6 +801,12 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan)
5283 - struct ioat_desc_sw *desc, *_desc;
5284 - int in_use_descs = 0;
5285 -
5286 -+ /* Before freeing channel resources first check
5287 -+ * if they have been previously allocated for this channel.
5288 -+ */
5289 -+ if (ioat_chan->desccount == 0)
5290 -+ return;
5291 -+
5292 - tasklet_disable(&ioat_chan->cleanup_task);
5293 - ioat_dma_memcpy_cleanup(ioat_chan);
5294 -
5295 -@@ -863,6 +869,7 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan)
5296 - ioat_chan->last_completion = ioat_chan->completion_addr = 0;
5297 - ioat_chan->pending = 0;
5298 - ioat_chan->dmacount = 0;
5299 -+ ioat_chan->desccount = 0;
5300 - ioat_chan->watchdog_completion = 0;
5301 - ioat_chan->last_compl_desc_addr_hw = 0;
5302 - ioat_chan->watchdog_tcp_cookie =
5303 -diff --git a/drivers/dma/iovlock.c b/drivers/dma/iovlock.c
5304 -index e763d72..9f6fe46 100644
5305 ---- a/drivers/dma/iovlock.c
5306 -+++ b/drivers/dma/iovlock.c
5307 -@@ -55,7 +55,6 @@ struct dma_pinned_list *dma_pin_iovec_pages(struct iovec *iov, size_t len)
5308 - int nr_iovecs = 0;
5309 - int iovec_len_used = 0;
5310 - int iovec_pages_used = 0;
5311 -- long err;
5312 -
5313 - /* don't pin down non-user-based iovecs */
5314 - if (segment_eq(get_fs(), KERNEL_DS))
5315 -@@ -72,23 +71,21 @@ struct dma_pinned_list *dma_pin_iovec_pages(struct iovec *iov, size_t len)
5316 - local_list = kmalloc(sizeof(*local_list)
5317 - + (nr_iovecs * sizeof (struct dma_page_list))
5318 - + (iovec_pages_used * sizeof (struct page*)), GFP_KERNEL);
5319 -- if (!local_list) {
5320 -- err = -ENOMEM;
5321 -+ if (!local_list)
5322 - goto out;
5323 -- }
5324 -
5325 - /* list of pages starts right after the page list array */
5326 - pages = (struct page **) &local_list->page_list[nr_iovecs];
5327 -
5328 -+ local_list->nr_iovecs = 0;
5329 -+
5330 - for (i = 0; i < nr_iovecs; i++) {
5331 - struct dma_page_list *page_list = &local_list->page_list[i];
5332 -
5333 - len -= iov[i].iov_len;
5334 -
5335 -- if (!access_ok(VERIFY_WRITE, iov[i].iov_base, iov[i].iov_len)) {
5336 -- err = -EFAULT;
5337 -+ if (!access_ok(VERIFY_WRITE, iov[i].iov_base, iov[i].iov_len))
5338 - goto unpin;
5339 -- }
5340 -
5341 - page_list->nr_pages = num_pages_spanned(&iov[i]);
5342 - page_list->base_address = iov[i].iov_base;
5343 -@@ -109,10 +106,8 @@ struct dma_pinned_list *dma_pin_iovec_pages(struct iovec *iov, size_t len)
5344 - NULL);
5345 - up_read(&current->mm->mmap_sem);
5346 -
5347 -- if (ret != page_list->nr_pages) {
5348 -- err = -ENOMEM;
5349 -+ if (ret != page_list->nr_pages)
5350 - goto unpin;
5351 -- }
5352 -
5353 - local_list->nr_iovecs = i + 1;
5354 - }
5355 -@@ -122,7 +117,7 @@ struct dma_pinned_list *dma_pin_iovec_pages(struct iovec *iov, size_t len)
5356 - unpin:
5357 - dma_unpin_iovec_pages(local_list);
5358 - out:
5359 -- return ERR_PTR(err);
5360 -+ return NULL;
5361 - }
5362 -
5363 - void dma_unpin_iovec_pages(struct dma_pinned_list *pinned_list)
5364 -diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
5365 -index c40f040..8c030d9 100644
5366 ---- a/drivers/hid/hidraw.c
5367 -+++ b/drivers/hid/hidraw.c
5368 -@@ -113,7 +113,7 @@ static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t
5369 - if (!dev->hid_output_raw_report)
5370 - return -ENODEV;
5371 -
5372 -- if (count > HID_MIN_BUFFER_SIZE) {
5373 -+ if (count > HID_MAX_BUFFER_SIZE) {
5374 - printk(KERN_WARNING "hidraw: pid %d passed too large report\n",
5375 - task_pid_nr(current));
5376 - return -EINVAL;
5377 -diff --git a/drivers/md/linear.c b/drivers/md/linear.c
5378 -index b1eebf8..a58a19e 100644
5379 ---- a/drivers/md/linear.c
5380 -+++ b/drivers/md/linear.c
5381 -@@ -157,6 +157,8 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
5382 -
5383 - min_spacing = conf->array_sectors / 2;
5384 - sector_div(min_spacing, PAGE_SIZE/sizeof(struct dev_info *));
5385 -+ if (min_spacing == 0)
5386 -+ min_spacing = 1;
5387 -
5388 - /* min_spacing is the minimum spacing that will fit the hash
5389 - * table in one PAGE. This may be much smaller than needed.
5390 -diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
5391 -index e34cd0e..941576d 100644
5392 ---- a/drivers/md/raid10.c
5393 -+++ b/drivers/md/raid10.c
5394 -@@ -1132,7 +1132,7 @@ static int raid10_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
5395 - if (!enough(conf))
5396 - return -EINVAL;
5397 -
5398 -- if (rdev->raid_disk)
5399 -+ if (rdev->raid_disk >= 0)
5400 - first = last = rdev->raid_disk;
5401 -
5402 - if (rdev->saved_raid_disk >= 0 &&
5403 -diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
5404 -index 044d84e..f7284b9 100644
5405 ---- a/drivers/mmc/core/core.c
5406 -+++ b/drivers/mmc/core/core.c
5407 -@@ -280,7 +280,11 @@ void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card)
5408 - (card->host->ios.clock / 1000);
5409 -
5410 - if (data->flags & MMC_DATA_WRITE)
5411 -- limit_us = 250000;
5412 -+ /*
5413 -+ * The limit is really 250 ms, but that is
5414 -+ * insufficient for some crappy cards.
5415 -+ */
5416 -+ limit_us = 300000;
5417 - else
5418 - limit_us = 100000;
5419 -
5420 -diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
5421 -index a972cc6..9e7a236 100644
5422 ---- a/drivers/mtd/chips/cfi_cmdset_0002.c
5423 -+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
5424 -@@ -362,19 +362,6 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary)
5425 - /* Set the default CFI lock/unlock addresses */
5426 - cfi->addr_unlock1 = 0x555;
5427 - cfi->addr_unlock2 = 0x2aa;
5428 -- /* Modify the unlock address if we are in compatibility mode */
5429 -- if ( /* x16 in x8 mode */
5430 -- ((cfi->device_type == CFI_DEVICETYPE_X8) &&
5431 -- (cfi->cfiq->InterfaceDesc ==
5432 -- CFI_INTERFACE_X8_BY_X16_ASYNC)) ||
5433 -- /* x32 in x16 mode */
5434 -- ((cfi->device_type == CFI_DEVICETYPE_X16) &&
5435 -- (cfi->cfiq->InterfaceDesc ==
5436 -- CFI_INTERFACE_X16_BY_X32_ASYNC)))
5437 -- {
5438 -- cfi->addr_unlock1 = 0xaaa;
5439 -- cfi->addr_unlock2 = 0x555;
5440 -- }
5441 -
5442 - } /* CFI mode */
5443 - else if (cfi->cfi_mode == CFI_MODE_JEDEC) {
5444 -diff --git a/drivers/mtd/chips/jedec_probe.c b/drivers/mtd/chips/jedec_probe.c
5445 -index f84ab61..2f3f2f7 100644
5446 ---- a/drivers/mtd/chips/jedec_probe.c
5447 -+++ b/drivers/mtd/chips/jedec_probe.c
5448 -@@ -1808,9 +1808,7 @@ static inline u32 jedec_read_mfr(struct map_info *map, uint32_t base,
5449 - * several first banks can contain 0x7f instead of actual ID
5450 - */
5451 - do {
5452 -- uint32_t ofs = cfi_build_cmd_addr(0 + (bank << 8),
5453 -- cfi_interleave(cfi),
5454 -- cfi->device_type);
5455 -+ uint32_t ofs = cfi_build_cmd_addr(0 + (bank << 8), map, cfi);
5456 - mask = (1 << (cfi->device_type * 8)) - 1;
5457 - result = map_read(map, base + ofs);
5458 - bank++;
5459 -@@ -1824,7 +1822,7 @@ static inline u32 jedec_read_id(struct map_info *map, uint32_t base,
5460 - {
5461 - map_word result;
5462 - unsigned long mask;
5463 -- u32 ofs = cfi_build_cmd_addr(1, cfi_interleave(cfi), cfi->device_type);
5464 -+ u32 ofs = cfi_build_cmd_addr(1, map, cfi);
5465 - mask = (1 << (cfi->device_type * 8)) -1;
5466 - result = map_read(map, base + ofs);
5467 - return result.x[0] & mask;
5468 -@@ -2067,8 +2065,8 @@ static int jedec_probe_chip(struct map_info *map, __u32 base,
5469 -
5470 - }
5471 - /* Ensure the unlock addresses we try stay inside the map */
5472 -- probe_offset1 = cfi_build_cmd_addr(cfi->addr_unlock1, cfi_interleave(cfi), cfi->device_type);
5473 -- probe_offset2 = cfi_build_cmd_addr(cfi->addr_unlock2, cfi_interleave(cfi), cfi->device_type);
5474 -+ probe_offset1 = cfi_build_cmd_addr(cfi->addr_unlock1, map, cfi);
5475 -+ probe_offset2 = cfi_build_cmd_addr(cfi->addr_unlock2, map, cfi);
5476 - if ( ((base + probe_offset1 + map_bankwidth(map)) >= map->size) ||
5477 - ((base + probe_offset2 + map_bankwidth(map)) >= map->size))
5478 - goto retry;
5479 -diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
5480 -index 0f6f974..39c17bb 100644
5481 ---- a/drivers/net/r8169.c
5482 -+++ b/drivers/net/r8169.c
5483 -@@ -370,8 +370,9 @@ struct ring_info {
5484 - };
5485 -
5486 - enum features {
5487 -- RTL_FEATURE_WOL = (1 << 0),
5488 -- RTL_FEATURE_MSI = (1 << 1),
5489 -+ RTL_FEATURE_WOL = (1 << 0),
5490 -+ RTL_FEATURE_MSI = (1 << 1),
5491 -+ RTL_FEATURE_GMII = (1 << 2),
5492 - };
5493 -
5494 - struct rtl8169_private {
5495 -@@ -406,13 +407,15 @@ struct rtl8169_private {
5496 - struct vlan_group *vlgrp;
5497 - #endif
5498 - int (*set_speed)(struct net_device *, u8 autoneg, u16 speed, u8 duplex);
5499 -- void (*get_settings)(struct net_device *, struct ethtool_cmd *);
5500 -+ int (*get_settings)(struct net_device *, struct ethtool_cmd *);
5501 - void (*phy_reset_enable)(void __iomem *);
5502 - void (*hw_start)(struct net_device *);
5503 - unsigned int (*phy_reset_pending)(void __iomem *);
5504 - unsigned int (*link_ok)(void __iomem *);
5505 - struct delayed_work task;
5506 - unsigned features;
5507 -+
5508 -+ struct mii_if_info mii;
5509 - };
5510 -
5511 - MODULE_AUTHOR("Realtek and the Linux r8169 crew <netdev@×××××××××××.org>");
5512 -@@ -482,6 +485,23 @@ static int mdio_read(void __iomem *ioaddr, int reg_addr)
5513 - return value;
5514 - }
5515 -
5516 -+static void rtl_mdio_write(struct net_device *dev, int phy_id, int location,
5517 -+ int val)
5518 -+{
5519 -+ struct rtl8169_private *tp = netdev_priv(dev);
5520 -+ void __iomem *ioaddr = tp->mmio_addr;
5521 -+
5522 -+ mdio_write(ioaddr, location, val);
5523 -+}
5524 -+
5525 -+static int rtl_mdio_read(struct net_device *dev, int phy_id, int location)
5526 -+{
5527 -+ struct rtl8169_private *tp = netdev_priv(dev);
5528 -+ void __iomem *ioaddr = tp->mmio_addr;
5529 -+
5530 -+ return mdio_read(ioaddr, location);
5531 -+}
5532 -+
5533 - static void rtl8169_irq_mask_and_ack(void __iomem *ioaddr)
5534 - {
5535 - RTL_W16(IntrMask, 0x0000);
5536 -@@ -720,9 +740,13 @@ static int rtl8169_set_speed_xmii(struct net_device *dev,
5537 -
5538 - auto_nego |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM;
5539 -
5540 -- if ((tp->mac_version == RTL_GIGA_MAC_VER_12) ||
5541 -- (tp->mac_version == RTL_GIGA_MAC_VER_17)) {
5542 -- /* Vendor specific (0x1f) and reserved (0x0e) MII registers. */
5543 -+ if ((tp->mac_version == RTL_GIGA_MAC_VER_11) ||
5544 -+ (tp->mac_version == RTL_GIGA_MAC_VER_12) ||
5545 -+ (tp->mac_version >= RTL_GIGA_MAC_VER_17)) {
5546 -+ /*
5547 -+ * Wake up the PHY.
5548 -+ * Vendor specific (0x1f) and reserved (0x0e) MII registers.
5549 -+ */
5550 - mdio_write(ioaddr, 0x1f, 0x0000);
5551 - mdio_write(ioaddr, 0x0e, 0x0000);
5552 - }
5553 -@@ -850,7 +874,7 @@ static int rtl8169_rx_vlan_skb(struct rtl8169_private *tp, struct RxDesc *desc,
5554 -
5555 - #endif
5556 -
5557 --static void rtl8169_gset_tbi(struct net_device *dev, struct ethtool_cmd *cmd)
5558 -+static int rtl8169_gset_tbi(struct net_device *dev, struct ethtool_cmd *cmd)
5559 - {
5560 - struct rtl8169_private *tp = netdev_priv(dev);
5561 - void __iomem *ioaddr = tp->mmio_addr;
5562 -@@ -867,65 +891,29 @@ static void rtl8169_gset_tbi(struct net_device *dev, struct ethtool_cmd *cmd)
5563 -
5564 - cmd->speed = SPEED_1000;
5565 - cmd->duplex = DUPLEX_FULL; /* Always set */
5566 -+
5567 -+ return 0;
5568 - }
5569 -
5570 --static void rtl8169_gset_xmii(struct net_device *dev, struct ethtool_cmd *cmd)
5571 -+static int rtl8169_gset_xmii(struct net_device *dev, struct ethtool_cmd *cmd)
5572 - {
5573 - struct rtl8169_private *tp = netdev_priv(dev);
5574 -- void __iomem *ioaddr = tp->mmio_addr;
5575 -- u8 status;
5576 --
5577 -- cmd->supported = SUPPORTED_10baseT_Half |
5578 -- SUPPORTED_10baseT_Full |
5579 -- SUPPORTED_100baseT_Half |
5580 -- SUPPORTED_100baseT_Full |
5581 -- SUPPORTED_1000baseT_Full |
5582 -- SUPPORTED_Autoneg |
5583 -- SUPPORTED_TP;
5584 --
5585 -- cmd->autoneg = 1;
5586 -- cmd->advertising = ADVERTISED_TP | ADVERTISED_Autoneg;
5587 --
5588 -- if (tp->phy_auto_nego_reg & ADVERTISE_10HALF)
5589 -- cmd->advertising |= ADVERTISED_10baseT_Half;
5590 -- if (tp->phy_auto_nego_reg & ADVERTISE_10FULL)
5591 -- cmd->advertising |= ADVERTISED_10baseT_Full;
5592 -- if (tp->phy_auto_nego_reg & ADVERTISE_100HALF)
5593 -- cmd->advertising |= ADVERTISED_100baseT_Half;
5594 -- if (tp->phy_auto_nego_reg & ADVERTISE_100FULL)
5595 -- cmd->advertising |= ADVERTISED_100baseT_Full;
5596 -- if (tp->phy_1000_ctrl_reg & ADVERTISE_1000FULL)
5597 -- cmd->advertising |= ADVERTISED_1000baseT_Full;
5598 --
5599 -- status = RTL_R8(PHYstatus);
5600 --
5601 -- if (status & _1000bpsF)
5602 -- cmd->speed = SPEED_1000;
5603 -- else if (status & _100bps)
5604 -- cmd->speed = SPEED_100;
5605 -- else if (status & _10bps)
5606 -- cmd->speed = SPEED_10;
5607 --
5608 -- if (status & TxFlowCtrl)
5609 -- cmd->advertising |= ADVERTISED_Asym_Pause;
5610 -- if (status & RxFlowCtrl)
5611 -- cmd->advertising |= ADVERTISED_Pause;
5612 --
5613 -- cmd->duplex = ((status & _1000bpsF) || (status & FullDup)) ?
5614 -- DUPLEX_FULL : DUPLEX_HALF;
5615 -+
5616 -+ return mii_ethtool_gset(&tp->mii, cmd);
5617 - }
5618 -
5619 - static int rtl8169_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
5620 - {
5621 - struct rtl8169_private *tp = netdev_priv(dev);
5622 - unsigned long flags;
5623 -+ int rc;
5624 -
5625 - spin_lock_irqsave(&tp->lock, flags);
5626 -
5627 -- tp->get_settings(dev, cmd);
5628 -+ rc = tp->get_settings(dev, cmd);
5629 -
5630 - spin_unlock_irqrestore(&tp->lock, flags);
5631 -- return 0;
5632 -+ return rc;
5633 - }
5634 -
5635 - static void rtl8169_get_regs(struct net_device *dev, struct ethtool_regs *regs,
5636 -@@ -1513,7 +1501,7 @@ static const struct rtl_cfg_info {
5637 - unsigned int align;
5638 - u16 intr_event;
5639 - u16 napi_event;
5640 -- unsigned msi;
5641 -+ unsigned features;
5642 - } rtl_cfg_infos [] = {
5643 - [RTL_CFG_0] = {
5644 - .hw_start = rtl_hw_start_8169,
5645 -@@ -1522,7 +1510,7 @@ static const struct rtl_cfg_info {
5646 - .intr_event = SYSErr | LinkChg | RxOverflow |
5647 - RxFIFOOver | TxErr | TxOK | RxOK | RxErr,
5648 - .napi_event = RxFIFOOver | TxErr | TxOK | RxOK | RxOverflow,
5649 -- .msi = 0
5650 -+ .features = RTL_FEATURE_GMII
5651 - },
5652 - [RTL_CFG_1] = {
5653 - .hw_start = rtl_hw_start_8168,
5654 -@@ -1531,7 +1519,7 @@ static const struct rtl_cfg_info {
5655 - .intr_event = SYSErr | LinkChg | RxOverflow |
5656 - TxErr | TxOK | RxOK | RxErr,
5657 - .napi_event = TxErr | TxOK | RxOK | RxOverflow,
5658 -- .msi = RTL_FEATURE_MSI
5659 -+ .features = RTL_FEATURE_GMII | RTL_FEATURE_MSI
5660 - },
5661 - [RTL_CFG_2] = {
5662 - .hw_start = rtl_hw_start_8101,
5663 -@@ -1540,7 +1528,7 @@ static const struct rtl_cfg_info {
5664 - .intr_event = SYSErr | LinkChg | RxOverflow | PCSTimeout |
5665 - RxFIFOOver | TxErr | TxOK | RxOK | RxErr,
5666 - .napi_event = RxFIFOOver | TxErr | TxOK | RxOK | RxOverflow,
5667 -- .msi = RTL_FEATURE_MSI
5668 -+ .features = RTL_FEATURE_MSI
5669 - }
5670 - };
5671 -
5672 -@@ -1552,7 +1540,7 @@ static unsigned rtl_try_msi(struct pci_dev *pdev, void __iomem *ioaddr,
5673 - u8 cfg2;
5674 -
5675 - cfg2 = RTL_R8(Config2) & ~MSIEnable;
5676 -- if (cfg->msi) {
5677 -+ if (cfg->features & RTL_FEATURE_MSI) {
5678 - if (pci_enable_msi(pdev)) {
5679 - dev_info(&pdev->dev, "no MSI. Back to INTx.\n");
5680 - } else {
5681 -@@ -1578,6 +1566,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
5682 - const struct rtl_cfg_info *cfg = rtl_cfg_infos + ent->driver_data;
5683 - const unsigned int region = cfg->region;
5684 - struct rtl8169_private *tp;
5685 -+ struct mii_if_info *mii;
5686 - struct net_device *dev;
5687 - void __iomem *ioaddr;
5688 - unsigned int i;
5689 -@@ -1602,6 +1591,14 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
5690 - tp->pci_dev = pdev;
5691 - tp->msg_enable = netif_msg_init(debug.msg_enable, R8169_MSG_DEFAULT);
5692 -
5693 -+ mii = &tp->mii;
5694 -+ mii->dev = dev;
5695 -+ mii->mdio_read = rtl_mdio_read;
5696 -+ mii->mdio_write = rtl_mdio_write;
5697 -+ mii->phy_id_mask = 0x1f;
5698 -+ mii->reg_num_mask = 0x1f;
5699 -+ mii->supports_gmii = !!(cfg->features & RTL_FEATURE_GMII);
5700 -+
5701 - /* enable device (incl. PCI PM wakeup and hotplug setup) */
5702 - rc = pci_enable_device(pdev);
5703 - if (rc < 0) {
5704 -@@ -2099,8 +2096,6 @@ static void rtl_hw_start_8168(struct net_device *dev)
5705 -
5706 - RTL_R8(IntrMask);
5707 -
5708 -- RTL_W32(RxMissed, 0);
5709 --
5710 - rtl_set_rx_mode(dev);
5711 -
5712 - RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
5713 -@@ -2143,8 +2138,6 @@ static void rtl_hw_start_8101(struct net_device *dev)
5714 -
5715 - RTL_R8(IntrMask);
5716 -
5717 -- RTL_W32(RxMissed, 0);
5718 --
5719 - rtl_set_rx_mode(dev);
5720 -
5721 - RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
5722 -@@ -2922,6 +2915,17 @@ static int rtl8169_poll(struct napi_struct *napi, int budget)
5723 - return work_done;
5724 - }
5725 -
5726 -+static void rtl8169_rx_missed(struct net_device *dev, void __iomem *ioaddr)
5727 -+{
5728 -+ struct rtl8169_private *tp = netdev_priv(dev);
5729 -+
5730 -+ if (tp->mac_version > RTL_GIGA_MAC_VER_06)
5731 -+ return;
5732 -+
5733 -+ dev->stats.rx_missed_errors += (RTL_R32(RxMissed) & 0xffffff);
5734 -+ RTL_W32(RxMissed, 0);
5735 -+}
5736 -+
5737 - static void rtl8169_down(struct net_device *dev)
5738 - {
5739 - struct rtl8169_private *tp = netdev_priv(dev);
5740 -@@ -2939,9 +2943,7 @@ core_down:
5741 -
5742 - rtl8169_asic_down(ioaddr);
5743 -
5744 -- /* Update the error counts. */
5745 -- dev->stats.rx_missed_errors += RTL_R32(RxMissed);
5746 -- RTL_W32(RxMissed, 0);
5747 -+ rtl8169_rx_missed(dev, ioaddr);
5748 -
5749 - spin_unlock_irq(&tp->lock);
5750 -
5751 -@@ -3063,8 +3065,7 @@ static struct net_device_stats *rtl8169_get_stats(struct net_device *dev)
5752 -
5753 - if (netif_running(dev)) {
5754 - spin_lock_irqsave(&tp->lock, flags);
5755 -- dev->stats.rx_missed_errors += RTL_R32(RxMissed);
5756 -- RTL_W32(RxMissed, 0);
5757 -+ rtl8169_rx_missed(dev, ioaddr);
5758 - spin_unlock_irqrestore(&tp->lock, flags);
5759 - }
5760 -
5761 -@@ -3089,8 +3090,7 @@ static int rtl8169_suspend(struct pci_dev *pdev, pm_message_t state)
5762 -
5763 - rtl8169_asic_down(ioaddr);
5764 -
5765 -- dev->stats.rx_missed_errors += RTL_R32(RxMissed);
5766 -- RTL_W32(RxMissed, 0);
5767 -+ rtl8169_rx_missed(dev, ioaddr);
5768 -
5769 - spin_unlock_irq(&tp->lock);
5770 -
5771 -diff --git a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h
5772 -index 17d4f31..c479ee2 100644
5773 ---- a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h
5774 -+++ b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h
5775 -@@ -129,6 +129,13 @@ struct iwl5000_shared {
5776 - __le32 padding2;
5777 - } __attribute__ ((packed));
5778 -
5779 -+/* calibrations defined for 5000 */
5780 -+/* defines the order in which results should be sent to the runtime uCode */
5781 -+enum iwl5000_calib {
5782 -+ IWL5000_CALIB_LO,
5783 -+ IWL5000_CALIB_TX_IQ,
5784 -+ IWL5000_CALIB_TX_IQ_PERD,
5785 -+};
5786 -
5787 - #endif /* __iwl_5000_hw_h__ */
5788 -
5789 -diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
5790 -index b08036a..79ff288 100644
5791 ---- a/drivers/net/wireless/iwlwifi/iwl-5000.c
5792 -+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
5793 -@@ -445,48 +445,6 @@ static int iwl5000_send_Xtal_calib(struct iwl_priv *priv)
5794 - sizeof(cal_cmd), &cal_cmd);
5795 - }
5796 -
5797 --static int iwl5000_send_calib_results(struct iwl_priv *priv)
5798 --{
5799 -- int ret = 0;
5800 --
5801 -- struct iwl_host_cmd hcmd = {
5802 -- .id = REPLY_PHY_CALIBRATION_CMD,
5803 -- .meta.flags = CMD_SIZE_HUGE,
5804 -- };
5805 --
5806 -- if (priv->calib_results.lo_res) {
5807 -- hcmd.len = priv->calib_results.lo_res_len;
5808 -- hcmd.data = priv->calib_results.lo_res;
5809 -- ret = iwl_send_cmd_sync(priv, &hcmd);
5810 --
5811 -- if (ret)
5812 -- goto err;
5813 -- }
5814 --
5815 -- if (priv->calib_results.tx_iq_res) {
5816 -- hcmd.len = priv->calib_results.tx_iq_res_len;
5817 -- hcmd.data = priv->calib_results.tx_iq_res;
5818 -- ret = iwl_send_cmd_sync(priv, &hcmd);
5819 --
5820 -- if (ret)
5821 -- goto err;
5822 -- }
5823 --
5824 -- if (priv->calib_results.tx_iq_perd_res) {
5825 -- hcmd.len = priv->calib_results.tx_iq_perd_res_len;
5826 -- hcmd.data = priv->calib_results.tx_iq_perd_res;
5827 -- ret = iwl_send_cmd_sync(priv, &hcmd);
5828 --
5829 -- if (ret)
5830 -- goto err;
5831 -- }
5832 --
5833 -- return 0;
5834 --err:
5835 -- IWL_ERROR("Error %d\n", ret);
5836 -- return ret;
5837 --}
5838 --
5839 - static int iwl5000_send_calib_cfg(struct iwl_priv *priv)
5840 - {
5841 - struct iwl5000_calib_cfg_cmd calib_cfg_cmd;
5842 -@@ -511,33 +469,30 @@ static void iwl5000_rx_calib_result(struct iwl_priv *priv,
5843 - struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
5844 - struct iwl5000_calib_hdr *hdr = (struct iwl5000_calib_hdr *)pkt->u.raw;
5845 - int len = le32_to_cpu(pkt->len) & FH_RSCSR_FRAME_SIZE_MSK;
5846 --
5847 -- iwl_free_calib_results(priv);
5848 -+ int index;
5849 -
5850 - /* reduce the size of the length field itself */
5851 - len -= 4;
5852 -
5853 -+ /* Define the order in which the results will be sent to the runtime
5854 -+ * uCode. iwl_send_calib_results sends them in a row according to their
5855 -+ * index. We sort them here */
5856 - switch (hdr->op_code) {
5857 - case IWL5000_PHY_CALIBRATE_LO_CMD:
5858 -- priv->calib_results.lo_res = kzalloc(len, GFP_ATOMIC);
5859 -- priv->calib_results.lo_res_len = len;
5860 -- memcpy(priv->calib_results.lo_res, pkt->u.raw, len);
5861 -+ index = IWL5000_CALIB_LO;
5862 - break;
5863 - case IWL5000_PHY_CALIBRATE_TX_IQ_CMD:
5864 -- priv->calib_results.tx_iq_res = kzalloc(len, GFP_ATOMIC);
5865 -- priv->calib_results.tx_iq_res_len = len;
5866 -- memcpy(priv->calib_results.tx_iq_res, pkt->u.raw, len);
5867 -+ index = IWL5000_CALIB_TX_IQ;
5868 - break;
5869 - case IWL5000_PHY_CALIBRATE_TX_IQ_PERD_CMD:
5870 -- priv->calib_results.tx_iq_perd_res = kzalloc(len, GFP_ATOMIC);
5871 -- priv->calib_results.tx_iq_perd_res_len = len;
5872 -- memcpy(priv->calib_results.tx_iq_perd_res, pkt->u.raw, len);
5873 -+ index = IWL5000_CALIB_TX_IQ_PERD;
5874 - break;
5875 - default:
5876 - IWL_ERROR("Unknown calibration notification %d\n",
5877 - hdr->op_code);
5878 - return;
5879 - }
5880 -+ iwl_calib_set(&priv->calib_results[index], pkt->u.raw, len);
5881 - }
5882 -
5883 - static void iwl5000_rx_calib_complete(struct iwl_priv *priv,
5884 -@@ -832,7 +787,7 @@ static int iwl5000_alive_notify(struct iwl_priv *priv)
5885 - iwl5000_send_Xtal_calib(priv);
5886 -
5887 - if (priv->ucode_type == UCODE_RT)
5888 -- iwl5000_send_calib_results(priv);
5889 -+ iwl_send_calib_results(priv);
5890 -
5891 - return 0;
5892 - }
5893 -diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
5894 -index e01f048..72a6743 100644
5895 ---- a/drivers/net/wireless/iwlwifi/iwl-agn.c
5896 -+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
5897 -@@ -2090,7 +2090,6 @@ static void iwl_alive_start(struct iwl_priv *priv)
5898 - iwl4965_error_recovery(priv);
5899 -
5900 - iwl_power_update_mode(priv, 1);
5901 -- ieee80211_notify_mac(priv->hw, IEEE80211_NOTIFY_RE_ASSOC);
5902 -
5903 - if (test_and_clear_bit(STATUS_MODE_PENDING, &priv->status))
5904 - iwl4965_set_mode(priv, priv->iw_mode);
5905 -@@ -2342,6 +2341,7 @@ static void iwl_bg_alive_start(struct work_struct *data)
5906 - mutex_lock(&priv->mutex);
5907 - iwl_alive_start(priv);
5908 - mutex_unlock(&priv->mutex);
5909 -+ ieee80211_notify_mac(priv->hw, IEEE80211_NOTIFY_RE_ASSOC);
5910 - }
5911 -
5912 - static void iwl4965_bg_rf_kill(struct work_struct *work)
5913 -@@ -2486,6 +2486,7 @@ static void iwl4965_post_associate(struct iwl_priv *priv)
5914 - if (!priv->vif || !priv->is_open)
5915 - return;
5916 -
5917 -+ iwl_power_cancel_timeout(priv);
5918 - iwl_scan_cancel_timeout(priv, 200);
5919 -
5920 - conf = ieee80211_get_hw_conf(priv->hw);
5921 -@@ -2503,8 +2504,7 @@ static void iwl4965_post_associate(struct iwl_priv *priv)
5922 -
5923 - priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK;
5924 -
5925 -- if (priv->current_ht_config.is_ht)
5926 -- iwl_set_rxon_ht(priv, &priv->current_ht_config);
5927 -+ iwl_set_rxon_ht(priv, &priv->current_ht_config);
5928 -
5929 - iwl_set_rxon_chain(priv);
5930 - priv->staging_rxon.assoc_id = cpu_to_le16(priv->assoc_id);
5931 -@@ -2550,10 +2550,6 @@ static void iwl4965_post_associate(struct iwl_priv *priv)
5932 - break;
5933 - }
5934 -
5935 -- /* Enable Rx differential gain and sensitivity calibrations */
5936 -- iwl_chain_noise_reset(priv);
5937 -- priv->start_calib = 1;
5938 --
5939 - if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS)
5940 - priv->assoc_station_added = 1;
5941 -
5942 -@@ -2561,7 +2557,12 @@ static void iwl4965_post_associate(struct iwl_priv *priv)
5943 - iwl_activate_qos(priv, 0);
5944 - spin_unlock_irqrestore(&priv->lock, flags);
5945 -
5946 -- iwl_power_update_mode(priv, 0);
5947 -+ iwl_power_enable_management(priv);
5948 -+
5949 -+ /* Enable Rx differential gain and sensitivity calibrations */
5950 -+ iwl_chain_noise_reset(priv);
5951 -+ priv->start_calib = 1;
5952 -+
5953 - /* we have just associated, don't start scan too early */
5954 - priv->next_scan_jiffies = jiffies + IWL_DELAY_NEXT_SCAN;
5955 - }
5956 -@@ -3212,18 +3213,26 @@ static int iwl4965_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
5957 - goto out_unlock;
5958 - }
5959 -
5960 -- /* we don't schedule scan within next_scan_jiffies period */
5961 -+ /* We don't schedule scan within next_scan_jiffies period.
5962 -+ * Avoid scanning during possible EAPOL exchange, return
5963 -+ * success immediately.
5964 -+ */
5965 - if (priv->next_scan_jiffies &&
5966 -- time_after(priv->next_scan_jiffies, jiffies)) {
5967 -- rc = -EAGAIN;
5968 -+ time_after(priv->next_scan_jiffies, jiffies)) {
5969 -+ IWL_DEBUG_SCAN("scan rejected: within next scan period\n");
5970 -+ queue_work(priv->workqueue, &priv->scan_completed);
5971 -+ rc = 0;
5972 - goto out_unlock;
5973 - }
5974 - /* if we just finished scan ask for delay */
5975 -- if (priv->last_scan_jiffies && time_after(priv->last_scan_jiffies +
5976 -- IWL_DELAY_NEXT_SCAN, jiffies)) {
5977 -- rc = -EAGAIN;
5978 -+ if (iwl_is_associated(priv) && priv->last_scan_jiffies &&
5979 -+ time_after(priv->last_scan_jiffies + IWL_DELAY_NEXT_SCAN, jiffies)) {
5980 -+ IWL_DEBUG_SCAN("scan rejected: within previous scan period\n");
5981 -+ queue_work(priv->workqueue, &priv->scan_completed);
5982 -+ rc = 0;
5983 - goto out_unlock;
5984 - }
5985 -+
5986 - if (len) {
5987 - IWL_DEBUG_SCAN("direct scan for %s [%d]\n ",
5988 - iwl_escape_essid(ssid, len), (int)len);
5989 -@@ -3546,6 +3555,16 @@ static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw)
5990 - /* Per mac80211.h: This is only used in IBSS mode... */
5991 - if (priv->iw_mode != IEEE80211_IF_TYPE_IBSS) {
5992 -
5993 -+ /* switch to CAM during association period.
5994 -+ * the ucode will block any association/authentication
5995 -+ * frome during assiciation period if it can not hear
5996 -+ * the AP because of PM. the timer enable PM back is
5997 -+ * association do not complete
5998 -+ */
5999 -+ if (priv->hw->conf.channel->flags & (IEEE80211_CHAN_PASSIVE_SCAN |
6000 -+ IEEE80211_CHAN_RADAR))
6001 -+ iwl_power_disable_management(priv, 3000);
6002 -+
6003 - IWL_DEBUG_MAC80211("leave - not in IBSS\n");
6004 - mutex_unlock(&priv->mutex);
6005 - return;
6006 -@@ -4083,6 +4102,7 @@ static void iwl_setup_deferred_work(struct iwl_priv *priv)
6007 - /* FIXME : remove when resolved PENDING */
6008 - INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed);
6009 - iwl_setup_scan_deferred_work(priv);
6010 -+ iwl_setup_power_deferred_work(priv);
6011 -
6012 - if (priv->cfg->ops->lib->setup_deferred_work)
6013 - priv->cfg->ops->lib->setup_deferred_work(priv);
6014 -@@ -4102,6 +4122,7 @@ static void iwl_cancel_deferred_work(struct iwl_priv *priv)
6015 -
6016 - cancel_delayed_work_sync(&priv->init_alive_start);
6017 - cancel_delayed_work(&priv->scan_check);
6018 -+ cancel_delayed_work_sync(&priv->set_power_save);
6019 - cancel_delayed_work(&priv->alive_start);
6020 - cancel_work_sync(&priv->beacon_update);
6021 - del_timer_sync(&priv->statistics_periodic);
6022 -@@ -4204,13 +4225,13 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
6023 -
6024 - pci_set_master(pdev);
6025 -
6026 -- err = pci_set_dma_mask(pdev, DMA_64BIT_MASK);
6027 -+ err = pci_set_dma_mask(pdev, DMA_BIT_MASK(36));
6028 - if (!err)
6029 -- err = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK);
6030 -+ err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(36));
6031 - if (err) {
6032 -- err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
6033 -+ err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
6034 - if (!err)
6035 -- err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
6036 -+ err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
6037 - /* both attempts failed: */
6038 - if (err) {
6039 - printk(KERN_WARNING "%s: No suitable DMA available.\n",
6040 -diff --git a/drivers/net/wireless/iwlwifi/iwl-calib.c b/drivers/net/wireless/iwlwifi/iwl-calib.c
6041 -index ef49440..35fb4a4 100644
6042 ---- a/drivers/net/wireless/iwlwifi/iwl-calib.c
6043 -+++ b/drivers/net/wireless/iwlwifi/iwl-calib.c
6044 -@@ -66,6 +66,66 @@
6045 - #include "iwl-core.h"
6046 - #include "iwl-calib.h"
6047 -
6048 -+/*****************************************************************************
6049 -+ * INIT calibrations framework
6050 -+ *****************************************************************************/
6051 -+
6052 -+ int iwl_send_calib_results(struct iwl_priv *priv)
6053 -+{
6054 -+ int ret = 0;
6055 -+ int i = 0;
6056 -+
6057 -+ struct iwl_host_cmd hcmd = {
6058 -+ .id = REPLY_PHY_CALIBRATION_CMD,
6059 -+ .meta.flags = CMD_SIZE_HUGE,
6060 -+ };
6061 -+
6062 -+ for (i = 0; i < IWL_CALIB_MAX; i++)
6063 -+ if (priv->calib_results[i].buf) {
6064 -+ hcmd.len = priv->calib_results[i].buf_len;
6065 -+ hcmd.data = priv->calib_results[i].buf;
6066 -+ ret = iwl_send_cmd_sync(priv, &hcmd);
6067 -+ if (ret)
6068 -+ goto err;
6069 -+ }
6070 -+
6071 -+ return 0;
6072 -+err:
6073 -+ IWL_ERROR("Error %d iteration %d\n", ret, i);
6074 -+ return ret;
6075 -+}
6076 -+EXPORT_SYMBOL(iwl_send_calib_results);
6077 -+
6078 -+int iwl_calib_set(struct iwl_calib_result *res, const u8 *buf, int len)
6079 -+{
6080 -+ if (res->buf_len != len) {
6081 -+ kfree(res->buf);
6082 -+ res->buf = kzalloc(len, GFP_ATOMIC);
6083 -+ }
6084 -+ if (unlikely(res->buf == NULL))
6085 -+ return -ENOMEM;
6086 -+
6087 -+ res->buf_len = len;
6088 -+ memcpy(res->buf, buf, len);
6089 -+ return 0;
6090 -+}
6091 -+EXPORT_SYMBOL(iwl_calib_set);
6092 -+
6093 -+void iwl_calib_free_results(struct iwl_priv *priv)
6094 -+{
6095 -+ int i;
6096 -+
6097 -+ for (i = 0; i < IWL_CALIB_MAX; i++) {
6098 -+ kfree(priv->calib_results[i].buf);
6099 -+ priv->calib_results[i].buf = NULL;
6100 -+ priv->calib_results[i].buf_len = 0;
6101 -+ }
6102 -+}
6103 -+
6104 -+/*****************************************************************************
6105 -+ * RUNTIME calibrations framework
6106 -+ *****************************************************************************/
6107 -+
6108 - /* "false alarms" are signals that our DSP tries to lock onto,
6109 - * but then determines that they are either noise, or transmissions
6110 - * from a distant wireless network (also "noise", really) that get
6111 -diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
6112 -index 80f2f84..1383fd1 100644
6113 ---- a/drivers/net/wireless/iwlwifi/iwl-core.c
6114 -+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
6115 -@@ -646,8 +646,14 @@ void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info)
6116 - struct iwl_rxon_cmd *rxon = &priv->staging_rxon;
6117 - u32 val;
6118 -
6119 -- if (!ht_info->is_ht)
6120 -+ if (!ht_info->is_ht) {
6121 -+ rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MIXED_MSK |
6122 -+ RXON_FLG_CHANNEL_MODE_PURE_40_MSK |
6123 -+ RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK |
6124 -+ RXON_FLG_FAT_PROT_MSK |
6125 -+ RXON_FLG_HT_PROT_MSK);
6126 - return;
6127 -+ }
6128 -
6129 - /* Set up channel bandwidth: 20 MHz only, or 20/40 mixed if fat ok */
6130 - if (iwl_is_fat_tx_allowed(priv, NULL))
6131 -@@ -950,22 +956,6 @@ err:
6132 - }
6133 - EXPORT_SYMBOL(iwl_init_drv);
6134 -
6135 --void iwl_free_calib_results(struct iwl_priv *priv)
6136 --{
6137 -- kfree(priv->calib_results.lo_res);
6138 -- priv->calib_results.lo_res = NULL;
6139 -- priv->calib_results.lo_res_len = 0;
6140 --
6141 -- kfree(priv->calib_results.tx_iq_res);
6142 -- priv->calib_results.tx_iq_res = NULL;
6143 -- priv->calib_results.tx_iq_res_len = 0;
6144 --
6145 -- kfree(priv->calib_results.tx_iq_perd_res);
6146 -- priv->calib_results.tx_iq_perd_res = NULL;
6147 -- priv->calib_results.tx_iq_perd_res_len = 0;
6148 --}
6149 --EXPORT_SYMBOL(iwl_free_calib_results);
6150 --
6151 - int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)
6152 - {
6153 - int ret = 0;
6154 -@@ -993,10 +983,9 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)
6155 - }
6156 - EXPORT_SYMBOL(iwl_set_tx_power);
6157 -
6158 --
6159 - void iwl_uninit_drv(struct iwl_priv *priv)
6160 - {
6161 -- iwl_free_calib_results(priv);
6162 -+ iwl_calib_free_results(priv);
6163 - iwlcore_free_geos(priv);
6164 - iwl_free_channel_map(priv);
6165 - kfree(priv->scan);
6166 -diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
6167 -index 64f139e..51b36b1 100644
6168 ---- a/drivers/net/wireless/iwlwifi/iwl-core.h
6169 -+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
6170 -@@ -186,7 +186,6 @@ struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg,
6171 - void iwl_hw_detect(struct iwl_priv *priv);
6172 -
6173 - void iwl_clear_stations_table(struct iwl_priv *priv);
6174 --void iwl_free_calib_results(struct iwl_priv *priv);
6175 - void iwl_reset_qos(struct iwl_priv *priv);
6176 - void iwl_set_rxon_chain(struct iwl_priv *priv);
6177 - int iwl_set_rxon_channel(struct iwl_priv *priv,
6178 -@@ -291,6 +290,13 @@ int iwl_scan_initiate(struct iwl_priv *priv);
6179 - void iwl_setup_rx_scan_handlers(struct iwl_priv *priv);
6180 - void iwl_setup_scan_deferred_work(struct iwl_priv *priv);
6181 -
6182 -+/*******************************************************************************
6183 -+ * Calibrations - implemented in iwl-calib.c
6184 -+ ******************************************************************************/
6185 -+int iwl_send_calib_results(struct iwl_priv *priv);
6186 -+int iwl_calib_set(struct iwl_calib_result *res, const u8 *buf, int len);
6187 -+void iwl_calib_free_results(struct iwl_priv *priv);
6188 -+
6189 - /*****************************************************
6190 - * S e n d i n g H o s t C o m m a n d s *
6191 - *****************************************************/
6192 -diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
6193 -index cdfb343..09bdf8e 100644
6194 ---- a/drivers/net/wireless/iwlwifi/iwl-dev.h
6195 -+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
6196 -@@ -745,13 +745,10 @@ struct statistics_general_data {
6197 - u32 beacon_energy_c;
6198 - };
6199 -
6200 --struct iwl_calib_results {
6201 -- void *tx_iq_res;
6202 -- void *tx_iq_perd_res;
6203 -- void *lo_res;
6204 -- u32 tx_iq_res_len;
6205 -- u32 tx_iq_perd_res_len;
6206 -- u32 lo_res_len;
6207 -+/* Opaque calibration results */
6208 -+struct iwl_calib_result {
6209 -+ void *buf;
6210 -+ size_t buf_len;
6211 - };
6212 -
6213 - enum ucode_type {
6214 -@@ -813,6 +810,7 @@ enum {
6215 -
6216 -
6217 - #define IWL_MAX_NUM_QUEUES 20 /* FIXME: do dynamic allocation */
6218 -+#define IWL_CALIB_MAX 3
6219 -
6220 - struct iwl_priv {
6221 -
6222 -@@ -857,7 +855,7 @@ struct iwl_priv {
6223 - s32 last_temperature;
6224 -
6225 - /* init calibration results */
6226 -- struct iwl_calib_results calib_results;
6227 -+ struct iwl_calib_result calib_results[IWL_CALIB_MAX];
6228 -
6229 - /* Scan related variables */
6230 - unsigned long last_scan_jiffies;
6231 -@@ -1047,6 +1045,7 @@ struct iwl_priv {
6232 -
6233 - struct tasklet_struct irq_tasklet;
6234 -
6235 -+ struct delayed_work set_power_save;
6236 - struct delayed_work init_alive_start;
6237 - struct delayed_work alive_start;
6238 - struct delayed_work scan_check;
6239 -diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c
6240 -index a099c9e..ae60bfd 100644
6241 ---- a/drivers/net/wireless/iwlwifi/iwl-power.c
6242 -+++ b/drivers/net/wireless/iwlwifi/iwl-power.c
6243 -@@ -324,7 +324,7 @@ EXPORT_SYMBOL(iwl_power_update_mode);
6244 - * this will be usefull for rate scale to disable PM during heavy
6245 - * Tx/Rx activities
6246 - */
6247 --int iwl_power_disable_management(struct iwl_priv *priv)
6248 -+int iwl_power_disable_management(struct iwl_priv *priv, u32 ms)
6249 - {
6250 - u16 prev_mode;
6251 - int ret = 0;
6252 -@@ -337,6 +337,11 @@ int iwl_power_disable_management(struct iwl_priv *priv)
6253 - ret = iwl_power_update_mode(priv, 0);
6254 - priv->power_data.power_disabled = 1;
6255 - priv->power_data.user_power_setting = prev_mode;
6256 -+ cancel_delayed_work(&priv->set_power_save);
6257 -+ if (ms)
6258 -+ queue_delayed_work(priv->workqueue, &priv->set_power_save,
6259 -+ msecs_to_jiffies(ms));
6260 -+
6261 -
6262 - return ret;
6263 - }
6264 -@@ -431,3 +436,35 @@ int iwl_power_temperature_change(struct iwl_priv *priv)
6265 - return ret;
6266 - }
6267 - EXPORT_SYMBOL(iwl_power_temperature_change);
6268 -+
6269 -+static void iwl_bg_set_power_save(struct work_struct *work)
6270 -+{
6271 -+ struct iwl_priv *priv = container_of(work,
6272 -+ struct iwl_priv, set_power_save.work);
6273 -+ IWL_DEBUG(IWL_DL_STATE, "update power\n");
6274 -+
6275 -+ if (test_bit(STATUS_EXIT_PENDING, &priv->status))
6276 -+ return;
6277 -+
6278 -+ mutex_lock(&priv->mutex);
6279 -+
6280 -+ /* on starting association we disable power managment
6281 -+ * until association, if association failed then this
6282 -+ * timer will expire and enable PM again.
6283 -+ */
6284 -+ if (!iwl_is_associated(priv))
6285 -+ iwl_power_enable_management(priv);
6286 -+
6287 -+ mutex_unlock(&priv->mutex);
6288 -+}
6289 -+void iwl_setup_power_deferred_work(struct iwl_priv *priv)
6290 -+{
6291 -+ INIT_DELAYED_WORK(&priv->set_power_save, iwl_bg_set_power_save);
6292 -+}
6293 -+EXPORT_SYMBOL(iwl_setup_power_deferred_work);
6294 -+
6295 -+void iwl_power_cancel_timeout(struct iwl_priv *priv)
6296 -+{
6297 -+ cancel_delayed_work(&priv->set_power_save);
6298 -+}
6299 -+EXPORT_SYMBOL(iwl_power_cancel_timeout);
6300 -diff --git a/drivers/net/wireless/iwlwifi/iwl-power.h b/drivers/net/wireless/iwlwifi/iwl-power.h
6301 -index abcbbf9..aa99f36 100644
6302 ---- a/drivers/net/wireless/iwlwifi/iwl-power.h
6303 -+++ b/drivers/net/wireless/iwlwifi/iwl-power.h
6304 -@@ -78,8 +78,10 @@ struct iwl_power_mgr {
6305 - u8 power_disabled; /* flag to disable using power saving level */
6306 - };
6307 -
6308 -+void iwl_setup_power_deferred_work(struct iwl_priv *priv);
6309 -+void iwl_power_cancel_timeout(struct iwl_priv *priv);
6310 - int iwl_power_update_mode(struct iwl_priv *priv, u8 refresh);
6311 --int iwl_power_disable_management(struct iwl_priv *priv);
6312 -+int iwl_power_disable_management(struct iwl_priv *priv, u32 ms);
6313 - int iwl_power_enable_management(struct iwl_priv *priv);
6314 - int iwl_power_set_user_mode(struct iwl_priv *priv, u16 mode);
6315 - int iwl_power_set_system_mode(struct iwl_priv *priv, u16 mode);
6316 -diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
6317 -index 6c8ac3a..3a90a67 100644
6318 ---- a/drivers/net/wireless/iwlwifi/iwl-scan.c
6319 -+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
6320 -@@ -464,11 +464,6 @@ void iwl_init_scan_params(struct iwl_priv *priv)
6321 -
6322 - int iwl_scan_initiate(struct iwl_priv *priv)
6323 - {
6324 -- if (priv->iw_mode == IEEE80211_IF_TYPE_AP) {
6325 -- IWL_ERROR("APs don't scan.\n");
6326 -- return 0;
6327 -- }
6328 --
6329 - if (!iwl_is_ready_rf(priv)) {
6330 - IWL_DEBUG_SCAN("Aborting scan due to not ready.\n");
6331 - return -EIO;
6332 -@@ -480,8 +475,7 @@ int iwl_scan_initiate(struct iwl_priv *priv)
6333 - }
6334 -
6335 - if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) {
6336 -- IWL_DEBUG_SCAN("Scan request while abort pending. "
6337 -- "Queuing.\n");
6338 -+ IWL_DEBUG_SCAN("Scan request while abort pending\n");
6339 - return -EAGAIN;
6340 - }
6341 -
6342 -diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
6343 -index b775d5b..752e7f8 100644
6344 ---- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
6345 -+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
6346 -@@ -5761,7 +5761,6 @@ static void iwl3945_alive_start(struct iwl3945_priv *priv)
6347 - if (priv->error_recovering)
6348 - iwl3945_error_recovery(priv);
6349 -
6350 -- ieee80211_notify_mac(priv->hw, IEEE80211_NOTIFY_RE_ASSOC);
6351 - return;
6352 -
6353 - restart:
6354 -@@ -6006,6 +6005,7 @@ static void iwl3945_bg_alive_start(struct work_struct *data)
6355 - mutex_lock(&priv->mutex);
6356 - iwl3945_alive_start(priv);
6357 - mutex_unlock(&priv->mutex);
6358 -+ ieee80211_notify_mac(priv->hw, IEEE80211_NOTIFY_RE_ASSOC);
6359 - }
6360 -
6361 - static void iwl3945_bg_rf_kill(struct work_struct *work)
6362 -@@ -6259,6 +6259,11 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
6363 - direct_mask,
6364 - (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]);
6365 -
6366 -+ if (scan->channel_count == 0) {
6367 -+ IWL_DEBUG_SCAN("channel count %d\n", scan->channel_count);
6368 -+ goto done;
6369 -+ }
6370 -+
6371 - cmd.len += le16_to_cpu(scan->tx_cmd.len) +
6372 - scan->channel_count * sizeof(struct iwl3945_scan_channel);
6373 - cmd.data = scan;
6374 -diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c
6375 -index a60ae86..a3ccd8c 100644
6376 ---- a/drivers/net/wireless/zd1211rw/zd_usb.c
6377 -+++ b/drivers/net/wireless/zd1211rw/zd_usb.c
6378 -@@ -61,6 +61,7 @@ static struct usb_device_id usb_ids[] = {
6379 - { USB_DEVICE(0x0105, 0x145f), .driver_info = DEVICE_ZD1211 },
6380 - /* ZD1211B */
6381 - { USB_DEVICE(0x0ace, 0x1215), .driver_info = DEVICE_ZD1211B },
6382 -+ { USB_DEVICE(0x0ace, 0xb215), .driver_info = DEVICE_ZD1211B },
6383 - { USB_DEVICE(0x157e, 0x300d), .driver_info = DEVICE_ZD1211B },
6384 - { USB_DEVICE(0x079b, 0x0062), .driver_info = DEVICE_ZD1211B },
6385 - { USB_DEVICE(0x1582, 0x6003), .driver_info = DEVICE_ZD1211B },
6386 -@@ -82,6 +83,7 @@ static struct usb_device_id usb_ids[] = {
6387 - { USB_DEVICE(0x0cde, 0x001a), .driver_info = DEVICE_ZD1211B },
6388 - { USB_DEVICE(0x0586, 0x340a), .driver_info = DEVICE_ZD1211B },
6389 - { USB_DEVICE(0x0471, 0x1237), .driver_info = DEVICE_ZD1211B },
6390 -+ { USB_DEVICE(0x07fa, 0x1196), .driver_info = DEVICE_ZD1211B },
6391 - /* "Driverless" devices that need ejecting */
6392 - { USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER },
6393 - { USB_DEVICE(0x0ace, 0x20ff), .driver_info = DEVICE_INSTALLER },
6394 -diff --git a/fs/ext3/super.c b/fs/ext3/super.c
6395 -index f38a5af..810bf7c 100644
6396 ---- a/fs/ext3/super.c
6397 -+++ b/fs/ext3/super.c
6398 -@@ -2365,13 +2365,12 @@ static void ext3_write_super (struct super_block * sb)
6399 -
6400 - static int ext3_sync_fs(struct super_block *sb, int wait)
6401 - {
6402 -- tid_t target;
6403 --
6404 - sb->s_dirt = 0;
6405 -- if (journal_start_commit(EXT3_SB(sb)->s_journal, &target)) {
6406 -- if (wait)
6407 -- log_wait_commit(EXT3_SB(sb)->s_journal, target);
6408 -- }
6409 -+ if (wait)
6410 -+ ext3_force_commit(sb);
6411 -+ else
6412 -+ journal_start_commit(EXT3_SB(sb)->s_journal, NULL);
6413 -+
6414 - return 0;
6415 - }
6416 -
6417 -diff --git a/fs/hfs/catalog.c b/fs/hfs/catalog.c
6418 -index ba85157..6d98f11 100644
6419 ---- a/fs/hfs/catalog.c
6420 -+++ b/fs/hfs/catalog.c
6421 -@@ -190,6 +190,10 @@ int hfs_cat_find_brec(struct super_block *sb, u32 cnid,
6422 -
6423 - fd->search_key->cat.ParID = rec.thread.ParID;
6424 - len = fd->search_key->cat.CName.len = rec.thread.CName.len;
6425 -+ if (len > HFS_NAMELEN) {
6426 -+ printk(KERN_ERR "hfs: bad catalog namelength\n");
6427 -+ return -EIO;
6428 -+ }
6429 - memcpy(fd->search_key->cat.CName.name, rec.thread.CName.name, len);
6430 - return hfs_brec_find(fd);
6431 - }
6432 -diff --git a/fs/jffs2/background.c b/fs/jffs2/background.c
6433 -index 8adebd3..0fd792b 100644
6434 ---- a/fs/jffs2/background.c
6435 -+++ b/fs/jffs2/background.c
6436 -@@ -85,15 +85,15 @@ static int jffs2_garbage_collect_thread(void *_c)
6437 - for (;;) {
6438 - allow_signal(SIGHUP);
6439 - again:
6440 -+ spin_lock(&c->erase_completion_lock);
6441 - if (!jffs2_thread_should_wake(c)) {
6442 - set_current_state (TASK_INTERRUPTIBLE);
6443 -+ spin_unlock(&c->erase_completion_lock);
6444 - D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread sleeping...\n"));
6445 -- /* Yes, there's a race here; we checked jffs2_thread_should_wake()
6446 -- before setting current->state to TASK_INTERRUPTIBLE. But it doesn't
6447 -- matter - We don't care if we miss a wakeup, because the GC thread
6448 -- is only an optimisation anyway. */
6449 - schedule();
6450 -- }
6451 -+ } else
6452 -+ spin_unlock(&c->erase_completion_lock);
6453 -+
6454 -
6455 - /* This thread is purely an optimisation. But if it runs when
6456 - other things could be running, it actually makes things a
6457 -diff --git a/fs/jffs2/compr_lzo.c b/fs/jffs2/compr_lzo.c
6458 -index 47b0457..90cb60d 100644
6459 ---- a/fs/jffs2/compr_lzo.c
6460 -+++ b/fs/jffs2/compr_lzo.c
6461 -@@ -19,7 +19,7 @@
6462 -
6463 - static void *lzo_mem;
6464 - static void *lzo_compress_buf;
6465 --static DEFINE_MUTEX(deflate_mutex);
6466 -+static DEFINE_MUTEX(deflate_mutex); /* for lzo_mem and lzo_compress_buf */
6467 -
6468 - static void free_workspace(void)
6469 - {
6470 -@@ -49,18 +49,21 @@ static int jffs2_lzo_compress(unsigned char *data_in, unsigned char *cpage_out,
6471 -
6472 - mutex_lock(&deflate_mutex);
6473 - ret = lzo1x_1_compress(data_in, *sourcelen, lzo_compress_buf, &compress_size, lzo_mem);
6474 -- mutex_unlock(&deflate_mutex);
6475 --
6476 - if (ret != LZO_E_OK)
6477 -- return -1;
6478 -+ goto fail;
6479 -
6480 - if (compress_size > *dstlen)
6481 -- return -1;
6482 -+ goto fail;
6483 -
6484 - memcpy(cpage_out, lzo_compress_buf, compress_size);
6485 -- *dstlen = compress_size;
6486 -+ mutex_unlock(&deflate_mutex);
6487 -
6488 -+ *dstlen = compress_size;
6489 - return 0;
6490 -+
6491 -+ fail:
6492 -+ mutex_unlock(&deflate_mutex);
6493 -+ return -1;
6494 - }
6495 -
6496 - static int jffs2_lzo_decompress(unsigned char *data_in, unsigned char *cpage_out,
6497 -diff --git a/include/asm-generic/memory_model.h b/include/asm-generic/memory_model.h
6498 -index ae060c6..18546d8 100644
6499 ---- a/include/asm-generic/memory_model.h
6500 -+++ b/include/asm-generic/memory_model.h
6501 -@@ -34,7 +34,7 @@
6502 -
6503 - #define __pfn_to_page(pfn) \
6504 - ({ unsigned long __pfn = (pfn); \
6505 -- unsigned long __nid = arch_pfn_to_nid(pfn); \
6506 -+ unsigned long __nid = arch_pfn_to_nid(__pfn); \
6507 - NODE_DATA(__nid)->node_mem_map + arch_local_page_offset(__pfn, __nid);\
6508 - })
6509 -
6510 -diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
6511 -index d6fb115..3a16bea 100644
6512 ---- a/include/linux/mtd/cfi.h
6513 -+++ b/include/linux/mtd/cfi.h
6514 -@@ -281,9 +281,25 @@ struct cfi_private {
6515 - /*
6516 - * Returns the command address according to the given geometry.
6517 - */
6518 --static inline uint32_t cfi_build_cmd_addr(uint32_t cmd_ofs, int interleave, int type)
6519 -+static inline uint32_t cfi_build_cmd_addr(uint32_t cmd_ofs,
6520 -+ struct map_info *map, struct cfi_private *cfi)
6521 - {
6522 -- return (cmd_ofs * type) * interleave;
6523 -+ unsigned bankwidth = map_bankwidth(map);
6524 -+ unsigned interleave = cfi_interleave(cfi);
6525 -+ unsigned type = cfi->device_type;
6526 -+ uint32_t addr;
6527 -+
6528 -+ addr = (cmd_ofs * type) * interleave;
6529 -+
6530 -+ /* Modify the unlock address if we are in compatiblity mode.
6531 -+ * For 16bit devices on 8 bit busses
6532 -+ * and 32bit devices on 16 bit busses
6533 -+ * set the low bit of the alternating bit sequence of the address.
6534 -+ */
6535 -+ if (((type * interleave) > bankwidth) && ((uint8_t)cmd_ofs == 0xaa))
6536 -+ addr |= (type >> 1)*interleave;
6537 -+
6538 -+ return addr;
6539 - }
6540 -
6541 - /*
6542 -@@ -429,7 +445,7 @@ static inline uint32_t cfi_send_gen_cmd(u_char cmd, uint32_t cmd_addr, uint32_t
6543 - int type, map_word *prev_val)
6544 - {
6545 - map_word val;
6546 -- uint32_t addr = base + cfi_build_cmd_addr(cmd_addr, cfi_interleave(cfi), type);
6547 -+ uint32_t addr = base + cfi_build_cmd_addr(cmd_addr, map, cfi);
6548 -
6549 - val = cfi_build_cmd(cmd, map, cfi);
6550 -
6551 -diff --git a/include/net/af_unix.h b/include/net/af_unix.h
6552 -index 7dd29b7..c29ff1d 100644
6553 ---- a/include/net/af_unix.h
6554 -+++ b/include/net/af_unix.h
6555 -@@ -54,6 +54,7 @@ struct unix_sock {
6556 - atomic_long_t inflight;
6557 - spinlock_t lock;
6558 - unsigned int gc_candidate : 1;
6559 -+ unsigned int gc_maybe_cycle : 1;
6560 - wait_queue_head_t peer_wait;
6561 - };
6562 - #define unix_sk(__sk) ((struct unix_sock *)__sk)
6563 -diff --git a/kernel/cgroup.c b/kernel/cgroup.c
6564 -index a0123d7..d68bf2b 100644
6565 ---- a/kernel/cgroup.c
6566 -+++ b/kernel/cgroup.c
6567 -@@ -2443,7 +2443,6 @@ static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry)
6568 - list_del(&cgrp->sibling);
6569 - spin_lock(&cgrp->dentry->d_lock);
6570 - d = dget(cgrp->dentry);
6571 -- cgrp->dentry = NULL;
6572 - spin_unlock(&d->d_lock);
6573 -
6574 - cgroup_d_remove_dir(d);
6575 -diff --git a/mm/hugetlb.c b/mm/hugetlb.c
6576 -index 67a7119..77427c8 100644
6577 ---- a/mm/hugetlb.c
6578 -+++ b/mm/hugetlb.c
6579 -@@ -353,11 +353,26 @@ static int vma_has_reserves(struct vm_area_struct *vma)
6580 - return 0;
6581 - }
6582 -
6583 -+static void clear_gigantic_page(struct page *page,
6584 -+ unsigned long addr, unsigned long sz)
6585 -+{
6586 -+ int i;
6587 -+ struct page *p = page;
6588 -+
6589 -+ might_sleep();
6590 -+ for (i = 0; i < sz/PAGE_SIZE; i++, p = mem_map_next(p, page, i)) {
6591 -+ cond_resched();
6592 -+ clear_user_highpage(p, addr + i * PAGE_SIZE);
6593 -+ }
6594 -+}
6595 - static void clear_huge_page(struct page *page,
6596 - unsigned long addr, unsigned long sz)
6597 - {
6598 - int i;
6599 -
6600 -+ if (unlikely(sz > MAX_ORDER_NR_PAGES))
6601 -+ return clear_gigantic_page(page, addr, sz);
6602 -+
6603 - might_sleep();
6604 - for (i = 0; i < sz/PAGE_SIZE; i++) {
6605 - cond_resched();
6606 -@@ -365,12 +380,32 @@ static void clear_huge_page(struct page *page,
6607 - }
6608 - }
6609 -
6610 -+static void copy_gigantic_page(struct page *dst, struct page *src,
6611 -+ unsigned long addr, struct vm_area_struct *vma)
6612 -+{
6613 -+ int i;
6614 -+ struct hstate *h = hstate_vma(vma);
6615 -+ struct page *dst_base = dst;
6616 -+ struct page *src_base = src;
6617 -+ might_sleep();
6618 -+ for (i = 0; i < pages_per_huge_page(h); ) {
6619 -+ cond_resched();
6620 -+ copy_user_highpage(dst, src, addr + i*PAGE_SIZE, vma);
6621 -+
6622 -+ i++;
6623 -+ dst = mem_map_next(dst, dst_base, i);
6624 -+ src = mem_map_next(src, src_base, i);
6625 -+ }
6626 -+}
6627 - static void copy_huge_page(struct page *dst, struct page *src,
6628 - unsigned long addr, struct vm_area_struct *vma)
6629 - {
6630 - int i;
6631 - struct hstate *h = hstate_vma(vma);
6632 -
6633 -+ if (unlikely(pages_per_huge_page(h) > MAX_ORDER_NR_PAGES))
6634 -+ return copy_gigantic_page(dst, src, addr, vma);
6635 -+
6636 - might_sleep();
6637 - for (i = 0; i < pages_per_huge_page(h); i++) {
6638 - cond_resched();
6639 -@@ -455,6 +490,8 @@ static void update_and_free_page(struct hstate *h, struct page *page)
6640 - {
6641 - int i;
6642 -
6643 -+ VM_BUG_ON(h->order >= MAX_ORDER);
6644 -+
6645 - h->nr_huge_pages--;
6646 - h->nr_huge_pages_node[page_to_nid(page)]--;
6647 - for (i = 0; i < pages_per_huge_page(h); i++) {
6648 -@@ -969,6 +1006,14 @@ found:
6649 - return 1;
6650 - }
6651 -
6652 -+static void prep_compound_huge_page(struct page *page, int order)
6653 -+{
6654 -+ if (unlikely(order > (MAX_ORDER - 1)))
6655 -+ prep_compound_gigantic_page(page, order);
6656 -+ else
6657 -+ prep_compound_page(page, order);
6658 -+}
6659 -+
6660 - /* Put bootmem huge pages into the standard lists after mem_map is up */
6661 - static void __init gather_bootmem_prealloc(void)
6662 - {
6663 -@@ -979,7 +1024,7 @@ static void __init gather_bootmem_prealloc(void)
6664 - struct hstate *h = m->hstate;
6665 - __ClearPageReserved(page);
6666 - WARN_ON(page_count(page) != 1);
6667 -- prep_compound_page(page, h->order);
6668 -+ prep_compound_huge_page(page, h->order);
6669 - prep_new_huge_page(h, page, page_to_nid(page));
6670 - }
6671 - }
6672 -@@ -2103,7 +2148,7 @@ int follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma,
6673 - same_page:
6674 - if (pages) {
6675 - get_page(page);
6676 -- pages[i] = page + pfn_offset;
6677 -+ pages[i] = mem_map_offset(page, pfn_offset);
6678 - }
6679 -
6680 - if (vmas)
6681 -diff --git a/mm/internal.h b/mm/internal.h
6682 -index 1f43f74..92729ea 100644
6683 ---- a/mm/internal.h
6684 -+++ b/mm/internal.h
6685 -@@ -17,6 +17,7 @@ void free_pgtables(struct mmu_gather *tlb, struct vm_area_struct *start_vma,
6686 - unsigned long floor, unsigned long ceiling);
6687 -
6688 - extern void prep_compound_page(struct page *page, unsigned long order);
6689 -+extern void prep_compound_gigantic_page(struct page *page, unsigned long order);
6690 -
6691 - static inline void set_page_count(struct page *page, int v)
6692 - {
6693 -@@ -53,6 +54,34 @@ static inline unsigned long page_order(struct page *page)
6694 - }
6695 -
6696 - /*
6697 -+ * Return the mem_map entry representing the 'offset' subpage within
6698 -+ * the maximally aligned gigantic page 'base'. Handle any discontiguity
6699 -+ * in the mem_map at MAX_ORDER_NR_PAGES boundaries.
6700 -+ */
6701 -+static inline struct page *mem_map_offset(struct page *base, int offset)
6702 -+{
6703 -+ if (unlikely(offset >= MAX_ORDER_NR_PAGES))
6704 -+ return pfn_to_page(page_to_pfn(base) + offset);
6705 -+ return base + offset;
6706 -+}
6707 -+
6708 -+/*
6709 -+ * Iterator over all subpages withing the maximally aligned gigantic
6710 -+ * page 'base'. Handle any discontiguity in the mem_map.
6711 -+ */
6712 -+static inline struct page *mem_map_next(struct page *iter,
6713 -+ struct page *base, int offset)
6714 -+{
6715 -+ if (unlikely((offset & (MAX_ORDER_NR_PAGES - 1)) == 0)) {
6716 -+ unsigned long pfn = page_to_pfn(base) + offset;
6717 -+ if (!pfn_valid(pfn))
6718 -+ return NULL;
6719 -+ return pfn_to_page(pfn);
6720 -+ }
6721 -+ return iter + 1;
6722 -+}
6723 -+
6724 -+/*
6725 - * FLATMEM and DISCONTIGMEM configurations use alloc_bootmem_node,
6726 - * so all functions starting at paging_init should be marked __init
6727 - * in those cases. SPARSEMEM, however, allows for memory hotplug,
6728 -diff --git a/mm/page_alloc.c b/mm/page_alloc.c
6729 -index 27b8681..ed5cdae 100644
6730 ---- a/mm/page_alloc.c
6731 -+++ b/mm/page_alloc.c
6732 -@@ -268,24 +268,39 @@ void prep_compound_page(struct page *page, unsigned long order)
6733 - {
6734 - int i;
6735 - int nr_pages = 1 << order;
6736 -+
6737 -+ set_compound_page_dtor(page, free_compound_page);
6738 -+ set_compound_order(page, order);
6739 -+ __SetPageHead(page);
6740 -+ for (i = 1; i < nr_pages; i++) {
6741 -+ struct page *p = page + i;
6742 -+
6743 -+ __SetPageTail(p);
6744 -+ p->first_page = page;
6745 -+ }
6746 -+}
6747 -+
6748 -+#ifdef CONFIG_HUGETLBFS
6749 -+void prep_compound_gigantic_page(struct page *page, unsigned long order)
6750 -+{
6751 -+ int i;
6752 -+ int nr_pages = 1 << order;
6753 - struct page *p = page + 1;
6754 -
6755 - set_compound_page_dtor(page, free_compound_page);
6756 - set_compound_order(page, order);
6757 - __SetPageHead(page);
6758 -- for (i = 1; i < nr_pages; i++, p++) {
6759 -- if (unlikely((i & (MAX_ORDER_NR_PAGES - 1)) == 0))
6760 -- p = pfn_to_page(page_to_pfn(page) + i);
6761 -+ for (i = 1; i < nr_pages; i++, p = mem_map_next(p, page, i)) {
6762 - __SetPageTail(p);
6763 - p->first_page = page;
6764 - }
6765 - }
6766 -+#endif
6767 -
6768 - static void destroy_compound_page(struct page *page, unsigned long order)
6769 - {
6770 - int i;
6771 - int nr_pages = 1 << order;
6772 -- struct page *p = page + 1;
6773 -
6774 - if (unlikely(compound_order(page) != order))
6775 - bad_page(page);
6776 -@@ -293,9 +308,8 @@ static void destroy_compound_page(struct page *page, unsigned long order)
6777 - if (unlikely(!PageHead(page)))
6778 - bad_page(page);
6779 - __ClearPageHead(page);
6780 -- for (i = 1; i < nr_pages; i++, p++) {
6781 -- if (unlikely((i & (MAX_ORDER_NR_PAGES - 1)) == 0))
6782 -- p = pfn_to_page(page_to_pfn(page) + i);
6783 -+ for (i = 1; i < nr_pages; i++) {
6784 -+ struct page *p = page + i;
6785 -
6786 - if (unlikely(!PageTail(p) |
6787 - (p->first_page != page)))
6788 -diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
6789 -index 015606b..8bde9bf 100644
6790 ---- a/net/unix/af_unix.c
6791 -+++ b/net/unix/af_unix.c
6792 -@@ -1300,14 +1300,23 @@ static void unix_destruct_fds(struct sk_buff *skb)
6793 - sock_wfree(skb);
6794 - }
6795 -
6796 --static void unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb)
6797 -+static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb)
6798 - {
6799 - int i;
6800 -+
6801 -+ /*
6802 -+ * Need to duplicate file references for the sake of garbage
6803 -+ * collection. Otherwise a socket in the fps might become a
6804 -+ * candidate for GC while the skb is not yet queued.
6805 -+ */
6806 -+ UNIXCB(skb).fp = scm_fp_dup(scm->fp);
6807 -+ if (!UNIXCB(skb).fp)
6808 -+ return -ENOMEM;
6809 -+
6810 - for (i=scm->fp->count-1; i>=0; i--)
6811 - unix_inflight(scm->fp->fp[i]);
6812 -- UNIXCB(skb).fp = scm->fp;
6813 - skb->destructor = unix_destruct_fds;
6814 -- scm->fp = NULL;
6815 -+ return 0;
6816 - }
6817 -
6818 - /*
6819 -@@ -1366,8 +1375,11 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock,
6820 - goto out;
6821 -
6822 - memcpy(UNIXCREDS(skb), &siocb->scm->creds, sizeof(struct ucred));
6823 -- if (siocb->scm->fp)
6824 -- unix_attach_fds(siocb->scm, skb);
6825 -+ if (siocb->scm->fp) {
6826 -+ err = unix_attach_fds(siocb->scm, skb);
6827 -+ if (err)
6828 -+ goto out_free;
6829 -+ }
6830 - unix_get_secdata(siocb->scm, skb);
6831 -
6832 - skb_reset_transport_header(skb);
6833 -@@ -1536,8 +1548,13 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,
6834 - size = min_t(int, size, skb_tailroom(skb));
6835 -
6836 - memcpy(UNIXCREDS(skb), &siocb->scm->creds, sizeof(struct ucred));
6837 -- if (siocb->scm->fp)
6838 -- unix_attach_fds(siocb->scm, skb);
6839 -+ if (siocb->scm->fp) {
6840 -+ err = unix_attach_fds(siocb->scm, skb);
6841 -+ if (err) {
6842 -+ kfree_skb(skb);
6843 -+ goto out_err;
6844 -+ }
6845 -+ }
6846 -
6847 - if ((err = memcpy_fromiovec(skb_put(skb,size), msg->msg_iov, size)) != 0) {
6848 - kfree_skb(skb);
6849 -diff --git a/net/unix/garbage.c b/net/unix/garbage.c
6850 -index 2a27b84..6d4a9a8 100644
6851 ---- a/net/unix/garbage.c
6852 -+++ b/net/unix/garbage.c
6853 -@@ -186,8 +186,17 @@ static void scan_inflight(struct sock *x, void (*func)(struct unix_sock *),
6854 - */
6855 - struct sock *sk = unix_get_socket(*fp++);
6856 - if (sk) {
6857 -- hit = true;
6858 -- func(unix_sk(sk));
6859 -+ struct unix_sock *u = unix_sk(sk);
6860 -+
6861 -+ /*
6862 -+ * Ignore non-candidates, they could
6863 -+ * have been added to the queues after
6864 -+ * starting the garbage collection
6865 -+ */
6866 -+ if (u->gc_candidate) {
6867 -+ hit = true;
6868 -+ func(u);
6869 -+ }
6870 - }
6871 - }
6872 - if (hit && hitlist != NULL) {
6873 -@@ -249,11 +258,11 @@ static void inc_inflight_move_tail(struct unix_sock *u)
6874 - {
6875 - atomic_long_inc(&u->inflight);
6876 - /*
6877 -- * If this is still a candidate, move it to the end of the
6878 -- * list, so that it's checked even if it was already passed
6879 -- * over
6880 -+ * If this still might be part of a cycle, move it to the end
6881 -+ * of the list, so that it's checked even if it was already
6882 -+ * passed over
6883 - */
6884 -- if (u->gc_candidate)
6885 -+ if (u->gc_maybe_cycle)
6886 - list_move_tail(&u->link, &gc_candidates);
6887 - }
6888 -
6889 -@@ -267,6 +276,7 @@ void unix_gc(void)
6890 - struct unix_sock *next;
6891 - struct sk_buff_head hitlist;
6892 - struct list_head cursor;
6893 -+ LIST_HEAD(not_cycle_list);
6894 -
6895 - spin_lock(&unix_gc_lock);
6896 -
6897 -@@ -282,10 +292,14 @@ void unix_gc(void)
6898 - *
6899 - * Holding unix_gc_lock will protect these candidates from
6900 - * being detached, and hence from gaining an external
6901 -- * reference. This also means, that since there are no
6902 -- * possible receivers, the receive queues of these sockets are
6903 -- * static during the GC, even though the dequeue is done
6904 -- * before the detach without atomicity guarantees.
6905 -+ * reference. Since there are no possible receivers, all
6906 -+ * buffers currently on the candidates' queues stay there
6907 -+ * during the garbage collection.
6908 -+ *
6909 -+ * We also know that no new candidate can be added onto the
6910 -+ * receive queues. Other, non candidate sockets _can_ be
6911 -+ * added to queue, so we must make sure only to touch
6912 -+ * candidates.
6913 - */
6914 - list_for_each_entry_safe(u, next, &gc_inflight_list, link) {
6915 - long total_refs;
6916 -@@ -299,6 +313,7 @@ void unix_gc(void)
6917 - if (total_refs == inflight_refs) {
6918 - list_move_tail(&u->link, &gc_candidates);
6919 - u->gc_candidate = 1;
6920 -+ u->gc_maybe_cycle = 1;
6921 - }
6922 - }
6923 -
6924 -@@ -325,14 +340,24 @@ void unix_gc(void)
6925 - list_move(&cursor, &u->link);
6926 -
6927 - if (atomic_long_read(&u->inflight) > 0) {
6928 -- list_move_tail(&u->link, &gc_inflight_list);
6929 -- u->gc_candidate = 0;
6930 -+ list_move_tail(&u->link, &not_cycle_list);
6931 -+ u->gc_maybe_cycle = 0;
6932 - scan_children(&u->sk, inc_inflight_move_tail, NULL);
6933 - }
6934 - }
6935 - list_del(&cursor);
6936 -
6937 - /*
6938 -+ * not_cycle_list contains those sockets which do not make up a
6939 -+ * cycle. Restore these to the inflight list.
6940 -+ */
6941 -+ while (!list_empty(&not_cycle_list)) {
6942 -+ u = list_entry(not_cycle_list.next, struct unix_sock, link);
6943 -+ u->gc_candidate = 0;
6944 -+ list_move_tail(&u->link, &gc_inflight_list);
6945 -+ }
6946 -+
6947 -+ /*
6948 - * Now gc_candidates contains only garbage. Restore original
6949 - * inflight counters for these as well, and remove the skbuffs
6950 - * which are creating the cycle(s).
6951 -diff --git a/security/keys/internal.h b/security/keys/internal.h
6952 -index b39f5c2..239098f 100644
6953 ---- a/security/keys/internal.h
6954 -+++ b/security/keys/internal.h
6955 -@@ -107,6 +107,7 @@ extern key_ref_t search_process_keyrings(struct key_type *type,
6956 -
6957 - extern struct key *find_keyring_by_name(const char *name, bool skip_perm_check);
6958 -
6959 -+extern int install_user_keyrings(struct task_struct *tsk);
6960 - extern int install_thread_keyring(struct task_struct *tsk);
6961 - extern int install_process_keyring(struct task_struct *tsk);
6962 -
6963 -diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
6964 -index 5be6d01..45b240a 100644
6965 ---- a/security/keys/process_keys.c
6966 -+++ b/security/keys/process_keys.c
6967 -@@ -40,7 +40,7 @@ struct key_user root_key_user = {
6968 - /*
6969 - * install user and user session keyrings for a particular UID
6970 - */
6971 --static int install_user_keyrings(struct task_struct *tsk)
6972 -+int install_user_keyrings(struct task_struct *tsk)
6973 - {
6974 - struct user_struct *user = tsk->user;
6975 - struct key *uid_keyring, *session_keyring;
6976 -diff --git a/security/keys/request_key.c b/security/keys/request_key.c
6977 -index ba32ca6..abea08f 100644
6978 ---- a/security/keys/request_key.c
6979 -+++ b/security/keys/request_key.c
6980 -@@ -74,6 +74,10 @@ static int call_sbin_request_key(struct key_construction *cons,
6981 -
6982 - kenter("{%d},{%d},%s", key->serial, authkey->serial, op);
6983 -
6984 -+ ret = install_user_keyrings(tsk);
6985 -+ if (ret < 0)
6986 -+ goto error_alloc;
6987 -+
6988 - /* allocate a new session keyring */
6989 - sprintf(desc, "_req.%u", key->serial);
6990 -
6991 -diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
6992 -index f3da621..732ce13 100644
6993 ---- a/sound/pci/hda/patch_sigmatel.c
6994 -+++ b/sound/pci/hda/patch_sigmatel.c
6995 -@@ -67,6 +67,7 @@ enum {
6996 - enum {
6997 - STAC_92HD73XX_REF,
6998 - STAC_DELL_M6,
6999 -+ STAC_DELL_EQ,
7000 - STAC_92HD73XX_MODELS
7001 - };
7002 -
7003 -@@ -560,9 +561,7 @@ static struct hda_verb dell_eq_core_init[] = {
7004 - };
7005 -
7006 - static struct hda_verb dell_m6_core_init[] = {
7007 -- /* set master volume to max value without distortion
7008 -- * and direct control */
7009 -- { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec},
7010 -+ { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
7011 - /* setup audio connections */
7012 - { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
7013 - { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
7014 -@@ -1297,11 +1296,13 @@ static unsigned int dell_m6_pin_configs[13] = {
7015 - static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = {
7016 - [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs,
7017 - [STAC_DELL_M6] = dell_m6_pin_configs,
7018 -+ [STAC_DELL_EQ] = dell_m6_pin_configs,
7019 - };
7020 -
7021 - static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = {
7022 - [STAC_92HD73XX_REF] = "ref",
7023 - [STAC_DELL_M6] = "dell-m6",
7024 -+ [STAC_DELL_EQ] = "dell-eq",
7025 - };
7026 -
7027 - static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
7028 -@@ -3560,8 +3561,12 @@ again:
7029 - spec->gpio_data = 0x01;
7030 -
7031 - switch (spec->board_config) {
7032 -- case STAC_DELL_M6:
7033 -+ case STAC_DELL_EQ:
7034 - spec->init = dell_eq_core_init;
7035 -+ /* fallthru */
7036 -+ case STAC_DELL_M6:
7037 -+ if (!spec->init)
7038 -+ spec->init = dell_m6_core_init;
7039 - switch (codec->subsystem_id) {
7040 - case 0x1028025e: /* Analog Mics */
7041 - case 0x1028025f:
7042 -@@ -3570,8 +3575,6 @@ again:
7043 - break;
7044 - case 0x10280271: /* Digital Mics */
7045 - case 0x10280272:
7046 -- spec->init = dell_m6_core_init;
7047 -- /* fall-through */
7048 - case 0x10280254:
7049 - case 0x10280255:
7050 - stac92xx_set_config_reg(codec, 0x13, 0x90A60160);
7051
7052 Deleted: genpatches-2.6/trunk/2.6.28/1006_linux-2.6.27.7.patch
7053 ===================================================================
7054 --- genpatches-2.6/trunk/2.6.28/1006_linux-2.6.27.7.patch 2008-12-05 00:39:44 UTC (rev 1417)
7055 +++ genpatches-2.6/trunk/2.6.28/1006_linux-2.6.27.7.patch 2008-12-05 00:43:09 UTC (rev 1418)
7056 @@ -1,1991 +0,0 @@
7057 -diff --git a/arch/arm/mm/cache-feroceon-l2.c b/arch/arm/mm/cache-feroceon-l2.c
7058 -index 7b5a25d..4f6cf46 100644
7059 ---- a/arch/arm/mm/cache-feroceon-l2.c
7060 -+++ b/arch/arm/mm/cache-feroceon-l2.c
7061 -@@ -148,7 +148,7 @@ static void feroceon_l2_inv_range(unsigned long start, unsigned long end)
7062 - /*
7063 - * Clean and invalidate partial last cache line.
7064 - */
7065 -- if (end & (CACHE_LINE_SIZE - 1)) {
7066 -+ if (start < end && end & (CACHE_LINE_SIZE - 1)) {
7067 - l2_clean_inv_pa(end & ~(CACHE_LINE_SIZE - 1));
7068 - end &= ~(CACHE_LINE_SIZE - 1);
7069 - }
7070 -@@ -156,7 +156,7 @@ static void feroceon_l2_inv_range(unsigned long start, unsigned long end)
7071 - /*
7072 - * Invalidate all full cache lines between 'start' and 'end'.
7073 - */
7074 -- while (start != end) {
7075 -+ while (start < end) {
7076 - unsigned long range_end = calc_range_end(start, end);
7077 - l2_inv_pa_range(start, range_end - CACHE_LINE_SIZE);
7078 - start = range_end;
7079 -diff --git a/arch/m68k/kernel/ints.c b/arch/m68k/kernel/ints.c
7080 -index ded7dd2..c4460bf 100644
7081 ---- a/arch/m68k/kernel/ints.c
7082 -+++ b/arch/m68k/kernel/ints.c
7083 -@@ -133,7 +133,7 @@ void __init m68k_setup_user_interrupt(unsigned int vec, unsigned int cnt,
7084 - {
7085 - int i;
7086 -
7087 -- BUG_ON(IRQ_USER + cnt >= NR_IRQS);
7088 -+ BUG_ON(IRQ_USER + cnt > NR_IRQS);
7089 - m68k_first_user_vec = vec;
7090 - for (i = 0; i < cnt; i++)
7091 - irq_controller[IRQ_USER + i] = &user_irq_controller;
7092 -diff --git a/arch/powerpc/include/asm/mpic.h b/arch/powerpc/include/asm/mpic.h
7093 -index fe566a3..eb685ed 100644
7094 ---- a/arch/powerpc/include/asm/mpic.h
7095 -+++ b/arch/powerpc/include/asm/mpic.h
7096 -@@ -355,6 +355,8 @@ struct mpic
7097 - #define MPIC_NO_BIAS 0x00000400
7098 - /* Ignore NIRQS as reported by FRR */
7099 - #define MPIC_BROKEN_FRR_NIRQS 0x00000800
7100 -+/* Destination only supports a single CPU at a time */
7101 -+#define MPIC_SINGLE_DEST_CPU 0x00001000
7102 -
7103 - /* MPIC HW modification ID */
7104 - #define MPIC_REGSET_MASK 0xf0000000
7105 -diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
7106 -index 483b65c..613bf8c 100644
7107 ---- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
7108 -+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
7109 -@@ -78,7 +78,8 @@ void __init mpc85xx_ds_pic_init(void)
7110 -
7111 - mpic = mpic_alloc(np, r.start,
7112 - MPIC_PRIMARY | MPIC_WANTS_RESET |
7113 -- MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS,
7114 -+ MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
7115 -+ MPIC_SINGLE_DEST_CPU,
7116 - 0, 256, " OpenPIC ");
7117 - BUG_ON(mpic == NULL);
7118 - of_node_put(np);
7119 -diff --git a/arch/powerpc/platforms/86xx/pic.c b/arch/powerpc/platforms/86xx/pic.c
7120 -index 8881c5d..668275d 100644
7121 ---- a/arch/powerpc/platforms/86xx/pic.c
7122 -+++ b/arch/powerpc/platforms/86xx/pic.c
7123 -@@ -44,7 +44,8 @@ void __init mpc86xx_init_irq(void)
7124 -
7125 - mpic = mpic_alloc(np, res.start,
7126 - MPIC_PRIMARY | MPIC_WANTS_RESET |
7127 -- MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS,
7128 -+ MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
7129 -+ MPIC_SINGLE_DEST_CPU,
7130 - 0, 256, " MPIC ");
7131 - of_node_put(np);
7132 - BUG_ON(mpic == NULL);
7133 -diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
7134 -index 8e3478c..f6299cc 100644
7135 ---- a/arch/powerpc/sysdev/mpic.c
7136 -+++ b/arch/powerpc/sysdev/mpic.c
7137 -@@ -563,6 +563,51 @@ static void __init mpic_scan_ht_pics(struct mpic *mpic)
7138 -
7139 - #endif /* CONFIG_MPIC_U3_HT_IRQS */
7140 -
7141 -+#ifdef CONFIG_SMP
7142 -+static int irq_choose_cpu(unsigned int virt_irq)
7143 -+{
7144 -+ cpumask_t mask = irq_desc[virt_irq].affinity;
7145 -+ int cpuid;
7146 -+
7147 -+ if (cpus_equal(mask, CPU_MASK_ALL)) {
7148 -+ static int irq_rover;
7149 -+ static DEFINE_SPINLOCK(irq_rover_lock);
7150 -+ unsigned long flags;
7151 -+
7152 -+ /* Round-robin distribution... */
7153 -+ do_round_robin:
7154 -+ spin_lock_irqsave(&irq_rover_lock, flags);
7155 -+
7156 -+ while (!cpu_online(irq_rover)) {
7157 -+ if (++irq_rover >= NR_CPUS)
7158 -+ irq_rover = 0;
7159 -+ }
7160 -+ cpuid = irq_rover;
7161 -+ do {
7162 -+ if (++irq_rover >= NR_CPUS)
7163 -+ irq_rover = 0;
7164 -+ } while (!cpu_online(irq_rover));
7165 -+
7166 -+ spin_unlock_irqrestore(&irq_rover_lock, flags);
7167 -+ } else {
7168 -+ cpumask_t tmp;
7169 -+
7170 -+ cpus_and(tmp, cpu_online_map, mask);
7171 -+
7172 -+ if (cpus_empty(tmp))
7173 -+ goto do_round_robin;
7174 -+
7175 -+ cpuid = first_cpu(tmp);
7176 -+ }
7177 -+
7178 -+ return cpuid;
7179 -+}
7180 -+#else
7181 -+static int irq_choose_cpu(unsigned int virt_irq)
7182 -+{
7183 -+ return hard_smp_processor_id();
7184 -+}
7185 -+#endif
7186 -
7187 - #define mpic_irq_to_hw(virq) ((unsigned int)irq_map[virq].hwirq)
7188 -
7189 -@@ -777,12 +822,18 @@ void mpic_set_affinity(unsigned int irq, cpumask_t cpumask)
7190 - struct mpic *mpic = mpic_from_irq(irq);
7191 - unsigned int src = mpic_irq_to_hw(irq);
7192 -
7193 -- cpumask_t tmp;
7194 -+ if (mpic->flags & MPIC_SINGLE_DEST_CPU) {
7195 -+ int cpuid = irq_choose_cpu(irq);
7196 -
7197 -- cpus_and(tmp, cpumask, cpu_online_map);
7198 -+ mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION), 1 << cpuid);
7199 -+ } else {
7200 -+ cpumask_t tmp;
7201 -
7202 -- mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION),
7203 -- mpic_physmask(cpus_addr(tmp)[0]));
7204 -+ cpus_and(tmp, cpumask, cpu_online_map);
7205 -+
7206 -+ mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION),
7207 -+ mpic_physmask(cpus_addr(tmp)[0]));
7208 -+ }
7209 - }
7210 -
7211 - static unsigned int mpic_type_to_vecpri(struct mpic *mpic, unsigned int type)
7212 -diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
7213 -index 632b13e..a947899 100644
7214 ---- a/arch/s390/kernel/topology.c
7215 -+++ b/arch/s390/kernel/topology.c
7216 -@@ -65,18 +65,21 @@ static int machine_has_topology_irq;
7217 - static struct timer_list topology_timer;
7218 - static void set_topology_timer(void);
7219 - static DECLARE_WORK(topology_work, topology_work_fn);
7220 -+/* topology_lock protects the core linked list */
7221 -+static DEFINE_SPINLOCK(topology_lock);
7222 -
7223 - cpumask_t cpu_core_map[NR_CPUS];
7224 -
7225 - cpumask_t cpu_coregroup_map(unsigned int cpu)
7226 - {
7227 - struct core_info *core = &core_info;
7228 -+ unsigned long flags;
7229 - cpumask_t mask;
7230 -
7231 - cpus_clear(mask);
7232 - if (!machine_has_topology)
7233 - return cpu_present_map;
7234 -- mutex_lock(&smp_cpu_state_mutex);
7235 -+ spin_lock_irqsave(&topology_lock, flags);
7236 - while (core) {
7237 - if (cpu_isset(cpu, core->mask)) {
7238 - mask = core->mask;
7239 -@@ -84,7 +87,7 @@ cpumask_t cpu_coregroup_map(unsigned int cpu)
7240 - }
7241 - core = core->next;
7242 - }
7243 -- mutex_unlock(&smp_cpu_state_mutex);
7244 -+ spin_unlock_irqrestore(&topology_lock, flags);
7245 - if (cpus_empty(mask))
7246 - mask = cpumask_of_cpu(cpu);
7247 - return mask;
7248 -@@ -133,7 +136,7 @@ static void tl_to_cores(struct tl_info *info)
7249 - union tl_entry *tle, *end;
7250 - struct core_info *core = &core_info;
7251 -
7252 -- mutex_lock(&smp_cpu_state_mutex);
7253 -+ spin_lock_irq(&topology_lock);
7254 - clear_cores();
7255 - tle = info->tle;
7256 - end = (union tl_entry *)((unsigned long)info + info->length);
7257 -@@ -157,7 +160,7 @@ static void tl_to_cores(struct tl_info *info)
7258 - }
7259 - tle = next_tle(tle);
7260 - }
7261 -- mutex_unlock(&smp_cpu_state_mutex);
7262 -+ spin_unlock_irq(&topology_lock);
7263 - }
7264 -
7265 - static void topology_update_polarization_simple(void)
7266 -diff --git a/block/blk-merge.c b/block/blk-merge.c
7267 -index 5efc9e7..857dce7 100644
7268 ---- a/block/blk-merge.c
7269 -+++ b/block/blk-merge.c
7270 -@@ -95,6 +95,9 @@ new_hw_segment:
7271 - nr_hw_segs++;
7272 - }
7273 -
7274 -+ if (nr_phys_segs == 1 && seg_size > rq->bio->bi_seg_front_size)
7275 -+ rq->bio->bi_seg_front_size = seg_size;
7276 -+
7277 - nr_phys_segs++;
7278 - bvprv = bv;
7279 - seg_size = bv->bv_len;
7280 -@@ -106,6 +109,10 @@ new_hw_segment:
7281 - rq->bio->bi_hw_front_size = hw_seg_size;
7282 - if (hw_seg_size > rq->biotail->bi_hw_back_size)
7283 - rq->biotail->bi_hw_back_size = hw_seg_size;
7284 -+ if (nr_phys_segs == 1 && seg_size > rq->bio->bi_seg_front_size)
7285 -+ rq->bio->bi_seg_front_size = seg_size;
7286 -+ if (seg_size > rq->biotail->bi_seg_back_size)
7287 -+ rq->biotail->bi_seg_back_size = seg_size;
7288 - rq->nr_phys_segments = nr_phys_segs;
7289 - rq->nr_hw_segments = nr_hw_segs;
7290 - }
7291 -@@ -133,7 +140,8 @@ static int blk_phys_contig_segment(struct request_queue *q, struct bio *bio,
7292 -
7293 - if (!BIOVEC_PHYS_MERGEABLE(__BVEC_END(bio), __BVEC_START(nxt)))
7294 - return 0;
7295 -- if (bio->bi_size + nxt->bi_size > q->max_segment_size)
7296 -+ if (bio->bi_seg_back_size + nxt->bi_seg_front_size >
7297 -+ q->max_segment_size)
7298 - return 0;
7299 -
7300 - /*
7301 -@@ -377,6 +385,8 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req,
7302 - {
7303 - int total_phys_segments;
7304 - int total_hw_segments;
7305 -+ unsigned int seg_size =
7306 -+ req->biotail->bi_seg_back_size + next->bio->bi_seg_front_size;
7307 -
7308 - /*
7309 - * First check if the either of the requests are re-queued
7310 -@@ -392,8 +402,13 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req,
7311 - return 0;
7312 -
7313 - total_phys_segments = req->nr_phys_segments + next->nr_phys_segments;
7314 -- if (blk_phys_contig_segment(q, req->biotail, next->bio))
7315 -+ if (blk_phys_contig_segment(q, req->biotail, next->bio)) {
7316 -+ if (req->nr_phys_segments == 1)
7317 -+ req->bio->bi_seg_front_size = seg_size;
7318 -+ if (next->nr_phys_segments == 1)
7319 -+ next->biotail->bi_seg_back_size = seg_size;
7320 - total_phys_segments--;
7321 -+ }
7322 -
7323 - if (total_phys_segments > q->max_phys_segments)
7324 - return 0;
7325 -diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
7326 -index ccae305..c54f38e 100644
7327 ---- a/drivers/acpi/bus.c
7328 -+++ b/drivers/acpi/bus.c
7329 -@@ -95,21 +95,21 @@ int acpi_bus_get_status(struct acpi_device *device)
7330 - }
7331 -
7332 - /*
7333 -- * Otherwise we assume the status of our parent (unless we don't
7334 -- * have one, in which case status is implied).
7335 -+ * According to ACPI spec some device can be present and functional
7336 -+ * even if the parent is not present but functional.
7337 -+ * In such conditions the child device should not inherit the status
7338 -+ * from the parent.
7339 - */
7340 -- else if (device->parent)
7341 -- device->status = device->parent->status;
7342 - else
7343 - STRUCT_TO_INT(device->status) =
7344 - ACPI_STA_DEVICE_PRESENT | ACPI_STA_DEVICE_ENABLED |
7345 - ACPI_STA_DEVICE_UI | ACPI_STA_DEVICE_FUNCTIONING;
7346 -
7347 - if (device->status.functional && !device->status.present) {
7348 -- printk(KERN_WARNING PREFIX "Device [%s] status [%08x]: "
7349 -- "functional but not present; setting present\n",
7350 -- device->pnp.bus_id, (u32) STRUCT_TO_INT(device->status));
7351 -- device->status.present = 1;
7352 -+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]: "
7353 -+ "functional but not present;\n",
7354 -+ device->pnp.bus_id,
7355 -+ (u32) STRUCT_TO_INT(device->status)));
7356 - }
7357 -
7358 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]\n",
7359 -diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
7360 -index 444cd9e..41b8e7c 100644
7361 ---- a/drivers/acpi/ec.c
7362 -+++ b/drivers/acpi/ec.c
7363 -@@ -70,7 +70,7 @@ enum ec_command {
7364 - #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */
7365 - #define ACPI_EC_UDELAY 100 /* Wait 100us before polling EC again */
7366 -
7367 --#define ACPI_EC_STORM_THRESHOLD 20 /* number of false interrupts
7368 -+#define ACPI_EC_STORM_THRESHOLD 8 /* number of false interrupts
7369 - per one transaction */
7370 -
7371 - enum {
7372 -@@ -100,8 +100,11 @@ struct transaction {
7373 - u8 *rdata;
7374 - unsigned short irq_count;
7375 - u8 command;
7376 -+ u8 wi;
7377 -+ u8 ri;
7378 - u8 wlen;
7379 - u8 rlen;
7380 -+ bool done;
7381 - };
7382 -
7383 - static struct acpi_ec {
7384 -@@ -178,34 +181,45 @@ static int ec_transaction_done(struct acpi_ec *ec)
7385 - unsigned long flags;
7386 - int ret = 0;
7387 - spin_lock_irqsave(&ec->curr_lock, flags);
7388 -- if (!ec->curr || (!ec->curr->wlen && !ec->curr->rlen))
7389 -+ if (!ec->curr || ec->curr->done)
7390 - ret = 1;
7391 - spin_unlock_irqrestore(&ec->curr_lock, flags);
7392 - return ret;
7393 - }
7394 -
7395 -+static void start_transaction(struct acpi_ec *ec)
7396 -+{
7397 -+ ec->curr->irq_count = ec->curr->wi = ec->curr->ri = 0;
7398 -+ ec->curr->done = false;
7399 -+ acpi_ec_write_cmd(ec, ec->curr->command);
7400 -+}
7401 -+
7402 - static void gpe_transaction(struct acpi_ec *ec, u8 status)
7403 - {
7404 - unsigned long flags;
7405 - spin_lock_irqsave(&ec->curr_lock, flags);
7406 - if (!ec->curr)
7407 - goto unlock;
7408 -- if (ec->curr->wlen > 0) {
7409 -- if ((status & ACPI_EC_FLAG_IBF) == 0) {
7410 -- acpi_ec_write_data(ec, *(ec->curr->wdata++));
7411 -- --ec->curr->wlen;
7412 -- } else
7413 -- /* false interrupt, state didn't change */
7414 -- ++ec->curr->irq_count;
7415 --
7416 -- } else if (ec->curr->rlen > 0) {
7417 -+ if (ec->curr->wlen > ec->curr->wi) {
7418 -+ if ((status & ACPI_EC_FLAG_IBF) == 0)
7419 -+ acpi_ec_write_data(ec,
7420 -+ ec->curr->wdata[ec->curr->wi++]);
7421 -+ else
7422 -+ goto err;
7423 -+ } else if (ec->curr->rlen > ec->curr->ri) {
7424 - if ((status & ACPI_EC_FLAG_OBF) == 1) {
7425 -- *(ec->curr->rdata++) = acpi_ec_read_data(ec);
7426 -- --ec->curr->rlen;
7427 -+ ec->curr->rdata[ec->curr->ri++] = acpi_ec_read_data(ec);
7428 -+ if (ec->curr->rlen == ec->curr->ri)
7429 -+ ec->curr->done = true;
7430 - } else
7431 -- /* false interrupt, state didn't change */
7432 -- ++ec->curr->irq_count;
7433 -- }
7434 -+ goto err;
7435 -+ } else if (ec->curr->wlen == ec->curr->wi &&
7436 -+ (status & ACPI_EC_FLAG_IBF) == 0)
7437 -+ ec->curr->done = true;
7438 -+ goto unlock;
7439 -+err:
7440 -+ /* false interrupt, state didn't change */
7441 -+ ++ec->curr->irq_count;
7442 - unlock:
7443 - spin_unlock_irqrestore(&ec->curr_lock, flags);
7444 - }
7445 -@@ -215,6 +229,15 @@ static int acpi_ec_wait(struct acpi_ec *ec)
7446 - if (wait_event_timeout(ec->wait, ec_transaction_done(ec),
7447 - msecs_to_jiffies(ACPI_EC_DELAY)))
7448 - return 0;
7449 -+ /* try restart command if we get any false interrupts */
7450 -+ if (ec->curr->irq_count &&
7451 -+ (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) == 0) {
7452 -+ pr_debug(PREFIX "controller reset, restart transaction\n");
7453 -+ start_transaction(ec);
7454 -+ if (wait_event_timeout(ec->wait, ec_transaction_done(ec),
7455 -+ msecs_to_jiffies(ACPI_EC_DELAY)))
7456 -+ return 0;
7457 -+ }
7458 - /* missing GPEs, switch back to poll mode */
7459 - if (printk_ratelimit())
7460 - pr_info(PREFIX "missing confirmations, "
7461 -@@ -239,10 +262,10 @@ static int ec_check_sci(struct acpi_ec *ec, u8 state)
7462 - static int ec_poll(struct acpi_ec *ec)
7463 - {
7464 - unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY);
7465 -- msleep(1);
7466 -+ udelay(ACPI_EC_UDELAY);
7467 - while (time_before(jiffies, delay)) {
7468 - gpe_transaction(ec, acpi_ec_read_status(ec));
7469 -- msleep(1);
7470 -+ udelay(ACPI_EC_UDELAY);
7471 - if (ec_transaction_done(ec))
7472 - return 0;
7473 - }
7474 -@@ -264,9 +287,8 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec,
7475 - /* start transaction */
7476 - spin_lock_irqsave(&ec->curr_lock, tmp);
7477 - /* following two actions should be kept atomic */
7478 -- t->irq_count = 0;
7479 - ec->curr = t;
7480 -- acpi_ec_write_cmd(ec, ec->curr->command);
7481 -+ start_transaction(ec);
7482 - if (ec->curr->command == ACPI_EC_COMMAND_QUERY)
7483 - clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
7484 - spin_unlock_irqrestore(&ec->curr_lock, tmp);
7485 -@@ -286,7 +308,8 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec,
7486 - acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR);
7487 - } else if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags) &&
7488 - t->irq_count > ACPI_EC_STORM_THRESHOLD) {
7489 -- pr_debug(PREFIX "GPE storm detected\n");
7490 -+ pr_info(PREFIX "GPE storm detected, "
7491 -+ "transactions will use polling mode\n");
7492 - set_bit(EC_FLAGS_GPE_STORM, &ec->flags);
7493 - }
7494 - return ret;
7495 -@@ -558,17 +581,26 @@ static u32 acpi_ec_gpe_handler(void *data)
7496 - pr_debug(PREFIX "~~~> interrupt\n");
7497 - status = acpi_ec_read_status(ec);
7498 -
7499 -- gpe_transaction(ec, status);
7500 -- if (ec_transaction_done(ec) && (status & ACPI_EC_FLAG_IBF) == 0)
7501 -- wake_up(&ec->wait);
7502 -+ if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) {
7503 -+ gpe_transaction(ec, status);
7504 -+ if (ec_transaction_done(ec) &&
7505 -+ (status & ACPI_EC_FLAG_IBF) == 0)
7506 -+ wake_up(&ec->wait);
7507 -+ }
7508 -
7509 - ec_check_sci(ec, status);
7510 - if (!test_bit(EC_FLAGS_GPE_MODE, &ec->flags) &&
7511 - !test_bit(EC_FLAGS_NO_GPE, &ec->flags)) {
7512 - /* this is non-query, must be confirmation */
7513 -- if (printk_ratelimit())
7514 -- pr_info(PREFIX "non-query interrupt received,"
7515 -+ if (!test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) {
7516 -+ if (printk_ratelimit())
7517 -+ pr_info(PREFIX "non-query interrupt received,"
7518 -+ " switching to interrupt mode\n");
7519 -+ } else {
7520 -+ /* hush, STORM switches the mode every transaction */
7521 -+ pr_debug(PREFIX "non-query interrupt received,"
7522 - " switching to interrupt mode\n");
7523 -+ }
7524 - set_bit(EC_FLAGS_GPE_MODE, &ec->flags);
7525 - }
7526 - return ACPI_INTERRUPT_HANDLED;
7527 -diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
7528 -index f6f52c1..0450761 100644
7529 ---- a/drivers/acpi/scan.c
7530 -+++ b/drivers/acpi/scan.c
7531 -@@ -276,6 +276,13 @@ int acpi_match_device_ids(struct acpi_device *device,
7532 - {
7533 - const struct acpi_device_id *id;
7534 -
7535 -+ /*
7536 -+ * If the device is not present, it is unnecessary to load device
7537 -+ * driver for it.
7538 -+ */
7539 -+ if (!device->status.present)
7540 -+ return -ENODEV;
7541 -+
7542 - if (device->flags.hardware_id) {
7543 - for (id = ids; id->id[0]; id++) {
7544 - if (!strcmp((char*)id->id, device->pnp.hardware_id))
7545 -@@ -1221,15 +1228,18 @@ acpi_add_single_object(struct acpi_device **child,
7546 - result = -ENODEV;
7547 - goto end;
7548 - }
7549 -- if (!device->status.present) {
7550 -- /* Bay and dock should be handled even if absent */
7551 -- if (!ACPI_SUCCESS(
7552 -- acpi_is_child_device(device, acpi_bay_match)) &&
7553 -- !ACPI_SUCCESS(
7554 -- acpi_is_child_device(device, acpi_dock_match))) {
7555 -- result = -ENODEV;
7556 -- goto end;
7557 -- }
7558 -+ /*
7559 -+ * When the device is neither present nor functional, the
7560 -+ * device should not be added to Linux ACPI device tree.
7561 -+ * When the status of the device is not present but functinal,
7562 -+ * it should be added to Linux ACPI tree. For example : bay
7563 -+ * device , dock device.
7564 -+ * In such conditions it is unncessary to check whether it is
7565 -+ * bay device or dock device.
7566 -+ */
7567 -+ if (!device->status.present && !device->status.functional) {
7568 -+ result = -ENODEV;
7569 -+ goto end;
7570 - }
7571 - break;
7572 - default:
7573 -@@ -1402,7 +1412,12 @@ static int acpi_bus_scan(struct acpi_device *start, struct acpi_bus_ops *ops)
7574 - * TBD: Need notifications and other detection mechanisms
7575 - * in place before we can fully implement this.
7576 - */
7577 -- if (child->status.present) {
7578 -+ /*
7579 -+ * When the device is not present but functional, it is also
7580 -+ * necessary to scan the children of this device.
7581 -+ */
7582 -+ if (child->status.present || (!child->status.present &&
7583 -+ child->status.functional)) {
7584 - status = acpi_get_next_object(ACPI_TYPE_ANY, chandle,
7585 - NULL, NULL);
7586 - if (ACPI_SUCCESS(status)) {
7587 -diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c
7588 -index 91dec44..4745792 100644
7589 ---- a/drivers/acpi/system.c
7590 -+++ b/drivers/acpi/system.c
7591 -@@ -78,9 +78,15 @@ static ssize_t acpi_table_show(struct kobject *kobj,
7592 - container_of(bin_attr, struct acpi_table_attr, attr);
7593 - struct acpi_table_header *table_header = NULL;
7594 - acpi_status status;
7595 -+ char name[ACPI_NAME_SIZE];
7596 -+
7597 -+ if (strncmp(table_attr->name, "NULL", 4))
7598 -+ memcpy(name, table_attr->name, ACPI_NAME_SIZE);
7599 -+ else
7600 -+ memcpy(name, "\0\0\0\0", 4);
7601 -
7602 - status =
7603 -- acpi_get_table(table_attr->name, table_attr->instance,
7604 -+ acpi_get_table(name, table_attr->instance,
7605 - &table_header);
7606 - if (ACPI_FAILURE(status))
7607 - return -ENODEV;
7608 -@@ -95,21 +101,24 @@ static void acpi_table_attr_init(struct acpi_table_attr *table_attr,
7609 - struct acpi_table_header *header = NULL;
7610 - struct acpi_table_attr *attr = NULL;
7611 -
7612 -- memcpy(table_attr->name, table_header->signature, ACPI_NAME_SIZE);
7613 -+ if (table_header->signature[0] != '\0')
7614 -+ memcpy(table_attr->name, table_header->signature,
7615 -+ ACPI_NAME_SIZE);
7616 -+ else
7617 -+ memcpy(table_attr->name, "NULL", 4);
7618 -
7619 - list_for_each_entry(attr, &acpi_table_attr_list, node) {
7620 -- if (!memcmp(table_header->signature, attr->name,
7621 -- ACPI_NAME_SIZE))
7622 -+ if (!memcmp(table_attr->name, attr->name, ACPI_NAME_SIZE))
7623 - if (table_attr->instance < attr->instance)
7624 - table_attr->instance = attr->instance;
7625 - }
7626 - table_attr->instance++;
7627 -
7628 - if (table_attr->instance > 1 || (table_attr->instance == 1 &&
7629 -- !acpi_get_table(table_header->
7630 -- signature, 2,
7631 -- &header)))
7632 -- sprintf(table_attr->name + 4, "%d", table_attr->instance);
7633 -+ !acpi_get_table
7634 -+ (table_header->signature, 2, &header)))
7635 -+ sprintf(table_attr->name + ACPI_NAME_SIZE, "%d",
7636 -+ table_attr->instance);
7637 -
7638 - table_attr->attr.size = 0;
7639 - table_attr->attr.read = acpi_table_show;
7640 -diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
7641 -index 8a59aaa..7a88dfd 100644
7642 ---- a/drivers/char/ipmi/ipmi_msghandler.c
7643 -+++ b/drivers/char/ipmi/ipmi_msghandler.c
7644 -@@ -422,9 +422,11 @@ struct ipmi_smi {
7645 - /**
7646 - * The driver model view of the IPMI messaging driver.
7647 - */
7648 --static struct device_driver ipmidriver = {
7649 -- .name = "ipmi",
7650 -- .bus = &platform_bus_type
7651 -+static struct platform_driver ipmidriver = {
7652 -+ .driver = {
7653 -+ .name = "ipmi",
7654 -+ .bus = &platform_bus_type
7655 -+ }
7656 - };
7657 - static DEFINE_MUTEX(ipmidriver_mutex);
7658 -
7659 -@@ -2384,9 +2386,9 @@ static int ipmi_bmc_register(ipmi_smi_t intf, int ifnum,
7660 - * representing the interfaced BMC already
7661 - */
7662 - if (bmc->guid_set)
7663 -- old_bmc = ipmi_find_bmc_guid(&ipmidriver, bmc->guid);
7664 -+ old_bmc = ipmi_find_bmc_guid(&ipmidriver.driver, bmc->guid);
7665 - else
7666 -- old_bmc = ipmi_find_bmc_prod_dev_id(&ipmidriver,
7667 -+ old_bmc = ipmi_find_bmc_prod_dev_id(&ipmidriver.driver,
7668 - bmc->id.product_id,
7669 - bmc->id.device_id);
7670 -
7671 -@@ -2416,7 +2418,7 @@ static int ipmi_bmc_register(ipmi_smi_t intf, int ifnum,
7672 - snprintf(name, sizeof(name),
7673 - "ipmi_bmc.%4.4x", bmc->id.product_id);
7674 -
7675 -- while (ipmi_find_bmc_prod_dev_id(&ipmidriver,
7676 -+ while (ipmi_find_bmc_prod_dev_id(&ipmidriver.driver,
7677 - bmc->id.product_id,
7678 - bmc->id.device_id)) {
7679 - if (!warn_printed) {
7680 -@@ -2446,7 +2448,7 @@ static int ipmi_bmc_register(ipmi_smi_t intf, int ifnum,
7681 - " Unable to allocate platform device\n");
7682 - return -ENOMEM;
7683 - }
7684 -- bmc->dev->dev.driver = &ipmidriver;
7685 -+ bmc->dev->dev.driver = &ipmidriver.driver;
7686 - dev_set_drvdata(&bmc->dev->dev, bmc);
7687 - kref_init(&bmc->refcount);
7688 -
7689 -@@ -4247,7 +4249,7 @@ static int ipmi_init_msghandler(void)
7690 - if (initialized)
7691 - return 0;
7692 -
7693 -- rv = driver_register(&ipmidriver);
7694 -+ rv = driver_register(&ipmidriver.driver);
7695 - if (rv) {
7696 - printk(KERN_ERR PFX "Could not register IPMI driver\n");
7697 - return rv;
7698 -@@ -4308,7 +4310,7 @@ static __exit void cleanup_ipmi(void)
7699 - remove_proc_entry(proc_ipmi_root->name, NULL);
7700 - #endif /* CONFIG_PROC_FS */
7701 -
7702 -- driver_unregister(&ipmidriver);
7703 -+ driver_unregister(&ipmidriver.driver);
7704 -
7705 - initialized = 0;
7706 -
7707 -diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
7708 -index 8e8afb6..7e860da 100644
7709 ---- a/drivers/char/ipmi/ipmi_si_intf.c
7710 -+++ b/drivers/char/ipmi/ipmi_si_intf.c
7711 -@@ -114,9 +114,11 @@ static char *si_to_str[] = { "kcs", "smic", "bt" };
7712 -
7713 - #define DEVICE_NAME "ipmi_si"
7714 -
7715 --static struct device_driver ipmi_driver = {
7716 -- .name = DEVICE_NAME,
7717 -- .bus = &platform_bus_type
7718 -+static struct platform_driver ipmi_driver = {
7719 -+ .driver = {
7720 -+ .name = DEVICE_NAME,
7721 -+ .bus = &platform_bus_type
7722 -+ }
7723 - };
7724 -
7725 -
7726 -@@ -2868,7 +2870,7 @@ static int try_smi_init(struct smi_info *new_smi)
7727 - goto out_err;
7728 - }
7729 - new_smi->dev = &new_smi->pdev->dev;
7730 -- new_smi->dev->driver = &ipmi_driver;
7731 -+ new_smi->dev->driver = &ipmi_driver.driver;
7732 -
7733 - rv = platform_device_add(new_smi->pdev);
7734 - if (rv) {
7735 -@@ -2983,7 +2985,7 @@ static __devinit int init_ipmi_si(void)
7736 - initialized = 1;
7737 -
7738 - /* Register the device drivers. */
7739 -- rv = driver_register(&ipmi_driver);
7740 -+ rv = driver_register(&ipmi_driver.driver);
7741 - if (rv) {
7742 - printk(KERN_ERR
7743 - "init_ipmi_si: Unable to register driver: %d\n",
7744 -@@ -3052,7 +3054,7 @@ static __devinit int init_ipmi_si(void)
7745 - #ifdef CONFIG_PPC_OF
7746 - of_unregister_platform_driver(&ipmi_of_platform_driver);
7747 - #endif
7748 -- driver_unregister(&ipmi_driver);
7749 -+ driver_unregister(&ipmi_driver.driver);
7750 - printk(KERN_WARNING
7751 - "ipmi_si: Unable to find any System Interface(s)\n");
7752 - return -ENODEV;
7753 -@@ -3151,7 +3153,7 @@ static __exit void cleanup_ipmi_si(void)
7754 - cleanup_one_si(e);
7755 - mutex_unlock(&smi_infos_lock);
7756 -
7757 -- driver_unregister(&ipmi_driver);
7758 -+ driver_unregister(&ipmi_driver.driver);
7759 - }
7760 - module_exit(cleanup_ipmi_si);
7761 -
7762 -diff --git a/drivers/hwmon/ibmaem.c b/drivers/hwmon/ibmaem.c
7763 -index 0f70dc2..7e909e8 100644
7764 ---- a/drivers/hwmon/ibmaem.c
7765 -+++ b/drivers/hwmon/ibmaem.c
7766 -@@ -88,9 +88,11 @@
7767 - static DEFINE_IDR(aem_idr);
7768 - static DEFINE_SPINLOCK(aem_idr_lock);
7769 -
7770 --static struct device_driver aem_driver = {
7771 -- .name = DRVNAME,
7772 -- .bus = &platform_bus_type,
7773 -+static struct platform_driver aem_driver = {
7774 -+ .driver = {
7775 -+ .name = DRVNAME,
7776 -+ .bus = &platform_bus_type,
7777 -+ }
7778 - };
7779 -
7780 - struct aem_ipmi_data {
7781 -@@ -583,7 +585,7 @@ static int aem_init_aem1_inst(struct aem_ipmi_data *probe, u8 module_handle)
7782 - data->pdev = platform_device_alloc(DRVNAME, data->id);
7783 - if (!data->pdev)
7784 - goto dev_err;
7785 -- data->pdev->dev.driver = &aem_driver;
7786 -+ data->pdev->dev.driver = &aem_driver.driver;
7787 -
7788 - res = platform_device_add(data->pdev);
7789 - if (res)
7790 -@@ -716,7 +718,7 @@ static int aem_init_aem2_inst(struct aem_ipmi_data *probe,
7791 - data->pdev = platform_device_alloc(DRVNAME, data->id);
7792 - if (!data->pdev)
7793 - goto dev_err;
7794 -- data->pdev->dev.driver = &aem_driver;
7795 -+ data->pdev->dev.driver = &aem_driver.driver;
7796 -
7797 - res = platform_device_add(data->pdev);
7798 - if (res)
7799 -@@ -1085,7 +1087,7 @@ static int __init aem_init(void)
7800 - {
7801 - int res;
7802 -
7803 -- res = driver_register(&aem_driver);
7804 -+ res = driver_register(&aem_driver.driver);
7805 - if (res) {
7806 - printk(KERN_ERR "Can't register aem driver\n");
7807 - return res;
7808 -@@ -1097,7 +1099,7 @@ static int __init aem_init(void)
7809 - return 0;
7810 -
7811 - ipmi_reg_err:
7812 -- driver_unregister(&aem_driver);
7813 -+ driver_unregister(&aem_driver.driver);
7814 - return res;
7815 -
7816 - }
7817 -@@ -1107,7 +1109,7 @@ static void __exit aem_exit(void)
7818 - struct aem_data *p1, *next1;
7819 -
7820 - ipmi_smi_watcher_unregister(&driver_data.bmc_events);
7821 -- driver_unregister(&aem_driver);
7822 -+ driver_unregister(&aem_driver.driver);
7823 - list_for_each_entry_safe(p1, next1, &driver_data.aem_devices, list)
7824 - aem_delete(p1);
7825 - }
7826 -diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
7827 -index 385e32b..cbedf95 100644
7828 ---- a/drivers/input/mouse/alps.c
7829 -+++ b/drivers/input/mouse/alps.c
7830 -@@ -54,6 +54,7 @@ static const struct alps_model_info alps_model_data[] = {
7831 - { { 0x20, 0x02, 0x0e }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* XXX */
7832 - { { 0x22, 0x02, 0x0a }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT },
7833 - { { 0x22, 0x02, 0x14 }, 0xff, 0xff, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude D600 */
7834 -+ { { 0x62, 0x02, 0x14 }, 0xcf, 0xcf, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude E6500 */
7835 - { { 0x73, 0x02, 0x50 }, 0xcf, 0xcf, ALPS_FW_BK_1 } /* Dell Vostro 1400 */
7836 - };
7837 -
7838 -diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
7839 -index ff05fe8..97ef945 100644
7840 ---- a/drivers/md/dm-raid1.c
7841 -+++ b/drivers/md/dm-raid1.c
7842 -@@ -1598,6 +1598,7 @@ static void mirror_dtr(struct dm_target *ti)
7843 -
7844 - del_timer_sync(&ms->timer);
7845 - flush_workqueue(ms->kmirrord_wq);
7846 -+ flush_scheduled_work();
7847 - dm_kcopyd_client_destroy(ms->kcopyd_client);
7848 - destroy_workqueue(ms->kmirrord_wq);
7849 - free_context(ms, ti, ms->nr_mirrors);
7850 -diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
7851 -index b59e472..d74df58 100644
7852 ---- a/drivers/media/video/tvaudio.c
7853 -+++ b/drivers/media/video/tvaudio.c
7854 -@@ -1576,13 +1576,13 @@ static int tvaudio_get_ctrl(struct CHIPSTATE *chip,
7855 - return 0;
7856 - }
7857 - case V4L2_CID_AUDIO_BASS:
7858 -- if (desc->flags & CHIP_HAS_BASSTREBLE)
7859 -+ if (!(desc->flags & CHIP_HAS_BASSTREBLE))
7860 - break;
7861 - ctrl->value = chip->bass;
7862 - return 0;
7863 - case V4L2_CID_AUDIO_TREBLE:
7864 -- if (desc->flags & CHIP_HAS_BASSTREBLE)
7865 -- return -EINVAL;
7866 -+ if (!(desc->flags & CHIP_HAS_BASSTREBLE))
7867 -+ break;
7868 - ctrl->value = chip->treble;
7869 - return 0;
7870 - }
7871 -@@ -1642,16 +1642,15 @@ static int tvaudio_set_ctrl(struct CHIPSTATE *chip,
7872 - return 0;
7873 - }
7874 - case V4L2_CID_AUDIO_BASS:
7875 -- if (desc->flags & CHIP_HAS_BASSTREBLE)
7876 -+ if (!(desc->flags & CHIP_HAS_BASSTREBLE))
7877 - break;
7878 - chip->bass = ctrl->value;
7879 - chip_write(chip,desc->bassreg,desc->bassfunc(chip->bass));
7880 -
7881 - return 0;
7882 - case V4L2_CID_AUDIO_TREBLE:
7883 -- if (desc->flags & CHIP_HAS_BASSTREBLE)
7884 -- return -EINVAL;
7885 --
7886 -+ if (!(desc->flags & CHIP_HAS_BASSTREBLE))
7887 -+ break;
7888 - chip->treble = ctrl->value;
7889 - chip_write(chip,desc->treblereg,desc->treblefunc(chip->treble));
7890 -
7891 -@@ -1695,7 +1694,7 @@ static int chip_command(struct i2c_client *client,
7892 - break;
7893 - case V4L2_CID_AUDIO_BASS:
7894 - case V4L2_CID_AUDIO_TREBLE:
7895 -- if (desc->flags & CHIP_HAS_BASSTREBLE)
7896 -+ if (!(desc->flags & CHIP_HAS_BASSTREBLE))
7897 - return -EINVAL;
7898 - break;
7899 - default:
7900 -diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
7901 -index 60775be..b35eb92 100644
7902 ---- a/drivers/misc/sony-laptop.c
7903 -+++ b/drivers/misc/sony-laptop.c
7904 -@@ -2315,8 +2315,10 @@ end:
7905 - */
7906 - static int sony_pic_disable(struct acpi_device *device)
7907 - {
7908 -- if (ACPI_FAILURE(acpi_evaluate_object(device->handle,
7909 -- "_DIS", NULL, NULL)))
7910 -+ acpi_status ret = acpi_evaluate_object(device->handle, "_DIS", NULL,
7911 -+ NULL);
7912 -+
7913 -+ if (ACPI_FAILURE(ret) && ret != AE_NOT_FOUND)
7914 - return -ENXIO;
7915 -
7916 - dprintk("Device disabled\n");
7917 -diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
7918 -index 4a11296..60a0453 100644
7919 ---- a/drivers/net/Kconfig
7920 -+++ b/drivers/net/Kconfig
7921 -@@ -2046,6 +2046,7 @@ config R8169
7922 - tristate "Realtek 8169 gigabit ethernet support"
7923 - depends on PCI
7924 - select CRC32
7925 -+ select MII
7926 - ---help---
7927 - Say Y here if you have a Realtek 8169 PCI Gigabit Ethernet adapter.
7928 -
7929 -diff --git a/drivers/net/bnx2x_init.h b/drivers/net/bnx2x_init.h
7930 -index 130927c..a6c0b3a 100644
7931 ---- a/drivers/net/bnx2x_init.h
7932 -+++ b/drivers/net/bnx2x_init.h
7933 -@@ -564,14 +564,15 @@ static const struct arb_line write_arb_addr[NUM_WR_Q-1] = {
7934 -
7935 - static void bnx2x_init_pxp(struct bnx2x *bp)
7936 - {
7937 -+ u16 devctl;
7938 - int r_order, w_order;
7939 - u32 val, i;
7940 -
7941 - pci_read_config_word(bp->pdev,
7942 -- bp->pcie_cap + PCI_EXP_DEVCTL, (u16 *)&val);
7943 -- DP(NETIF_MSG_HW, "read 0x%x from devctl\n", (u16)val);
7944 -- w_order = ((val & PCI_EXP_DEVCTL_PAYLOAD) >> 5);
7945 -- r_order = ((val & PCI_EXP_DEVCTL_READRQ) >> 12);
7946 -+ bp->pcie_cap + PCI_EXP_DEVCTL, &devctl);
7947 -+ DP(NETIF_MSG_HW, "read 0x%x from devctl\n", devctl);
7948 -+ w_order = ((devctl & PCI_EXP_DEVCTL_PAYLOAD) >> 5);
7949 -+ r_order = ((devctl & PCI_EXP_DEVCTL_READRQ) >> 12);
7950 -
7951 - if (r_order > MAX_RD_ORD) {
7952 - DP(NETIF_MSG_HW, "read order of %d order adjusted to %d\n",
7953 -diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
7954 -index a8eb3c4..53459db 100644
7955 ---- a/drivers/net/bnx2x_main.c
7956 -+++ b/drivers/net/bnx2x_main.c
7957 -@@ -6480,6 +6480,7 @@ load_int_disable:
7958 - bnx2x_free_irq(bp);
7959 - load_error:
7960 - bnx2x_free_mem(bp);
7961 -+ bp->port.pmf = 0;
7962 -
7963 - /* TBD we really need to reset the chip
7964 - if we want to recover from this */
7965 -@@ -6790,6 +6791,7 @@ unload_error:
7966 - /* Report UNLOAD_DONE to MCP */
7967 - if (!BP_NOMCP(bp))
7968 - bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_DONE);
7969 -+ bp->port.pmf = 0;
7970 -
7971 - /* Free SKBs, SGEs, TPA pool and driver internals */
7972 - bnx2x_free_skbs(bp);
7973 -@@ -10203,8 +10205,6 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
7974 - return -ENOMEM;
7975 - }
7976 -
7977 -- netif_carrier_off(dev);
7978 --
7979 - bp = netdev_priv(dev);
7980 - bp->msglevel = debug;
7981 -
7982 -@@ -10228,6 +10228,8 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
7983 - goto init_one_exit;
7984 - }
7985 -
7986 -+ netif_carrier_off(dev);
7987 -+
7988 - bp->common.name = board_info[ent->driver_data].name;
7989 - printk(KERN_INFO "%s: %s (%c%d) PCI-E x%d %s found at mem %lx,"
7990 - " IRQ %d, ", dev->name, bp->common.name,
7991 -diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
7992 -index 0676c6d..a225827 100644
7993 ---- a/drivers/net/wireless/ath5k/base.c
7994 -+++ b/drivers/net/wireless/ath5k/base.c
7995 -@@ -294,9 +294,9 @@ static inline u64 ath5k_extend_tsf(struct ath5k_hw *ah, u32 rstamp)
7996 - }
7997 -
7998 - /* Interrupt handling */
7999 --static int ath5k_init(struct ath5k_softc *sc);
8000 -+static int ath5k_init(struct ath5k_softc *sc, bool is_resume);
8001 - static int ath5k_stop_locked(struct ath5k_softc *sc);
8002 --static int ath5k_stop_hw(struct ath5k_softc *sc);
8003 -+static int ath5k_stop_hw(struct ath5k_softc *sc, bool is_suspend);
8004 - static irqreturn_t ath5k_intr(int irq, void *dev_id);
8005 - static void ath5k_tasklet_reset(unsigned long data);
8006 -
8007 -@@ -584,7 +584,7 @@ ath5k_pci_suspend(struct pci_dev *pdev, pm_message_t state)
8008 -
8009 - ath5k_led_off(sc);
8010 -
8011 -- ath5k_stop_hw(sc);
8012 -+ ath5k_stop_hw(sc, true);
8013 -
8014 - free_irq(pdev->irq, sc);
8015 - pci_save_state(pdev);
8016 -@@ -599,8 +599,7 @@ ath5k_pci_resume(struct pci_dev *pdev)
8017 - {
8018 - struct ieee80211_hw *hw = pci_get_drvdata(pdev);
8019 - struct ath5k_softc *sc = hw->priv;
8020 -- struct ath5k_hw *ah = sc->ah;
8021 -- int i, err;
8022 -+ int err;
8023 -
8024 - pci_restore_state(pdev);
8025 -
8026 -@@ -621,21 +620,11 @@ ath5k_pci_resume(struct pci_dev *pdev)
8027 - goto err_no_irq;
8028 - }
8029 -
8030 -- err = ath5k_init(sc);
8031 -+ err = ath5k_init(sc, true);
8032 - if (err)
8033 - goto err_irq;
8034 - ath5k_led_enable(sc);
8035 -
8036 -- /*
8037 -- * Reset the key cache since some parts do not
8038 -- * reset the contents on initial power up or resume.
8039 -- *
8040 -- * FIXME: This may need to be revisited when mac80211 becomes
8041 -- * aware of suspend/resume.
8042 -- */
8043 -- for (i = 0; i < AR5K_KEYTABLE_SIZE; i++)
8044 -- ath5k_hw_reset_key(ah, i);
8045 --
8046 - return 0;
8047 - err_irq:
8048 - free_irq(pdev->irq, sc);
8049 -@@ -657,7 +646,6 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
8050 - struct ath5k_softc *sc = hw->priv;
8051 - struct ath5k_hw *ah = sc->ah;
8052 - u8 mac[ETH_ALEN];
8053 -- unsigned int i;
8054 - int ret;
8055 -
8056 - ATH5K_DBG(sc, ATH5K_DEBUG_ANY, "devid 0x%x\n", pdev->device);
8057 -@@ -676,13 +664,6 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
8058 - __set_bit(ATH_STAT_MRRETRY, sc->status);
8059 -
8060 - /*
8061 -- * Reset the key cache since some parts do not
8062 -- * reset the contents on initial power up.
8063 -- */
8064 -- for (i = 0; i < AR5K_KEYTABLE_SIZE; i++)
8065 -- ath5k_hw_reset_key(ah, i);
8066 --
8067 -- /*
8068 - * Collect the channel list. The 802.11 layer
8069 - * is resposible for filtering this list based
8070 - * on settings like the phy mode and regulatory
8071 -@@ -2197,12 +2178,18 @@ ath5k_beacon_config(struct ath5k_softc *sc)
8072 - \********************/
8073 -
8074 - static int
8075 --ath5k_init(struct ath5k_softc *sc)
8076 -+ath5k_init(struct ath5k_softc *sc, bool is_resume)
8077 - {
8078 -- int ret;
8079 -+ struct ath5k_hw *ah = sc->ah;
8080 -+ int ret, i;
8081 -
8082 - mutex_lock(&sc->lock);
8083 -
8084 -+ if (is_resume && !test_bit(ATH_STAT_STARTED, sc->status))
8085 -+ goto out_ok;
8086 -+
8087 -+ __clear_bit(ATH_STAT_STARTED, sc->status);
8088 -+
8089 - ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "mode %d\n", sc->opmode);
8090 -
8091 - /*
8092 -@@ -2220,7 +2207,7 @@ ath5k_init(struct ath5k_softc *sc)
8093 - */
8094 - sc->curchan = sc->hw->conf.channel;
8095 - sc->curband = &sc->sbands[sc->curchan->band];
8096 -- ret = ath5k_hw_reset(sc->ah, sc->opmode, sc->curchan, false);
8097 -+ ret = ath5k_hw_reset(ah, sc->opmode, sc->curchan, false);
8098 - if (ret) {
8099 - ATH5K_ERR(sc, "unable to reset hardware: %d\n", ret);
8100 - goto done;
8101 -@@ -2229,7 +2216,14 @@ ath5k_init(struct ath5k_softc *sc)
8102 - * This is needed only to setup initial state
8103 - * but it's best done after a reset.
8104 - */
8105 -- ath5k_hw_set_txpower_limit(sc->ah, 0);
8106 -+ ath5k_hw_set_txpower_limit(ah, 0);
8107 -+
8108 -+ /*
8109 -+ * Reset the key cache since some parts do not reset the
8110 -+ * contents on initial power up or resume from suspend.
8111 -+ */
8112 -+ for (i = 0; i < AR5K_KEYTABLE_SIZE; i++)
8113 -+ ath5k_hw_reset_key(ah, i);
8114 -
8115 - /*
8116 - * Setup the hardware after reset: the key cache
8117 -@@ -2249,13 +2243,17 @@ ath5k_init(struct ath5k_softc *sc)
8118 - AR5K_INT_RXORN | AR5K_INT_FATAL | AR5K_INT_GLOBAL |
8119 - AR5K_INT_MIB;
8120 -
8121 -- ath5k_hw_set_intr(sc->ah, sc->imask);
8122 -+ ath5k_hw_set_intr(ah, sc->imask);
8123 -+
8124 -+ __set_bit(ATH_STAT_STARTED, sc->status);
8125 -+
8126 - /* Set ack to be sent at low bit-rates */
8127 -- ath5k_hw_set_ack_bitrate_high(sc->ah, false);
8128 -+ ath5k_hw_set_ack_bitrate_high(ah, false);
8129 -
8130 - mod_timer(&sc->calib_tim, round_jiffies(jiffies +
8131 - msecs_to_jiffies(ath5k_calinterval * 1000)));
8132 -
8133 -+out_ok:
8134 - ret = 0;
8135 - done:
8136 - mmiowb();
8137 -@@ -2310,7 +2308,7 @@ ath5k_stop_locked(struct ath5k_softc *sc)
8138 - * stop is preempted).
8139 - */
8140 - static int
8141 --ath5k_stop_hw(struct ath5k_softc *sc)
8142 -+ath5k_stop_hw(struct ath5k_softc *sc, bool is_suspend)
8143 - {
8144 - int ret;
8145 -
8146 -@@ -2341,6 +2339,9 @@ ath5k_stop_hw(struct ath5k_softc *sc)
8147 - }
8148 - }
8149 - ath5k_txbuf_free(sc, sc->bbuf);
8150 -+ if (!is_suspend)
8151 -+ __clear_bit(ATH_STAT_STARTED, sc->status);
8152 -+
8153 - mmiowb();
8154 - mutex_unlock(&sc->lock);
8155 -
8156 -@@ -2719,12 +2720,12 @@ err:
8157 -
8158 - static int ath5k_start(struct ieee80211_hw *hw)
8159 - {
8160 -- return ath5k_init(hw->priv);
8161 -+ return ath5k_init(hw->priv, false);
8162 - }
8163 -
8164 - static void ath5k_stop(struct ieee80211_hw *hw)
8165 - {
8166 -- ath5k_stop_hw(hw->priv);
8167 -+ ath5k_stop_hw(hw->priv, false);
8168 - }
8169 -
8170 - static int ath5k_add_interface(struct ieee80211_hw *hw,
8171 -diff --git a/drivers/net/wireless/ath5k/base.h b/drivers/net/wireless/ath5k/base.h
8172 -index 7ec2f37..214a565 100644
8173 ---- a/drivers/net/wireless/ath5k/base.h
8174 -+++ b/drivers/net/wireless/ath5k/base.h
8175 -@@ -132,11 +132,12 @@ struct ath5k_softc {
8176 - size_t desc_len; /* size of TX/RX descriptors */
8177 - u16 cachelsz; /* cache line size */
8178 -
8179 -- DECLARE_BITMAP(status, 4);
8180 -+ DECLARE_BITMAP(status, 5);
8181 - #define ATH_STAT_INVALID 0 /* disable hardware accesses */
8182 - #define ATH_STAT_MRRETRY 1 /* multi-rate retry support */
8183 - #define ATH_STAT_PROMISC 2
8184 - #define ATH_STAT_LEDSOFT 3 /* enable LED gpio status */
8185 -+#define ATH_STAT_STARTED 4 /* opened & irqs enabled */
8186 -
8187 - unsigned int filter_flags; /* HW flags, AR5K_RX_FILTER_* */
8188 - unsigned int curmode; /* current phy mode */
8189 -diff --git a/drivers/net/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c
8190 -index ad1a5b4..9b40cbe 100644
8191 ---- a/drivers/net/wireless/ath5k/hw.c
8192 -+++ b/drivers/net/wireless/ath5k/hw.c
8193 -@@ -826,9 +826,10 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode,
8194 - mdelay(1);
8195 -
8196 - /*
8197 -- * Write some more initial register settings
8198 -+ * Write some more initial register settings for revised chips
8199 - */
8200 -- if (ah->ah_version == AR5K_AR5212) {
8201 -+ if (ah->ah_version == AR5K_AR5212 &&
8202 -+ ah->ah_phy_revision > 0x41) {
8203 - ath5k_hw_reg_write(ah, 0x0002a002, 0x982c);
8204 -
8205 - if (channel->hw_value == CHANNEL_G)
8206 -@@ -847,19 +848,10 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode,
8207 - else
8208 - ath5k_hw_reg_write(ah, 0x00000000, 0x994c);
8209 -
8210 -- /* Some bits are disabled here, we know nothing about
8211 -- * register 0xa228 yet, most of the times this ends up
8212 -- * with a value 0x9b5 -haven't seen any dump with
8213 -- * a different value- */
8214 -- /* Got this from decompiling binary HAL */
8215 -- data = ath5k_hw_reg_read(ah, 0xa228);
8216 -- data &= 0xfffffdff;
8217 -- ath5k_hw_reg_write(ah, data, 0xa228);
8218 --
8219 -- data = ath5k_hw_reg_read(ah, 0xa228);
8220 -- data &= 0xfffe03ff;
8221 -- ath5k_hw_reg_write(ah, data, 0xa228);
8222 -- data = 0;
8223 -+ /* Got this from legacy-hal */
8224 -+ AR5K_REG_DISABLE_BITS(ah, 0xa228, 0x200);
8225 -+
8226 -+ AR5K_REG_MASKED_BITS(ah, 0xa228, 2 << 10, ~0x1fc00);
8227 -
8228 - /* Just write 0x9b5 ? */
8229 - /* ath5k_hw_reg_write(ah, 0x000009b5, 0xa228); */
8230 -diff --git a/drivers/net/wireless/ath5k/initvals.c b/drivers/net/wireless/ath5k/initvals.c
8231 -index 2806b21..cf7ebd1 100644
8232 ---- a/drivers/net/wireless/ath5k/initvals.c
8233 -+++ b/drivers/net/wireless/ath5k/initvals.c
8234 -@@ -810,6 +810,8 @@ static const struct ath5k_ini_mode ar5212_rf5111_ini_mode_end[] = {
8235 - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
8236 - { AR5K_PHY(642),
8237 - { 0xd03e6788, 0xd03e6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } },
8238 -+ { 0xa228,
8239 -+ { 0x000001b5, 0x000001b5, 0x000001b5, 0x000001b5, 0x000001b5 } },
8240 - { 0xa23c,
8241 - { 0x13c889af, 0x13c889af, 0x13c889af, 0x13c889af, 0x13c889af } },
8242 - };
8243 -diff --git a/drivers/net/wireless/hostap/hostap_wlan.h b/drivers/net/wireless/hostap/hostap_wlan.h
8244 -index ffdf487..a68f97c 100644
8245 ---- a/drivers/net/wireless/hostap/hostap_wlan.h
8246 -+++ b/drivers/net/wireless/hostap/hostap_wlan.h
8247 -@@ -918,9 +918,12 @@ struct hostap_interface {
8248 -
8249 - /*
8250 - * TX meta data - stored in skb->cb buffer, so this must not be increased over
8251 -- * the 40-byte limit
8252 -+ * the 48-byte limit.
8253 -+ * THE PADDING THIS STARTS WITH IS A HORRIBLE HACK THAT SHOULD NOT LIVE
8254 -+ * TO SEE THE DAY.
8255 - */
8256 - struct hostap_skb_tx_data {
8257 -+ unsigned int __padding_for_default_qdiscs;
8258 - u32 magic; /* HOSTAP_SKB_TX_DATA_MAGIC */
8259 - u8 rate; /* transmit rate */
8260 - #define HOSTAP_TX_FLAGS_WDS BIT(0)
8261 -diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
8262 -index 72a6743..cf7056e 100644
8263 ---- a/drivers/net/wireless/iwlwifi/iwl-agn.c
8264 -+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
8265 -@@ -3275,7 +3275,11 @@ static void iwl4965_mac_update_tkip_key(struct ieee80211_hw *hw,
8266 - return;
8267 - }
8268 -
8269 -- iwl_scan_cancel_timeout(priv, 100);
8270 -+ if (iwl_scan_cancel(priv)) {
8271 -+ /* cancel scan failed, just live w/ bad key and rely
8272 -+ briefly on SW decryption */
8273 -+ return;
8274 -+ }
8275 -
8276 - key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK);
8277 - key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
8278 -diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c
8279 -index ca5deb6..0cebbc4 100644
8280 ---- a/drivers/net/wireless/rtl8187_dev.c
8281 -+++ b/drivers/net/wireless/rtl8187_dev.c
8282 -@@ -45,6 +45,9 @@ static struct usb_device_id rtl8187_table[] __devinitdata = {
8283 - {USB_DEVICE(0x03f0, 0xca02), .driver_info = DEVICE_RTL8187},
8284 - /* Sitecom */
8285 - {USB_DEVICE(0x0df6, 0x000d), .driver_info = DEVICE_RTL8187},
8286 -+ {USB_DEVICE(0x0df6, 0x0028), .driver_info = DEVICE_RTL8187B},
8287 -+ /* Abocom */
8288 -+ {USB_DEVICE(0x13d1, 0xabe6), .driver_info = DEVICE_RTL8187},
8289 - {}
8290 - };
8291 -
8292 -diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
8293 -index c1b9ea3..98b9df7 100644
8294 ---- a/drivers/pnp/pnpacpi/core.c
8295 -+++ b/drivers/pnp/pnpacpi/core.c
8296 -@@ -148,9 +148,13 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
8297 - acpi_status status;
8298 - struct pnp_dev *dev;
8299 -
8300 -+ /*
8301 -+ * If a PnPacpi device is not present , the device
8302 -+ * driver should not be loaded.
8303 -+ */
8304 - status = acpi_get_handle(device->handle, "_CRS", &temp);
8305 - if (ACPI_FAILURE(status) || !ispnpidacpi(acpi_device_hid(device)) ||
8306 -- is_exclusive_device(device))
8307 -+ is_exclusive_device(device) || (!device->status.present))
8308 - return 0;
8309 -
8310 - dev = pnp_alloc_dev(&pnpacpi_protocol, num, acpi_device_hid(device));
8311 -diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
8312 -index 1fe0901..7716145 100644
8313 ---- a/drivers/scsi/dpt_i2o.c
8314 -+++ b/drivers/scsi/dpt_i2o.c
8315 -@@ -2445,7 +2445,7 @@ static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd)
8316 - hba_status = detailed_status >> 8;
8317 -
8318 - // calculate resid for sg
8319 -- scsi_set_resid(cmd, scsi_bufflen(cmd) - readl(reply+5));
8320 -+ scsi_set_resid(cmd, scsi_bufflen(cmd) - readl(reply+20));
8321 -
8322 - pHba = (adpt_hba*) cmd->device->host->hostdata[0];
8323 -
8324 -@@ -2456,7 +2456,7 @@ static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd)
8325 - case I2O_SCSI_DSC_SUCCESS:
8326 - cmd->result = (DID_OK << 16);
8327 - // handle underflow
8328 -- if(readl(reply+5) < cmd->underflow ) {
8329 -+ if (readl(reply+20) < cmd->underflow) {
8330 - cmd->result = (DID_ERROR <<16);
8331 - printk(KERN_WARNING"%s: SCSI CMD underflow\n",pHba->name);
8332 - }
8333 -diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
8334 -index 94a720e..00f6780 100644
8335 ---- a/drivers/scsi/qla2xxx/qla_def.h
8336 -+++ b/drivers/scsi/qla2xxx/qla_def.h
8337 -@@ -2546,7 +2546,6 @@ typedef struct scsi_qla_host {
8338 - uint8_t fcode_revision[16];
8339 - uint32_t fw_revision[4];
8340 -
8341 -- uint16_t fdt_odd_index;
8342 - uint32_t fdt_wrt_disable;
8343 - uint32_t fdt_erase_cmd;
8344 - uint32_t fdt_block_size;
8345 -diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
8346 -index ee89ddd..3a0a178 100644
8347 ---- a/drivers/scsi/qla2xxx/qla_init.c
8348 -+++ b/drivers/scsi/qla2xxx/qla_init.c
8349 -@@ -974,7 +974,6 @@ qla2x00_setup_chip(scsi_qla_host_t *ha)
8350 - &ha->fw_minor_version,
8351 - &ha->fw_subminor_version,
8352 - &ha->fw_attributes, &ha->fw_memory_size);
8353 -- qla2x00_resize_request_q(ha);
8354 - ha->flags.npiv_supported = 0;
8355 - if ((IS_QLA24XX(ha) || IS_QLA25XX(ha) ||
8356 - IS_QLA84XX(ha)) &&
8357 -@@ -986,6 +985,7 @@ qla2x00_setup_chip(scsi_qla_host_t *ha)
8358 - ha->max_npiv_vports =
8359 - MIN_MULTI_ID_FABRIC - 1;
8360 - }
8361 -+ qla2x00_resize_request_q(ha);
8362 -
8363 - if (ql2xallocfwdump)
8364 - qla2x00_alloc_fw_dump(ha);
8365 -diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
8366 -index 813bc77..c07e879 100644
8367 ---- a/drivers/scsi/qla2xxx/qla_mbx.c
8368 -+++ b/drivers/scsi/qla2xxx/qla_mbx.c
8369 -@@ -1964,7 +1964,7 @@ qla2x00_get_resource_cnts(scsi_qla_host_t *ha, uint16_t *cur_xchg_cnt,
8370 - *cur_iocb_cnt = mcp->mb[7];
8371 - if (orig_iocb_cnt)
8372 - *orig_iocb_cnt = mcp->mb[10];
8373 -- if (max_npiv_vports)
8374 -+ if (ha->flags.npiv_supported && max_npiv_vports)
8375 - *max_npiv_vports = mcp->mb[11];
8376 - }
8377 -
8378 -diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
8379 -index 6d0f0e5..86e143c 100644
8380 ---- a/drivers/scsi/qla2xxx/qla_os.c
8381 -+++ b/drivers/scsi/qla2xxx/qla_os.c
8382 -@@ -730,6 +730,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
8383 - if (ha->isp_ops->abort_command(ha, sp)) {
8384 - DEBUG2(printk("%s(%ld): abort_command "
8385 - "mbx failed.\n", __func__, ha->host_no));
8386 -+ ret = FAILED;
8387 - } else {
8388 - DEBUG3(printk("%s(%ld): abort_command "
8389 - "mbx success.\n", __func__, ha->host_no));
8390 -diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c
8391 -index 1bca744..910c3b3 100644
8392 ---- a/drivers/scsi/qla2xxx/qla_sup.c
8393 -+++ b/drivers/scsi/qla2xxx/qla_sup.c
8394 -@@ -546,6 +546,7 @@ qla24xx_get_flash_manufacturer(scsi_qla_host_t *ha, uint8_t *man_id,
8395 - void
8396 - qla2xxx_get_flash_info(scsi_qla_host_t *ha)
8397 - {
8398 -+#define FLASH_BLK_SIZE_4K 0x1000
8399 - #define FLASH_BLK_SIZE_32K 0x8000
8400 - #define FLASH_BLK_SIZE_64K 0x10000
8401 - uint16_t cnt, chksum;
8402 -@@ -577,7 +578,6 @@ qla2xxx_get_flash_info(scsi_qla_host_t *ha)
8403 - goto no_flash_data;
8404 - }
8405 -
8406 -- ha->fdt_odd_index = le16_to_cpu(fdt->man_id) == 0x1f;
8407 - ha->fdt_wrt_disable = fdt->wrt_disable_bits;
8408 - ha->fdt_erase_cmd = flash_conf_to_access_addr(0x0300 | fdt->erase_cmd);
8409 - ha->fdt_block_size = le32_to_cpu(fdt->block_size);
8410 -@@ -590,10 +590,10 @@ qla2xxx_get_flash_info(scsi_qla_host_t *ha)
8411 - }
8412 -
8413 - DEBUG2(qla_printk(KERN_DEBUG, ha, "Flash[FDT]: (0x%x/0x%x) erase=0x%x "
8414 -- "pro=%x upro=%x idx=%d wrtd=0x%x blk=0x%x.\n",
8415 -+ "pro=%x upro=%x wrtd=0x%x blk=0x%x.\n",
8416 - le16_to_cpu(fdt->man_id), le16_to_cpu(fdt->id), ha->fdt_erase_cmd,
8417 - ha->fdt_protect_sec_cmd, ha->fdt_unprotect_sec_cmd,
8418 -- ha->fdt_odd_index, ha->fdt_wrt_disable, ha->fdt_block_size));
8419 -+ ha->fdt_wrt_disable, ha->fdt_block_size));
8420 - return;
8421 -
8422 - no_flash_data:
8423 -@@ -614,8 +614,7 @@ no_flash_data:
8424 - ha->fdt_block_size = FLASH_BLK_SIZE_64K;
8425 - break;
8426 - case 0x1f: /* Atmel 26DF081A. */
8427 -- ha->fdt_odd_index = 1;
8428 -- ha->fdt_block_size = FLASH_BLK_SIZE_64K;
8429 -+ ha->fdt_block_size = FLASH_BLK_SIZE_4K;
8430 - ha->fdt_erase_cmd = flash_conf_to_access_addr(0x0320);
8431 - ha->fdt_unprotect_sec_cmd = flash_conf_to_access_addr(0x0339);
8432 - ha->fdt_protect_sec_cmd = flash_conf_to_access_addr(0x0336);
8433 -@@ -627,9 +626,9 @@ no_flash_data:
8434 - }
8435 -
8436 - DEBUG2(qla_printk(KERN_DEBUG, ha, "Flash[MID]: (0x%x/0x%x) erase=0x%x "
8437 -- "pro=%x upro=%x idx=%d wrtd=0x%x blk=0x%x.\n", man_id, flash_id,
8438 -+ "pro=%x upro=%x wrtd=0x%x blk=0x%x.\n", man_id, flash_id,
8439 - ha->fdt_erase_cmd, ha->fdt_protect_sec_cmd,
8440 -- ha->fdt_unprotect_sec_cmd, ha->fdt_odd_index, ha->fdt_wrt_disable,
8441 -+ ha->fdt_unprotect_sec_cmd, ha->fdt_wrt_disable,
8442 - ha->fdt_block_size));
8443 - }
8444 -
8445 -@@ -710,13 +709,9 @@ qla24xx_write_flash_data(scsi_qla_host_t *ha, uint32_t *dwptr, uint32_t faddr,
8446 - qla24xx_unprotect_flash(ha);
8447 -
8448 - for (liter = 0; liter < dwords; liter++, faddr++, dwptr++) {
8449 -- if (ha->fdt_odd_index) {
8450 -- findex = faddr << 2;
8451 -- fdata = findex & sec_mask;
8452 -- } else {
8453 -- findex = faddr;
8454 -- fdata = (findex & sec_mask) << 2;
8455 -- }
8456 -+
8457 -+ findex = faddr;
8458 -+ fdata = (findex & sec_mask) << 2;
8459 -
8460 - /* Are we at the beginning of a sector? */
8461 - if ((findex & rest_addr) == 0) {
8462 -diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
8463 -index d996a61..61524fc 100644
8464 ---- a/drivers/usb/class/cdc-acm.c
8465 -+++ b/drivers/usb/class/cdc-acm.c
8466 -@@ -158,16 +158,12 @@ static int acm_wb_is_avail(struct acm *acm)
8467 - }
8468 -
8469 - /*
8470 -- * Finish write.
8471 -+ * Finish write. Caller must hold acm->write_lock
8472 - */
8473 - static void acm_write_done(struct acm *acm, struct acm_wb *wb)
8474 - {
8475 -- unsigned long flags;
8476 --
8477 -- spin_lock_irqsave(&acm->write_lock, flags);
8478 - wb->use = 0;
8479 - acm->transmitting--;
8480 -- spin_unlock_irqrestore(&acm->write_lock, flags);
8481 - }
8482 -
8483 - /*
8484 -@@ -482,6 +478,7 @@ static void acm_write_bulk(struct urb *urb)
8485 - {
8486 - struct acm_wb *wb = urb->context;
8487 - struct acm *acm = wb->instance;
8488 -+ unsigned long flags;
8489 -
8490 - if (verbose || urb->status
8491 - || (urb->actual_length != urb->transfer_buffer_length))
8492 -@@ -490,7 +487,9 @@ static void acm_write_bulk(struct urb *urb)
8493 - urb->transfer_buffer_length,
8494 - urb->status);
8495 -
8496 -+ spin_lock_irqsave(&acm->write_lock, flags);
8497 - acm_write_done(acm, wb);
8498 -+ spin_unlock_irqrestore(&acm->write_lock, flags);
8499 - if (ACM_READY(acm))
8500 - schedule_work(&acm->work);
8501 - else
8502 -diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
8503 -index 286b443..9cfa366 100644
8504 ---- a/drivers/usb/core/message.c
8505 -+++ b/drivers/usb/core/message.c
8506 -@@ -1091,6 +1091,7 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
8507 - continue;
8508 - dev_dbg(&dev->dev, "unregistering interface %s\n",
8509 - dev_name(&interface->dev));
8510 -+ interface->unregistering = 1;
8511 - usb_remove_sysfs_intf_files(interface);
8512 - device_del(&interface->dev);
8513 - }
8514 -diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
8515 -index 5e1f5d5..668a6d6 100644
8516 ---- a/drivers/usb/core/sysfs.c
8517 -+++ b/drivers/usb/core/sysfs.c
8518 -@@ -816,7 +816,7 @@ int usb_create_sysfs_intf_files(struct usb_interface *intf)
8519 - struct usb_host_interface *alt = intf->cur_altsetting;
8520 - int retval;
8521 -
8522 -- if (intf->sysfs_files_created)
8523 -+ if (intf->sysfs_files_created || intf->unregistering)
8524 - return 0;
8525 -
8526 - /* The interface string may be present in some altsettings
8527 -diff --git a/drivers/usb/gadget/f_acm.c b/drivers/usb/gadget/f_acm.c
8528 -index 5ee1590..c1d34df 100644
8529 ---- a/drivers/usb/gadget/f_acm.c
8530 -+++ b/drivers/usb/gadget/f_acm.c
8531 -@@ -463,7 +463,11 @@ static int acm_cdc_notify(struct f_acm *acm, u8 type, u16 value,
8532 - notify->wLength = cpu_to_le16(length);
8533 - memcpy(buf, data, length);
8534 -
8535 -+ /* ep_queue() can complete immediately if it fills the fifo... */
8536 -+ spin_unlock(&acm->lock);
8537 - status = usb_ep_queue(ep, req, GFP_ATOMIC);
8538 -+ spin_lock(&acm->lock);
8539 -+
8540 - if (status < 0) {
8541 - ERROR(acm->port.func.config->cdev,
8542 - "acm ttyGS%d can't notify serial state, %d\n",
8543 -diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
8544 -index 228797e..a657c94 100644
8545 ---- a/drivers/usb/host/Kconfig
8546 -+++ b/drivers/usb/host/Kconfig
8547 -@@ -110,29 +110,18 @@ config USB_ISP116X_HCD
8548 -
8549 - config USB_ISP1760_HCD
8550 - tristate "ISP 1760 HCD support"
8551 -- depends on USB && EXPERIMENTAL
8552 -+ depends on USB && EXPERIMENTAL && (PCI || PPC_OF)
8553 - ---help---
8554 - The ISP1760 chip is a USB 2.0 host controller.
8555 -
8556 - This driver does not support isochronous transfers or OTG.
8557 -+ This USB controller is usually attached to a non-DMA-Master
8558 -+ capable bus. NXP's eval kit brings this chip on PCI card
8559 -+ where the chip itself is behind a PLB to simulate such
8560 -+ a bus.
8561 -
8562 - To compile this driver as a module, choose M here: the
8563 -- module will be called isp1760-hcd.
8564 --
8565 --config USB_ISP1760_PCI
8566 -- bool "Support for the PCI bus"
8567 -- depends on USB_ISP1760_HCD && PCI
8568 -- ---help---
8569 -- Enables support for the device present on the PCI bus.
8570 -- This should only be required if you happen to have the eval kit from
8571 -- NXP and you are going to test it.
8572 --
8573 --config USB_ISP1760_OF
8574 -- bool "Support for the OF platform bus"
8575 -- depends on USB_ISP1760_HCD && PPC_OF
8576 -- ---help---
8577 -- Enables support for the device present on the PowerPC
8578 -- OpenFirmware platform bus.
8579 -+ module will be called isp1760.
8580 -
8581 - config USB_OHCI_HCD
8582 - tristate "OHCI HCD support"
8583 -diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
8584 -index 86e38b0..dc21ade 100644
8585 ---- a/drivers/usb/host/ehci-hcd.c
8586 -+++ b/drivers/usb/host/ehci-hcd.c
8587 -@@ -643,7 +643,7 @@ static int ehci_run (struct usb_hcd *hcd)
8588 - static irqreturn_t ehci_irq (struct usb_hcd *hcd)
8589 - {
8590 - struct ehci_hcd *ehci = hcd_to_ehci (hcd);
8591 -- u32 status, pcd_status = 0, cmd;
8592 -+ u32 status, masked_status, pcd_status = 0, cmd;
8593 - int bh;
8594 -
8595 - spin_lock (&ehci->lock);
8596 -@@ -656,14 +656,14 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
8597 - goto dead;
8598 - }
8599 -
8600 -- status &= INTR_MASK;
8601 -- if (!status) { /* irq sharing? */
8602 -+ masked_status = status & INTR_MASK;
8603 -+ if (!masked_status) { /* irq sharing? */
8604 - spin_unlock(&ehci->lock);
8605 - return IRQ_NONE;
8606 - }
8607 -
8608 - /* clear (just) interrupts */
8609 -- ehci_writel(ehci, status, &ehci->regs->status);
8610 -+ ehci_writel(ehci, masked_status, &ehci->regs->status);
8611 - cmd = ehci_readl(ehci, &ehci->regs->command);
8612 - bh = 0;
8613 -
8614 -@@ -731,19 +731,18 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
8615 -
8616 - /* PCI errors [4.15.2.4] */
8617 - if (unlikely ((status & STS_FATAL) != 0)) {
8618 -+ ehci_err(ehci, "fatal error\n");
8619 - dbg_cmd (ehci, "fatal", ehci_readl(ehci,
8620 - &ehci->regs->command));
8621 - dbg_status (ehci, "fatal", status);
8622 -- if (status & STS_HALT) {
8623 -- ehci_err (ehci, "fatal error\n");
8624 -+ ehci_halt(ehci);
8625 - dead:
8626 -- ehci_reset (ehci);
8627 -- ehci_writel(ehci, 0, &ehci->regs->configured_flag);
8628 -- /* generic layer kills/unlinks all urbs, then
8629 -- * uses ehci_stop to clean up the rest
8630 -- */
8631 -- bh = 1;
8632 -- }
8633 -+ ehci_reset(ehci);
8634 -+ ehci_writel(ehci, 0, &ehci->regs->configured_flag);
8635 -+ /* generic layer kills/unlinks all urbs, then
8636 -+ * uses ehci_stop to clean up the rest
8637 -+ */
8638 -+ bh = 1;
8639 - }
8640 -
8641 - if (bh)
8642 -diff --git a/drivers/usb/host/ehci-ps3.c b/drivers/usb/host/ehci-ps3.c
8643 -index 0eba894..9c9da35 100644
8644 ---- a/drivers/usb/host/ehci-ps3.c
8645 -+++ b/drivers/usb/host/ehci-ps3.c
8646 -@@ -205,6 +205,7 @@ static int ps3_ehci_remove(struct ps3_system_bus_device *dev)
8647 -
8648 - tmp = hcd->irq;
8649 -
8650 -+ ehci_shutdown(hcd);
8651 - usb_remove_hcd(hcd);
8652 -
8653 - ps3_system_bus_set_driver_data(dev, NULL);
8654 -diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
8655 -index 4a0c5a7..a081ee6 100644
8656 ---- a/drivers/usb/host/ehci-sched.c
8657 -+++ b/drivers/usb/host/ehci-sched.c
8658 -@@ -918,7 +918,7 @@ iso_stream_init (
8659 - */
8660 - stream->usecs = HS_USECS_ISO (maxp);
8661 - bandwidth = stream->usecs * 8;
8662 -- bandwidth /= 1 << (interval - 1);
8663 -+ bandwidth /= interval;
8664 -
8665 - } else {
8666 - u32 addr;
8667 -@@ -951,7 +951,7 @@ iso_stream_init (
8668 - } else
8669 - stream->raw_mask = smask_out [hs_transfers - 1];
8670 - bandwidth = stream->usecs + stream->c_usecs;
8671 -- bandwidth /= 1 << (interval + 2);
8672 -+ bandwidth /= interval << 3;
8673 -
8674 - /* stream->splits gets created from raw_mask later */
8675 - stream->address = cpu_to_hc32(ehci, addr);
8676 -diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c
8677 -index 051ef7b..78b8aaa 100644
8678 ---- a/drivers/usb/host/isp1760-if.c
8679 -+++ b/drivers/usb/host/isp1760-if.c
8680 -@@ -14,16 +14,16 @@
8681 - #include "../core/hcd.h"
8682 - #include "isp1760-hcd.h"
8683 -
8684 --#ifdef CONFIG_USB_ISP1760_OF
8685 -+#ifdef CONFIG_PPC_OF
8686 - #include <linux/of.h>
8687 - #include <linux/of_platform.h>
8688 - #endif
8689 -
8690 --#ifdef CONFIG_USB_ISP1760_PCI
8691 -+#ifdef CONFIG_PCI
8692 - #include <linux/pci.h>
8693 - #endif
8694 -
8695 --#ifdef CONFIG_USB_ISP1760_OF
8696 -+#ifdef CONFIG_PPC_OF
8697 - static int of_isp1760_probe(struct of_device *dev,
8698 - const struct of_device_id *match)
8699 - {
8700 -@@ -128,7 +128,7 @@ static struct of_platform_driver isp1760_of_driver = {
8701 - };
8702 - #endif
8703 -
8704 --#ifdef CONFIG_USB_ISP1760_PCI
8705 -+#ifdef CONFIG_PCI
8706 - static u32 nxp_pci_io_base;
8707 - static u32 iolength;
8708 - static u32 pci_mem_phy0;
8709 -@@ -287,28 +287,28 @@ static struct pci_driver isp1761_pci_driver = {
8710 -
8711 - static int __init isp1760_init(void)
8712 - {
8713 -- int ret = -ENODEV;
8714 -+ int ret;
8715 -
8716 - init_kmem_once();
8717 -
8718 --#ifdef CONFIG_USB_ISP1760_OF
8719 -+#ifdef CONFIG_PPC_OF
8720 - ret = of_register_platform_driver(&isp1760_of_driver);
8721 - if (ret) {
8722 - deinit_kmem_cache();
8723 - return ret;
8724 - }
8725 - #endif
8726 --#ifdef CONFIG_USB_ISP1760_PCI
8727 -+#ifdef CONFIG_PCI
8728 - ret = pci_register_driver(&isp1761_pci_driver);
8729 - if (ret)
8730 - goto unreg_of;
8731 - #endif
8732 - return ret;
8733 -
8734 --#ifdef CONFIG_USB_ISP1760_PCI
8735 -+#ifdef CONFIG_PCI
8736 - unreg_of:
8737 - #endif
8738 --#ifdef CONFIG_USB_ISP1760_OF
8739 -+#ifdef CONFIG_PPC_OF
8740 - of_unregister_platform_driver(&isp1760_of_driver);
8741 - #endif
8742 - deinit_kmem_cache();
8743 -@@ -318,10 +318,10 @@ module_init(isp1760_init);
8744 -
8745 - static void __exit isp1760_exit(void)
8746 - {
8747 --#ifdef CONFIG_USB_ISP1760_OF
8748 -+#ifdef CONFIG_PPC_OF
8749 - of_unregister_platform_driver(&isp1760_of_driver);
8750 - #endif
8751 --#ifdef CONFIG_USB_ISP1760_PCI
8752 -+#ifdef CONFIG_PCI
8753 - pci_unregister_driver(&isp1761_pci_driver);
8754 - #endif
8755 - deinit_kmem_cache();
8756 -diff --git a/drivers/usb/host/ohci-ps3.c b/drivers/usb/host/ohci-ps3.c
8757 -index 2089d8a..3c1a3b5 100644
8758 ---- a/drivers/usb/host/ohci-ps3.c
8759 -+++ b/drivers/usb/host/ohci-ps3.c
8760 -@@ -192,7 +192,7 @@ fail_start:
8761 - return result;
8762 - }
8763 -
8764 --static int ps3_ohci_remove (struct ps3_system_bus_device *dev)
8765 -+static int ps3_ohci_remove(struct ps3_system_bus_device *dev)
8766 - {
8767 - unsigned int tmp;
8768 - struct usb_hcd *hcd =
8769 -@@ -205,6 +205,7 @@ static int ps3_ohci_remove (struct ps3_system_bus_device *dev)
8770 -
8771 - tmp = hcd->irq;
8772 -
8773 -+ ohci_shutdown(hcd);
8774 - usb_remove_hcd(hcd);
8775 -
8776 - ps3_system_bus_set_driver_data(dev, NULL);
8777 -diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
8778 -index 061df9b..ccebf89 100644
8779 ---- a/drivers/usb/storage/unusual_devs.h
8780 -+++ b/drivers/usb/storage/unusual_devs.h
8781 -@@ -1251,6 +1251,13 @@ UNUSUAL_DEV( 0x0839, 0x000a, 0x0001, 0x0001,
8782 - US_SC_DEVICE, US_PR_DEVICE, NULL,
8783 - US_FL_FIX_INQUIRY),
8784 -
8785 -+/* Reported by Luciano Rocha <luciano@×××××××.com> */
8786 -+UNUSUAL_DEV( 0x0840, 0x0082, 0x0001, 0x0001,
8787 -+ "Argosy",
8788 -+ "Storage",
8789 -+ US_SC_DEVICE, US_PR_DEVICE, NULL,
8790 -+ US_FL_FIX_CAPACITY),
8791 -+
8792 - /* Entry and supporting patch by Theodore Kilgore <kilgota@××××××.edu>.
8793 - * Flag will support Bulk devices which use a standards-violating 32-byte
8794 - * Command Block Wrapper. Here, the "DC2MEGA" cameras (several brands) with
8795 -diff --git a/fs/namespace.c b/fs/namespace.c
8796 -index 6e283c9..1bd5ba2 100644
8797 ---- a/fs/namespace.c
8798 -+++ b/fs/namespace.c
8799 -@@ -1553,8 +1553,13 @@ static noinline int do_remount(struct nameidata *nd, int flags, int mnt_flags,
8800 - if (!err)
8801 - nd->path.mnt->mnt_flags = mnt_flags;
8802 - up_write(&sb->s_umount);
8803 -- if (!err)
8804 -+ if (!err) {
8805 - security_sb_post_remount(nd->path.mnt, flags, data);
8806 -+
8807 -+ spin_lock(&vfsmount_lock);
8808 -+ touch_mnt_namespace(nd->path.mnt->mnt_ns);
8809 -+ spin_unlock(&vfsmount_lock);
8810 -+ }
8811 - return err;
8812 - }
8813 -
8814 -diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
8815 -index f9a8b89..7a510a6 100644
8816 ---- a/fs/proc/proc_sysctl.c
8817 -+++ b/fs/proc/proc_sysctl.c
8818 -@@ -31,6 +31,7 @@ static struct inode *proc_sys_make_inode(struct super_block *sb,
8819 - inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
8820 - inode->i_flags |= S_PRIVATE; /* tell selinux to ignore this inode */
8821 - inode->i_mode = table->mode;
8822 -+ inode->i_uid = inode->i_gid = 0;
8823 - if (!table->child) {
8824 - inode->i_mode |= S_IFREG;
8825 - inode->i_op = &proc_sys_inode_operations;
8826 -diff --git a/include/linux/bio.h b/include/linux/bio.h
8827 -index 0933a14..3d83947 100644
8828 ---- a/include/linux/bio.h
8829 -+++ b/include/linux/bio.h
8830 -@@ -98,6 +98,13 @@ struct bio {
8831 - unsigned int bi_size; /* residual I/O count */
8832 -
8833 - /*
8834 -+ * To keep track of the max segment size, we account for the
8835 -+ * sizes of the first and last mergeable segments in this bio.
8836 -+ */
8837 -+ unsigned int bi_seg_front_size;
8838 -+ unsigned int bi_seg_back_size;
8839 -+
8840 -+ /*
8841 - * To keep track of the max hw size, we account for the
8842 - * sizes of the first and last virtually mergeable segments
8843 - * in this bio
8844 -diff --git a/include/linux/usb.h b/include/linux/usb.h
8845 -index 94ac74a..2e434dc 100644
8846 ---- a/include/linux/usb.h
8847 -+++ b/include/linux/usb.h
8848 -@@ -108,6 +108,7 @@ enum usb_interface_condition {
8849 - * (in probe()), bound to a driver, or unbinding (in disconnect())
8850 - * @is_active: flag set when the interface is bound and not suspended.
8851 - * @sysfs_files_created: sysfs attributes exist
8852 -+ * @unregistering: flag set when the interface is being unregistered
8853 - * @needs_remote_wakeup: flag set when the driver requires remote-wakeup
8854 - * capability during autosuspend.
8855 - * @needs_altsetting0: flag set when a set-interface request for altsetting 0
8856 -@@ -163,6 +164,7 @@ struct usb_interface {
8857 - enum usb_interface_condition condition; /* state of binding */
8858 - unsigned is_active:1; /* the interface is not suspended */
8859 - unsigned sysfs_files_created:1; /* the sysfs attributes exist */
8860 -+ unsigned unregistering:1; /* unregistration is in progress */
8861 - unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */
8862 - unsigned needs_altsetting0:1; /* switch to altsetting 0 is pending */
8863 - unsigned needs_binding:1; /* needs delayed unbind/rebind */
8864 -diff --git a/mm/hugetlb.c b/mm/hugetlb.c
8865 -index 77427c8..81e9a82 100644
8866 ---- a/mm/hugetlb.c
8867 -+++ b/mm/hugetlb.c
8868 -@@ -1797,6 +1797,7 @@ int unmap_ref_private(struct mm_struct *mm,
8869 - struct page *page,
8870 - unsigned long address)
8871 - {
8872 -+ struct hstate *h = hstate_vma(vma);
8873 - struct vm_area_struct *iter_vma;
8874 - struct address_space *mapping;
8875 - struct prio_tree_iter iter;
8876 -@@ -1806,7 +1807,7 @@ int unmap_ref_private(struct mm_struct *mm,
8877 - * vm_pgoff is in PAGE_SIZE units, hence the different calculation
8878 - * from page cache lookup which is in HPAGE_SIZE units.
8879 - */
8880 -- address = address & huge_page_mask(hstate_vma(vma));
8881 -+ address = address & huge_page_mask(h);
8882 - pgoff = ((address - vma->vm_start) >> PAGE_SHIFT)
8883 - + (vma->vm_pgoff >> PAGE_SHIFT);
8884 - mapping = (struct address_space *)page_private(page);
8885 -@@ -1825,7 +1826,7 @@ int unmap_ref_private(struct mm_struct *mm,
8886 - */
8887 - if (!is_vma_resv_set(iter_vma, HPAGE_RESV_OWNER))
8888 - unmap_hugepage_range(iter_vma,
8889 -- address, address + HPAGE_SIZE,
8890 -+ address, address + huge_page_size(h),
8891 - page);
8892 - }
8893 -
8894 -diff --git a/mm/page_isolation.c b/mm/page_isolation.c
8895 -index b70a7fe..5e0ffd9 100644
8896 ---- a/mm/page_isolation.c
8897 -+++ b/mm/page_isolation.c
8898 -@@ -130,10 +130,11 @@ int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn)
8899 - if (page && get_pageblock_migratetype(page) != MIGRATE_ISOLATE)
8900 - break;
8901 - }
8902 -- if (pfn < end_pfn)
8903 -+ page = __first_valid_page(start_pfn, end_pfn - start_pfn);
8904 -+ if ((pfn < end_pfn) || !page)
8905 - return -EBUSY;
8906 - /* Check all pages are free or Marked as ISOLATED */
8907 -- zone = page_zone(pfn_to_page(pfn));
8908 -+ zone = page_zone(page);
8909 - spin_lock_irqsave(&zone->lock, flags);
8910 - ret = __test_page_isolated_in_pageblock(start_pfn, end_pfn);
8911 - spin_unlock_irqrestore(&zone->lock, flags);
8912 -diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
8913 -index 8f5a403..a631a1f 100644
8914 ---- a/net/ipv4/proc.c
8915 -+++ b/net/ipv4/proc.c
8916 -@@ -237,43 +237,45 @@ static const struct snmp_mib snmp4_net_list[] = {
8917 - SNMP_MIB_SENTINEL
8918 - };
8919 -
8920 -+static void icmpmsg_put_line(struct seq_file *seq, unsigned long *vals,
8921 -+ unsigned short *type, int count)
8922 -+{
8923 -+ int j;
8924 -+
8925 -+ if (count) {
8926 -+ seq_printf(seq, "\nIcmpMsg:");
8927 -+ for (j = 0; j < count; ++j)
8928 -+ seq_printf(seq, " %sType%u",
8929 -+ type[j] & 0x100 ? "Out" : "In",
8930 -+ type[j] & 0xff);
8931 -+ seq_printf(seq, "\nIcmpMsg:");
8932 -+ for (j = 0; j < count; ++j)
8933 -+ seq_printf(seq, " %lu", vals[j]);
8934 -+ }
8935 -+}
8936 -+
8937 - static void icmpmsg_put(struct seq_file *seq)
8938 - {
8939 - #define PERLINE 16
8940 -
8941 -- int j, i, count;
8942 -- static int out[PERLINE];
8943 -+ int i, count;
8944 -+ unsigned short type[PERLINE];
8945 -+ unsigned long vals[PERLINE], val;
8946 - struct net *net = seq->private;
8947 -
8948 - count = 0;
8949 - for (i = 0; i < ICMPMSG_MIB_MAX; i++) {
8950 --
8951 -- if (snmp_fold_field((void **) net->mib.icmpmsg_statistics, i))
8952 -- out[count++] = i;
8953 -- if (count < PERLINE)
8954 -- continue;
8955 --
8956 -- seq_printf(seq, "\nIcmpMsg:");
8957 -- for (j = 0; j < PERLINE; ++j)
8958 -- seq_printf(seq, " %sType%u", i & 0x100 ? "Out" : "In",
8959 -- i & 0xff);
8960 -- seq_printf(seq, "\nIcmpMsg: ");
8961 -- for (j = 0; j < PERLINE; ++j)
8962 -- seq_printf(seq, " %lu",
8963 -- snmp_fold_field((void **) net->mib.icmpmsg_statistics,
8964 -- out[j]));
8965 -- seq_putc(seq, '\n');
8966 -- }
8967 -- if (count) {
8968 -- seq_printf(seq, "\nIcmpMsg:");
8969 -- for (j = 0; j < count; ++j)
8970 -- seq_printf(seq, " %sType%u", out[j] & 0x100 ? "Out" :
8971 -- "In", out[j] & 0xff);
8972 -- seq_printf(seq, "\nIcmpMsg:");
8973 -- for (j = 0; j < count; ++j)
8974 -- seq_printf(seq, " %lu", snmp_fold_field((void **)
8975 -- net->mib.icmpmsg_statistics, out[j]));
8976 -+ val = snmp_fold_field((void **) net->mib.icmpmsg_statistics, i);
8977 -+ if (val) {
8978 -+ type[count] = i;
8979 -+ vals[count++] = val;
8980 -+ }
8981 -+ if (count == PERLINE) {
8982 -+ icmpmsg_put_line(seq, vals, type, count);
8983 -+ count = 0;
8984 -+ }
8985 - }
8986 -+ icmpmsg_put_line(seq, vals, type, count);
8987 -
8988 - #undef PERLINE
8989 - }
8990 -diff --git a/scripts/package/builddeb b/scripts/package/builddeb
8991 -index ba6bf5d..1264b8e 100644
8992 ---- a/scripts/package/builddeb
8993 -+++ b/scripts/package/builddeb
8994 -@@ -15,15 +15,18 @@ set -e
8995 - version=$KERNELRELEASE
8996 - revision=`cat .version`
8997 - tmpdir="$objtree/debian/tmp"
8998 -+fwdir="$objtree/debian/fwtmp"
8999 - packagename=linux-$version
9000 -+fwpackagename=linux-firmware-image
9001 -
9002 - if [ "$ARCH" == "um" ] ; then
9003 - packagename=user-mode-linux-$version
9004 - fi
9005 -
9006 - # Setup the directory structure
9007 --rm -rf "$tmpdir"
9008 -+rm -rf "$tmpdir" "$fwdir"
9009 - mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot"
9010 -+mkdir -p "$fwdir/DEBIAN" "$fwdir/lib"
9011 - if [ "$ARCH" == "um" ] ; then
9012 - mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/share/doc/$packagename" "$tmpdir/usr/bin"
9013 - fi
9014 -@@ -107,6 +110,7 @@ Standards-Version: 3.6.1
9015 -
9016 - Package: $packagename
9017 - Provides: kernel-image-$version, linux-image-$version
9018 -+Suggests: $fwpackagename
9019 - Architecture: any
9020 - Description: Linux kernel, version $version
9021 - This package contains the Linux kernel, modules and corresponding other
9022 -@@ -118,8 +122,24 @@ fi
9023 - chown -R root:root "$tmpdir"
9024 - chmod -R go-w "$tmpdir"
9025 -
9026 -+# Do we have firmware? Move it out of the way and build it into a package.
9027 -+if [ -e "$tmpdir/lib/firmware" ]; then
9028 -+ mv "$tmpdir/lib/firmware" "$fwdir/lib/"
9029 -+
9030 -+ cat <<EOF >> debian/control
9031 -+
9032 -+Package: $fwpackagename
9033 -+Architecture: all
9034 -+Description: Linux kernel firmware, version $version
9035 -+ This package contains firmware from the Linux kernel, version $version
9036 -+EOF
9037 -+
9038 -+ dpkg-gencontrol -isp -p$fwpackagename -P"$fwdir"
9039 -+ dpkg --build "$fwdir" ..
9040 -+fi
9041 -+
9042 - # Perform the final magic
9043 --dpkg-gencontrol -isp
9044 -+dpkg-gencontrol -isp -p$packagename
9045 - dpkg --build "$tmpdir" ..
9046 -
9047 - exit 0
9048
9049 Deleted: genpatches-2.6/trunk/2.6.28/1500_inotify-watch-removal-race.patch
9050 ===================================================================
9051 --- genpatches-2.6/trunk/2.6.28/1500_inotify-watch-removal-race.patch 2008-12-05 00:39:44 UTC (rev 1417)
9052 +++ genpatches-2.6/trunk/2.6.28/1500_inotify-watch-removal-race.patch 2008-12-05 00:43:09 UTC (rev 1418)
9053 @@ -1,567 +0,0 @@
9054 -From: Al Viro <viro@×××××××××××××××.uk>
9055 -Date: Sat, 15 Nov 2008 01:15:43 +0000 (+0000)
9056 -Subject: Fix inotify watch removal/umount races
9057 -X-Git-Tag: v2.6.28-rc5~1
9058 -X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=8f7b0ba1c853919b85b54774775f567f30006107
9059 -
9060 -Fix inotify watch removal/umount races
9061 -
9062 -Inotify watch removals suck violently.
9063 -
9064 -To kick the watch out we need (in this order) inode->inotify_mutex and
9065 -ih->mutex. That's fine if we have a hold on inode; however, for all
9066 -other cases we need to make damn sure we don't race with umount. We can
9067 -*NOT* just grab a reference to a watch - inotify_unmount_inodes() will
9068 -happily sail past it and we'll end with reference to inode potentially
9069 -outliving its superblock.
9070 -
9071 -Ideally we just want to grab an active reference to superblock if we
9072 -can; that will make sure we won't go into inotify_umount_inodes() until
9073 -we are done. Cleanup is just deactivate_super().
9074 -
9075 -However, that leaves a messy case - what if we *are* racing with
9076 -umount() and active references to superblock can't be acquired anymore?
9077 -We can bump ->s_count, grab ->s_umount, which will almost certainly wait
9078 -until the superblock is shut down and the watch in question is pining
9079 -for fjords. That's fine, but there is a problem - we might have hit the
9080 -window between ->s_active getting to 0 / ->s_count - below S_BIAS (i.e.
9081 -the moment when superblock is past the point of no return and is heading
9082 -for shutdown) and the moment when deactivate_super() acquires
9083 -->s_umount.
9084 -
9085 -We could just do drop_super() yield() and retry, but that's rather
9086 -antisocial and this stuff is luser-triggerable. OTOH, having grabbed
9087 -->s_umount and having found that we'd got there first (i.e. that
9088 -->s_root is non-NULL) we know that we won't race with
9089 -inotify_umount_inodes().
9090 -
9091 -So we could grab a reference to watch and do the rest as above, just
9092 -with drop_super() instead of deactivate_super(), right? Wrong. We had
9093 -to drop ih->mutex before we could grab ->s_umount. So the watch
9094 -could've been gone already.
9095 -
9096 -That still can be dealt with - we need to save watch->wd, do idr_find()
9097 -and compare its result with our pointer. If they match, we either have
9098 -the damn thing still alive or we'd lost not one but two races at once,
9099 -the watch had been killed and a new one got created with the same ->wd
9100 -at the same address. That couldn't have happened in inotify_destroy(),
9101 -but inotify_rm_wd() could run into that. Still, "new one got created"
9102 -is not a problem - we have every right to kill it or leave it alone,
9103 -whatever's more convenient.
9104 -
9105 -So we can use idr_find(...) == watch && watch->inode->i_sb == sb as
9106 -"grab it and kill it" check. If it's been our original watch, we are
9107 -fine, if it's a newcomer - nevermind, just pretend that we'd won the
9108 -race and kill the fscker anyway; we are safe since we know that its
9109 -superblock won't be going away.
9110 -
9111 -And yes, this is far beyond mere "not very pretty"; so's the entire
9112 -concept of inotify to start with.
9113 -
9114 -Signed-off-by: Al Viro <viro@×××××××××××××××.uk>
9115 -Acked-by: Greg KH <greg@×××××.com>
9116 -Signed-off-by: Linus Torvalds <torvalds@××××××××××××××××.org>
9117 ----
9118 -
9119 -diff --git a/fs/inotify.c b/fs/inotify.c
9120 -index 690e725..7bbed1b 100644
9121 ---- a/fs/inotify.c
9122 -+++ b/fs/inotify.c
9123 -@@ -106,6 +106,20 @@ void get_inotify_watch(struct inotify_watch *watch)
9124 - }
9125 - EXPORT_SYMBOL_GPL(get_inotify_watch);
9126 -
9127 -+int pin_inotify_watch(struct inotify_watch *watch)
9128 -+{
9129 -+ struct super_block *sb = watch->inode->i_sb;
9130 -+ spin_lock(&sb_lock);
9131 -+ if (sb->s_count >= S_BIAS) {
9132 -+ atomic_inc(&sb->s_active);
9133 -+ spin_unlock(&sb_lock);
9134 -+ atomic_inc(&watch->count);
9135 -+ return 1;
9136 -+ }
9137 -+ spin_unlock(&sb_lock);
9138 -+ return 0;
9139 -+}
9140 -+
9141 - /**
9142 - * put_inotify_watch - decrements the ref count on a given watch. cleans up
9143 - * watch references if the count reaches zero. inotify_watch is freed by
9144 -@@ -124,6 +138,13 @@ void put_inotify_watch(struct inotify_watch *watch)
9145 - }
9146 - EXPORT_SYMBOL_GPL(put_inotify_watch);
9147 -
9148 -+void unpin_inotify_watch(struct inotify_watch *watch)
9149 -+{
9150 -+ struct super_block *sb = watch->inode->i_sb;
9151 -+ put_inotify_watch(watch);
9152 -+ deactivate_super(sb);
9153 -+}
9154 -+
9155 - /*
9156 - * inotify_handle_get_wd - returns the next WD for use by the given handle
9157 - *
9158 -@@ -479,6 +500,112 @@ void inotify_init_watch(struct inotify_watch *watch)
9159 - }
9160 - EXPORT_SYMBOL_GPL(inotify_init_watch);
9161 -
9162 -+/*
9163 -+ * Watch removals suck violently. To kick the watch out we need (in this
9164 -+ * order) inode->inotify_mutex and ih->mutex. That's fine if we have
9165 -+ * a hold on inode; however, for all other cases we need to make damn sure
9166 -+ * we don't race with umount. We can *NOT* just grab a reference to a
9167 -+ * watch - inotify_unmount_inodes() will happily sail past it and we'll end
9168 -+ * with reference to inode potentially outliving its superblock. Ideally
9169 -+ * we just want to grab an active reference to superblock if we can; that
9170 -+ * will make sure we won't go into inotify_umount_inodes() until we are
9171 -+ * done. Cleanup is just deactivate_super(). However, that leaves a messy
9172 -+ * case - what if we *are* racing with umount() and active references to
9173 -+ * superblock can't be acquired anymore? We can bump ->s_count, grab
9174 -+ * ->s_umount, which will almost certainly wait until the superblock is shut
9175 -+ * down and the watch in question is pining for fjords. That's fine, but
9176 -+ * there is a problem - we might have hit the window between ->s_active
9177 -+ * getting to 0 / ->s_count - below S_BIAS (i.e. the moment when superblock
9178 -+ * is past the point of no return and is heading for shutdown) and the
9179 -+ * moment when deactivate_super() acquires ->s_umount. We could just do
9180 -+ * drop_super() yield() and retry, but that's rather antisocial and this
9181 -+ * stuff is luser-triggerable. OTOH, having grabbed ->s_umount and having
9182 -+ * found that we'd got there first (i.e. that ->s_root is non-NULL) we know
9183 -+ * that we won't race with inotify_umount_inodes(). So we could grab a
9184 -+ * reference to watch and do the rest as above, just with drop_super() instead
9185 -+ * of deactivate_super(), right? Wrong. We had to drop ih->mutex before we
9186 -+ * could grab ->s_umount. So the watch could've been gone already.
9187 -+ *
9188 -+ * That still can be dealt with - we need to save watch->wd, do idr_find()
9189 -+ * and compare its result with our pointer. If they match, we either have
9190 -+ * the damn thing still alive or we'd lost not one but two races at once,
9191 -+ * the watch had been killed and a new one got created with the same ->wd
9192 -+ * at the same address. That couldn't have happened in inotify_destroy(),
9193 -+ * but inotify_rm_wd() could run into that. Still, "new one got created"
9194 -+ * is not a problem - we have every right to kill it or leave it alone,
9195 -+ * whatever's more convenient.
9196 -+ *
9197 -+ * So we can use idr_find(...) == watch && watch->inode->i_sb == sb as
9198 -+ * "grab it and kill it" check. If it's been our original watch, we are
9199 -+ * fine, if it's a newcomer - nevermind, just pretend that we'd won the
9200 -+ * race and kill the fscker anyway; we are safe since we know that its
9201 -+ * superblock won't be going away.
9202 -+ *
9203 -+ * And yes, this is far beyond mere "not very pretty"; so's the entire
9204 -+ * concept of inotify to start with.
9205 -+ */
9206 -+
9207 -+/**
9208 -+ * pin_to_kill - pin the watch down for removal
9209 -+ * @ih: inotify handle
9210 -+ * @watch: watch to kill
9211 -+ *
9212 -+ * Called with ih->mutex held, drops it. Possible return values:
9213 -+ * 0 - nothing to do, it has died
9214 -+ * 1 - remove it, drop the reference and deactivate_super()
9215 -+ * 2 - remove it, drop the reference and drop_super(); we tried hard to avoid
9216 -+ * that variant, since it involved a lot of PITA, but that's the best that
9217 -+ * could've been done.
9218 -+ */
9219 -+static int pin_to_kill(struct inotify_handle *ih, struct inotify_watch *watch)
9220 -+{
9221 -+ struct super_block *sb = watch->inode->i_sb;
9222 -+ s32 wd = watch->wd;
9223 -+
9224 -+ spin_lock(&sb_lock);
9225 -+ if (sb->s_count >= S_BIAS) {
9226 -+ atomic_inc(&sb->s_active);
9227 -+ spin_unlock(&sb_lock);
9228 -+ get_inotify_watch(watch);
9229 -+ mutex_unlock(&ih->mutex);
9230 -+ return 1; /* the best outcome */
9231 -+ }
9232 -+ sb->s_count++;
9233 -+ spin_unlock(&sb_lock);
9234 -+ mutex_unlock(&ih->mutex); /* can't grab ->s_umount under it */
9235 -+ down_read(&sb->s_umount);
9236 -+ if (likely(!sb->s_root)) {
9237 -+ /* fs is already shut down; the watch is dead */
9238 -+ drop_super(sb);
9239 -+ return 0;
9240 -+ }
9241 -+ /* raced with the final deactivate_super() */
9242 -+ mutex_lock(&ih->mutex);
9243 -+ if (idr_find(&ih->idr, wd) != watch || watch->inode->i_sb != sb) {
9244 -+ /* the watch is dead */
9245 -+ mutex_unlock(&ih->mutex);
9246 -+ drop_super(sb);
9247 -+ return 0;
9248 -+ }
9249 -+ /* still alive or freed and reused with the same sb and wd; kill */
9250 -+ get_inotify_watch(watch);
9251 -+ mutex_unlock(&ih->mutex);
9252 -+ return 2;
9253 -+}
9254 -+
9255 -+static void unpin_and_kill(struct inotify_watch *watch, int how)
9256 -+{
9257 -+ struct super_block *sb = watch->inode->i_sb;
9258 -+ put_inotify_watch(watch);
9259 -+ switch (how) {
9260 -+ case 1:
9261 -+ deactivate_super(sb);
9262 -+ break;
9263 -+ case 2:
9264 -+ drop_super(sb);
9265 -+ }
9266 -+}
9267 -+
9268 - /**
9269 - * inotify_destroy - clean up and destroy an inotify instance
9270 - * @ih: inotify handle
9271 -@@ -490,11 +617,15 @@ void inotify_destroy(struct inotify_handle *ih)
9272 - * pretty. We cannot do a simple iteration over the list, because we
9273 - * do not know the inode until we iterate to the watch. But we need to
9274 - * hold inode->inotify_mutex before ih->mutex. The following works.
9275 -+ *
9276 -+ * AV: it had to become even uglier to start working ;-/
9277 - */
9278 - while (1) {
9279 - struct inotify_watch *watch;
9280 - struct list_head *watches;
9281 -+ struct super_block *sb;
9282 - struct inode *inode;
9283 -+ int how;
9284 -
9285 - mutex_lock(&ih->mutex);
9286 - watches = &ih->watches;
9287 -@@ -503,8 +634,10 @@ void inotify_destroy(struct inotify_handle *ih)
9288 - break;
9289 - }
9290 - watch = list_first_entry(watches, struct inotify_watch, h_list);
9291 -- get_inotify_watch(watch);
9292 -- mutex_unlock(&ih->mutex);
9293 -+ sb = watch->inode->i_sb;
9294 -+ how = pin_to_kill(ih, watch);
9295 -+ if (!how)
9296 -+ continue;
9297 -
9298 - inode = watch->inode;
9299 - mutex_lock(&inode->inotify_mutex);
9300 -@@ -518,7 +651,7 @@ void inotify_destroy(struct inotify_handle *ih)
9301 -
9302 - mutex_unlock(&ih->mutex);
9303 - mutex_unlock(&inode->inotify_mutex);
9304 -- put_inotify_watch(watch);
9305 -+ unpin_and_kill(watch, how);
9306 - }
9307 -
9308 - /* free this handle: the put matching the get in inotify_init() */
9309 -@@ -719,7 +852,9 @@ void inotify_evict_watch(struct inotify_watch *watch)
9310 - int inotify_rm_wd(struct inotify_handle *ih, u32 wd)
9311 - {
9312 - struct inotify_watch *watch;
9313 -+ struct super_block *sb;
9314 - struct inode *inode;
9315 -+ int how;
9316 -
9317 - mutex_lock(&ih->mutex);
9318 - watch = idr_find(&ih->idr, wd);
9319 -@@ -727,9 +862,12 @@ int inotify_rm_wd(struct inotify_handle *ih, u32 wd)
9320 - mutex_unlock(&ih->mutex);
9321 - return -EINVAL;
9322 - }
9323 -- get_inotify_watch(watch);
9324 -+ sb = watch->inode->i_sb;
9325 -+ how = pin_to_kill(ih, watch);
9326 -+ if (!how)
9327 -+ return 0;
9328 -+
9329 - inode = watch->inode;
9330 -- mutex_unlock(&ih->mutex);
9331 -
9332 - mutex_lock(&inode->inotify_mutex);
9333 - mutex_lock(&ih->mutex);
9334 -@@ -740,7 +878,7 @@ int inotify_rm_wd(struct inotify_handle *ih, u32 wd)
9335 -
9336 - mutex_unlock(&ih->mutex);
9337 - mutex_unlock(&inode->inotify_mutex);
9338 -- put_inotify_watch(watch);
9339 -+ unpin_and_kill(watch, how);
9340 -
9341 - return 0;
9342 - }
9343 -diff --git a/include/linux/inotify.h b/include/linux/inotify.h
9344 -index bd57857..37ea289 100644
9345 ---- a/include/linux/inotify.h
9346 -+++ b/include/linux/inotify.h
9347 -@@ -134,6 +134,8 @@ extern void inotify_remove_watch_locked(struct inotify_handle *,
9348 - struct inotify_watch *);
9349 - extern void get_inotify_watch(struct inotify_watch *);
9350 - extern void put_inotify_watch(struct inotify_watch *);
9351 -+extern int pin_inotify_watch(struct inotify_watch *);
9352 -+extern void unpin_inotify_watch(struct inotify_watch *);
9353 -
9354 - #else
9355 -
9356 -@@ -228,6 +230,15 @@ static inline void put_inotify_watch(struct inotify_watch *watch)
9357 - {
9358 - }
9359 -
9360 -+extern inline int pin_inotify_watch(struct inotify_watch *watch)
9361 -+{
9362 -+ return 0;
9363 -+}
9364 -+
9365 -+extern inline void unpin_inotify_watch(struct inotify_watch *watch)
9366 -+{
9367 -+}
9368 -+
9369 - #endif /* CONFIG_INOTIFY */
9370 -
9371 - #endif /* __KERNEL __ */
9372 -diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c
9373 -index 8ba0e0d..8b50944 100644
9374 ---- a/kernel/audit_tree.c
9375 -+++ b/kernel/audit_tree.c
9376 -@@ -24,6 +24,7 @@ struct audit_chunk {
9377 - struct list_head trees; /* with root here */
9378 - int dead;
9379 - int count;
9380 -+ atomic_long_t refs;
9381 - struct rcu_head head;
9382 - struct node {
9383 - struct list_head list;
9384 -@@ -56,7 +57,8 @@ static LIST_HEAD(prune_list);
9385 - * tree is refcounted; one reference for "some rules on rules_list refer to
9386 - * it", one for each chunk with pointer to it.
9387 - *
9388 -- * chunk is refcounted by embedded inotify_watch.
9389 -+ * chunk is refcounted by embedded inotify_watch + .refs (non-zero refcount
9390 -+ * of watch contributes 1 to .refs).
9391 - *
9392 - * node.index allows to get from node.list to containing chunk.
9393 - * MSB of that sucker is stolen to mark taggings that we might have to
9394 -@@ -121,6 +123,7 @@ static struct audit_chunk *alloc_chunk(int count)
9395 - INIT_LIST_HEAD(&chunk->hash);
9396 - INIT_LIST_HEAD(&chunk->trees);
9397 - chunk->count = count;
9398 -+ atomic_long_set(&chunk->refs, 1);
9399 - for (i = 0; i < count; i++) {
9400 - INIT_LIST_HEAD(&chunk->owners[i].list);
9401 - chunk->owners[i].index = i;
9402 -@@ -129,9 +132,8 @@ static struct audit_chunk *alloc_chunk(int count)
9403 - return chunk;
9404 - }
9405 -
9406 --static void __free_chunk(struct rcu_head *rcu)
9407 -+static void free_chunk(struct audit_chunk *chunk)
9408 - {
9409 -- struct audit_chunk *chunk = container_of(rcu, struct audit_chunk, head);
9410 - int i;
9411 -
9412 - for (i = 0; i < chunk->count; i++) {
9413 -@@ -141,14 +143,16 @@ static void __free_chunk(struct rcu_head *rcu)
9414 - kfree(chunk);
9415 - }
9416 -
9417 --static inline void free_chunk(struct audit_chunk *chunk)
9418 -+void audit_put_chunk(struct audit_chunk *chunk)
9419 - {
9420 -- call_rcu(&chunk->head, __free_chunk);
9421 -+ if (atomic_long_dec_and_test(&chunk->refs))
9422 -+ free_chunk(chunk);
9423 - }
9424 -
9425 --void audit_put_chunk(struct audit_chunk *chunk)
9426 -+static void __put_chunk(struct rcu_head *rcu)
9427 - {
9428 -- put_inotify_watch(&chunk->watch);
9429 -+ struct audit_chunk *chunk = container_of(rcu, struct audit_chunk, head);
9430 -+ audit_put_chunk(chunk);
9431 - }
9432 -
9433 - enum {HASH_SIZE = 128};
9434 -@@ -176,7 +180,7 @@ struct audit_chunk *audit_tree_lookup(const struct inode *inode)
9435 -
9436 - list_for_each_entry_rcu(p, list, hash) {
9437 - if (p->watch.inode == inode) {
9438 -- get_inotify_watch(&p->watch);
9439 -+ atomic_long_inc(&p->refs);
9440 - return p;
9441 - }
9442 - }
9443 -@@ -194,17 +198,49 @@ int audit_tree_match(struct audit_chunk *chunk, struct audit_tree *tree)
9444 -
9445 - /* tagging and untagging inodes with trees */
9446 -
9447 --static void untag_chunk(struct audit_chunk *chunk, struct node *p)
9448 -+static struct audit_chunk *find_chunk(struct node *p)
9449 -+{
9450 -+ int index = p->index & ~(1U<<31);
9451 -+ p -= index;
9452 -+ return container_of(p, struct audit_chunk, owners[0]);
9453 -+}
9454 -+
9455 -+static void untag_chunk(struct node *p)
9456 - {
9457 -+ struct audit_chunk *chunk = find_chunk(p);
9458 - struct audit_chunk *new;
9459 - struct audit_tree *owner;
9460 - int size = chunk->count - 1;
9461 - int i, j;
9462 -
9463 -+ if (!pin_inotify_watch(&chunk->watch)) {
9464 -+ /*
9465 -+ * Filesystem is shutting down; all watches are getting
9466 -+ * evicted, just take it off the node list for this
9467 -+ * tree and let the eviction logics take care of the
9468 -+ * rest.
9469 -+ */
9470 -+ owner = p->owner;
9471 -+ if (owner->root == chunk) {
9472 -+ list_del_init(&owner->same_root);
9473 -+ owner->root = NULL;
9474 -+ }
9475 -+ list_del_init(&p->list);
9476 -+ p->owner = NULL;
9477 -+ put_tree(owner);
9478 -+ return;
9479 -+ }
9480 -+
9481 -+ spin_unlock(&hash_lock);
9482 -+
9483 -+ /*
9484 -+ * pin_inotify_watch() succeeded, so the watch won't go away
9485 -+ * from under us.
9486 -+ */
9487 - mutex_lock(&chunk->watch.inode->inotify_mutex);
9488 - if (chunk->dead) {
9489 - mutex_unlock(&chunk->watch.inode->inotify_mutex);
9490 -- return;
9491 -+ goto out;
9492 - }
9493 -
9494 - owner = p->owner;
9495 -@@ -221,7 +257,7 @@ static void untag_chunk(struct audit_chunk *chunk, struct node *p)
9496 - inotify_evict_watch(&chunk->watch);
9497 - mutex_unlock(&chunk->watch.inode->inotify_mutex);
9498 - put_inotify_watch(&chunk->watch);
9499 -- return;
9500 -+ goto out;
9501 - }
9502 -
9503 - new = alloc_chunk(size);
9504 -@@ -263,7 +299,7 @@ static void untag_chunk(struct audit_chunk *chunk, struct node *p)
9505 - inotify_evict_watch(&chunk->watch);
9506 - mutex_unlock(&chunk->watch.inode->inotify_mutex);
9507 - put_inotify_watch(&chunk->watch);
9508 -- return;
9509 -+ goto out;
9510 -
9511 - Fallback:
9512 - // do the best we can
9513 -@@ -277,6 +313,9 @@ Fallback:
9514 - put_tree(owner);
9515 - spin_unlock(&hash_lock);
9516 - mutex_unlock(&chunk->watch.inode->inotify_mutex);
9517 -+out:
9518 -+ unpin_inotify_watch(&chunk->watch);
9519 -+ spin_lock(&hash_lock);
9520 - }
9521 -
9522 - static int create_chunk(struct inode *inode, struct audit_tree *tree)
9523 -@@ -387,13 +426,6 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
9524 - return 0;
9525 - }
9526 -
9527 --static struct audit_chunk *find_chunk(struct node *p)
9528 --{
9529 -- int index = p->index & ~(1U<<31);
9530 -- p -= index;
9531 -- return container_of(p, struct audit_chunk, owners[0]);
9532 --}
9533 --
9534 - static void kill_rules(struct audit_tree *tree)
9535 - {
9536 - struct audit_krule *rule, *next;
9537 -@@ -431,17 +463,10 @@ static void prune_one(struct audit_tree *victim)
9538 - spin_lock(&hash_lock);
9539 - while (!list_empty(&victim->chunks)) {
9540 - struct node *p;
9541 -- struct audit_chunk *chunk;
9542 -
9543 - p = list_entry(victim->chunks.next, struct node, list);
9544 -- chunk = find_chunk(p);
9545 -- get_inotify_watch(&chunk->watch);
9546 -- spin_unlock(&hash_lock);
9547 --
9548 -- untag_chunk(chunk, p);
9549 -
9550 -- put_inotify_watch(&chunk->watch);
9551 -- spin_lock(&hash_lock);
9552 -+ untag_chunk(p);
9553 - }
9554 - spin_unlock(&hash_lock);
9555 - put_tree(victim);
9556 -@@ -469,7 +494,6 @@ static void trim_marked(struct audit_tree *tree)
9557 -
9558 - while (!list_empty(&tree->chunks)) {
9559 - struct node *node;
9560 -- struct audit_chunk *chunk;
9561 -
9562 - node = list_entry(tree->chunks.next, struct node, list);
9563 -
9564 -@@ -477,14 +501,7 @@ static void trim_marked(struct audit_tree *tree)
9565 - if (!(node->index & (1U<<31)))
9566 - break;
9567 -
9568 -- chunk = find_chunk(node);
9569 -- get_inotify_watch(&chunk->watch);
9570 -- spin_unlock(&hash_lock);
9571 --
9572 -- untag_chunk(chunk, node);
9573 --
9574 -- put_inotify_watch(&chunk->watch);
9575 -- spin_lock(&hash_lock);
9576 -+ untag_chunk(node);
9577 - }
9578 - if (!tree->root && !tree->goner) {
9579 - tree->goner = 1;
9580 -@@ -878,7 +895,7 @@ static void handle_event(struct inotify_watch *watch, u32 wd, u32 mask,
9581 - static void destroy_watch(struct inotify_watch *watch)
9582 - {
9583 - struct audit_chunk *chunk = container_of(watch, struct audit_chunk, watch);
9584 -- free_chunk(chunk);
9585 -+ call_rcu(&chunk->head, __put_chunk);
9586 - }
9587 -
9588 - static const struct inotify_operations rtree_inotify_ops = {
9589 -diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
9590 -index b7d354e..9fd85a4 100644
9591 ---- a/kernel/auditfilter.c
9592 -+++ b/kernel/auditfilter.c
9593 -@@ -1094,8 +1094,8 @@ static void audit_inotify_unregister(struct list_head *in_list)
9594 - list_for_each_entry_safe(p, n, in_list, ilist) {
9595 - list_del(&p->ilist);
9596 - inotify_rm_watch(audit_ih, &p->wdata);
9597 -- /* the put matching the get in audit_do_del_rule() */
9598 -- put_inotify_watch(&p->wdata);
9599 -+ /* the unpin matching the pin in audit_do_del_rule() */
9600 -+ unpin_inotify_watch(&p->wdata);
9601 - }
9602 - }
9603 -
9604 -@@ -1389,9 +1389,13 @@ static inline int audit_del_rule(struct audit_entry *entry,
9605 - /* Put parent on the inotify un-registration
9606 - * list. Grab a reference before releasing
9607 - * audit_filter_mutex, to be released in
9608 -- * audit_inotify_unregister(). */
9609 -- list_add(&parent->ilist, &inotify_list);
9610 -- get_inotify_watch(&parent->wdata);
9611 -+ * audit_inotify_unregister().
9612 -+ * If filesystem is going away, just leave
9613 -+ * the sucker alone, eviction will take
9614 -+ * care of it.
9615 -+ */
9616 -+ if (pin_inotify_watch(&parent->wdata))
9617 -+ list_add(&parent->ilist, &inotify_list);
9618 - }
9619 - }
9620 - }
9621
9622 Deleted: genpatches-2.6/trunk/2.6.28/1700_HP-laptop-dmi-quirk-fix.patch
9623 ===================================================================
9624 --- genpatches-2.6/trunk/2.6.28/1700_HP-laptop-dmi-quirk-fix.patch 2008-12-05 00:39:44 UTC (rev 1417)
9625 +++ genpatches-2.6/trunk/2.6.28/1700_HP-laptop-dmi-quirk-fix.patch 2008-12-05 00:43:09 UTC (rev 1418)
9626 @@ -1,66 +0,0 @@
9627 -From: Andreas Herrmann <andreas.herrmann3@×××.com>
9628 -Date: Wed, 22 Oct 2008 11:08:31 +0000 (+0200)
9629 -Subject: x86: call dmi-quirks for HP Laptops after early-quirks are executed
9630 -X-Git-Tag: v2.6.28-rc1~12^2~12
9631 -X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=35af28219e684a36cc8b1ff456c370ce22be157d
9632 -
9633 -x86: call dmi-quirks for HP Laptops after early-quirks are executed
9634 -
9635 -Impact: make warning message disappear - functionality unchanged
9636 -
9637 -Problems with bogus IRQ0 override of those laptops should be fixed
9638 -with commits
9639 -
9640 -x86: SB600: skip IRQ0 override if it is not routed to INT2 of IOAPIC
9641 -x86: SB450: skip IRQ0 override if it is not routed to INT2 of IOAPIC
9642 -
9643 -that introduce early-quirks based on chipset configuration.
9644 -
9645 -For further information, see
9646 -http://bugzilla.kernel.org/show_bug.cgi?id=11516
9647 -
9648 -Instead of removing the related dmi-quirks completely we'd like to
9649 -keep them for (at least) one kernel version -- to double-check whether
9650 -the early-quirks really took effect. But the dmi-quirks need to be
9651 -called after early-quirks are executed. With this patch calling
9652 -sequence for dmi-quriks is changed as follows:
9653 -
9654 - acpi_boot_table_init() (dmi-quirks)
9655 - ...
9656 - early_quirks() (detect bogus IRQ0 override)
9657 - ...
9658 - acpi_boot_init() (late dmi-quirks and setup IO APIC)
9659 -
9660 -Note: Plan is to remove the "late dmi-quirks" with next kernel version.
9661 -
9662 -Signed-off-by: Andreas Herrmann <andreas.herrmann3@×××.com>
9663 -Signed-off-by: Ingo Molnar <mingo@××××.hu>
9664 ----
9665 -
9666 -diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
9667 -index 0d1c26a..8072edb 100644
9668 ---- a/arch/x86/kernel/acpi/boot.c
9669 -+++ b/arch/x86/kernel/acpi/boot.c
9670 -@@ -1598,6 +1598,11 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
9671 - DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 360"),
9672 - },
9673 - },
9674 -+ {}
9675 -+};
9676 -+
9677 -+/* second table for DMI checks that should run after early-quirks */
9678 -+static struct dmi_system_id __initdata acpi_dmi_table_late[] = {
9679 - /*
9680 - * HP laptops which use a DSDT reporting as HP/SB400/10000,
9681 - * which includes some code which overrides all temperature
9682 -@@ -1726,6 +1731,9 @@ int __init early_acpi_boot_init(void)
9683 -
9684 - int __init acpi_boot_init(void)
9685 - {
9686 -+ /* those are executed after early-quirks are executed */
9687 -+ dmi_check_system(acpi_dmi_table_late);
9688 -+
9689 - /*
9690 - * If acpi_disabled, bail out
9691 - * One exception: acpi=ht continues far enough to enumerate LAPICs
9692 -
9693
9694 Deleted: genpatches-2.6/trunk/2.6.28/2001_setkey-policy-breakage-fix.patch
9695 ===================================================================
9696 --- genpatches-2.6/trunk/2.6.28/2001_setkey-policy-breakage-fix.patch 2008-12-05 00:39:44 UTC (rev 1417)
9697 +++ genpatches-2.6/trunk/2.6.28/2001_setkey-policy-breakage-fix.patch 2008-12-05 00:43:09 UTC (rev 1418)
9698 @@ -1,45 +0,0 @@
9699 -From: Alexey Dobriyan <adobriyan@×××××.com>
9700 -Date: Fri, 31 Oct 2008 23:41:26 +0000 (-0700)
9701 -Subject: key: fix setkey(8) policy set breakage
9702 -X-Git-Tag: v2.6.28-rc3~3^2~4
9703 -X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=920da6923cf03c8a78fbaffa408f8ab37f6abfc1
9704 -
9705 -key: fix setkey(8) policy set breakage
9706 -
9707 -Steps to reproduce:
9708 -
9709 - #/usr/sbin/setkey -f
9710 - flush;
9711 - spdflush;
9712 -
9713 - add 192.168.0.42 192.168.0.1 ah 24500 -A hmac-md5 "1234567890123456";
9714 - add 192.168.0.42 192.168.0.1 esp 24501 -E 3des-cbc "123456789012123456789012";
9715 -
9716 - spdadd 192.168.0.42 192.168.0.1 any -P out ipsec
9717 - esp/transport//require
9718 - ah/transport//require;
9719 -
9720 -setkey: invalid keymsg length
9721 -
9722 -Policy dump will bail out with the same message after that.
9723 -
9724 --recv(4, "\2\16\0\0\32\0\3\0\0\0\0\0\37\r\0\0\3\0\5\0\377 \0\0\2\0\0\0\300\250\0*\0"..., 32768, 0) = 208
9725 -+recv(4, "\2\16\0\0\36\0\3\0\0\0\0\0H\t\0\0\3\0\5\0\377 \0\0\2\0\0\0\300\250\0*\0"..., 32768, 0) = 208
9726 -
9727 -Signed-off-by: Alexey Dobriyan <adobriyan@×××××.com>
9728 -Signed-off-by: David S. Miller <davem@×××××××××.net>
9729 ----
9730 -
9731 -diff --git a/net/key/af_key.c b/net/key/af_key.c
9732 -index e55e044..3440a46 100644
9733 ---- a/net/key/af_key.c
9734 -+++ b/net/key/af_key.c
9735 -@@ -2075,7 +2075,6 @@ static int pfkey_xfrm_policy2msg(struct sk_buff *skb, struct xfrm_policy *xp, in
9736 - req_size += socklen * 2;
9737 - } else {
9738 - size -= 2*socklen;
9739 -- socklen = 0;
9740 - }
9741 - rq = (void*)skb_put(skb, req_size);
9742 - pol->sadb_x_policy_len += req_size/8;
9743 -
9744
9745 Deleted: genpatches-2.6/trunk/2.6.28/2200_sb600-acpi-irq0-override.patch
9746 ===================================================================
9747 --- genpatches-2.6/trunk/2.6.28/2200_sb600-acpi-irq0-override.patch 2008-12-05 00:39:44 UTC (rev 1417)
9748 +++ genpatches-2.6/trunk/2.6.28/2200_sb600-acpi-irq0-override.patch 2008-12-05 00:43:09 UTC (rev 1418)
9749 @@ -1,112 +0,0 @@
9750 -From: Andreas Herrmann <andreas.herrmann3@×××.com>
9751 -Date: Tue, 14 Oct 2008 19:01:15 +0000 (+0200)
9752 -Subject: x86: SB600: skip ACPI IRQ0 override if it is not routed to INT2 of IOAPIC
9753 -X-Git-Tag: v2.6.28-rc1~26^2~2^2
9754 -X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=26adcfbf00e0726b4469070aa2f530dcf963f484
9755 -
9756 -x86: SB600: skip ACPI IRQ0 override if it is not routed to INT2 of IOAPIC
9757 -
9758 -On some more HP laptops BIOS reports an IRQ0 override
9759 -but the SB600 chipset is configured such that timer
9760 -interrupts go to INT0 of IOAPIC.
9761 -
9762 -Check IRQ0 routing and if it is routed to INT0 of IOAPIC skip the
9763 -timer override.
9764 -
9765 -http://bugzilla.kernel.org/show_bug.cgi?id=11715
9766 -http://bugzilla.kernel.org/show_bug.cgi?id=11516
9767 -
9768 -Signed-off-by: Andreas Herrmann <andreas.herrmann3@×××.com>
9769 -Signed-off-by: Len Brown <len.brown@×××××.com>
9770 -[dsd@g.o: rediff for 2.6.27]
9771 ----
9772 -
9773 -Index: linux-2.6.27-gentoo-r4/arch/x86/kernel/early-quirks.c
9774 -===================================================================
9775 ---- linux-2.6.27-gentoo-r4.orig/arch/x86/kernel/early-quirks.c
9776 -+++ linux-2.6.27-gentoo-r4/arch/x86/kernel/early-quirks.c
9777 -@@ -95,7 +95,8 @@ static void __init nvidia_bugs(int num,
9778 -
9779 - }
9780 -
9781 --static u32 ati_ixp4x0_rev(int num, int slot, int func)
9782 -+#if defined(CONFIG_ACPI) && defined(CONFIG_X86_IO_APIC)
9783 -+static u32 __init ati_ixp4x0_rev(int num, int slot, int func)
9784 - {
9785 - u32 d;
9786 - u8 b;
9787 -@@ -115,7 +116,6 @@ static u32 ati_ixp4x0_rev(int num, int s
9788 -
9789 - static void __init ati_bugs(int num, int slot, int func)
9790 - {
9791 --#if defined(CONFIG_ACPI) && defined (CONFIG_X86_IO_APIC)
9792 - u32 d;
9793 - u8 b;
9794 -
9795 -@@ -138,9 +138,56 @@ static void __init ati_bugs(int num, int
9796 - printk(KERN_INFO "If you got timer trouble "
9797 - "try acpi_use_timer_override\n");
9798 - }
9799 --#endif
9800 - }
9801 -
9802 -+static u32 __init ati_sbx00_rev(int num, int slot, int func)
9803 -+{
9804 -+ u32 old, d;
9805 -+
9806 -+ d = read_pci_config(num, slot, func, 0x70);
9807 -+ old = d;
9808 -+ d &= ~(1<<8);
9809 -+ write_pci_config(num, slot, func, 0x70, d);
9810 -+ d = read_pci_config(num, slot, func, 0x8);
9811 -+ d &= 0xff;
9812 -+ write_pci_config(num, slot, func, 0x70, old);
9813 -+
9814 -+ return d;
9815 -+}
9816 -+
9817 -+static void __init ati_bugs_contd(int num, int slot, int func)
9818 -+{
9819 -+ u32 d, rev;
9820 -+
9821 -+ if (acpi_use_timer_override)
9822 -+ return;
9823 -+
9824 -+ rev = ati_sbx00_rev(num, slot, func);
9825 -+ if (rev > 0x13)
9826 -+ return;
9827 -+
9828 -+ /* check for IRQ0 interrupt swap */
9829 -+ d = read_pci_config(num, slot, func, 0x64);
9830 -+ if (!(d & (1<<14)))
9831 -+ acpi_skip_timer_override = 1;
9832 -+
9833 -+ if (acpi_skip_timer_override) {
9834 -+ printk(KERN_INFO "SB600 revision 0x%x\n", rev);
9835 -+ printk(KERN_INFO "Ignoring ACPI timer override.\n");
9836 -+ printk(KERN_INFO "If you got timer trouble "
9837 -+ "try acpi_use_timer_override\n");
9838 -+ }
9839 -+}
9840 -+#else
9841 -+static void __init ati_bugs(int num, int slot, int func)
9842 -+{
9843 -+}
9844 -+
9845 -+static void __init ati_bugs_contd(int num, int slot, int func)
9846 -+{
9847 -+}
9848 -+#endif
9849 -+
9850 - #define QFLAG_APPLY_ONCE 0x1
9851 - #define QFLAG_APPLIED 0x2
9852 - #define QFLAG_DONE (QFLAG_APPLY_ONCE|QFLAG_APPLIED)
9853 -@@ -162,6 +209,8 @@ static struct chipset early_qrk[] __init
9854 - PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, fix_hypertransport_config },
9855 - { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_SMBUS,
9856 - PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs },
9857 -+ { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS,
9858 -+ PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs_contd },
9859 - {}
9860 - };
9861 -