aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/sleep/main.c71
-rw-r--r--drivers/atm/firestream.c1
-rw-r--r--drivers/atm/he.c3
-rw-r--r--drivers/atm/idt77252.c6
-rw-r--r--drivers/atm/iphase.c2
-rw-r--r--drivers/block/nbd.c6
-rw-r--r--drivers/char/ip2/i2lib.c12
-rw-r--r--drivers/char/rio/riotable.c4
-rw-r--r--drivers/char/rio/riotty.c4
-rw-r--r--drivers/firewire/fw-ohci.c9
-rw-r--r--drivers/hwmon/w83781d.c21
-rw-r--r--drivers/ide/arm/ide_arm.c2
-rw-r--r--drivers/ide/cris/ide-cris.c2
-rw-r--r--drivers/ide/h8300/ide-h8300.c3
-rw-r--r--drivers/ide/ide-iops.c2
-rw-r--r--drivers/ide/ide-pnp.c2
-rw-r--r--drivers/ide/legacy/buddha.c2
-rw-r--r--drivers/ide/legacy/falconide.c2
-rw-r--r--drivers/ide/legacy/gayle.c2
-rw-r--r--drivers/ide/legacy/macide.c2
-rw-r--r--drivers/ide/legacy/q40ide.c2
-rw-r--r--drivers/ide/pci/cmd640.c2
-rw-r--r--drivers/ide/ppc/mpc8xx.c2
-rw-r--r--drivers/ide/ppc/pmac.c2
-rw-r--r--drivers/input/apm-power.c7
-rw-r--r--drivers/input/evdev.c6
-rw-r--r--drivers/input/joydev.c3
-rw-r--r--drivers/input/keyboard/pxa27x_keypad.c6
-rw-r--r--drivers/input/mousedev.c3
-rw-r--r--drivers/leds/leds-gpio.c20
-rw-r--r--drivers/media/radio/radio-cadet.c6
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c31
-rw-r--r--drivers/media/video/cx23885/cx23885-cards.c6
-rw-r--r--drivers/media/video/cx23885/cx23885-core.c134
-rw-r--r--drivers/media/video/v4l2-int-device.c2
-rw-r--r--drivers/net/Kconfig2
-rw-r--r--drivers/net/bfin_mac.c2
-rw-r--r--drivers/net/bonding/bond_sysfs.c1
-rw-r--r--drivers/net/forcedeth.c18
-rw-r--r--drivers/net/ibm_newemac/core.c4
-rw-r--r--drivers/net/plip.c7
-rw-r--r--drivers/net/s2io.c2
-rw-r--r--drivers/net/sky2.c6
-rw-r--r--drivers/net/tulip/eeprom.c6
-rw-r--r--drivers/net/tulip/tulip_core.c7
-rw-r--r--drivers/net/usb/Kconfig2
-rw-r--r--drivers/net/usb/dm9601.c2
-rw-r--r--drivers/net/usb/pegasus.c4
-rw-r--r--drivers/net/wan/lapbether.c2
-rw-r--r--drivers/net/wireless/b43/dma.c7
-rw-r--r--drivers/net/wireless/b43/pcmcia.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c2
-rw-r--r--drivers/net/wireless/libertas/if_cs.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c13
-rw-r--r--drivers/scsi/hosts.c16
-rw-r--r--drivers/scsi/libsas/sas_discover.c5
-rw-r--r--drivers/scsi/mvsas.c711
-rw-r--r--drivers/scsi/scsi_sysfs.c2
-rw-r--r--drivers/serial/atmel_serial.c30
-rw-r--r--drivers/usb/host/ehci-hub.c5
-rw-r--r--drivers/usb/host/ohci-hcd.c2
-rw-r--r--drivers/usb/host/ohci-q.c2
-rw-r--r--drivers/usb/misc/usbtest.c3
-rw-r--r--drivers/usb/serial/cp2101.c1
-rw-r--r--drivers/usb/serial/keyspan.h4
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c4
-rw-r--r--drivers/usb/serial/visor.c2
-rw-r--r--drivers/watchdog/it8712f_wdt.c14
68 files changed, 743 insertions, 543 deletions
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c
index d2f71a54726c..71183eea7906 100644
--- a/drivers/acpi/sleep/main.c
+++ b/drivers/acpi/sleep/main.c
@@ -26,21 +26,6 @@ u8 sleep_states[ACPI_S_STATE_COUNT];
26 26
27#ifdef CONFIG_PM_SLEEP 27#ifdef CONFIG_PM_SLEEP
28static u32 acpi_target_sleep_state = ACPI_STATE_S0; 28static u32 acpi_target_sleep_state = ACPI_STATE_S0;
29static bool acpi_sleep_finish_wake_up;
30
31/*
32 * ACPI 2.0 and later want us to execute _PTS after suspending devices, so we
33 * allow the user to request that behavior by using the 'acpi_new_pts_ordering'
34 * kernel command line option that causes the following variable to be set.
35 */
36static bool new_pts_ordering;
37
38static int __init acpi_new_pts_ordering(char *str)
39{
40 new_pts_ordering = true;
41 return 1;
42}
43__setup("acpi_new_pts_ordering", acpi_new_pts_ordering);
44#endif 29#endif
45 30
46static int acpi_sleep_prepare(u32 acpi_state) 31static int acpi_sleep_prepare(u32 acpi_state)
@@ -91,14 +76,6 @@ static int acpi_pm_begin(suspend_state_t pm_state)
91 76
92 if (sleep_states[acpi_state]) { 77 if (sleep_states[acpi_state]) {
93 acpi_target_sleep_state = acpi_state; 78 acpi_target_sleep_state = acpi_state;
94 if (new_pts_ordering)
95 return 0;
96
97 error = acpi_sleep_prepare(acpi_state);
98 if (error)
99 acpi_target_sleep_state = ACPI_STATE_S0;
100 else
101 acpi_sleep_finish_wake_up = true;
102 } else { 79 } else {
103 printk(KERN_ERR "ACPI does not support this state: %d\n", 80 printk(KERN_ERR "ACPI does not support this state: %d\n",
104 pm_state); 81 pm_state);
@@ -116,14 +93,11 @@ static int acpi_pm_begin(suspend_state_t pm_state)
116 93
117static int acpi_pm_prepare(void) 94static int acpi_pm_prepare(void)
118{ 95{
119 if (new_pts_ordering) { 96 int error = acpi_sleep_prepare(acpi_target_sleep_state);
120 int error = acpi_sleep_prepare(acpi_target_sleep_state);
121 97
122 if (error) { 98 if (error) {
123 acpi_target_sleep_state = ACPI_STATE_S0; 99 acpi_target_sleep_state = ACPI_STATE_S0;
124 return error; 100 return error;
125 }
126 acpi_sleep_finish_wake_up = true;
127 } 101 }
128 102
129 return ACPI_SUCCESS(acpi_hw_disable_all_gpes()) ? 0 : -EFAULT; 103 return ACPI_SUCCESS(acpi_hw_disable_all_gpes()) ? 0 : -EFAULT;
@@ -212,7 +186,6 @@ static void acpi_pm_finish(void)
212 acpi_set_firmware_waking_vector((acpi_physical_address) 0); 186 acpi_set_firmware_waking_vector((acpi_physical_address) 0);
213 187
214 acpi_target_sleep_state = ACPI_STATE_S0; 188 acpi_target_sleep_state = ACPI_STATE_S0;
215 acpi_sleep_finish_wake_up = false;
216 189
217#ifdef CONFIG_X86 190#ifdef CONFIG_X86
218 if (init_8259A_after_S1) { 191 if (init_8259A_after_S1) {
@@ -229,11 +202,10 @@ static void acpi_pm_finish(void)
229static void acpi_pm_end(void) 202static void acpi_pm_end(void)
230{ 203{
231 /* 204 /*
232 * This is necessary in case acpi_pm_finish() is not called directly 205 * This is necessary in case acpi_pm_finish() is not called during a
233 * during a failing transition to a sleep state. 206 * failing transition to a sleep state.
234 */ 207 */
235 if (acpi_sleep_finish_wake_up) 208 acpi_target_sleep_state = ACPI_STATE_S0;
236 acpi_pm_finish();
237} 209}
238 210
239static int acpi_pm_state_valid(suspend_state_t pm_state) 211static int acpi_pm_state_valid(suspend_state_t pm_state)
@@ -285,31 +257,18 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
285#ifdef CONFIG_HIBERNATION 257#ifdef CONFIG_HIBERNATION
286static int acpi_hibernation_begin(void) 258static int acpi_hibernation_begin(void)
287{ 259{
288 int error;
289
290 acpi_target_sleep_state = ACPI_STATE_S4; 260 acpi_target_sleep_state = ACPI_STATE_S4;
291 if (new_pts_ordering)
292 return 0;
293 261
294 error = acpi_sleep_prepare(ACPI_STATE_S4); 262 return 0;
295 if (error)
296 acpi_target_sleep_state = ACPI_STATE_S0;
297 else
298 acpi_sleep_finish_wake_up = true;
299
300 return error;
301} 263}
302 264
303static int acpi_hibernation_prepare(void) 265static int acpi_hibernation_prepare(void)
304{ 266{
305 if (new_pts_ordering) { 267 int error = acpi_sleep_prepare(ACPI_STATE_S4);
306 int error = acpi_sleep_prepare(ACPI_STATE_S4);
307 268
308 if (error) { 269 if (error) {
309 acpi_target_sleep_state = ACPI_STATE_S0; 270 acpi_target_sleep_state = ACPI_STATE_S0;
310 return error; 271 return error;
311 }
312 acpi_sleep_finish_wake_up = true;
313 } 272 }
314 273
315 return ACPI_SUCCESS(acpi_hw_disable_all_gpes()) ? 0 : -EFAULT; 274 return ACPI_SUCCESS(acpi_hw_disable_all_gpes()) ? 0 : -EFAULT;
@@ -353,17 +312,15 @@ static void acpi_hibernation_finish(void)
353 acpi_set_firmware_waking_vector((acpi_physical_address) 0); 312 acpi_set_firmware_waking_vector((acpi_physical_address) 0);
354 313
355 acpi_target_sleep_state = ACPI_STATE_S0; 314 acpi_target_sleep_state = ACPI_STATE_S0;
356 acpi_sleep_finish_wake_up = false;
357} 315}
358 316
359static void acpi_hibernation_end(void) 317static void acpi_hibernation_end(void)
360{ 318{
361 /* 319 /*
362 * This is necessary in case acpi_hibernation_finish() is not called 320 * This is necessary in case acpi_hibernation_finish() is not called
363 * directly during a failing transition to the sleep state. 321 * during a failing transition to the sleep state.
364 */ 322 */
365 if (acpi_sleep_finish_wake_up) 323 acpi_target_sleep_state = ACPI_STATE_S0;
366 acpi_hibernation_finish();
367} 324}
368 325
369static int acpi_hibernation_pre_restore(void) 326static int acpi_hibernation_pre_restore(void)
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index 47c57a4294b7..98099f526d82 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -978,6 +978,7 @@ static int fs_open(struct atm_vcc *atm_vcc)
978 /* Docs are vague about this atm_hdr field. By the way, the FS 978 /* Docs are vague about this atm_hdr field. By the way, the FS
979 * chip makes odd errors if lower bits are set.... -- REW */ 979 * chip makes odd errors if lower bits are set.... -- REW */
980 tc->atm_hdr = (vpi << 20) | (vci << 4); 980 tc->atm_hdr = (vpi << 20) | (vci << 4);
981 tmc0 = 0;
981 { 982 {
982 int pcr = atm_pcr_goal (txtp); 983 int pcr = atm_pcr_goal (txtp);
983 984
diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index 2e3395b7e8c1..ffc4a5a41946 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -3000,8 +3000,7 @@ he_proc_read(struct atm_dev *dev, loff_t *pos, char *page)
3000 3000
3001/* eeprom routines -- see 4.7 */ 3001/* eeprom routines -- see 4.7 */
3002 3002
3003u8 3003static u8 read_prom_byte(struct he_dev *he_dev, int addr)
3004read_prom_byte(struct he_dev *he_dev, int addr)
3005{ 3004{
3006 u32 val = 0, tmp_read = 0; 3005 u32 val = 0, tmp_read = 0;
3007 int i, j = 0; 3006 int i, j = 0;
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
index b967919fb7e2..28d77b5195de 100644
--- a/drivers/atm/idt77252.c
+++ b/drivers/atm/idt77252.c
@@ -2016,8 +2016,7 @@ idt77252_send_skb(struct atm_vcc *vcc, struct sk_buff *skb, int oam)
2016 return 0; 2016 return 0;
2017} 2017}
2018 2018
2019int 2019static int idt77252_send(struct atm_vcc *vcc, struct sk_buff *skb)
2020idt77252_send(struct atm_vcc *vcc, struct sk_buff *skb)
2021{ 2020{
2022 return idt77252_send_skb(vcc, skb, 0); 2021 return idt77252_send_skb(vcc, skb, 0);
2023} 2022}
@@ -3072,8 +3071,7 @@ idt77252_dev_open(struct idt77252_dev *card)
3072 return 0; 3071 return 0;
3073} 3072}
3074 3073
3075void 3074static void idt77252_dev_close(struct atm_dev *dev)
3076idt77252_dev_close(struct atm_dev *dev)
3077{ 3075{
3078 struct idt77252_dev *card = dev->dev_data; 3076 struct idt77252_dev *card = dev->dev_data;
3079 u32 conf; 3077 u32 conf;
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index ef52452640e0..670c093ed25f 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -958,6 +958,7 @@ static void ia_suni_pm7345_init (IADEV *iadev)
958 958
959/***************************** IA_LIB END *****************************/ 959/***************************** IA_LIB END *****************************/
960 960
961#ifdef CONFIG_ATM_IA_DEBUG
961static int tcnter = 0; 962static int tcnter = 0;
962static void xdump( u_char* cp, int length, char* prefix ) 963static void xdump( u_char* cp, int length, char* prefix )
963{ 964{
@@ -992,6 +993,7 @@ static void xdump( u_char* cp, int length, char* prefix )
992 } 993 }
993 994
994} /* close xdump(... */ 995} /* close xdump(... */
996#endif /* CONFIG_ATM_IA_DEBUG */
995 997
996 998
997static struct atm_dev *ia_boards = NULL; 999static struct atm_dev *ia_boards = NULL;
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index b53fdb0a282c..60cc54368b66 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -153,6 +153,12 @@ static int sock_xmit(struct nbd_device *lo, int send, void *buf, int size,
153 struct kvec iov; 153 struct kvec iov;
154 sigset_t blocked, oldset; 154 sigset_t blocked, oldset;
155 155
156 if (unlikely(!sock)) {
157 printk(KERN_ERR "%s: Attempted %s on closed socket in sock_xmit\n",
158 lo->disk->disk_name, (send ? "send" : "recv"));
159 return -EINVAL;
160 }
161
156 /* Allow interception of SIGKILL only 162 /* Allow interception of SIGKILL only
157 * Don't allow other signals to interrupt the transmission */ 163 * Don't allow other signals to interrupt the transmission */
158 siginitsetinv(&blocked, sigmask(SIGKILL)); 164 siginitsetinv(&blocked, sigmask(SIGKILL));
diff --git a/drivers/char/ip2/i2lib.c b/drivers/char/ip2/i2lib.c
index d6567b32fb5c..9c25320121ef 100644
--- a/drivers/char/ip2/i2lib.c
+++ b/drivers/char/ip2/i2lib.c
@@ -644,12 +644,12 @@ i2QueueCommands(int type, i2ChanStrPtr pCh, int timeout, int nCommands,
644 // Normal Expected path - We still hold LOCK 644 // Normal Expected path - We still hold LOCK
645 break; /* from for()- Enough room: goto proceed */ 645 break; /* from for()- Enough room: goto proceed */
646 } 646 }
647 } 647 ip2trace(CHANN, ITRC_QUEUE, 3, 1, totalsize);
648 648 WRITE_UNLOCK_IRQRESTORE(lock_var_p, flags);
649 ip2trace (CHANN, ITRC_QUEUE, 3, 1, totalsize ); 649 } else
650 ip2trace(CHANN, ITRC_QUEUE, 3, 1, totalsize);
650 651
651 // Prepare to wait for buffers to empty 652 /* Prepare to wait for buffers to empty */
652 WRITE_UNLOCK_IRQRESTORE(lock_var_p,flags);
653 serviceOutgoingFifo(pB); // Dump what we got 653 serviceOutgoingFifo(pB); // Dump what we got
654 654
655 if (timeout == 0) { 655 if (timeout == 0) {
@@ -1830,6 +1830,8 @@ i2StripFifo(i2eBordStrPtr pB)
1830 default: // Neither packet? should be impossible 1830 default: // Neither packet? should be impossible
1831 ip2trace (ITRC_NO_PORT, ITRC_SFIFO, 5, 1, 1831 ip2trace (ITRC_NO_PORT, ITRC_SFIFO, 5, 1,
1832 PTYPE_OF(pB->i2eLeadoffWord) ); 1832 PTYPE_OF(pB->i2eLeadoffWord) );
1833 WRITE_UNLOCK_IRQRESTORE(&pB->read_fifo_spinlock,
1834 bflags);
1833 1835
1834 break; 1836 break;
1835 } // End of switch on type of packets 1837 } // End of switch on type of packets
diff --git a/drivers/char/rio/riotable.c b/drivers/char/rio/riotable.c
index 991119c9f473..9b52892a501f 100644
--- a/drivers/char/rio/riotable.c
+++ b/drivers/char/rio/riotable.c
@@ -425,8 +425,10 @@ int RIOApel(struct rio_info *p)
425 425
426 MapP = &p->RIOConnectTable[Next++]; 426 MapP = &p->RIOConnectTable[Next++];
427 MapP->HostUniqueNum = HostP->UniqueNum; 427 MapP->HostUniqueNum = HostP->UniqueNum;
428 if ((HostP->Flags & RUN_STATE) != RC_RUNNING) 428 if ((HostP->Flags & RUN_STATE) != RC_RUNNING) {
429 rio_spin_unlock_irqrestore(&HostP->HostLock, flags);
429 continue; 430 continue;
431 }
430 MapP->RtaUniqueNum = 0; 432 MapP->RtaUniqueNum = 0;
431 MapP->ID = 0; 433 MapP->ID = 0;
432 MapP->Flags = SLOT_IN_USE; 434 MapP->Flags = SLOT_IN_USE;
diff --git a/drivers/char/rio/riotty.c b/drivers/char/rio/riotty.c
index a4f0b1e3e7fa..cfa54361473f 100644
--- a/drivers/char/rio/riotty.c
+++ b/drivers/char/rio/riotty.c
@@ -319,6 +319,7 @@ int riotopen(struct tty_struct *tty, struct file *filp)
319 PortP->State |= RIO_WOPEN; 319 PortP->State |= RIO_WOPEN;
320 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 320 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
321 if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { 321 if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
322 rio_spin_lock_irqsave(&PortP->portSem, flags);
322 /* 323 /*
323 ** ACTION: verify that this is a good thing 324 ** ACTION: verify that this is a good thing
324 ** to do here. -- ??? 325 ** to do here. -- ???
@@ -334,6 +335,7 @@ int riotopen(struct tty_struct *tty, struct file *filp)
334 func_exit(); 335 func_exit();
335 return -EINTR; 336 return -EINTR;
336 } 337 }
338 rio_spin_lock_irqsave(&PortP->portSem, flags);
337 } 339 }
338 PortP->State &= ~RIO_WOPEN; 340 PortP->State &= ~RIO_WOPEN;
339 } 341 }
@@ -493,6 +495,7 @@ int riotclose(void *ptr)
493 495
494 if (RIOShortCommand(p, PortP, CLOSE, 1, 0) == RIO_FAIL) { 496 if (RIOShortCommand(p, PortP, CLOSE, 1, 0) == RIO_FAIL) {
495 RIOPreemptiveCmd(p, PortP, FCLOSE); 497 RIOPreemptiveCmd(p, PortP, FCLOSE);
498 rio_spin_lock_irqsave(&PortP->portSem, flags);
496 goto close_end; 499 goto close_end;
497 } 500 }
498 501
@@ -508,6 +511,7 @@ int riotclose(void *ptr)
508 511
509 if (p->RIOHalted) { 512 if (p->RIOHalted) {
510 RIOClearUp(PortP); 513 RIOClearUp(PortP);
514 rio_spin_lock_irqsave(&PortP->portSem, flags);
511 goto close_end; 515 goto close_end;
512 } 516 }
513 if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { 517 if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c
index 996d61f0d460..ca6d51efd8bb 100644
--- a/drivers/firewire/fw-ohci.c
+++ b/drivers/firewire/fw-ohci.c
@@ -401,7 +401,8 @@ static void ar_context_tasklet(unsigned long data)
401 401
402 if (d->res_count == 0) { 402 if (d->res_count == 0) {
403 size_t size, rest, offset; 403 size_t size, rest, offset;
404 dma_addr_t buffer_bus; 404 dma_addr_t start_bus;
405 void *start;
405 406
406 /* 407 /*
407 * This descriptor is finished and we may have a 408 * This descriptor is finished and we may have a
@@ -410,9 +411,9 @@ static void ar_context_tasklet(unsigned long data)
410 */ 411 */
411 412
412 offset = offsetof(struct ar_buffer, data); 413 offset = offsetof(struct ar_buffer, data);
413 buffer_bus = le32_to_cpu(ab->descriptor.data_address) - offset; 414 start = buffer = ab;
415 start_bus = le32_to_cpu(ab->descriptor.data_address) - offset;
414 416
415 buffer = ab;
416 ab = ab->next; 417 ab = ab->next;
417 d = &ab->descriptor; 418 d = &ab->descriptor;
418 size = buffer + PAGE_SIZE - ctx->pointer; 419 size = buffer + PAGE_SIZE - ctx->pointer;
@@ -427,7 +428,7 @@ static void ar_context_tasklet(unsigned long data)
427 buffer = handle_ar_packet(ctx, buffer); 428 buffer = handle_ar_packet(ctx, buffer);
428 429
429 dma_free_coherent(ohci->card.device, PAGE_SIZE, 430 dma_free_coherent(ohci->card.device, PAGE_SIZE,
430 buffer, buffer_bus); 431 start, start_bus);
431 ar_context_add_page(ctx); 432 ar_context_add_page(ctx);
432 } else { 433 } else {
433 buffer = ctx->pointer; 434 buffer = ctx->pointer;
diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c
index 5c85670e2d16..f942ecdd47c8 100644
--- a/drivers/hwmon/w83781d.c
+++ b/drivers/hwmon/w83781d.c
@@ -1367,7 +1367,8 @@ w83781d_isa_probe(struct platform_device *pdev)
1367 1367
1368 /* Reserve the ISA region */ 1368 /* Reserve the ISA region */
1369 res = platform_get_resource(pdev, IORESOURCE_IO, 0); 1369 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
1370 if (!request_region(res->start, W83781D_EXTENT, "w83781d")) { 1370 if (!request_region(res->start + W83781D_ADDR_REG_OFFSET, 2,
1371 "w83781d")) {
1371 err = -EBUSY; 1372 err = -EBUSY;
1372 goto exit; 1373 goto exit;
1373 } 1374 }
@@ -1415,7 +1416,7 @@ w83781d_isa_probe(struct platform_device *pdev)
1415 device_remove_file(&pdev->dev, &dev_attr_name); 1416 device_remove_file(&pdev->dev, &dev_attr_name);
1416 kfree(data); 1417 kfree(data);
1417 exit_release_region: 1418 exit_release_region:
1418 release_region(res->start, W83781D_EXTENT); 1419 release_region(res->start + W83781D_ADDR_REG_OFFSET, 2);
1419 exit: 1420 exit:
1420 return err; 1421 return err;
1421} 1422}
@@ -1429,7 +1430,7 @@ w83781d_isa_remove(struct platform_device *pdev)
1429 sysfs_remove_group(&pdev->dev.kobj, &w83781d_group); 1430 sysfs_remove_group(&pdev->dev.kobj, &w83781d_group);
1430 sysfs_remove_group(&pdev->dev.kobj, &w83781d_group_opt); 1431 sysfs_remove_group(&pdev->dev.kobj, &w83781d_group_opt);
1431 device_remove_file(&pdev->dev, &dev_attr_name); 1432 device_remove_file(&pdev->dev, &dev_attr_name);
1432 release_region(data->client.addr, W83781D_EXTENT); 1433 release_region(data->client.addr + W83781D_ADDR_REG_OFFSET, 2);
1433 kfree(data); 1434 kfree(data);
1434 1435
1435 return 0; 1436 return 0;
@@ -1797,8 +1798,17 @@ w83781d_isa_found(unsigned short address)
1797{ 1798{
1798 int val, save, found = 0; 1799 int val, save, found = 0;
1799 1800
1800 if (!request_region(address, W83781D_EXTENT, "w83781d")) 1801 /* We have to request the region in two parts because some
1802 boards declare base+4 to base+7 as a PNP device */
1803 if (!request_region(address, 4, "w83781d")) {
1804 pr_debug("w83781d: Failed to request low part of region\n");
1801 return 0; 1805 return 0;
1806 }
1807 if (!request_region(address + 4, 4, "w83781d")) {
1808 pr_debug("w83781d: Failed to request high part of region\n");
1809 release_region(address, 4);
1810 return 0;
1811 }
1802 1812
1803#define REALLY_SLOW_IO 1813#define REALLY_SLOW_IO
1804 /* We need the timeouts for at least some W83781D-like 1814 /* We need the timeouts for at least some W83781D-like
@@ -1871,7 +1881,8 @@ w83781d_isa_found(unsigned short address)
1871 val == 0x30 ? "W83782D" : "W83781D", (int)address); 1881 val == 0x30 ? "W83782D" : "W83781D", (int)address);
1872 1882
1873 release: 1883 release:
1874 release_region(address, W83781D_EXTENT); 1884 release_region(address + 4, 4);
1885 release_region(address, 4);
1875 return found; 1886 return found;
1876} 1887}
1877 1888
diff --git a/drivers/ide/arm/ide_arm.c b/drivers/ide/arm/ide_arm.c
index 43a70e91363e..be9ff7334c52 100644
--- a/drivers/ide/arm/ide_arm.c
+++ b/drivers/ide/arm/ide_arm.c
@@ -46,3 +46,5 @@ static int __init ide_arm_init(void)
46} 46}
47 47
48module_init(ide_arm_init); 48module_init(ide_arm_init);
49
50MODULE_LICENSE("GPL");
diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c
index e79bf8f9b7db..c8ffbaf29a88 100644
--- a/drivers/ide/cris/ide-cris.c
+++ b/drivers/ide/cris/ide-cris.c
@@ -1067,3 +1067,5 @@ static void cris_dma_start(ide_drive_t *drive)
1067} 1067}
1068 1068
1069module_init(init_e100_ide); 1069module_init(init_e100_ide);
1070
1071MODULE_LICENSE("GPL");
diff --git a/drivers/ide/h8300/ide-h8300.c b/drivers/ide/h8300/ide-h8300.c
index 520aec075700..4108ec4ffa7f 100644
--- a/drivers/ide/h8300/ide-h8300.c
+++ b/drivers/ide/h8300/ide-h8300.c
@@ -110,6 +110,7 @@ static int __init h8300_ide_init(void)
110 ide_init_port_data(hwif, index); 110 ide_init_port_data(hwif, index);
111 ide_init_port_hw(hwif, &hw); 111 ide_init_port_hw(hwif, &hw);
112 hwif_setup(hwif); 112 hwif_setup(hwif);
113 hwif->host_flags = IDE_HFLAG_NO_IO_32BIT;
113 printk(KERN_INFO "ide%d: H8/300 generic IDE interface\n", index); 114 printk(KERN_INFO "ide%d: H8/300 generic IDE interface\n", index);
114 115
115 idx[0] = index; 116 idx[0] = index;
@@ -125,3 +126,5 @@ out_busy:
125} 126}
126 127
127module_init(h8300_ide_init); 128module_init(h8300_ide_init);
129
130MODULE_LICENSE("GPL");
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 01b92208f09d..e77cee0e5d65 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -658,7 +658,7 @@ int ide_driveid_update(ide_drive_t *drive)
658 local_irq_restore(flags); 658 local_irq_restore(flags);
659 return 0; 659 return 0;
660 } 660 }
661 ata_input_data(drive, id, SECTOR_WORDS); 661 hwif->ata_input_data(drive, id, SECTOR_WORDS);
662 (void)ide_read_status(drive); /* clear drive IRQ */ 662 (void)ide_read_status(drive); /* clear drive IRQ */
663 local_irq_enable(); 663 local_irq_enable();
664 local_irq_restore(flags); 664 local_irq_restore(flags);
diff --git a/drivers/ide/ide-pnp.c b/drivers/ide/ide-pnp.c
index b163b2e52212..c14bb5380c25 100644
--- a/drivers/ide/ide-pnp.c
+++ b/drivers/ide/ide-pnp.c
@@ -86,3 +86,5 @@ static void __exit pnpide_exit(void)
86 86
87module_init(pnpide_init); 87module_init(pnpide_init);
88module_exit(pnpide_exit); 88module_exit(pnpide_exit);
89
90MODULE_LICENSE("GPL");
diff --git a/drivers/ide/legacy/buddha.c b/drivers/ide/legacy/buddha.c
index 50ffa871d5e9..fdd3791e465f 100644
--- a/drivers/ide/legacy/buddha.c
+++ b/drivers/ide/legacy/buddha.c
@@ -241,3 +241,5 @@ fail_base2:
241} 241}
242 242
243module_init(buddha_init); 243module_init(buddha_init);
244
245MODULE_LICENSE("GPL");
diff --git a/drivers/ide/legacy/falconide.c b/drivers/ide/legacy/falconide.c
index 8949ce71bddc..e950afa5939c 100644
--- a/drivers/ide/legacy/falconide.c
+++ b/drivers/ide/legacy/falconide.c
@@ -93,3 +93,5 @@ static int __init falconide_init(void)
93} 93}
94 94
95module_init(falconide_init); 95module_init(falconide_init);
96
97MODULE_LICENSE("GPL");
diff --git a/drivers/ide/legacy/gayle.c b/drivers/ide/legacy/gayle.c
index b7d81090d5da..e3b4638cc883 100644
--- a/drivers/ide/legacy/gayle.c
+++ b/drivers/ide/legacy/gayle.c
@@ -195,3 +195,5 @@ found:
195} 195}
196 196
197module_init(gayle_init); 197module_init(gayle_init);
198
199MODULE_LICENSE("GPL");
diff --git a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c
index 9a79098d9eb4..eaf5dbe58bc2 100644
--- a/drivers/ide/legacy/macide.c
+++ b/drivers/ide/legacy/macide.c
@@ -137,3 +137,5 @@ static int __init macide_init(void)
137} 137}
138 138
139module_init(macide_init); 139module_init(macide_init);
140
141MODULE_LICENSE("GPL");
diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c
index 1381b91bc316..2da28759686e 100644
--- a/drivers/ide/legacy/q40ide.c
+++ b/drivers/ide/legacy/q40ide.c
@@ -153,3 +153,5 @@ static int __init q40ide_init(void)
153} 153}
154 154
155module_init(q40ide_init); 155module_init(q40ide_init);
156
157MODULE_LICENSE("GPL");
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c
index ec667982809c..29fbc5ead03b 100644
--- a/drivers/ide/pci/cmd640.c
+++ b/drivers/ide/pci/cmd640.c
@@ -881,3 +881,5 @@ module_param_named(probe_vlb, cmd640_vlb, bool, 0);
881MODULE_PARM_DESC(probe_vlb, "probe for VLB version of CMD640 chipset"); 881MODULE_PARM_DESC(probe_vlb, "probe for VLB version of CMD640 chipset");
882 882
883module_init(cmd640x_init); 883module_init(cmd640x_init);
884
885MODULE_LICENSE("GPL");
diff --git a/drivers/ide/ppc/mpc8xx.c b/drivers/ide/ppc/mpc8xx.c
index 38fbfb8d5445..ebaba01c7551 100644
--- a/drivers/ide/ppc/mpc8xx.c
+++ b/drivers/ide/ppc/mpc8xx.c
@@ -853,3 +853,5 @@ static int __init mpc8xx_ide_probe(void)
853} 853}
854 854
855module_init(mpc8xx_ide_probe); 855module_init(mpc8xx_ide_probe);
856
857MODULE_LICENSE("GPL");
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index 78c9eeb85634..d9ca52e6cdab 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -1771,3 +1771,5 @@ static int __devinit pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
1771#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ 1771#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
1772 1772
1773module_init(pmac_ide_probe); 1773module_init(pmac_ide_probe);
1774
1775MODULE_LICENSE("GPL");
diff --git a/drivers/input/apm-power.c b/drivers/input/apm-power.c
index c36d110b349a..7d61a9660806 100644
--- a/drivers/input/apm-power.c
+++ b/drivers/input/apm-power.c
@@ -63,8 +63,6 @@ static int apmpower_connect(struct input_handler *handler,
63 handle->handler = handler; 63 handle->handler = handler;
64 handle->name = "apm-power"; 64 handle->name = "apm-power";
65 65
66 handler->private = handle;
67
68 error = input_register_handle(handle); 66 error = input_register_handle(handle);
69 if (error) { 67 if (error) {
70 printk(KERN_ERR 68 printk(KERN_ERR
@@ -87,11 +85,10 @@ static int apmpower_connect(struct input_handler *handler,
87 return 0; 85 return 0;
88} 86}
89 87
90static void apmpower_disconnect(struct input_handle *handler) 88static void apmpower_disconnect(struct input_handle *handle)
91{ 89{
92 struct input_handle *handle = handler->private;
93
94 input_close_device(handle); 90 input_close_device(handle);
91 input_unregister_handle(handle);
95 kfree(handle); 92 kfree(handle);
96} 93}
97 94
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 99562cee827e..b32984bc516f 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -124,6 +124,7 @@ static void evdev_free(struct device *dev)
124{ 124{
125 struct evdev *evdev = container_of(dev, struct evdev, dev); 125 struct evdev *evdev = container_of(dev, struct evdev, dev);
126 126
127 input_put_device(evdev->handle.dev);
127 kfree(evdev); 128 kfree(evdev);
128} 129}
129 130
@@ -853,9 +854,6 @@ static void evdev_cleanup(struct evdev *evdev)
853 evdev_hangup(evdev); 854 evdev_hangup(evdev);
854 evdev_remove_chrdev(evdev); 855 evdev_remove_chrdev(evdev);
855 856
856 if (evdev->grab)
857 evdev_ungrab(evdev, evdev->grab);
858
859 /* evdev is marked dead so no one else accesses evdev->open */ 857 /* evdev is marked dead so no one else accesses evdev->open */
860 if (evdev->open) { 858 if (evdev->open) {
861 input_flush_device(handle, NULL); 859 input_flush_device(handle, NULL);
@@ -896,7 +894,7 @@ static int evdev_connect(struct input_handler *handler, struct input_dev *dev,
896 evdev->exist = 1; 894 evdev->exist = 1;
897 evdev->minor = minor; 895 evdev->minor = minor;
898 896
899 evdev->handle.dev = dev; 897 evdev->handle.dev = input_get_device(dev);
900 evdev->handle.name = evdev->name; 898 evdev->handle.name = evdev->name;
901 evdev->handle.handler = handler; 899 evdev->handle.handler = handler;
902 evdev->handle.private = evdev; 900 evdev->handle.private = evdev;
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index 22b2789ef58a..65d7077a75a1 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -171,6 +171,7 @@ static void joydev_free(struct device *dev)
171{ 171{
172 struct joydev *joydev = container_of(dev, struct joydev, dev); 172 struct joydev *joydev = container_of(dev, struct joydev, dev);
173 173
174 input_put_device(joydev->handle.dev);
174 kfree(joydev); 175 kfree(joydev);
175} 176}
176 177
@@ -750,7 +751,7 @@ static int joydev_connect(struct input_handler *handler, struct input_dev *dev,
750 joydev->minor = minor; 751 joydev->minor = minor;
751 752
752 joydev->exist = 1; 753 joydev->exist = 1;
753 joydev->handle.dev = dev; 754 joydev->handle.dev = input_get_device(dev);
754 joydev->handle.name = joydev->name; 755 joydev->handle.name = joydev->name;
755 joydev->handle.handler = handler; 756 joydev->handle.handler = handler;
756 joydev->handle.private = joydev; 757 joydev->handle.private = joydev;
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c
index 6224c2fb3b65..4e651c11c1da 100644
--- a/drivers/input/keyboard/pxa27x_keypad.c
+++ b/drivers/input/keyboard/pxa27x_keypad.c
@@ -50,9 +50,9 @@
50#define KPKDI 0x0048 50#define KPKDI 0x0048
51 51
52/* bit definitions */ 52/* bit definitions */
53#define KPC_MKRN(n) ((((n) & 0x7) - 1) << 26) /* matrix key row number */ 53#define KPC_MKRN(n) ((((n) - 1) & 0x7) << 26) /* matrix key row number */
54#define KPC_MKCN(n) ((((n) & 0x7) - 1) << 23) /* matrix key column number */ 54#define KPC_MKCN(n) ((((n) - 1) & 0x7) << 23) /* matrix key column number */
55#define KPC_DKN(n) ((((n) & 0x7) - 1) << 6) /* direct key number */ 55#define KPC_DKN(n) ((((n) - 1) & 0x7) << 6) /* direct key number */
56 56
57#define KPC_AS (0x1 << 30) /* Automatic Scan bit */ 57#define KPC_AS (0x1 << 30) /* Automatic Scan bit */
58#define KPC_ASACT (0x1 << 29) /* Automatic Scan on Activity */ 58#define KPC_ASACT (0x1 << 29) /* Automatic Scan on Activity */
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index bbbe5e81adc1..b989748598ae 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -414,6 +414,7 @@ static void mousedev_free(struct device *dev)
414{ 414{
415 struct mousedev *mousedev = container_of(dev, struct mousedev, dev); 415 struct mousedev *mousedev = container_of(dev, struct mousedev, dev);
416 416
417 input_put_device(mousedev->handle.dev);
417 kfree(mousedev); 418 kfree(mousedev);
418} 419}
419 420
@@ -865,7 +866,7 @@ static struct mousedev *mousedev_create(struct input_dev *dev,
865 866
866 mousedev->minor = minor; 867 mousedev->minor = minor;
867 mousedev->exist = 1; 868 mousedev->exist = 1;
868 mousedev->handle.dev = dev; 869 mousedev->handle.dev = input_get_device(dev);
869 mousedev->handle.name = mousedev->name; 870 mousedev->handle.name = mousedev->name;
870 mousedev->handle.handler = handler; 871 mousedev->handle.handler = handler;
871 mousedev->handle.private = mousedev; 872 mousedev->handle.private = mousedev;
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 6c0a9c4761ee..4c0b05852cb6 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -49,13 +49,13 @@ static void gpio_led_set(struct led_classdev *led_cdev,
49 if (led_dat->active_low) 49 if (led_dat->active_low)
50 level = !level; 50 level = !level;
51 51
52 /* setting GPIOs with I2C/etc requires a preemptible task context */ 52 /* Setting GPIOs with I2C/etc requires a task context, and we don't
53 * seem to have a reliable way to know if we're already in one; so
54 * let's just assume the worst.
55 */
53 if (led_dat->can_sleep) { 56 if (led_dat->can_sleep) {
54 if (preempt_count()) { 57 led_dat->new_level = level;
55 led_dat->new_level = level; 58 schedule_work(&led_dat->work);
56 schedule_work(&led_dat->work);
57 } else
58 gpio_set_value_cansleep(led_dat->gpio, level);
59 } else 59 } else
60 gpio_set_value(led_dat->gpio, level); 60 gpio_set_value(led_dat->gpio, level);
61} 61}
@@ -79,6 +79,10 @@ static int gpio_led_probe(struct platform_device *pdev)
79 cur_led = &pdata->leds[i]; 79 cur_led = &pdata->leds[i];
80 led_dat = &leds_data[i]; 80 led_dat = &leds_data[i];
81 81
82 ret = gpio_request(cur_led->gpio, cur_led->name);
83 if (ret < 0)
84 goto err;
85
82 led_dat->cdev.name = cur_led->name; 86 led_dat->cdev.name = cur_led->name;
83 led_dat->cdev.default_trigger = cur_led->default_trigger; 87 led_dat->cdev.default_trigger = cur_led->default_trigger;
84 led_dat->gpio = cur_led->gpio; 88 led_dat->gpio = cur_led->gpio;
@@ -87,10 +91,6 @@ static int gpio_led_probe(struct platform_device *pdev)
87 led_dat->cdev.brightness_set = gpio_led_set; 91 led_dat->cdev.brightness_set = gpio_led_set;
88 led_dat->cdev.brightness = LED_OFF; 92 led_dat->cdev.brightness = LED_OFF;
89 93
90 ret = gpio_request(led_dat->gpio, led_dat->cdev.name);
91 if (ret < 0)
92 goto err;
93
94 gpio_direction_output(led_dat->gpio, led_dat->active_low); 94 gpio_direction_output(led_dat->gpio, led_dat->active_low);
95 95
96 INIT_WORK(&led_dat->work, gpio_led_work); 96 INIT_WORK(&led_dat->work, gpio_led_work);
diff --git a/drivers/media/radio/radio-cadet.c b/drivers/media/radio/radio-cadet.c
index 34e317ced5a3..57b9e3adc8f0 100644
--- a/drivers/media/radio/radio-cadet.c
+++ b/drivers/media/radio/radio-cadet.c
@@ -587,6 +587,8 @@ static struct video_device cadet_radio=
587 .vidioc_s_input = vidioc_s_input, 587 .vidioc_s_input = vidioc_s_input,
588}; 588};
589 589
590#ifdef CONFIG_PNP
591
590static struct pnp_device_id cadet_pnp_devices[] = { 592static struct pnp_device_id cadet_pnp_devices[] = {
591 /* ADS Cadet AM/FM Radio Card */ 593 /* ADS Cadet AM/FM Radio Card */
592 {.id = "MSM0c24", .driver_data = 0}, 594 {.id = "MSM0c24", .driver_data = 0},
@@ -621,6 +623,10 @@ static struct pnp_driver cadet_pnp_driver = {
621 .remove = NULL, 623 .remove = NULL,
622}; 624};
623 625
626#else
627static struct pnp_driver cadet_pnp_driver;
628#endif
629
624static int cadet_probe(void) 630static int cadet_probe(void)
625{ 631{
626 static int iovals[8]={0x330,0x332,0x334,0x336,0x338,0x33a,0x33c,0x33e}; 632 static int iovals[8]={0x330,0x332,0x334,0x336,0x338,0x33a,0x33c,0x33e};
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index a080c149cc6c..fcf8f2d208a8 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -1990,7 +1990,7 @@ static int bttv_g_frequency(struct file *file, void *priv,
1990 if (0 != err) 1990 if (0 != err)
1991 return err; 1991 return err;
1992 1992
1993 f->type = V4L2_TUNER_ANALOG_TV; 1993 f->type = btv->radio_user ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
1994 f->frequency = btv->freq; 1994 f->frequency = btv->freq;
1995 1995
1996 return 0; 1996 return 0;
@@ -2009,7 +2009,8 @@ static int bttv_s_frequency(struct file *file, void *priv,
2009 2009
2010 if (unlikely(f->tuner != 0)) 2010 if (unlikely(f->tuner != 0))
2011 return -EINVAL; 2011 return -EINVAL;
2012 if (unlikely(f->type != V4L2_TUNER_ANALOG_TV)) 2012 if (unlikely(f->type != (btv->radio_user
2013 ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV)))
2013 return -EINVAL; 2014 return -EINVAL;
2014 mutex_lock(&btv->lock); 2015 mutex_lock(&btv->lock);
2015 btv->freq = f->frequency; 2016 btv->freq = f->frequency;
@@ -3415,6 +3416,7 @@ static int radio_open(struct inode *inode, struct file *file)
3415{ 3416{
3416 int minor = iminor(inode); 3417 int minor = iminor(inode);
3417 struct bttv *btv = NULL; 3418 struct bttv *btv = NULL;
3419 struct bttv_fh *fh;
3418 unsigned int i; 3420 unsigned int i;
3419 3421
3420 dprintk("bttv: open minor=%d\n",minor); 3422 dprintk("bttv: open minor=%d\n",minor);
@@ -3429,12 +3431,19 @@ static int radio_open(struct inode *inode, struct file *file)
3429 return -ENODEV; 3431 return -ENODEV;
3430 3432
3431 dprintk("bttv%d: open called (radio)\n",btv->c.nr); 3433 dprintk("bttv%d: open called (radio)\n",btv->c.nr);
3434
3435 /* allocate per filehandle data */
3436 fh = kmalloc(sizeof(*fh), GFP_KERNEL);
3437 if (NULL == fh)
3438 return -ENOMEM;
3439 file->private_data = fh;
3440 *fh = btv->init;
3441 v4l2_prio_open(&btv->prio, &fh->prio);
3442
3432 mutex_lock(&btv->lock); 3443 mutex_lock(&btv->lock);
3433 3444
3434 btv->radio_user++; 3445 btv->radio_user++;
3435 3446
3436 file->private_data = btv;
3437
3438 bttv_call_i2c_clients(btv,AUDC_SET_RADIO,NULL); 3447 bttv_call_i2c_clients(btv,AUDC_SET_RADIO,NULL);
3439 audio_input(btv,TVAUDIO_INPUT_RADIO); 3448 audio_input(btv,TVAUDIO_INPUT_RADIO);
3440 3449
@@ -3444,7 +3453,8 @@ static int radio_open(struct inode *inode, struct file *file)
3444 3453
3445static int radio_release(struct inode *inode, struct file *file) 3454static int radio_release(struct inode *inode, struct file *file)
3446{ 3455{
3447 struct bttv *btv = file->private_data; 3456 struct bttv_fh *fh = file->private_data;
3457 struct bttv *btv = fh->btv;
3448 struct rds_command cmd; 3458 struct rds_command cmd;
3449 3459
3450 btv->radio_user--; 3460 btv->radio_user--;
@@ -3508,8 +3518,12 @@ static int radio_enum_input(struct file *file, void *priv,
3508static int radio_g_audio(struct file *file, void *priv, 3518static int radio_g_audio(struct file *file, void *priv,
3509 struct v4l2_audio *a) 3519 struct v4l2_audio *a)
3510{ 3520{
3521 if (a->index != 0)
3522 return -EINVAL;
3523
3511 memset(a, 0, sizeof(*a)); 3524 memset(a, 0, sizeof(*a));
3512 strcpy(a->name, "Radio"); 3525 strcpy(a->name, "Radio");
3526
3513 return 0; 3527 return 0;
3514} 3528}
3515 3529
@@ -3569,7 +3583,8 @@ static int radio_g_input(struct file *filp, void *priv, unsigned int *i)
3569static ssize_t radio_read(struct file *file, char __user *data, 3583static ssize_t radio_read(struct file *file, char __user *data,
3570 size_t count, loff_t *ppos) 3584 size_t count, loff_t *ppos)
3571{ 3585{
3572 struct bttv *btv = file->private_data; 3586 struct bttv_fh *fh = file->private_data;
3587 struct bttv *btv = fh->btv;
3573 struct rds_command cmd; 3588 struct rds_command cmd;
3574 cmd.block_count = count/3; 3589 cmd.block_count = count/3;
3575 cmd.buffer = data; 3590 cmd.buffer = data;
@@ -3583,7 +3598,8 @@ static ssize_t radio_read(struct file *file, char __user *data,
3583 3598
3584static unsigned int radio_poll(struct file *file, poll_table *wait) 3599static unsigned int radio_poll(struct file *file, poll_table *wait)
3585{ 3600{
3586 struct bttv *btv = file->private_data; 3601 struct bttv_fh *fh = file->private_data;
3602 struct bttv *btv = fh->btv;
3587 struct rds_command cmd; 3603 struct rds_command cmd;
3588 cmd.instance = file; 3604 cmd.instance = file;
3589 cmd.event_list = wait; 3605 cmd.event_list = wait;
@@ -3599,6 +3615,7 @@ static const struct file_operations radio_fops =
3599 .open = radio_open, 3615 .open = radio_open,
3600 .read = radio_read, 3616 .read = radio_read,
3601 .release = radio_release, 3617 .release = radio_release,
3618 .compat_ioctl = v4l_compat_ioctl32,
3602 .ioctl = video_ioctl2, 3619 .ioctl = video_ioctl2,
3603 .llseek = no_llseek, 3620 .llseek = no_llseek,
3604 .poll = radio_poll, 3621 .poll = radio_poll,
diff --git a/drivers/media/video/cx23885/cx23885-cards.c b/drivers/media/video/cx23885/cx23885-cards.c
index 2d414dad5c31..dfa269838e01 100644
--- a/drivers/media/video/cx23885/cx23885-cards.c
+++ b/drivers/media/video/cx23885/cx23885-cards.c
@@ -232,6 +232,7 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data)
232 case 78631: /* WinTV-HVR1800 (PCIe, OEM, No IR, No FM, Dual channel ATSC and MPEG2 HW Encoder */ 232 case 78631: /* WinTV-HVR1800 (PCIe, OEM, No IR, No FM, Dual channel ATSC and MPEG2 HW Encoder */
233 case 79001: /* WinTV-HVR1250 (PCIe, Retail, IR, full height, ATSC and Basic analog */ 233 case 79001: /* WinTV-HVR1250 (PCIe, Retail, IR, full height, ATSC and Basic analog */
234 case 79101: /* WinTV-HVR1250 (PCIe, Retail, IR, half height, ATSC and Basic analog */ 234 case 79101: /* WinTV-HVR1250 (PCIe, Retail, IR, half height, ATSC and Basic analog */
235 case 79561: /* WinTV-HVR1250 (PCIe, OEM, No IR, half height, ATSC and Basic analog */
235 case 79571: /* WinTV-HVR1250 (PCIe, OEM, No IR, full height, ATSC and Basic analog */ 236 case 79571: /* WinTV-HVR1250 (PCIe, OEM, No IR, full height, ATSC and Basic analog */
236 case 79671: /* WinTV-HVR1250 (PCIe, OEM, No IR, half height, ATSC and Basic analog */ 237 case 79671: /* WinTV-HVR1250 (PCIe, OEM, No IR, half height, ATSC and Basic analog */
237 break; 238 break;
@@ -347,10 +348,13 @@ void cx23885_card_setup(struct cx23885_dev *dev)
347 case CX23885_BOARD_HAUPPAUGE_HVR1250: 348 case CX23885_BOARD_HAUPPAUGE_HVR1250:
348 case CX23885_BOARD_HAUPPAUGE_HVR1500: 349 case CX23885_BOARD_HAUPPAUGE_HVR1500:
349 case CX23885_BOARD_HAUPPAUGE_HVR1500Q: 350 case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
351 if (dev->i2c_bus[0].i2c_rc == 0)
352 hauppauge_eeprom(dev, eeprom+0x80);
353 break;
350 case CX23885_BOARD_HAUPPAUGE_HVR1800: 354 case CX23885_BOARD_HAUPPAUGE_HVR1800:
351 case CX23885_BOARD_HAUPPAUGE_HVR1800lp: 355 case CX23885_BOARD_HAUPPAUGE_HVR1800lp:
352 if (dev->i2c_bus[0].i2c_rc == 0) 356 if (dev->i2c_bus[0].i2c_rc == 0)
353 hauppauge_eeprom(dev, eeprom+0x80); 357 hauppauge_eeprom(dev, eeprom+0xc0);
354 break; 358 break;
355 } 359 }
356 360
diff --git a/drivers/media/video/cx23885/cx23885-core.c b/drivers/media/video/cx23885/cx23885-core.c
index 8e40c7bcc06d..7f10b273598f 100644
--- a/drivers/media/video/cx23885/cx23885-core.c
+++ b/drivers/media/video/cx23885/cx23885-core.c
@@ -56,137 +56,6 @@ LIST_HEAD(cx23885_devlist);
56 56
57#define NO_SYNC_LINE (-1U) 57#define NO_SYNC_LINE (-1U)
58 58
59/*
60 * CX23885 Assumptions
61 * 1 line = 16 bytes of CDT
62 * cmds size = 80
63 * cdt size = 16 * linesize
64 * iqsize = 64
65 * maxlines = 6
66 *
67 * Address Space:
68 * 0x00000000 0x00008fff FIFO clusters
69 * 0x00010000 0x000104af Channel Management Data Structures
70 * 0x000104b0 0x000104ff Free
71 * 0x00010500 0x000108bf 15 channels * iqsize
72 * 0x000108c0 0x000108ff Free
73 * 0x00010900 0x00010e9f IQ's + Cluster Descriptor Tables
74 * 15 channels * (iqsize + (maxlines * linesize))
75 * 0x00010ea0 0x00010xxx Free
76 */
77
78static struct sram_channel cx23885_sram_channels[] = {
79 [SRAM_CH01] = {
80 .name = "VID A",
81 .cmds_start = 0x10000,
82 .ctrl_start = 0x105b0,
83 .cdt = 0x107b0,
84 .fifo_start = 0x40,
85 .fifo_size = 0x2800,
86 .ptr1_reg = DMA1_PTR1,
87 .ptr2_reg = DMA1_PTR2,
88 .cnt1_reg = DMA1_CNT1,
89 .cnt2_reg = DMA1_CNT2,
90 .jumponly = 1,
91 },
92 [SRAM_CH02] = {
93 .name = "ch2",
94 .cmds_start = 0x0,
95 .ctrl_start = 0x0,
96 .cdt = 0x0,
97 .fifo_start = 0x0,
98 .fifo_size = 0x0,
99 .ptr1_reg = DMA2_PTR1,
100 .ptr2_reg = DMA2_PTR2,
101 .cnt1_reg = DMA2_CNT1,
102 .cnt2_reg = DMA2_CNT2,
103 },
104 [SRAM_CH03] = {
105 .name = "TS1 B",
106 .cmds_start = 0x100A0,
107 .ctrl_start = 0x10630,
108 .cdt = 0x10870,
109 .fifo_start = 0x5000,
110 .fifo_size = 0x1000,
111 .ptr1_reg = DMA3_PTR1,
112 .ptr2_reg = DMA3_PTR2,
113 .cnt1_reg = DMA3_CNT1,
114 .cnt2_reg = DMA3_CNT2,
115 },
116 [SRAM_CH04] = {
117 .name = "ch4",
118 .cmds_start = 0x0,
119 .ctrl_start = 0x0,
120 .cdt = 0x0,
121 .fifo_start = 0x0,
122 .fifo_size = 0x0,
123 .ptr1_reg = DMA4_PTR1,
124 .ptr2_reg = DMA4_PTR2,
125 .cnt1_reg = DMA4_CNT1,
126 .cnt2_reg = DMA4_CNT2,
127 },
128 [SRAM_CH05] = {
129 .name = "ch5",
130 .cmds_start = 0x0,
131 .ctrl_start = 0x0,
132 .cdt = 0x0,
133 .fifo_start = 0x0,
134 .fifo_size = 0x0,
135 .ptr1_reg = DMA5_PTR1,
136 .ptr2_reg = DMA5_PTR2,
137 .cnt1_reg = DMA5_CNT1,
138 .cnt2_reg = DMA5_CNT2,
139 },
140 [SRAM_CH06] = {
141 .name = "TS2 C",
142 .cmds_start = 0x10140,
143 .ctrl_start = 0x10680,
144 .cdt = 0x108d0,
145 .fifo_start = 0x6000,
146 .fifo_size = 0x1000,
147 .ptr1_reg = DMA5_PTR1,
148 .ptr2_reg = DMA5_PTR2,
149 .cnt1_reg = DMA5_CNT1,
150 .cnt2_reg = DMA5_CNT2,
151 },
152 [SRAM_CH07] = {
153 .name = "ch7",
154 .cmds_start = 0x0,
155 .ctrl_start = 0x0,
156 .cdt = 0x0,
157 .fifo_start = 0x0,
158 .fifo_size = 0x0,
159 .ptr1_reg = DMA6_PTR1,
160 .ptr2_reg = DMA6_PTR2,
161 .cnt1_reg = DMA6_CNT1,
162 .cnt2_reg = DMA6_CNT2,
163 },
164 [SRAM_CH08] = {
165 .name = "ch8",
166 .cmds_start = 0x0,
167 .ctrl_start = 0x0,
168 .cdt = 0x0,
169 .fifo_start = 0x0,
170 .fifo_size = 0x0,
171 .ptr1_reg = DMA7_PTR1,
172 .ptr2_reg = DMA7_PTR2,
173 .cnt1_reg = DMA7_CNT1,
174 .cnt2_reg = DMA7_CNT2,
175 },
176 [SRAM_CH09] = {
177 .name = "ch9",
178 .cmds_start = 0x0,
179 .ctrl_start = 0x0,
180 .cdt = 0x0,
181 .fifo_start = 0x0,
182 .fifo_size = 0x0,
183 .ptr1_reg = DMA8_PTR1,
184 .ptr2_reg = DMA8_PTR2,
185 .cnt1_reg = DMA8_CNT1,
186 .cnt2_reg = DMA8_CNT2,
187 },
188};
189
190/* FIXME, these allocations will change when 59/* FIXME, these allocations will change when
191 * analog arrives. The be reviewed. 60 * analog arrives. The be reviewed.
192 * CX23887 Assumptions 61 * CX23887 Assumptions
@@ -754,6 +623,7 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
754 atomic_inc(&dev->refcount); 623 atomic_inc(&dev->refcount);
755 624
756 dev->nr = cx23885_devcount++; 625 dev->nr = cx23885_devcount++;
626 dev->sram_channels = cx23887_sram_channels;
757 sprintf(dev->name, "cx23885[%d]", dev->nr); 627 sprintf(dev->name, "cx23885[%d]", dev->nr);
758 628
759 mutex_lock(&devlist); 629 mutex_lock(&devlist);
@@ -763,13 +633,11 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
763 /* Configure the internal memory */ 633 /* Configure the internal memory */
764 if(dev->pci->device == 0x8880) { 634 if(dev->pci->device == 0x8880) {
765 dev->bridge = CX23885_BRIDGE_887; 635 dev->bridge = CX23885_BRIDGE_887;
766 dev->sram_channels = cx23887_sram_channels;
767 /* Apply a sensible clock frequency for the PCIe bridge */ 636 /* Apply a sensible clock frequency for the PCIe bridge */
768 dev->clk_freq = 25000000; 637 dev->clk_freq = 25000000;
769 } else 638 } else
770 if(dev->pci->device == 0x8852) { 639 if(dev->pci->device == 0x8852) {
771 dev->bridge = CX23885_BRIDGE_885; 640 dev->bridge = CX23885_BRIDGE_885;
772 dev->sram_channels = cx23885_sram_channels;
773 /* Apply a sensible clock frequency for the PCIe bridge */ 641 /* Apply a sensible clock frequency for the PCIe bridge */
774 dev->clk_freq = 28000000; 642 dev->clk_freq = 28000000;
775 } else 643 } else
diff --git a/drivers/media/video/v4l2-int-device.c b/drivers/media/video/v4l2-int-device.c
index a545dcaf857f..0e4549922f26 100644
--- a/drivers/media/video/v4l2-int-device.c
+++ b/drivers/media/video/v4l2-int-device.c
@@ -156,3 +156,5 @@ int v4l2_int_ioctl_1(struct v4l2_int_device *d, int cmd, void *arg)
156 find_ioctl(d->u.slave, cmd, 156 find_ioctl(d->u.slave, cmd,
157 (v4l2_int_ioctl_func *)no_such_ioctl_1))(d, arg); 157 (v4l2_int_ioctl_func *)no_such_ioctl_1))(d, arg);
158} 158}
159
160MODULE_LICENSE("GPL");
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index fe7b5ec09708..3a0b20afec7b 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2635,7 +2635,7 @@ config NIU
2635 2635
2636config PASEMI_MAC 2636config PASEMI_MAC
2637 tristate "PA Semi 1/10Gbit MAC" 2637 tristate "PA Semi 1/10Gbit MAC"
2638 depends on PPC64 && PCI 2638 depends on PPC_PASEMI && PCI
2639 select PHYLIB 2639 select PHYLIB
2640 select INET_LRO 2640 select INET_LRO
2641 help 2641 help
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index c993a32b3f50..26b2dd5016cd 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -575,7 +575,6 @@ adjust_head:
575static int bf537mac_hard_start_xmit(struct sk_buff *skb, 575static int bf537mac_hard_start_xmit(struct sk_buff *skb,
576 struct net_device *dev) 576 struct net_device *dev)
577{ 577{
578 struct bf537mac_local *lp = netdev_priv(dev);
579 unsigned int data; 578 unsigned int data;
580 579
581 current_tx_ptr->skb = skb; 580 current_tx_ptr->skb = skb;
@@ -634,7 +633,6 @@ out:
634static void bf537mac_rx(struct net_device *dev) 633static void bf537mac_rx(struct net_device *dev)
635{ 634{
636 struct sk_buff *skb, *new_skb; 635 struct sk_buff *skb, *new_skb;
637 struct bf537mac_local *lp = netdev_priv(dev);
638 unsigned short len; 636 unsigned short len;
639 637
640 /* allocate a new skb for next time receive */ 638 /* allocate a new skb for next time receive */
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 90a1f31e8e63..979c2d05ff9c 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -341,6 +341,7 @@ static ssize_t bonding_store_slaves(struct device *d,
341 341
342 if (command[0] == '-') { 342 if (command[0] == '-') {
343 dev = NULL; 343 dev = NULL;
344 original_mtu = 0;
344 bond_for_each_slave(bond, slave, i) 345 bond_for_each_slave(bond, slave, i)
345 if (strnicmp(slave->dev->name, ifname, IFNAMSIZ) == 0) { 346 if (strnicmp(slave->dev->name, ifname, IFNAMSIZ) == 0) {
346 dev = slave->dev; 347 dev = slave->dev;
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 6f7e3fde9e7c..980c2c229a71 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -1854,6 +1854,7 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
1854 struct ring_desc* start_tx; 1854 struct ring_desc* start_tx;
1855 struct ring_desc* prev_tx; 1855 struct ring_desc* prev_tx;
1856 struct nv_skb_map* prev_tx_ctx; 1856 struct nv_skb_map* prev_tx_ctx;
1857 unsigned long flags;
1857 1858
1858 /* add fragments to entries count */ 1859 /* add fragments to entries count */
1859 for (i = 0; i < fragments; i++) { 1860 for (i = 0; i < fragments; i++) {
@@ -1863,10 +1864,10 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
1863 1864
1864 empty_slots = nv_get_empty_tx_slots(np); 1865 empty_slots = nv_get_empty_tx_slots(np);
1865 if (unlikely(empty_slots <= entries)) { 1866 if (unlikely(empty_slots <= entries)) {
1866 spin_lock_irq(&np->lock); 1867 spin_lock_irqsave(&np->lock, flags);
1867 netif_stop_queue(dev); 1868 netif_stop_queue(dev);
1868 np->tx_stop = 1; 1869 np->tx_stop = 1;
1869 spin_unlock_irq(&np->lock); 1870 spin_unlock_irqrestore(&np->lock, flags);
1870 return NETDEV_TX_BUSY; 1871 return NETDEV_TX_BUSY;
1871 } 1872 }
1872 1873
@@ -1929,13 +1930,13 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
1929 tx_flags_extra = skb->ip_summed == CHECKSUM_PARTIAL ? 1930 tx_flags_extra = skb->ip_summed == CHECKSUM_PARTIAL ?
1930 NV_TX2_CHECKSUM_L3 | NV_TX2_CHECKSUM_L4 : 0; 1931 NV_TX2_CHECKSUM_L3 | NV_TX2_CHECKSUM_L4 : 0;
1931 1932
1932 spin_lock_irq(&np->lock); 1933 spin_lock_irqsave(&np->lock, flags);
1933 1934
1934 /* set tx flags */ 1935 /* set tx flags */
1935 start_tx->flaglen |= cpu_to_le32(tx_flags | tx_flags_extra); 1936 start_tx->flaglen |= cpu_to_le32(tx_flags | tx_flags_extra);
1936 np->put_tx.orig = put_tx; 1937 np->put_tx.orig = put_tx;
1937 1938
1938 spin_unlock_irq(&np->lock); 1939 spin_unlock_irqrestore(&np->lock, flags);
1939 1940
1940 dprintk(KERN_DEBUG "%s: nv_start_xmit: entries %d queued for transmission. tx_flags_extra: %x\n", 1941 dprintk(KERN_DEBUG "%s: nv_start_xmit: entries %d queued for transmission. tx_flags_extra: %x\n",
1941 dev->name, entries, tx_flags_extra); 1942 dev->name, entries, tx_flags_extra);
@@ -1971,6 +1972,7 @@ static int nv_start_xmit_optimized(struct sk_buff *skb, struct net_device *dev)
1971 struct ring_desc_ex* prev_tx; 1972 struct ring_desc_ex* prev_tx;
1972 struct nv_skb_map* prev_tx_ctx; 1973 struct nv_skb_map* prev_tx_ctx;
1973 struct nv_skb_map* start_tx_ctx; 1974 struct nv_skb_map* start_tx_ctx;
1975 unsigned long flags;
1974 1976
1975 /* add fragments to entries count */ 1977 /* add fragments to entries count */
1976 for (i = 0; i < fragments; i++) { 1978 for (i = 0; i < fragments; i++) {
@@ -1980,10 +1982,10 @@ static int nv_start_xmit_optimized(struct sk_buff *skb, struct net_device *dev)
1980 1982
1981 empty_slots = nv_get_empty_tx_slots(np); 1983 empty_slots = nv_get_empty_tx_slots(np);
1982 if (unlikely(empty_slots <= entries)) { 1984 if (unlikely(empty_slots <= entries)) {
1983 spin_lock_irq(&np->lock); 1985 spin_lock_irqsave(&np->lock, flags);
1984 netif_stop_queue(dev); 1986 netif_stop_queue(dev);
1985 np->tx_stop = 1; 1987 np->tx_stop = 1;
1986 spin_unlock_irq(&np->lock); 1988 spin_unlock_irqrestore(&np->lock, flags);
1987 return NETDEV_TX_BUSY; 1989 return NETDEV_TX_BUSY;
1988 } 1990 }
1989 1991
@@ -2059,7 +2061,7 @@ static int nv_start_xmit_optimized(struct sk_buff *skb, struct net_device *dev)
2059 start_tx->txvlan = 0; 2061 start_tx->txvlan = 0;
2060 } 2062 }
2061 2063
2062 spin_lock_irq(&np->lock); 2064 spin_lock_irqsave(&np->lock, flags);
2063 2065
2064 if (np->tx_limit) { 2066 if (np->tx_limit) {
2065 /* Limit the number of outstanding tx. Setup all fragments, but 2067 /* Limit the number of outstanding tx. Setup all fragments, but
@@ -2085,7 +2087,7 @@ static int nv_start_xmit_optimized(struct sk_buff *skb, struct net_device *dev)
2085 start_tx->flaglen |= cpu_to_le32(tx_flags | tx_flags_extra); 2087 start_tx->flaglen |= cpu_to_le32(tx_flags | tx_flags_extra);
2086 np->put_tx.ex = put_tx; 2088 np->put_tx.ex = put_tx;
2087 2089
2088 spin_unlock_irq(&np->lock); 2090 spin_unlock_irqrestore(&np->lock, flags);
2089 2091
2090 dprintk(KERN_DEBUG "%s: nv_start_xmit_optimized: entries %d queued for transmission. tx_flags_extra: %x\n", 2092 dprintk(KERN_DEBUG "%s: nv_start_xmit_optimized: entries %d queued for transmission. tx_flags_extra: %x\n",
2091 dev->name, entries, tx_flags_extra); 2093 dev->name, entries, tx_flags_extra);
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c
index 0789802d59ed..378a23963495 100644
--- a/drivers/net/ibm_newemac/core.c
+++ b/drivers/net/ibm_newemac/core.c
@@ -1242,8 +1242,8 @@ static int emac_close(struct net_device *ndev)
1242static inline u16 emac_tx_csum(struct emac_instance *dev, 1242static inline u16 emac_tx_csum(struct emac_instance *dev,
1243 struct sk_buff *skb) 1243 struct sk_buff *skb)
1244{ 1244{
1245 if (emac_has_feature(dev, EMAC_FTR_HAS_TAH && 1245 if (emac_has_feature(dev, EMAC_FTR_HAS_TAH) &&
1246 skb->ip_summed == CHECKSUM_PARTIAL)) { 1246 (skb->ip_summed == CHECKSUM_PARTIAL)) {
1247 ++dev->stats.tx_packets_csum; 1247 ++dev->stats.tx_packets_csum;
1248 return EMAC_TX_CTRL_TAH_CSUM; 1248 return EMAC_TX_CTRL_TAH_CSUM;
1249 } 1249 }
diff --git a/drivers/net/plip.c b/drivers/net/plip.c
index fee3d7b1feba..1e965427b0e9 100644
--- a/drivers/net/plip.c
+++ b/drivers/net/plip.c
@@ -903,17 +903,18 @@ plip_interrupt(void *dev_id)
903 struct net_local *nl; 903 struct net_local *nl;
904 struct plip_local *rcv; 904 struct plip_local *rcv;
905 unsigned char c0; 905 unsigned char c0;
906 unsigned long flags;
906 907
907 nl = netdev_priv(dev); 908 nl = netdev_priv(dev);
908 rcv = &nl->rcv_data; 909 rcv = &nl->rcv_data;
909 910
910 spin_lock_irq (&nl->lock); 911 spin_lock_irqsave (&nl->lock, flags);
911 912
912 c0 = read_status(dev); 913 c0 = read_status(dev);
913 if ((c0 & 0xf8) != 0xc0) { 914 if ((c0 & 0xf8) != 0xc0) {
914 if ((dev->irq != -1) && (net_debug > 1)) 915 if ((dev->irq != -1) && (net_debug > 1))
915 printk(KERN_DEBUG "%s: spurious interrupt\n", dev->name); 916 printk(KERN_DEBUG "%s: spurious interrupt\n", dev->name);
916 spin_unlock_irq (&nl->lock); 917 spin_unlock_irqrestore (&nl->lock, flags);
917 return; 918 return;
918 } 919 }
919 920
@@ -942,7 +943,7 @@ plip_interrupt(void *dev_id)
942 break; 943 break;
943 } 944 }
944 945
945 spin_unlock_irq(&nl->lock); 946 spin_unlock_irqrestore(&nl->lock, flags);
946} 947}
947 948
948static int 949static int
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 3c915b82e199..c082cf0b1ac6 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -84,7 +84,7 @@
84#include "s2io.h" 84#include "s2io.h"
85#include "s2io-regs.h" 85#include "s2io-regs.h"
86 86
87#define DRV_VERSION "2.0.26.15-2" 87#define DRV_VERSION "2.0.26.20"
88 88
89/* S2io Driver name & version. */ 89/* S2io Driver name & version. */
90static char s2io_driver_name[] = "Neterion"; 90static char s2io_driver_name[] = "Neterion";
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 54c662690f65..853bce0ac478 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -4329,10 +4329,14 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state)
4329 if (!hw) 4329 if (!hw)
4330 return 0; 4330 return 0;
4331 4331
4332 del_timer_sync(&hw->watchdog_timer);
4333 cancel_work_sync(&hw->restart_work);
4334
4332 for (i = 0; i < hw->ports; i++) { 4335 for (i = 0; i < hw->ports; i++) {
4333 struct net_device *dev = hw->dev[i]; 4336 struct net_device *dev = hw->dev[i];
4334 struct sky2_port *sky2 = netdev_priv(dev); 4337 struct sky2_port *sky2 = netdev_priv(dev);
4335 4338
4339 netif_device_detach(dev);
4336 if (netif_running(dev)) 4340 if (netif_running(dev))
4337 sky2_down(dev); 4341 sky2_down(dev);
4338 4342
@@ -4383,6 +4387,8 @@ static int sky2_resume(struct pci_dev *pdev)
4383 4387
4384 for (i = 0; i < hw->ports; i++) { 4388 for (i = 0; i < hw->ports; i++) {
4385 struct net_device *dev = hw->dev[i]; 4389 struct net_device *dev = hw->dev[i];
4390
4391 netif_device_attach(dev);
4386 if (netif_running(dev)) { 4392 if (netif_running(dev)) {
4387 err = sky2_up(dev); 4393 err = sky2_up(dev);
4388 if (err) { 4394 if (err) {
diff --git a/drivers/net/tulip/eeprom.c b/drivers/net/tulip/eeprom.c
index 206918bad539..da2206f6021d 100644
--- a/drivers/net/tulip/eeprom.c
+++ b/drivers/net/tulip/eeprom.c
@@ -343,6 +343,12 @@ int __devinit tulip_read_eeprom(struct net_device *dev, int location, int addr_l
343 void __iomem *ee_addr = tp->base_addr + CSR9; 343 void __iomem *ee_addr = tp->base_addr + CSR9;
344 int read_cmd = location | (EE_READ_CMD << addr_len); 344 int read_cmd = location | (EE_READ_CMD << addr_len);
345 345
346 /* If location is past the end of what we can address, don't
347 * read some other location (ie truncate). Just return zero.
348 */
349 if (location > (1 << addr_len) - 1)
350 return 0;
351
346 iowrite32(EE_ENB & ~EE_CS, ee_addr); 352 iowrite32(EE_ENB & ~EE_CS, ee_addr);
347 iowrite32(EE_ENB, ee_addr); 353 iowrite32(EE_ENB, ee_addr);
348 354
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
index ed600bf56e78..82f404b76d81 100644
--- a/drivers/net/tulip/tulip_core.c
+++ b/drivers/net/tulip/tulip_core.c
@@ -1437,6 +1437,7 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
1437 EEPROM. 1437 EEPROM.
1438 */ 1438 */
1439 ee_data = tp->eeprom; 1439 ee_data = tp->eeprom;
1440 memset(ee_data, 0, sizeof(tp->eeprom));
1440 sum = 0; 1441 sum = 0;
1441 if (chip_idx == LC82C168) { 1442 if (chip_idx == LC82C168) {
1442 for (i = 0; i < 3; i++) { 1443 for (i = 0; i < 3; i++) {
@@ -1458,8 +1459,12 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
1458 /* A serial EEPROM interface, we read now and sort it out later. */ 1459 /* A serial EEPROM interface, we read now and sort it out later. */
1459 int sa_offset = 0; 1460 int sa_offset = 0;
1460 int ee_addr_size = tulip_read_eeprom(dev, 0xff, 8) & 0x40000 ? 8 : 6; 1461 int ee_addr_size = tulip_read_eeprom(dev, 0xff, 8) & 0x40000 ? 8 : 6;
1462 int ee_max_addr = ((1 << ee_addr_size) - 1) * sizeof(u16);
1461 1463
1462 for (i = 0; i < sizeof(tp->eeprom); i+=2) { 1464 if (ee_max_addr > sizeof(tp->eeprom))
1465 ee_max_addr = sizeof(tp->eeprom);
1466
1467 for (i = 0; i < ee_max_addr ; i += sizeof(u16)) {
1463 u16 data = tulip_read_eeprom(dev, i/2, ee_addr_size); 1468 u16 data = tulip_read_eeprom(dev, i/2, ee_addr_size);
1464 ee_data[i] = data & 0xff; 1469 ee_data[i] = data & 0xff;
1465 ee_data[i + 1] = data >> 8; 1470 ee_data[i + 1] = data >> 8;
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
index a12c9c41b217..0604f3faf043 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -129,7 +129,7 @@ config USB_USBNET
129 129
130config USB_NET_AX8817X 130config USB_NET_AX8817X
131 tristate "ASIX AX88xxx Based USB 2.0 Ethernet Adapters" 131 tristate "ASIX AX88xxx Based USB 2.0 Ethernet Adapters"
132 depends on USB_USBNET && NET_ETHERNET 132 depends on USB_USBNET
133 select CRC32 133 select CRC32
134 default y 134 default y
135 help 135 help
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c
index 0343b00cf1fd..01660f68943a 100644
--- a/drivers/net/usb/dm9601.c
+++ b/drivers/net/usb/dm9601.c
@@ -354,7 +354,7 @@ static void dm9601_set_multicast(struct net_device *net)
354 struct dev_mc_list *mc_list = net->mc_list; 354 struct dev_mc_list *mc_list = net->mc_list;
355 int i; 355 int i;
356 356
357 for (i = 0; i < net->mc_count; i++) { 357 for (i = 0; i < net->mc_count; i++, mc_list = mc_list->next) {
358 u32 crc = ether_crc(ETH_ALEN, mc_list->dmi_addr) >> 26; 358 u32 crc = ether_crc(ETH_ALEN, mc_list->dmi_addr) >> 26;
359 hashes[crc >> 3] |= 1 << (crc & 0x7); 359 hashes[crc >> 3] |= 1 << (crc & 0x7);
360 } 360 }
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index d1ed68a11e70..b588c890ea70 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -1128,12 +1128,8 @@ pegasus_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
1128{ 1128{
1129 pegasus_t *pegasus; 1129 pegasus_t *pegasus;
1130 1130
1131 if (in_atomic())
1132 return 0;
1133
1134 pegasus = netdev_priv(dev); 1131 pegasus = netdev_priv(dev);
1135 mii_ethtool_gset(&pegasus->mii, ecmd); 1132 mii_ethtool_gset(&pegasus->mii, ecmd);
1136
1137 return 0; 1133 return 0;
1138} 1134}
1139 1135
diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c
index fb37b8095231..824df3b5ea49 100644
--- a/drivers/net/wan/lapbether.c
+++ b/drivers/net/wan/lapbether.c
@@ -58,7 +58,7 @@ struct lapbethdev {
58 struct net_device_stats stats; /* some statistics */ 58 struct net_device_stats stats; /* some statistics */
59}; 59};
60 60
61static struct list_head lapbeth_devices = LIST_HEAD_INIT(lapbeth_devices); 61static LIST_HEAD(lapbeth_devices);
62 62
63/* ------------------------------------------------------------------------ */ 63/* ------------------------------------------------------------------------ */
64 64
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
index cfbc1a26f601..948eb1fe916b 100644
--- a/drivers/net/wireless/b43/dma.c
+++ b/drivers/net/wireless/b43/dma.c
@@ -619,6 +619,7 @@ static int setup_rx_descbuffer(struct b43_dmaring *ring,
619 } 619 }
620 620
621 if (b43_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) { 621 if (b43_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) {
622 b43err(ring->dev->wl, "RX DMA buffer allocation failed\n");
622 dev_kfree_skb_any(skb); 623 dev_kfree_skb_any(skb);
623 return -EIO; 624 return -EIO;
624 } 625 }
@@ -874,8 +875,12 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev,
874 DMA_TO_DEVICE); 875 DMA_TO_DEVICE);
875 876
876 if (b43_dma_mapping_error(ring, dma_test, 877 if (b43_dma_mapping_error(ring, dma_test,
877 b43_txhdr_size(dev), 1)) 878 b43_txhdr_size(dev), 1)) {
879
880 b43err(dev->wl,
881 "TXHDR DMA allocation failed\n");
878 goto err_kfree_txhdr_cache; 882 goto err_kfree_txhdr_cache;
883 }
879 } 884 }
880 885
881 dma_unmap_single(dev->dev->dev, 886 dma_unmap_single(dev->dev->dev,
diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c
index b79a6bd5396d..371e4a119511 100644
--- a/drivers/net/wireless/b43/pcmcia.c
+++ b/drivers/net/wireless/b43/pcmcia.c
@@ -91,6 +91,8 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev)
91 91
92 dev->conf.ConfigBase = parse.config.base; 92 dev->conf.ConfigBase = parse.config.base;
93 dev->conf.Present = parse.config.rmask[0]; 93 dev->conf.Present = parse.config.rmask[0];
94 dev->conf.Attributes = CONF_ENABLE_IRQ;
95 dev->conf.IntType = INT_MEMORY_AND_IO;
94 96
95 dev->io.BasePort2 = 0; 97 dev->io.BasePort2 = 0;
96 dev->io.NumPorts2 = 0; 98 dev->io.NumPorts2 = 0;
@@ -112,8 +114,8 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev)
112 if (res != CS_SUCCESS) 114 if (res != CS_SUCCESS)
113 goto err_disable; 115 goto err_disable;
114 116
115 dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_FIRST_SHARED; 117 dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
116 dev->irq.IRQInfo1 = IRQ_LEVEL_ID | IRQ_SHARE_ID; 118 dev->irq.IRQInfo1 = IRQ_LEVEL_ID;
117 dev->irq.Handler = NULL; /* The handler is registered later. */ 119 dev->irq.Handler = NULL; /* The handler is registered later. */
118 dev->irq.Instance = NULL; 120 dev->irq.Instance = NULL;
119 res = pcmcia_request_irq(dev, &dev->irq); 121 res = pcmcia_request_irq(dev, &dev->irq);
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index d727de8b96fe..65767570be68 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -4589,7 +4589,7 @@ static u8 iwl4965_is_fat_tx_allowed(struct iwl4965_priv *priv,
4589 4589
4590 if (sta_ht_inf) { 4590 if (sta_ht_inf) {
4591 if ((!sta_ht_inf->ht_supported) || 4591 if ((!sta_ht_inf->ht_supported) ||
4592 (!sta_ht_inf->cap & IEEE80211_HT_CAP_SUP_WIDTH)) 4592 (!(sta_ht_inf->cap & IEEE80211_HT_CAP_SUP_WIDTH)))
4593 return 0; 4593 return 0;
4594 } 4594 }
4595 4595
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c
index 5a9cadb97503..038c66a98f15 100644
--- a/drivers/net/wireless/libertas/if_cs.c
+++ b/drivers/net/wireless/libertas/if_cs.c
@@ -677,9 +677,7 @@ sbi_get_int_status_exit:
677 677
678 /* Card has a command result for us */ 678 /* Card has a command result for us */
679 if (*ireg & IF_CS_C_S_CMD_UPLD_RDY) { 679 if (*ireg & IF_CS_C_S_CMD_UPLD_RDY) {
680 spin_lock(&priv->driver_lock);
681 ret = if_cs_receive_cmdres(priv, priv->upld_buf, &priv->upld_len); 680 ret = if_cs_receive_cmdres(priv, priv->upld_buf, &priv->upld_len);
682 spin_unlock(&priv->driver_lock);
683 if (ret < 0) 681 if (ret < 0)
684 lbs_pr_err("could not receive cmd from card\n"); 682 lbs_pr_err("could not receive cmd from card\n");
685 } 683 }
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index bd305f7f3efd..e873a39fcce3 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -1393,11 +1393,20 @@ int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev, pm_message_t state)
1393 1393
1394exit: 1394exit:
1395 /* 1395 /*
1396 * Set device mode to sleep for power management. 1396 * Set device mode to sleep for power management,
1397 * on some hardware this call seems to consistently fail.
1398 * From the specifications it is hard to tell why it fails,
1399 * and if this is a "bad thing".
1400 * Overall it is safe to just ignore the failure and
1401 * continue suspending. The only downside is that the
1402 * device will not be in optimal power save mode, but with
1403 * the radio and the other components already disabled the
1404 * device is as good as disabled.
1397 */ 1405 */
1398 retval = rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_SLEEP); 1406 retval = rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_SLEEP);
1399 if (retval) 1407 if (retval)
1400 return retval; 1408 WARNING(rt2x00dev, "Device failed to enter sleep state, "
1409 "continue suspending.\n");
1401 1410
1402 return 0; 1411 return 0;
1403} 1412}
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 880c78bff0e1..ed7e0a1fc34d 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -218,18 +218,24 @@ int scsi_add_host(struct Scsi_Host *shost, struct device *dev)
218 218
219 get_device(&shost->shost_gendev); 219 get_device(&shost->shost_gendev);
220 220
221 if (shost->transportt->host_size && 221 if (shost->transportt->host_size) {
222 (shost->shost_data = kzalloc(shost->transportt->host_size, 222 shost->shost_data = kzalloc(shost->transportt->host_size,
223 GFP_KERNEL)) == NULL) 223 GFP_KERNEL);
224 goto out_del_classdev; 224 if (shost->shost_data == NULL) {
225 error = -ENOMEM;
226 goto out_del_classdev;
227 }
228 }
225 229
226 if (shost->transportt->create_work_queue) { 230 if (shost->transportt->create_work_queue) {
227 snprintf(shost->work_q_name, KOBJ_NAME_LEN, "scsi_wq_%d", 231 snprintf(shost->work_q_name, KOBJ_NAME_LEN, "scsi_wq_%d",
228 shost->host_no); 232 shost->host_no);
229 shost->work_q = create_singlethread_workqueue( 233 shost->work_q = create_singlethread_workqueue(
230 shost->work_q_name); 234 shost->work_q_name);
231 if (!shost->work_q) 235 if (!shost->work_q) {
236 error = -EINVAL;
232 goto out_free_shost_data; 237 goto out_free_shost_data;
238 }
233 } 239 }
234 240
235 error = scsi_sysfs_add_host(shost); 241 error = scsi_sysfs_add_host(shost);
diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c
index 31b9af224243..709a6f75ca9d 100644
--- a/drivers/scsi/libsas/sas_discover.c
+++ b/drivers/scsi/libsas/sas_discover.c
@@ -295,11 +295,14 @@ static void sas_discover_domain(struct work_struct *work)
295 case FANOUT_DEV: 295 case FANOUT_DEV:
296 error = sas_discover_root_expander(dev); 296 error = sas_discover_root_expander(dev);
297 break; 297 break;
298#ifdef CONFIG_SCSI_SAS_ATA
299 case SATA_DEV: 298 case SATA_DEV:
300 case SATA_PM: 299 case SATA_PM:
300#ifdef CONFIG_SCSI_SAS_ATA
301 error = sas_discover_sata(dev); 301 error = sas_discover_sata(dev);
302 break; 302 break;
303#else
304 SAS_DPRINTK("ATA device seen but CONFIG_SCSI_SAS_ATA=N so cannot attach\n");
305 /* Fall through */
303#endif 306#endif
304 default: 307 default:
305 error = -ENXIO; 308 error = -ENXIO;
diff --git a/drivers/scsi/mvsas.c b/drivers/scsi/mvsas.c
index 5ec0665b3a3d..e55b9037adb2 100644
--- a/drivers/scsi/mvsas.c
+++ b/drivers/scsi/mvsas.c
@@ -37,11 +37,13 @@
37#include <linux/dma-mapping.h> 37#include <linux/dma-mapping.h>
38#include <linux/ctype.h> 38#include <linux/ctype.h>
39#include <scsi/libsas.h> 39#include <scsi/libsas.h>
40#include <scsi/scsi_tcq.h>
41#include <scsi/sas_ata.h>
40#include <asm/io.h> 42#include <asm/io.h>
41 43
42#define DRV_NAME "mvsas" 44#define DRV_NAME "mvsas"
43#define DRV_VERSION "0.5.1" 45#define DRV_VERSION "0.5.2"
44#define _MV_DUMP 0 46#define _MV_DUMP 0
45#define MVS_DISABLE_NVRAM 47#define MVS_DISABLE_NVRAM
46#define MVS_DISABLE_MSI 48#define MVS_DISABLE_MSI
47 49
@@ -52,7 +54,7 @@
52 readl(regs + MVS_##reg); \ 54 readl(regs + MVS_##reg); \
53 } while (0) 55 } while (0)
54 56
55#define MVS_ID_NOT_MAPPED 0xff 57#define MVS_ID_NOT_MAPPED 0x7f
56#define MVS_CHIP_SLOT_SZ (1U << mvi->chip->slot_width) 58#define MVS_CHIP_SLOT_SZ (1U << mvi->chip->slot_width)
57 59
58/* offset for D2H FIS in the Received FIS List Structure */ 60/* offset for D2H FIS in the Received FIS List Structure */
@@ -84,6 +86,7 @@ enum driver_configuration {
84 MVS_RX_FIS_COUNT = 17, /* Optional rx'd FISs (max 17) */ 86 MVS_RX_FIS_COUNT = 17, /* Optional rx'd FISs (max 17) */
85 87
86 MVS_QUEUE_SIZE = 30, /* Support Queue depth */ 88 MVS_QUEUE_SIZE = 30, /* Support Queue depth */
89 MVS_CAN_QUEUE = MVS_SLOTS - 1, /* SCSI Queue depth */
87}; 90};
88 91
89/* unchangeable hardware details */ 92/* unchangeable hardware details */
@@ -358,7 +361,20 @@ enum hw_register_bits {
358 361
359 /* VSR */ 362 /* VSR */
360 /* PHYMODE 6 (CDB) */ 363 /* PHYMODE 6 (CDB) */
361 PHY_MODE6_DTL_SPEED = (1U << 27), 364 PHY_MODE6_LATECLK = (1U << 29), /* Lock Clock */
365 PHY_MODE6_DTL_SPEED = (1U << 27), /* Digital Loop Speed */
366 PHY_MODE6_FC_ORDER = (1U << 26), /* Fibre Channel Mode Order*/
367 PHY_MODE6_MUCNT_EN = (1U << 24), /* u Count Enable */
368 PHY_MODE6_SEL_MUCNT_LEN = (1U << 22), /* Training Length Select */
369 PHY_MODE6_SELMUPI = (1U << 20), /* Phase Multi Select (init) */
370 PHY_MODE6_SELMUPF = (1U << 18), /* Phase Multi Select (final) */
371 PHY_MODE6_SELMUFF = (1U << 16), /* Freq Loop Multi Sel(final) */
372 PHY_MODE6_SELMUFI = (1U << 14), /* Freq Loop Multi Sel(init) */
373 PHY_MODE6_FREEZE_LOOP = (1U << 12), /* Freeze Rx CDR Loop */
374 PHY_MODE6_INT_RXFOFFS = (1U << 3), /* Rx CDR Freq Loop Enable */
375 PHY_MODE6_FRC_RXFOFFS = (1U << 2), /* Initial Rx CDR Offset */
376 PHY_MODE6_STAU_0D8 = (1U << 1), /* Rx CDR Freq Loop Saturate */
377 PHY_MODE6_RXSAT_DIS = (1U << 0), /* Saturate Ctl */
362}; 378};
363 379
364enum mvs_info_flags { 380enum mvs_info_flags {
@@ -511,7 +527,43 @@ enum status_buffer {
511}; 527};
512 528
513enum error_info_rec { 529enum error_info_rec {
514 CMD_ISS_STPD = (1U << 31), /* Cmd Issue Stopped */ 530 CMD_ISS_STPD = (1U << 31), /* Cmd Issue Stopped */
531 CMD_PI_ERR = (1U << 30), /* Protection info error. see flags2 */
532 RSP_OVER = (1U << 29), /* rsp buffer overflow */
533 RETRY_LIM = (1U << 28), /* FIS/frame retry limit exceeded */
534 UNK_FIS = (1U << 27), /* unknown FIS */
535 DMA_TERM = (1U << 26), /* DMA terminate primitive rx'd */
536 SYNC_ERR = (1U << 25), /* SYNC rx'd during frame xmit */
537 TFILE_ERR = (1U << 24), /* SATA taskfile Error bit set */
538 R_ERR = (1U << 23), /* SATA returned R_ERR prim */
539 RD_OFS = (1U << 20), /* Read DATA frame invalid offset */
540 XFER_RDY_OFS = (1U << 19), /* XFER_RDY offset error */
541 UNEXP_XFER_RDY = (1U << 18), /* unexpected XFER_RDY error */
542 DATA_OVER_UNDER = (1U << 16), /* data overflow/underflow */
543 INTERLOCK = (1U << 15), /* interlock error */
544 NAK = (1U << 14), /* NAK rx'd */
545 ACK_NAK_TO = (1U << 13), /* ACK/NAK timeout */
546 CXN_CLOSED = (1U << 12), /* cxn closed w/out ack/nak */
547 OPEN_TO = (1U << 11), /* I_T nexus lost, open cxn timeout */
548 PATH_BLOCKED = (1U << 10), /* I_T nexus lost, pathway blocked */
549 NO_DEST = (1U << 9), /* I_T nexus lost, no destination */
550 STP_RES_BSY = (1U << 8), /* STP resources busy */
551 BREAK = (1U << 7), /* break received */
552 BAD_DEST = (1U << 6), /* bad destination */
553 BAD_PROTO = (1U << 5), /* protocol not supported */
554 BAD_RATE = (1U << 4), /* cxn rate not supported */
555 WRONG_DEST = (1U << 3), /* wrong destination error */
556 CREDIT_TO = (1U << 2), /* credit timeout */
557 WDOG_TO = (1U << 1), /* watchdog timeout */
558 BUF_PAR = (1U << 0), /* buffer parity error */
559};
560
561enum error_info_rec_2 {
562 SLOT_BSY_ERR = (1U << 31), /* Slot Busy Error */
563 GRD_CHK_ERR = (1U << 14), /* Guard Check Error */
564 APP_CHK_ERR = (1U << 13), /* Application Check error */
565 REF_CHK_ERR = (1U << 12), /* Reference Check Error */
566 USR_BLK_NM = (1U << 0), /* User Block Number */
515}; 567};
516 568
517struct mvs_chip_info { 569struct mvs_chip_info {
@@ -543,28 +595,12 @@ struct mvs_cmd_hdr {
543 __le32 reserved[4]; 595 __le32 reserved[4];
544}; 596};
545 597
546struct mvs_slot_info {
547 struct sas_task *task;
548 u32 n_elem;
549 u32 tx;
550
551 /* DMA buffer for storing cmd tbl, open addr frame, status buffer,
552 * and PRD table
553 */
554 void *buf;
555 dma_addr_t buf_dma;
556#if _MV_DUMP
557 u32 cmd_size;
558#endif
559
560 void *response;
561};
562
563struct mvs_port { 598struct mvs_port {
564 struct asd_sas_port sas_port; 599 struct asd_sas_port sas_port;
565 u8 port_attached; 600 u8 port_attached;
566 u8 taskfileset; 601 u8 taskfileset;
567 u8 wide_port_phymap; 602 u8 wide_port_phymap;
603 struct list_head list;
568}; 604};
569 605
570struct mvs_phy { 606struct mvs_phy {
@@ -582,6 +618,27 @@ struct mvs_phy {
582 u32 frame_rcvd_size; 618 u32 frame_rcvd_size;
583 u8 frame_rcvd[32]; 619 u8 frame_rcvd[32];
584 u8 phy_attached; 620 u8 phy_attached;
621 enum sas_linkrate minimum_linkrate;
622 enum sas_linkrate maximum_linkrate;
623};
624
625struct mvs_slot_info {
626 struct list_head list;
627 struct sas_task *task;
628 u32 n_elem;
629 u32 tx;
630
631 /* DMA buffer for storing cmd tbl, open addr frame, status buffer,
632 * and PRD table
633 */
634 void *buf;
635 dma_addr_t buf_dma;
636#if _MV_DUMP
637 u32 cmd_size;
638#endif
639
640 void *response;
641 struct mvs_port *port;
585}; 642};
586 643
587struct mvs_info { 644struct mvs_info {
@@ -612,21 +669,14 @@ struct mvs_info {
612 669
613 const struct mvs_chip_info *chip; 670 const struct mvs_chip_info *chip;
614 671
615 unsigned long tags[MVS_SLOTS]; 672 u8 tags[MVS_SLOTS];
616 struct mvs_slot_info slot_info[MVS_SLOTS]; 673 struct mvs_slot_info slot_info[MVS_SLOTS];
617 /* further per-slot information */ 674 /* further per-slot information */
618 struct mvs_phy phy[MVS_MAX_PHYS]; 675 struct mvs_phy phy[MVS_MAX_PHYS];
619 struct mvs_port port[MVS_MAX_PHYS]; 676 struct mvs_port port[MVS_MAX_PHYS];
620 677#ifdef MVS_USE_TASKLET
621 u32 can_queue; /* per adapter */ 678 struct tasklet_struct tasklet;
622 u32 tag_out; /*Get*/ 679#endif
623 u32 tag_in; /*Give*/
624};
625
626struct mvs_queue_task {
627 struct list_head list;
628
629 void *uldd_task;
630}; 680};
631 681
632static int mvs_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func, 682static int mvs_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func,
@@ -641,10 +691,11 @@ static u32 mvs_read_port_irq_mask(struct mvs_info *mvi, u32 port);
641static u32 mvs_is_phy_ready(struct mvs_info *mvi, int i); 691static u32 mvs_is_phy_ready(struct mvs_info *mvi, int i);
642static void mvs_detect_porttype(struct mvs_info *mvi, int i); 692static void mvs_detect_porttype(struct mvs_info *mvi, int i);
643static void mvs_update_phyinfo(struct mvs_info *mvi, int i, int get_st); 693static void mvs_update_phyinfo(struct mvs_info *mvi, int i, int get_st);
694static void mvs_release_task(struct mvs_info *mvi, int phy_no);
644 695
645static int mvs_scan_finished(struct Scsi_Host *, unsigned long); 696static int mvs_scan_finished(struct Scsi_Host *, unsigned long);
646static void mvs_scan_start(struct Scsi_Host *); 697static void mvs_scan_start(struct Scsi_Host *);
647static int mvs_sas_slave_alloc(struct scsi_device *scsi_dev); 698static int mvs_slave_configure(struct scsi_device *sdev);
648 699
649static struct scsi_transport_template *mvs_stt; 700static struct scsi_transport_template *mvs_stt;
650 701
@@ -659,7 +710,7 @@ static struct scsi_host_template mvs_sht = {
659 .name = DRV_NAME, 710 .name = DRV_NAME,
660 .queuecommand = sas_queuecommand, 711 .queuecommand = sas_queuecommand,
661 .target_alloc = sas_target_alloc, 712 .target_alloc = sas_target_alloc,
662 .slave_configure = sas_slave_configure, 713 .slave_configure = mvs_slave_configure,
663 .slave_destroy = sas_slave_destroy, 714 .slave_destroy = sas_slave_destroy,
664 .scan_finished = mvs_scan_finished, 715 .scan_finished = mvs_scan_finished,
665 .scan_start = mvs_scan_start, 716 .scan_start = mvs_scan_start,
@@ -674,7 +725,7 @@ static struct scsi_host_template mvs_sht = {
674 .use_clustering = ENABLE_CLUSTERING, 725 .use_clustering = ENABLE_CLUSTERING,
675 .eh_device_reset_handler = sas_eh_device_reset_handler, 726 .eh_device_reset_handler = sas_eh_device_reset_handler,
676 .eh_bus_reset_handler = sas_eh_bus_reset_handler, 727 .eh_bus_reset_handler = sas_eh_bus_reset_handler,
677 .slave_alloc = mvs_sas_slave_alloc, 728 .slave_alloc = sas_slave_alloc,
678 .target_destroy = sas_target_destroy, 729 .target_destroy = sas_target_destroy,
679 .ioctl = sas_ioctl, 730 .ioctl = sas_ioctl,
680}; 731};
@@ -709,10 +760,10 @@ static void mvs_hexdump(u32 size, u8 *data, u32 baseaddr)
709 printk("\n"); 760 printk("\n");
710} 761}
711 762
763#if _MV_DUMP
712static void mvs_hba_sb_dump(struct mvs_info *mvi, u32 tag, 764static void mvs_hba_sb_dump(struct mvs_info *mvi, u32 tag,
713 enum sas_protocol proto) 765 enum sas_protocol proto)
714{ 766{
715#if _MV_DUMP
716 u32 offset; 767 u32 offset;
717 struct pci_dev *pdev = mvi->pdev; 768 struct pci_dev *pdev = mvi->pdev;
718 struct mvs_slot_info *slot = &mvi->slot_info[tag]; 769 struct mvs_slot_info *slot = &mvi->slot_info[tag];
@@ -723,14 +774,14 @@ static void mvs_hba_sb_dump(struct mvs_info *mvi, u32 tag,
723 tag); 774 tag);
724 mvs_hexdump(32, (u8 *) slot->response, 775 mvs_hexdump(32, (u8 *) slot->response,
725 (u32) slot->buf_dma + offset); 776 (u32) slot->buf_dma + offset);
726#endif
727} 777}
778#endif
728 779
729static void mvs_hba_memory_dump(struct mvs_info *mvi, u32 tag, 780static void mvs_hba_memory_dump(struct mvs_info *mvi, u32 tag,
730 enum sas_protocol proto) 781 enum sas_protocol proto)
731{ 782{
732#if _MV_DUMP 783#if _MV_DUMP
733 u32 sz, w_ptr, r_ptr; 784 u32 sz, w_ptr;
734 u64 addr; 785 u64 addr;
735 void __iomem *regs = mvi->regs; 786 void __iomem *regs = mvi->regs;
736 struct pci_dev *pdev = mvi->pdev; 787 struct pci_dev *pdev = mvi->pdev;
@@ -738,12 +789,10 @@ static void mvs_hba_memory_dump(struct mvs_info *mvi, u32 tag,
738 789
739 /*Delivery Queue */ 790 /*Delivery Queue */
740 sz = mr32(TX_CFG) & TX_RING_SZ_MASK; 791 sz = mr32(TX_CFG) & TX_RING_SZ_MASK;
741 w_ptr = mr32(TX_PROD_IDX) & TX_RING_SZ_MASK; 792 w_ptr = slot->tx;
742 r_ptr = mr32(TX_CONS_IDX) & TX_RING_SZ_MASK;
743 addr = mr32(TX_HI) << 16 << 16 | mr32(TX_LO); 793 addr = mr32(TX_HI) << 16 << 16 | mr32(TX_LO);
744 dev_printk(KERN_DEBUG, &pdev->dev, 794 dev_printk(KERN_DEBUG, &pdev->dev,
745 "Delivery Queue Size=%04d , WRT_PTR=%04X , RD_PTR=%04X\n", 795 "Delivery Queue Size=%04d , WRT_PTR=%04X\n", sz, w_ptr);
746 sz, w_ptr, r_ptr);
747 dev_printk(KERN_DEBUG, &pdev->dev, 796 dev_printk(KERN_DEBUG, &pdev->dev,
748 "Delivery Queue Base Address=0x%llX (PA)" 797 "Delivery Queue Base Address=0x%llX (PA)"
749 "(tx_dma=0x%llX), Entry=%04d\n", 798 "(tx_dma=0x%llX), Entry=%04d\n",
@@ -751,11 +800,11 @@ static void mvs_hba_memory_dump(struct mvs_info *mvi, u32 tag,
751 mvs_hexdump(sizeof(u32), (u8 *)(&mvi->tx[mvi->tx_prod]), 800 mvs_hexdump(sizeof(u32), (u8 *)(&mvi->tx[mvi->tx_prod]),
752 (u32) mvi->tx_dma + sizeof(u32) * w_ptr); 801 (u32) mvi->tx_dma + sizeof(u32) * w_ptr);
753 /*Command List */ 802 /*Command List */
754 addr = mr32(CMD_LIST_HI) << 16 << 16 | mr32(CMD_LIST_LO); 803 addr = mvi->slot_dma;
755 dev_printk(KERN_DEBUG, &pdev->dev, 804 dev_printk(KERN_DEBUG, &pdev->dev,
756 "Command List Base Address=0x%llX (PA)" 805 "Command List Base Address=0x%llX (PA)"
757 "(slot_dma=0x%llX), Header=%03d\n", 806 "(slot_dma=0x%llX), Header=%03d\n",
758 addr, mvi->slot_dma, tag); 807 addr, slot->buf_dma, tag);
759 dev_printk(KERN_DEBUG, &pdev->dev, "Command Header[%03d]:\n", tag); 808 dev_printk(KERN_DEBUG, &pdev->dev, "Command Header[%03d]:\n", tag);
760 /*mvs_cmd_hdr */ 809 /*mvs_cmd_hdr */
761 mvs_hexdump(sizeof(struct mvs_cmd_hdr), (u8 *)(&mvi->slot[tag]), 810 mvs_hexdump(sizeof(struct mvs_cmd_hdr), (u8 *)(&mvi->slot[tag]),
@@ -779,7 +828,7 @@ static void mvs_hba_memory_dump(struct mvs_info *mvi, u32 tag,
779 828
780static void mvs_hba_cq_dump(struct mvs_info *mvi) 829static void mvs_hba_cq_dump(struct mvs_info *mvi)
781{ 830{
782#if _MV_DUMP 831#if (_MV_DUMP > 2)
783 u64 addr; 832 u64 addr;
784 void __iomem *regs = mvi->regs; 833 void __iomem *regs = mvi->regs;
785 struct pci_dev *pdev = mvi->pdev; 834 struct pci_dev *pdev = mvi->pdev;
@@ -788,8 +837,8 @@ static void mvs_hba_cq_dump(struct mvs_info *mvi)
788 837
789 /*Completion Queue */ 838 /*Completion Queue */
790 addr = mr32(RX_HI) << 16 << 16 | mr32(RX_LO); 839 addr = mr32(RX_HI) << 16 << 16 | mr32(RX_LO);
791 dev_printk(KERN_DEBUG, &pdev->dev, "Completion Task = 0x%08X\n", 840 dev_printk(KERN_DEBUG, &pdev->dev, "Completion Task = 0x%p\n",
792 (u32) mvi->slot_info[rx_desc & RXQ_SLOT_MASK].task); 841 mvi->slot_info[rx_desc & RXQ_SLOT_MASK].task);
793 dev_printk(KERN_DEBUG, &pdev->dev, 842 dev_printk(KERN_DEBUG, &pdev->dev,
794 "Completion List Base Address=0x%llX (PA), " 843 "Completion List Base Address=0x%llX (PA), "
795 "CQ_Entry=%04d, CQ_WP=0x%08X\n", 844 "CQ_Entry=%04d, CQ_WP=0x%08X\n",
@@ -854,34 +903,53 @@ static int pci_go_64(struct pci_dev *pdev)
854 return rc; 903 return rc;
855} 904}
856 905
906static int mvs_find_tag(struct mvs_info *mvi, struct sas_task *task, u32 *tag)
907{
908 if (task->lldd_task) {
909 struct mvs_slot_info *slot;
910 slot = (struct mvs_slot_info *) task->lldd_task;
911 *tag = slot - mvi->slot_info;
912 return 1;
913 }
914 return 0;
915}
916
857static void mvs_tag_clear(struct mvs_info *mvi, u32 tag) 917static void mvs_tag_clear(struct mvs_info *mvi, u32 tag)
858{ 918{
859 mvi->tag_in = (mvi->tag_in + 1) & (MVS_SLOTS - 1); 919 void *bitmap = (void *) &mvi->tags;
860 mvi->tags[mvi->tag_in] = tag; 920 clear_bit(tag, bitmap);
861} 921}
862 922
863static void mvs_tag_free(struct mvs_info *mvi, u32 tag) 923static void mvs_tag_free(struct mvs_info *mvi, u32 tag)
864{ 924{
865 mvi->tag_out = (mvi->tag_out - 1) & (MVS_SLOTS - 1); 925 mvs_tag_clear(mvi, tag);
926}
927
928static void mvs_tag_set(struct mvs_info *mvi, unsigned int tag)
929{
930 void *bitmap = (void *) &mvi->tags;
931 set_bit(tag, bitmap);
866} 932}
867 933
868static int mvs_tag_alloc(struct mvs_info *mvi, u32 *tag_out) 934static int mvs_tag_alloc(struct mvs_info *mvi, u32 *tag_out)
869{ 935{
870 if (mvi->tag_out != mvi->tag_in) { 936 unsigned int index, tag;
871 *tag_out = mvi->tags[mvi->tag_out]; 937 void *bitmap = (void *) &mvi->tags;
872 mvi->tag_out = (mvi->tag_out + 1) & (MVS_SLOTS - 1); 938
873 return 0; 939 index = find_first_zero_bit(bitmap, MVS_SLOTS);
874 } 940 tag = index;
875 return -EBUSY; 941 if (tag >= MVS_SLOTS)
942 return -SAS_QUEUE_FULL;
943 mvs_tag_set(mvi, tag);
944 *tag_out = tag;
945 return 0;
876} 946}
877 947
878static void mvs_tag_init(struct mvs_info *mvi) 948static void mvs_tag_init(struct mvs_info *mvi)
879{ 949{
880 int i; 950 int i;
881 for (i = 0; i < MVS_SLOTS; ++i) 951 for (i = 0; i < MVS_SLOTS; ++i)
882 mvi->tags[i] = i; 952 mvs_tag_clear(mvi, i);
883 mvi->tag_out = 0;
884 mvi->tag_in = MVS_SLOTS - 1;
885} 953}
886 954
887#ifndef MVS_DISABLE_NVRAM 955#ifndef MVS_DISABLE_NVRAM
@@ -1013,10 +1081,21 @@ err_out:
1013static void mvs_bytes_dmaed(struct mvs_info *mvi, int i) 1081static void mvs_bytes_dmaed(struct mvs_info *mvi, int i)
1014{ 1082{
1015 struct mvs_phy *phy = &mvi->phy[i]; 1083 struct mvs_phy *phy = &mvi->phy[i];
1084 struct asd_sas_phy *sas_phy = mvi->sas.sas_phy[i];
1016 1085
1017 if (!phy->phy_attached) 1086 if (!phy->phy_attached)
1018 return; 1087 return;
1019 1088
1089 if (sas_phy->phy) {
1090 struct sas_phy *sphy = sas_phy->phy;
1091
1092 sphy->negotiated_linkrate = sas_phy->linkrate;
1093 sphy->minimum_linkrate = phy->minimum_linkrate;
1094 sphy->minimum_linkrate_hw = SAS_LINK_RATE_1_5_GBPS;
1095 sphy->maximum_linkrate = phy->maximum_linkrate;
1096 sphy->maximum_linkrate_hw = SAS_LINK_RATE_3_0_GBPS;
1097 }
1098
1020 if (phy->phy_type & PORT_TYPE_SAS) { 1099 if (phy->phy_type & PORT_TYPE_SAS) {
1021 struct sas_identify_frame *id; 1100 struct sas_identify_frame *id;
1022 1101
@@ -1053,80 +1132,149 @@ static void mvs_scan_start(struct Scsi_Host *shost)
1053 } 1132 }
1054} 1133}
1055 1134
1056static int mvs_sas_slave_alloc(struct scsi_device *scsi_dev) 1135static int mvs_slave_configure(struct scsi_device *sdev)
1057{ 1136{
1058 int rc; 1137 struct domain_device *dev = sdev_to_domain_dev(sdev);
1138 int ret = sas_slave_configure(sdev);
1059 1139
1060 rc = sas_slave_alloc(scsi_dev); 1140 if (ret)
1141 return ret;
1061 1142
1062 return rc; 1143 if (dev_is_sata(dev)) {
1144 /* struct ata_port *ap = dev->sata_dev.ap; */
1145 /* struct ata_device *adev = ap->link.device; */
1146
1147 /* clamp at no NCQ for the time being */
1148 /* adev->flags |= ATA_DFLAG_NCQ_OFF; */
1149 scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, 1);
1150 }
1151 return 0;
1063} 1152}
1064 1153
1065static void mvs_int_port(struct mvs_info *mvi, int port_no, u32 events) 1154static void mvs_int_port(struct mvs_info *mvi, int phy_no, u32 events)
1066{ 1155{
1067 struct pci_dev *pdev = mvi->pdev; 1156 struct pci_dev *pdev = mvi->pdev;
1068 struct sas_ha_struct *sas_ha = &mvi->sas; 1157 struct sas_ha_struct *sas_ha = &mvi->sas;
1069 struct mvs_phy *phy = &mvi->phy[port_no]; 1158 struct mvs_phy *phy = &mvi->phy[phy_no];
1070 struct asd_sas_phy *sas_phy = &phy->sas_phy; 1159 struct asd_sas_phy *sas_phy = &phy->sas_phy;
1071 1160
1072 phy->irq_status = mvs_read_port_irq_stat(mvi, port_no); 1161 phy->irq_status = mvs_read_port_irq_stat(mvi, phy_no);
1073 /* 1162 /*
1074 * events is port event now , 1163 * events is port event now ,
1075 * we need check the interrupt status which belongs to per port. 1164 * we need check the interrupt status which belongs to per port.
1076 */ 1165 */
1077 dev_printk(KERN_DEBUG, &pdev->dev, 1166 dev_printk(KERN_DEBUG, &pdev->dev,
1078 "Port %d Event = %X\n", 1167 "Port %d Event = %X\n",
1079 port_no, phy->irq_status); 1168 phy_no, phy->irq_status);
1080 1169
1081 if (phy->irq_status & (PHYEV_POOF | PHYEV_DEC_ERR)) { 1170 if (phy->irq_status & (PHYEV_POOF | PHYEV_DEC_ERR)) {
1082 if (!mvs_is_phy_ready(mvi, port_no)) { 1171 mvs_release_task(mvi, phy_no);
1172 if (!mvs_is_phy_ready(mvi, phy_no)) {
1083 sas_phy_disconnected(sas_phy); 1173 sas_phy_disconnected(sas_phy);
1084 sas_ha->notify_phy_event(sas_phy, PHYE_LOSS_OF_SIGNAL); 1174 sas_ha->notify_phy_event(sas_phy, PHYE_LOSS_OF_SIGNAL);
1175 dev_printk(KERN_INFO, &pdev->dev,
1176 "Port %d Unplug Notice\n", phy_no);
1177
1085 } else 1178 } else
1086 mvs_phy_control(sas_phy, PHY_FUNC_LINK_RESET, NULL); 1179 mvs_phy_control(sas_phy, PHY_FUNC_LINK_RESET, NULL);
1087 } 1180 }
1088 if (!(phy->irq_status & PHYEV_DEC_ERR)) { 1181 if (!(phy->irq_status & PHYEV_DEC_ERR)) {
1089 if (phy->irq_status & PHYEV_COMWAKE) { 1182 if (phy->irq_status & PHYEV_COMWAKE) {
1090 u32 tmp = mvs_read_port_irq_mask(mvi, port_no); 1183 u32 tmp = mvs_read_port_irq_mask(mvi, phy_no);
1091 mvs_write_port_irq_mask(mvi, port_no, 1184 mvs_write_port_irq_mask(mvi, phy_no,
1092 tmp | PHYEV_SIG_FIS); 1185 tmp | PHYEV_SIG_FIS);
1093 } 1186 }
1094 if (phy->irq_status & (PHYEV_SIG_FIS | PHYEV_ID_DONE)) { 1187 if (phy->irq_status & (PHYEV_SIG_FIS | PHYEV_ID_DONE)) {
1095 phy->phy_status = mvs_is_phy_ready(mvi, port_no); 1188 phy->phy_status = mvs_is_phy_ready(mvi, phy_no);
1096 if (phy->phy_status) { 1189 if (phy->phy_status) {
1097 mvs_detect_porttype(mvi, port_no); 1190 mvs_detect_porttype(mvi, phy_no);
1098 1191
1099 if (phy->phy_type & PORT_TYPE_SATA) { 1192 if (phy->phy_type & PORT_TYPE_SATA) {
1100 u32 tmp = mvs_read_port_irq_mask(mvi, 1193 u32 tmp = mvs_read_port_irq_mask(mvi,
1101 port_no); 1194 phy_no);
1102 tmp &= ~PHYEV_SIG_FIS; 1195 tmp &= ~PHYEV_SIG_FIS;
1103 mvs_write_port_irq_mask(mvi, 1196 mvs_write_port_irq_mask(mvi,
1104 port_no, tmp); 1197 phy_no, tmp);
1105 } 1198 }
1106 1199
1107 mvs_update_phyinfo(mvi, port_no, 0); 1200 mvs_update_phyinfo(mvi, phy_no, 0);
1108 sas_ha->notify_phy_event(sas_phy, 1201 sas_ha->notify_phy_event(sas_phy,
1109 PHYE_OOB_DONE); 1202 PHYE_OOB_DONE);
1110 mvs_bytes_dmaed(mvi, port_no); 1203 mvs_bytes_dmaed(mvi, phy_no);
1111 } else { 1204 } else {
1112 dev_printk(KERN_DEBUG, &pdev->dev, 1205 dev_printk(KERN_DEBUG, &pdev->dev,
1113 "plugin interrupt but phy is gone\n"); 1206 "plugin interrupt but phy is gone\n");
1114 mvs_phy_control(sas_phy, PHY_FUNC_LINK_RESET, 1207 mvs_phy_control(sas_phy, PHY_FUNC_LINK_RESET,
1115 NULL); 1208 NULL);
1116 } 1209 }
1117 } else if (phy->irq_status & PHYEV_BROAD_CH) 1210 } else if (phy->irq_status & PHYEV_BROAD_CH) {
1211 mvs_release_task(mvi, phy_no);
1118 sas_ha->notify_port_event(sas_phy, 1212 sas_ha->notify_port_event(sas_phy,
1119 PORTE_BROADCAST_RCVD); 1213 PORTE_BROADCAST_RCVD);
1214 }
1120 } 1215 }
1121 mvs_write_port_irq_stat(mvi, port_no, phy->irq_status); 1216 mvs_write_port_irq_stat(mvi, phy_no, phy->irq_status);
1122} 1217}
1123 1218
1124static void mvs_int_sata(struct mvs_info *mvi) 1219static void mvs_int_sata(struct mvs_info *mvi)
1125{ 1220{
1126 /* FIXME */ 1221 u32 tmp;
1222 void __iomem *regs = mvi->regs;
1223 tmp = mr32(INT_STAT_SRS);
1224 mw32(INT_STAT_SRS, tmp & 0xFFFF);
1225}
1226
1227static void mvs_slot_reset(struct mvs_info *mvi, struct sas_task *task,
1228 u32 slot_idx)
1229{
1230 void __iomem *regs = mvi->regs;
1231 struct domain_device *dev = task->dev;
1232 struct asd_sas_port *sas_port = dev->port;
1233 struct mvs_port *port = mvi->slot_info[slot_idx].port;
1234 u32 reg_set, phy_mask;
1235
1236 if (!sas_protocol_ata(task->task_proto)) {
1237 reg_set = 0;
1238 phy_mask = (port->wide_port_phymap) ? port->wide_port_phymap :
1239 sas_port->phy_mask;
1240 } else {
1241 reg_set = port->taskfileset;
1242 phy_mask = sas_port->phy_mask;
1243 }
1244 mvi->tx[mvi->tx_prod] = cpu_to_le32(TXQ_MODE_I | slot_idx |
1245 (TXQ_CMD_SLOT_RESET << TXQ_CMD_SHIFT) |
1246 (phy_mask << TXQ_PHY_SHIFT) |
1247 (reg_set << TXQ_SRS_SHIFT));
1248
1249 mw32(TX_PROD_IDX, mvi->tx_prod);
1250 mvi->tx_prod = (mvi->tx_prod + 1) & (MVS_CHIP_SLOT_SZ - 1);
1251}
1252
1253static int mvs_sata_done(struct mvs_info *mvi, struct sas_task *task,
1254 u32 slot_idx, int err)
1255{
1256 struct mvs_port *port = mvi->slot_info[slot_idx].port;
1257 struct task_status_struct *tstat = &task->task_status;
1258 struct ata_task_resp *resp = (struct ata_task_resp *)tstat->buf;
1259 int stat = SAM_GOOD;
1260
1261 resp->frame_len = sizeof(struct dev_to_host_fis);
1262 memcpy(&resp->ending_fis[0],
1263 SATA_RECEIVED_D2H_FIS(port->taskfileset),
1264 sizeof(struct dev_to_host_fis));
1265 tstat->buf_valid_size = sizeof(*resp);
1266 if (unlikely(err))
1267 stat = SAS_PROTO_RESPONSE;
1268 return stat;
1127} 1269}
1128 1270
1129static void mvs_slot_free(struct mvs_info *mvi, struct sas_task *task, 1271static void mvs_slot_free(struct mvs_info *mvi, u32 rx_desc)
1272{
1273 u32 slot_idx = rx_desc & RXQ_SLOT_MASK;
1274 mvs_tag_clear(mvi, slot_idx);
1275}
1276
1277static void mvs_slot_task_free(struct mvs_info *mvi, struct sas_task *task,
1130 struct mvs_slot_info *slot, u32 slot_idx) 1278 struct mvs_slot_info *slot, u32 slot_idx)
1131{ 1279{
1132 if (!sas_protocol_ata(task->task_proto)) 1280 if (!sas_protocol_ata(task->task_proto))
@@ -1149,38 +1297,58 @@ static void mvs_slot_free(struct mvs_info *mvi, struct sas_task *task,
1149 /* do nothing */ 1297 /* do nothing */
1150 break; 1298 break;
1151 } 1299 }
1152 1300 list_del(&slot->list);
1301 task->lldd_task = NULL;
1153 slot->task = NULL; 1302 slot->task = NULL;
1154 mvs_tag_clear(mvi, slot_idx); 1303 slot->port = NULL;
1155} 1304}
1156 1305
1157static void mvs_slot_err(struct mvs_info *mvi, struct sas_task *task, 1306static int mvs_slot_err(struct mvs_info *mvi, struct sas_task *task,
1158 u32 slot_idx) 1307 u32 slot_idx)
1159{ 1308{
1160 struct mvs_slot_info *slot = &mvi->slot_info[slot_idx]; 1309 struct mvs_slot_info *slot = &mvi->slot_info[slot_idx];
1161 u64 err_dw0 = *(u32 *) slot->response; 1310 u32 err_dw0 = le32_to_cpu(*(u32 *) (slot->response));
1162 void __iomem *regs = mvi->regs; 1311 u32 err_dw1 = le32_to_cpu(*(u32 *) (slot->response + 4));
1163 u32 tmp; 1312 int stat = SAM_CHECK_COND;
1164 1313
1165 if (err_dw0 & CMD_ISS_STPD) 1314 if (err_dw1 & SLOT_BSY_ERR) {
1166 if (sas_protocol_ata(task->task_proto)) { 1315 stat = SAS_QUEUE_FULL;
1167 tmp = mr32(INT_STAT_SRS); 1316 mvs_slot_reset(mvi, task, slot_idx);
1168 mw32(INT_STAT_SRS, tmp & 0xFFFF); 1317 }
1169 } 1318 switch (task->task_proto) {
1319 case SAS_PROTOCOL_SSP:
1320 break;
1321 case SAS_PROTOCOL_SMP:
1322 break;
1323 case SAS_PROTOCOL_SATA:
1324 case SAS_PROTOCOL_STP:
1325 case SAS_PROTOCOL_SATA | SAS_PROTOCOL_STP:
1326 if (err_dw0 & TFILE_ERR)
1327 stat = mvs_sata_done(mvi, task, slot_idx, 1);
1328 break;
1329 default:
1330 break;
1331 }
1170 1332
1171 mvs_hba_sb_dump(mvi, slot_idx, task->task_proto); 1333 mvs_hexdump(16, (u8 *) slot->response, 0);
1334 return stat;
1172} 1335}
1173 1336
1174static int mvs_slot_complete(struct mvs_info *mvi, u32 rx_desc) 1337static int mvs_slot_complete(struct mvs_info *mvi, u32 rx_desc, u32 flags)
1175{ 1338{
1176 u32 slot_idx = rx_desc & RXQ_SLOT_MASK; 1339 u32 slot_idx = rx_desc & RXQ_SLOT_MASK;
1177 struct mvs_slot_info *slot = &mvi->slot_info[slot_idx]; 1340 struct mvs_slot_info *slot = &mvi->slot_info[slot_idx];
1178 struct sas_task *task = slot->task; 1341 struct sas_task *task = slot->task;
1179 struct task_status_struct *tstat = &task->task_status; 1342 struct task_status_struct *tstat;
1180 struct mvs_port *port = &mvi->port[task->dev->port->id]; 1343 struct mvs_port *port;
1181 bool aborted; 1344 bool aborted;
1182 void *to; 1345 void *to;
1183 1346
1347 if (unlikely(!task || !task->lldd_task))
1348 return -1;
1349
1350 mvs_hba_cq_dump(mvi);
1351
1184 spin_lock(&task->task_state_lock); 1352 spin_lock(&task->task_state_lock);
1185 aborted = task->task_state_flags & SAS_TASK_STATE_ABORTED; 1353 aborted = task->task_state_flags & SAS_TASK_STATE_ABORTED;
1186 if (!aborted) { 1354 if (!aborted) {
@@ -1190,22 +1358,27 @@ static int mvs_slot_complete(struct mvs_info *mvi, u32 rx_desc)
1190 } 1358 }
1191 spin_unlock(&task->task_state_lock); 1359 spin_unlock(&task->task_state_lock);
1192 1360
1193 if (aborted) 1361 if (aborted) {
1362 mvs_slot_task_free(mvi, task, slot, slot_idx);
1363 mvs_slot_free(mvi, rx_desc);
1194 return -1; 1364 return -1;
1365 }
1195 1366
1367 port = slot->port;
1368 tstat = &task->task_status;
1196 memset(tstat, 0, sizeof(*tstat)); 1369 memset(tstat, 0, sizeof(*tstat));
1197 tstat->resp = SAS_TASK_COMPLETE; 1370 tstat->resp = SAS_TASK_COMPLETE;
1198 1371
1199 1372 if (unlikely(!port->port_attached || flags)) {
1200 if (unlikely(!port->port_attached)) { 1373 mvs_slot_err(mvi, task, slot_idx);
1201 tstat->stat = SAS_PHY_DOWN; 1374 if (!sas_protocol_ata(task->task_proto))
1375 tstat->stat = SAS_PHY_DOWN;
1202 goto out; 1376 goto out;
1203 } 1377 }
1204 1378
1205 /* error info record present */ 1379 /* error info record present */
1206 if ((rx_desc & RXQ_ERR) && (*(u64 *) slot->response)) { 1380 if (unlikely((rx_desc & RXQ_ERR) && (*(u64 *) slot->response))) {
1207 tstat->stat = SAM_CHECK_COND; 1381 tstat->stat = mvs_slot_err(mvi, task, slot_idx);
1208 mvs_slot_err(mvi, task, slot_idx);
1209 goto out; 1382 goto out;
1210 } 1383 }
1211 1384
@@ -1242,21 +1415,7 @@ static int mvs_slot_complete(struct mvs_info *mvi, u32 rx_desc)
1242 case SAS_PROTOCOL_SATA: 1415 case SAS_PROTOCOL_SATA:
1243 case SAS_PROTOCOL_STP: 1416 case SAS_PROTOCOL_STP:
1244 case SAS_PROTOCOL_SATA | SAS_PROTOCOL_STP: { 1417 case SAS_PROTOCOL_SATA | SAS_PROTOCOL_STP: {
1245 struct ata_task_resp *resp = 1418 tstat->stat = mvs_sata_done(mvi, task, slot_idx, 0);
1246 (struct ata_task_resp *)tstat->buf;
1247
1248 if ((rx_desc & (RXQ_DONE | RXQ_ERR | RXQ_ATTN)) ==
1249 RXQ_DONE)
1250 tstat->stat = SAM_GOOD;
1251 else
1252 tstat->stat = SAM_CHECK_COND;
1253
1254 resp->frame_len = sizeof(struct dev_to_host_fis);
1255 memcpy(&resp->ending_fis[0],
1256 SATA_RECEIVED_D2H_FIS(port->taskfileset),
1257 sizeof(struct dev_to_host_fis));
1258 if (resp->ending_fis[2] & ATA_ERR)
1259 mvs_hexdump(16, resp->ending_fis, 0);
1260 break; 1419 break;
1261 } 1420 }
1262 1421
@@ -1266,11 +1425,34 @@ static int mvs_slot_complete(struct mvs_info *mvi, u32 rx_desc)
1266 } 1425 }
1267 1426
1268out: 1427out:
1269 mvs_slot_free(mvi, task, slot, slot_idx); 1428 mvs_slot_task_free(mvi, task, slot, slot_idx);
1429 if (unlikely(tstat->stat != SAS_QUEUE_FULL))
1430 mvs_slot_free(mvi, rx_desc);
1431
1432 spin_unlock(&mvi->lock);
1270 task->task_done(task); 1433 task->task_done(task);
1434 spin_lock(&mvi->lock);
1271 return tstat->stat; 1435 return tstat->stat;
1272} 1436}
1273 1437
1438static void mvs_release_task(struct mvs_info *mvi, int phy_no)
1439{
1440 struct list_head *pos, *n;
1441 struct mvs_slot_info *slot;
1442 struct mvs_phy *phy = &mvi->phy[phy_no];
1443 struct mvs_port *port = phy->port;
1444 u32 rx_desc;
1445
1446 if (!port)
1447 return;
1448
1449 list_for_each_safe(pos, n, &port->list) {
1450 slot = container_of(pos, struct mvs_slot_info, list);
1451 rx_desc = (u32) (slot - mvi->slot_info);
1452 mvs_slot_complete(mvi, rx_desc, 1);
1453 }
1454}
1455
1274static void mvs_int_full(struct mvs_info *mvi) 1456static void mvs_int_full(struct mvs_info *mvi)
1275{ 1457{
1276 void __iomem *regs = mvi->regs; 1458 void __iomem *regs = mvi->regs;
@@ -1305,40 +1487,43 @@ static int mvs_int_rx(struct mvs_info *mvi, bool self_clear)
1305 * we don't have to stall the CPU reading that register. 1487 * we don't have to stall the CPU reading that register.
1306 * The actual RX ring is offset by one dword, due to this. 1488 * The actual RX ring is offset by one dword, due to this.
1307 */ 1489 */
1308 rx_prod_idx = mr32(RX_CONS_IDX) & RX_RING_SZ_MASK; 1490 rx_prod_idx = mvi->rx_cons;
1309 if (rx_prod_idx == 0xfff) { /* h/w hasn't touched RX ring yet */ 1491 mvi->rx_cons = le32_to_cpu(mvi->rx[0]);
1310 mvi->rx_cons = 0xfff; 1492 if (mvi->rx_cons == 0xfff) /* h/w hasn't touched RX ring yet */
1311 return 0; 1493 return 0;
1312 }
1313 1494
1314 /* The CMPL_Q may come late, read from register and try again 1495 /* The CMPL_Q may come late, read from register and try again
1315 * note: if coalescing is enabled, 1496 * note: if coalescing is enabled,
1316 * it will need to read from register every time for sure 1497 * it will need to read from register every time for sure
1317 */ 1498 */
1318 if (mvi->rx_cons == rx_prod_idx) 1499 if (mvi->rx_cons == rx_prod_idx)
1319 return 0; 1500 mvi->rx_cons = mr32(RX_CONS_IDX) & RX_RING_SZ_MASK;
1320 1501
1321 if (mvi->rx_cons == 0xfff) 1502 if (mvi->rx_cons == rx_prod_idx)
1322 mvi->rx_cons = MVS_RX_RING_SZ - 1; 1503 return 0;
1323 1504
1324 while (mvi->rx_cons != rx_prod_idx) { 1505 while (mvi->rx_cons != rx_prod_idx) {
1325 1506
1326 /* increment our internal RX consumer pointer */ 1507 /* increment our internal RX consumer pointer */
1327 mvi->rx_cons = (mvi->rx_cons + 1) & (MVS_RX_RING_SZ - 1); 1508 rx_prod_idx = (rx_prod_idx + 1) & (MVS_RX_RING_SZ - 1);
1328 1509
1329 rx_desc = le32_to_cpu(mvi->rx[mvi->rx_cons + 1]); 1510 rx_desc = le32_to_cpu(mvi->rx[rx_prod_idx + 1]);
1330
1331 mvs_hba_cq_dump(mvi);
1332 1511
1333 if (likely(rx_desc & RXQ_DONE)) 1512 if (likely(rx_desc & RXQ_DONE))
1334 mvs_slot_complete(mvi, rx_desc); 1513 mvs_slot_complete(mvi, rx_desc, 0);
1335 if (rx_desc & RXQ_ATTN) { 1514 if (rx_desc & RXQ_ATTN) {
1336 attn = true; 1515 attn = true;
1337 dev_printk(KERN_DEBUG, &pdev->dev, "ATTN %X\n", 1516 dev_printk(KERN_DEBUG, &pdev->dev, "ATTN %X\n",
1338 rx_desc); 1517 rx_desc);
1339 } else if (rx_desc & RXQ_ERR) { 1518 } else if (rx_desc & RXQ_ERR) {
1519 if (!(rx_desc & RXQ_DONE))
1520 mvs_slot_complete(mvi, rx_desc, 0);
1340 dev_printk(KERN_DEBUG, &pdev->dev, "RXQ_ERR %X\n", 1521 dev_printk(KERN_DEBUG, &pdev->dev, "RXQ_ERR %X\n",
1341 rx_desc); 1522 rx_desc);
1523 } else if (rx_desc & RXQ_SLOT_RESET) {
1524 dev_printk(KERN_DEBUG, &pdev->dev, "Slot reset[%X]\n",
1525 rx_desc);
1526 mvs_slot_free(mvi, rx_desc);
1342 } 1527 }
1343 } 1528 }
1344 1529
@@ -1348,6 +1533,23 @@ static int mvs_int_rx(struct mvs_info *mvi, bool self_clear)
1348 return 0; 1533 return 0;
1349} 1534}
1350 1535
1536#ifdef MVS_USE_TASKLET
1537static void mvs_tasklet(unsigned long data)
1538{
1539 struct mvs_info *mvi = (struct mvs_info *) data;
1540 unsigned long flags;
1541
1542 spin_lock_irqsave(&mvi->lock, flags);
1543
1544#ifdef MVS_DISABLE_MSI
1545 mvs_int_full(mvi);
1546#else
1547 mvs_int_rx(mvi, true);
1548#endif
1549 spin_unlock_irqrestore(&mvi->lock, flags);
1550}
1551#endif
1552
1351static irqreturn_t mvs_interrupt(int irq, void *opaque) 1553static irqreturn_t mvs_interrupt(int irq, void *opaque)
1352{ 1554{
1353 struct mvs_info *mvi = opaque; 1555 struct mvs_info *mvi = opaque;
@@ -1356,18 +1558,21 @@ static irqreturn_t mvs_interrupt(int irq, void *opaque)
1356 1558
1357 stat = mr32(GBL_INT_STAT); 1559 stat = mr32(GBL_INT_STAT);
1358 1560
1359 /* clear CMD_CMPLT ASAP */
1360 mw32_f(INT_STAT, CINT_DONE);
1361
1362 if (stat == 0 || stat == 0xffffffff) 1561 if (stat == 0 || stat == 0xffffffff)
1363 return IRQ_NONE; 1562 return IRQ_NONE;
1364 1563
1564 /* clear CMD_CMPLT ASAP */
1565 mw32_f(INT_STAT, CINT_DONE);
1566
1567#ifndef MVS_USE_TASKLET
1365 spin_lock(&mvi->lock); 1568 spin_lock(&mvi->lock);
1366 1569
1367 mvs_int_full(mvi); 1570 mvs_int_full(mvi);
1368 1571
1369 spin_unlock(&mvi->lock); 1572 spin_unlock(&mvi->lock);
1370 1573#else
1574 tasklet_schedule(&mvi->tasklet);
1575#endif
1371 return IRQ_HANDLED; 1576 return IRQ_HANDLED;
1372} 1577}
1373 1578
@@ -1376,12 +1581,15 @@ static irqreturn_t mvs_msi_interrupt(int irq, void *opaque)
1376{ 1581{
1377 struct mvs_info *mvi = opaque; 1582 struct mvs_info *mvi = opaque;
1378 1583
1584#ifndef MVS_USE_TASKLET
1379 spin_lock(&mvi->lock); 1585 spin_lock(&mvi->lock);
1380 1586
1381 mvs_int_rx(mvi, true); 1587 mvs_int_rx(mvi, true);
1382 1588
1383 spin_unlock(&mvi->lock); 1589 spin_unlock(&mvi->lock);
1384 1590#else
1591 tasklet_schedule(&mvi->tasklet);
1592#endif
1385 return IRQ_HANDLED; 1593 return IRQ_HANDLED;
1386} 1594}
1387#endif 1595#endif
@@ -1576,15 +1784,19 @@ static u8 mvs_assign_reg_set(struct mvs_info *mvi, struct mvs_port *port)
1576 return MVS_ID_NOT_MAPPED; 1784 return MVS_ID_NOT_MAPPED;
1577} 1785}
1578 1786
1579static u32 mvs_get_ncq_tag(struct sas_task *task) 1787static u32 mvs_get_ncq_tag(struct sas_task *task, u32 *tag)
1580{ 1788{
1581 u32 tag = 0;
1582 struct ata_queued_cmd *qc = task->uldd_task; 1789 struct ata_queued_cmd *qc = task->uldd_task;
1583 1790
1584 if (qc) 1791 if (qc) {
1585 tag = qc->tag; 1792 if (qc->tf.command == ATA_CMD_FPDMA_WRITE ||
1793 qc->tf.command == ATA_CMD_FPDMA_READ) {
1794 *tag = qc->tag;
1795 return 1;
1796 }
1797 }
1586 1798
1587 return tag; 1799 return 0;
1588} 1800}
1589 1801
1590static int mvs_task_prep_ata(struct mvs_info *mvi, 1802static int mvs_task_prep_ata(struct mvs_info *mvi,
@@ -1628,11 +1840,9 @@ static int mvs_task_prep_ata(struct mvs_info *mvi,
1628 hdr->flags = cpu_to_le32(flags); 1840 hdr->flags = cpu_to_le32(flags);
1629 1841
1630 /* FIXME: the low order order 5 bits for the TAG if enable NCQ */ 1842 /* FIXME: the low order order 5 bits for the TAG if enable NCQ */
1631 if (task->ata_task.use_ncq) { 1843 if (task->ata_task.use_ncq && mvs_get_ncq_tag(task, &hdr->tags))
1632 hdr->tags = cpu_to_le32(mvs_get_ncq_tag(task)); 1844 task->ata_task.fis.sector_count |= hdr->tags << 3;
1633 /*Fill in task file */ 1845 else
1634 task->ata_task.fis.sector_count = hdr->tags << 3;
1635 } else
1636 hdr->tags = cpu_to_le32(tag); 1846 hdr->tags = cpu_to_le32(tag);
1637 hdr->data_len = cpu_to_le32(task->total_xfer_len); 1847 hdr->data_len = cpu_to_le32(task->total_xfer_len);
1638 1848
@@ -1725,13 +1935,16 @@ static int mvs_task_prep_ssp(struct mvs_info *mvi,
1725 u32 flags; 1935 u32 flags;
1726 u32 resp_len, req_len, i, tag = tei->tag; 1936 u32 resp_len, req_len, i, tag = tei->tag;
1727 const u32 max_resp_len = SB_RFB_MAX; 1937 const u32 max_resp_len = SB_RFB_MAX;
1938 u8 phy_mask;
1728 1939
1729 slot = &mvi->slot_info[tag]; 1940 slot = &mvi->slot_info[tag];
1730 1941
1942 phy_mask = (port->wide_port_phymap) ? port->wide_port_phymap :
1943 task->dev->port->phy_mask;
1731 slot->tx = mvi->tx_prod; 1944 slot->tx = mvi->tx_prod;
1732 mvi->tx[mvi->tx_prod] = cpu_to_le32(TXQ_MODE_I | tag | 1945 mvi->tx[mvi->tx_prod] = cpu_to_le32(TXQ_MODE_I | tag |
1733 (TXQ_CMD_SSP << TXQ_CMD_SHIFT) | 1946 (TXQ_CMD_SSP << TXQ_CMD_SHIFT) |
1734 (port->wide_port_phymap << TXQ_PHY_SHIFT)); 1947 (phy_mask << TXQ_PHY_SHIFT));
1735 1948
1736 flags = MCH_RETRY; 1949 flags = MCH_RETRY;
1737 if (task->ssp_task.enable_first_burst) { 1950 if (task->ssp_task.enable_first_burst) {
@@ -1832,22 +2045,32 @@ static int mvs_task_exec(struct sas_task *task, const int num, gfp_t gfp_flags)
1832 void __iomem *regs = mvi->regs; 2045 void __iomem *regs = mvi->regs;
1833 struct mvs_task_exec_info tei; 2046 struct mvs_task_exec_info tei;
1834 struct sas_task *t = task; 2047 struct sas_task *t = task;
2048 struct mvs_slot_info *slot;
1835 u32 tag = 0xdeadbeef, rc, n_elem = 0; 2049 u32 tag = 0xdeadbeef, rc, n_elem = 0;
1836 unsigned long flags; 2050 unsigned long flags;
1837 u32 n = num, pass = 0; 2051 u32 n = num, pass = 0;
1838 2052
1839 spin_lock_irqsave(&mvi->lock, flags); 2053 spin_lock_irqsave(&mvi->lock, flags);
1840
1841 do { 2054 do {
2055 dev = t->dev;
1842 tei.port = &mvi->port[dev->port->id]; 2056 tei.port = &mvi->port[dev->port->id];
1843 2057
1844 if (!tei.port->port_attached) { 2058 if (!tei.port->port_attached) {
1845 struct task_status_struct *ts = &t->task_status; 2059 if (sas_protocol_ata(t->task_proto)) {
1846 ts->stat = SAS_PHY_DOWN; 2060 rc = SAS_PHY_DOWN;
1847 t->task_done(t); 2061 goto out_done;
1848 rc = 0; 2062 } else {
1849 goto exec_exit; 2063 struct task_status_struct *ts = &t->task_status;
2064 ts->resp = SAS_TASK_UNDELIVERED;
2065 ts->stat = SAS_PHY_DOWN;
2066 t->task_done(t);
2067 if (n > 1)
2068 t = list_entry(t->list.next,
2069 struct sas_task, list);
2070 continue;
2071 }
1850 } 2072 }
2073
1851 if (!sas_protocol_ata(t->task_proto)) { 2074 if (!sas_protocol_ata(t->task_proto)) {
1852 if (t->num_scatter) { 2075 if (t->num_scatter) {
1853 n_elem = pci_map_sg(mvi->pdev, t->scatter, 2076 n_elem = pci_map_sg(mvi->pdev, t->scatter,
@@ -1866,9 +2089,10 @@ static int mvs_task_exec(struct sas_task *task, const int num, gfp_t gfp_flags)
1866 if (rc) 2089 if (rc)
1867 goto err_out; 2090 goto err_out;
1868 2091
1869 mvi->slot_info[tag].task = t; 2092 slot = &mvi->slot_info[tag];
1870 mvi->slot_info[tag].n_elem = n_elem; 2093 t->lldd_task = NULL;
1871 memset(mvi->slot_info[tag].buf, 0, MVS_SLOT_BUF_SZ); 2094 slot->n_elem = n_elem;
2095 memset(slot->buf, 0, MVS_SLOT_BUF_SZ);
1872 tei.task = t; 2096 tei.task = t;
1873 tei.hdr = &mvi->slot[tag]; 2097 tei.hdr = &mvi->slot[tag];
1874 tei.tag = tag; 2098 tei.tag = tag;
@@ -1897,28 +2121,26 @@ static int mvs_task_exec(struct sas_task *task, const int num, gfp_t gfp_flags)
1897 if (rc) 2121 if (rc)
1898 goto err_out_tag; 2122 goto err_out_tag;
1899 2123
2124 slot->task = t;
2125 slot->port = tei.port;
2126 t->lldd_task = (void *) slot;
2127 list_add_tail(&slot->list, &slot->port->list);
1900 /* TODO: select normal or high priority */ 2128 /* TODO: select normal or high priority */
1901 2129
1902 spin_lock(&t->task_state_lock); 2130 spin_lock(&t->task_state_lock);
1903 t->task_state_flags |= SAS_TASK_AT_INITIATOR; 2131 t->task_state_flags |= SAS_TASK_AT_INITIATOR;
1904 spin_unlock(&t->task_state_lock); 2132 spin_unlock(&t->task_state_lock);
1905 2133
1906 if (n == 1) {
1907 spin_unlock_irqrestore(&mvi->lock, flags);
1908 mw32(TX_PROD_IDX, mvi->tx_prod);
1909 }
1910 mvs_hba_memory_dump(mvi, tag, t->task_proto); 2134 mvs_hba_memory_dump(mvi, tag, t->task_proto);
1911 2135
1912 ++pass; 2136 ++pass;
1913 mvi->tx_prod = (mvi->tx_prod + 1) & (MVS_CHIP_SLOT_SZ - 1); 2137 mvi->tx_prod = (mvi->tx_prod + 1) & (MVS_CHIP_SLOT_SZ - 1);
1914 2138 if (n > 1)
1915 if (n == 1) 2139 t = list_entry(t->list.next, struct sas_task, list);
1916 break;
1917
1918 t = list_entry(t->list.next, struct sas_task, list);
1919 } while (--n); 2140 } while (--n);
1920 2141
1921 return 0; 2142 rc = 0;
2143 goto out_done;
1922 2144
1923err_out_tag: 2145err_out_tag:
1924 mvs_tag_free(mvi, tag); 2146 mvs_tag_free(mvi, tag);
@@ -1928,7 +2150,7 @@ err_out:
1928 if (n_elem) 2150 if (n_elem)
1929 pci_unmap_sg(mvi->pdev, t->scatter, n_elem, 2151 pci_unmap_sg(mvi->pdev, t->scatter, n_elem,
1930 t->data_dir); 2152 t->data_dir);
1931exec_exit: 2153out_done:
1932 if (pass) 2154 if (pass)
1933 mw32(TX_PROD_IDX, (mvi->tx_prod - 1) & (MVS_CHIP_SLOT_SZ - 1)); 2155 mw32(TX_PROD_IDX, (mvi->tx_prod - 1) & (MVS_CHIP_SLOT_SZ - 1));
1934 spin_unlock_irqrestore(&mvi->lock, flags); 2156 spin_unlock_irqrestore(&mvi->lock, flags);
@@ -1937,42 +2159,59 @@ exec_exit:
1937 2159
1938static int mvs_task_abort(struct sas_task *task) 2160static int mvs_task_abort(struct sas_task *task)
1939{ 2161{
1940 int rc = 1; 2162 int rc;
1941 unsigned long flags; 2163 unsigned long flags;
1942 struct mvs_info *mvi = task->dev->port->ha->lldd_ha; 2164 struct mvs_info *mvi = task->dev->port->ha->lldd_ha;
1943 struct pci_dev *pdev = mvi->pdev; 2165 struct pci_dev *pdev = mvi->pdev;
2166 int tag;
1944 2167
1945 spin_lock_irqsave(&task->task_state_lock, flags); 2168 spin_lock_irqsave(&task->task_state_lock, flags);
1946 if (task->task_state_flags & SAS_TASK_STATE_DONE) { 2169 if (task->task_state_flags & SAS_TASK_STATE_DONE) {
1947 rc = TMF_RESP_FUNC_COMPLETE; 2170 rc = TMF_RESP_FUNC_COMPLETE;
2171 spin_unlock_irqrestore(&task->task_state_lock, flags);
1948 goto out_done; 2172 goto out_done;
1949 } 2173 }
1950 spin_unlock_irqrestore(&task->task_state_lock, flags); 2174 spin_unlock_irqrestore(&task->task_state_lock, flags);
1951 2175
1952 /*FIXME*/
1953 rc = TMF_RESP_FUNC_COMPLETE;
1954
1955 switch (task->task_proto) { 2176 switch (task->task_proto) {
1956 case SAS_PROTOCOL_SMP: 2177 case SAS_PROTOCOL_SMP:
1957 dev_printk(KERN_DEBUG, &pdev->dev, "SMP Abort! "); 2178 dev_printk(KERN_DEBUG, &pdev->dev, "SMP Abort! \n");
1958 break; 2179 break;
1959 case SAS_PROTOCOL_SSP: 2180 case SAS_PROTOCOL_SSP:
1960 dev_printk(KERN_DEBUG, &pdev->dev, "SSP Abort! "); 2181 dev_printk(KERN_DEBUG, &pdev->dev, "SSP Abort! \n");
1961 break; 2182 break;
1962 case SAS_PROTOCOL_SATA: 2183 case SAS_PROTOCOL_SATA:
1963 case SAS_PROTOCOL_STP: 2184 case SAS_PROTOCOL_STP:
1964 case SAS_PROTOCOL_SATA | SAS_PROTOCOL_STP:{ 2185 case SAS_PROTOCOL_SATA | SAS_PROTOCOL_STP:{
1965 dev_printk(KERN_DEBUG, &pdev->dev, "STP Abort! " 2186 dev_printk(KERN_DEBUG, &pdev->dev, "STP Abort! \n");
1966 "Dump D2H FIS: \n"); 2187#if _MV_DUMP
2188 dev_printk(KERN_DEBUG, &pdev->dev, "Dump D2H FIS: \n");
1967 mvs_hexdump(sizeof(struct host_to_dev_fis), 2189 mvs_hexdump(sizeof(struct host_to_dev_fis),
1968 (void *)&task->ata_task.fis, 0); 2190 (void *)&task->ata_task.fis, 0);
1969 dev_printk(KERN_DEBUG, &pdev->dev, "Dump ATAPI Cmd : \n"); 2191 dev_printk(KERN_DEBUG, &pdev->dev, "Dump ATAPI Cmd : \n");
1970 mvs_hexdump(16, task->ata_task.atapi_packet, 0); 2192 mvs_hexdump(16, task->ata_task.atapi_packet, 0);
2193#endif
2194 spin_lock_irqsave(&task->task_state_lock, flags);
2195 if (task->task_state_flags & SAS_TASK_NEED_DEV_RESET) {
2196 /* TODO */
2197 ;
2198 }
2199 spin_unlock_irqrestore(&task->task_state_lock, flags);
1971 break; 2200 break;
1972 } 2201 }
1973 default: 2202 default:
1974 break; 2203 break;
1975 } 2204 }
2205
2206 if (mvs_find_tag(mvi, task, &tag)) {
2207 spin_lock_irqsave(&mvi->lock, flags);
2208 mvs_slot_task_free(mvi, task, &mvi->slot_info[tag], tag);
2209 spin_unlock_irqrestore(&mvi->lock, flags);
2210 }
2211 if (!mvs_task_exec(task, 1, GFP_ATOMIC))
2212 rc = TMF_RESP_FUNC_COMPLETE;
2213 else
2214 rc = TMF_RESP_FUNC_FAILED;
1976out_done: 2215out_done:
1977 return rc; 2216 return rc;
1978} 2217}
@@ -2001,7 +2240,7 @@ static void mvs_free(struct mvs_info *mvi)
2001 mvi->rx_fis, mvi->rx_fis_dma); 2240 mvi->rx_fis, mvi->rx_fis_dma);
2002 if (mvi->rx) 2241 if (mvi->rx)
2003 dma_free_coherent(&mvi->pdev->dev, 2242 dma_free_coherent(&mvi->pdev->dev,
2004 sizeof(*mvi->rx) * MVS_RX_RING_SZ, 2243 sizeof(*mvi->rx) * (MVS_RX_RING_SZ + 1),
2005 mvi->rx, mvi->rx_dma); 2244 mvi->rx, mvi->rx_dma);
2006 if (mvi->slot) 2245 if (mvi->slot)
2007 dma_free_coherent(&mvi->pdev->dev, 2246 dma_free_coherent(&mvi->pdev->dev,
@@ -2109,6 +2348,9 @@ static struct mvs_info *__devinit mvs_alloc(struct pci_dev *pdev,
2109 return NULL; 2348 return NULL;
2110 2349
2111 spin_lock_init(&mvi->lock); 2350 spin_lock_init(&mvi->lock);
2351#ifdef MVS_USE_TASKLET
2352 tasklet_init(&mvi->tasklet, mvs_tasklet, (unsigned long)mvi);
2353#endif
2112 mvi->pdev = pdev; 2354 mvi->pdev = pdev;
2113 mvi->chip = chip; 2355 mvi->chip = chip;
2114 2356
@@ -2132,6 +2374,10 @@ static struct mvs_info *__devinit mvs_alloc(struct pci_dev *pdev,
2132 mvs_phy_init(mvi, i); 2374 mvs_phy_init(mvi, i);
2133 arr_phy[i] = &mvi->phy[i].sas_phy; 2375 arr_phy[i] = &mvi->phy[i].sas_phy;
2134 arr_port[i] = &mvi->port[i].sas_port; 2376 arr_port[i] = &mvi->port[i].sas_port;
2377 mvi->port[i].taskfileset = MVS_ID_NOT_MAPPED;
2378 mvi->port[i].wide_port_phymap = 0;
2379 mvi->port[i].port_attached = 0;
2380 INIT_LIST_HEAD(&mvi->port[i].list);
2135 } 2381 }
2136 2382
2137 SHOST_TO_SAS_HA(mvi->shost) = &mvi->sas; 2383 SHOST_TO_SAS_HA(mvi->shost) = &mvi->sas;
@@ -2148,9 +2394,10 @@ static struct mvs_info *__devinit mvs_alloc(struct pci_dev *pdev,
2148 mvi->sas.sas_phy = arr_phy; 2394 mvi->sas.sas_phy = arr_phy;
2149 mvi->sas.sas_port = arr_port; 2395 mvi->sas.sas_port = arr_port;
2150 mvi->sas.num_phys = chip->n_phy; 2396 mvi->sas.num_phys = chip->n_phy;
2151 mvi->sas.lldd_max_execute_num = MVS_CHIP_SLOT_SZ - 1; 2397 mvi->sas.lldd_max_execute_num = 1;
2152 mvi->sas.lldd_queue_size = MVS_QUEUE_SIZE; 2398 mvi->sas.lldd_queue_size = MVS_QUEUE_SIZE;
2153 mvi->can_queue = (MVS_CHIP_SLOT_SZ >> 1) - 1; 2399 mvi->shost->can_queue = MVS_CAN_QUEUE;
2400 mvi->shost->cmd_per_lun = MVS_SLOTS / mvi->sas.num_phys;
2154 mvi->sas.lldd_ha = mvi; 2401 mvi->sas.lldd_ha = mvi;
2155 mvi->sas.core.shost = mvi->shost; 2402 mvi->sas.core.shost = mvi->shost;
2156 2403
@@ -2203,11 +2450,11 @@ static struct mvs_info *__devinit mvs_alloc(struct pci_dev *pdev,
2203 memset(mvi->rx_fis, 0, MVS_RX_FISL_SZ); 2450 memset(mvi->rx_fis, 0, MVS_RX_FISL_SZ);
2204 2451
2205 mvi->rx = dma_alloc_coherent(&pdev->dev, 2452 mvi->rx = dma_alloc_coherent(&pdev->dev,
2206 sizeof(*mvi->rx) * MVS_RX_RING_SZ, 2453 sizeof(*mvi->rx) * (MVS_RX_RING_SZ + 1),
2207 &mvi->rx_dma, GFP_KERNEL); 2454 &mvi->rx_dma, GFP_KERNEL);
2208 if (!mvi->rx) 2455 if (!mvi->rx)
2209 goto err_out; 2456 goto err_out;
2210 memset(mvi->rx, 0, sizeof(*mvi->rx) * MVS_RX_RING_SZ); 2457 memset(mvi->rx, 0, sizeof(*mvi->rx) * (MVS_RX_RING_SZ + 1));
2211 2458
2212 mvi->rx[0] = cpu_to_le32(0xfff); 2459 mvi->rx[0] = cpu_to_le32(0xfff);
2213 mvi->rx_cons = 0xfff; 2460 mvi->rx_cons = 0xfff;
@@ -2357,7 +2604,7 @@ static void __devinit mvs_phy_hacks(struct mvs_info *mvi)
2357 mvs_cw32(regs, CMD_SAS_CTL0, tmp); 2604 mvs_cw32(regs, CMD_SAS_CTL0, tmp);
2358 2605
2359 /* workaround for WDTIMEOUT , set to 550 ms */ 2606 /* workaround for WDTIMEOUT , set to 550 ms */
2360 mvs_cw32(regs, CMD_WD_TIMER, 0xffffff); 2607 mvs_cw32(regs, CMD_WD_TIMER, 0x86470);
2361 2608
2362 /* not to halt for different port op during wideport link change */ 2609 /* not to halt for different port op during wideport link change */
2363 mvs_cw32(regs, CMD_APP_ERR_CONFIG, 0xffefbf7d); 2610 mvs_cw32(regs, CMD_APP_ERR_CONFIG, 0xffefbf7d);
@@ -2465,17 +2712,16 @@ static u32 mvs_is_phy_ready(struct mvs_info *mvi, int i)
2465{ 2712{
2466 u32 tmp; 2713 u32 tmp;
2467 struct mvs_phy *phy = &mvi->phy[i]; 2714 struct mvs_phy *phy = &mvi->phy[i];
2468 struct mvs_port *port; 2715 struct mvs_port *port = phy->port;;
2469 2716
2470 tmp = mvs_read_phy_ctl(mvi, i); 2717 tmp = mvs_read_phy_ctl(mvi, i);
2471 2718
2472 if ((tmp & PHY_READY_MASK) && !(phy->irq_status & PHYEV_POOF)) { 2719 if ((tmp & PHY_READY_MASK) && !(phy->irq_status & PHYEV_POOF)) {
2473 if (!phy->port) 2720 if (!port)
2474 phy->phy_attached = 1; 2721 phy->phy_attached = 1;
2475 return tmp; 2722 return tmp;
2476 } 2723 }
2477 2724
2478 port = phy->port;
2479 if (port) { 2725 if (port) {
2480 if (phy->phy_type & PORT_TYPE_SAS) { 2726 if (phy->phy_type & PORT_TYPE_SAS) {
2481 port->wide_port_phymap &= ~(1U << i); 2727 port->wide_port_phymap &= ~(1U << i);
@@ -2497,7 +2743,7 @@ static void mvs_update_phyinfo(struct mvs_info *mvi, int i,
2497{ 2743{
2498 struct mvs_phy *phy = &mvi->phy[i]; 2744 struct mvs_phy *phy = &mvi->phy[i];
2499 struct pci_dev *pdev = mvi->pdev; 2745 struct pci_dev *pdev = mvi->pdev;
2500 u32 tmp, j; 2746 u32 tmp;
2501 u64 tmp64; 2747 u64 tmp64;
2502 2748
2503 mvs_write_port_cfg_addr(mvi, i, PHYR_IDENTIFY); 2749 mvs_write_port_cfg_addr(mvi, i, PHYR_IDENTIFY);
@@ -2524,46 +2770,20 @@ static void mvs_update_phyinfo(struct mvs_info *mvi, int i,
2524 sas_phy->linkrate = 2770 sas_phy->linkrate =
2525 (phy->phy_status & PHY_NEG_SPP_PHYS_LINK_RATE_MASK) >> 2771 (phy->phy_status & PHY_NEG_SPP_PHYS_LINK_RATE_MASK) >>
2526 PHY_NEG_SPP_PHYS_LINK_RATE_MASK_OFFSET; 2772 PHY_NEG_SPP_PHYS_LINK_RATE_MASK_OFFSET;
2527 2773 phy->minimum_linkrate =
2528 /* Updated attached_sas_addr */ 2774 (phy->phy_status &
2529 mvs_write_port_cfg_addr(mvi, i, PHYR_ATT_ADDR_HI); 2775 PHY_MIN_SPP_PHYS_LINK_RATE_MASK) >> 8;
2530 phy->att_dev_sas_addr = 2776 phy->maximum_linkrate =
2531 (u64) mvs_read_port_cfg_data(mvi, i) << 32; 2777 (phy->phy_status &
2532 2778 PHY_MAX_SPP_PHYS_LINK_RATE_MASK) >> 12;
2533 mvs_write_port_cfg_addr(mvi, i, PHYR_ATT_ADDR_LO);
2534 phy->att_dev_sas_addr |= mvs_read_port_cfg_data(mvi, i);
2535
2536 dev_printk(KERN_DEBUG, &pdev->dev,
2537 "phy[%d] Get Attached Address 0x%llX ,"
2538 " SAS Address 0x%llX\n",
2539 i, phy->att_dev_sas_addr, phy->dev_sas_addr);
2540 dev_printk(KERN_DEBUG, &pdev->dev,
2541 "Rate = %x , type = %d\n",
2542 sas_phy->linkrate, phy->phy_type);
2543
2544#if 1
2545 /*
2546 * If the device is capable of supporting a wide port
2547 * on its phys, it may configure the phys as a wide port.
2548 */
2549 if (phy->phy_type & PORT_TYPE_SAS)
2550 for (j = 0; j < mvi->chip->n_phy && j != i; ++j) {
2551 if ((mvi->phy[j].phy_attached) &&
2552 (mvi->phy[j].phy_type & PORT_TYPE_SAS))
2553 if (phy->att_dev_sas_addr ==
2554 mvi->phy[j].att_dev_sas_addr - 1) {
2555 phy->att_dev_sas_addr =
2556 mvi->phy[j].att_dev_sas_addr;
2557 break;
2558 }
2559 }
2560
2561#endif
2562
2563 tmp64 = cpu_to_be64(phy->att_dev_sas_addr);
2564 memcpy(sas_phy->attached_sas_addr, &tmp64, SAS_ADDR_SIZE);
2565 2779
2566 if (phy->phy_type & PORT_TYPE_SAS) { 2780 if (phy->phy_type & PORT_TYPE_SAS) {
2781 /* Updated attached_sas_addr */
2782 mvs_write_port_cfg_addr(mvi, i, PHYR_ATT_ADDR_HI);
2783 phy->att_dev_sas_addr =
2784 (u64) mvs_read_port_cfg_data(mvi, i) << 32;
2785 mvs_write_port_cfg_addr(mvi, i, PHYR_ATT_ADDR_LO);
2786 phy->att_dev_sas_addr |= mvs_read_port_cfg_data(mvi, i);
2567 mvs_write_port_cfg_addr(mvi, i, PHYR_ATT_DEV_INFO); 2787 mvs_write_port_cfg_addr(mvi, i, PHYR_ATT_DEV_INFO);
2568 phy->att_dev_info = mvs_read_port_cfg_data(mvi, i); 2788 phy->att_dev_info = mvs_read_port_cfg_data(mvi, i);
2569 phy->identify.device_type = 2789 phy->identify.device_type =
@@ -2582,6 +2802,7 @@ static void mvs_update_phyinfo(struct mvs_info *mvi, int i,
2582 } else if (phy->phy_type & PORT_TYPE_SATA) { 2802 } else if (phy->phy_type & PORT_TYPE_SATA) {
2583 phy->identify.target_port_protocols = SAS_PROTOCOL_STP; 2803 phy->identify.target_port_protocols = SAS_PROTOCOL_STP;
2584 if (mvs_is_sig_fis_received(phy->irq_status)) { 2804 if (mvs_is_sig_fis_received(phy->irq_status)) {
2805 phy->att_dev_sas_addr = i; /* temp */
2585 if (phy_st & PHY_OOB_DTCTD) 2806 if (phy_st & PHY_OOB_DTCTD)
2586 sas_phy->oob_mode = SATA_OOB_MODE; 2807 sas_phy->oob_mode = SATA_OOB_MODE;
2587 phy->frame_rcvd_size = 2808 phy->frame_rcvd_size =
@@ -2591,20 +2812,34 @@ static void mvs_update_phyinfo(struct mvs_info *mvi, int i,
2591 } else { 2812 } else {
2592 dev_printk(KERN_DEBUG, &pdev->dev, 2813 dev_printk(KERN_DEBUG, &pdev->dev,
2593 "No sig fis\n"); 2814 "No sig fis\n");
2815 phy->phy_type &= ~(PORT_TYPE_SATA);
2816 goto out_done;
2594 } 2817 }
2595 } 2818 }
2819 tmp64 = cpu_to_be64(phy->att_dev_sas_addr);
2820 memcpy(sas_phy->attached_sas_addr, &tmp64, SAS_ADDR_SIZE);
2821
2822 dev_printk(KERN_DEBUG, &pdev->dev,
2823 "phy[%d] Get Attached Address 0x%llX ,"
2824 " SAS Address 0x%llX\n",
2825 i, phy->att_dev_sas_addr, phy->dev_sas_addr);
2826 dev_printk(KERN_DEBUG, &pdev->dev,
2827 "Rate = %x , type = %d\n",
2828 sas_phy->linkrate, phy->phy_type);
2829
2596 /* workaround for HW phy decoding error on 1.5g disk drive */ 2830 /* workaround for HW phy decoding error on 1.5g disk drive */
2597 mvs_write_port_vsr_addr(mvi, i, VSR_PHY_MODE6); 2831 mvs_write_port_vsr_addr(mvi, i, VSR_PHY_MODE6);
2598 tmp = mvs_read_port_vsr_data(mvi, i); 2832 tmp = mvs_read_port_vsr_data(mvi, i);
2599 if (((phy->phy_status & PHY_NEG_SPP_PHYS_LINK_RATE_MASK) >> 2833 if (((phy->phy_status & PHY_NEG_SPP_PHYS_LINK_RATE_MASK) >>
2600 PHY_NEG_SPP_PHYS_LINK_RATE_MASK_OFFSET) == 2834 PHY_NEG_SPP_PHYS_LINK_RATE_MASK_OFFSET) ==
2601 SAS_LINK_RATE_1_5_GBPS) 2835 SAS_LINK_RATE_1_5_GBPS)
2602 tmp &= ~PHY_MODE6_DTL_SPEED; 2836 tmp &= ~PHY_MODE6_LATECLK;
2603 else 2837 else
2604 tmp |= PHY_MODE6_DTL_SPEED; 2838 tmp |= PHY_MODE6_LATECLK;
2605 mvs_write_port_vsr_data(mvi, i, tmp); 2839 mvs_write_port_vsr_data(mvi, i, tmp);
2606 2840
2607 } 2841 }
2842out_done:
2608 if (get_st) 2843 if (get_st)
2609 mvs_write_port_irq_stat(mvi, i, phy->irq_status); 2844 mvs_write_port_irq_stat(mvi, i, phy->irq_status);
2610} 2845}
@@ -2629,6 +2864,11 @@ static void mvs_port_formed(struct asd_sas_phy *sas_phy)
2629 spin_unlock_irqrestore(&mvi->lock, flags); 2864 spin_unlock_irqrestore(&mvi->lock, flags);
2630} 2865}
2631 2866
2867static int mvs_I_T_nexus_reset(struct domain_device *dev)
2868{
2869 return TMF_RESP_FUNC_FAILED;
2870}
2871
2632static int __devinit mvs_hw_init(struct mvs_info *mvi) 2872static int __devinit mvs_hw_init(struct mvs_info *mvi)
2633{ 2873{
2634 void __iomem *regs = mvi->regs; 2874 void __iomem *regs = mvi->regs;
@@ -2790,13 +3030,12 @@ static int __devinit mvs_hw_init(struct mvs_info *mvi)
2790 /* enable CMD/CMPL_Q/RESP mode */ 3030 /* enable CMD/CMPL_Q/RESP mode */
2791 mw32(PCS, PCS_SATA_RETRY | PCS_FIS_RX_EN | PCS_CMD_EN); 3031 mw32(PCS, PCS_SATA_RETRY | PCS_FIS_RX_EN | PCS_CMD_EN);
2792 3032
2793 /* re-enable interrupts globally */
2794 mvs_hba_interrupt_enable(mvi);
2795
2796 /* enable completion queue interrupt */ 3033 /* enable completion queue interrupt */
2797 tmp = (CINT_PORT_MASK | CINT_DONE | CINT_MEM); 3034 tmp = (CINT_PORT_MASK | CINT_DONE | CINT_MEM | CINT_SRS);
2798 mw32(INT_MASK, tmp); 3035 mw32(INT_MASK, tmp);
2799 3036
3037 /* Enable SRS interrupt */
3038 mw32(INT_MASK_SRS, 0xFF);
2800 return 0; 3039 return 0;
2801} 3040}
2802 3041
@@ -2870,6 +3109,8 @@ static int __devinit mvs_pci_init(struct pci_dev *pdev,
2870 3109
2871 mvs_print_info(mvi); 3110 mvs_print_info(mvi);
2872 3111
3112 mvs_hba_interrupt_enable(mvi);
3113
2873 scsi_scan_host(mvi->shost); 3114 scsi_scan_host(mvi->shost);
2874 3115
2875 return 0; 3116 return 0;
@@ -2915,12 +3156,22 @@ static struct sas_domain_function_template mvs_transport_ops = {
2915 .lldd_execute_task = mvs_task_exec, 3156 .lldd_execute_task = mvs_task_exec,
2916 .lldd_control_phy = mvs_phy_control, 3157 .lldd_control_phy = mvs_phy_control,
2917 .lldd_abort_task = mvs_task_abort, 3158 .lldd_abort_task = mvs_task_abort,
2918 .lldd_port_formed = mvs_port_formed 3159 .lldd_port_formed = mvs_port_formed,
3160 .lldd_I_T_nexus_reset = mvs_I_T_nexus_reset,
2919}; 3161};
2920 3162
2921static struct pci_device_id __devinitdata mvs_pci_table[] = { 3163static struct pci_device_id __devinitdata mvs_pci_table[] = {
2922 { PCI_VDEVICE(MARVELL, 0x6320), chip_6320 }, 3164 { PCI_VDEVICE(MARVELL, 0x6320), chip_6320 },
2923 { PCI_VDEVICE(MARVELL, 0x6340), chip_6440 }, 3165 { PCI_VDEVICE(MARVELL, 0x6340), chip_6440 },
3166 {
3167 .vendor = PCI_VENDOR_ID_MARVELL,
3168 .device = 0x6440,
3169 .subvendor = PCI_ANY_ID,
3170 .subdevice = 0x6480,
3171 .class = 0,
3172 .class_mask = 0,
3173 .driver_data = chip_6480,
3174 },
2924 { PCI_VDEVICE(MARVELL, 0x6440), chip_6440 }, 3175 { PCI_VDEVICE(MARVELL, 0x6440), chip_6440 },
2925 { PCI_VDEVICE(MARVELL, 0x6480), chip_6480 }, 3176 { PCI_VDEVICE(MARVELL, 0x6480), chip_6480 },
2926 3177
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index b9b09a704584..ed83cdb6e67d 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -294,7 +294,6 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work)
294 } 294 }
295 295
296 if (sdev->request_queue) { 296 if (sdev->request_queue) {
297 bsg_unregister_queue(sdev->request_queue);
298 sdev->request_queue->queuedata = NULL; 297 sdev->request_queue->queuedata = NULL;
299 /* user context needed to free queue */ 298 /* user context needed to free queue */
300 scsi_free_queue(sdev->request_queue); 299 scsi_free_queue(sdev->request_queue);
@@ -858,6 +857,7 @@ void __scsi_remove_device(struct scsi_device *sdev)
858 if (scsi_device_set_state(sdev, SDEV_CANCEL) != 0) 857 if (scsi_device_set_state(sdev, SDEV_CANCEL) != 0)
859 return; 858 return;
860 859
860 bsg_unregister_queue(sdev->request_queue);
861 class_device_unregister(&sdev->sdev_classdev); 861 class_device_unregister(&sdev->sdev_classdev);
862 transport_remove_device(dev); 862 transport_remove_device(dev);
863 device_del(dev); 863 device_del(dev);
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index d57bf3e708d8..430997e33fc4 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -96,6 +96,7 @@
96 96
97 /* PDC registers */ 97 /* PDC registers */
98#define UART_PUT_PTCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_PTCR) 98#define UART_PUT_PTCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_PTCR)
99#define UART_GET_TCR(port) __raw_readl((port)->membase + ATMEL_PDC_TCR)
99#define UART_GET_PTSR(port) __raw_readl((port)->membase + ATMEL_PDC_PTSR) 100#define UART_GET_PTSR(port) __raw_readl((port)->membase + ATMEL_PDC_PTSR)
100 101
101#define UART_PUT_RPR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_RPR) 102#define UART_PUT_RPR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_RPR)
@@ -106,6 +107,7 @@
106 107
107#define UART_PUT_TPR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_TPR) 108#define UART_PUT_TPR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_TPR)
108#define UART_PUT_TCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_TCR) 109#define UART_PUT_TCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_TCR)
110#define UART_GET_TCR(port) __raw_readl((port)->membase + ATMEL_PDC_TCR)
109 111
110static int (*atmel_open_hook)(struct uart_port *); 112static int (*atmel_open_hook)(struct uart_port *);
111static void (*atmel_close_hook)(struct uart_port *); 113static void (*atmel_close_hook)(struct uart_port *);
@@ -562,17 +564,22 @@ static void atmel_tx_dma(struct uart_port *port)
562 struct atmel_dma_buffer *pdc = &atmel_port->pdc_tx; 564 struct atmel_dma_buffer *pdc = &atmel_port->pdc_tx;
563 int count; 565 int count;
564 566
567 /* nothing left to transmit? */
568 if (UART_GET_TCR(port))
569 return;
570
565 xmit->tail += pdc->ofs; 571 xmit->tail += pdc->ofs;
566 xmit->tail &= UART_XMIT_SIZE - 1; 572 xmit->tail &= UART_XMIT_SIZE - 1;
567 573
568 port->icount.tx += pdc->ofs; 574 port->icount.tx += pdc->ofs;
569 pdc->ofs = 0; 575 pdc->ofs = 0;
570 576
571 if (!uart_circ_empty(xmit)) { 577 /* more to transmit - setup next transfer */
572 /* more to transmit - setup next transfer */
573 578
574 /* disable PDC transmit */ 579 /* disable PDC transmit */
575 UART_PUT_PTCR(port, ATMEL_PDC_TXTDIS); 580 UART_PUT_PTCR(port, ATMEL_PDC_TXTDIS);
581
582 if (!uart_circ_empty(xmit)) {
576 dma_sync_single_for_device(port->dev, 583 dma_sync_single_for_device(port->dev,
577 pdc->dma_addr, 584 pdc->dma_addr,
578 pdc->dma_size, 585 pdc->dma_size,
@@ -586,11 +593,6 @@ static void atmel_tx_dma(struct uart_port *port)
586 /* re-enable PDC transmit and interrupts */ 593 /* re-enable PDC transmit and interrupts */
587 UART_PUT_PTCR(port, ATMEL_PDC_TXTEN); 594 UART_PUT_PTCR(port, ATMEL_PDC_TXTEN);
588 UART_PUT_IER(port, ATMEL_US_ENDTX | ATMEL_US_TXBUFE); 595 UART_PUT_IER(port, ATMEL_US_ENDTX | ATMEL_US_TXBUFE);
589 } else {
590 /* nothing left to transmit - disable the transmitter */
591
592 /* disable PDC transmit */
593 UART_PUT_PTCR(port, ATMEL_PDC_TXTDIS);
594 } 596 }
595 597
596 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) 598 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
@@ -1274,6 +1276,7 @@ static void atmel_console_write(struct console *co, const char *s, u_int count)
1274{ 1276{
1275 struct uart_port *port = &atmel_ports[co->index].uart; 1277 struct uart_port *port = &atmel_ports[co->index].uart;
1276 unsigned int status, imr; 1278 unsigned int status, imr;
1279 unsigned int pdc_tx;
1277 1280
1278 /* 1281 /*
1279 * First, save IMR and then disable interrupts 1282 * First, save IMR and then disable interrupts
@@ -1281,6 +1284,10 @@ static void atmel_console_write(struct console *co, const char *s, u_int count)
1281 imr = UART_GET_IMR(port); 1284 imr = UART_GET_IMR(port);
1282 UART_PUT_IDR(port, ATMEL_US_RXRDY | ATMEL_US_TXRDY); 1285 UART_PUT_IDR(port, ATMEL_US_RXRDY | ATMEL_US_TXRDY);
1283 1286
1287 /* Store PDC transmit status and disable it */
1288 pdc_tx = UART_GET_PTSR(port) & ATMEL_PDC_TXTEN;
1289 UART_PUT_PTCR(port, ATMEL_PDC_TXTDIS);
1290
1284 uart_console_write(port, s, count, atmel_console_putchar); 1291 uart_console_write(port, s, count, atmel_console_putchar);
1285 1292
1286 /* 1293 /*
@@ -1290,6 +1297,11 @@ static void atmel_console_write(struct console *co, const char *s, u_int count)
1290 do { 1297 do {
1291 status = UART_GET_CSR(port); 1298 status = UART_GET_CSR(port);
1292 } while (!(status & ATMEL_US_TXRDY)); 1299 } while (!(status & ATMEL_US_TXRDY));
1300
1301 /* Restore PDC transmit status */
1302 if (pdc_tx)
1303 UART_PUT_PTCR(port, ATMEL_PDC_TXTEN);
1304
1293 /* set interrupts back the way they were */ 1305 /* set interrupts back the way they were */
1294 UART_PUT_IER(port, imr); 1306 UART_PUT_IER(port, imr);
1295} 1307}
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 40e8240b7851..4e065e556e4b 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -135,8 +135,6 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
135 hcd->state = HC_STATE_QUIESCING; 135 hcd->state = HC_STATE_QUIESCING;
136 } 136 }
137 ehci->command = ehci_readl(ehci, &ehci->regs->command); 137 ehci->command = ehci_readl(ehci, &ehci->regs->command);
138 if (ehci->reclaim)
139 end_unlink_async(ehci);
140 ehci_work(ehci); 138 ehci_work(ehci);
141 139
142 /* Unlike other USB host controller types, EHCI doesn't have 140 /* Unlike other USB host controller types, EHCI doesn't have
@@ -180,6 +178,9 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
180 ehci_halt (ehci); 178 ehci_halt (ehci);
181 hcd->state = HC_STATE_SUSPENDED; 179 hcd->state = HC_STATE_SUSPENDED;
182 180
181 if (ehci->reclaim)
182 end_unlink_async(ehci);
183
183 /* allow remote wakeup */ 184 /* allow remote wakeup */
184 mask = INTR_MASK; 185 mask = INTR_MASK;
185 if (!device_may_wakeup(&hcd->self.root_hub->dev)) 186 if (!device_may_wakeup(&hcd->self.root_hub->dev))
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index dd4798ee028e..33f1c1c32edf 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -467,7 +467,7 @@ static void unlink_watchdog_func(unsigned long _ohci)
467out: 467out:
468 kfree(seen); 468 kfree(seen);
469 if (ohci->eds_scheduled) 469 if (ohci->eds_scheduled)
470 mod_timer(&ohci->unlink_watchdog, round_jiffies_relative(HZ)); 470 mod_timer(&ohci->unlink_watchdog, round_jiffies(jiffies + HZ));
471done: 471done:
472 spin_unlock_irqrestore(&ohci->lock, flags); 472 spin_unlock_irqrestore(&ohci->lock, flags);
473} 473}
diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c
index 51817322232b..9c9f3b59186f 100644
--- a/drivers/usb/host/ohci-q.c
+++ b/drivers/usb/host/ohci-q.c
@@ -169,7 +169,7 @@ static int ed_schedule (struct ohci_hcd *ohci, struct ed *ed)
169 if (quirk_zfmicro(ohci) 169 if (quirk_zfmicro(ohci)
170 && (ed->type == PIPE_INTERRUPT) 170 && (ed->type == PIPE_INTERRUPT)
171 && !(ohci->eds_scheduled++)) 171 && !(ohci->eds_scheduled++))
172 mod_timer(&ohci->unlink_watchdog, round_jiffies_relative(HZ)); 172 mod_timer(&ohci->unlink_watchdog, round_jiffies(jiffies + HZ));
173 wmb (); 173 wmb ();
174 174
175 /* we care about rm_list when setting CLE/BLE in case the HC was at 175 /* we care about rm_list when setting CLE/BLE in case the HC was at
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index da922dfc0dcc..b6b5b2affad1 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -378,6 +378,7 @@ alloc_sglist (int nents, int max, int vary)
378 sg = kmalloc (nents * sizeof *sg, GFP_KERNEL); 378 sg = kmalloc (nents * sizeof *sg, GFP_KERNEL);
379 if (!sg) 379 if (!sg)
380 return NULL; 380 return NULL;
381 sg_init_table(sg, nents);
381 382
382 for (i = 0; i < nents; i++) { 383 for (i = 0; i < nents; i++) {
383 char *buf; 384 char *buf;
@@ -390,7 +391,7 @@ alloc_sglist (int nents, int max, int vary)
390 } 391 }
391 392
392 /* kmalloc pages are always physically contiguous! */ 393 /* kmalloc pages are always physically contiguous! */
393 sg_init_one(&sg[i], buf, size); 394 sg_set_buf(&sg[i], buf, size);
394 395
395 switch (pattern) { 396 switch (pattern) {
396 case 0: 397 case 0:
diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c
index f3ca66017a03..324bb61d68ff 100644
--- a/drivers/usb/serial/cp2101.c
+++ b/drivers/usb/serial/cp2101.c
@@ -75,6 +75,7 @@ static struct usb_device_id id_table [] = {
75 { USB_DEVICE(0x10C4, 0x81E2) }, /* Lipowsky Industrie Elektronik GmbH, Baby-LIN */ 75 { USB_DEVICE(0x10C4, 0x81E2) }, /* Lipowsky Industrie Elektronik GmbH, Baby-LIN */
76 { USB_DEVICE(0x10C4, 0x81E7) }, /* Aerocomm Radio */ 76 { USB_DEVICE(0x10C4, 0x81E7) }, /* Aerocomm Radio */
77 { USB_DEVICE(0x10C4, 0x8218) }, /* Lipowsky Industrie Elektronik GmbH, HARP-1 */ 77 { USB_DEVICE(0x10C4, 0x8218) }, /* Lipowsky Industrie Elektronik GmbH, HARP-1 */
78 { USB_DEVICE(0x10c4, 0x8293) }, /* Telegesys ETRX2USB */
78 { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ 79 { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */
79 { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ 80 { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */
80 { USB_DEVICE(0x10C4, 0xF001) }, /* Elan Digital Systems USBscope50 */ 81 { USB_DEVICE(0x10C4, 0xF001) }, /* Elan Digital Systems USBscope50 */
diff --git a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h
index 8a0d17401529..74ce8bca3e66 100644
--- a/drivers/usb/serial/keyspan.h
+++ b/drivers/usb/serial/keyspan.h
@@ -637,6 +637,7 @@ static struct usb_serial_driver keyspan_pre_device = {
637 .description = "Keyspan - (without firmware)", 637 .description = "Keyspan - (without firmware)",
638 .id_table = keyspan_pre_ids, 638 .id_table = keyspan_pre_ids,
639 .num_interrupt_in = NUM_DONT_CARE, 639 .num_interrupt_in = NUM_DONT_CARE,
640 .num_interrupt_out = NUM_DONT_CARE,
640 .num_bulk_in = NUM_DONT_CARE, 641 .num_bulk_in = NUM_DONT_CARE,
641 .num_bulk_out = NUM_DONT_CARE, 642 .num_bulk_out = NUM_DONT_CARE,
642 .num_ports = 1, 643 .num_ports = 1,
@@ -651,6 +652,7 @@ static struct usb_serial_driver keyspan_1port_device = {
651 .description = "Keyspan 1 port adapter", 652 .description = "Keyspan 1 port adapter",
652 .id_table = keyspan_1port_ids, 653 .id_table = keyspan_1port_ids,
653 .num_interrupt_in = NUM_DONT_CARE, 654 .num_interrupt_in = NUM_DONT_CARE,
655 .num_interrupt_out = NUM_DONT_CARE,
654 .num_bulk_in = NUM_DONT_CARE, 656 .num_bulk_in = NUM_DONT_CARE,
655 .num_bulk_out = NUM_DONT_CARE, 657 .num_bulk_out = NUM_DONT_CARE,
656 .num_ports = 1, 658 .num_ports = 1,
@@ -678,6 +680,7 @@ static struct usb_serial_driver keyspan_2port_device = {
678 .description = "Keyspan 2 port adapter", 680 .description = "Keyspan 2 port adapter",
679 .id_table = keyspan_2port_ids, 681 .id_table = keyspan_2port_ids,
680 .num_interrupt_in = NUM_DONT_CARE, 682 .num_interrupt_in = NUM_DONT_CARE,
683 .num_interrupt_out = NUM_DONT_CARE,
681 .num_bulk_in = NUM_DONT_CARE, 684 .num_bulk_in = NUM_DONT_CARE,
682 .num_bulk_out = NUM_DONT_CARE, 685 .num_bulk_out = NUM_DONT_CARE,
683 .num_ports = 2, 686 .num_ports = 2,
@@ -705,6 +708,7 @@ static struct usb_serial_driver keyspan_4port_device = {
705 .description = "Keyspan 4 port adapter", 708 .description = "Keyspan 4 port adapter",
706 .id_table = keyspan_4port_ids, 709 .id_table = keyspan_4port_ids,
707 .num_interrupt_in = NUM_DONT_CARE, 710 .num_interrupt_in = NUM_DONT_CARE,
711 .num_interrupt_out = NUM_DONT_CARE,
708 .num_bulk_in = NUM_DONT_CARE, 712 .num_bulk_in = NUM_DONT_CARE,
709 .num_bulk_out = NUM_DONT_CARE, 713 .num_bulk_out = NUM_DONT_CARE,
710 .num_ports = 4, 714 .num_ports = 4,
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index b517f93352ec..e3d241f67afc 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -265,8 +265,8 @@ static struct usb_serial_driver ti_1port_device = {
265 .description = "TI USB 3410 1 port adapter", 265 .description = "TI USB 3410 1 port adapter",
266 .usb_driver = &ti_usb_driver, 266 .usb_driver = &ti_usb_driver,
267 .id_table = ti_id_table_3410, 267 .id_table = ti_id_table_3410,
268 .num_interrupt_in = 1, 268 .num_interrupt_in = NUM_DONT_CARE,
269 .num_bulk_in = 1, 269 .num_bulk_in = NUM_DONT_CARE,
270 .num_bulk_out = 1, 270 .num_bulk_out = 1,
271 .num_ports = 1, 271 .num_ports = 1,
272 .attach = ti_startup, 272 .attach = ti_startup,
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index 22b3f78a388c..c2b01f7c3197 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -191,7 +191,7 @@ static struct usb_serial_driver handspring_device = {
191 .id_table = id_table, 191 .id_table = id_table,
192 .num_interrupt_in = NUM_DONT_CARE, 192 .num_interrupt_in = NUM_DONT_CARE,
193 .num_bulk_in = 2, 193 .num_bulk_in = 2,
194 .num_bulk_out = 2, 194 .num_bulk_out = NUM_DONT_CARE,
195 .num_ports = 2, 195 .num_ports = 2,
196 .open = visor_open, 196 .open = visor_open,
197 .close = visor_close, 197 .close = visor_close,
diff --git a/drivers/watchdog/it8712f_wdt.c b/drivers/watchdog/it8712f_wdt.c
index 1efcad3b6fca..ca90c5192596 100644
--- a/drivers/watchdog/it8712f_wdt.c
+++ b/drivers/watchdog/it8712f_wdt.c
@@ -111,15 +111,6 @@ superio_inw(int reg)
111 return val; 111 return val;
112} 112}
113 113
114static void
115superio_outw(int val, int reg)
116{
117 outb(reg++, REG);
118 outb((val >> 8) & 0xff, VAL);
119 outb(reg, REG);
120 outb(val & 0xff, VAL);
121}
122
123static inline void 114static inline void
124superio_select(int ldn) 115superio_select(int ldn)
125{ 116{
@@ -170,9 +161,8 @@ it8712f_wdt_update_margin(void)
170 superio_outb(config, WDT_CONFIG); 161 superio_outb(config, WDT_CONFIG);
171 162
172 if (revision >= 0x08) 163 if (revision >= 0x08)
173 superio_outw(units, WDT_TIMEOUT); 164 superio_outb(units >> 8, WDT_TIMEOUT + 1);
174 else 165 superio_outb(units, WDT_TIMEOUT);
175 superio_outb(units, WDT_TIMEOUT);
176} 166}
177 167
178static int 168static int