Magellan Linux

Contents of /trunk/kernel26-alx/patches-2.6.23-r1/0105-2.6.23.6-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 658 - (show annotations) (download)
Mon Jun 23 21:39:39 2008 UTC (15 years, 10 months ago) by niro
File size: 55568 byte(s)
2.6.23-alx-r1: new default as we fix the via epia clocksource=tsc quircks
-linux-2.6.23.17
-fbcondecor-0.9.4
-squashfs-3.3
-unionfs-2.3.3
-ipw3945-1.2.2
-mptbase-vmware fix

1 diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c
2 index 2cbb9aa..37b651e 100644
3 --- a/drivers/acpi/sleep/main.c
4 +++ b/drivers/acpi/sleep/main.c
5 @@ -170,8 +170,8 @@ static int acpi_pm_finish(suspend_state_t pm_state)
6 {
7 u32 acpi_state = acpi_target_sleep_state;
8
9 - acpi_leave_sleep_state(acpi_state);
10 acpi_disable_wakeup_device(acpi_state);
11 + acpi_leave_sleep_state(acpi_state);
12
13 /* reset firmware waking vector */
14 acpi_set_firmware_waking_vector((acpi_physical_address) 0);
15 @@ -256,8 +256,8 @@ static int acpi_hibernation_enter(void)
16
17 static void acpi_hibernation_finish(void)
18 {
19 - acpi_leave_sleep_state(ACPI_STATE_S4);
20 acpi_disable_wakeup_device(ACPI_STATE_S4);
21 + acpi_leave_sleep_state(ACPI_STATE_S4);
22
23 /* reset firmware waking vector */
24 acpi_set_firmware_waking_vector((acpi_physical_address) 0);
25 @@ -389,6 +389,7 @@ static void acpi_power_off(void)
26 /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
27 printk("%s called\n", __FUNCTION__);
28 local_irq_disable();
29 + acpi_enable_wakeup_device(ACPI_STATE_S5);
30 acpi_enter_sleep_state(ACPI_STATE_S5);
31 }
32
33 diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
34 index c168203..d684208 100644
35 --- a/drivers/ata/ahci.c
36 +++ b/drivers/ata/ahci.c
37 @@ -41,6 +41,7 @@
38 #include <linux/interrupt.h>
39 #include <linux/dma-mapping.h>
40 #include <linux/device.h>
41 +#include <linux/dmi.h>
42 #include <scsi/scsi_host.h>
43 #include <scsi/scsi_cmnd.h>
44 #include <linux/libata.h>
45 @@ -231,6 +232,7 @@ static void ahci_freeze(struct ata_port *ap);
46 static void ahci_thaw(struct ata_port *ap);
47 static void ahci_error_handler(struct ata_port *ap);
48 static void ahci_vt8251_error_handler(struct ata_port *ap);
49 +static void ahci_p5wdh_error_handler(struct ata_port *ap);
50 static void ahci_post_internal_cmd(struct ata_queued_cmd *qc);
51 static int ahci_port_resume(struct ata_port *ap);
52 static unsigned int ahci_fill_sg(struct ata_queued_cmd *qc, void *cmd_tbl);
53 @@ -329,6 +331,40 @@ static const struct ata_port_operations ahci_vt8251_ops = {
54 .port_stop = ahci_port_stop,
55 };
56
57 +static const struct ata_port_operations ahci_p5wdh_ops = {
58 + .port_disable = ata_port_disable,
59 +
60 + .check_status = ahci_check_status,
61 + .check_altstatus = ahci_check_status,
62 + .dev_select = ata_noop_dev_select,
63 +
64 + .tf_read = ahci_tf_read,
65 +
66 + .qc_prep = ahci_qc_prep,
67 + .qc_issue = ahci_qc_issue,
68 +
69 + .irq_clear = ahci_irq_clear,
70 + .irq_on = ata_dummy_irq_on,
71 + .irq_ack = ata_dummy_irq_ack,
72 +
73 + .scr_read = ahci_scr_read,
74 + .scr_write = ahci_scr_write,
75 +
76 + .freeze = ahci_freeze,
77 + .thaw = ahci_thaw,
78 +
79 + .error_handler = ahci_p5wdh_error_handler,
80 + .post_internal_cmd = ahci_post_internal_cmd,
81 +
82 +#ifdef CONFIG_PM
83 + .port_suspend = ahci_port_suspend,
84 + .port_resume = ahci_port_resume,
85 +#endif
86 +
87 + .port_start = ahci_port_start,
88 + .port_stop = ahci_port_stop,
89 +};
90 +
91 static const struct ata_port_info ahci_port_info[] = {
92 /* board_ahci */
93 {
94 @@ -1176,6 +1212,52 @@ static int ahci_vt8251_hardreset(struct ata_port *ap, unsigned int *class,
95 return rc ?: -EAGAIN;
96 }
97
98 +static int ahci_p5wdh_hardreset(struct ata_port *ap, unsigned int *class,
99 + unsigned long deadline)
100 +{
101 + struct ahci_port_priv *pp = ap->private_data;
102 + u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG;
103 + struct ata_taskfile tf;
104 + int rc;
105 +
106 + ahci_stop_engine(ap);
107 +
108 + /* clear D2H reception area to properly wait for D2H FIS */
109 + ata_tf_init(ap->device, &tf);
110 + tf.command = 0x80;
111 + ata_tf_to_fis(&tf, 0, 0, d2h_fis);
112 +
113 + rc = sata_port_hardreset(ap, sata_ehc_deb_timing(&ap->eh_context),
114 + deadline);
115 +
116 + ahci_start_engine(ap);
117 +
118 + if (rc || ata_port_offline(ap))
119 + return rc;
120 +
121 + /* spec mandates ">= 2ms" before checking status */
122 + msleep(150);
123 +
124 + /* The pseudo configuration device on SIMG4726 attached to
125 + * ASUS P5W-DH Deluxe doesn't send signature FIS after
126 + * hardreset if no device is attached to the first downstream
127 + * port && the pseudo device locks up on SRST w/ PMP==0. To
128 + * work around this, wait for !BSY only briefly. If BSY isn't
129 + * cleared, perform CLO and proceed to IDENTIFY (achieved by
130 + * ATA_LFLAG_NO_SRST and ATA_LFLAG_ASSUME_ATA).
131 + *
132 + * Wait for two seconds. Devices attached to downstream port
133 + * which can't process the following IDENTIFY after this will
134 + * have to be reset again. For most cases, this should
135 + * suffice while making probing snappish enough.
136 + */
137 + rc = ata_wait_ready(ap, jiffies + 2 * HZ);
138 + if (rc)
139 + ahci_kick_engine(ap, 0);
140 +
141 + return 0;
142 +}
143 +
144 static void ahci_postreset(struct ata_port *ap, unsigned int *class)
145 {
146 void __iomem *port_mmio = ahci_port_base(ap);
147 @@ -1556,6 +1638,19 @@ static void ahci_vt8251_error_handler(struct ata_port *ap)
148 ahci_postreset);
149 }
150
151 +static void ahci_p5wdh_error_handler(struct ata_port *ap)
152 +{
153 + if (!(ap->pflags & ATA_PFLAG_FROZEN)) {
154 + /* restart engine */
155 + ahci_stop_engine(ap);
156 + ahci_start_engine(ap);
157 + }
158 +
159 + /* perform recovery */
160 + ata_do_eh(ap, ata_std_prereset, ahci_softreset, ahci_p5wdh_hardreset,
161 + ahci_postreset);
162 +}
163 +
164 static void ahci_post_internal_cmd(struct ata_queued_cmd *qc)
165 {
166 struct ata_port *ap = qc->ap;
167 @@ -1802,6 +1897,51 @@ static void ahci_print_info(struct ata_host *host)
168 );
169 }
170
171 +/* On ASUS P5W DH Deluxe, the second port of PCI device 00:1f.2 is
172 + * hardwired to on-board SIMG 4726. The chipset is ICH8 and doesn't
173 + * support PMP and the 4726 either directly exports the device
174 + * attached to the first downstream port or acts as a hardware storage
175 + * controller and emulate a single ATA device (can be RAID 0/1 or some
176 + * other configuration).
177 + *
178 + * When there's no device attached to the first downstream port of the
179 + * 4726, "Config Disk" appears, which is a pseudo ATA device to
180 + * configure the 4726. However, ATA emulation of the device is very
181 + * lame. It doesn't send signature D2H Reg FIS after the initial
182 + * hardreset, pukes on SRST w/ PMP==0 and has bunch of other issues.
183 + *
184 + * The following function works around the problem by always using
185 + * hardreset on the port and not depending on receiving signature FIS
186 + * afterward. If signature FIS isn't received soon, ATA class is
187 + * assumed without follow-up softreset.
188 + */
189 +static void ahci_p5wdh_workaround(struct ata_host *host)
190 +{
191 + static struct dmi_system_id sysids[] = {
192 + {
193 + .ident = "P5W DH Deluxe",
194 + .matches = {
195 + DMI_MATCH(DMI_SYS_VENDOR,
196 + "ASUSTEK COMPUTER INC"),
197 + DMI_MATCH(DMI_PRODUCT_NAME, "P5W DH Deluxe"),
198 + },
199 + },
200 + { }
201 + };
202 + struct pci_dev *pdev = to_pci_dev(host->dev);
203 +
204 + if (pdev->bus->number == 0 && pdev->devfn == PCI_DEVFN(0x1f, 2) &&
205 + dmi_check_system(sysids)) {
206 + struct ata_port *ap = host->ports[1];
207 +
208 + dev_printk(KERN_INFO, &pdev->dev, "enabling ASUS P5W DH "
209 + "Deluxe on-board SIMG4726 workaround\n");
210 +
211 + ap->ops = &ahci_p5wdh_ops;
212 + ap->flags |= ATA_FLAG_NO_SRST | ATA_FLAG_ASSUME_ATA;
213 + }
214 +}
215 +
216 static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
217 {
218 static int printed_version;
219 @@ -1863,6 +2003,9 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
220 ap->ops = &ata_dummy_port_ops;
221 }
222
223 + /* apply workaround for ASUS P5W DH Deluxe mainboard */
224 + ahci_p5wdh_workaround(host);
225 +
226 /* initialize adapter */
227 rc = ahci_configure_dma_masks(pdev, hpriv->cap & HOST_CAP_64);
228 if (rc)
229 diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
230 index 772be09..78b670d 100644
231 --- a/drivers/ata/libata-core.c
232 +++ b/drivers/ata/libata-core.c
233 @@ -3793,11 +3793,18 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
234 /* Drives which do spurious command completion */
235 { "HTS541680J9SA00", "SB2IC7EP", ATA_HORKAGE_NONCQ, },
236 { "HTS541612J9SA00", "SBDIC7JP", ATA_HORKAGE_NONCQ, },
237 + { "HDT722516DLA380", "V43OA96A", ATA_HORKAGE_NONCQ, },
238 { "Hitachi HTS541616J9SA00", "SB4OC70P", ATA_HORKAGE_NONCQ, },
239 + { "Hitachi HTS542525K9SA00", "BBFOC31P", ATA_HORKAGE_NONCQ, },
240 { "WDC WD740ADFD-00NLR1", NULL, ATA_HORKAGE_NONCQ, },
241 + { "WDC WD3200AAJS-00RYA0", "12.01B01", ATA_HORKAGE_NONCQ, },
242 { "FUJITSU MHV2080BH", "00840028", ATA_HORKAGE_NONCQ, },
243 + { "ST9120822AS", "3.CLF", ATA_HORKAGE_NONCQ, },
244 { "ST9160821AS", "3.CLF", ATA_HORKAGE_NONCQ, },
245 - { "ST3160812AS", "3.AD", ATA_HORKAGE_NONCQ, },
246 + { "ST9160821AS", "3.ALD", ATA_HORKAGE_NONCQ, },
247 + { "ST9160821AS", "3.CCD", ATA_HORKAGE_NONCQ, },
248 + { "ST3160812AS", "3.ADJ", ATA_HORKAGE_NONCQ, },
249 + { "ST980813AS", "3.ADB", ATA_HORKAGE_NONCQ, },
250 { "SAMSUNG HD401LJ", "ZZ100-15", ATA_HORKAGE_NONCQ, },
251
252 /* devices which puke on READ_NATIVE_MAX */
253 diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
254 index ac6ceed..6ebdbd8 100644
255 --- a/drivers/ata/libata-eh.c
256 +++ b/drivers/ata/libata-eh.c
257 @@ -1759,9 +1759,11 @@ static int ata_do_reset(struct ata_port *ap, ata_reset_fn_t reset,
258 return 0;
259 }
260
261 -static int ata_eh_followup_srst_needed(int rc, int classify,
262 - const unsigned int *classes)
263 +static int ata_eh_followup_srst_needed(struct ata_port *ap, int rc,
264 + int classify, const unsigned int *classes)
265 {
266 + if (ap->flags & ATA_FLAG_NO_SRST)
267 + return 0;
268 if (rc == -EAGAIN)
269 return 1;
270 if (rc != 0)
271 @@ -1792,7 +1794,8 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
272 */
273 action = ehc->i.action;
274 ehc->i.action &= ~ATA_EH_RESET_MASK;
275 - if (softreset && (!hardreset || (!sata_set_spd_needed(ap) &&
276 + if (softreset && (!hardreset || (!(ap->flags & ATA_FLAG_NO_SRST) &&
277 + !sata_set_spd_needed(ap) &&
278 !(action & ATA_EH_HARDRESET))))
279 ehc->i.action |= ATA_EH_SOFTRESET;
280 else
281 @@ -1855,7 +1858,7 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
282 rc = ata_do_reset(ap, reset, classes, deadline);
283
284 if (reset == hardreset &&
285 - ata_eh_followup_srst_needed(rc, classify, classes)) {
286 + ata_eh_followup_srst_needed(ap, rc, classify, classes)) {
287 /* okay, let's do follow-up softreset */
288 reset = softreset;
289
290 @@ -1870,8 +1873,8 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
291 ata_eh_about_to_do(ap, NULL, ATA_EH_RESET_MASK);
292 rc = ata_do_reset(ap, reset, classes, deadline);
293
294 - if (rc == 0 && classify &&
295 - classes[0] == ATA_DEV_UNKNOWN) {
296 + if (rc == 0 && classify && classes[0] == ATA_DEV_UNKNOWN &&
297 + !(ap->flags & ATA_FLAG_ASSUME_ATA)) {
298 ata_port_printk(ap, KERN_ERR,
299 "classification failed\n");
300 rc = -EINVAL;
301 @@ -1879,6 +1882,10 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
302 }
303 }
304
305 + /* if we skipped follow-up srst, clear rc */
306 + if (rc == -EAGAIN)
307 + rc = 0;
308 +
309 if (rc && try < ARRAY_SIZE(ata_eh_reset_timeouts)) {
310 unsigned long now = jiffies;
311
312 @@ -1906,8 +1913,17 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
313 /* After the reset, the device state is PIO 0 and the
314 * controller state is undefined. Record the mode.
315 */
316 - for (i = 0; i < ATA_MAX_DEVICES; i++)
317 - ap->device[i].pio_mode = XFER_PIO_0;
318 + for (i = 0; i < ata_port_max_devices(ap); i++) {
319 + struct ata_device *dev = &ap->device[i];
320 +
321 + dev->pio_mode = XFER_PIO_0;
322 +
323 + if (ata_port_offline(ap))
324 + continue;
325 +
326 + if (ap->flags & ATA_FLAG_ASSUME_ATA)
327 + classes[dev->devno] = ATA_DEV_ATA;
328 + }
329
330 /* record current link speed */
331 if (sata_scr_read(ap, SCR_STATUS, &sstatus) == 0)
332 diff --git a/drivers/char/drm/i915_irq.c b/drivers/char/drm/i915_irq.c
333 index bb8e9e9..94d638e 100644
334 --- a/drivers/char/drm/i915_irq.c
335 +++ b/drivers/char/drm/i915_irq.c
336 @@ -553,7 +553,7 @@ int i915_vblank_swap(DRM_IOCTL_ARGS)
337 return DRM_ERR(EBUSY);
338 }
339
340 - vbl_swap = drm_calloc(1, sizeof(vbl_swap), DRM_MEM_DRIVER);
341 + vbl_swap = drm_calloc(1, sizeof(*vbl_swap), DRM_MEM_DRIVER);
342
343 if (!vbl_swap) {
344 DRM_ERROR("Failed to allocate memory to queue swap\n");
345 diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c
346 index af5790f..2e9fdb9 100644
347 --- a/drivers/char/drm/radeon_cp.c
348 +++ b/drivers/char/drm/radeon_cp.c
349 @@ -1679,7 +1679,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
350 dev_priv->gart_info.bus_addr =
351 dev_priv->pcigart_offset + dev_priv->fb_location;
352 dev_priv->gart_info.mapping.offset =
353 - dev_priv->gart_info.bus_addr;
354 + dev_priv->pcigart_offset + dev_priv->fb_aper_offset;
355 dev_priv->gart_info.mapping.size =
356 dev_priv->gart_info.table_size;
357
358 @@ -2291,7 +2291,8 @@ int radeon_driver_firstopen(struct drm_device *dev)
359 if (ret != 0)
360 return ret;
361
362 - ret = drm_addmap(dev, drm_get_resource_start(dev, 0),
363 + dev_priv->fb_aper_offset = drm_get_resource_start(dev, 0);
364 + ret = drm_addmap(dev, dev_priv->fb_aper_offset,
365 drm_get_resource_len(dev, 0), _DRM_FRAME_BUFFER,
366 _DRM_WRITE_COMBINING, &map);
367 if (ret != 0)
368 diff --git a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h
369 index 3b3d935..41e91ea 100644
370 --- a/drivers/char/drm/radeon_drv.h
371 +++ b/drivers/char/drm/radeon_drv.h
372 @@ -293,6 +293,7 @@ typedef struct drm_radeon_private {
373
374 /* starting from here on, data is preserved accross an open */
375 uint32_t flags; /* see radeon_chip_flags */
376 + unsigned long fb_aper_offset;
377 } drm_radeon_private_t;
378
379 typedef struct drm_radeon_buf_priv {
380 diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c
381 index ed76f0a..5000b3b 100644
382 --- a/drivers/char/moxa.c
383 +++ b/drivers/char/moxa.c
384 @@ -1040,14 +1040,14 @@ static void check_xmit_empty(unsigned long data)
385 struct moxa_port *ch;
386
387 ch = (struct moxa_port *) data;
388 - del_timer_sync(&moxa_ports[ch->port].emptyTimer);
389 if (ch->tty && (ch->statusflags & EMPTYWAIT)) {
390 if (MoxaPortTxQueue(ch->port) == 0) {
391 ch->statusflags &= ~EMPTYWAIT;
392 tty_wakeup(ch->tty);
393 return;
394 }
395 - mod_timer(&moxa_ports[ch->port].emptyTimer, jiffies + HZ);
396 + mod_timer(&moxa_ports[ch->port].emptyTimer,
397 + round_jiffies(jiffies + HZ));
398 } else
399 ch->statusflags &= ~EMPTYWAIT;
400 }
401 diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c
402 index 56cbba7..94bb3d0 100644
403 --- a/drivers/char/rocket.c
404 +++ b/drivers/char/rocket.c
405 @@ -699,8 +699,8 @@ static void init_r_port(int board, int aiop, int chan, struct pci_dev *pci_dev)
406 spin_lock_init(&info->slock);
407 mutex_init(&info->write_mtx);
408 rp_table[line] = info;
409 - if (pci_dev)
410 - tty_register_device(rocket_driver, line, &pci_dev->dev);
411 + tty_register_device(rocket_driver, line, pci_dev ? &pci_dev->dev :
412 + NULL);
413 }
414
415 /*
416 @@ -2434,7 +2434,7 @@ static int __init rp_init(void)
417 rocket_driver->init_termios.c_ispeed = 9600;
418 rocket_driver->init_termios.c_ospeed = 9600;
419 #ifdef ROCKET_SOFT_FLOW
420 - rocket_driver->flags |= TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
421 + rocket_driver->flags |= TTY_DRIVER_REAL_RAW;
422 #endif
423 tty_set_operations(rocket_driver, &rocket_ops);
424
425 @@ -2491,10 +2491,14 @@ static void rp_cleanup_module(void)
426 if (retval)
427 printk(KERN_INFO "Error %d while trying to unregister "
428 "rocketport driver\n", -retval);
429 - put_tty_driver(rocket_driver);
430
431 for (i = 0; i < MAX_RP_PORTS; i++)
432 - kfree(rp_table[i]);
433 + if (rp_table[i]) {
434 + tty_unregister_device(rocket_driver, i);
435 + kfree(rp_table[i]);
436 + }
437 +
438 + put_tty_driver(rocket_driver);
439
440 for (i = 0; i < NUM_BOARDS; i++) {
441 if (rcktpt_io_addr[i] <= 0 || is_PCI[i])
442 diff --git a/drivers/hwmon/lm87.c b/drivers/hwmon/lm87.c
443 index 988ae1c..1128153 100644
444 --- a/drivers/hwmon/lm87.c
445 +++ b/drivers/hwmon/lm87.c
446 @@ -129,7 +129,7 @@ static u8 LM87_REG_TEMP_LOW[3] = { 0x3A, 0x38, 0x2C };
447 (((val) < 0 ? (val)-500 : (val)+500) / 1000))
448
449 #define FAN_FROM_REG(reg,div) ((reg) == 255 || (reg) == 0 ? 0 : \
450 - 1350000 + (reg)*(div) / 2) / ((reg)*(div))
451 + (1350000 + (reg)*(div) / 2) / ((reg)*(div)))
452 #define FAN_TO_REG(val,div) ((val)*(div) * 255 <= 1350000 ? 255 : \
453 (1350000 + (val)*(div) / 2) / ((val)*(div)))
454
455 @@ -145,7 +145,7 @@ static u8 LM87_REG_TEMP_LOW[3] = { 0x3A, 0x38, 0x2C };
456 #define CHAN_NO_FAN(nr) (1 << (nr))
457 #define CHAN_TEMP3 (1 << 2)
458 #define CHAN_VCC_5V (1 << 3)
459 -#define CHAN_NO_VID (1 << 8)
460 +#define CHAN_NO_VID (1 << 7)
461
462 /*
463 * Functions declaration
464 diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c
465 index 7a4a15f..329b599 100644
466 --- a/drivers/hwmon/w83627hf.c
467 +++ b/drivers/hwmon/w83627hf.c
468 @@ -391,6 +391,7 @@ static int __devexit w83627hf_remove(struct platform_device *pdev);
469
470 static int w83627hf_read_value(struct w83627hf_data *data, u16 reg);
471 static int w83627hf_write_value(struct w83627hf_data *data, u16 reg, u16 value);
472 +static void w83627hf_update_fan_div(struct w83627hf_data *data);
473 static struct w83627hf_data *w83627hf_update_device(struct device *dev);
474 static void w83627hf_init_device(struct platform_device *pdev);
475
476 @@ -1244,6 +1245,7 @@ static int __devinit w83627hf_probe(struct platform_device *pdev)
477 data->fan_min[0] = w83627hf_read_value(data, W83781D_REG_FAN_MIN(1));
478 data->fan_min[1] = w83627hf_read_value(data, W83781D_REG_FAN_MIN(2));
479 data->fan_min[2] = w83627hf_read_value(data, W83781D_REG_FAN_MIN(3));
480 + w83627hf_update_fan_div(data);
481
482 /* Register common device attributes */
483 if ((err = sysfs_create_group(&dev->kobj, &w83627hf_group)))
484 @@ -1333,6 +1335,24 @@ static int __devexit w83627hf_remove(struct platform_device *pdev)
485 }
486
487
488 +/* Registers 0x50-0x5f are banked */
489 +static inline void w83627hf_set_bank(struct w83627hf_data *data, u16 reg)
490 +{
491 + if ((reg & 0x00f0) == 0x50) {
492 + outb_p(W83781D_REG_BANK, data->addr + W83781D_ADDR_REG_OFFSET);
493 + outb_p(reg >> 8, data->addr + W83781D_DATA_REG_OFFSET);
494 + }
495 +}
496 +
497 +/* Not strictly necessary, but play it safe for now */
498 +static inline void w83627hf_reset_bank(struct w83627hf_data *data, u16 reg)
499 +{
500 + if (reg & 0xff00) {
501 + outb_p(W83781D_REG_BANK, data->addr + W83781D_ADDR_REG_OFFSET);
502 + outb_p(0, data->addr + W83781D_DATA_REG_OFFSET);
503 + }
504 +}
505 +
506 static int w83627hf_read_value(struct w83627hf_data *data, u16 reg)
507 {
508 int res, word_sized;
509 @@ -1343,12 +1363,7 @@ static int w83627hf_read_value(struct w83627hf_data *data, u16 reg)
510 && (((reg & 0x00ff) == 0x50)
511 || ((reg & 0x00ff) == 0x53)
512 || ((reg & 0x00ff) == 0x55));
513 - if (reg & 0xff00) {
514 - outb_p(W83781D_REG_BANK,
515 - data->addr + W83781D_ADDR_REG_OFFSET);
516 - outb_p(reg >> 8,
517 - data->addr + W83781D_DATA_REG_OFFSET);
518 - }
519 + w83627hf_set_bank(data, reg);
520 outb_p(reg & 0xff, data->addr + W83781D_ADDR_REG_OFFSET);
521 res = inb_p(data->addr + W83781D_DATA_REG_OFFSET);
522 if (word_sized) {
523 @@ -1358,11 +1373,7 @@ static int w83627hf_read_value(struct w83627hf_data *data, u16 reg)
524 (res << 8) + inb_p(data->addr +
525 W83781D_DATA_REG_OFFSET);
526 }
527 - if (reg & 0xff00) {
528 - outb_p(W83781D_REG_BANK,
529 - data->addr + W83781D_ADDR_REG_OFFSET);
530 - outb_p(0, data->addr + W83781D_DATA_REG_OFFSET);
531 - }
532 + w83627hf_reset_bank(data, reg);
533 mutex_unlock(&data->lock);
534 return res;
535 }
536 @@ -1433,12 +1444,7 @@ static int w83627hf_write_value(struct w83627hf_data *data, u16 reg, u16 value)
537 || ((reg & 0xff00) == 0x200))
538 && (((reg & 0x00ff) == 0x53)
539 || ((reg & 0x00ff) == 0x55));
540 - if (reg & 0xff00) {
541 - outb_p(W83781D_REG_BANK,
542 - data->addr + W83781D_ADDR_REG_OFFSET);
543 - outb_p(reg >> 8,
544 - data->addr + W83781D_DATA_REG_OFFSET);
545 - }
546 + w83627hf_set_bank(data, reg);
547 outb_p(reg & 0xff, data->addr + W83781D_ADDR_REG_OFFSET);
548 if (word_sized) {
549 outb_p(value >> 8,
550 @@ -1448,11 +1454,7 @@ static int w83627hf_write_value(struct w83627hf_data *data, u16 reg, u16 value)
551 }
552 outb_p(value & 0xff,
553 data->addr + W83781D_DATA_REG_OFFSET);
554 - if (reg & 0xff00) {
555 - outb_p(W83781D_REG_BANK,
556 - data->addr + W83781D_ADDR_REG_OFFSET);
557 - outb_p(0, data->addr + W83781D_DATA_REG_OFFSET);
558 - }
559 + w83627hf_reset_bank(data, reg);
560 mutex_unlock(&data->lock);
561 return 0;
562 }
563 @@ -1556,6 +1558,24 @@ static void __devinit w83627hf_init_device(struct platform_device *pdev)
564 | 0x01);
565 }
566
567 +static void w83627hf_update_fan_div(struct w83627hf_data *data)
568 +{
569 + int reg;
570 +
571 + reg = w83627hf_read_value(data, W83781D_REG_VID_FANDIV);
572 + data->fan_div[0] = (reg >> 4) & 0x03;
573 + data->fan_div[1] = (reg >> 6) & 0x03;
574 + if (data->type != w83697hf) {
575 + data->fan_div[2] = (w83627hf_read_value(data,
576 + W83781D_REG_PIN) >> 6) & 0x03;
577 + }
578 + reg = w83627hf_read_value(data, W83781D_REG_VBAT);
579 + data->fan_div[0] |= (reg >> 3) & 0x04;
580 + data->fan_div[1] |= (reg >> 4) & 0x04;
581 + if (data->type != w83697hf)
582 + data->fan_div[2] |= (reg >> 5) & 0x04;
583 +}
584 +
585 static struct w83627hf_data *w83627hf_update_device(struct device *dev)
586 {
587 struct w83627hf_data *data = dev_get_drvdata(dev);
588 @@ -1633,18 +1653,8 @@ static struct w83627hf_data *w83627hf_update_device(struct device *dev)
589 w83627hf_read_value(data, W83781D_REG_TEMP_HYST(3));
590 }
591
592 - i = w83627hf_read_value(data, W83781D_REG_VID_FANDIV);
593 - data->fan_div[0] = (i >> 4) & 0x03;
594 - data->fan_div[1] = (i >> 6) & 0x03;
595 - if (data->type != w83697hf) {
596 - data->fan_div[2] = (w83627hf_read_value(data,
597 - W83781D_REG_PIN) >> 6) & 0x03;
598 - }
599 - i = w83627hf_read_value(data, W83781D_REG_VBAT);
600 - data->fan_div[0] |= (i >> 3) & 0x04;
601 - data->fan_div[1] |= (i >> 4) & 0x04;
602 - if (data->type != w83697hf)
603 - data->fan_div[2] |= (i >> 5) & 0x04;
604 + w83627hf_update_fan_div(data);
605 +
606 data->alarms =
607 w83627hf_read_value(data, W83781D_REG_ALARM1) |
608 (w83627hf_read_value(data, W83781D_REG_ALARM2) << 8) |
609 diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c
610 index 082ca7d..6102aa9 100644
611 --- a/drivers/ide/pci/cs5535.c
612 +++ b/drivers/ide/pci/cs5535.c
613 @@ -84,7 +84,7 @@ static void cs5535_set_speed(ide_drive_t *drive, u8 speed)
614
615 /* Set the PIO timings */
616 if ((speed & XFER_MODE) == XFER_PIO) {
617 - ide_drive_t *pair = &drive->hwif->drives[drive->dn ^ 1];
618 + ide_drive_t *pair = ide_get_paired_drive(drive);
619 u8 cmd, pioa;
620
621 cmd = pioa = speed - XFER_PIO_0;
622 diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c
623 index 9fead2e..e887058 100644
624 --- a/drivers/ide/pci/serverworks.c
625 +++ b/drivers/ide/pci/serverworks.c
626 @@ -97,6 +97,7 @@ static u8 svwks_udma_filter(ide_drive_t *drive)
627 mode = 2;
628
629 switch(mode) {
630 + case 3: mask = 0x3f; break;
631 case 2: mask = 0x1f; break;
632 case 1: mask = 0x07; break;
633 default: mask = 0x00; break;
634 diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
635 index 50f6d17..713064d 100644
636 --- a/drivers/ide/pci/siimage.c
637 +++ b/drivers/ide/pci/siimage.c
638 @@ -180,7 +180,7 @@ static void sil_tune_pio(ide_drive_t *drive, u8 pio)
639 const u16 data_speed[] = { 0x328a, 0x2283, 0x1104, 0x10c3, 0x10c1 };
640
641 ide_hwif_t *hwif = HWIF(drive);
642 - ide_drive_t *pair = &hwif->drives[drive->dn ^ 1];
643 + ide_drive_t *pair = ide_get_paired_drive(drive);
644 u32 speedt = 0;
645 u16 speedp = 0;
646 unsigned long addr = siimage_seldev(drive, 0x04);
647 diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
648 index 01d7008..495c803 100644
649 --- a/drivers/infiniband/core/uverbs_cmd.c
650 +++ b/drivers/infiniband/core/uverbs_cmd.c
651 @@ -147,8 +147,12 @@ static struct ib_uobject *__idr_get_uobj(struct idr *idr, int id,
652
653 spin_lock(&ib_uverbs_idr_lock);
654 uobj = idr_find(idr, id);
655 - if (uobj)
656 - kref_get(&uobj->ref);
657 + if (uobj) {
658 + if (uobj->context == context)
659 + kref_get(&uobj->ref);
660 + else
661 + uobj = NULL;
662 + }
663 spin_unlock(&ib_uverbs_idr_lock);
664
665 return uobj;
666 diff --git a/drivers/infiniband/hw/mthca/mthca_cmd.c b/drivers/infiniband/hw/mthca/mthca_cmd.c
667 index acc9589..6966f94 100644
668 --- a/drivers/infiniband/hw/mthca/mthca_cmd.c
669 +++ b/drivers/infiniband/hw/mthca/mthca_cmd.c
670 @@ -290,6 +290,12 @@ static int mthca_cmd_post(struct mthca_dev *dev,
671 err = mthca_cmd_post_hcr(dev, in_param, out_param, in_modifier,
672 op_modifier, op, token, event);
673
674 + /*
675 + * Make sure that our HCR writes don't get mixed in with
676 + * writes from another CPU starting a FW command.
677 + */
678 + mmiowb();
679 +
680 mutex_unlock(&dev->cmd.hcr_mutex);
681 return err;
682 }
683 diff --git a/drivers/isdn/hardware/avm/b1.c b/drivers/isdn/hardware/avm/b1.c
684 index 7a69a18..4484a64 100644
685 --- a/drivers/isdn/hardware/avm/b1.c
686 +++ b/drivers/isdn/hardware/avm/b1.c
687 @@ -321,12 +321,15 @@ void b1_reset_ctr(struct capi_ctr *ctrl)
688 avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
689 avmcard *card = cinfo->card;
690 unsigned int port = card->port;
691 + unsigned long flags;
692
693 b1_reset(port);
694 b1_reset(port);
695
696 memset(cinfo->version, 0, sizeof(cinfo->version));
697 + spin_lock_irqsave(&card->lock, flags);
698 capilib_release(&cinfo->ncci_head);
699 + spin_unlock_irqrestore(&card->lock, flags);
700 capi_ctr_reseted(ctrl);
701 }
702
703 @@ -361,9 +364,8 @@ void b1_release_appl(struct capi_ctr *ctrl, u16 appl)
704 unsigned int port = card->port;
705 unsigned long flags;
706
707 - capilib_release_appl(&cinfo->ncci_head, appl);
708 -
709 spin_lock_irqsave(&card->lock, flags);
710 + capilib_release_appl(&cinfo->ncci_head, appl);
711 b1_put_byte(port, SEND_RELEASE);
712 b1_put_word(port, appl);
713 spin_unlock_irqrestore(&card->lock, flags);
714 @@ -380,27 +382,27 @@ u16 b1_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
715 u8 subcmd = CAPIMSG_SUBCOMMAND(skb->data);
716 u16 dlen, retval;
717
718 + spin_lock_irqsave(&card->lock, flags);
719 if (CAPICMD(cmd, subcmd) == CAPI_DATA_B3_REQ) {
720 retval = capilib_data_b3_req(&cinfo->ncci_head,
721 CAPIMSG_APPID(skb->data),
722 CAPIMSG_NCCI(skb->data),
723 CAPIMSG_MSGID(skb->data));
724 - if (retval != CAPI_NOERROR)
725 + if (retval != CAPI_NOERROR) {
726 + spin_unlock_irqrestore(&card->lock, flags);
727 return retval;
728 + }
729
730 dlen = CAPIMSG_DATALEN(skb->data);
731
732 - spin_lock_irqsave(&card->lock, flags);
733 b1_put_byte(port, SEND_DATA_B3_REQ);
734 b1_put_slice(port, skb->data, len);
735 b1_put_slice(port, skb->data + len, dlen);
736 - spin_unlock_irqrestore(&card->lock, flags);
737 } else {
738 - spin_lock_irqsave(&card->lock, flags);
739 b1_put_byte(port, SEND_MESSAGE);
740 b1_put_slice(port, skb->data, len);
741 - spin_unlock_irqrestore(&card->lock, flags);
742 }
743 + spin_unlock_irqrestore(&card->lock, flags);
744
745 dev_kfree_skb_any(skb);
746 return CAPI_NOERROR;
747 @@ -534,17 +536,17 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr)
748
749 ApplId = (unsigned) b1_get_word(card->port);
750 MsgLen = b1_get_slice(card->port, card->msgbuf);
751 - spin_unlock_irqrestore(&card->lock, flags);
752 if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) {
753 printk(KERN_ERR "%s: incoming packet dropped\n",
754 card->name);
755 + spin_unlock_irqrestore(&card->lock, flags);
756 } else {
757 memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen);
758 if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_CONF)
759 capilib_data_b3_conf(&cinfo->ncci_head, ApplId,
760 CAPIMSG_NCCI(skb->data),
761 CAPIMSG_MSGID(skb->data));
762 -
763 + spin_unlock_irqrestore(&card->lock, flags);
764 capi_ctr_handle_message(ctrl, ApplId, skb);
765 }
766 break;
767 @@ -554,21 +556,17 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr)
768 ApplId = b1_get_word(card->port);
769 NCCI = b1_get_word(card->port);
770 WindowSize = b1_get_word(card->port);
771 - spin_unlock_irqrestore(&card->lock, flags);
772 -
773 capilib_new_ncci(&cinfo->ncci_head, ApplId, NCCI, WindowSize);
774 -
775 + spin_unlock_irqrestore(&card->lock, flags);
776 break;
777
778 case RECEIVE_FREE_NCCI:
779
780 ApplId = b1_get_word(card->port);
781 NCCI = b1_get_word(card->port);
782 - spin_unlock_irqrestore(&card->lock, flags);
783 -
784 if (NCCI != 0xffffffff)
785 capilib_free_ncci(&cinfo->ncci_head, ApplId, NCCI);
786 -
787 + spin_unlock_irqrestore(&card->lock, flags);
788 break;
789
790 case RECEIVE_START:
791 diff --git a/drivers/isdn/hardware/avm/c4.c b/drivers/isdn/hardware/avm/c4.c
792 index d58f927..8710cf6 100644
793 --- a/drivers/isdn/hardware/avm/c4.c
794 +++ b/drivers/isdn/hardware/avm/c4.c
795 @@ -727,6 +727,7 @@ static void c4_send_init(avmcard *card)
796 {
797 struct sk_buff *skb;
798 void *p;
799 + unsigned long flags;
800
801 skb = alloc_skb(15, GFP_ATOMIC);
802 if (!skb) {
803 @@ -744,12 +745,15 @@ static void c4_send_init(avmcard *card)
804 skb_put(skb, (u8 *)p - (u8 *)skb->data);
805
806 skb_queue_tail(&card->dma->send_queue, skb);
807 + spin_lock_irqsave(&card->lock, flags);
808 c4_dispatch_tx(card);
809 + spin_unlock_irqrestore(&card->lock, flags);
810 }
811
812 static int queue_sendconfigword(avmcard *card, u32 val)
813 {
814 struct sk_buff *skb;
815 + unsigned long flags;
816 void *p;
817
818 skb = alloc_skb(3+4, GFP_ATOMIC);
819 @@ -766,7 +770,9 @@ static int queue_sendconfigword(avmcard *card, u32 val)
820 skb_put(skb, (u8 *)p - (u8 *)skb->data);
821
822 skb_queue_tail(&card->dma->send_queue, skb);
823 + spin_lock_irqsave(&card->lock, flags);
824 c4_dispatch_tx(card);
825 + spin_unlock_irqrestore(&card->lock, flags);
826 return 0;
827 }
828
829 @@ -986,7 +992,9 @@ static void c4_release_appl(struct capi_ctr *ctrl, u16 appl)
830 struct sk_buff *skb;
831 void *p;
832
833 + spin_lock_irqsave(&card->lock, flags);
834 capilib_release_appl(&cinfo->ncci_head, appl);
835 + spin_unlock_irqrestore(&card->lock, flags);
836
837 if (ctrl->cnr == card->cardnr) {
838 skb = alloc_skb(7, GFP_ATOMIC);
839 @@ -1019,7 +1027,8 @@ static u16 c4_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
840 u16 retval = CAPI_NOERROR;
841 unsigned long flags;
842
843 - if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_REQ) {
844 + spin_lock_irqsave(&card->lock, flags);
845 + if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_REQ) {
846 retval = capilib_data_b3_req(&cinfo->ncci_head,
847 CAPIMSG_APPID(skb->data),
848 CAPIMSG_NCCI(skb->data),
849 @@ -1027,10 +1036,9 @@ static u16 c4_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
850 }
851 if (retval == CAPI_NOERROR) {
852 skb_queue_tail(&card->dma->send_queue, skb);
853 - spin_lock_irqsave(&card->lock, flags);
854 c4_dispatch_tx(card);
855 - spin_unlock_irqrestore(&card->lock, flags);
856 }
857 + spin_unlock_irqrestore(&card->lock, flags);
858 return retval;
859 }
860
861 diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
862 index 927cb34..7c426d0 100644
863 --- a/drivers/md/bitmap.c
864 +++ b/drivers/md/bitmap.c
865 @@ -274,7 +274,7 @@ static int write_sb_page(struct bitmap *bitmap, struct page *page, int wait)
866 if (bitmap->offset < 0) {
867 /* DATA BITMAP METADATA */
868 if (bitmap->offset
869 - + page->index * (PAGE_SIZE/512)
870 + + (long)(page->index * (PAGE_SIZE/512))
871 + size/512 > 0)
872 /* bitmap runs in to metadata */
873 return -EINVAL;
874 diff --git a/drivers/md/dm-delay.c b/drivers/md/dm-delay.c
875 index 6928c13..9538331 100644
876 --- a/drivers/md/dm-delay.c
877 +++ b/drivers/md/dm-delay.c
878 @@ -305,7 +305,7 @@ static int delay_status(struct dm_target *ti, status_type_t type,
879 (unsigned long long) dc->start_read,
880 dc->read_delay);
881 if (dc->dev_write)
882 - DMEMIT("%s %llu %u", dc->dev_write->name,
883 + DMEMIT(" %s %llu %u", dc->dev_write->name,
884 (unsigned long long) dc->start_write,
885 dc->write_delay);
886 break;
887 diff --git a/drivers/md/dm.c b/drivers/md/dm.c
888 index 2120155..998d450 100644
889 --- a/drivers/md/dm.c
890 +++ b/drivers/md/dm.c
891 @@ -1064,12 +1064,14 @@ static struct mapped_device *alloc_dev(int minor)
892 return NULL;
893 }
894
895 +static void unlock_fs(struct mapped_device *md);
896 +
897 static void free_dev(struct mapped_device *md)
898 {
899 int minor = md->disk->first_minor;
900
901 if (md->suspended_bdev) {
902 - thaw_bdev(md->suspended_bdev, NULL);
903 + unlock_fs(md);
904 bdput(md->suspended_bdev);
905 }
906 mempool_destroy(md->tio_pool);
907 diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
908 index f96dea9..3808f52 100644
909 --- a/drivers/md/raid5.c
910 +++ b/drivers/md/raid5.c
911 @@ -377,7 +377,12 @@ static unsigned long get_stripe_work(struct stripe_head *sh)
912 ack++;
913
914 sh->ops.count -= ack;
915 - BUG_ON(sh->ops.count < 0);
916 + if (unlikely(sh->ops.count < 0)) {
917 + printk(KERN_ERR "pending: %#lx ops.pending: %#lx ops.ack: %#lx "
918 + "ops.complete: %#lx\n", pending, sh->ops.pending,
919 + sh->ops.ack, sh->ops.complete);
920 + BUG();
921 + }
922
923 return pending;
924 }
925 @@ -551,8 +556,7 @@ static void ops_complete_biofill(void *stripe_head_ref)
926 }
927 }
928 }
929 - clear_bit(STRIPE_OP_BIOFILL, &sh->ops.ack);
930 - clear_bit(STRIPE_OP_BIOFILL, &sh->ops.pending);
931 + set_bit(STRIPE_OP_BIOFILL, &sh->ops.complete);
932
933 return_io(return_bi);
934
935 @@ -2630,6 +2634,13 @@ static void handle_stripe5(struct stripe_head *sh)
936 s.expanded = test_bit(STRIPE_EXPAND_READY, &sh->state);
937 /* Now to look around and see what can be done */
938
939 + /* clean-up completed biofill operations */
940 + if (test_bit(STRIPE_OP_BIOFILL, &sh->ops.complete)) {
941 + clear_bit(STRIPE_OP_BIOFILL, &sh->ops.pending);
942 + clear_bit(STRIPE_OP_BIOFILL, &sh->ops.ack);
943 + clear_bit(STRIPE_OP_BIOFILL, &sh->ops.complete);
944 + }
945 +
946 rcu_read_lock();
947 for (i=disks; i--; ) {
948 mdk_rdev_t *rdev;
949 diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
950 index be1df85..87e0161 100644
951 --- a/drivers/pci/msi.c
952 +++ b/drivers/pci/msi.c
953 @@ -132,7 +132,7 @@ void read_msi_msg(unsigned int irq, struct msi_msg *msg)
954 pci_read_config_word(dev, msi_data_reg(pos, 1), &data);
955 } else {
956 msg->address_hi = 0;
957 - pci_read_config_word(dev, msi_data_reg(pos, 1), &data);
958 + pci_read_config_word(dev, msi_data_reg(pos, 0), &data);
959 }
960 msg->data = data;
961 break;
962 diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
963 index 0e579ca..ffdd0da 100644
964 --- a/drivers/scsi/hptiop.c
965 +++ b/drivers/scsi/hptiop.c
966 @@ -365,8 +365,9 @@ static void hptiop_host_request_callback(struct hptiop_hba *hba, u32 tag)
967 scp->result = SAM_STAT_CHECK_CONDITION;
968 memset(&scp->sense_buffer,
969 0, sizeof(scp->sense_buffer));
970 - memcpy(&scp->sense_buffer,
971 - &req->sg_list, le32_to_cpu(req->dataxfer_length));
972 + memcpy(&scp->sense_buffer, &req->sg_list,
973 + min(sizeof(scp->sense_buffer),
974 + le32_to_cpu(req->dataxfer_length)));
975 break;
976
977 default:
978 diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
979 index b5ebb73..6e2382e 100644
980 --- a/drivers/usb/core/hcd.h
981 +++ b/drivers/usb/core/hcd.h
982 @@ -19,6 +19,8 @@
983
984 #ifdef __KERNEL__
985
986 +#include <linux/rwsem.h>
987 +
988 /* This file contains declarations of usbcore internals that are mostly
989 * used or exposed by Host Controller Drivers.
990 */
991 @@ -454,5 +456,9 @@ static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb) {}
992 : (in_interrupt () ? "in_interrupt" : "can sleep"))
993
994
995 -#endif /* __KERNEL__ */
996 +/* This rwsem is for use only by the hub driver and ehci-hcd.
997 + * Nobody else should touch it.
998 + */
999 +extern struct rw_semaphore ehci_cf_port_reset_rwsem;
1000
1001 +#endif /* __KERNEL__ */
1002 diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
1003 index f7b337f..c3adffa 100644
1004 --- a/drivers/usb/core/hub.c
1005 +++ b/drivers/usb/core/hub.c
1006 @@ -125,6 +125,12 @@ MODULE_PARM_DESC(use_both_schemes,
1007 "try the other device initialization scheme if the "
1008 "first one fails");
1009
1010 +/* Mutual exclusion for EHCI CF initialization. This interferes with
1011 + * port reset on some companion controllers.
1012 + */
1013 +DECLARE_RWSEM(ehci_cf_port_reset_rwsem);
1014 +EXPORT_SYMBOL_GPL(ehci_cf_port_reset_rwsem);
1015 +
1016
1017 static inline char *portspeed(int portstatus)
1018 {
1019 @@ -1460,6 +1466,11 @@ static int hub_port_reset(struct usb_hub *hub, int port1,
1020 {
1021 int i, status;
1022
1023 + /* Block EHCI CF initialization during the port reset.
1024 + * Some companion controllers don't like it when they mix.
1025 + */
1026 + down_read(&ehci_cf_port_reset_rwsem);
1027 +
1028 /* Reset the port */
1029 for (i = 0; i < PORT_RESET_TRIES; i++) {
1030 status = set_port_feature(hub->hdev,
1031 @@ -1490,7 +1501,7 @@ static int hub_port_reset(struct usb_hub *hub, int port1,
1032 usb_set_device_state(udev, status
1033 ? USB_STATE_NOTATTACHED
1034 : USB_STATE_DEFAULT);
1035 - return status;
1036 + goto done;
1037 }
1038
1039 dev_dbg (hub->intfdev,
1040 @@ -1503,6 +1514,8 @@ static int hub_port_reset(struct usb_hub *hub, int port1,
1041 "Cannot enable port %i. Maybe the USB cable is bad?\n",
1042 port1);
1043
1044 + done:
1045 + up_read(&ehci_cf_port_reset_rwsem);
1046 return status;
1047 }
1048
1049 diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
1050 index ebf3dc2..d42c561 100644
1051 --- a/drivers/usb/core/quirks.c
1052 +++ b/drivers/usb/core/quirks.c
1053 @@ -32,52 +32,6 @@ static const struct usb_device_id usb_quirk_list[] = {
1054 { USB_DEVICE(0x0204, 0x6025), .driver_info = USB_QUIRK_RESET_RESUME },
1055 /* HP 5300/5370C scanner */
1056 { USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 },
1057 - /* Hewlett-Packard PhotoSmart 720 / PhotoSmart 935 (storage) */
1058 - { USB_DEVICE(0x03f0, 0x4002), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1059 -
1060 - /* SGS Thomson Microelectronics 4in1 card reader */
1061 - { USB_DEVICE(0x0483, 0x0321), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1062 -
1063 - /* Acer Peripherals Inc. (now BenQ Corp.) Prisa 640BU */
1064 - { USB_DEVICE(0x04a5, 0x207e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1065 - /* Benq S2W 3300U */
1066 - { USB_DEVICE(0x04a5, 0x20b0), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1067 - /* Canon, Inc. CanoScan N1240U/LiDE30 */
1068 - { USB_DEVICE(0x04a9, 0x220e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1069 - /* Canon, Inc. CanoScan N650U/N656U */
1070 - { USB_DEVICE(0x04a9, 0x2206), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1071 - /* Canon, Inc. CanoScan 1220U */
1072 - { USB_DEVICE(0x04a9, 0x2207), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1073 - /* Canon, Inc. CanoScan N670U/N676U/LiDE 20 */
1074 - { USB_DEVICE(0x04a9, 0x220d), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1075 - /* old Cannon scanner */
1076 - { USB_DEVICE(0x04a9, 0x2220), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1077 - /* Seiko Epson Corp. Perfection 1200 */
1078 - { USB_DEVICE(0x04b8, 0x0104), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1079 - /* Seiko Epson Corp. Perfection 660 */
1080 - { USB_DEVICE(0x04b8, 0x0114), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1081 - /* Epson Perfection 1260 Photo */
1082 - { USB_DEVICE(0x04b8, 0x011d), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1083 - /* Seiko Epson Corp - Perfection 1670 */
1084 - { USB_DEVICE(0x04b8, 0x011f), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1085 - /* EPSON Perfection 2480 */
1086 - { USB_DEVICE(0x04b8, 0x0121), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1087 - /* Seiko Epson Corp.*/
1088 - { USB_DEVICE(0x04b8, 0x0122), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1089 - /* Samsung ML-2010 printer */
1090 - { USB_DEVICE(0x04e8, 0x326c), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1091 - /* Samsung ML-2510 Series printer */
1092 - { USB_DEVICE(0x04e8, 0x327e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1093 - /* Elsa MicroLink 56k (V.250) */
1094 - { USB_DEVICE(0x05cc, 0x2267), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1095 - /* Ultima Electronics Corp.*/
1096 - { USB_DEVICE(0x05d8, 0x4005), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1097 -
1098 - /* Genesys USB-to-IDE */
1099 - { USB_DEVICE(0x0503, 0x0702), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1100 -
1101 - /* USB Graphical LCD - EEH Datalink GmbH */
1102 - { USB_DEVICE(0x060c, 0x04eb), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1103
1104 /* INTEL VALUE SSD */
1105 { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
1106 @@ -85,44 +39,15 @@ static const struct usb_device_id usb_quirk_list[] = {
1107 /* M-Systems Flash Disk Pioneers */
1108 { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME },
1109
1110 - /* Agfa Snapscan1212u */
1111 - { USB_DEVICE(0x06bd, 0x2061), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1112 - /* Seagate RSS LLC */
1113 - { USB_DEVICE(0x0bc2, 0x3000), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1114 - /* Umax [hex] Astra 3400U */
1115 - { USB_DEVICE(0x1606, 0x0060), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1116 -
1117 /* Philips PSC805 audio device */
1118 { USB_DEVICE(0x0471, 0x0155), .driver_info = USB_QUIRK_RESET_RESUME },
1119
1120 - /* Alcor multi-card reader */
1121 - { USB_DEVICE(0x058f, 0x6366), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1122 -
1123 - /* Canon EOS 5D in PC Connection mode */
1124 - { USB_DEVICE(0x04a9, 0x3101), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1125 -
1126 - /* RIM Blackberry */
1127 - { USB_DEVICE(0x0fca, 0x0001), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1128 - { USB_DEVICE(0x0fca, 0x0004), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1129 - { USB_DEVICE(0x0fca, 0x0006), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1130 -
1131 - /* Apple iPhone */
1132 - { USB_DEVICE(0x05ac, 0x1290), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
1133 -
1134 /* SKYMEDI USB_DRIVE */
1135 { USB_DEVICE(0x1516, 0x8628), .driver_info = USB_QUIRK_RESET_RESUME },
1136
1137 { } /* terminating entry must be last */
1138 };
1139
1140 -static void usb_autosuspend_quirk(struct usb_device *udev)
1141 -{
1142 -#ifdef CONFIG_USB_SUSPEND
1143 - /* disable autosuspend, but allow the user to re-enable it via sysfs */
1144 - udev->autosuspend_disabled = 1;
1145 -#endif
1146 -}
1147 -
1148 static const struct usb_device_id *find_id(struct usb_device *udev)
1149 {
1150 const struct usb_device_id *id = usb_quirk_list;
1151 @@ -149,13 +74,9 @@ void usb_detect_quirks(struct usb_device *udev)
1152 dev_dbg(&udev->dev, "USB quirks for this device: %x\n",
1153 udev->quirks);
1154
1155 - /* do any special quirk handling here if needed */
1156 - if (udev->quirks & USB_QUIRK_NO_AUTOSUSPEND)
1157 - usb_autosuspend_quirk(udev);
1158 -
1159 /* By default, disable autosuspend for all non-hubs */
1160 #ifdef CONFIG_USB_SUSPEND
1161 if (udev->descriptor.bDeviceClass != USB_CLASS_HUB)
1162 - udev->autosuspend_delay = -1;
1163 + udev->autosuspend_disabled = 1;
1164 #endif
1165 }
1166 diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
1167 index be63022..3da7979 100644
1168 --- a/drivers/usb/core/urb.c
1169 +++ b/drivers/usb/core/urb.c
1170 @@ -358,7 +358,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
1171
1172 /* enforce simple/standard policy */
1173 allowed = (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP |
1174 - URB_NO_INTERRUPT);
1175 + URB_NO_INTERRUPT | URB_FREE_BUFFER);
1176 switch (temp) {
1177 case PIPE_BULK:
1178 if (is_out)
1179 diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
1180 index 593e235..d57de87 100644
1181 --- a/drivers/usb/gadget/ether.c
1182 +++ b/drivers/usb/gadget/ether.c
1183 @@ -1989,8 +1989,20 @@ static int eth_start_xmit (struct sk_buff *skb, struct net_device *net)
1184 }
1185
1186 spin_lock_irqsave(&dev->req_lock, flags);
1187 + /*
1188 + * this freelist can be empty if an interrupt triggered disconnect()
1189 + * and reconfigured the gadget (shutting down this queue) after the
1190 + * network stack decided to xmit but before we got the spinlock.
1191 + */
1192 + if (list_empty(&dev->tx_reqs)) {
1193 + spin_unlock_irqrestore(&dev->req_lock, flags);
1194 + return 1;
1195 + }
1196 +
1197 req = container_of (dev->tx_reqs.next, struct usb_request, list);
1198 list_del (&req->list);
1199 +
1200 + /* temporarily stop TX queue when the freelist empties */
1201 if (list_empty (&dev->tx_reqs))
1202 netif_stop_queue (net);
1203 spin_unlock_irqrestore(&dev->req_lock, flags);
1204 diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
1205 index 35cdba1..31310ca 100644
1206 --- a/drivers/usb/host/ehci-hcd.c
1207 +++ b/drivers/usb/host/ehci-hcd.c
1208 @@ -570,10 +570,18 @@ static int ehci_run (struct usb_hcd *hcd)
1209 * are explicitly handed to companion controller(s), so no TT is
1210 * involved with the root hub. (Except where one is integrated,
1211 * and there's no companion controller unless maybe for USB OTG.)
1212 + *
1213 + * Turning on the CF flag will transfer ownership of all ports
1214 + * from the companions to the EHCI controller. If any of the
1215 + * companions are in the middle of a port reset at the time, it
1216 + * could cause trouble. Write-locking ehci_cf_port_reset_rwsem
1217 + * guarantees that no resets are in progress.
1218 */
1219 + down_write(&ehci_cf_port_reset_rwsem);
1220 hcd->state = HC_STATE_RUNNING;
1221 ehci_writel(ehci, FLAG_CF, &ehci->regs->configured_flag);
1222 ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */
1223 + up_write(&ehci_cf_port_reset_rwsem);
1224
1225 temp = HC_VERSION(ehci_readl(ehci, &ehci->caps->hc_capbase));
1226 ehci_info (ehci,
1227 diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
1228 index 88a2c7d..9eb4a65 100644
1229 --- a/drivers/usb/serial/generic.c
1230 +++ b/drivers/usb/serial/generic.c
1231 @@ -208,14 +208,15 @@ int usb_serial_generic_write(struct usb_serial_port *port, const unsigned char *
1232
1233 /* only do something if we have a bulk out endpoint */
1234 if (serial->num_bulk_out) {
1235 - spin_lock_bh(&port->lock);
1236 + unsigned long flags;
1237 + spin_lock_irqsave(&port->lock, flags);
1238 if (port->write_urb_busy) {
1239 - spin_unlock_bh(&port->lock);
1240 + spin_unlock_irqrestore(&port->lock, flags);
1241 dbg("%s - already writing", __FUNCTION__);
1242 return 0;
1243 }
1244 port->write_urb_busy = 1;
1245 - spin_unlock_bh(&port->lock);
1246 + spin_unlock_irqrestore(&port->lock, flags);
1247
1248 count = (count > port->bulk_out_size) ? port->bulk_out_size : count;
1249
1250 diff --git a/drivers/video/platinumfb.c b/drivers/video/platinumfb.c
1251 index 8503e73..cbe71a5 100644
1252 --- a/drivers/video/platinumfb.c
1253 +++ b/drivers/video/platinumfb.c
1254 @@ -17,6 +17,8 @@
1255 * more details.
1256 */
1257
1258 +#undef DEBUG
1259 +
1260 #include <linux/module.h>
1261 #include <linux/kernel.h>
1262 #include <linux/errno.h>
1263 @@ -535,33 +537,35 @@ static int __devinit platinumfb_probe(struct of_device* odev,
1264 volatile __u8 *fbuffer;
1265 int bank0, bank1, bank2, bank3, rc;
1266
1267 - printk(KERN_INFO "platinumfb: Found Apple Platinum video hardware\n");
1268 + dev_info(&odev->dev, "Found Apple Platinum video hardware\n");
1269
1270 info = framebuffer_alloc(sizeof(*pinfo), &odev->dev);
1271 - if (info == NULL)
1272 + if (info == NULL) {
1273 + dev_err(&odev->dev, "Failed to allocate fbdev !\n");
1274 return -ENOMEM;
1275 + }
1276 pinfo = info->par;
1277
1278 if (of_address_to_resource(dp, 0, &pinfo->rsrc_reg) ||
1279 of_address_to_resource(dp, 1, &pinfo->rsrc_fb)) {
1280 - printk(KERN_ERR "platinumfb: Can't get resources\n");
1281 - framebuffer_release(info);
1282 - return -ENXIO;
1283 - }
1284 - if (!request_mem_region(pinfo->rsrc_reg.start,
1285 - pinfo->rsrc_reg.start -
1286 - pinfo->rsrc_reg.end + 1,
1287 - "platinumfb registers")) {
1288 + dev_err(&odev->dev, "Can't get resources\n");
1289 framebuffer_release(info);
1290 return -ENXIO;
1291 }
1292 + dev_dbg(&odev->dev, " registers : 0x%llx...0x%llx\n",
1293 + (unsigned long long)pinfo->rsrc_reg.start,
1294 + (unsigned long long)pinfo->rsrc_reg.end);
1295 + dev_dbg(&odev->dev, " framebuffer: 0x%llx...0x%llx\n",
1296 + (unsigned long long)pinfo->rsrc_fb.start,
1297 + (unsigned long long)pinfo->rsrc_fb.end);
1298 +
1299 + /* Do not try to request register space, they overlap with the
1300 + * northbridge and that can fail. Only request framebuffer
1301 + */
1302 if (!request_mem_region(pinfo->rsrc_fb.start,
1303 - pinfo->rsrc_fb.start
1304 - - pinfo->rsrc_fb.end + 1,
1305 + pinfo->rsrc_fb.end - pinfo->rsrc_fb.start + 1,
1306 "platinumfb framebuffer")) {
1307 - release_mem_region(pinfo->rsrc_reg.start,
1308 - pinfo->rsrc_reg.end -
1309 - pinfo->rsrc_reg.start + 1);
1310 + printk(KERN_ERR "platinumfb: Can't request framebuffer !\n");
1311 framebuffer_release(info);
1312 return -ENXIO;
1313 }
1314 @@ -600,7 +604,8 @@ static int __devinit platinumfb_probe(struct of_device* odev,
1315 bank2 = fbuffer[0x200000] == 0x56;
1316 bank3 = fbuffer[0x300000] == 0x78;
1317 pinfo->total_vram = (bank0 + bank1 + bank2 + bank3) * 0x100000;
1318 - printk(KERN_INFO "platinumfb: Total VRAM = %dMB (%d%d%d%d)\n", (int) (pinfo->total_vram / 1024 / 1024),
1319 + printk(KERN_INFO "platinumfb: Total VRAM = %dMB (%d%d%d%d)\n",
1320 + (unsigned int) (pinfo->total_vram / 1024 / 1024),
1321 bank3, bank2, bank1, bank0);
1322
1323 /*
1324 @@ -644,16 +649,15 @@ static int __devexit platinumfb_remove(struct of_device* odev)
1325 unregister_framebuffer (info);
1326
1327 /* Unmap frame buffer and registers */
1328 + iounmap(pinfo->frame_buffer);
1329 + iounmap(pinfo->platinum_regs);
1330 + iounmap(pinfo->cmap_regs);
1331 +
1332 release_mem_region(pinfo->rsrc_fb.start,
1333 pinfo->rsrc_fb.end -
1334 pinfo->rsrc_fb.start + 1);
1335 - release_mem_region(pinfo->rsrc_reg.start,
1336 - pinfo->rsrc_reg.end -
1337 - pinfo->rsrc_reg.start + 1);
1338 - iounmap(pinfo->frame_buffer);
1339 - iounmap(pinfo->platinum_regs);
1340 +
1341 release_mem_region(pinfo->cmap_regs_phys, 0x1000);
1342 - iounmap(pinfo->cmap_regs);
1343
1344 framebuffer_release(info);
1345
1346 diff --git a/include/linux/ide.h b/include/linux/ide.h
1347 index b9f66c1..20528c0 100644
1348 --- a/include/linux/ide.h
1349 +++ b/include/linux/ide.h
1350 @@ -1437,4 +1437,11 @@ static inline int hwif_to_node(ide_hwif_t *hwif)
1351 return dev ? pcibus_to_node(dev->bus) : -1;
1352 }
1353
1354 +static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive)
1355 +{
1356 + ide_hwif_t *hwif = HWIF(drive);
1357 +
1358 + return &hwif->drives[(drive->dn ^ 1) & 1];
1359 +}
1360 +
1361 #endif /* _IDE_H */
1362 diff --git a/include/linux/libata.h b/include/linux/libata.h
1363 index a67bb90..9ccca8f 100644
1364 --- a/include/linux/libata.h
1365 +++ b/include/linux/libata.h
1366 @@ -177,6 +177,8 @@ enum {
1367 ATA_FLAG_IGN_SIMPLEX = (1 << 15), /* ignore SIMPLEX */
1368 ATA_FLAG_NO_IORDY = (1 << 16), /* controller lacks iordy */
1369 ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */
1370 + ATA_FLAG_NO_SRST = (1 << 18),
1371 + ATA_FLAG_ASSUME_ATA = (1 << 19),
1372
1373 /* The following flag belongs to ap->pflags but is kept in
1374 * ap->flags because it's referenced in many LLDs and will be
1375 diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
1376 index 8da374c..2692ec9 100644
1377 --- a/include/linux/usb/quirks.h
1378 +++ b/include/linux/usb/quirks.h
1379 @@ -4,11 +4,8 @@
1380 * belong here.
1381 */
1382
1383 -/* device must not be autosuspended */
1384 -#define USB_QUIRK_NO_AUTOSUSPEND 0x00000001
1385 -
1386 /* string descriptors must not be fetched using a 255-byte read */
1387 -#define USB_QUIRK_STRING_FETCH_255 0x00000002
1388 +#define USB_QUIRK_STRING_FETCH_255 0x00000001
1389
1390 /* device can't resume correctly so reset it instead */
1391 -#define USB_QUIRK_RESET_RESUME 0x00000004
1392 +#define USB_QUIRK_RESET_RESUME 0x00000002
1393 diff --git a/sound/core/Makefile b/sound/core/Makefile
1394 index 5a01c76..05f5cdc 100644
1395 --- a/sound/core/Makefile
1396 +++ b/sound/core/Makefile
1397 @@ -14,7 +14,8 @@ endif
1398 snd-pcm-objs := pcm.o pcm_native.o pcm_lib.o pcm_timer.o pcm_misc.o \
1399 pcm_memory.o
1400
1401 -snd-page-alloc-objs := memalloc.o sgbuf.o
1402 +snd-page-alloc-y := memalloc.o
1403 +snd-page-alloc-$(CONFIG_HAS_DMA) += sgbuf.o
1404
1405 snd-rawmidi-objs := rawmidi.o
1406 snd-timer-objs := timer.o
1407 diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c
1408 index 9b5656d..6f99b6f 100644
1409 --- a/sound/core/memalloc.c
1410 +++ b/sound/core/memalloc.c
1411 @@ -206,6 +206,7 @@ void snd_free_pages(void *ptr, size_t size)
1412 *
1413 */
1414
1415 +#ifdef CONFIG_HAS_DMA
1416 /* allocate the coherent DMA pages */
1417 static void *snd_malloc_dev_pages(struct device *dev, size_t size, dma_addr_t *dma)
1418 {
1419 @@ -239,6 +240,7 @@ static void snd_free_dev_pages(struct device *dev, size_t size, void *ptr,
1420 dec_snd_pages(pg);
1421 dma_free_coherent(dev, PAGE_SIZE << pg, ptr, dma);
1422 }
1423 +#endif /* CONFIG_HAS_DMA */
1424
1425 #ifdef CONFIG_SBUS
1426
1427 @@ -312,12 +314,14 @@ int snd_dma_alloc_pages(int type, struct device *device, size_t size,
1428 dmab->area = snd_malloc_sbus_pages(device, size, &dmab->addr);
1429 break;
1430 #endif
1431 +#ifdef CONFIG_HAS_DMA
1432 case SNDRV_DMA_TYPE_DEV:
1433 dmab->area = snd_malloc_dev_pages(device, size, &dmab->addr);
1434 break;
1435 case SNDRV_DMA_TYPE_DEV_SG:
1436 snd_malloc_sgbuf_pages(device, size, dmab, NULL);
1437 break;
1438 +#endif
1439 default:
1440 printk(KERN_ERR "snd-malloc: invalid device type %d\n", type);
1441 dmab->area = NULL;
1442 @@ -383,12 +387,14 @@ void snd_dma_free_pages(struct snd_dma_buffer *dmab)
1443 snd_free_sbus_pages(dmab->dev.dev, dmab->bytes, dmab->area, dmab->addr);
1444 break;
1445 #endif
1446 +#ifdef CONFIG_HAS_DMA
1447 case SNDRV_DMA_TYPE_DEV:
1448 snd_free_dev_pages(dmab->dev.dev, dmab->bytes, dmab->area, dmab->addr);
1449 break;
1450 case SNDRV_DMA_TYPE_DEV_SG:
1451 snd_free_sgbuf_pages(dmab);
1452 break;
1453 +#endif
1454 default:
1455 printk(KERN_ERR "snd-malloc: invalid device type %d\n", dmab->dev.type);
1456 }
1457 diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c
1458 index 7b2c1dc..5bff700 100644
1459 --- a/sound/pci/emu10k1/emumixer.c
1460 +++ b/sound/pci/emu10k1/emumixer.c
1461 @@ -871,7 +871,7 @@ static struct snd_kcontrol_new snd_emu10k1_spdif_mask_control =
1462 .access = SNDRV_CTL_ELEM_ACCESS_READ,
1463 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1464 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,MASK),
1465 - .count = 4,
1466 + .count = 3,
1467 .info = snd_emu10k1_spdif_info,
1468 .get = snd_emu10k1_spdif_get_mask
1469 };
1470 @@ -880,7 +880,7 @@ static struct snd_kcontrol_new snd_emu10k1_spdif_control =
1471 {
1472 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1473 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT),
1474 - .count = 4,
1475 + .count = 3,
1476 .info = snd_emu10k1_spdif_info,
1477 .get = snd_emu10k1_spdif_get,
1478 .put = snd_emu10k1_spdif_put
1479 diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
1480 index 3f25de7..d46e7e4 100644
1481 --- a/sound/pci/hda/patch_sigmatel.c
1482 +++ b/sound/pci/hda/patch_sigmatel.c
1483 @@ -162,8 +162,9 @@ static hda_nid_t stac925x_dac_nids[1] = {
1484 0x02,
1485 };
1486
1487 -static hda_nid_t stac925x_dmic_nids[1] = {
1488 - 0x15,
1489 +#define STAC925X_NUM_DMICS 1
1490 +static hda_nid_t stac925x_dmic_nids[STAC925X_NUM_DMICS + 1] = {
1491 + 0x15, 0
1492 };
1493
1494 static hda_nid_t stac922x_adc_nids[2] = {
1495 @@ -190,8 +191,9 @@ static hda_nid_t stac9205_mux_nids[2] = {
1496 0x19, 0x1a
1497 };
1498
1499 -static hda_nid_t stac9205_dmic_nids[2] = {
1500 - 0x17, 0x18,
1501 +#define STAC9205_NUM_DMICS 2
1502 +static hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = {
1503 + 0x17, 0x18, 0
1504 };
1505
1506 static hda_nid_t stac9200_pin_nids[8] = {
1507 @@ -1182,7 +1184,8 @@ static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cf
1508 case 3:
1509 /* add line-in as side */
1510 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 3) {
1511 - cfg->line_out_pins[3] = cfg->input_pins[AUTO_PIN_LINE];
1512 + cfg->line_out_pins[cfg->line_outs] =
1513 + cfg->input_pins[AUTO_PIN_LINE];
1514 spec->line_switch = 1;
1515 cfg->line_outs++;
1516 }
1517 @@ -1190,12 +1193,14 @@ static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cf
1518 case 2:
1519 /* add line-in as clfe and mic as side */
1520 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 2) {
1521 - cfg->line_out_pins[2] = cfg->input_pins[AUTO_PIN_LINE];
1522 + cfg->line_out_pins[cfg->line_outs] =
1523 + cfg->input_pins[AUTO_PIN_LINE];
1524 spec->line_switch = 1;
1525 cfg->line_outs++;
1526 }
1527 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 3) {
1528 - cfg->line_out_pins[3] = cfg->input_pins[AUTO_PIN_MIC];
1529 + cfg->line_out_pins[cfg->line_outs] =
1530 + cfg->input_pins[AUTO_PIN_MIC];
1531 spec->mic_switch = 1;
1532 cfg->line_outs++;
1533 }
1534 @@ -1203,12 +1208,14 @@ static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cf
1535 case 1:
1536 /* add line-in as surr and mic as clfe */
1537 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 1) {
1538 - cfg->line_out_pins[1] = cfg->input_pins[AUTO_PIN_LINE];
1539 + cfg->line_out_pins[cfg->line_outs] =
1540 + cfg->input_pins[AUTO_PIN_LINE];
1541 spec->line_switch = 1;
1542 cfg->line_outs++;
1543 }
1544 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 2) {
1545 - cfg->line_out_pins[2] = cfg->input_pins[AUTO_PIN_MIC];
1546 + cfg->line_out_pins[cfg->line_outs] =
1547 + cfg->input_pins[AUTO_PIN_MIC];
1548 spec->mic_switch = 1;
1549 cfg->line_outs++;
1550 }
1551 @@ -2058,7 +2065,7 @@ static int patch_stac925x(struct hda_codec *codec)
1552 case 0x83847633: /* STAC9202D */
1553 case 0x83847636: /* STAC9251 */
1554 case 0x83847637: /* STAC9251D */
1555 - spec->num_dmics = 1;
1556 + spec->num_dmics = STAC925X_NUM_DMICS;
1557 spec->dmic_nids = stac925x_dmic_nids;
1558 break;
1559 default:
1560 @@ -2302,7 +2309,7 @@ static int patch_stac9205(struct hda_codec *codec)
1561 spec->mux_nids = stac9205_mux_nids;
1562 spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids);
1563 spec->dmic_nids = stac9205_dmic_nids;
1564 - spec->num_dmics = ARRAY_SIZE(stac9205_dmic_nids);
1565 + spec->num_dmics = STAC9205_NUM_DMICS;
1566 spec->dmux_nid = 0x1d;
1567
1568 spec->init = stac9205_core_init;
1569 diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
1570 index 3b3ef65..75dcb9a 100644
1571 --- a/sound/pci/rme9652/hdsp.c
1572 +++ b/sound/pci/rme9652/hdsp.c
1573 @@ -3108,6 +3108,9 @@ static int hdsp_dds_offset(struct hdsp *hdsp)
1574 unsigned int dds_value = hdsp->dds_value;
1575 int system_sample_rate = hdsp->system_sample_rate;
1576
1577 + if (!dds_value)
1578 + return 0;
1579 +
1580 n = DDS_NUMERATOR;
1581 /*
1582 * dds_value = n / rate
1583 diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c
1584 index 325d4b6..19776e7 100644
1585 --- a/sound/usb/usbmixer.c
1586 +++ b/sound/usb/usbmixer.c
1587 @@ -1483,7 +1483,7 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, unsi
1588 struct snd_kcontrol *kctl;
1589 char **namelist;
1590
1591 - if (! num_ins || desc[0] < 6 + num_ins) {
1592 + if (! num_ins || desc[0] < 5 + num_ins) {
1593 snd_printk(KERN_ERR "invalid SELECTOR UNIT descriptor %d\n", unitid);
1594 return -EINVAL;
1595 }