Gentoo Archives: gentoo-commits

From: "Mike Pagano (mpagano)" <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] linux-patches r1487 - genpatches-2.6/trunk/2.6.28
Date: Sun, 25 Jan 2009 15:38:11
Message-Id: E1LR73l-0002oS-6h@stork.gentoo.org
1 Author: mpagano
2 Date: 2009-01-25 15:38:04 +0000 (Sun, 25 Jan 2009)
3 New Revision: 1487
4
5 Added:
6 genpatches-2.6/trunk/2.6.28/1001_linux-2.6.28.2.patch
7 Removed:
8 genpatches-2.6/trunk/2.6.28/2000_sctp-fwd-tsn-overflow.patch
9 genpatches-2.6/trunk/2.6.28/2300_usb-reenable-interface.patch
10 genpatches-2.6/trunk/2.6.28/2515_nokia-6300-wrong-capacity.patch
11 genpatches-2.6/trunk/2.6.28/2700_hda-asus-mic-input.patch
12 Modified:
13 genpatches-2.6/trunk/2.6.28/0000_README
14 Log:
15 Linux patch 2.6.28.2 and the removal of redundant and uncessary patches.
16
17 Modified: genpatches-2.6/trunk/2.6.28/0000_README
18 ===================================================================
19 --- genpatches-2.6/trunk/2.6.28/0000_README 2009-01-25 09:03:04 UTC (rev 1486)
20 +++ genpatches-2.6/trunk/2.6.28/0000_README 2009-01-25 15:38:04 UTC (rev 1487)
21 @@ -43,18 +43,14 @@
22 From: http://www.kernel.org
23 Desc: Linux 2.6.28.1
24
25 +Patch: 1001_linux-2.6.28.2.patch
26 +From: http://www.kernel.org
27 +Desc: Linux 2.6.28.2
28 +
29 Patch: 1725_alpha-srm-compile-failure.patch
30 From: http://bugs.gentoo.org/254150
31 Desc: Fix irq_srm compile failure on some Alpha platforms
32
33 -Patch: 2000_sctp-fwd-tsn-overflow.patch
34 -From: http://bugs.gentoo.org/254907
35 -Desc: Fix possible memory overflow with SCTP networking
36 -
37 -Patch: 2300_usb-reenable-interface.patch
38 -From: http://bugs.gentoo.org/252997
39 -Desc: Fix reuse of USB interfaces from userspace
40 -
41 Patch: 2305_uninline-pci-ioremap-bar.patch
42 From: http://bugs.gentoo.org/252488
43 Desc: Move some PCI code around to fix compilation on alpha
44 @@ -71,14 +67,6 @@
45 From: http://bugs.gentoo.org/254793
46 Desc: Fix boot hang with pata_hpt366 driver
47
48 -Patch: 2515_nokia-6300-wrong-capacity.patch
49 -From: http://bugs.gentoo.org/254034
50 -Desc: Fix capacity reported by Nokia 6300 phone
51 -
52 -Patch: 2700_hda-asus-mic-input.patch
53 -From: http://bugs.gentoo.org/235732
54 -Desc: Fix microphone input regression on Asus laptops
55 -
56 Patch: 2705_i915-no-vblank-on-disabled-pipe.patch
57 From: http://bugs.gentoo.org/253813
58 Desc: Fix crash with GEM + compiz
59
60 Added: genpatches-2.6/trunk/2.6.28/1001_linux-2.6.28.2.patch
61 ===================================================================
62 --- genpatches-2.6/trunk/2.6.28/1001_linux-2.6.28.2.patch (rev 0)
63 +++ genpatches-2.6/trunk/2.6.28/1001_linux-2.6.28.2.patch 2009-01-25 15:38:04 UTC (rev 1487)
64 @@ -0,0 +1,1998 @@
65 +diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt
66 +index 394d7d3..bef6550 100644
67 +--- a/Documentation/sound/alsa/ALSA-Configuration.txt
68 ++++ b/Documentation/sound/alsa/ALSA-Configuration.txt
69 +@@ -979,9 +979,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
70 + 6stack 6-jack, separate surrounds (default)
71 + 3stack 3-stack, shared surrounds
72 + laptop 2-channel only (FSC V2060, Samsung M50)
73 +- laptop-eapd 2-channel with EAPD (Samsung R65, ASUS A6J)
74 ++ laptop-eapd 2-channel with EAPD (ASUS A6J)
75 + laptop-automute 2-channel with EAPD and HP-automute (Lenovo N100)
76 + ultra 2-channel with EAPD (Samsung Ultra tablet PC)
77 ++ samsung 2-channel with EAPD (Samsung R65)
78 +
79 + AD1988/AD1988B/AD1989A/AD1989B
80 + 6stack 6-jack
81 +diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
82 +index 6bd91ed..0429d3e 100644
83 +--- a/arch/ia64/Kconfig
84 ++++ b/arch/ia64/Kconfig
85 +@@ -17,6 +17,7 @@ config IA64
86 + select ACPI if (!IA64_HP_SIM)
87 + select PM if (!IA64_HP_SIM)
88 + select ARCH_SUPPORTS_MSI
89 ++ select HAVE_UNSTABLE_SCHED_CLOCK
90 + select HAVE_IDE
91 + select HAVE_OPROFILE
92 + select HAVE_KPROBES
93 +diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
94 +index db44e02..ba51948 100644
95 +--- a/arch/powerpc/mm/slice.c
96 ++++ b/arch/powerpc/mm/slice.c
97 +@@ -710,9 +710,18 @@ int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr,
98 + unsigned long len)
99 + {
100 + struct slice_mask mask, available;
101 ++ unsigned int psize = mm->context.user_psize;
102 +
103 + mask = slice_range_to_mask(addr, len);
104 +- available = slice_mask_for_size(mm, mm->context.user_psize);
105 ++ available = slice_mask_for_size(mm, psize);
106 ++#ifdef CONFIG_PPC_64K_PAGES
107 ++ /* We need to account for 4k slices too */
108 ++ if (psize == MMU_PAGE_64K) {
109 ++ struct slice_mask compat_mask;
110 ++ compat_mask = slice_mask_for_size(mm, MMU_PAGE_4K);
111 ++ or_mask(available, compat_mask);
112 ++ }
113 ++#endif
114 +
115 + #if 0 /* too verbose */
116 + slice_dbg("is_hugepage_only_range(mm=%p, addr=%lx, len=%lx)\n",
117 +diff --git a/drivers/firmware/dell_rbu.c b/drivers/firmware/dell_rbu.c
118 +index 13946eb..b4704e1 100644
119 +--- a/drivers/firmware/dell_rbu.c
120 ++++ b/drivers/firmware/dell_rbu.c
121 +@@ -576,7 +576,7 @@ static ssize_t read_rbu_image_type(struct kobject *kobj,
122 + {
123 + int size = 0;
124 + if (!pos)
125 +- size = sprintf(buffer, "%s\n", image_type);
126 ++ size = scnprintf(buffer, count, "%s\n", image_type);
127 + return size;
128 + }
129 +
130 +@@ -648,7 +648,7 @@ static ssize_t read_rbu_packet_size(struct kobject *kobj,
131 + int size = 0;
132 + if (!pos) {
133 + spin_lock(&rbu_data.lock);
134 +- size = sprintf(buffer, "%lu\n", rbu_data.packetsize);
135 ++ size = scnprintf(buffer, count, "%lu\n", rbu_data.packetsize);
136 + spin_unlock(&rbu_data.lock);
137 + }
138 + return size;
139 +diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c
140 +index 70bb854..fcf74eb 100644
141 +--- a/drivers/hwmon/abituguru3.c
142 ++++ b/drivers/hwmon/abituguru3.c
143 +@@ -1153,7 +1153,7 @@ static int __init abituguru3_dmi_detect(void)
144 +
145 + static inline int abituguru3_dmi_detect(void)
146 + {
147 +- return -ENODEV;
148 ++ return 1;
149 + }
150 +
151 + #endif /* CONFIG_DMI */
152 +diff --git a/drivers/misc/sgi-xp/xpc_sn2.c b/drivers/misc/sgi-xp/xpc_sn2.c
153 +index b4882cc..d32c1ee 100644
154 +--- a/drivers/misc/sgi-xp/xpc_sn2.c
155 ++++ b/drivers/misc/sgi-xp/xpc_sn2.c
156 +@@ -904,7 +904,7 @@ xpc_update_partition_info_sn2(struct xpc_partition *part, u8 remote_rp_version,
157 + dev_dbg(xpc_part, " remote_vars_pa = 0x%016lx\n",
158 + part_sn2->remote_vars_pa);
159 +
160 +- part->last_heartbeat = remote_vars->heartbeat;
161 ++ part->last_heartbeat = remote_vars->heartbeat - 1;
162 + dev_dbg(xpc_part, " last_heartbeat = 0x%016lx\n",
163 + part->last_heartbeat);
164 +
165 +diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
166 +index b5d6b9a..b427978 100644
167 +--- a/drivers/net/irda/irda-usb.c
168 ++++ b/drivers/net/irda/irda-usb.c
169 +@@ -1075,7 +1075,7 @@ static int stir421x_patch_device(struct irda_usb_cb *self)
170 + {
171 + unsigned int i;
172 + int ret;
173 +- char stir421x_fw_name[11];
174 ++ char stir421x_fw_name[12];
175 + const struct firmware *fw;
176 + const unsigned char *fw_version_ptr; /* pointer to version string */
177 + unsigned long fw_version = 0;
178 +diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
179 +index 34fe7ef..9934dbc 100644
180 +--- a/drivers/net/r6040.c
181 ++++ b/drivers/net/r6040.c
182 +@@ -49,8 +49,8 @@
183 + #include <asm/processor.h>
184 +
185 + #define DRV_NAME "r6040"
186 +-#define DRV_VERSION "0.18"
187 +-#define DRV_RELDATE "13Jul2008"
188 ++#define DRV_VERSION "0.19"
189 ++#define DRV_RELDATE "18Dec2008"
190 +
191 + /* PHY CHIP Address */
192 + #define PHY1_ADDR 1 /* For MAC1 */
193 +@@ -214,7 +214,7 @@ static int r6040_phy_read(void __iomem *ioaddr, int phy_addr, int reg)
194 + /* Wait for the read bit to be cleared */
195 + while (limit--) {
196 + cmd = ioread16(ioaddr + MMDIO);
197 +- if (cmd & MDIO_READ)
198 ++ if (!(cmd & MDIO_READ))
199 + break;
200 + }
201 +
202 +@@ -233,7 +233,7 @@ static void r6040_phy_write(void __iomem *ioaddr, int phy_addr, int reg, u16 val
203 + /* Wait for the write bit to be cleared */
204 + while (limit--) {
205 + cmd = ioread16(ioaddr + MMDIO);
206 +- if (cmd & MDIO_WRITE)
207 ++ if (!(cmd & MDIO_WRITE))
208 + break;
209 + }
210 + }
211 +@@ -681,8 +681,10 @@ static irqreturn_t r6040_interrupt(int irq, void *dev_id)
212 + struct net_device *dev = dev_id;
213 + struct r6040_private *lp = netdev_priv(dev);
214 + void __iomem *ioaddr = lp->base;
215 +- u16 status;
216 ++ u16 misr, status;
217 +
218 ++ /* Save MIER */
219 ++ misr = ioread16(ioaddr + MIER);
220 + /* Mask off RDC MAC interrupt */
221 + iowrite16(MSK_INT, ioaddr + MIER);
222 + /* Read MISR status and clear */
223 +@@ -702,7 +704,7 @@ static irqreturn_t r6040_interrupt(int irq, void *dev_id)
224 + dev->stats.rx_fifo_errors++;
225 +
226 + /* Mask off RX interrupt */
227 +- iowrite16(ioread16(ioaddr + MIER) & ~RX_INTS, ioaddr + MIER);
228 ++ misr &= ~RX_INTS;
229 + netif_rx_schedule(dev, &lp->napi);
230 + }
231 +
232 +@@ -710,6 +712,9 @@ static irqreturn_t r6040_interrupt(int irq, void *dev_id)
233 + if (status & TX_INTS)
234 + r6040_tx(dev);
235 +
236 ++ /* Restore RDC MAC interrupt */
237 ++ iowrite16(misr, ioaddr + MIER);
238 ++
239 + return IRQ_HANDLED;
240 + }
241 +
242 +diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
243 +index 75d749b..8a2e32d 100644
244 +--- a/drivers/net/wireless/p54/p54usb.c
245 ++++ b/drivers/net/wireless/p54/p54usb.c
246 +@@ -54,6 +54,7 @@ static struct usb_device_id p54u_table[] __devinitdata = {
247 + {USB_DEVICE(0x050d, 0x7050)}, /* Belkin F5D7050 ver 1000 */
248 + {USB_DEVICE(0x0572, 0x2000)}, /* Cohiba Proto board */
249 + {USB_DEVICE(0x0572, 0x2002)}, /* Cohiba Proto board */
250 ++ {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */
251 + {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */
252 + {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */
253 + {USB_DEVICE(0x0846, 0x4240)}, /* Netgear WG111 (v2) */
254 +@@ -214,6 +215,8 @@ static void p54u_tx_3887(struct ieee80211_hw *dev, struct p54_control_hdr *data,
255 + usb_fill_bulk_urb(data_urb, priv->udev,
256 + usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), data, len,
257 + free_on_tx ? p54u_tx_free_cb : p54u_tx_cb, dev);
258 ++ addr_urb->transfer_flags |= URB_ZERO_PACKET;
259 ++ data_urb->transfer_flags |= URB_ZERO_PACKET;
260 +
261 + usb_submit_urb(addr_urb, GFP_ATOMIC);
262 + usb_submit_urb(data_urb, GFP_ATOMIC);
263 +@@ -251,6 +254,7 @@ static void p54u_tx_lm87(struct ieee80211_hw *dev,
264 + usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), hdr,
265 + len + sizeof(*hdr), free_on_tx ? p54u_tx_free_cb : p54u_tx_cb,
266 + dev);
267 ++ data_urb->transfer_flags |= URB_ZERO_PACKET;
268 +
269 + usb_submit_urb(data_urb, GFP_ATOMIC);
270 + }
271 +@@ -293,11 +297,13 @@ static void p54u_tx_net2280(struct ieee80211_hw *dev, struct p54_control_hdr *da
272 + usb_fill_bulk_urb(int_urb, priv->udev,
273 + usb_sndbulkpipe(priv->udev, P54U_PIPE_DEV), reg, sizeof(*reg),
274 + p54u_tx_free_cb, dev);
275 ++ int_urb->transfer_flags |= URB_ZERO_PACKET;
276 + usb_submit_urb(int_urb, GFP_ATOMIC);
277 +
278 + usb_fill_bulk_urb(data_urb, priv->udev,
279 + usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), hdr, len + sizeof(*hdr),
280 + free_on_tx ? p54u_tx_free_cb : p54u_tx_cb, dev);
281 ++ data_urb->transfer_flags |= URB_ZERO_PACKET;
282 + usb_submit_urb(data_urb, GFP_ATOMIC);
283 + }
284 +
285 +diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
286 +index 934f8e0..42cfa05 100644
287 +--- a/drivers/net/wireless/rt2x00/rt73usb.c
288 ++++ b/drivers/net/wireless/rt2x00/rt73usb.c
289 +@@ -2434,6 +2434,7 @@ static struct usb_device_id rt73usb_device_table[] = {
290 + /* Linksys */
291 + { USB_DEVICE(0x13b1, 0x0020), USB_DEVICE_DATA(&rt73usb_ops) },
292 + { USB_DEVICE(0x13b1, 0x0023), USB_DEVICE_DATA(&rt73usb_ops) },
293 ++ { USB_DEVICE(0x13b1, 0x0028), USB_DEVICE_DATA(&rt73usb_ops) },
294 + /* MSI */
295 + { USB_DEVICE(0x0db0, 0x6877), USB_DEVICE_DATA(&rt73usb_ops) },
296 + { USB_DEVICE(0x0db0, 0x6874), USB_DEVICE_DATA(&rt73usb_ops) },
297 +diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
298 +index 9aad608..503f082 100644
299 +--- a/drivers/pci/pcie/aspm.c
300 ++++ b/drivers/pci/pcie/aspm.c
301 +@@ -33,6 +33,11 @@ struct endpoint_state {
302 + struct pcie_link_state {
303 + struct list_head sibiling;
304 + struct pci_dev *pdev;
305 ++ bool downstream_has_switch;
306 ++
307 ++ struct pcie_link_state *parent;
308 ++ struct list_head children;
309 ++ struct list_head link;
310 +
311 + /* ASPM state */
312 + unsigned int support_state;
313 +@@ -125,7 +130,7 @@ static void pcie_set_clock_pm(struct pci_dev *pdev, int enable)
314 + link_state->clk_pm_enabled = !!enable;
315 + }
316 +
317 +-static void pcie_check_clock_pm(struct pci_dev *pdev)
318 ++static void pcie_check_clock_pm(struct pci_dev *pdev, int blacklist)
319 + {
320 + int pos;
321 + u32 reg32;
322 +@@ -149,10 +154,26 @@ static void pcie_check_clock_pm(struct pci_dev *pdev)
323 + if (!(reg16 & PCI_EXP_LNKCTL_CLKREQ_EN))
324 + enabled = 0;
325 + }
326 +- link_state->clk_pm_capable = capable;
327 + link_state->clk_pm_enabled = enabled;
328 + link_state->bios_clk_state = enabled;
329 +- pcie_set_clock_pm(pdev, policy_to_clkpm_state(pdev));
330 ++ if (!blacklist) {
331 ++ link_state->clk_pm_capable = capable;
332 ++ pcie_set_clock_pm(pdev, policy_to_clkpm_state(pdev));
333 ++ } else {
334 ++ link_state->clk_pm_capable = 0;
335 ++ pcie_set_clock_pm(pdev, 0);
336 ++ }
337 ++}
338 ++
339 ++static bool pcie_aspm_downstream_has_switch(struct pci_dev *pdev)
340 ++{
341 ++ struct pci_dev *child_dev;
342 ++
343 ++ list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) {
344 ++ if (child_dev->pcie_type == PCI_EXP_TYPE_UPSTREAM)
345 ++ return true;
346 ++ }
347 ++ return false;
348 + }
349 +
350 + /*
351 +@@ -419,9 +440,9 @@ static unsigned int pcie_aspm_check_state(struct pci_dev *pdev,
352 + {
353 + struct pci_dev *child_dev;
354 +
355 +- /* If no child, disable the link */
356 ++ /* If no child, ignore the link */
357 + if (list_empty(&pdev->subordinate->devices))
358 +- return 0;
359 ++ return state;
360 + list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) {
361 + if (child_dev->pcie_type == PCI_EXP_TYPE_PCI_BRIDGE) {
362 + /*
363 +@@ -462,6 +483,9 @@ static void __pcie_aspm_config_link(struct pci_dev *pdev, unsigned int state)
364 + int valid = 1;
365 + struct pcie_link_state *link_state = pdev->link_state;
366 +
367 ++ /* If no child, disable the link */
368 ++ if (list_empty(&pdev->subordinate->devices))
369 ++ state = 0;
370 + /*
371 + * if the downstream component has pci bridge function, don't do ASPM
372 + * now
373 +@@ -493,20 +517,52 @@ static void __pcie_aspm_config_link(struct pci_dev *pdev, unsigned int state)
374 + link_state->enabled_state = state;
375 + }
376 +
377 ++static struct pcie_link_state *get_root_port_link(struct pcie_link_state *link)
378 ++{
379 ++ struct pcie_link_state *root_port_link = link;
380 ++ while (root_port_link->parent)
381 ++ root_port_link = root_port_link->parent;
382 ++ return root_port_link;
383 ++}
384 ++
385 ++/* check the whole hierarchy, and configure each link in the hierarchy */
386 + static void __pcie_aspm_configure_link_state(struct pci_dev *pdev,
387 + unsigned int state)
388 + {
389 + struct pcie_link_state *link_state = pdev->link_state;
390 ++ struct pcie_link_state *root_port_link = get_root_port_link(link_state);
391 ++ struct pcie_link_state *leaf;
392 +
393 +- if (link_state->support_state == 0)
394 +- return;
395 + state &= PCIE_LINK_STATE_L0S|PCIE_LINK_STATE_L1;
396 +
397 +- /* state 0 means disabling aspm */
398 +- state = pcie_aspm_check_state(pdev, state);
399 ++ /* check all links who have specific root port link */
400 ++ list_for_each_entry(leaf, &link_list, sibiling) {
401 ++ if (!list_empty(&leaf->children) ||
402 ++ get_root_port_link(leaf) != root_port_link)
403 ++ continue;
404 ++ state = pcie_aspm_check_state(leaf->pdev, state);
405 ++ }
406 ++ /* check root port link too in case it hasn't children */
407 ++ state = pcie_aspm_check_state(root_port_link->pdev, state);
408 ++
409 + if (link_state->enabled_state == state)
410 + return;
411 +- __pcie_aspm_config_link(pdev, state);
412 ++
413 ++ /*
414 ++ * we must change the hierarchy. See comments in
415 ++ * __pcie_aspm_config_link for the order
416 ++ **/
417 ++ if (state & PCIE_LINK_STATE_L1) {
418 ++ list_for_each_entry(leaf, &link_list, sibiling) {
419 ++ if (get_root_port_link(leaf) == root_port_link)
420 ++ __pcie_aspm_config_link(leaf->pdev, state);
421 ++ }
422 ++ } else {
423 ++ list_for_each_entry_reverse(leaf, &link_list, sibiling) {
424 ++ if (get_root_port_link(leaf) == root_port_link)
425 ++ __pcie_aspm_config_link(leaf->pdev, state);
426 ++ }
427 ++ }
428 + }
429 +
430 + /*
431 +@@ -570,6 +626,7 @@ void pcie_aspm_init_link_state(struct pci_dev *pdev)
432 + unsigned int state;
433 + struct pcie_link_state *link_state;
434 + int error = 0;
435 ++ int blacklist;
436 +
437 + if (aspm_disabled || !pdev->is_pcie || pdev->link_state)
438 + return;
439 +@@ -580,29 +637,58 @@ void pcie_aspm_init_link_state(struct pci_dev *pdev)
440 + if (list_empty(&pdev->subordinate->devices))
441 + goto out;
442 +
443 +- if (pcie_aspm_sanity_check(pdev))
444 +- goto out;
445 ++ blacklist = !!pcie_aspm_sanity_check(pdev);
446 +
447 + mutex_lock(&aspm_lock);
448 +
449 + link_state = kzalloc(sizeof(*link_state), GFP_KERNEL);
450 + if (!link_state)
451 + goto unlock_out;
452 +- pdev->link_state = link_state;
453 +
454 +- pcie_aspm_configure_common_clock(pdev);
455 ++ link_state->downstream_has_switch = pcie_aspm_downstream_has_switch(pdev);
456 ++ INIT_LIST_HEAD(&link_state->children);
457 ++ INIT_LIST_HEAD(&link_state->link);
458 ++ if (pdev->bus->self) {/* this is a switch */
459 ++ struct pcie_link_state *parent_link_state;
460 +
461 +- pcie_aspm_cap_init(pdev);
462 ++ parent_link_state = pdev->bus->parent->self->link_state;
463 ++ if (!parent_link_state) {
464 ++ kfree(link_state);
465 ++ goto unlock_out;
466 ++ }
467 ++ list_add(&link_state->link, &parent_link_state->children);
468 ++ link_state->parent = parent_link_state;
469 ++ }
470 +
471 +- /* config link state to avoid BIOS error */
472 +- state = pcie_aspm_check_state(pdev, policy_to_aspm_state(pdev));
473 +- __pcie_aspm_config_link(pdev, state);
474 ++ pdev->link_state = link_state;
475 +
476 +- pcie_check_clock_pm(pdev);
477 ++ if (!blacklist) {
478 ++ pcie_aspm_configure_common_clock(pdev);
479 ++ pcie_aspm_cap_init(pdev);
480 ++ } else {
481 ++ link_state->enabled_state = PCIE_LINK_STATE_L0S|PCIE_LINK_STATE_L1;
482 ++ link_state->bios_aspm_state = 0;
483 ++ /* Set support state to 0, so we will disable ASPM later */
484 ++ link_state->support_state = 0;
485 ++ }
486 +
487 + link_state->pdev = pdev;
488 + list_add(&link_state->sibiling, &link_list);
489 +
490 ++ if (link_state->downstream_has_switch) {
491 ++ /*
492 ++ * If link has switch, delay the link config. The leaf link
493 ++ * initialization will config the whole hierarchy. but we must
494 ++ * make sure BIOS doesn't set unsupported link state
495 ++ **/
496 ++ state = pcie_aspm_check_state(pdev, link_state->bios_aspm_state);
497 ++ __pcie_aspm_config_link(pdev, state);
498 ++ } else
499 ++ __pcie_aspm_configure_link_state(pdev,
500 ++ policy_to_aspm_state(pdev));
501 ++
502 ++ pcie_check_clock_pm(pdev, blacklist);
503 ++
504 + unlock_out:
505 + if (error)
506 + free_link_state(pdev);
507 +@@ -635,6 +721,7 @@ void pcie_aspm_exit_link_state(struct pci_dev *pdev)
508 + /* All functions are removed, so just disable ASPM for the link */
509 + __pcie_aspm_config_one_dev(parent, 0);
510 + list_del(&link_state->sibiling);
511 ++ list_del(&link_state->link);
512 + /* Clock PM is for endpoint device */
513 +
514 + free_link_state(parent);
515 +diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
516 +index 8c08130..7c3710e 100644
517 +--- a/drivers/usb/core/driver.c
518 ++++ b/drivers/usb/core/driver.c
519 +@@ -279,9 +279,12 @@ static int usb_unbind_interface(struct device *dev)
520 + * altsetting means creating new endpoint device entries).
521 + * When either of these happens, defer the Set-Interface.
522 + */
523 +- if (intf->cur_altsetting->desc.bAlternateSetting == 0)
524 +- ; /* Already in altsetting 0 so skip Set-Interface */
525 +- else if (!error && intf->dev.power.status == DPM_ON)
526 ++ if (intf->cur_altsetting->desc.bAlternateSetting == 0) {
527 ++ /* Already in altsetting 0 so skip Set-Interface.
528 ++ * Just re-enable it without affecting the endpoint toggles.
529 ++ */
530 ++ usb_enable_interface(udev, intf, false);
531 ++ } else if (!error && intf->dev.power.status == DPM_ON)
532 + usb_set_interface(udev, intf->altsetting[0].
533 + desc.bInterfaceNumber, 0);
534 + else
535 +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
536 +index b19cbfc..81eea42 100644
537 +--- a/drivers/usb/core/hub.c
538 ++++ b/drivers/usb/core/hub.c
539 +@@ -2385,7 +2385,7 @@ void usb_ep0_reinit(struct usb_device *udev)
540 + {
541 + usb_disable_endpoint(udev, 0 + USB_DIR_IN);
542 + usb_disable_endpoint(udev, 0 + USB_DIR_OUT);
543 +- usb_enable_endpoint(udev, &udev->ep0);
544 ++ usb_enable_endpoint(udev, &udev->ep0, true);
545 + }
546 + EXPORT_SYMBOL_GPL(usb_ep0_reinit);
547 +
548 +diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
549 +index 6d1048f..bdcfe92 100644
550 +--- a/drivers/usb/core/message.c
551 ++++ b/drivers/usb/core/message.c
552 +@@ -1113,22 +1113,26 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
553 + * usb_enable_endpoint - Enable an endpoint for USB communications
554 + * @dev: the device whose interface is being enabled
555 + * @ep: the endpoint
556 ++ * @reset_toggle: flag to set the endpoint's toggle back to 0
557 + *
558 +- * Resets the endpoint toggle, and sets dev->ep_{in,out} pointers.
559 ++ * Resets the endpoint toggle if asked, and sets dev->ep_{in,out} pointers.
560 + * For control endpoints, both the input and output sides are handled.
561 + */
562 +-void usb_enable_endpoint(struct usb_device *dev, struct usb_host_endpoint *ep)
563 ++void usb_enable_endpoint(struct usb_device *dev, struct usb_host_endpoint *ep,
564 ++ bool reset_toggle)
565 + {
566 + int epnum = usb_endpoint_num(&ep->desc);
567 + int is_out = usb_endpoint_dir_out(&ep->desc);
568 + int is_control = usb_endpoint_xfer_control(&ep->desc);
569 +
570 + if (is_out || is_control) {
571 +- usb_settoggle(dev, epnum, 1, 0);
572 ++ if (reset_toggle)
573 ++ usb_settoggle(dev, epnum, 1, 0);
574 + dev->ep_out[epnum] = ep;
575 + }
576 + if (!is_out || is_control) {
577 +- usb_settoggle(dev, epnum, 0, 0);
578 ++ if (reset_toggle)
579 ++ usb_settoggle(dev, epnum, 0, 0);
580 + dev->ep_in[epnum] = ep;
581 + }
582 + ep->enabled = 1;
583 +@@ -1138,17 +1142,18 @@ void usb_enable_endpoint(struct usb_device *dev, struct usb_host_endpoint *ep)
584 + * usb_enable_interface - Enable all the endpoints for an interface
585 + * @dev: the device whose interface is being enabled
586 + * @intf: pointer to the interface descriptor
587 ++ * @reset_toggles: flag to set the endpoints' toggles back to 0
588 + *
589 + * Enables all the endpoints for the interface's current altsetting.
590 + */
591 +-static void usb_enable_interface(struct usb_device *dev,
592 +- struct usb_interface *intf)
593 ++void usb_enable_interface(struct usb_device *dev,
594 ++ struct usb_interface *intf, bool reset_toggles)
595 + {
596 + struct usb_host_interface *alt = intf->cur_altsetting;
597 + int i;
598 +
599 + for (i = 0; i < alt->desc.bNumEndpoints; ++i)
600 +- usb_enable_endpoint(dev, &alt->endpoint[i]);
601 ++ usb_enable_endpoint(dev, &alt->endpoint[i], reset_toggles);
602 + }
603 +
604 + /**
605 +@@ -1271,7 +1276,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
606 + * during the SETUP stage - hence EP0 toggles are "don't care" here.
607 + * (Likewise, EP0 never "halts" on well designed devices.)
608 + */
609 +- usb_enable_interface(dev, iface);
610 ++ usb_enable_interface(dev, iface, true);
611 + if (device_is_registered(&iface->dev))
612 + usb_create_sysfs_intf_files(iface);
613 +
614 +@@ -1346,7 +1351,7 @@ int usb_reset_configuration(struct usb_device *dev)
615 + alt = &intf->altsetting[0];
616 +
617 + intf->cur_altsetting = alt;
618 +- usb_enable_interface(dev, intf);
619 ++ usb_enable_interface(dev, intf, true);
620 + if (device_is_registered(&intf->dev))
621 + usb_create_sysfs_intf_files(intf);
622 + }
623 +@@ -1604,7 +1609,7 @@ free_interfaces:
624 + alt = &intf->altsetting[0];
625 +
626 + intf->cur_altsetting = alt;
627 +- usb_enable_interface(dev, intf);
628 ++ usb_enable_interface(dev, intf, true);
629 + intf->dev.parent = &dev->dev;
630 + intf->dev.driver = NULL;
631 + intf->dev.bus = &usb_bus_type;
632 +diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
633 +index be1fa07..956bf1e 100644
634 +--- a/drivers/usb/core/usb.c
635 ++++ b/drivers/usb/core/usb.c
636 +@@ -362,7 +362,7 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent,
637 + dev->ep0.desc.bLength = USB_DT_ENDPOINT_SIZE;
638 + dev->ep0.desc.bDescriptorType = USB_DT_ENDPOINT;
639 + /* ep0 maxpacket comes later, from device descriptor */
640 +- usb_enable_endpoint(dev, &dev->ep0);
641 ++ usb_enable_endpoint(dev, &dev->ep0, true);
642 + dev->can_submit = 1;
643 +
644 + /* Save readable and stable topology id, distinguishing devices
645 +diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
646 +index 9a1a45a..1d450e9 100644
647 +--- a/drivers/usb/core/usb.h
648 ++++ b/drivers/usb/core/usb.h
649 +@@ -10,7 +10,9 @@ extern int usb_create_ep_files(struct device *parent,
650 + extern void usb_remove_ep_files(struct usb_host_endpoint *endpoint);
651 +
652 + extern void usb_enable_endpoint(struct usb_device *dev,
653 +- struct usb_host_endpoint *ep);
654 ++ struct usb_host_endpoint *ep, bool reset_toggle);
655 ++extern void usb_enable_interface(struct usb_device *dev,
656 ++ struct usb_interface *intf, bool reset_toggles);
657 + extern void usb_disable_endpoint(struct usb_device *dev, unsigned int epaddr);
658 + extern void usb_disable_interface(struct usb_device *dev,
659 + struct usb_interface *intf);
660 +diff --git a/drivers/usb/storage/libusual.c b/drivers/usb/storage/libusual.c
661 +index d617e8a..f970b27 100644
662 +--- a/drivers/usb/storage/libusual.c
663 ++++ b/drivers/usb/storage/libusual.c
664 +@@ -46,6 +46,12 @@ static int usu_probe_thread(void *arg);
665 + { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin,bcdDeviceMax), \
666 + .driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
667 +
668 ++#define COMPLIANT_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
669 ++ vendorName, productName, useProtocol, useTransport, \
670 ++ initFunction, flags) \
671 ++{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
672 ++ .driver_info = (flags) }
673 ++
674 + #define USUAL_DEV(useProto, useTrans, useType) \
675 + { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, useProto, useTrans), \
676 + .driver_info = ((useType)<<24) }
677 +@@ -57,6 +63,7 @@ struct usb_device_id storage_usb_ids [] = {
678 +
679 + #undef USUAL_DEV
680 + #undef UNUSUAL_DEV
681 ++#undef COMPLIANT_DEV
682 +
683 + MODULE_DEVICE_TABLE(usb, storage_usb_ids);
684 + EXPORT_SYMBOL_GPL(storage_usb_ids);
685 +diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
686 +index 09779f6..620c2b5 100644
687 +--- a/drivers/usb/storage/scsiglue.c
688 ++++ b/drivers/usb/storage/scsiglue.c
689 +@@ -59,6 +59,13 @@
690 + #include "transport.h"
691 + #include "protocol.h"
692 +
693 ++/* Vendor IDs for companies that seem to include the READ CAPACITY bug
694 ++ * in all their devices
695 ++ */
696 ++#define VENDOR_ID_NOKIA 0x0421
697 ++#define VENDOR_ID_NIKON 0x04b0
698 ++#define VENDOR_ID_MOTOROLA 0x22b8
699 ++
700 + /***********************************************************************
701 + * Host functions
702 + ***********************************************************************/
703 +@@ -134,6 +141,22 @@ static int slave_configure(struct scsi_device *sdev)
704 + * settings can't be overridden via the scsi devinfo mechanism. */
705 + if (sdev->type == TYPE_DISK) {
706 +
707 ++ /* Some vendors seem to put the READ CAPACITY bug into
708 ++ * all their devices -- primarily makers of cell phones
709 ++ * and digital cameras. Since these devices always use
710 ++ * flash media and can be expected to have an even number
711 ++ * of sectors, we will always enable the CAPACITY_HEURISTICS
712 ++ * flag unless told otherwise. */
713 ++ switch (le16_to_cpu(us->pusb_dev->descriptor.idVendor)) {
714 ++ case VENDOR_ID_NOKIA:
715 ++ case VENDOR_ID_NIKON:
716 ++ case VENDOR_ID_MOTOROLA:
717 ++ if (!(us->fflags & (US_FL_FIX_CAPACITY |
718 ++ US_FL_CAPACITY_OK)))
719 ++ us->fflags |= US_FL_CAPACITY_HEURISTICS;
720 ++ break;
721 ++ }
722 ++
723 + /* Disk-type devices use MODE SENSE(6) if the protocol
724 + * (SubClass) is Transparent SCSI, otherwise they use
725 + * MODE SENSE(10). */
726 +@@ -196,6 +219,14 @@ static int slave_configure(struct scsi_device *sdev)
727 + * sector in a larger then 1 sector read, since the performance
728 + * impact is negible we set this flag for all USB disks */
729 + sdev->last_sector_bug = 1;
730 ++
731 ++ /* Enable last-sector hacks for single-target devices using
732 ++ * the Bulk-only transport, unless we already know the
733 ++ * capacity will be decremented or is correct. */
734 ++ if (!(us->fflags & (US_FL_FIX_CAPACITY | US_FL_CAPACITY_OK |
735 ++ US_FL_SCM_MULT_TARG)) &&
736 ++ us->protocol == US_PR_BULK)
737 ++ us->use_last_sector_hacks = 1;
738 + } else {
739 +
740 + /* Non-disk-type devices don't need to blacklist any pages
741 +diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
742 +index 79108d5..95de764 100644
743 +--- a/drivers/usb/storage/transport.c
744 ++++ b/drivers/usb/storage/transport.c
745 +@@ -57,6 +57,9 @@
746 + #include "scsiglue.h"
747 + #include "debug.h"
748 +
749 ++#include <linux/blkdev.h>
750 ++#include "../../scsi/sd.h"
751 ++
752 +
753 + /***********************************************************************
754 + * Data transfer routines
755 +@@ -511,6 +514,80 @@ int usb_stor_bulk_transfer_sg(struct us_data* us, unsigned int pipe,
756 + * Transport routines
757 + ***********************************************************************/
758 +
759 ++/* There are so many devices that report the capacity incorrectly,
760 ++ * this routine was written to counteract some of the resulting
761 ++ * problems.
762 ++ */
763 ++static void last_sector_hacks(struct us_data *us, struct scsi_cmnd *srb)
764 ++{
765 ++ struct gendisk *disk;
766 ++ struct scsi_disk *sdkp;
767 ++ u32 sector;
768 ++
769 ++ /* To Report "Medium Error: Record Not Found */
770 ++ static unsigned char record_not_found[18] = {
771 ++ [0] = 0x70, /* current error */
772 ++ [2] = MEDIUM_ERROR, /* = 0x03 */
773 ++ [7] = 0x0a, /* additional length */
774 ++ [12] = 0x14 /* Record Not Found */
775 ++ };
776 ++
777 ++ /* If last-sector problems can't occur, whether because the
778 ++ * capacity was already decremented or because the device is
779 ++ * known to report the correct capacity, then we don't need
780 ++ * to do anything.
781 ++ */
782 ++ if (!us->use_last_sector_hacks)
783 ++ return;
784 ++
785 ++ /* Was this command a READ(10) or a WRITE(10)? */
786 ++ if (srb->cmnd[0] != READ_10 && srb->cmnd[0] != WRITE_10)
787 ++ goto done;
788 ++
789 ++ /* Did this command access the last sector? */
790 ++ sector = (srb->cmnd[2] << 24) | (srb->cmnd[3] << 16) |
791 ++ (srb->cmnd[4] << 8) | (srb->cmnd[5]);
792 ++ disk = srb->request->rq_disk;
793 ++ if (!disk)
794 ++ goto done;
795 ++ sdkp = scsi_disk(disk);
796 ++ if (!sdkp)
797 ++ goto done;
798 ++ if (sector + 1 != sdkp->capacity)
799 ++ goto done;
800 ++
801 ++ if (srb->result == SAM_STAT_GOOD && scsi_get_resid(srb) == 0) {
802 ++
803 ++ /* The command succeeded. We know this device doesn't
804 ++ * have the last-sector bug, so stop checking it.
805 ++ */
806 ++ us->use_last_sector_hacks = 0;
807 ++
808 ++ } else {
809 ++ /* The command failed. Allow up to 3 retries in case this
810 ++ * is some normal sort of failure. After that, assume the
811 ++ * capacity is wrong and we're trying to access the sector
812 ++ * beyond the end. Replace the result code and sense data
813 ++ * with values that will cause the SCSI core to fail the
814 ++ * command immediately, instead of going into an infinite
815 ++ * (or even just a very long) retry loop.
816 ++ */
817 ++ if (++us->last_sector_retries < 3)
818 ++ return;
819 ++ srb->result = SAM_STAT_CHECK_CONDITION;
820 ++ memcpy(srb->sense_buffer, record_not_found,
821 ++ sizeof(record_not_found));
822 ++ }
823 ++
824 ++ done:
825 ++ /* Don't reset the retry counter for TEST UNIT READY commands,
826 ++ * because they get issued after device resets which might be
827 ++ * caused by a failed last-sector access.
828 ++ */
829 ++ if (srb->cmnd[0] != TEST_UNIT_READY)
830 ++ us->last_sector_retries = 0;
831 ++}
832 ++
833 + /* Invoke the transport and basic error-handling/recovery methods
834 + *
835 + * This is used by the protocol layers to actually send the message to
836 +@@ -544,6 +621,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
837 + /* if the transport provided its own sense data, don't auto-sense */
838 + if (result == USB_STOR_TRANSPORT_NO_SENSE) {
839 + srb->result = SAM_STAT_CHECK_CONDITION;
840 ++ last_sector_hacks(us, srb);
841 + return;
842 + }
843 +
844 +@@ -667,6 +745,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
845 + scsi_bufflen(srb) - scsi_get_resid(srb) < srb->underflow)
846 + srb->result = (DID_ERROR << 16) | (SUGGEST_RETRY << 24);
847 +
848 ++ last_sector_hacks(us, srb);
849 + return;
850 +
851 + /* Error and abort processing: try to resynchronize with the device
852 +@@ -694,6 +773,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
853 + us->transport_reset(us);
854 + }
855 + clear_bit(US_FLIDX_RESETTING, &us->dflags);
856 ++ last_sector_hacks(us, srb);
857 + }
858 +
859 + /* Stop the current URB transfer */
860 +diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
861 +index a078540..ce7f746 100644
862 +--- a/drivers/usb/storage/unusual_devs.h
863 ++++ b/drivers/usb/storage/unusual_devs.h
864 +@@ -27,7 +27,8 @@
865 +
866 + /* IMPORTANT NOTE: This file must be included in another file which does
867 + * the following thing for it to work:
868 +- * The macro UNUSUAL_DEV() must be defined before this file is included
869 ++ * The UNUSUAL_DEV, COMPLIANT_DEV, and USUAL_DEV macros must be defined
870 ++ * before this file is included.
871 + */
872 +
873 + /* If you edit this file, please try to keep it sorted first by VendorID,
874 +@@ -46,6 +47,12 @@
875 + * <usb-storage@××××××××××××××××××××.net>
876 + */
877 +
878 ++/* Note: If you add an entry only in order to set the CAPACITY_OK flag,
879 ++ * use the COMPLIANT_DEV macro instead of UNUSUAL_DEV. This is
880 ++ * because such entries mark devices which actually work correctly,
881 ++ * as opposed to devices that do something strangely or wrongly.
882 ++ */
883 ++
884 + /* patch submitted by Vivian Bregier <Vivian.Bregier@××××.fr>
885 + */
886 + UNUSUAL_DEV( 0x03eb, 0x2002, 0x0100, 0x0100,
887 +@@ -160,34 +167,6 @@ UNUSUAL_DEV( 0x0421, 0x0019, 0x0592, 0x0592,
888 + US_SC_DEVICE, US_PR_DEVICE, NULL,
889 + US_FL_MAX_SECTORS_64 ),
890 +
891 +-/* Reported by Filip Joelsson <filip@××××××××××.nu> */
892 +-UNUSUAL_DEV( 0x0421, 0x005d, 0x0001, 0x0600,
893 +- "Nokia",
894 +- "Nokia 3110c",
895 +- US_SC_DEVICE, US_PR_DEVICE, NULL,
896 +- US_FL_FIX_CAPACITY ),
897 +-
898 +-/* Reported by Ozan Sener <themgzzy@×××××.com> */
899 +-UNUSUAL_DEV( 0x0421, 0x0060, 0x0551, 0x0551,
900 +- "Nokia",
901 +- "3500c",
902 +- US_SC_DEVICE, US_PR_DEVICE, NULL,
903 +- US_FL_FIX_CAPACITY ),
904 +-
905 +-/* Reported by CSECSY Laszlo <boobaa@××××××××××.org> */
906 +-UNUSUAL_DEV( 0x0421, 0x0063, 0x0001, 0x0601,
907 +- "Nokia",
908 +- "Nokia 3109c",
909 +- US_SC_DEVICE, US_PR_DEVICE, NULL,
910 +- US_FL_FIX_CAPACITY ),
911 +-
912 +-/* Patch for Nokia 5310 capacity */
913 +-UNUSUAL_DEV( 0x0421, 0x006a, 0x0000, 0x0701,
914 +- "Nokia",
915 +- "5310",
916 +- US_SC_DEVICE, US_PR_DEVICE, NULL,
917 +- US_FL_FIX_CAPACITY ),
918 +-
919 + /* Reported by Mario Rettig <mariorettig@×××.de> */
920 + UNUSUAL_DEV( 0x0421, 0x042e, 0x0100, 0x0100,
921 + "Nokia",
922 +@@ -253,42 +232,6 @@ UNUSUAL_DEV( 0x0421, 0x0495, 0x0370, 0x0370,
923 + US_SC_DEVICE, US_PR_DEVICE, NULL,
924 + US_FL_MAX_SECTORS_64 ),
925 +
926 +-/* Reported by Cedric Godin <cedric@×××××××.be> */
927 +-UNUSUAL_DEV( 0x0421, 0x04b9, 0x0500, 0x0551,
928 +- "Nokia",
929 +- "5300",
930 +- US_SC_DEVICE, US_PR_DEVICE, NULL,
931 +- US_FL_FIX_CAPACITY ),
932 +-
933 +-/* Reported by Paulo Fessel <pfessel@×××××.com> */
934 +-UNUSUAL_DEV( 0x0421, 0x04bd, 0x0000, 0x9999,
935 +- "Nokia",
936 +- "5200",
937 +- US_SC_DEVICE, US_PR_DEVICE, NULL,
938 +- US_FL_FIX_CAPACITY ),
939 +-
940 +-/* Reported by Richard Nauber <RichardNauber@×××.de> */
941 +-UNUSUAL_DEV( 0x0421, 0x04fa, 0x0550, 0x0660,
942 +- "Nokia",
943 +- "6300",
944 +- US_SC_DEVICE, US_PR_DEVICE, NULL,
945 +- US_FL_FIX_CAPACITY ),
946 +-
947 +-/* Patch for Nokia 5310 capacity */
948 +-UNUSUAL_DEV( 0x0421, 0x006a, 0x0000, 0x0591,
949 +- "Nokia",
950 +- "5310",
951 +- US_SC_DEVICE, US_PR_DEVICE, NULL,
952 +- US_FL_FIX_CAPACITY ),
953 +-
954 +-/* Submitted by Ricky Wong Yung Fei <evilbladewarrior@×××××.com> */
955 +-/* Nokia 7610 Supernova - Too many sectors reported in usb storage mode */
956 +-UNUSUAL_DEV( 0x0421, 0x00f5, 0x0000, 0x0470,
957 +- "Nokia",
958 +- "7610 Supernova",
959 +- US_SC_DEVICE, US_PR_DEVICE, NULL,
960 +- US_FL_FIX_CAPACITY ),
961 +-
962 + /* Reported by Olaf Hering <olh@××××.de> from novell bug #105878 */
963 + UNUSUAL_DEV( 0x0424, 0x0fdc, 0x0210, 0x0210,
964 + "SMSC",
965 +@@ -403,83 +346,6 @@ UNUSUAL_DEV( 0x04b0, 0x0301, 0x0010, 0x0010,
966 + US_SC_DEVICE, US_PR_DEVICE,NULL,
967 + US_FL_NOT_LOCKABLE ),
968 +
969 +-/* Reported by Stefan de Konink <skinkie@××××××.nl> */
970 +-UNUSUAL_DEV( 0x04b0, 0x0401, 0x0200, 0x0200,
971 +- "NIKON",
972 +- "NIKON DSC D100",
973 +- US_SC_DEVICE, US_PR_DEVICE, NULL,
974 +- US_FL_FIX_CAPACITY),
975 +-
976 +-/* Reported by Tobias Kunze Briseno <t-linux@×××××××.com> */
977 +-UNUSUAL_DEV( 0x04b0, 0x0403, 0x0200, 0x0200,
978 +- "NIKON",
979 +- "NIKON DSC D2H",
980 +- US_SC_DEVICE, US_PR_DEVICE, NULL,
981 +- US_FL_FIX_CAPACITY),
982 +-
983 +-/* Reported by Milinevsky Dmitry <niam.niam@×××××.com> */
984 +-UNUSUAL_DEV( 0x04b0, 0x0409, 0x0100, 0x0100,
985 +- "NIKON",
986 +- "NIKON DSC D50",
987 +- US_SC_DEVICE, US_PR_DEVICE, NULL,
988 +- US_FL_FIX_CAPACITY),
989 +-
990 +-/* Reported by Andreas Bockhold <andreas@×××××××××××.de> */
991 +-UNUSUAL_DEV( 0x04b0, 0x0405, 0x0100, 0x0100,
992 +- "NIKON",
993 +- "NIKON DSC D70",
994 +- US_SC_DEVICE, US_PR_DEVICE, NULL,
995 +- US_FL_FIX_CAPACITY),
996 +-
997 +-/* Reported by Jamie Kitson <jamie@×××××××××××××××××××.uk> */
998 +-UNUSUAL_DEV( 0x04b0, 0x040d, 0x0100, 0x0100,
999 +- "NIKON",
1000 +- "NIKON DSC D70s",
1001 +- US_SC_DEVICE, US_PR_DEVICE, NULL,
1002 +- US_FL_FIX_CAPACITY),
1003 +-
1004 +-/* Reported by Graber and Mike Pagano <mpagano-kernel@×××××××.com> */
1005 +-UNUSUAL_DEV( 0x04b0, 0x040f, 0x0100, 0x0200,
1006 +- "NIKON",
1007 +- "NIKON DSC D200",
1008 +- US_SC_DEVICE, US_PR_DEVICE, NULL,
1009 +- US_FL_FIX_CAPACITY),
1010 +-
1011 +-/* Reported by Emil Larsson <emil@××××.net> */
1012 +-UNUSUAL_DEV( 0x04b0, 0x0411, 0x0100, 0x0111,
1013 +- "NIKON",
1014 +- "NIKON DSC D80",
1015 +- US_SC_DEVICE, US_PR_DEVICE, NULL,
1016 +- US_FL_FIX_CAPACITY),
1017 +-
1018 +-/* Reported by Ortwin Glueck <odi@×××.ch> */
1019 +-UNUSUAL_DEV( 0x04b0, 0x0413, 0x0110, 0x0111,
1020 +- "NIKON",
1021 +- "NIKON DSC D40",
1022 +- US_SC_DEVICE, US_PR_DEVICE, NULL,
1023 +- US_FL_FIX_CAPACITY),
1024 +-
1025 +-/* Reported by Paul Check <paul@××××××××××.com> */
1026 +-UNUSUAL_DEV( 0x04b0, 0x0415, 0x0100, 0x0100,
1027 +- "NIKON",
1028 +- "NIKON DSC D2Xs",
1029 +- US_SC_DEVICE, US_PR_DEVICE, NULL,
1030 +- US_FL_FIX_CAPACITY),
1031 +-
1032 +-/* Reported by Shan Destromp (shansan@×××××.com) */
1033 +-UNUSUAL_DEV( 0x04b0, 0x0417, 0x0100, 0x0100,
1034 +- "NIKON",
1035 +- "NIKON DSC D40X",
1036 +- US_SC_DEVICE, US_PR_DEVICE, NULL,
1037 +- US_FL_FIX_CAPACITY),
1038 +-
1039 +-/* Reported by paul ready <lxtwin@×××××××××××.uk> */
1040 +-UNUSUAL_DEV( 0x04b0, 0x0419, 0x0100, 0x0200,
1041 +- "NIKON",
1042 +- "NIKON DSC D300",
1043 +- US_SC_DEVICE, US_PR_DEVICE, NULL,
1044 +- US_FL_FIX_CAPACITY),
1045 +-
1046 + /* Reported by Doug Maxey (dwm@××××××××××.com) */
1047 + UNUSUAL_DEV( 0x04b3, 0x4001, 0x0110, 0x0110,
1048 + "IBM",
1049 +@@ -692,6 +558,13 @@ UNUSUAL_DEV( 0x0525, 0xa140, 0x0100, 0x0100,
1050 + US_SC_8070, US_PR_DEVICE, NULL,
1051 + US_FL_FIX_INQUIRY ),
1052 +
1053 ++/* Added by Alan Stern <stern@×××××××××××××××.edu> */
1054 ++COMPLIANT_DEV(0x0525, 0xa4a5, 0x0000, 0x9999,
1055 ++ "Linux",
1056 ++ "File-backed Storage Gadget",
1057 ++ US_SC_DEVICE, US_PR_DEVICE, NULL,
1058 ++ US_FL_CAPACITY_OK ),
1059 ++
1060 + /* Yakumo Mega Image 37
1061 + * Submitted by Stephan Fuhrmann <atomenergie@××××××××.de> */
1062 + UNUSUAL_DEV( 0x052b, 0x1801, 0x0100, 0x0100,
1063 +@@ -2107,27 +1980,6 @@ UNUSUAL_DEV( 0x22b8, 0x3010, 0x0001, 0x0001,
1064 + US_FL_FIX_CAPACITY | US_FL_IGNORE_RESIDUE ),
1065 +
1066 + /*
1067 +- * Patch by Pete Zaitcev <zaitcev@××××××.com>
1068 +- * Report by Mark Patton. Red Hat bz#208928.
1069 +- * Added support for rev 0x0002 (Motorola ROKR W5)
1070 +- * by Javier Smaldone <javier@××××××××××××.ar>
1071 +- */
1072 +-UNUSUAL_DEV( 0x22b8, 0x4810, 0x0001, 0x0002,
1073 +- "Motorola",
1074 +- "RAZR V3i/ROKR W5",
1075 +- US_SC_DEVICE, US_PR_DEVICE, NULL,
1076 +- US_FL_FIX_CAPACITY),
1077 +-
1078 +-/*
1079 +- * Patch by Jost Diederichs <jost@×××××.com>
1080 +- */
1081 +-UNUSUAL_DEV(0x22b8, 0x6410, 0x0001, 0x9999,
1082 +- "Motorola Inc.",
1083 +- "Motorola Phone (RAZRV3xx)",
1084 +- US_SC_DEVICE, US_PR_DEVICE, NULL,
1085 +- US_FL_FIX_CAPACITY),
1086 +-
1087 +-/*
1088 + * Patch by Constantin Baranov <const@×××××.ru>
1089 + * Report by Andreas Koenecke.
1090 + * Motorola ROKR Z6.
1091 +diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
1092 +index 27016fd..ceb8ac3 100644
1093 +--- a/drivers/usb/storage/usb.c
1094 ++++ b/drivers/usb/storage/usb.c
1095 +@@ -126,6 +126,8 @@ MODULE_PARM_DESC(delay_use, "seconds to delay before using a new device");
1096 + { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin,bcdDeviceMax), \
1097 + .driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
1098 +
1099 ++#define COMPLIANT_DEV UNUSUAL_DEV
1100 ++
1101 + #define USUAL_DEV(useProto, useTrans, useType) \
1102 + { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, useProto, useTrans), \
1103 + .driver_info = (USB_US_TYPE_STOR<<24) }
1104 +@@ -134,6 +136,7 @@ static struct usb_device_id storage_usb_ids [] = {
1105 +
1106 + # include "unusual_devs.h"
1107 + #undef UNUSUAL_DEV
1108 ++#undef COMPLIANT_DEV
1109 + #undef USUAL_DEV
1110 + /* Terminating entry */
1111 + { }
1112 +@@ -164,6 +167,8 @@ MODULE_DEVICE_TABLE (usb, storage_usb_ids);
1113 + .initFunction = init_function, \
1114 + }
1115 +
1116 ++#define COMPLIANT_DEV UNUSUAL_DEV
1117 ++
1118 + #define USUAL_DEV(use_protocol, use_transport, use_type) \
1119 + { \
1120 + .useProtocol = use_protocol, \
1121 +@@ -173,6 +178,7 @@ MODULE_DEVICE_TABLE (usb, storage_usb_ids);
1122 + static struct us_unusual_dev us_unusual_dev_list[] = {
1123 + # include "unusual_devs.h"
1124 + # undef UNUSUAL_DEV
1125 ++# undef COMPLIANT_DEV
1126 + # undef USUAL_DEV
1127 +
1128 + /* Terminating entry */
1129 +diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h
1130 +index a4ad73b..2e995c9 100644
1131 +--- a/drivers/usb/storage/usb.h
1132 ++++ b/drivers/usb/storage/usb.h
1133 +@@ -155,6 +155,10 @@ struct us_data {
1134 + #ifdef CONFIG_PM
1135 + pm_hook suspend_resume_hook;
1136 + #endif
1137 ++
1138 ++ /* hacks for READ CAPACITY bug handling */
1139 ++ int use_last_sector_hacks;
1140 ++ int last_sector_retries;
1141 + };
1142 +
1143 + /* Convert between us_data and the corresponding Scsi_Host */
1144 +diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
1145 +index d0ff0b8..e5eaa62 100644
1146 +--- a/fs/fs-writeback.c
1147 ++++ b/fs/fs-writeback.c
1148 +@@ -421,9 +421,6 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
1149 + * If we're a pdlfush thread, then implement pdflush collision avoidance
1150 + * against the entire list.
1151 + *
1152 +- * WB_SYNC_HOLD is a hack for sys_sync(): reattach the inode to sb->s_dirty so
1153 +- * that it can be located for waiting on in __writeback_single_inode().
1154 +- *
1155 + * If `bdi' is non-zero then we're being asked to writeback a specific queue.
1156 + * This function assumes that the blockdev superblock's inodes are backed by
1157 + * a variety of queues, so all inodes are searched. For other superblocks,
1158 +@@ -443,6 +440,7 @@ void generic_sync_sb_inodes(struct super_block *sb,
1159 + struct writeback_control *wbc)
1160 + {
1161 + const unsigned long start = jiffies; /* livelock avoidance */
1162 ++ int sync = wbc->sync_mode == WB_SYNC_ALL;
1163 +
1164 + spin_lock(&inode_lock);
1165 + if (!wbc->for_kupdate || list_empty(&sb->s_io))
1166 +@@ -499,10 +497,6 @@ void generic_sync_sb_inodes(struct super_block *sb,
1167 + __iget(inode);
1168 + pages_skipped = wbc->pages_skipped;
1169 + __writeback_single_inode(inode, wbc);
1170 +- if (wbc->sync_mode == WB_SYNC_HOLD) {
1171 +- inode->dirtied_when = jiffies;
1172 +- list_move(&inode->i_list, &sb->s_dirty);
1173 +- }
1174 + if (current_is_pdflush())
1175 + writeback_release(bdi);
1176 + if (wbc->pages_skipped != pages_skipped) {
1177 +@@ -523,7 +517,49 @@ void generic_sync_sb_inodes(struct super_block *sb,
1178 + if (!list_empty(&sb->s_more_io))
1179 + wbc->more_io = 1;
1180 + }
1181 +- spin_unlock(&inode_lock);
1182 ++
1183 ++ if (sync) {
1184 ++ struct inode *inode, *old_inode = NULL;
1185 ++
1186 ++ /*
1187 ++ * Data integrity sync. Must wait for all pages under writeback,
1188 ++ * because there may have been pages dirtied before our sync
1189 ++ * call, but which had writeout started before we write it out.
1190 ++ * In which case, the inode may not be on the dirty list, but
1191 ++ * we still have to wait for that writeout.
1192 ++ */
1193 ++ list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
1194 ++ struct address_space *mapping;
1195 ++
1196 ++ if (inode->i_state & (I_FREEING|I_WILL_FREE))
1197 ++ continue;
1198 ++ mapping = inode->i_mapping;
1199 ++ if (mapping->nrpages == 0)
1200 ++ continue;
1201 ++ __iget(inode);
1202 ++ spin_unlock(&inode_lock);
1203 ++ /*
1204 ++ * We hold a reference to 'inode' so it couldn't have
1205 ++ * been removed from s_inodes list while we dropped the
1206 ++ * inode_lock. We cannot iput the inode now as we can
1207 ++ * be holding the last reference and we cannot iput it
1208 ++ * under inode_lock. So we keep the reference and iput
1209 ++ * it later.
1210 ++ */
1211 ++ iput(old_inode);
1212 ++ old_inode = inode;
1213 ++
1214 ++ filemap_fdatawait(mapping);
1215 ++
1216 ++ cond_resched();
1217 ++
1218 ++ spin_lock(&inode_lock);
1219 ++ }
1220 ++ spin_unlock(&inode_lock);
1221 ++ iput(old_inode);
1222 ++ } else
1223 ++ spin_unlock(&inode_lock);
1224 ++
1225 + return; /* Leave any unwritten inodes on s_io */
1226 + }
1227 + EXPORT_SYMBOL_GPL(generic_sync_sb_inodes);
1228 +@@ -588,8 +624,7 @@ restart:
1229 +
1230 + /*
1231 + * writeback and wait upon the filesystem's dirty inodes. The caller will
1232 +- * do this in two passes - one to write, and one to wait. WB_SYNC_HOLD is
1233 +- * used to park the written inodes on sb->s_dirty for the wait pass.
1234 ++ * do this in two passes - one to write, and one to wait.
1235 + *
1236 + * A finite limit is set on the number of pages which will be written.
1237 + * To prevent infinite livelock of sys_sync().
1238 +@@ -600,30 +635,21 @@ restart:
1239 + void sync_inodes_sb(struct super_block *sb, int wait)
1240 + {
1241 + struct writeback_control wbc = {
1242 +- .sync_mode = wait ? WB_SYNC_ALL : WB_SYNC_HOLD,
1243 ++ .sync_mode = wait ? WB_SYNC_ALL : WB_SYNC_NONE,
1244 + .range_start = 0,
1245 + .range_end = LLONG_MAX,
1246 + };
1247 +- unsigned long nr_dirty = global_page_state(NR_FILE_DIRTY);
1248 +- unsigned long nr_unstable = global_page_state(NR_UNSTABLE_NFS);
1249 +
1250 +- wbc.nr_to_write = nr_dirty + nr_unstable +
1251 +- (inodes_stat.nr_inodes - inodes_stat.nr_unused) +
1252 +- nr_dirty + nr_unstable;
1253 +- wbc.nr_to_write += wbc.nr_to_write / 2; /* Bit more for luck */
1254 +- sync_sb_inodes(sb, &wbc);
1255 +-}
1256 ++ if (!wait) {
1257 ++ unsigned long nr_dirty = global_page_state(NR_FILE_DIRTY);
1258 ++ unsigned long nr_unstable = global_page_state(NR_UNSTABLE_NFS);
1259 +
1260 +-/*
1261 +- * Rather lame livelock avoidance.
1262 +- */
1263 +-static void set_sb_syncing(int val)
1264 +-{
1265 +- struct super_block *sb;
1266 +- spin_lock(&sb_lock);
1267 +- list_for_each_entry_reverse(sb, &super_blocks, s_list)
1268 +- sb->s_syncing = val;
1269 +- spin_unlock(&sb_lock);
1270 ++ wbc.nr_to_write = nr_dirty + nr_unstable +
1271 ++ (inodes_stat.nr_inodes - inodes_stat.nr_unused);
1272 ++ } else
1273 ++ wbc.nr_to_write = LONG_MAX; /* doesn't actually matter */
1274 ++
1275 ++ sync_sb_inodes(sb, &wbc);
1276 + }
1277 +
1278 + /**
1279 +@@ -652,9 +678,6 @@ static void __sync_inodes(int wait)
1280 + spin_lock(&sb_lock);
1281 + restart:
1282 + list_for_each_entry(sb, &super_blocks, s_list) {
1283 +- if (sb->s_syncing)
1284 +- continue;
1285 +- sb->s_syncing = 1;
1286 + sb->s_count++;
1287 + spin_unlock(&sb_lock);
1288 + down_read(&sb->s_umount);
1289 +@@ -672,13 +695,10 @@ restart:
1290 +
1291 + void sync_inodes(int wait)
1292 + {
1293 +- set_sb_syncing(0);
1294 + __sync_inodes(0);
1295 +
1296 +- if (wait) {
1297 +- set_sb_syncing(0);
1298 ++ if (wait)
1299 + __sync_inodes(1);
1300 +- }
1301 + }
1302 +
1303 + /**
1304 +diff --git a/fs/sync.c b/fs/sync.c
1305 +index 6cc8cb4..9e5f60d 100644
1306 +--- a/fs/sync.c
1307 ++++ b/fs/sync.c
1308 +@@ -287,7 +287,7 @@ int do_sync_mapping_range(struct address_space *mapping, loff_t offset,
1309 +
1310 + if (flags & SYNC_FILE_RANGE_WRITE) {
1311 + ret = __filemap_fdatawrite_range(mapping, offset, endbyte,
1312 +- WB_SYNC_NONE);
1313 ++ WB_SYNC_ALL);
1314 + if (ret < 0)
1315 + goto out;
1316 + }
1317 +diff --git a/include/linux/fs.h b/include/linux/fs.h
1318 +index efeff3d..4b91924 100644
1319 +--- a/include/linux/fs.h
1320 ++++ b/include/linux/fs.h
1321 +@@ -1124,7 +1124,6 @@ struct super_block {
1322 + struct rw_semaphore s_umount;
1323 + struct mutex s_lock;
1324 + int s_count;
1325 +- int s_syncing;
1326 + int s_need_sync_fs;
1327 + atomic_t s_active;
1328 + #ifdef CONFIG_SECURITY
1329 +diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
1330 +index d9a3bbe..bd414ec 100644
1331 +--- a/include/linux/usb_usual.h
1332 ++++ b/include/linux/usb_usual.h
1333 +@@ -52,8 +52,9 @@
1334 + US_FLAG(MAX_SECTORS_MIN,0x00002000) \
1335 + /* Sets max_sectors to arch min */ \
1336 + US_FLAG(BULK_IGNORE_TAG,0x00004000) \
1337 +- /* Ignore tag mismatch in bulk operations */
1338 +-
1339 ++ /* Ignore tag mismatch in bulk operations */ \
1340 ++ US_FLAG(CAPACITY_OK, 0x00010000) \
1341 ++ /* READ CAPACITY response is correct */
1342 +
1343 + #define US_FLAG(name, value) US_FL_##name = value ,
1344 + enum { US_DO_ALL_FLAGS };
1345 +diff --git a/include/linux/writeback.h b/include/linux/writeback.h
1346 +index e585657..b93ab38 100644
1347 +--- a/include/linux/writeback.h
1348 ++++ b/include/linux/writeback.h
1349 +@@ -30,7 +30,6 @@ static inline int task_is_pdflush(struct task_struct *task)
1350 + enum writeback_sync_modes {
1351 + WB_SYNC_NONE, /* Don't wait on anything */
1352 + WB_SYNC_ALL, /* Wait on every mapping */
1353 +- WB_SYNC_HOLD, /* Hold the inode on sb_dirty for sys_sync() */
1354 + };
1355 +
1356 + /*
1357 +diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
1358 +index 98345e4..06a68c4 100644
1359 +--- a/kernel/sched_fair.c
1360 ++++ b/kernel/sched_fair.c
1361 +@@ -283,7 +283,7 @@ static void update_min_vruntime(struct cfs_rq *cfs_rq)
1362 + struct sched_entity,
1363 + run_node);
1364 +
1365 +- if (vruntime == cfs_rq->min_vruntime)
1366 ++ if (!cfs_rq->curr)
1367 + vruntime = se->vruntime;
1368 + else
1369 + vruntime = min_vruntime(vruntime, se->vruntime);
1370 +diff --git a/lib/idr.c b/lib/idr.c
1371 +index 1c4f928..21154ae 100644
1372 +--- a/lib/idr.c
1373 ++++ b/lib/idr.c
1374 +@@ -121,7 +121,7 @@ int idr_pre_get(struct idr *idp, gfp_t gfp_mask)
1375 + {
1376 + while (idp->id_free_cnt < IDR_FREE_MAX) {
1377 + struct idr_layer *new;
1378 +- new = kmem_cache_alloc(idr_layer_cache, gfp_mask);
1379 ++ new = kmem_cache_zalloc(idr_layer_cache, gfp_mask);
1380 + if (new == NULL)
1381 + return (0);
1382 + move_to_free_list(idp, new);
1383 +@@ -623,16 +623,10 @@ void *idr_replace(struct idr *idp, void *ptr, int id)
1384 + }
1385 + EXPORT_SYMBOL(idr_replace);
1386 +
1387 +-static void idr_cache_ctor(void *idr_layer)
1388 +-{
1389 +- memset(idr_layer, 0, sizeof(struct idr_layer));
1390 +-}
1391 +-
1392 + void __init idr_init_cache(void)
1393 + {
1394 + idr_layer_cache = kmem_cache_create("idr_layer_cache",
1395 +- sizeof(struct idr_layer), 0, SLAB_PANIC,
1396 +- idr_cache_ctor);
1397 ++ sizeof(struct idr_layer), 0, SLAB_PANIC, NULL);
1398 + }
1399 +
1400 + /**
1401 +diff --git a/mm/filemap.c b/mm/filemap.c
1402 +index f65417c..6f62ef9 100644
1403 +--- a/mm/filemap.c
1404 ++++ b/mm/filemap.c
1405 +@@ -210,7 +210,7 @@ int __filemap_fdatawrite_range(struct address_space *mapping, loff_t start,
1406 + int ret;
1407 + struct writeback_control wbc = {
1408 + .sync_mode = sync_mode,
1409 +- .nr_to_write = mapping->nrpages * 2,
1410 ++ .nr_to_write = LONG_MAX,
1411 + .range_start = start,
1412 + .range_end = end,
1413 + };
1414 +@@ -1317,7 +1317,8 @@ generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
1415 + goto out; /* skip atime */
1416 + size = i_size_read(inode);
1417 + if (pos < size) {
1418 +- retval = filemap_write_and_wait(mapping);
1419 ++ retval = filemap_write_and_wait_range(mapping, pos,
1420 ++ pos + iov_length(iov, nr_segs) - 1);
1421 + if (!retval) {
1422 + retval = mapping->a_ops->direct_IO(READ, iocb,
1423 + iov, pos, nr_segs);
1424 +@@ -2067,18 +2068,10 @@ generic_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
1425 + if (count != ocount)
1426 + *nr_segs = iov_shorten((struct iovec *)iov, *nr_segs, count);
1427 +
1428 +- /*
1429 +- * Unmap all mmappings of the file up-front.
1430 +- *
1431 +- * This will cause any pte dirty bits to be propagated into the
1432 +- * pageframes for the subsequent filemap_write_and_wait().
1433 +- */
1434 + write_len = iov_length(iov, *nr_segs);
1435 + end = (pos + write_len - 1) >> PAGE_CACHE_SHIFT;
1436 +- if (mapping_mapped(mapping))
1437 +- unmap_mapping_range(mapping, pos, write_len, 0);
1438 +
1439 +- written = filemap_write_and_wait(mapping);
1440 ++ written = filemap_write_and_wait_range(mapping, pos, pos + write_len - 1);
1441 + if (written)
1442 + goto out;
1443 +
1444 +@@ -2298,7 +2291,8 @@ generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov,
1445 + * the file data here, to try to honour O_DIRECT expectations.
1446 + */
1447 + if (unlikely(file->f_flags & O_DIRECT) && written)
1448 +- status = filemap_write_and_wait(mapping);
1449 ++ status = filemap_write_and_wait_range(mapping,
1450 ++ pos, pos + written - 1);
1451 +
1452 + return written ? written : status;
1453 + }
1454 +diff --git a/mm/page-writeback.c b/mm/page-writeback.c
1455 +index 2970e35..08d2b96 100644
1456 +--- a/mm/page-writeback.c
1457 ++++ b/mm/page-writeback.c
1458 +@@ -868,9 +868,11 @@ int write_cache_pages(struct address_space *mapping,
1459 + int done = 0;
1460 + struct pagevec pvec;
1461 + int nr_pages;
1462 ++ pgoff_t uninitialized_var(writeback_index);
1463 + pgoff_t index;
1464 + pgoff_t end; /* Inclusive */
1465 +- int scanned = 0;
1466 ++ pgoff_t done_index;
1467 ++ int cycled;
1468 + int range_whole = 0;
1469 + long nr_to_write = wbc->nr_to_write;
1470 +
1471 +@@ -881,83 +883,134 @@ int write_cache_pages(struct address_space *mapping,
1472 +
1473 + pagevec_init(&pvec, 0);
1474 + if (wbc->range_cyclic) {
1475 +- index = mapping->writeback_index; /* Start from prev offset */
1476 ++ writeback_index = mapping->writeback_index; /* prev offset */
1477 ++ index = writeback_index;
1478 ++ if (index == 0)
1479 ++ cycled = 1;
1480 ++ else
1481 ++ cycled = 0;
1482 + end = -1;
1483 + } else {
1484 + index = wbc->range_start >> PAGE_CACHE_SHIFT;
1485 + end = wbc->range_end >> PAGE_CACHE_SHIFT;
1486 + if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)
1487 + range_whole = 1;
1488 +- scanned = 1;
1489 ++ cycled = 1; /* ignore range_cyclic tests */
1490 + }
1491 + retry:
1492 +- while (!done && (index <= end) &&
1493 +- (nr_pages = pagevec_lookup_tag(&pvec, mapping, &index,
1494 +- PAGECACHE_TAG_DIRTY,
1495 +- min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1))) {
1496 +- unsigned i;
1497 ++ done_index = index;
1498 ++ while (!done && (index <= end)) {
1499 ++ int i;
1500 ++
1501 ++ nr_pages = pagevec_lookup_tag(&pvec, mapping, &index,
1502 ++ PAGECACHE_TAG_DIRTY,
1503 ++ min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1);
1504 ++ if (nr_pages == 0)
1505 ++ break;
1506 +
1507 +- scanned = 1;
1508 + for (i = 0; i < nr_pages; i++) {
1509 + struct page *page = pvec.pages[i];
1510 +
1511 + /*
1512 +- * At this point we hold neither mapping->tree_lock nor
1513 +- * lock on the page itself: the page may be truncated or
1514 +- * invalidated (changing page->mapping to NULL), or even
1515 +- * swizzled back from swapper_space to tmpfs file
1516 +- * mapping
1517 ++ * At this point, the page may be truncated or
1518 ++ * invalidated (changing page->mapping to NULL), or
1519 ++ * even swizzled back from swapper_space to tmpfs file
1520 ++ * mapping. However, page->index will not change
1521 ++ * because we have a reference on the page.
1522 + */
1523 ++ if (page->index > end) {
1524 ++ /*
1525 ++ * can't be range_cyclic (1st pass) because
1526 ++ * end == -1 in that case.
1527 ++ */
1528 ++ done = 1;
1529 ++ break;
1530 ++ }
1531 ++
1532 ++ done_index = page->index + 1;
1533 ++
1534 + lock_page(page);
1535 +
1536 ++ /*
1537 ++ * Page truncated or invalidated. We can freely skip it
1538 ++ * then, even for data integrity operations: the page
1539 ++ * has disappeared concurrently, so there could be no
1540 ++ * real expectation of this data interity operation
1541 ++ * even if there is now a new, dirty page at the same
1542 ++ * pagecache address.
1543 ++ */
1544 + if (unlikely(page->mapping != mapping)) {
1545 ++continue_unlock:
1546 + unlock_page(page);
1547 + continue;
1548 + }
1549 +
1550 +- if (!wbc->range_cyclic && page->index > end) {
1551 +- done = 1;
1552 +- unlock_page(page);
1553 +- continue;
1554 ++ if (!PageDirty(page)) {
1555 ++ /* someone wrote it for us */
1556 ++ goto continue_unlock;
1557 + }
1558 +
1559 +- if (wbc->sync_mode != WB_SYNC_NONE)
1560 +- wait_on_page_writeback(page);
1561 +-
1562 +- if (PageWriteback(page) ||
1563 +- !clear_page_dirty_for_io(page)) {
1564 +- unlock_page(page);
1565 +- continue;
1566 ++ if (PageWriteback(page)) {
1567 ++ if (wbc->sync_mode != WB_SYNC_NONE)
1568 ++ wait_on_page_writeback(page);
1569 ++ else
1570 ++ goto continue_unlock;
1571 + }
1572 +
1573 +- ret = (*writepage)(page, wbc, data);
1574 ++ BUG_ON(PageWriteback(page));
1575 ++ if (!clear_page_dirty_for_io(page))
1576 ++ goto continue_unlock;
1577 +
1578 +- if (unlikely(ret == AOP_WRITEPAGE_ACTIVATE)) {
1579 +- unlock_page(page);
1580 +- ret = 0;
1581 ++ ret = (*writepage)(page, wbc, data);
1582 ++ if (unlikely(ret)) {
1583 ++ if (ret == AOP_WRITEPAGE_ACTIVATE) {
1584 ++ unlock_page(page);
1585 ++ ret = 0;
1586 ++ } else {
1587 ++ /*
1588 ++ * done_index is set past this page,
1589 ++ * so media errors will not choke
1590 ++ * background writeout for the entire
1591 ++ * file. This has consequences for
1592 ++ * range_cyclic semantics (ie. it may
1593 ++ * not be suitable for data integrity
1594 ++ * writeout).
1595 ++ */
1596 ++ done = 1;
1597 ++ break;
1598 ++ }
1599 ++ }
1600 ++
1601 ++ if (wbc->sync_mode == WB_SYNC_NONE) {
1602 ++ wbc->nr_to_write--;
1603 ++ if (wbc->nr_to_write <= 0) {
1604 ++ done = 1;
1605 ++ break;
1606 ++ }
1607 + }
1608 +- if (ret || (--nr_to_write <= 0))
1609 +- done = 1;
1610 + if (wbc->nonblocking && bdi_write_congested(bdi)) {
1611 + wbc->encountered_congestion = 1;
1612 + done = 1;
1613 ++ break;
1614 + }
1615 + }
1616 + pagevec_release(&pvec);
1617 + cond_resched();
1618 + }
1619 +- if (!scanned && !done) {
1620 ++ if (!cycled) {
1621 + /*
1622 ++ * range_cyclic:
1623 + * We hit the last page and there is more work to be done: wrap
1624 + * back to the start of the file
1625 + */
1626 +- scanned = 1;
1627 ++ cycled = 1;
1628 + index = 0;
1629 ++ end = writeback_index - 1;
1630 + goto retry;
1631 + }
1632 + if (!wbc->no_nrwrite_index_update) {
1633 + if (wbc->range_cyclic || (range_whole && nr_to_write > 0))
1634 +- mapping->writeback_index = index;
1635 ++ mapping->writeback_index = done_index;
1636 + wbc->nr_to_write = nr_to_write;
1637 + }
1638 +
1639 +diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
1640 +index 0fa208e..05f198d 100644
1641 +--- a/net/bridge/netfilter/ebtables.c
1642 ++++ b/net/bridge/netfilter/ebtables.c
1643 +@@ -80,7 +80,7 @@ static inline int ebt_do_match (struct ebt_entry_match *m,
1644 + {
1645 + par->match = m->u.match;
1646 + par->matchinfo = m->data;
1647 +- return m->u.match->match(skb, par);
1648 ++ return m->u.match->match(skb, par) ? EBT_MATCH : EBT_NOMATCH;
1649 + }
1650 +
1651 + static inline int ebt_dev_check(char *entry, const struct net_device *device)
1652 +diff --git a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
1653 +index 4e88792..625707a 100644
1654 +--- a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
1655 ++++ b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
1656 +@@ -20,7 +20,7 @@
1657 + #include <net/netfilter/nf_conntrack_core.h>
1658 + #include <net/netfilter/nf_log.h>
1659 +
1660 +-static unsigned long nf_ct_icmp_timeout __read_mostly = 30*HZ;
1661 ++static unsigned int nf_ct_icmp_timeout __read_mostly = 30*HZ;
1662 +
1663 + static bool icmp_pkt_to_tuple(const struct sk_buff *skb, unsigned int dataoff,
1664 + struct nf_conntrack_tuple *tuple)
1665 +diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
1666 +index c5aca0b..9e31f91 100644
1667 +--- a/net/ipv4/tcp.c
1668 ++++ b/net/ipv4/tcp.c
1669 +@@ -578,10 +578,6 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos,
1670 + else if (!ret) {
1671 + if (spliced)
1672 + break;
1673 +- if (flags & SPLICE_F_NONBLOCK) {
1674 +- ret = -EAGAIN;
1675 +- break;
1676 +- }
1677 + if (sock_flag(sk, SOCK_DONE))
1678 + break;
1679 + if (sk->sk_err) {
1680 +@@ -599,6 +595,10 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos,
1681 + ret = -ENOTCONN;
1682 + break;
1683 + }
1684 ++ if (flags & SPLICE_F_NONBLOCK) {
1685 ++ ret = -EAGAIN;
1686 ++ break;
1687 ++ }
1688 + if (!timeo) {
1689 + ret = -EAGAIN;
1690 + break;
1691 +diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
1692 +index 29c7c99..52ee1dc 100644
1693 +--- a/net/ipv6/ip6_fib.c
1694 ++++ b/net/ipv6/ip6_fib.c
1695 +@@ -298,6 +298,10 @@ static void fib6_dump_end(struct netlink_callback *cb)
1696 + struct fib6_walker_t *w = (void*)cb->args[2];
1697 +
1698 + if (w) {
1699 ++ if (cb->args[4]) {
1700 ++ cb->args[4] = 0;
1701 ++ fib6_walker_unlink(w);
1702 ++ }
1703 + cb->args[2] = 0;
1704 + kfree(w);
1705 + }
1706 +@@ -330,15 +334,12 @@ static int fib6_dump_table(struct fib6_table *table, struct sk_buff *skb,
1707 + read_lock_bh(&table->tb6_lock);
1708 + res = fib6_walk_continue(w);
1709 + read_unlock_bh(&table->tb6_lock);
1710 +- if (res != 0) {
1711 +- if (res < 0)
1712 +- fib6_walker_unlink(w);
1713 +- goto end;
1714 ++ if (res <= 0) {
1715 ++ fib6_walker_unlink(w);
1716 ++ cb->args[4] = 0;
1717 + }
1718 +- fib6_walker_unlink(w);
1719 +- cb->args[4] = 0;
1720 + }
1721 +-end:
1722 ++
1723 + return res;
1724 + }
1725 +
1726 +diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
1727 +index 0572617..7cd13e5 100644
1728 +--- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
1729 ++++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
1730 +@@ -26,7 +26,7 @@
1731 + #include <net/netfilter/ipv6/nf_conntrack_icmpv6.h>
1732 + #include <net/netfilter/nf_log.h>
1733 +
1734 +-static unsigned long nf_ct_icmpv6_timeout __read_mostly = 30*HZ;
1735 ++static unsigned int nf_ct_icmpv6_timeout __read_mostly = 30*HZ;
1736 +
1737 + static bool icmpv6_pkt_to_tuple(const struct sk_buff *skb,
1738 + unsigned int dataoff,
1739 +diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
1740 +index 89837a4..bfbf521 100644
1741 +--- a/net/netfilter/x_tables.c
1742 ++++ b/net/netfilter/x_tables.c
1743 +@@ -273,6 +273,10 @@ static int match_revfn(u8 af, const char *name, u8 revision, int *bestp)
1744 + have_rev = 1;
1745 + }
1746 + }
1747 ++
1748 ++ if (af != NFPROTO_UNSPEC && !have_rev)
1749 ++ return match_revfn(NFPROTO_UNSPEC, name, revision, bestp);
1750 ++
1751 + return have_rev;
1752 + }
1753 +
1754 +@@ -289,6 +293,10 @@ static int target_revfn(u8 af, const char *name, u8 revision, int *bestp)
1755 + have_rev = 1;
1756 + }
1757 + }
1758 ++
1759 ++ if (af != NFPROTO_UNSPEC && !have_rev)
1760 ++ return target_revfn(NFPROTO_UNSPEC, name, revision, bestp);
1761 ++
1762 + return have_rev;
1763 + }
1764 +
1765 +diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
1766 +index 246f906..ea51fcd 100644
1767 +--- a/net/sched/cls_u32.c
1768 ++++ b/net/sched/cls_u32.c
1769 +@@ -637,8 +637,9 @@ static int u32_change(struct tcf_proto *tp, unsigned long base, u32 handle,
1770 + break;
1771 +
1772 + n->next = *ins;
1773 +- wmb();
1774 ++ tcf_tree_lock(tp);
1775 + *ins = n;
1776 ++ tcf_tree_unlock(tp);
1777 +
1778 + *arg = (unsigned long)n;
1779 + return 0;
1780 +diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
1781 +index d14f020..d2943a4 100644
1782 +--- a/net/sched/sch_htb.c
1783 ++++ b/net/sched/sch_htb.c
1784 +@@ -924,6 +924,7 @@ static struct sk_buff *htb_dequeue(struct Qdisc *sch)
1785 + }
1786 + }
1787 + sch->qstats.overlimits++;
1788 ++ qdisc_watchdog_cancel(&q->watchdog);
1789 + qdisc_watchdog_schedule(&q->watchdog, next_event);
1790 + fin:
1791 + return skb;
1792 +diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
1793 +index a6a0ea7..679fcde 100644
1794 +--- a/net/sctp/sm_statefuns.c
1795 ++++ b/net/sctp/sm_statefuns.c
1796 +@@ -3691,6 +3691,7 @@ sctp_disposition_t sctp_sf_eat_fwd_tsn(const struct sctp_endpoint *ep,
1797 + {
1798 + struct sctp_chunk *chunk = arg;
1799 + struct sctp_fwdtsn_hdr *fwdtsn_hdr;
1800 ++ struct sctp_fwdtsn_skip *skip;
1801 + __u16 len;
1802 + __u32 tsn;
1803 +
1804 +@@ -3720,6 +3721,12 @@ sctp_disposition_t sctp_sf_eat_fwd_tsn(const struct sctp_endpoint *ep,
1805 + if (sctp_tsnmap_check(&asoc->peer.tsn_map, tsn) < 0)
1806 + goto discard_noforce;
1807 +
1808 ++ /* Silently discard the chunk if stream-id is not valid */
1809 ++ sctp_walk_fwdtsn(skip, chunk) {
1810 ++ if (ntohs(skip->stream) >= asoc->c.sinit_max_instreams)
1811 ++ goto discard_noforce;
1812 ++ }
1813 ++
1814 + sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_FWDTSN, SCTP_U32(tsn));
1815 + if (len > sizeof(struct sctp_fwdtsn_hdr))
1816 + sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_FWDTSN,
1817 +@@ -3751,6 +3758,7 @@ sctp_disposition_t sctp_sf_eat_fwd_tsn_fast(
1818 + {
1819 + struct sctp_chunk *chunk = arg;
1820 + struct sctp_fwdtsn_hdr *fwdtsn_hdr;
1821 ++ struct sctp_fwdtsn_skip *skip;
1822 + __u16 len;
1823 + __u32 tsn;
1824 +
1825 +@@ -3780,6 +3788,12 @@ sctp_disposition_t sctp_sf_eat_fwd_tsn_fast(
1826 + if (sctp_tsnmap_check(&asoc->peer.tsn_map, tsn) < 0)
1827 + goto gen_shutdown;
1828 +
1829 ++ /* Silently discard the chunk if stream-id is not valid */
1830 ++ sctp_walk_fwdtsn(skip, chunk) {
1831 ++ if (ntohs(skip->stream) >= asoc->c.sinit_max_instreams)
1832 ++ goto gen_shutdown;
1833 ++ }
1834 ++
1835 + sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_FWDTSN, SCTP_U32(tsn));
1836 + if (len > sizeof(struct sctp_fwdtsn_hdr))
1837 + sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_FWDTSN,
1838 +diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
1839 +index 9b4e0e9..3c0f421 100644
1840 +--- a/security/keys/keyctl.c
1841 ++++ b/security/keys/keyctl.c
1842 +@@ -270,6 +270,7 @@ long keyctl_join_session_keyring(const char __user *_name)
1843 +
1844 + /* join the session */
1845 + ret = join_session_keyring(name);
1846 ++ kfree(name);
1847 +
1848 + error:
1849 + return ret;
1850 +diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
1851 +index 2dc976d..87bade3 100644
1852 +--- a/sound/pci/hda/patch_analog.c
1853 ++++ b/sound/pci/hda/patch_analog.c
1854 +@@ -629,6 +629,36 @@ static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = {
1855 + HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw),
1856 + HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT),
1857 + HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT),
1858 ++ HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0, HDA_OUTPUT),
1859 ++ HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0, HDA_OUTPUT),
1860 ++ HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT),
1861 ++ HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT),
1862 ++ HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT),
1863 ++ HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT),
1864 ++ HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_OUTPUT),
1865 ++ {
1866 ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1867 ++ .name = "Capture Source",
1868 ++ .info = ad198x_mux_enum_info,
1869 ++ .get = ad198x_mux_enum_get,
1870 ++ .put = ad198x_mux_enum_put,
1871 ++ },
1872 ++ {
1873 ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1874 ++ .name = "External Amplifier",
1875 ++ .info = ad198x_eapd_info,
1876 ++ .get = ad198x_eapd_get,
1877 ++ .put = ad198x_eapd_put,
1878 ++ .private_value = 0x1b | (1 << 8), /* port-D, inversed */
1879 ++ },
1880 ++ { } /* end */
1881 ++};
1882 ++
1883 ++static struct snd_kcontrol_new ad1986a_samsung_mixers[] = {
1884 ++ HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol),
1885 ++ HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw),
1886 ++ HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT),
1887 ++ HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT),
1888 + HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT),
1889 + HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT),
1890 + HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT),
1891 +@@ -917,6 +947,7 @@ enum {
1892 + AD1986A_LAPTOP_EAPD,
1893 + AD1986A_LAPTOP_AUTOMUTE,
1894 + AD1986A_ULTRA,
1895 ++ AD1986A_SAMSUNG,
1896 + AD1986A_MODELS
1897 + };
1898 +
1899 +@@ -927,6 +958,7 @@ static const char *ad1986a_models[AD1986A_MODELS] = {
1900 + [AD1986A_LAPTOP_EAPD] = "laptop-eapd",
1901 + [AD1986A_LAPTOP_AUTOMUTE] = "laptop-automute",
1902 + [AD1986A_ULTRA] = "ultra",
1903 ++ [AD1986A_SAMSUNG] = "samsung",
1904 + };
1905 +
1906 + static struct snd_pci_quirk ad1986a_cfg_tbl[] = {
1907 +@@ -949,9 +981,9 @@ static struct snd_pci_quirk ad1986a_cfg_tbl[] = {
1908 + SND_PCI_QUIRK(0x1179, 0xff40, "Toshiba", AD1986A_LAPTOP_EAPD),
1909 + SND_PCI_QUIRK(0x144d, 0xb03c, "Samsung R55", AD1986A_3STACK),
1910 + SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_LAPTOP),
1911 +- SND_PCI_QUIRK(0x144d, 0xc023, "Samsung X60", AD1986A_LAPTOP_EAPD),
1912 +- SND_PCI_QUIRK(0x144d, 0xc024, "Samsung R65", AD1986A_LAPTOP_EAPD),
1913 +- SND_PCI_QUIRK(0x144d, 0xc026, "Samsung X11", AD1986A_LAPTOP_EAPD),
1914 ++ SND_PCI_QUIRK(0x144d, 0xc023, "Samsung X60", AD1986A_SAMSUNG),
1915 ++ SND_PCI_QUIRK(0x144d, 0xc024, "Samsung R65", AD1986A_SAMSUNG),
1916 ++ SND_PCI_QUIRK(0x144d, 0xc026, "Samsung X11", AD1986A_SAMSUNG),
1917 + SND_PCI_QUIRK(0x144d, 0xc027, "Samsung Q1", AD1986A_ULTRA),
1918 + SND_PCI_QUIRK(0x144d, 0xc504, "Samsung Q35", AD1986A_3STACK),
1919 + SND_PCI_QUIRK(0x17aa, 0x1011, "Lenovo M55", AD1986A_LAPTOP),
1920 +@@ -1033,6 +1065,17 @@ static int patch_ad1986a(struct hda_codec *codec)
1921 + break;
1922 + case AD1986A_LAPTOP_EAPD:
1923 + spec->mixers[0] = ad1986a_laptop_eapd_mixers;
1924 ++ spec->num_init_verbs = 2;
1925 ++ spec->init_verbs[1] = ad1986a_eapd_init_verbs;
1926 ++ spec->multiout.max_channels = 2;
1927 ++ spec->multiout.num_dacs = 1;
1928 ++ spec->multiout.dac_nids = ad1986a_laptop_dac_nids;
1929 ++ if (!is_jack_available(codec, 0x25))
1930 ++ spec->multiout.dig_out_nid = 0;
1931 ++ spec->input_mux = &ad1986a_laptop_eapd_capture_source;
1932 ++ break;
1933 ++ case AD1986A_SAMSUNG:
1934 ++ spec->mixers[0] = ad1986a_samsung_mixers;
1935 + spec->num_init_verbs = 3;
1936 + spec->init_verbs[1] = ad1986a_eapd_init_verbs;
1937 + spec->init_verbs[2] = ad1986a_automic_verbs;
1938 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
1939 +index a378c01..befb699 100644
1940 +--- a/sound/pci/hda/patch_realtek.c
1941 ++++ b/sound/pci/hda/patch_realtek.c
1942 +@@ -10473,6 +10473,7 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = {
1943 + SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
1944 + SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
1945 + SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
1946 ++ SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
1947 + SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
1948 + SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
1949 + SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
1950 +diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
1951 +index 24ff2b8..8b204b8 100644
1952 +--- a/sound/pci/hda/patch_sigmatel.c
1953 ++++ b/sound/pci/hda/patch_sigmatel.c
1954 +@@ -89,6 +89,7 @@ enum {
1955 + STAC_DELL_M4_2,
1956 + STAC_DELL_M4_3,
1957 + STAC_HP_M4,
1958 ++ STAC_HP_DV5,
1959 + STAC_92HD71BXX_MODELS
1960 + };
1961 +
1962 +@@ -1702,6 +1703,7 @@ static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = {
1963 + [STAC_DELL_M4_2] = dell_m4_2_pin_configs,
1964 + [STAC_DELL_M4_3] = dell_m4_3_pin_configs,
1965 + [STAC_HP_M4] = NULL,
1966 ++ [STAC_HP_DV5] = NULL,
1967 + };
1968 +
1969 + static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
1970 +@@ -1710,6 +1712,7 @@ static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
1971 + [STAC_DELL_M4_2] = "dell-m4-2",
1972 + [STAC_DELL_M4_3] = "dell-m4-3",
1973 + [STAC_HP_M4] = "hp-m4",
1974 ++ [STAC_HP_DV5] = "hp-dv5",
1975 + };
1976 +
1977 + static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
1978 +@@ -1722,6 +1725,8 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
1979 + "HP dv7", STAC_HP_M4),
1980 + SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc,
1981 + "HP dv7", STAC_HP_M4),
1982 ++ SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3603,
1983 ++ "HP dv5", STAC_HP_DV5),
1984 + SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a,
1985 + "unknown HP", STAC_HP_M4),
1986 + SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
1987 +@@ -3980,8 +3985,19 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res)
1988 + continue;
1989 + if (presence)
1990 + stac92xx_set_pinctl(codec, cfg->hp_pins[i], val);
1991 ++#if 0 /* FIXME */
1992 ++/* Resetting the pinctl like below may lead to (a sort of) regressions
1993 ++ * on some devices since they use the HP pin actually for line/speaker
1994 ++ * outs although the default pin config shows a different pin (that is
1995 ++ * wrong and useless).
1996 ++ *
1997 ++ * So, it's basically a problem of default pin configs, likely a BIOS issue.
1998 ++ * But, disabling the code below just works around it, and I'm too tired of
1999 ++ * bug reports with such devices...
2000 ++ */
2001 + else
2002 + stac92xx_reset_pinctl(codec, cfg->hp_pins[i], val);
2003 ++#endif /* FIXME */
2004 + }
2005 + }
2006 +
2007 +diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c
2008 +index 98c6a8c..e9e829e 100644
2009 +--- a/sound/pci/oxygen/virtuoso.c
2010 ++++ b/sound/pci/oxygen/virtuoso.c
2011 +@@ -26,7 +26,7 @@
2012 + * SPI 0 -> 1st PCM1796 (front)
2013 + * SPI 1 -> 2nd PCM1796 (surround)
2014 + * SPI 2 -> 3rd PCM1796 (center/LFE)
2015 +- * SPI 4 -> 4th PCM1796 (back)
2016 ++ * SPI 4 -> 4th PCM1796 (back) and EEPROM self-destruct (do not use!)
2017 + *
2018 + * GPIO 2 -> M0 of CS5381
2019 + * GPIO 3 -> M1 of CS5381
2020 +@@ -207,6 +207,12 @@ static void xonar_gpio_changed(struct oxygen *chip);
2021 + static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec,
2022 + u8 reg, u8 value)
2023 + {
2024 ++ /*
2025 ++ * We don't want to do writes on SPI 4 because the EEPROM, which shares
2026 ++ * the same pin, might get confused and broken. We'd better take care
2027 ++ * that the driver works with the default register values ...
2028 ++ */
2029 ++#if 0
2030 + /* maps ALSA channel pair number to SPI output */
2031 + static const u8 codec_map[4] = {
2032 + 0, 1, 2, 4
2033 +@@ -217,6 +223,7 @@ static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec,
2034 + (codec_map[codec] << OXYGEN_SPI_CODEC_SHIFT) |
2035 + OXYGEN_SPI_CEN_LATCH_CLOCK_HI,
2036 + (reg << 8) | value);
2037 ++#endif
2038 + }
2039 +
2040 + static inline void pcm1796_write_i2c(struct oxygen *chip, unsigned int codec,
2041 +@@ -750,6 +757,9 @@ static const DECLARE_TLV_DB_SCALE(cs4362a_db_scale, -12700, 100, 0);
2042 +
2043 + static int xonar_d2_control_filter(struct snd_kcontrol_new *template)
2044 + {
2045 ++ if (!strncmp(template->name, "Master Playback ", 16))
2046 ++ /* disable volume/mute because they would require SPI writes */
2047 ++ return 1;
2048 + if (!strncmp(template->name, "CD Capture ", 11))
2049 + /* CD in is actually connected to the video in pin */
2050 + template->private_value ^= AC97_CD ^ AC97_VIDEO;
2051 +@@ -840,9 +850,8 @@ static const struct oxygen_model model_xonar_d2 = {
2052 + .dac_volume_min = 0x0f,
2053 + .dac_volume_max = 0xff,
2054 + .misc_flags = OXYGEN_MISC_MIDI,
2055 +- .function_flags = OXYGEN_FUNCTION_SPI |
2056 +- OXYGEN_FUNCTION_ENABLE_SPI_4_5,
2057 +- .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
2058 ++ .function_flags = OXYGEN_FUNCTION_SPI,
2059 ++ .dac_i2s_format = OXYGEN_I2S_FORMAT_I2S,
2060 + .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
2061 + };
2062 +
2063
2064 Deleted: genpatches-2.6/trunk/2.6.28/2000_sctp-fwd-tsn-overflow.patch
2065 ===================================================================
2066 --- genpatches-2.6/trunk/2.6.28/2000_sctp-fwd-tsn-overflow.patch 2009-01-25 09:03:04 UTC (rev 1486)
2067 +++ genpatches-2.6/trunk/2.6.28/2000_sctp-fwd-tsn-overflow.patch 2009-01-25 15:38:04 UTC (rev 1487)
2068 @@ -1,76 +0,0 @@
2069 -From: Wei Yongjun <yjwei@××××××××××.com>
2070 -Date: Fri, 26 Dec 2008 00:58:11 +0000 (-0800)
2071 -Subject: sctp: Avoid memory overflow while FWD-TSN chunk is received with bad stream ID
2072 -X-Git-Tag: v2.6.29-rc1~581^2~75
2073 -X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=9fcb95a105758b81ef0131cd18e2db5149f13e95
2074 -
2075 -sctp: Avoid memory overflow while FWD-TSN chunk is received with bad stream ID
2076 -
2077 -If FWD-TSN chunk is received with bad stream ID, the sctp will not do the
2078 -validity check, this may cause memory overflow when overwrite the TSN of
2079 -the stream ID.
2080 -
2081 -The FORWARD-TSN chunk is like this:
2082 -
2083 -FORWARD-TSN chunk
2084 - Type = 192
2085 - Flags = 0
2086 - Length = 172
2087 - NewTSN = 99
2088 - Stream = 10000
2089 - StreamSequence = 0xFFFF
2090 -
2091 -This patch fix this problem by discard the chunk if stream ID is not
2092 -less than MIS.
2093 -
2094 -Signed-off-by: Wei Yongjun <yjwei@××××××××××.com>
2095 -Signed-off-by: Vlad Yasevich <vladislav.yasevich@××.com>
2096 -Signed-off-by: David S. Miller <davem@×××××××××.net>
2097 ----
2098 -
2099 -diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
2100 -index 9f2a3eb..1c4e5d6 100644
2101 ---- a/net/sctp/sm_statefuns.c
2102 -+++ b/net/sctp/sm_statefuns.c
2103 -@@ -3689,6 +3689,7 @@ sctp_disposition_t sctp_sf_eat_fwd_tsn(const struct sctp_endpoint *ep,
2104 - {
2105 - struct sctp_chunk *chunk = arg;
2106 - struct sctp_fwdtsn_hdr *fwdtsn_hdr;
2107 -+ struct sctp_fwdtsn_skip *skip;
2108 - __u16 len;
2109 - __u32 tsn;
2110 -
2111 -@@ -3718,6 +3719,12 @@ sctp_disposition_t sctp_sf_eat_fwd_tsn(const struct sctp_endpoint *ep,
2112 - if (sctp_tsnmap_check(&asoc->peer.tsn_map, tsn) < 0)
2113 - goto discard_noforce;
2114 -
2115 -+ /* Silently discard the chunk if stream-id is not valid */
2116 -+ sctp_walk_fwdtsn(skip, chunk) {
2117 -+ if (ntohs(skip->stream) >= asoc->c.sinit_max_instreams)
2118 -+ goto discard_noforce;
2119 -+ }
2120 -+
2121 - sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_FWDTSN, SCTP_U32(tsn));
2122 - if (len > sizeof(struct sctp_fwdtsn_hdr))
2123 - sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_FWDTSN,
2124 -@@ -3749,6 +3756,7 @@ sctp_disposition_t sctp_sf_eat_fwd_tsn_fast(
2125 - {
2126 - struct sctp_chunk *chunk = arg;
2127 - struct sctp_fwdtsn_hdr *fwdtsn_hdr;
2128 -+ struct sctp_fwdtsn_skip *skip;
2129 - __u16 len;
2130 - __u32 tsn;
2131 -
2132 -@@ -3778,6 +3786,12 @@ sctp_disposition_t sctp_sf_eat_fwd_tsn_fast(
2133 - if (sctp_tsnmap_check(&asoc->peer.tsn_map, tsn) < 0)
2134 - goto gen_shutdown;
2135 -
2136 -+ /* Silently discard the chunk if stream-id is not valid */
2137 -+ sctp_walk_fwdtsn(skip, chunk) {
2138 -+ if (ntohs(skip->stream) >= asoc->c.sinit_max_instreams)
2139 -+ goto gen_shutdown;
2140 -+ }
2141 -+
2142 - sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_FWDTSN, SCTP_U32(tsn));
2143 - if (len > sizeof(struct sctp_fwdtsn_hdr))
2144 - sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_FWDTSN,
2145
2146 Deleted: genpatches-2.6/trunk/2.6.28/2300_usb-reenable-interface.patch
2147 ===================================================================
2148 --- genpatches-2.6/trunk/2.6.28/2300_usb-reenable-interface.patch 2009-01-25 09:03:04 UTC (rev 1486)
2149 +++ genpatches-2.6/trunk/2.6.28/2300_usb-reenable-interface.patch 2009-01-25 15:38:04 UTC (rev 1487)
2150 @@ -1,181 +0,0 @@
2151 -http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/gregkh-04-usb/usb-re-enable-interface-after-driver-unbinds.patch
2152 -
2153 -From stern@×××××××××××××××.edu Mon Jan 5 16:09:39 2009
2154 -From: Alan Stern <stern@×××××××××××××××.edu>
2155 -Date: Wed, 31 Dec 2008 11:31:33 -0500 (EST)
2156 -Subject: USB: re-enable interface after driver unbinds
2157 -To: Greg KH <greg@×××××.com>
2158 -Message-ID: <Pine.LNX.4.44L0.0812311129430.2471-100000@××××××××××××××××.org>
2159 -
2160 -
2161 -This patch (as1197) fixes an error introduced recently. Since a
2162 -significant number of devices can't handle Set-Interface requests, we
2163 -no longer call usb_set_interface() when a driver unbinds from an
2164 -interface, provided the interface is already in altsetting 0. However
2165 -the interface still does get disabled, and the call to
2166 -usb_set_interface() was the only thing re-enabling it. Since the
2167 -interface doesn't get re-enabled, further attempts to use it fail.
2168 -
2169 -So the patch adds a call to usb_enable_interface() when a driver
2170 -unbinds and the interface is in altsetting 0. For this to work
2171 -right, the interface's endpoints have to be re-enabled but their
2172 -toggles have to be left alone. Therefore an additional argument is
2173 -added to usb_enable_endpoint() and usb_enable_interface(), a flag
2174 -indicating whether or not the endpoint toggles should be reset.
2175 -
2176 -This is a forward-ported version of a patch which fixes Bugzilla
2177 -#12301.
2178 -
2179 -Signed-off-by: Alan Stern <stern@×××××××××××××××.edu>
2180 -Reported-by: David Roka <roka@×××××.hu>
2181 -Reported-by: Erik Ekman <erik@××××.se>
2182 -Tested-by: Erik Ekman <erik@××××.se>
2183 -Tested-by: Alon Bar-Lev <alon.barlev@×××××.com>
2184 -Signed-off-by: Greg Kroah-Hartman <gregkh@××××.de>
2185 -
2186 -Index: 2.6.28/drivers/usb/core/usb.h
2187 -===================================================================
2188 ---- 2.6.28.orig/drivers/usb/core/usb.h
2189 -+++ 2.6.28/drivers/usb/core/usb.h
2190 -@@ -10,7 +10,9 @@ extern int usb_create_ep_files(struct de
2191 - extern void usb_remove_ep_files(struct usb_host_endpoint *endpoint);
2192 -
2193 - extern void usb_enable_endpoint(struct usb_device *dev,
2194 -- struct usb_host_endpoint *ep);
2195 -+ struct usb_host_endpoint *ep, bool reset_toggle);
2196 -+extern void usb_enable_interface(struct usb_device *dev,
2197 -+ struct usb_interface *intf, bool reset_toggles);
2198 - extern void usb_disable_endpoint(struct usb_device *dev, unsigned int epaddr);
2199 - extern void usb_disable_interface(struct usb_device *dev,
2200 - struct usb_interface *intf);
2201 -Index: 2.6.28/drivers/usb/core/driver.c
2202 -===================================================================
2203 ---- 2.6.28.orig/drivers/usb/core/driver.c
2204 -+++ 2.6.28/drivers/usb/core/driver.c
2205 -@@ -279,9 +279,12 @@ static int usb_unbind_interface(struct d
2206 - * altsetting means creating new endpoint device entries).
2207 - * When either of these happens, defer the Set-Interface.
2208 - */
2209 -- if (intf->cur_altsetting->desc.bAlternateSetting == 0)
2210 -- ; /* Already in altsetting 0 so skip Set-Interface */
2211 -- else if (!error && intf->dev.power.status == DPM_ON)
2212 -+ if (intf->cur_altsetting->desc.bAlternateSetting == 0) {
2213 -+ /* Already in altsetting 0 so skip Set-Interface.
2214 -+ * Just re-enable it without affecting the endpoint toggles.
2215 -+ */
2216 -+ usb_enable_interface(udev, intf, false);
2217 -+ } else if (!error && intf->dev.power.status == DPM_ON)
2218 - usb_set_interface(udev, intf->altsetting[0].
2219 - desc.bInterfaceNumber, 0);
2220 - else
2221 -Index: 2.6.28/drivers/usb/core/message.c
2222 -===================================================================
2223 ---- 2.6.28.orig/drivers/usb/core/message.c
2224 -+++ 2.6.28/drivers/usb/core/message.c
2225 -@@ -1113,22 +1113,26 @@ void usb_disable_device(struct usb_devic
2226 - * usb_enable_endpoint - Enable an endpoint for USB communications
2227 - * @dev: the device whose interface is being enabled
2228 - * @ep: the endpoint
2229 -+ * @reset_toggle: flag to set the endpoint's toggle back to 0
2230 - *
2231 -- * Resets the endpoint toggle, and sets dev->ep_{in,out} pointers.
2232 -+ * Resets the endpoint toggle if asked, and sets dev->ep_{in,out} pointers.
2233 - * For control endpoints, both the input and output sides are handled.
2234 - */
2235 --void usb_enable_endpoint(struct usb_device *dev, struct usb_host_endpoint *ep)
2236 -+void usb_enable_endpoint(struct usb_device *dev, struct usb_host_endpoint *ep,
2237 -+ bool reset_toggle)
2238 - {
2239 - int epnum = usb_endpoint_num(&ep->desc);
2240 - int is_out = usb_endpoint_dir_out(&ep->desc);
2241 - int is_control = usb_endpoint_xfer_control(&ep->desc);
2242 -
2243 - if (is_out || is_control) {
2244 -- usb_settoggle(dev, epnum, 1, 0);
2245 -+ if (reset_toggle)
2246 -+ usb_settoggle(dev, epnum, 1, 0);
2247 - dev->ep_out[epnum] = ep;
2248 - }
2249 - if (!is_out || is_control) {
2250 -- usb_settoggle(dev, epnum, 0, 0);
2251 -+ if (reset_toggle)
2252 -+ usb_settoggle(dev, epnum, 0, 0);
2253 - dev->ep_in[epnum] = ep;
2254 - }
2255 - ep->enabled = 1;
2256 -@@ -1138,17 +1142,18 @@ void usb_enable_endpoint(struct usb_devi
2257 - * usb_enable_interface - Enable all the endpoints for an interface
2258 - * @dev: the device whose interface is being enabled
2259 - * @intf: pointer to the interface descriptor
2260 -+ * @reset_toggles: flag to set the endpoints' toggles back to 0
2261 - *
2262 - * Enables all the endpoints for the interface's current altsetting.
2263 - */
2264 --static void usb_enable_interface(struct usb_device *dev,
2265 -- struct usb_interface *intf)
2266 -+void usb_enable_interface(struct usb_device *dev,
2267 -+ struct usb_interface *intf, bool reset_toggles)
2268 - {
2269 - struct usb_host_interface *alt = intf->cur_altsetting;
2270 - int i;
2271 -
2272 - for (i = 0; i < alt->desc.bNumEndpoints; ++i)
2273 -- usb_enable_endpoint(dev, &alt->endpoint[i]);
2274 -+ usb_enable_endpoint(dev, &alt->endpoint[i], reset_toggles);
2275 - }
2276 -
2277 - /**
2278 -@@ -1271,7 +1276,7 @@ int usb_set_interface(struct usb_device
2279 - * during the SETUP stage - hence EP0 toggles are "don't care" here.
2280 - * (Likewise, EP0 never "halts" on well designed devices.)
2281 - */
2282 -- usb_enable_interface(dev, iface);
2283 -+ usb_enable_interface(dev, iface, true);
2284 - if (device_is_registered(&iface->dev))
2285 - usb_create_sysfs_intf_files(iface);
2286 -
2287 -@@ -1346,7 +1351,7 @@ int usb_reset_configuration(struct usb_d
2288 - alt = &intf->altsetting[0];
2289 -
2290 - intf->cur_altsetting = alt;
2291 -- usb_enable_interface(dev, intf);
2292 -+ usb_enable_interface(dev, intf, true);
2293 - if (device_is_registered(&intf->dev))
2294 - usb_create_sysfs_intf_files(intf);
2295 - }
2296 -@@ -1604,7 +1609,7 @@ free_interfaces:
2297 - alt = &intf->altsetting[0];
2298 -
2299 - intf->cur_altsetting = alt;
2300 -- usb_enable_interface(dev, intf);
2301 -+ usb_enable_interface(dev, intf, true);
2302 - intf->dev.parent = &dev->dev;
2303 - intf->dev.driver = NULL;
2304 - intf->dev.bus = &usb_bus_type;
2305 -Index: 2.6.28/drivers/usb/core/usb.c
2306 -===================================================================
2307 ---- 2.6.28.orig/drivers/usb/core/usb.c
2308 -+++ 2.6.28/drivers/usb/core/usb.c
2309 -@@ -362,7 +362,7 @@ struct usb_device *usb_alloc_dev(struct
2310 - dev->ep0.desc.bLength = USB_DT_ENDPOINT_SIZE;
2311 - dev->ep0.desc.bDescriptorType = USB_DT_ENDPOINT;
2312 - /* ep0 maxpacket comes later, from device descriptor */
2313 -- usb_enable_endpoint(dev, &dev->ep0);
2314 -+ usb_enable_endpoint(dev, &dev->ep0, true);
2315 - dev->can_submit = 1;
2316 -
2317 - /* Save readable and stable topology id, distinguishing devices
2318 -Index: 2.6.28/drivers/usb/core/hub.c
2319 -===================================================================
2320 ---- 2.6.28.orig/drivers/usb/core/hub.c
2321 -+++ 2.6.28/drivers/usb/core/hub.c
2322 -@@ -2385,7 +2385,7 @@ void usb_ep0_reinit(struct usb_device *u
2323 - {
2324 - usb_disable_endpoint(udev, 0 + USB_DIR_IN);
2325 - usb_disable_endpoint(udev, 0 + USB_DIR_OUT);
2326 -- usb_enable_endpoint(udev, &udev->ep0);
2327 -+ usb_enable_endpoint(udev, &udev->ep0, true);
2328 - }
2329 - EXPORT_SYMBOL_GPL(usb_ep0_reinit);
2330 -
2331 -
2332
2333 Deleted: genpatches-2.6/trunk/2.6.28/2515_nokia-6300-wrong-capacity.patch
2334 ===================================================================
2335 --- genpatches-2.6/trunk/2.6.28/2515_nokia-6300-wrong-capacity.patch 2009-01-25 09:03:04 UTC (rev 1486)
2336 +++ genpatches-2.6/trunk/2.6.28/2515_nokia-6300-wrong-capacity.patch 2009-01-25 15:38:04 UTC (rev 1487)
2337 @@ -1,49 +0,0 @@
2338 -Message-ID: <496C6C6A.1050407@×××××××××.ru>
2339 -Date: Tue, 13 Jan 2009 13:26:50 +0300
2340 -From: Sergey Ovcharenko <velegrin@×××××××××.ru>
2341 -User-Agent: Thunderbird 2.0.0.14 (X11/20080603)
2342 -MIME-Version: 1.0
2343 -To: stern@×××××××××××××××.edu, linux-usb@×××××××××××.org,
2344 - usb-storage@××××××××××××××××××××.net
2345 -
2346 -Petr Lanc reported problems with his nokia 6300 in mass-storage mode:
2347 -http://bugs.gentoo.org/show_bug.cgi?id=253034
2348 -
2349 -The number of reported sectors is off-by-one.
2350 -This bug used to be fixed,but the devices revision
2351 -changed to 7.00
2352 -
2353 -Signed-off-by: Sergey Ovcharenko <velegrin@×××××××××.ru>
2354 ----
2355 -/proc/bus/usb/devices:
2356 -T: Bus=02 Lev=01 Prnt=01 Port=04 Cnt=01 Dev#= 4 Spd=12 MxCh= 0
2357 -D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
2358 -P: Vendor=0421 ProdID=04fa Rev= 7.00
2359 -S: Manufacturer=Nokia
2360 -S: Product=Nokia 6300
2361 -S: SerialNumber=356857024913660
2362 -C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=100mA
2363 -I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
2364 -E: Ad=81(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
2365 -E: Ad=01(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
2366 -
2367 -
2368 -Index: linux-2.6.27-gentoo-r6/drivers/usb/storage/unusual_devs.h
2369 -===================================================================
2370 ---- linux-2.6.27-gentoo-r7/drivers/usb/storage/unusual_devs.h.orig
2371 -+++ linux-2.6.27-gentoo-r7/drivers/usb/storage/unusual_devs.h
2372 -@@ -247,7 +247,7 @@ UNUSUAL_DEV( 0x0421, 0x04b9, 0x0500, 0x
2373 - US_FL_FIX_CAPACITY ),
2374 -
2375 - /* Reported by Richard Nauber <RichardNauber@×××.de> */
2376 --UNUSUAL_DEV( 0x0421, 0x04fa, 0x0550, 0x0660,
2377 -+UNUSUAL_DEV( 0x0421, 0x04fa, 0x0550, 0x0700,
2378 - "Nokia",
2379 - "6300",
2380 -
2381 - US_SC_DEVICE, US_PR_DEVICE, NULL,
2382 -
2383 -
2384 -
2385 -
2386 -
2387
2388 Deleted: genpatches-2.6/trunk/2.6.28/2700_hda-asus-mic-input.patch
2389 ===================================================================
2390 --- genpatches-2.6/trunk/2.6.28/2700_hda-asus-mic-input.patch 2009-01-25 09:03:04 UTC (rev 1486)
2391 +++ genpatches-2.6/trunk/2.6.28/2700_hda-asus-mic-input.patch 2009-01-25 15:38:04 UTC (rev 1487)
2392 @@ -1,125 +0,0 @@
2393 -From: Takashi Iwai <tiwai@××××.de>
2394 -Date: Fri, 21 Nov 2008 01:25:48 +0000 (+0100)
2395 -Subject: ALSA: hda - make laptop-eapd model back for AD1986A
2396 -X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftiwai%2Fsound-2.6.git;a=commitdiff_plain;h=1725b82a6e2721612a3572d0336f51f1f1c3cf54
2397 -
2398 -ALSA: hda - make laptop-eapd model back for AD1986A
2399 -
2400 -The changes specific for Samsung laptops seem unapplicable to other
2401 -hardware models like ASUS. The mic inputs are lost on such hardware
2402 -by the change 5d5d5f43f1b835c375de9bd270cce030d16e2871.
2403 -
2404 -This patch adds back the old laptop-eapd model, and create a new
2405 -model "samsung" for the new one specific to Samsung laptops with
2406 -automatic mic selection feature.
2407 -
2408 -Reference: kernel bugzilla #12070
2409 - http://bugzilla.kernel.org/show_bug.cgi?id=12070
2410 -
2411 -Signed-off-by: Takashi Iwai <tiwai@××××.de>
2412 ----
2413 -
2414 -diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt
2415 -index 010aa66..e55081f 100644
2416 ---- a/Documentation/sound/alsa/ALSA-Configuration.txt
2417 -+++ b/Documentation/sound/alsa/ALSA-Configuration.txt
2418 -@@ -984,9 +984,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
2419 - 6stack 6-jack, separate surrounds (default)
2420 - 3stack 3-stack, shared surrounds
2421 - laptop 2-channel only (FSC V2060, Samsung M50)
2422 -- laptop-eapd 2-channel with EAPD (Samsung R65, ASUS A6J)
2423 -+ laptop-eapd 2-channel with EAPD (ASUS A6J)
2424 - laptop-automute 2-channel with EAPD and HP-automute (Lenovo N100)
2425 - ultra 2-channel with EAPD (Samsung Ultra tablet PC)
2426 -+ samsung 2-channel with EAPD (Samsung R65)
2427 -
2428 - AD1988/AD1988B/AD1989A/AD1989B
2429 - 6stack 6-jack
2430 -diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
2431 -index 032cbb4..0cc6be1 100644
2432 ---- a/sound/pci/hda/patch_analog.c
2433 -+++ b/sound/pci/hda/patch_analog.c
2434 -@@ -642,6 +642,36 @@ static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = {
2435 - HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw),
2436 - HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT),
2437 - HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT),
2438 -+ HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0, HDA_OUTPUT),
2439 -+ HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0, HDA_OUTPUT),
2440 -+ HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT),
2441 -+ HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT),
2442 -+ HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT),
2443 -+ HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT),
2444 -+ HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_OUTPUT),
2445 -+ {
2446 -+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2447 -+ .name = "Capture Source",
2448 -+ .info = ad198x_mux_enum_info,
2449 -+ .get = ad198x_mux_enum_get,
2450 -+ .put = ad198x_mux_enum_put,
2451 -+ },
2452 -+ {
2453 -+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2454 -+ .name = "External Amplifier",
2455 -+ .info = ad198x_eapd_info,
2456 -+ .get = ad198x_eapd_get,
2457 -+ .put = ad198x_eapd_put,
2458 -+ .private_value = 0x1b | (1 << 8), /* port-D, inversed */
2459 -+ },
2460 -+ { } /* end */
2461 -+};
2462 -+
2463 -+static struct snd_kcontrol_new ad1986a_samsung_mixers[] = {
2464 -+ HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol),
2465 -+ HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw),
2466 -+ HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT),
2467 -+ HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT),
2468 - HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT),
2469 - HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT),
2470 - HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT),
2471 -@@ -930,6 +960,7 @@ enum {
2472 - AD1986A_LAPTOP_EAPD,
2473 - AD1986A_LAPTOP_AUTOMUTE,
2474 - AD1986A_ULTRA,
2475 -+ AD1986A_SAMSUNG,
2476 - AD1986A_MODELS
2477 - };
2478 -
2479 -@@ -940,6 +971,7 @@ static const char *ad1986a_models[AD1986A_MODELS] = {
2480 - [AD1986A_LAPTOP_EAPD] = "laptop-eapd",
2481 - [AD1986A_LAPTOP_AUTOMUTE] = "laptop-automute",
2482 - [AD1986A_ULTRA] = "ultra",
2483 -+ [AD1986A_SAMSUNG] = "samsung",
2484 - };
2485 -
2486 - static struct snd_pci_quirk ad1986a_cfg_tbl[] = {
2487 -@@ -962,9 +994,9 @@ static struct snd_pci_quirk ad1986a_cfg_tbl[] = {
2488 - SND_PCI_QUIRK(0x1179, 0xff40, "Toshiba", AD1986A_LAPTOP_EAPD),
2489 - SND_PCI_QUIRK(0x144d, 0xb03c, "Samsung R55", AD1986A_3STACK),
2490 - SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_LAPTOP),
2491 -- SND_PCI_QUIRK(0x144d, 0xc023, "Samsung X60", AD1986A_LAPTOP_EAPD),
2492 -- SND_PCI_QUIRK(0x144d, 0xc024, "Samsung R65", AD1986A_LAPTOP_EAPD),
2493 -- SND_PCI_QUIRK(0x144d, 0xc026, "Samsung X11", AD1986A_LAPTOP_EAPD),
2494 -+ SND_PCI_QUIRK(0x144d, 0xc023, "Samsung X60", AD1986A_SAMSUNG),
2495 -+ SND_PCI_QUIRK(0x144d, 0xc024, "Samsung R65", AD1986A_SAMSUNG),
2496 -+ SND_PCI_QUIRK(0x144d, 0xc026, "Samsung X11", AD1986A_SAMSUNG),
2497 - SND_PCI_QUIRK(0x144d, 0xc027, "Samsung Q1", AD1986A_ULTRA),
2498 - SND_PCI_QUIRK(0x144d, 0xc504, "Samsung Q35", AD1986A_3STACK),
2499 - SND_PCI_QUIRK(0x17aa, 0x1011, "Lenovo M55", AD1986A_LAPTOP),
2500 -@@ -1046,6 +1078,17 @@ static int patch_ad1986a(struct hda_codec *codec)
2501 - break;
2502 - case AD1986A_LAPTOP_EAPD:
2503 - spec->mixers[0] = ad1986a_laptop_eapd_mixers;
2504 -+ spec->num_init_verbs = 2;
2505 -+ spec->init_verbs[1] = ad1986a_eapd_init_verbs;
2506 -+ spec->multiout.max_channels = 2;
2507 -+ spec->multiout.num_dacs = 1;
2508 -+ spec->multiout.dac_nids = ad1986a_laptop_dac_nids;
2509 -+ if (!is_jack_available(codec, 0x25))
2510 -+ spec->multiout.dig_out_nid = 0;
2511 -+ spec->input_mux = &ad1986a_laptop_eapd_capture_source;
2512 -+ break;
2513 -+ case AD1986A_SAMSUNG:
2514 -+ spec->mixers[0] = ad1986a_samsung_mixers;
2515 - spec->num_init_verbs = 3;
2516 - spec->init_verbs[1] = ad1986a_eapd_init_verbs;
2517 - spec->init_verbs[2] = ad1986a_automic_verbs;