aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/drm/Kconfig2
-rw-r--r--drivers/char/random.c67
-rw-r--r--drivers/firewire/Kconfig14
-rw-r--r--drivers/firewire/Makefile12
-rw-r--r--drivers/firewire/fw-cdev.c2
-rw-r--r--drivers/firewire/fw-ohci.c5
-rw-r--r--drivers/hwmon/Kconfig2
-rw-r--r--drivers/hwmon/applesmc.c7
-rw-r--r--drivers/hwmon/coretemp.c32
-rw-r--r--drivers/hwmon/ds1621.c8
-rw-r--r--drivers/hwmon/hwmon-vid.c4
-rw-r--r--drivers/hwmon/w83627hf.c4
-rw-r--r--drivers/i2c/busses/i2c-pxa.c23
-rw-r--r--drivers/ieee1394/eth1394.c91
-rw-r--r--drivers/ieee1394/eth1394.h4
-rw-r--r--drivers/ieee1394/raw1394.c8
-rw-r--r--drivers/ieee1394/sbp2.c1
-rw-r--r--drivers/infiniband/core/cm.c25
-rw-r--r--drivers/infiniband/hw/mthca/mthca_qp.c6
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib.h3
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_cm.c74
-rw-r--r--drivers/input/serio/sa1111ps2.c4
-rw-r--r--drivers/macintosh/Kconfig1
-rw-r--r--drivers/message/fusion/mptbase.h2
-rw-r--r--drivers/message/fusion/mptscsih.c8
-rw-r--r--drivers/net/Kconfig1
-rw-r--r--drivers/net/defxx.c1
-rw-r--r--drivers/net/e1000/e1000_main.c9
-rw-r--r--drivers/net/ehea/ehea.h2
-rw-r--r--drivers/net/ehea/ehea_main.c2
-rw-r--r--drivers/net/mlx4/alloc.c2
-rw-r--r--drivers/net/sky2.c6
-rw-r--r--drivers/net/sky2.h24
-rw-r--r--drivers/net/wireless/hostap/hostap_80211_tx.c13
-rw-r--r--drivers/net/wireless/prism54/islpci_eth.c5
-rw-r--r--drivers/pci/quirks.c18
-rw-r--r--drivers/pcmcia/at91_cf.c13
-rw-r--r--drivers/s390/scsi/zfcp_aux.c1
-rw-r--r--drivers/s390/scsi/zfcp_ccw.c5
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c40
-rw-r--r--drivers/s390/scsi/zfcp_scsi.c3
-rw-r--r--drivers/scsi/Kconfig14
-rw-r--r--drivers/scsi/Makefile5
-rw-r--r--drivers/scsi/aacraid/aachba.c15
-rw-r--r--drivers/scsi/aacraid/aacraid.h3
-rw-r--r--drivers/scsi/aacraid/rx.c8
-rw-r--r--drivers/scsi/aacraid/sa.c9
-rw-r--r--drivers/scsi/aic7xxx/aicasm/aicasm_gram.y1
-rw-r--r--drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.y1
-rw-r--r--drivers/scsi/aic94xx/aic94xx_tmf.c14
-rw-r--r--drivers/scsi/ipr.c7
-rw-r--r--drivers/scsi/jazz_esp.c429
-rw-r--r--drivers/scsi/libsrp.c1
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.c67
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.h14
-rw-r--r--drivers/scsi/pluto.c18
-rw-r--r--drivers/scsi/scsi_devinfo.c1
-rw-r--r--drivers/scsi/sd.c18
-rw-r--r--drivers/scsi/stex.c90
-rw-r--r--drivers/serial/amba-pl010.c3
-rw-r--r--drivers/serial/amba-pl011.c3
-rw-r--r--drivers/serial/serial_ks8695.c2
-rw-r--r--drivers/serial/suncore.c6
-rw-r--r--drivers/serial/sunzilog.c4
-rw-r--r--drivers/usb/core/hcd.c2
-rw-r--r--drivers/usb/core/hub.c32
-rw-r--r--drivers/usb/core/usb.c4
-rw-r--r--drivers/video/neofb.c30
68 files changed, 734 insertions, 621 deletions
diff --git a/drivers/char/drm/Kconfig b/drivers/char/drm/Kconfig
index ef833a1c27eb..0b7ffa5191c6 100644
--- a/drivers/char/drm/Kconfig
+++ b/drivers/char/drm/Kconfig
@@ -6,7 +6,7 @@
6# 6#
7config DRM 7config DRM
8 tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)" 8 tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)"
9 depends on (AGP || AGP=n) && PCI 9 depends on (AGP || AGP=n) && PCI && !EMULATED_CMPXCHG
10 help 10 help
11 Kernel-level support for the Direct Rendering Infrastructure (DRI) 11 Kernel-level support for the Direct Rendering Infrastructure (DRI)
12 introduced in XFree86 4.0. If you say Y here, you need to select 12 introduced in XFree86 4.0. If you say Y here, you need to select
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 46c1b97748b6..0474cac4a84e 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -760,7 +760,7 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min,
760 760
761static void extract_buf(struct entropy_store *r, __u8 *out) 761static void extract_buf(struct entropy_store *r, __u8 *out)
762{ 762{
763 int i, x; 763 int i;
764 __u32 data[16], buf[5 + SHA_WORKSPACE_WORDS]; 764 __u32 data[16], buf[5 + SHA_WORKSPACE_WORDS];
765 765
766 sha_init(buf); 766 sha_init(buf);
@@ -772,9 +772,11 @@ static void extract_buf(struct entropy_store *r, __u8 *out)
772 * attempts to find previous ouputs), unless the hash 772 * attempts to find previous ouputs), unless the hash
773 * function can be inverted. 773 * function can be inverted.
774 */ 774 */
775 for (i = 0, x = 0; i < r->poolinfo->poolwords; i += 16, x+=2) { 775 for (i = 0; i < r->poolinfo->poolwords; i += 16) {
776 sha_transform(buf, (__u8 *)r->pool+i, buf + 5); 776 /* hash blocks of 16 words = 512 bits */
777 add_entropy_words(r, &buf[x % 5], 1); 777 sha_transform(buf, (__u8 *)(r->pool + i), buf + 5);
778 /* feed back portion of the resulting hash */
779 add_entropy_words(r, &buf[i % 5], 1);
778 } 780 }
779 781
780 /* 782 /*
@@ -782,7 +784,7 @@ static void extract_buf(struct entropy_store *r, __u8 *out)
782 * portion of the pool while mixing, and hash one 784 * portion of the pool while mixing, and hash one
783 * final time. 785 * final time.
784 */ 786 */
785 __add_entropy_words(r, &buf[x % 5], 1, data); 787 __add_entropy_words(r, &buf[i % 5], 1, data);
786 sha_transform(buf, (__u8 *)data, buf + 5); 788 sha_transform(buf, (__u8 *)data, buf + 5);
787 789
788 /* 790 /*
@@ -1018,37 +1020,44 @@ random_poll(struct file *file, poll_table * wait)
1018 return mask; 1020 return mask;
1019} 1021}
1020 1022
1021static ssize_t 1023static int
1022random_write(struct file * file, const char __user * buffer, 1024write_pool(struct entropy_store *r, const char __user *buffer, size_t count)
1023 size_t count, loff_t *ppos)
1024{ 1025{
1025 int ret = 0;
1026 size_t bytes; 1026 size_t bytes;
1027 __u32 buf[16]; 1027 __u32 buf[16];
1028 const char __user *p = buffer; 1028 const char __user *p = buffer;
1029 size_t c = count;
1030 1029
1031 while (c > 0) { 1030 while (count > 0) {
1032 bytes = min(c, sizeof(buf)); 1031 bytes = min(count, sizeof(buf));
1032 if (copy_from_user(&buf, p, bytes))
1033 return -EFAULT;
1033 1034
1034 bytes -= copy_from_user(&buf, p, bytes); 1035 count -= bytes;
1035 if (!bytes) {
1036 ret = -EFAULT;
1037 break;
1038 }
1039 c -= bytes;
1040 p += bytes; 1036 p += bytes;
1041 1037
1042 add_entropy_words(&input_pool, buf, (bytes + 3) / 4); 1038 add_entropy_words(r, buf, (bytes + 3) / 4);
1043 }
1044 if (p == buffer) {
1045 return (ssize_t)ret;
1046 } else {
1047 struct inode *inode = file->f_path.dentry->d_inode;
1048 inode->i_mtime = current_fs_time(inode->i_sb);
1049 mark_inode_dirty(inode);
1050 return (ssize_t)(p - buffer);
1051 } 1039 }
1040
1041 return 0;
1042}
1043
1044static ssize_t
1045random_write(struct file * file, const char __user * buffer,
1046 size_t count, loff_t *ppos)
1047{
1048 size_t ret;
1049 struct inode *inode = file->f_path.dentry->d_inode;
1050
1051 ret = write_pool(&blocking_pool, buffer, count);
1052 if (ret)
1053 return ret;
1054 ret = write_pool(&nonblocking_pool, buffer, count);
1055 if (ret)
1056 return ret;
1057
1058 inode->i_mtime = current_fs_time(inode->i_sb);
1059 mark_inode_dirty(inode);
1060 return (ssize_t)count;
1052} 1061}
1053 1062
1054static int 1063static int
@@ -1087,8 +1096,8 @@ random_ioctl(struct inode * inode, struct file * file,
1087 return -EINVAL; 1096 return -EINVAL;
1088 if (get_user(size, p++)) 1097 if (get_user(size, p++))
1089 return -EFAULT; 1098 return -EFAULT;
1090 retval = random_write(file, (const char __user *) p, 1099 retval = write_pool(&input_pool, (const char __user *)p,
1091 size, &file->f_pos); 1100 size);
1092 if (retval < 0) 1101 if (retval < 0)
1093 return retval; 1102 return retval;
1094 credit_entropy_store(&input_pool, ent_count); 1103 credit_entropy_store(&input_pool, ent_count);
diff --git a/drivers/firewire/Kconfig b/drivers/firewire/Kconfig
index 5932c72f9e42..396dade731f9 100644
--- a/drivers/firewire/Kconfig
+++ b/drivers/firewire/Kconfig
@@ -18,7 +18,7 @@ config FIREWIRE
18 your IEEE 1394 adapter. 18 your IEEE 1394 adapter.
19 19
20 To compile this driver as a module, say M here: the module will be 20 To compile this driver as a module, say M here: the module will be
21 called fw-core. 21 called firewire-core.
22 22
23 This is the "JUJU" FireWire stack, an alternative implementation 23 This is the "JUJU" FireWire stack, an alternative implementation
24 designed for robustness and simplicity. You can build either this 24 designed for robustness and simplicity. You can build either this
@@ -34,11 +34,11 @@ config FIREWIRE_OHCI
34 is the only chipset in use, so say Y here. 34 is the only chipset in use, so say Y here.
35 35
36 To compile this driver as a module, say M here: The module will be 36 To compile this driver as a module, say M here: The module will be
37 called fw-ohci. 37 called firewire-ohci.
38 38
39 If you also build ohci1394 of the classic IEEE 1394 driver stack, 39 If you also build ohci1394 of the classic IEEE 1394 driver stack,
40 blacklist either ohci1394 or fw-ohci to let hotplug load the desired 40 blacklist either ohci1394 or firewire-ohci to let hotplug load the
41 driver. 41 desired driver.
42 42
43config FIREWIRE_SBP2 43config FIREWIRE_SBP2
44 tristate "Support for storage devices (SBP-2 protocol driver)" 44 tristate "Support for storage devices (SBP-2 protocol driver)"
@@ -50,12 +50,12 @@ config FIREWIRE_SBP2
50 like scanners. 50 like scanners.
51 51
52 To compile this driver as a module, say M here: The module will be 52 To compile this driver as a module, say M here: The module will be
53 called fw-sbp2. 53 called firewire-sbp2.
54 54
55 You should also enable support for disks, CD-ROMs, etc. in the SCSI 55 You should also enable support for disks, CD-ROMs, etc. in the SCSI
56 configuration section. 56 configuration section.
57 57
58 If you also build sbp2 of the classic IEEE 1394 driver stack, 58 If you also build sbp2 of the classic IEEE 1394 driver stack,
59 blacklist either sbp2 or fw-sbp2 to let hotplug load the desired 59 blacklist either sbp2 or firewire-sbp2 to let hotplug load the
60 driver. 60 desired driver.
61 61
diff --git a/drivers/firewire/Makefile b/drivers/firewire/Makefile
index fc7d59d4bce0..a7c31e9039c1 100644
--- a/drivers/firewire/Makefile
+++ b/drivers/firewire/Makefile
@@ -2,9 +2,11 @@
2# Makefile for the Linux IEEE 1394 implementation 2# Makefile for the Linux IEEE 1394 implementation
3# 3#
4 4
5fw-core-y += fw-card.o fw-topology.o fw-transaction.o fw-iso.o \ 5firewire-core-y += fw-card.o fw-topology.o fw-transaction.o fw-iso.o \
6 fw-device.o fw-cdev.o 6 fw-device.o fw-cdev.o
7firewire-ohci-y += fw-ohci.o
8firewire-sbp2-y += fw-sbp2.o
7 9
8obj-$(CONFIG_FIREWIRE) += fw-core.o 10obj-$(CONFIG_FIREWIRE) += firewire-core.o
9obj-$(CONFIG_FIREWIRE_OHCI) += fw-ohci.o 11obj-$(CONFIG_FIREWIRE_OHCI) += firewire-ohci.o
10obj-$(CONFIG_FIREWIRE_SBP2) += fw-sbp2.o 12obj-$(CONFIG_FIREWIRE_SBP2) += firewire-sbp2.o
diff --git a/drivers/firewire/fw-cdev.c b/drivers/firewire/fw-cdev.c
index 0fa5bd54c6a1..3ab3585d3601 100644
--- a/drivers/firewire/fw-cdev.c
+++ b/drivers/firewire/fw-cdev.c
@@ -365,7 +365,7 @@ complete_transaction(struct fw_card *card, int rcode,
365 response->response.data, response->response.length); 365 response->response.data, response->response.length);
366} 366}
367 367
368static ssize_t ioctl_send_request(struct client *client, void *buffer) 368static int ioctl_send_request(struct client *client, void *buffer)
369{ 369{
370 struct fw_device *device = client->device; 370 struct fw_device *device = client->device;
371 struct fw_cdev_send_request *request = buffer; 371 struct fw_cdev_send_request *request = buffer;
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c
index c17342d3e6fd..2e4cfa57126d 100644
--- a/drivers/firewire/fw-ohci.c
+++ b/drivers/firewire/fw-ohci.c
@@ -268,7 +268,7 @@ static int ar_context_add_page(struct ar_context *ctx)
268 268
269 dma_sync_single_for_device(dev, ab_bus, PAGE_SIZE, DMA_BIDIRECTIONAL); 269 dma_sync_single_for_device(dev, ab_bus, PAGE_SIZE, DMA_BIDIRECTIONAL);
270 270
271 ctx->last_buffer->descriptor.branch_address = ab_bus | 1; 271 ctx->last_buffer->descriptor.branch_address = cpu_to_le32(ab_bus | 1);
272 ctx->last_buffer->next = ab; 272 ctx->last_buffer->next = ab;
273 ctx->last_buffer = ab; 273 ctx->last_buffer = ab;
274 274
@@ -417,7 +417,8 @@ ar_context_init(struct ar_context *ctx, struct fw_ohci *ohci, u32 regs)
417 ctx->current_buffer = ab.next; 417 ctx->current_buffer = ab.next;
418 ctx->pointer = ctx->current_buffer->data; 418 ctx->pointer = ctx->current_buffer->data;
419 419
420 reg_write(ctx->ohci, COMMAND_PTR(ctx->regs), ab.descriptor.branch_address); 420 reg_write(ctx->ohci, COMMAND_PTR(ctx->regs),
421 le32_to_cpu(ab.descriptor.branch_address));
421 reg_write(ctx->ohci, CONTROL_SET(ctx->regs), CONTEXT_RUN); 422 reg_write(ctx->ohci, CONTROL_SET(ctx->regs), CONTEXT_RUN);
422 flush_writes(ctx->ohci); 423 flush_writes(ctx->ohci);
423 424
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 4d1cb5b855d1..13eea47dceb3 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -620,7 +620,7 @@ config SENSORS_HDAPS
620 620
621config SENSORS_APPLESMC 621config SENSORS_APPLESMC
622 tristate "Apple SMC (Motion sensor, light sensor, keyboard backlight)" 622 tristate "Apple SMC (Motion sensor, light sensor, keyboard backlight)"
623 depends on HWMON && INPUT && X86 623 depends on INPUT && X86
624 select NEW_LEDS 624 select NEW_LEDS
625 select LEDS_CLASS 625 select LEDS_CLASS
626 default n 626 default n
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index 366f4a1a2cb8..fd1281f42209 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -1206,11 +1206,13 @@ static int __init applesmc_init(void)
1206 } 1206 }
1207 1207
1208 ret = sysfs_create_file(&pdev->dev.kobj, &dev_attr_name.attr); 1208 ret = sysfs_create_file(&pdev->dev.kobj, &dev_attr_name.attr);
1209 if (ret)
1210 goto out_device;
1209 1211
1210 /* Create key enumeration sysfs files */ 1212 /* Create key enumeration sysfs files */
1211 ret = sysfs_create_group(&pdev->dev.kobj, &key_enumeration_group); 1213 ret = sysfs_create_group(&pdev->dev.kobj, &key_enumeration_group);
1212 if (ret) 1214 if (ret)
1213 goto out_device; 1215 goto out_name;
1214 1216
1215 /* create fan files */ 1217 /* create fan files */
1216 count = applesmc_get_fan_count(); 1218 count = applesmc_get_fan_count();
@@ -1310,6 +1312,8 @@ out_fan_1:
1310 sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[1]); 1312 sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[1]);
1311out_key_enumeration: 1313out_key_enumeration:
1312 sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group); 1314 sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group);
1315out_name:
1316 sysfs_remove_file(&pdev->dev.kobj, &dev_attr_name.attr);
1313out_device: 1317out_device:
1314 platform_device_unregister(pdev); 1318 platform_device_unregister(pdev);
1315out_driver: 1319out_driver:
@@ -1335,6 +1339,7 @@ static void __exit applesmc_exit(void)
1335 sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[0]); 1339 sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[0]);
1336 sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[1]); 1340 sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[1]);
1337 sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group); 1341 sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group);
1342 sysfs_remove_file(&pdev->dev.kobj, &dev_attr_name.attr);
1338 platform_device_unregister(pdev); 1343 platform_device_unregister(pdev);
1339 platform_driver_unregister(&applesmc_driver); 1344 platform_driver_unregister(&applesmc_driver);
1340 release_region(APPLESMC_DATA_PORT, APPLESMC_NR_PORTS); 1345 release_region(APPLESMC_DATA_PORT, APPLESMC_NR_PORTS);
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index 75e3911810a3..0328382df8fa 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -176,6 +176,22 @@ static int __devinit coretemp_probe(struct platform_device *pdev)
176 goto exit_free; 176 goto exit_free;
177 } 177 }
178 178
179 /* Check if we have problem with errata AE18 of Core processors:
180 Readings might stop update when processor visited too deep sleep,
181 fixed for stepping D0 (6EC).
182 */
183
184 if ((c->x86_model == 0xe) && (c->x86_mask < 0xc)) {
185 /* check for microcode update */
186 rdmsr_on_cpu(data->id, MSR_IA32_UCODE_REV, &eax, &edx);
187 if (edx < 0x39) {
188 dev_err(&pdev->dev,
189 "Errata AE18 not fixed, update BIOS or "
190 "microcode of the CPU!\n");
191 goto exit_free;
192 }
193 }
194
179 /* Some processors have Tjmax 85 following magic should detect it 195 /* Some processors have Tjmax 85 following magic should detect it
180 Intel won't disclose the information without signed NDA, but 196 Intel won't disclose the information without signed NDA, but
181 individuals cannot sign it. Catch(ed) 22. 197 individuals cannot sign it. Catch(ed) 22.
@@ -193,6 +209,19 @@ static int __devinit coretemp_probe(struct platform_device *pdev)
193 } 209 }
194 } 210 }
195 211
212 /* Intel says that above should not work for desktop Core2 processors,
213 but it seems to work. There is no other way how get the absolute
214 readings. Warn the user about this. First check if are desktop,
215 bit 50 of MSR_IA32_PLATFORM_ID should be 0.
216 */
217
218 rdmsr_safe_on_cpu(data->id, MSR_IA32_PLATFORM_ID, &eax, &edx);
219
220 if ((c->x86_model == 0xf) && (!(edx & 0x00040000))) {
221 dev_warn(&pdev->dev, "Using undocumented features, absolute "
222 "temperature might be wrong!\n");
223 }
224
196 platform_set_drvdata(pdev, data); 225 platform_set_drvdata(pdev, data);
197 226
198 if ((err = sysfs_create_group(&pdev->dev.kobj, &coretemp_group))) 227 if ((err = sysfs_create_group(&pdev->dev.kobj, &coretemp_group)))
@@ -330,9 +359,6 @@ static int __init coretemp_init(void)
330 int i, err = -ENODEV; 359 int i, err = -ENODEV;
331 struct pdev_entry *p, *n; 360 struct pdev_entry *p, *n;
332 361
333 printk(KERN_NOTICE DRVNAME ": This driver uses undocumented features "
334 "of Core CPU. Temperature might be wrong!\n");
335
336 /* quick check if we run Intel */ 362 /* quick check if we run Intel */
337 if (cpu_data[0].x86_vendor != X86_VENDOR_INTEL) 363 if (cpu_data[0].x86_vendor != X86_VENDOR_INTEL)
338 goto exit; 364 goto exit;
diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c
index c849c0c6ee9c..d5ac422d73b2 100644
--- a/drivers/hwmon/ds1621.c
+++ b/drivers/hwmon/ds1621.c
@@ -53,8 +53,8 @@ MODULE_PARM_DESC(polarity, "Output's polarity: 0 = active high, 1 = active low")
53 53
54/* The DS1621 registers */ 54/* The DS1621 registers */
55#define DS1621_REG_TEMP 0xAA /* word, RO */ 55#define DS1621_REG_TEMP 0xAA /* word, RO */
56#define DS1621_REG_TEMP_MIN 0xA1 /* word, RW */ 56#define DS1621_REG_TEMP_MIN 0xA2 /* word, RW */
57#define DS1621_REG_TEMP_MAX 0xA2 /* word, RW */ 57#define DS1621_REG_TEMP_MAX 0xA1 /* word, RW */
58#define DS1621_REG_CONF 0xAC /* byte, RW */ 58#define DS1621_REG_CONF 0xAC /* byte, RW */
59#define DS1621_COM_START 0xEE /* no data */ 59#define DS1621_COM_START 0xEE /* no data */
60#define DS1621_COM_STOP 0x22 /* no data */ 60#define DS1621_COM_STOP 0x22 /* no data */
@@ -328,9 +328,9 @@ static struct ds1621_data *ds1621_update_client(struct device *dev)
328 328
329 /* reset alarms if necessary */ 329 /* reset alarms if necessary */
330 new_conf = data->conf; 330 new_conf = data->conf;
331 if (data->temp < data->temp_min) 331 if (data->temp > data->temp_min)
332 new_conf &= ~DS1621_ALARM_TEMP_LOW; 332 new_conf &= ~DS1621_ALARM_TEMP_LOW;
333 if (data->temp > data->temp_max) 333 if (data->temp < data->temp_max)
334 new_conf &= ~DS1621_ALARM_TEMP_HIGH; 334 new_conf &= ~DS1621_ALARM_TEMP_HIGH;
335 if (data->conf != new_conf) 335 if (data->conf != new_conf)
336 ds1621_write_value(client, DS1621_REG_CONF, 336 ds1621_write_value(client, DS1621_REG_CONF,
diff --git a/drivers/hwmon/hwmon-vid.c b/drivers/hwmon/hwmon-vid.c
index 5aab23b93e24..f17e771e42f8 100644
--- a/drivers/hwmon/hwmon-vid.c
+++ b/drivers/hwmon/hwmon-vid.c
@@ -132,7 +132,9 @@ int vid_from_reg(int val, u8 vrm)
132 val &= 0x7f; 132 val &= 0x7f;
133 return(val > 0x77 ? 0 : (1500000 - (val * 12500) + 500) / 1000); 133 return(val > 0x77 ? 0 : (1500000 - (val * 12500) + 500) / 1000);
134 default: /* report 0 for unknown */ 134 default: /* report 0 for unknown */
135 printk(KERN_INFO "hwmon-vid: requested unknown VRM version\n"); 135 if (vrm)
136 printk(KERN_WARNING "hwmon-vid: Requested unsupported "
137 "VRM version (%u)\n", (unsigned int)vrm);
136 return 0; 138 return 0;
137 } 139 }
138} 140}
diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c
index a5b774b07cbd..12cb40a975de 100644
--- a/drivers/hwmon/w83627hf.c
+++ b/drivers/hwmon/w83627hf.c
@@ -965,8 +965,10 @@ static int __init w83627hf_find(int sioaddr, unsigned short *addr,
965 case W687THF_DEVID: 965 case W687THF_DEVID:
966 sio_data->type = w83687thf; 966 sio_data->type = w83687thf;
967 break; 967 break;
968 case 0xff: /* No device at all */
969 goto exit;
968 default: 970 default:
969 pr_debug(DRVNAME ": Unsupported chip (DEVID=0x%x)\n", val); 971 pr_debug(DRVNAME ": Unsupported chip (DEVID=0x%02x)\n", val);
970 goto exit; 972 goto exit;
971 } 973 }
972 974
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 8a0a99b93641..28e7b91a4553 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -837,20 +837,10 @@ static const struct i2c_algorithm i2c_pxa_algorithm = {
837 .functionality = i2c_pxa_functionality, 837 .functionality = i2c_pxa_functionality,
838}; 838};
839 839
840static struct pxa_i2c i2c_pxa = {
841 .lock = __SPIN_LOCK_UNLOCKED(i2c_pxa.lock),
842 .adap = {
843 .owner = THIS_MODULE,
844 .algo = &i2c_pxa_algorithm,
845 .name = "pxa2xx-i2c.0",
846 .retries = 5,
847 },
848};
849
850#define res_len(r) ((r)->end - (r)->start + 1) 840#define res_len(r) ((r)->end - (r)->start + 1)
851static int i2c_pxa_probe(struct platform_device *dev) 841static int i2c_pxa_probe(struct platform_device *dev)
852{ 842{
853 struct pxa_i2c *i2c = &i2c_pxa; 843 struct pxa_i2c *i2c;
854 struct resource *res; 844 struct resource *res;
855 struct i2c_pxa_platform_data *plat = dev->dev.platform_data; 845 struct i2c_pxa_platform_data *plat = dev->dev.platform_data;
856 int ret; 846 int ret;
@@ -864,15 +854,20 @@ static int i2c_pxa_probe(struct platform_device *dev)
864 if (!request_mem_region(res->start, res_len(res), res->name)) 854 if (!request_mem_region(res->start, res_len(res), res->name))
865 return -ENOMEM; 855 return -ENOMEM;
866 856
867 i2c = kmalloc(sizeof(struct pxa_i2c), GFP_KERNEL); 857 i2c = kzalloc(sizeof(struct pxa_i2c), GFP_KERNEL);
868 if (!i2c) { 858 if (!i2c) {
869 ret = -ENOMEM; 859 ret = -ENOMEM;
870 goto emalloc; 860 goto emalloc;
871 } 861 }
872 862
873 memcpy(i2c, &i2c_pxa, sizeof(struct pxa_i2c)); 863 i2c->adap.owner = THIS_MODULE;
864 i2c->adap.algo = &i2c_pxa_algorithm;
865 i2c->adap.retries = 5;
866
867 spin_lock_init(&i2c->lock);
874 init_waitqueue_head(&i2c->wait); 868 init_waitqueue_head(&i2c->wait);
875 i2c->adap.name[strlen(i2c->adap.name) - 1] = '0' + dev->id % 10; 869
870 sprintf(i2c->adap.name, "pxa_i2c-i2c.%u", dev->id);
876 871
877 i2c->reg_base = ioremap(res->start, res_len(res)); 872 i2c->reg_base = ioremap(res->start, res_len(res));
878 if (!i2c->reg_base) { 873 if (!i2c->reg_base) {
diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c
index 2296d43a2414..5f026b5d7857 100644
--- a/drivers/ieee1394/eth1394.c
+++ b/drivers/ieee1394/eth1394.c
@@ -47,6 +47,7 @@
47#include <linux/types.h> 47#include <linux/types.h>
48#include <linux/delay.h> 48#include <linux/delay.h>
49#include <linux/init.h> 49#include <linux/init.h>
50#include <linux/workqueue.h>
50 51
51#include <linux/netdevice.h> 52#include <linux/netdevice.h>
52#include <linux/inetdevice.h> 53#include <linux/inetdevice.h>
@@ -235,6 +236,9 @@ static int ether1394_open(struct net_device *dev)
235/* This is called after an "ifdown" */ 236/* This is called after an "ifdown" */
236static int ether1394_stop(struct net_device *dev) 237static int ether1394_stop(struct net_device *dev)
237{ 238{
239 /* flush priv->wake */
240 flush_scheduled_work();
241
238 netif_stop_queue(dev); 242 netif_stop_queue(dev);
239 return 0; 243 return 0;
240} 244}
@@ -531,6 +535,37 @@ static void ether1394_init_dev(struct net_device *dev)
531} 535}
532 536
533/* 537/*
538 * Wake the queue up after commonly encountered transmit failure conditions are
539 * hopefully over. Currently only tlabel exhaustion is accounted for.
540 */
541static void ether1394_wake_queue(struct work_struct *work)
542{
543 struct eth1394_priv *priv;
544 struct hpsb_packet *packet;
545
546 priv = container_of(work, struct eth1394_priv, wake);
547 packet = hpsb_alloc_packet(0);
548
549 /* This is really bad, but unjam the queue anyway. */
550 if (!packet)
551 goto out;
552
553 packet->host = priv->host;
554 packet->node_id = priv->wake_node;
555 /*
556 * A transaction label is all we really want. If we get one, it almost
557 * always means we can get a lot more because the ieee1394 core recycled
558 * a whole batch of tlabels, at last.
559 */
560 if (hpsb_get_tlabel(packet) == 0)
561 hpsb_free_tlabel(packet);
562
563 hpsb_free_packet(packet);
564out:
565 netif_wake_queue(priv->wake_dev);
566}
567
568/*
534 * This function is called every time a card is found. It is generally called 569 * This function is called every time a card is found. It is generally called
535 * when the module is installed. This is where we add all of our ethernet 570 * when the module is installed. This is where we add all of our ethernet
536 * devices. One for each host. 571 * devices. One for each host.
@@ -564,16 +599,17 @@ static void ether1394_add_host(struct hpsb_host *host)
564 } 599 }
565 600
566 SET_MODULE_OWNER(dev); 601 SET_MODULE_OWNER(dev);
567#if 0 602
568 /* FIXME - Is this the correct parent device anyway? */ 603 /* This used to be &host->device in Linux 2.6.20 and before. */
569 SET_NETDEV_DEV(dev, &host->device); 604 SET_NETDEV_DEV(dev, host->device.parent);
570#endif
571 605
572 priv = netdev_priv(dev); 606 priv = netdev_priv(dev);
573 INIT_LIST_HEAD(&priv->ip_node_list); 607 INIT_LIST_HEAD(&priv->ip_node_list);
574 spin_lock_init(&priv->lock); 608 spin_lock_init(&priv->lock);
575 priv->host = host; 609 priv->host = host;
576 priv->local_fifo = fifo_addr; 610 priv->local_fifo = fifo_addr;
611 INIT_WORK(&priv->wake, ether1394_wake_queue);
612 priv->wake_dev = dev;
577 613
578 hi = hpsb_create_hostinfo(&eth1394_highlevel, host, sizeof(*hi)); 614 hi = hpsb_create_hostinfo(&eth1394_highlevel, host, sizeof(*hi));
579 if (hi == NULL) { 615 if (hi == NULL) {
@@ -1390,22 +1426,17 @@ static int ether1394_prep_write_packet(struct hpsb_packet *p,
1390 u64 addr, void *data, int tx_len) 1426 u64 addr, void *data, int tx_len)
1391{ 1427{
1392 p->node_id = node; 1428 p->node_id = node;
1393 p->data = NULL;
1394 1429
1395 p->tcode = TCODE_WRITEB; 1430 if (hpsb_get_tlabel(p))
1396 p->header[1] = host->node_id << 16 | addr >> 32; 1431 return -EAGAIN;
1397 p->header[2] = addr & 0xffffffff;
1398 1432
1433 p->tcode = TCODE_WRITEB;
1399 p->header_size = 16; 1434 p->header_size = 16;
1400 p->expect_response = 1; 1435 p->expect_response = 1;
1401
1402 if (hpsb_get_tlabel(p)) {
1403 ETH1394_PRINT_G(KERN_ERR, "Out of tlabels\n");
1404 return -1;
1405 }
1406 p->header[0] = 1436 p->header[0] =
1407 p->node_id << 16 | p->tlabel << 10 | 1 << 8 | TCODE_WRITEB << 4; 1437 p->node_id << 16 | p->tlabel << 10 | 1 << 8 | TCODE_WRITEB << 4;
1408 1438 p->header[1] = host->node_id << 16 | addr >> 32;
1439 p->header[2] = addr & 0xffffffff;
1409 p->header[3] = tx_len << 16; 1440 p->header[3] = tx_len << 16;
1410 p->data_size = (tx_len + 3) & ~3; 1441 p->data_size = (tx_len + 3) & ~3;
1411 p->data = data; 1442 p->data = data;
@@ -1451,7 +1482,7 @@ static int ether1394_send_packet(struct packet_task *ptask, unsigned int tx_len)
1451 1482
1452 packet = ether1394_alloc_common_packet(priv->host); 1483 packet = ether1394_alloc_common_packet(priv->host);
1453 if (!packet) 1484 if (!packet)
1454 return -1; 1485 return -ENOMEM;
1455 1486
1456 if (ptask->tx_type == ETH1394_GASP) { 1487 if (ptask->tx_type == ETH1394_GASP) {
1457 int length = tx_len + 2 * sizeof(quadlet_t); 1488 int length = tx_len + 2 * sizeof(quadlet_t);
@@ -1462,7 +1493,7 @@ static int ether1394_send_packet(struct packet_task *ptask, unsigned int tx_len)
1462 ptask->addr, ptask->skb->data, 1493 ptask->addr, ptask->skb->data,
1463 tx_len)) { 1494 tx_len)) {
1464 hpsb_free_packet(packet); 1495 hpsb_free_packet(packet);
1465 return -1; 1496 return -EAGAIN;
1466 } 1497 }
1467 1498
1468 ptask->packet = packet; 1499 ptask->packet = packet;
@@ -1471,7 +1502,7 @@ static int ether1394_send_packet(struct packet_task *ptask, unsigned int tx_len)
1471 1502
1472 if (hpsb_send_packet(packet) < 0) { 1503 if (hpsb_send_packet(packet) < 0) {
1473 ether1394_free_packet(packet); 1504 ether1394_free_packet(packet);
1474 return -1; 1505 return -EIO;
1475 } 1506 }
1476 1507
1477 return 0; 1508 return 0;
@@ -1514,13 +1545,18 @@ static void ether1394_complete_cb(void *__ptask)
1514 1545
1515 ptask->outstanding_pkts--; 1546 ptask->outstanding_pkts--;
1516 if (ptask->outstanding_pkts > 0 && !fail) { 1547 if (ptask->outstanding_pkts > 0 && !fail) {
1517 int tx_len; 1548 int tx_len, err;
1518 1549
1519 /* Add the encapsulation header to the fragment */ 1550 /* Add the encapsulation header to the fragment */
1520 tx_len = ether1394_encapsulate(ptask->skb, ptask->max_payload, 1551 tx_len = ether1394_encapsulate(ptask->skb, ptask->max_payload,
1521 &ptask->hdr); 1552 &ptask->hdr);
1522 if (ether1394_send_packet(ptask, tx_len)) 1553 err = ether1394_send_packet(ptask, tx_len);
1554 if (err) {
1555 if (err == -EAGAIN)
1556 ETH1394_PRINT_G(KERN_ERR, "Out of tlabels\n");
1557
1523 ether1394_dg_complete(ptask, 1); 1558 ether1394_dg_complete(ptask, 1);
1559 }
1524 } else { 1560 } else {
1525 ether1394_dg_complete(ptask, fail); 1561 ether1394_dg_complete(ptask, fail);
1526 } 1562 }
@@ -1633,10 +1669,18 @@ static int ether1394_tx(struct sk_buff *skb, struct net_device *dev)
1633 /* Add the encapsulation header to the fragment */ 1669 /* Add the encapsulation header to the fragment */
1634 tx_len = ether1394_encapsulate(skb, max_payload, &ptask->hdr); 1670 tx_len = ether1394_encapsulate(skb, max_payload, &ptask->hdr);
1635 dev->trans_start = jiffies; 1671 dev->trans_start = jiffies;
1636 if (ether1394_send_packet(ptask, tx_len)) 1672 if (ether1394_send_packet(ptask, tx_len)) {
1637 goto fail; 1673 if (dest_node == (LOCAL_BUS | ALL_NODES))
1674 goto fail;
1675
1676 /* Most failures of ether1394_send_packet are recoverable. */
1677 netif_stop_queue(dev);
1678 priv->wake_node = dest_node;
1679 schedule_work(&priv->wake);
1680 kmem_cache_free(packet_task_cache, ptask);
1681 return NETDEV_TX_BUSY;
1682 }
1638 1683
1639 netif_wake_queue(dev);
1640 return NETDEV_TX_OK; 1684 return NETDEV_TX_OK;
1641fail: 1685fail:
1642 if (ptask) 1686 if (ptask)
@@ -1650,9 +1694,6 @@ fail:
1650 priv->stats.tx_errors++; 1694 priv->stats.tx_errors++;
1651 spin_unlock_irqrestore(&priv->lock, flags); 1695 spin_unlock_irqrestore(&priv->lock, flags);
1652 1696
1653 if (netif_queue_stopped(dev))
1654 netif_wake_queue(dev);
1655
1656 /* 1697 /*
1657 * FIXME: According to a patch from 2003-02-26, "returning non-zero 1698 * FIXME: According to a patch from 2003-02-26, "returning non-zero
1658 * causes serious problems" here, allegedly. Before that patch, 1699 * causes serious problems" here, allegedly. Before that patch,
diff --git a/drivers/ieee1394/eth1394.h b/drivers/ieee1394/eth1394.h
index a3439ee7cb4e..4f3e2dd46f00 100644
--- a/drivers/ieee1394/eth1394.h
+++ b/drivers/ieee1394/eth1394.h
@@ -66,6 +66,10 @@ struct eth1394_priv {
66 int bc_dgl; /* Outgoing broadcast datagram label */ 66 int bc_dgl; /* Outgoing broadcast datagram label */
67 struct list_head ip_node_list; /* List of IP capable nodes */ 67 struct list_head ip_node_list; /* List of IP capable nodes */
68 struct unit_directory *ud_list[ALL_NODES]; /* Cached unit dir list */ 68 struct unit_directory *ud_list[ALL_NODES]; /* Cached unit dir list */
69
70 struct work_struct wake; /* Wake up after xmit failure */
71 struct net_device *wake_dev; /* Stupid backlink for .wake */
72 nodeid_t wake_node; /* Destination of failed xmit */
69}; 73};
70 74
71 75
diff --git a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c
index d382500f4210..f1d05eeb9f51 100644
--- a/drivers/ieee1394/raw1394.c
+++ b/drivers/ieee1394/raw1394.c
@@ -936,6 +936,7 @@ static int handle_async_send(struct file_info *fi, struct pending_request *req)
936 struct hpsb_packet *packet; 936 struct hpsb_packet *packet;
937 int header_length = req->req.misc & 0xffff; 937 int header_length = req->req.misc & 0xffff;
938 int expect_response = req->req.misc >> 16; 938 int expect_response = req->req.misc >> 16;
939 size_t data_size;
939 940
940 if (header_length > req->req.length || header_length < 12 || 941 if (header_length > req->req.length || header_length < 12 ||
941 header_length > FIELD_SIZEOF(struct hpsb_packet, header)) { 942 header_length > FIELD_SIZEOF(struct hpsb_packet, header)) {
@@ -945,7 +946,8 @@ static int handle_async_send(struct file_info *fi, struct pending_request *req)
945 return sizeof(struct raw1394_request); 946 return sizeof(struct raw1394_request);
946 } 947 }
947 948
948 packet = hpsb_alloc_packet(req->req.length - header_length); 949 data_size = req->req.length - header_length;
950 packet = hpsb_alloc_packet(data_size);
949 req->packet = packet; 951 req->packet = packet;
950 if (!packet) 952 if (!packet)
951 return -ENOMEM; 953 return -ENOMEM;
@@ -960,7 +962,7 @@ static int handle_async_send(struct file_info *fi, struct pending_request *req)
960 962
961 if (copy_from_user 963 if (copy_from_user
962 (packet->data, int2ptr(req->req.sendb) + header_length, 964 (packet->data, int2ptr(req->req.sendb) + header_length,
963 packet->data_size)) { 965 data_size)) {
964 req->req.error = RAW1394_ERROR_MEMFAULT; 966 req->req.error = RAW1394_ERROR_MEMFAULT;
965 req->req.length = 0; 967 req->req.length = 0;
966 queue_complete_req(req); 968 queue_complete_req(req);
@@ -974,7 +976,7 @@ static int handle_async_send(struct file_info *fi, struct pending_request *req)
974 packet->host = fi->host; 976 packet->host = fi->host;
975 packet->expect_response = expect_response; 977 packet->expect_response = expect_response;
976 packet->header_size = header_length; 978 packet->header_size = header_length;
977 packet->data_size = req->req.length - header_length; 979 packet->data_size = data_size;
978 980
979 req->req.length = 0; 981 req->req.length = 0;
980 hpsb_set_packet_complete_task(packet, 982 hpsb_set_packet_complete_task(packet,
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index 4cb6fa2bcfb7..875eadd5e8f5 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -70,6 +70,7 @@
70#include <linux/stringify.h> 70#include <linux/stringify.h>
71#include <linux/types.h> 71#include <linux/types.h>
72#include <linux/wait.h> 72#include <linux/wait.h>
73#include <linux/workqueue.h>
73 74
74#include <asm/byteorder.h> 75#include <asm/byteorder.h>
75#include <asm/errno.h> 76#include <asm/errno.h>
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index e840434a96d8..40c004a2697e 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -1297,26 +1297,29 @@ static struct cm_id_private * cm_match_req(struct cm_work *work,
1297 1297
1298 req_msg = (struct cm_req_msg *)work->mad_recv_wc->recv_buf.mad; 1298 req_msg = (struct cm_req_msg *)work->mad_recv_wc->recv_buf.mad;
1299 1299
1300 /* Check for duplicate REQ and stale connections. */ 1300 /* Check for possible duplicate REQ. */
1301 spin_lock_irqsave(&cm.lock, flags); 1301 spin_lock_irqsave(&cm.lock, flags);
1302 timewait_info = cm_insert_remote_id(cm_id_priv->timewait_info); 1302 timewait_info = cm_insert_remote_id(cm_id_priv->timewait_info);
1303 if (!timewait_info)
1304 timewait_info = cm_insert_remote_qpn(cm_id_priv->timewait_info);
1305
1306 if (timewait_info) { 1303 if (timewait_info) {
1307 cur_cm_id_priv = cm_get_id(timewait_info->work.local_id, 1304 cur_cm_id_priv = cm_get_id(timewait_info->work.local_id,
1308 timewait_info->work.remote_id); 1305 timewait_info->work.remote_id);
1309 cm_cleanup_timewait(cm_id_priv->timewait_info);
1310 spin_unlock_irqrestore(&cm.lock, flags); 1306 spin_unlock_irqrestore(&cm.lock, flags);
1311 if (cur_cm_id_priv) { 1307 if (cur_cm_id_priv) {
1312 cm_dup_req_handler(work, cur_cm_id_priv); 1308 cm_dup_req_handler(work, cur_cm_id_priv);
1313 cm_deref_id(cur_cm_id_priv); 1309 cm_deref_id(cur_cm_id_priv);
1314 } else 1310 }
1315 cm_issue_rej(work->port, work->mad_recv_wc, 1311 return NULL;
1316 IB_CM_REJ_STALE_CONN, CM_MSG_RESPONSE_REQ, 1312 }
1317 NULL, 0); 1313
1318 listen_cm_id_priv = NULL; 1314 /* Check for stale connections. */
1319 goto out; 1315 timewait_info = cm_insert_remote_qpn(cm_id_priv->timewait_info);
1316 if (timewait_info) {
1317 cm_cleanup_timewait(cm_id_priv->timewait_info);
1318 spin_unlock_irqrestore(&cm.lock, flags);
1319 cm_issue_rej(work->port, work->mad_recv_wc,
1320 IB_CM_REJ_STALE_CONN, CM_MSG_RESPONSE_REQ,
1321 NULL, 0);
1322 return NULL;
1320 } 1323 }
1321 1324
1322 /* Find matching listen request. */ 1325 /* Find matching listen request. */
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c
index 027664979fe2..eef415b12b2e 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -2284,10 +2284,10 @@ void mthca_free_err_wqe(struct mthca_dev *dev, struct mthca_qp *qp, int is_send,
2284 struct mthca_next_seg *next; 2284 struct mthca_next_seg *next;
2285 2285
2286 /* 2286 /*
2287 * For SRQs, all WQEs generate a CQE, so we're always at the 2287 * For SRQs, all receive WQEs generate a CQE, so we're always
2288 * end of the doorbell chain. 2288 * at the end of the doorbell chain.
2289 */ 2289 */
2290 if (qp->ibqp.srq) { 2290 if (qp->ibqp.srq && !is_send) {
2291 *new_wqe = 0; 2291 *new_wqe = 0;
2292 return; 2292 return;
2293 } 2293 }
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
index 158759e28a5b..285c143115cc 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib.h
+++ b/drivers/infiniband/ulp/ipoib/ipoib.h
@@ -156,7 +156,7 @@ struct ipoib_cm_data {
156 * - and then invoke a Destroy QP or Reset QP. 156 * - and then invoke a Destroy QP or Reset QP.
157 * 157 *
158 * We use the second option and wait for a completion on the 158 * We use the second option and wait for a completion on the
159 * rx_drain_qp before destroying QPs attached to our SRQ. 159 * same CQ before destroying QPs attached to our SRQ.
160 */ 160 */
161 161
162enum ipoib_cm_state { 162enum ipoib_cm_state {
@@ -199,7 +199,6 @@ struct ipoib_cm_dev_priv {
199 struct ib_srq *srq; 199 struct ib_srq *srq;
200 struct ipoib_cm_rx_buf *srq_ring; 200 struct ipoib_cm_rx_buf *srq_ring;
201 struct ib_cm_id *id; 201 struct ib_cm_id *id;
202 struct ib_qp *rx_drain_qp; /* generates WR described in 10.3.1 */
203 struct list_head passive_ids; /* state: LIVE */ 202 struct list_head passive_ids; /* state: LIVE */
204 struct list_head rx_error_list; /* state: ERROR */ 203 struct list_head rx_error_list; /* state: ERROR */
205 struct list_head rx_flush_list; /* state: FLUSH, drain not started */ 204 struct list_head rx_flush_list; /* state: FLUSH, drain not started */
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index f133b56fd978..076a0bbb63d7 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -69,8 +69,9 @@ static struct ib_qp_attr ipoib_cm_err_attr = {
69 69
70#define IPOIB_CM_RX_DRAIN_WRID 0x7fffffff 70#define IPOIB_CM_RX_DRAIN_WRID 0x7fffffff
71 71
72static struct ib_recv_wr ipoib_cm_rx_drain_wr = { 72static struct ib_send_wr ipoib_cm_rx_drain_wr = {
73 .wr_id = IPOIB_CM_RX_DRAIN_WRID 73 .wr_id = IPOIB_CM_RX_DRAIN_WRID,
74 .opcode = IB_WR_SEND,
74}; 75};
75 76
76static int ipoib_cm_tx_handler(struct ib_cm_id *cm_id, 77static int ipoib_cm_tx_handler(struct ib_cm_id *cm_id,
@@ -163,16 +164,22 @@ partial_error:
163 164
164static void ipoib_cm_start_rx_drain(struct ipoib_dev_priv* priv) 165static void ipoib_cm_start_rx_drain(struct ipoib_dev_priv* priv)
165{ 166{
166 struct ib_recv_wr *bad_wr; 167 struct ib_send_wr *bad_wr;
168 struct ipoib_cm_rx *p;
167 169
168 /* rx_drain_qp send queue depth is 1, so 170 /* We only reserved 1 extra slot in CQ for drain WRs, so
169 * make sure we have at most 1 outstanding WR. */ 171 * make sure we have at most 1 outstanding WR. */
170 if (list_empty(&priv->cm.rx_flush_list) || 172 if (list_empty(&priv->cm.rx_flush_list) ||
171 !list_empty(&priv->cm.rx_drain_list)) 173 !list_empty(&priv->cm.rx_drain_list))
172 return; 174 return;
173 175
174 if (ib_post_recv(priv->cm.rx_drain_qp, &ipoib_cm_rx_drain_wr, &bad_wr)) 176 /*
175 ipoib_warn(priv, "failed to post rx_drain wr\n"); 177 * QPs on flush list are error state. This way, a "flush
178 * error" WC will be immediately generated for each WR we post.
179 */
180 p = list_entry(priv->cm.rx_flush_list.next, typeof(*p), list);
181 if (ib_post_send(p->qp, &ipoib_cm_rx_drain_wr, &bad_wr))
182 ipoib_warn(priv, "failed to post drain wr\n");
176 183
177 list_splice_init(&priv->cm.rx_flush_list, &priv->cm.rx_drain_list); 184 list_splice_init(&priv->cm.rx_flush_list, &priv->cm.rx_drain_list);
178} 185}
@@ -199,10 +206,10 @@ static struct ib_qp *ipoib_cm_create_rx_qp(struct net_device *dev,
199 struct ipoib_dev_priv *priv = netdev_priv(dev); 206 struct ipoib_dev_priv *priv = netdev_priv(dev);
200 struct ib_qp_init_attr attr = { 207 struct ib_qp_init_attr attr = {
201 .event_handler = ipoib_cm_rx_event_handler, 208 .event_handler = ipoib_cm_rx_event_handler,
202 .send_cq = priv->cq, /* does not matter, we never send anything */ 209 .send_cq = priv->cq, /* For drain WR */
203 .recv_cq = priv->cq, 210 .recv_cq = priv->cq,
204 .srq = priv->cm.srq, 211 .srq = priv->cm.srq,
205 .cap.max_send_wr = 1, /* FIXME: 0 Seems not to work */ 212 .cap.max_send_wr = 1, /* For drain WR */
206 .cap.max_send_sge = 1, /* FIXME: 0 Seems not to work */ 213 .cap.max_send_sge = 1, /* FIXME: 0 Seems not to work */
207 .sq_sig_type = IB_SIGNAL_ALL_WR, 214 .sq_sig_type = IB_SIGNAL_ALL_WR,
208 .qp_type = IB_QPT_RC, 215 .qp_type = IB_QPT_RC,
@@ -242,6 +249,27 @@ static int ipoib_cm_modify_rx_qp(struct net_device *dev,
242 ipoib_warn(priv, "failed to modify QP to RTR: %d\n", ret); 249 ipoib_warn(priv, "failed to modify QP to RTR: %d\n", ret);
243 return ret; 250 return ret;
244 } 251 }
252
253 /*
254 * Current Mellanox HCA firmware won't generate completions
255 * with error for drain WRs unless the QP has been moved to
256 * RTS first. This work-around leaves a window where a QP has
257 * moved to error asynchronously, but this will eventually get
258 * fixed in firmware, so let's not error out if modify QP
259 * fails.
260 */
261 qp_attr.qp_state = IB_QPS_RTS;
262 ret = ib_cm_init_qp_attr(cm_id, &qp_attr, &qp_attr_mask);
263 if (ret) {
264 ipoib_warn(priv, "failed to init QP attr for RTS: %d\n", ret);
265 return 0;
266 }
267 ret = ib_modify_qp(qp, &qp_attr, qp_attr_mask);
268 if (ret) {
269 ipoib_warn(priv, "failed to modify QP to RTS: %d\n", ret);
270 return 0;
271 }
272
245 return 0; 273 return 0;
246} 274}
247 275
@@ -623,38 +651,11 @@ static void ipoib_cm_tx_completion(struct ib_cq *cq, void *tx_ptr)
623int ipoib_cm_dev_open(struct net_device *dev) 651int ipoib_cm_dev_open(struct net_device *dev)
624{ 652{
625 struct ipoib_dev_priv *priv = netdev_priv(dev); 653 struct ipoib_dev_priv *priv = netdev_priv(dev);
626 struct ib_qp_init_attr qp_init_attr = {
627 .send_cq = priv->cq, /* does not matter, we never send anything */
628 .recv_cq = priv->cq,
629 .cap.max_send_wr = 1, /* FIXME: 0 Seems not to work */
630 .cap.max_send_sge = 1, /* FIXME: 0 Seems not to work */
631 .cap.max_recv_wr = 1,
632 .cap.max_recv_sge = 1, /* FIXME: 0 Seems not to work */
633 .sq_sig_type = IB_SIGNAL_ALL_WR,
634 .qp_type = IB_QPT_UC,
635 };
636 int ret; 654 int ret;
637 655
638 if (!IPOIB_CM_SUPPORTED(dev->dev_addr)) 656 if (!IPOIB_CM_SUPPORTED(dev->dev_addr))
639 return 0; 657 return 0;
640 658
641 priv->cm.rx_drain_qp = ib_create_qp(priv->pd, &qp_init_attr);
642 if (IS_ERR(priv->cm.rx_drain_qp)) {
643 printk(KERN_WARNING "%s: failed to create CM ID\n", priv->ca->name);
644 ret = PTR_ERR(priv->cm.rx_drain_qp);
645 return ret;
646 }
647
648 /*
649 * We put the QP in error state directly. This way, a "flush
650 * error" WC will be immediately generated for each WR we post.
651 */
652 ret = ib_modify_qp(priv->cm.rx_drain_qp, &ipoib_cm_err_attr, IB_QP_STATE);
653 if (ret) {
654 ipoib_warn(priv, "failed to modify drain QP to error: %d\n", ret);
655 goto err_qp;
656 }
657
658 priv->cm.id = ib_create_cm_id(priv->ca, ipoib_cm_rx_handler, dev); 659 priv->cm.id = ib_create_cm_id(priv->ca, ipoib_cm_rx_handler, dev);
659 if (IS_ERR(priv->cm.id)) { 660 if (IS_ERR(priv->cm.id)) {
660 printk(KERN_WARNING "%s: failed to create CM ID\n", priv->ca->name); 661 printk(KERN_WARNING "%s: failed to create CM ID\n", priv->ca->name);
@@ -676,8 +677,6 @@ err_listen:
676 ib_destroy_cm_id(priv->cm.id); 677 ib_destroy_cm_id(priv->cm.id);
677err_cm: 678err_cm:
678 priv->cm.id = NULL; 679 priv->cm.id = NULL;
679err_qp:
680 ib_destroy_qp(priv->cm.rx_drain_qp);
681 return ret; 680 return ret;
682} 681}
683 682
@@ -740,7 +739,6 @@ void ipoib_cm_dev_stop(struct net_device *dev)
740 kfree(p); 739 kfree(p);
741 } 740 }
742 741
743 ib_destroy_qp(priv->cm.rx_drain_qp);
744 cancel_delayed_work(&priv->cm.stale_task); 742 cancel_delayed_work(&priv->cm.stale_task);
745} 743}
746 744
diff --git a/drivers/input/serio/sa1111ps2.c b/drivers/input/serio/sa1111ps2.c
index 559508795af1..d31ece8f68e9 100644
--- a/drivers/input/serio/sa1111ps2.c
+++ b/drivers/input/serio/sa1111ps2.c
@@ -170,7 +170,7 @@ static void ps2_close(struct serio *io)
170/* 170/*
171 * Clear the input buffer. 171 * Clear the input buffer.
172 */ 172 */
173static void __init ps2_clear_input(struct ps2if *ps2if) 173static void __devinit ps2_clear_input(struct ps2if *ps2if)
174{ 174{
175 int maxread = 100; 175 int maxread = 100;
176 176
@@ -228,7 +228,7 @@ static int __init ps2_test(struct ps2if *ps2if)
228/* 228/*
229 * Add one device to this driver. 229 * Add one device to this driver.
230 */ 230 */
231static int ps2_probe(struct sa1111_dev *dev) 231static int __devinit ps2_probe(struct sa1111_dev *dev)
232{ 232{
233 struct ps2if *ps2if; 233 struct ps2if *ps2if;
234 struct serio *serio; 234 struct serio *serio;
diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig
index 58926da0ae18..f44c94abd883 100644
--- a/drivers/macintosh/Kconfig
+++ b/drivers/macintosh/Kconfig
@@ -113,7 +113,6 @@ config PMAC_SMU
113 113
114config PMAC_APM_EMU 114config PMAC_APM_EMU
115 tristate "APM emulation" 115 tristate "APM emulation"
116 select SYS_SUPPORTS_APM_EMULATION
117 select APM_EMULATION 116 select APM_EMULATION
118 depends on ADB_PMU && PM 117 depends on ADB_PMU && PM
119 118
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index d25d3be8fcd2..165f81d16d00 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -436,7 +436,7 @@ typedef struct _MPT_SAS_MGMT {
436typedef struct _mpt_ioctl_events { 436typedef struct _mpt_ioctl_events {
437 u32 event; /* Specified by define above */ 437 u32 event; /* Specified by define above */
438 u32 eventContext; /* Index or counter */ 438 u32 eventContext; /* Index or counter */
439 int data[2]; /* First 8 bytes of Event Data */ 439 u32 data[2]; /* First 8 bytes of Event Data */
440} MPT_IOCTL_EVENTS; 440} MPT_IOCTL_EVENTS;
441 441
442/* 442/*
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index fa0f7761652a..3bd94f11e7d6 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -2463,11 +2463,11 @@ mptscsih_copy_sense_data(struct scsi_cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR
2463 ioc->events[idx].event = MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE; 2463 ioc->events[idx].event = MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE;
2464 ioc->events[idx].eventContext = ioc->eventContext; 2464 ioc->events[idx].eventContext = ioc->eventContext;
2465 2465
2466 ioc->events[idx].data[0] = (pReq->LUN[1] << 24) || 2466 ioc->events[idx].data[0] = (pReq->LUN[1] << 24) |
2467 (MPI_EVENT_SCSI_DEV_STAT_RC_SMART_DATA << 16) || 2467 (MPI_EVENT_SCSI_DEV_STAT_RC_SMART_DATA << 16) |
2468 (sc->device->channel << 8) || sc->device->id; 2468 (sc->device->channel << 8) | sc->device->id;
2469 2469
2470 ioc->events[idx].data[1] = (sense_data[13] << 8) || sense_data[12]; 2470 ioc->events[idx].data[1] = (sense_data[13] << 8) | sense_data[12];
2471 2471
2472 ioc->eventContext++; 2472 ioc->eventContext++;
2473 if (hd->ioc->pcidev->vendor == 2473 if (hd->ioc->pcidev->vendor ==
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 30fd479fea5e..1798a9f9fb25 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2280,7 +2280,6 @@ config GFAR_NAPI
2280config UCC_GETH 2280config UCC_GETH
2281 tristate "Freescale QE Gigabit Ethernet" 2281 tristate "Freescale QE Gigabit Ethernet"
2282 depends on QUICC_ENGINE 2282 depends on QUICC_ENGINE
2283 select UCC_FAST
2284 help 2283 help
2285 This driver supports the Gigabit Ethernet mode of the QUICC Engine, 2284 This driver supports the Gigabit Ethernet mode of the QUICC Engine,
2286 which is available on some Freescale SOCs. 2285 which is available on some Freescale SOCs.
diff --git a/drivers/net/defxx.c b/drivers/net/defxx.c
index 571d82f8008c..7df23dc28190 100644
--- a/drivers/net/defxx.c
+++ b/drivers/net/defxx.c
@@ -566,6 +566,7 @@ static int __devinit dfx_register(struct device *bdev)
566 bp->base.mem = ioremap_nocache(bar_start, bar_len); 566 bp->base.mem = ioremap_nocache(bar_start, bar_len);
567 if (!bp->base.mem) { 567 if (!bp->base.mem) {
568 printk(KERN_ERR "%s: Cannot map MMIO\n", print_name); 568 printk(KERN_ERR "%s: Cannot map MMIO\n", print_name);
569 err = -ENOMEM;
569 goto err_out_region; 570 goto err_out_region;
570 } 571 }
571 } else { 572 } else {
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index cbc7febe9cdc..9ec35b7a8207 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -1325,7 +1325,10 @@ e1000_sw_init(struct e1000_adapter *adapter)
1325 spin_lock_init(&adapter->tx_queue_lock); 1325 spin_lock_init(&adapter->tx_queue_lock);
1326#endif 1326#endif
1327 1327
1328 atomic_set(&adapter->irq_sem, 1); 1328 /* Explicitly disable IRQ since the NIC can be in any state. */
1329 atomic_set(&adapter->irq_sem, 0);
1330 e1000_irq_disable(adapter);
1331
1329 spin_lock_init(&adapter->stats_lock); 1332 spin_lock_init(&adapter->stats_lock);
1330 1333
1331 set_bit(__E1000_DOWN, &adapter->flags); 1334 set_bit(__E1000_DOWN, &adapter->flags);
@@ -1431,6 +1434,10 @@ e1000_open(struct net_device *netdev)
1431 /* From here on the code is the same as e1000_up() */ 1434 /* From here on the code is the same as e1000_up() */
1432 clear_bit(__E1000_DOWN, &adapter->flags); 1435 clear_bit(__E1000_DOWN, &adapter->flags);
1433 1436
1437#ifdef CONFIG_E1000_NAPI
1438 netif_poll_enable(netdev);
1439#endif
1440
1434 e1000_irq_enable(adapter); 1441 e1000_irq_enable(adapter);
1435 1442
1436 /* fire a link status change interrupt to start the watchdog */ 1443 /* fire a link status change interrupt to start the watchdog */
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index 602872dbe15f..e85a933a4762 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -39,7 +39,7 @@
39#include <asm/io.h> 39#include <asm/io.h>
40 40
41#define DRV_NAME "ehea" 41#define DRV_NAME "ehea"
42#define DRV_VERSION "EHEA_0058" 42#define DRV_VERSION "EHEA_0061"
43 43
44#define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \ 44#define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \
45 | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR) 45 | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR)
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index f6e0cb1ada1f..152bb2016a2c 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -428,7 +428,7 @@ static struct ehea_cqe *ehea_proc_rwqes(struct net_device *dev,
428 } 428 }
429 skb_copy_to_linear_data(skb, ((char*)cqe) + 64, 429 skb_copy_to_linear_data(skb, ((char*)cqe) + 64,
430 cqe->num_bytes_transfered - 4); 430 cqe->num_bytes_transfered - 4);
431 ehea_fill_skb(dev, skb, cqe); 431 ehea_fill_skb(port->netdev, skb, cqe);
432 } else if (rq == 2) { /* RQ2 */ 432 } else if (rq == 2) { /* RQ2 */
433 skb = get_skb_by_index(skb_arr_rq2, 433 skb = get_skb_by_index(skb_arr_rq2,
434 skb_arr_rq2_len, cqe); 434 skb_arr_rq2_len, cqe);
diff --git a/drivers/net/mlx4/alloc.c b/drivers/net/mlx4/alloc.c
index dfbd5809d744..f8d63d39f592 100644
--- a/drivers/net/mlx4/alloc.c
+++ b/drivers/net/mlx4/alloc.c
@@ -51,8 +51,8 @@ u32 mlx4_bitmap_alloc(struct mlx4_bitmap *bitmap)
51 51
52 if (obj < bitmap->max) { 52 if (obj < bitmap->max) {
53 set_bit(obj, bitmap->table); 53 set_bit(obj, bitmap->table);
54 bitmap->last = (obj + 1) & (bitmap->max - 1);
54 obj |= bitmap->top; 55 obj |= bitmap->top;
55 bitmap->last = obj + 1;
56 } else 56 } else
57 obj = -1; 57 obj = -1;
58 58
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 832fd69a0e59..adfbe81693a6 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -364,7 +364,7 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
364 /* for SFP-module set SIGDET polarity to low */ 364 /* for SFP-module set SIGDET polarity to low */
365 ctrl = gm_phy_read(hw, port, PHY_MARV_PHY_CTRL); 365 ctrl = gm_phy_read(hw, port, PHY_MARV_PHY_CTRL);
366 ctrl |= PHY_M_FIB_SIGD_POL; 366 ctrl |= PHY_M_FIB_SIGD_POL;
367 gm_phy_write(hw, port, PHY_MARV_CTRL, ctrl); 367 gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, ctrl);
368 } 368 }
369 369
370 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg); 370 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg);
@@ -658,7 +658,7 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port)
658 const u8 *addr = hw->dev[port]->dev_addr; 658 const u8 *addr = hw->dev[port]->dev_addr;
659 659
660 sky2_write32(hw, SK_REG(port, GPHY_CTRL), GPC_RST_SET); 660 sky2_write32(hw, SK_REG(port, GPHY_CTRL), GPC_RST_SET);
661 sky2_write32(hw, SK_REG(port, GPHY_CTRL), GPC_RST_CLR|GPC_ENA_PAUSE); 661 sky2_write32(hw, SK_REG(port, GPHY_CTRL), GPC_RST_CLR);
662 662
663 sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_RST_CLR); 663 sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_RST_CLR);
664 664
@@ -1432,7 +1432,7 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
1432 tcpsum = offset << 16; /* sum start */ 1432 tcpsum = offset << 16; /* sum start */
1433 tcpsum |= offset + skb->csum_offset; /* sum write */ 1433 tcpsum |= offset + skb->csum_offset; /* sum write */
1434 1434
1435 ctrl = CALSUM | WR_SUM | INIT_SUM | LOCK_SUM; 1435 ctrl |= CALSUM | WR_SUM | INIT_SUM | LOCK_SUM;
1436 if (ip_hdr(skb)->protocol == IPPROTO_UDP) 1436 if (ip_hdr(skb)->protocol == IPPROTO_UDP)
1437 ctrl |= UDPTCP; 1437 ctrl |= UDPTCP;
1438 1438
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h
index 5efb5afc45ba..b8c4a3b5eadf 100644
--- a/drivers/net/sky2.h
+++ b/drivers/net/sky2.h
@@ -1149,7 +1149,7 @@ enum {
1149 PHY_M_IS_JABBER = 1<<0, /* Jabber */ 1149 PHY_M_IS_JABBER = 1<<0, /* Jabber */
1150 1150
1151 PHY_M_DEF_MSK = PHY_M_IS_LSP_CHANGE | PHY_M_IS_LST_CHANGE 1151 PHY_M_DEF_MSK = PHY_M_IS_LSP_CHANGE | PHY_M_IS_LST_CHANGE
1152 | PHY_M_IS_FIFO_ERROR, 1152 | PHY_M_IS_DUP_CHANGE,
1153 PHY_M_AN_MSK = PHY_M_IS_AN_ERROR | PHY_M_IS_AN_COMPL, 1153 PHY_M_AN_MSK = PHY_M_IS_AN_ERROR | PHY_M_IS_AN_COMPL,
1154}; 1154};
1155 1155
@@ -1732,28 +1732,6 @@ enum {
1732 1732
1733/* GPHY_CTRL 32 bit GPHY Control Reg (YUKON only) */ 1733/* GPHY_CTRL 32 bit GPHY Control Reg (YUKON only) */
1734enum { 1734enum {
1735 GPC_SEL_BDT = 1<<28, /* Select Bi-Dir. Transfer for MDC/MDIO */
1736 GPC_INT_POL_HI = 1<<27, /* IRQ Polarity is Active HIGH */
1737 GPC_75_OHM = 1<<26, /* Use 75 Ohm Termination instead of 50 */
1738 GPC_DIS_FC = 1<<25, /* Disable Automatic Fiber/Copper Detection */
1739 GPC_DIS_SLEEP = 1<<24, /* Disable Energy Detect */
1740 GPC_HWCFG_M_3 = 1<<23, /* HWCFG_MODE[3] */
1741 GPC_HWCFG_M_2 = 1<<22, /* HWCFG_MODE[2] */
1742 GPC_HWCFG_M_1 = 1<<21, /* HWCFG_MODE[1] */
1743 GPC_HWCFG_M_0 = 1<<20, /* HWCFG_MODE[0] */
1744 GPC_ANEG_0 = 1<<19, /* ANEG[0] */
1745 GPC_ENA_XC = 1<<18, /* Enable MDI crossover */
1746 GPC_DIS_125 = 1<<17, /* Disable 125 MHz clock */
1747 GPC_ANEG_3 = 1<<16, /* ANEG[3] */
1748 GPC_ANEG_2 = 1<<15, /* ANEG[2] */
1749 GPC_ANEG_1 = 1<<14, /* ANEG[1] */
1750 GPC_ENA_PAUSE = 1<<13, /* Enable Pause (SYM_OR_REM) */
1751 GPC_PHYADDR_4 = 1<<12, /* Bit 4 of Phy Addr */
1752 GPC_PHYADDR_3 = 1<<11, /* Bit 3 of Phy Addr */
1753 GPC_PHYADDR_2 = 1<<10, /* Bit 2 of Phy Addr */
1754 GPC_PHYADDR_1 = 1<<9, /* Bit 1 of Phy Addr */
1755 GPC_PHYADDR_0 = 1<<8, /* Bit 0 of Phy Addr */
1756 /* Bits 7..2: reserved */
1757 GPC_RST_CLR = 1<<1, /* Clear GPHY Reset */ 1735 GPC_RST_CLR = 1<<1, /* Clear GPHY Reset */
1758 GPC_RST_SET = 1<<0, /* Set GPHY Reset */ 1736 GPC_RST_SET = 1<<0, /* Set GPHY Reset */
1759}; 1737};
diff --git a/drivers/net/wireless/hostap/hostap_80211_tx.c b/drivers/net/wireless/hostap/hostap_80211_tx.c
index 246fac0e8001..3df3c60263d4 100644
--- a/drivers/net/wireless/hostap/hostap_80211_tx.c
+++ b/drivers/net/wireless/hostap/hostap_80211_tx.c
@@ -311,7 +311,7 @@ static struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb,
311 local_info_t *local; 311 local_info_t *local;
312 struct ieee80211_hdr_4addr *hdr; 312 struct ieee80211_hdr_4addr *hdr;
313 u16 fc; 313 u16 fc;
314 int hdr_len, res; 314 int prefix_len, postfix_len, hdr_len, res;
315 315
316 iface = netdev_priv(skb->dev); 316 iface = netdev_priv(skb->dev);
317 local = iface->local; 317 local = iface->local;
@@ -337,10 +337,13 @@ static struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb,
337 if (skb == NULL) 337 if (skb == NULL)
338 return NULL; 338 return NULL;
339 339
340 if ((skb_headroom(skb) < crypt->ops->extra_mpdu_prefix_len || 340 prefix_len = crypt->ops->extra_mpdu_prefix_len +
341 skb_tailroom(skb) < crypt->ops->extra_mpdu_postfix_len) && 341 crypt->ops->extra_msdu_prefix_len;
342 pskb_expand_head(skb, crypt->ops->extra_mpdu_prefix_len, 342 postfix_len = crypt->ops->extra_mpdu_postfix_len +
343 crypt->ops->extra_mpdu_postfix_len, GFP_ATOMIC)) { 343 crypt->ops->extra_msdu_postfix_len;
344 if ((skb_headroom(skb) < prefix_len ||
345 skb_tailroom(skb) < postfix_len) &&
346 pskb_expand_head(skb, prefix_len, postfix_len, GFP_ATOMIC)) {
344 kfree_skb(skb); 347 kfree_skb(skb);
345 return NULL; 348 return NULL;
346 } 349 }
diff --git a/drivers/net/wireless/prism54/islpci_eth.c b/drivers/net/wireless/prism54/islpci_eth.c
index dd070cccf324..f49eb068c7d0 100644
--- a/drivers/net/wireless/prism54/islpci_eth.c
+++ b/drivers/net/wireless/prism54/islpci_eth.c
@@ -378,9 +378,10 @@ islpci_eth_receive(islpci_private *priv)
378 display_buffer((char *) skb->data, skb->len); 378 display_buffer((char *) skb->data, skb->len);
379#endif 379#endif
380 /* take care of monitor mode and spy monitoring. */ 380 /* take care of monitor mode and spy monitoring. */
381 if (unlikely(priv->iw_mode == IW_MODE_MONITOR)) 381 if (unlikely(priv->iw_mode == IW_MODE_MONITOR)) {
382 skb->dev = ndev;
382 discard = islpci_monitor_rx(priv, &skb); 383 discard = islpci_monitor_rx(priv, &skb);
383 else { 384 } else {
384 if (unlikely(skb->data[2 * ETH_ALEN] == 0)) { 385 if (unlikely(skb->data[2 * ETH_ALEN] == 0)) {
385 /* The packet has a rx_annex. Read it for spy monitoring, Then 386 /* The packet has a rx_annex. Read it for spy monitoring, Then
386 * remove it, while keeping the 2 leading MAC addr. 387 * remove it, while keeping the 2 leading MAC addr.
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 6ccc2e95930a..1cff65fb9c43 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1625,18 +1625,20 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE,
1625 quirk_nvidia_ck804_pcie_aer_ext_cap); 1625 quirk_nvidia_ck804_pcie_aer_ext_cap);
1626 1626
1627#ifdef CONFIG_PCI_MSI 1627#ifdef CONFIG_PCI_MSI
1628/* The Serverworks PCI-X chipset does not support MSI. We cannot easily rely 1628/* Some chipsets do not support MSI. We cannot easily rely on setting
1629 * on setting PCI_BUS_FLAGS_NO_MSI in its bus flags because there are actually 1629 * PCI_BUS_FLAGS_NO_MSI in its bus flags because there are actually
1630 * some other busses controlled by the chipset even if Linux is not aware of it. 1630 * some other busses controlled by the chipset even if Linux is not
1631 * Instead of setting the flag on all busses in the machine, simply disable MSI 1631 * aware of it. Instead of setting the flag on all busses in the
1632 * globally. 1632 * machine, simply disable MSI globally.
1633 */ 1633 */
1634static void __init quirk_svw_msi(struct pci_dev *dev) 1634static void __init quirk_disable_all_msi(struct pci_dev *dev)
1635{ 1635{
1636 pci_no_msi(); 1636 pci_no_msi();
1637 printk(KERN_WARNING "PCI: MSI quirk detected. MSI deactivated.\n"); 1637 printk(KERN_WARNING "PCI: MSI quirk detected. MSI deactivated.\n");
1638} 1638}
1639DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_GCNB_LE, quirk_svw_msi); 1639DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_GCNB_LE, quirk_disable_all_msi);
1640DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS400_200, quirk_disable_all_msi);
1641DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480, quirk_disable_all_msi);
1640 1642
1641/* Disable MSI on chipsets that are known to not support it */ 1643/* Disable MSI on chipsets that are known to not support it */
1642static void __devinit quirk_disable_msi(struct pci_dev *dev) 1644static void __devinit quirk_disable_msi(struct pci_dev *dev)
@@ -1649,8 +1651,6 @@ static void __devinit quirk_disable_msi(struct pci_dev *dev)
1649 } 1651 }
1650} 1652}
1651DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_disable_msi); 1653DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_disable_msi);
1652DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS400_200, quirk_disable_msi);
1653DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480, quirk_disable_msi);
1654 1654
1655/* Go through the list of Hypertransport capabilities and 1655/* Go through the list of Hypertransport capabilities and
1656 * return 1 if a HT MSI capability is found and enabled */ 1656 * return 1 if a HT MSI capability is found and enabled */
diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c
index 948efc775a78..eb6abd3f9221 100644
--- a/drivers/pcmcia/at91_cf.c
+++ b/drivers/pcmcia/at91_cf.c
@@ -336,16 +336,21 @@ static int at91_cf_suspend(struct platform_device *pdev, pm_message_t mesg)
336 enable_irq_wake(board->det_pin); 336 enable_irq_wake(board->det_pin);
337 if (board->irq_pin) 337 if (board->irq_pin)
338 enable_irq_wake(board->irq_pin); 338 enable_irq_wake(board->irq_pin);
339 } else {
340 disable_irq_wake(board->det_pin);
341 if (board->irq_pin)
342 disable_irq_wake(board->irq_pin);
343 } 339 }
344 return 0; 340 return 0;
345} 341}
346 342
347static int at91_cf_resume(struct platform_device *pdev) 343static int at91_cf_resume(struct platform_device *pdev)
348{ 344{
345 struct at91_cf_socket *cf = platform_get_drvdata(pdev);
346 struct at91_cf_data *board = cf->board;
347
348 if (device_may_wakeup(&pdev->dev)) {
349 disable_irq_wake(board->det_pin);
350 if (board->irq_pin)
351 disable_irq_wake(board->irq_pin);
352 }
353
349 pcmcia_socket_dev_resume(&pdev->dev); 354 pcmcia_socket_dev_resume(&pdev->dev);
350 return 0; 355 return 0;
351} 356}
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index ddff40c4212c..821cde65e369 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -1127,6 +1127,7 @@ zfcp_adapter_dequeue(struct zfcp_adapter *adapter)
1127 int retval = 0; 1127 int retval = 0;
1128 unsigned long flags; 1128 unsigned long flags;
1129 1129
1130 zfcp_adapter_scsi_unregister(adapter);
1130 device_unregister(&adapter->generic_services); 1131 device_unregister(&adapter->generic_services);
1131 zfcp_sysfs_adapter_remove_files(&adapter->ccw_device->dev); 1132 zfcp_sysfs_adapter_remove_files(&adapter->ccw_device->dev);
1132 dev_set_drvdata(&adapter->ccw_device->dev, NULL); 1133 dev_set_drvdata(&adapter->ccw_device->dev, NULL);
diff --git a/drivers/s390/scsi/zfcp_ccw.c b/drivers/s390/scsi/zfcp_ccw.c
index 81680efa1721..1c8f71a59855 100644
--- a/drivers/s390/scsi/zfcp_ccw.c
+++ b/drivers/s390/scsi/zfcp_ccw.c
@@ -189,9 +189,7 @@ zfcp_ccw_set_online(struct ccw_device *ccw_device)
189 * @ccw_device: pointer to belonging ccw device 189 * @ccw_device: pointer to belonging ccw device
190 * 190 *
191 * This function gets called by the common i/o layer and sets an adapter 191 * This function gets called by the common i/o layer and sets an adapter
192 * into state offline. Setting an fcp device offline means that it will be 192 * into state offline.
193 * unregistered from the SCSI stack and that the adapter will be shut down
194 * asynchronously.
195 */ 193 */
196static int 194static int
197zfcp_ccw_set_offline(struct ccw_device *ccw_device) 195zfcp_ccw_set_offline(struct ccw_device *ccw_device)
@@ -202,7 +200,6 @@ zfcp_ccw_set_offline(struct ccw_device *ccw_device)
202 adapter = dev_get_drvdata(&ccw_device->dev); 200 adapter = dev_get_drvdata(&ccw_device->dev);
203 zfcp_erp_adapter_shutdown(adapter, 0); 201 zfcp_erp_adapter_shutdown(adapter, 0);
204 zfcp_erp_wait(adapter); 202 zfcp_erp_wait(adapter);
205 zfcp_adapter_scsi_unregister(adapter);
206 zfcp_erp_thread_kill(adapter); 203 zfcp_erp_thread_kill(adapter);
207 zfcp_adapter_debug_unregister(adapter); 204 zfcp_adapter_debug_unregister(adapter);
208 up(&zfcp_data.config_sema); 205 up(&zfcp_data.config_sema);
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index a8b02542ac2d..0eb31e162b15 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -156,44 +156,30 @@ zfcp_fsf_req_free(struct zfcp_fsf_req *fsf_req)
156 kfree(fsf_req); 156 kfree(fsf_req);
157} 157}
158 158
159/** 159/*
160 * zfcp_fsf_req_dismiss - dismiss a single fsf request 160 * Never ever call this without shutting down the adapter first.
161 */ 161 * Otherwise the adapter would continue using and corrupting s390 storage.
162static void zfcp_fsf_req_dismiss(struct zfcp_adapter *adapter, 162 * Included BUG_ON() call to ensure this is done.
163 struct zfcp_fsf_req *fsf_req, 163 * ERP is supposed to be the only user of this function.
164 unsigned int counter)
165{
166 u64 dbg_tmp[2];
167
168 dbg_tmp[0] = (u64) atomic_read(&adapter->reqs_active);
169 dbg_tmp[1] = (u64) counter;
170 debug_event(adapter->erp_dbf, 4, (void *) dbg_tmp, 16);
171 list_del(&fsf_req->list);
172 fsf_req->status |= ZFCP_STATUS_FSFREQ_DISMISSED;
173 zfcp_fsf_req_complete(fsf_req);
174}
175
176/**
177 * zfcp_fsf_req_dismiss_all - dismiss all remaining fsf requests
178 */ 164 */
179void zfcp_fsf_req_dismiss_all(struct zfcp_adapter *adapter) 165void zfcp_fsf_req_dismiss_all(struct zfcp_adapter *adapter)
180{ 166{
181 struct zfcp_fsf_req *request, *tmp; 167 struct zfcp_fsf_req *fsf_req, *tmp;
182 unsigned long flags; 168 unsigned long flags;
183 LIST_HEAD(remove_queue); 169 LIST_HEAD(remove_queue);
184 unsigned int i, counter; 170 unsigned int i;
185 171
172 BUG_ON(atomic_test_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &adapter->status));
186 spin_lock_irqsave(&adapter->req_list_lock, flags); 173 spin_lock_irqsave(&adapter->req_list_lock, flags);
187 atomic_set(&adapter->reqs_active, 0); 174 atomic_set(&adapter->reqs_active, 0);
188 for (i=0; i<REQUEST_LIST_SIZE; i++) 175 for (i = 0; i < REQUEST_LIST_SIZE; i++)
189 list_splice_init(&adapter->req_list[i], &remove_queue); 176 list_splice_init(&adapter->req_list[i], &remove_queue);
190
191 spin_unlock_irqrestore(&adapter->req_list_lock, flags); 177 spin_unlock_irqrestore(&adapter->req_list_lock, flags);
192 178
193 counter = 0; 179 list_for_each_entry_safe(fsf_req, tmp, &remove_queue, list) {
194 list_for_each_entry_safe(request, tmp, &remove_queue, list) { 180 list_del(&fsf_req->list);
195 zfcp_fsf_req_dismiss(adapter, request, counter); 181 fsf_req->status |= ZFCP_STATUS_FSFREQ_DISMISSED;
196 counter++; 182 zfcp_fsf_req_complete(fsf_req);
197 } 183 }
198} 184}
199 185
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index 16e2d64658af..0acf6db0a08d 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -569,6 +569,9 @@ zfcp_adapter_scsi_register(struct zfcp_adapter *adapter)
569 int retval = 0; 569 int retval = 0;
570 static unsigned int unique_id = 0; 570 static unsigned int unique_id = 0;
571 571
572 if (adapter->scsi_host)
573 goto out;
574
572 /* register adapter as SCSI host with mid layer of SCSI stack */ 575 /* register adapter as SCSI host with mid layer of SCSI stack */
573 adapter->scsi_host = scsi_host_alloc(&zfcp_data.scsi_host_template, 576 adapter->scsi_host = scsi_host_alloc(&zfcp_data.scsi_host_template,
574 sizeof (struct zfcp_adapter *)); 577 sizeof (struct zfcp_adapter *));
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index d28c14e23c32..572034ceb143 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -1753,23 +1753,9 @@ config SUN3X_ESP
1753 The ESP was an on-board SCSI controller used on Sun 3/80 1753 The ESP was an on-board SCSI controller used on Sun 3/80
1754 machines. Say Y here to compile in support for it. 1754 machines. Say Y here to compile in support for it.
1755 1755
1756config SCSI_ESP_CORE
1757 tristate "ESP Scsi Driver Core"
1758 depends on SCSI
1759 select SCSI_SPI_ATTRS
1760 help
1761 This is a core driver for NCR53c9x based scsi chipsets,
1762 also known as "ESP" for Emulex Scsi Processor or
1763 Enhanced Scsi Processor. This driver does not exist by
1764 itself, there are front-end drivers which, when enabled,
1765 select and enable this driver. One example is SCSI_SUNESP.
1766 These front-end drivers provide probing, DMA, and register
1767 access support for the core driver.
1768
1769config SCSI_SUNESP 1756config SCSI_SUNESP
1770 tristate "Sparc ESP Scsi Driver" 1757 tristate "Sparc ESP Scsi Driver"
1771 depends on SBUS && SCSI 1758 depends on SBUS && SCSI
1772 select SCSI_ESP_CORE
1773 help 1759 help
1774 This is the driver for the Sun ESP SCSI host adapter. The ESP 1760 This is the driver for the Sun ESP SCSI host adapter. The ESP
1775 chipset is present in most SPARC SBUS-based computers. 1761 chipset is present in most SPARC SBUS-based computers.
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index 51e884fa10b0..b1b632791580 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -106,8 +106,7 @@ obj-$(CONFIG_MEGARAID_LEGACY) += megaraid.o
106obj-$(CONFIG_MEGARAID_NEWGEN) += megaraid/ 106obj-$(CONFIG_MEGARAID_NEWGEN) += megaraid/
107obj-$(CONFIG_MEGARAID_SAS) += megaraid/ 107obj-$(CONFIG_MEGARAID_SAS) += megaraid/
108obj-$(CONFIG_SCSI_ACARD) += atp870u.o 108obj-$(CONFIG_SCSI_ACARD) += atp870u.o
109obj-$(CONFIG_SCSI_ESP_CORE) += esp_scsi.o 109obj-$(CONFIG_SCSI_SUNESP) += esp_scsi.o sun_esp.o
110obj-$(CONFIG_SCSI_SUNESP) += sun_esp.o
111obj-$(CONFIG_SCSI_GDTH) += gdth.o 110obj-$(CONFIG_SCSI_GDTH) += gdth.o
112obj-$(CONFIG_SCSI_INITIO) += initio.o 111obj-$(CONFIG_SCSI_INITIO) += initio.o
113obj-$(CONFIG_SCSI_INIA100) += a100u2w.o 112obj-$(CONFIG_SCSI_INIA100) += a100u2w.o
@@ -121,7 +120,7 @@ obj-$(CONFIG_BLK_DEV_3W_XXXX_RAID) += 3w-xxxx.o
121obj-$(CONFIG_SCSI_3W_9XXX) += 3w-9xxx.o 120obj-$(CONFIG_SCSI_3W_9XXX) += 3w-9xxx.o
122obj-$(CONFIG_SCSI_PPA) += ppa.o 121obj-$(CONFIG_SCSI_PPA) += ppa.o
123obj-$(CONFIG_SCSI_IMM) += imm.o 122obj-$(CONFIG_SCSI_IMM) += imm.o
124obj-$(CONFIG_JAZZ_ESP) += NCR53C9x.o jazz_esp.o 123obj-$(CONFIG_JAZZ_ESP) += esp_scsi.o jazz_esp.o
125obj-$(CONFIG_SUN3X_ESP) += NCR53C9x.o sun3x_esp.o 124obj-$(CONFIG_SUN3X_ESP) += NCR53C9x.o sun3x_esp.o
126obj-$(CONFIG_SCSI_FCAL) += fcal.o 125obj-$(CONFIG_SCSI_FCAL) += fcal.o
127obj-$(CONFIG_SCSI_LASI700) += 53c700.o lasi700.o 126obj-$(CONFIG_SCSI_LASI700) += 53c700.o lasi700.o
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 1e82c69b36b0..8dcfe4ec35c2 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -146,7 +146,7 @@ static char *aac_get_status_string(u32 status);
146static int nondasd = -1; 146static int nondasd = -1;
147static int dacmode = -1; 147static int dacmode = -1;
148 148
149static int commit = -1; 149int aac_commit = -1;
150int startup_timeout = 180; 150int startup_timeout = 180;
151int aif_timeout = 120; 151int aif_timeout = 120;
152 152
@@ -154,7 +154,7 @@ module_param(nondasd, int, S_IRUGO|S_IWUSR);
154MODULE_PARM_DESC(nondasd, "Control scanning of hba for nondasd devices. 0=off, 1=on"); 154MODULE_PARM_DESC(nondasd, "Control scanning of hba for nondasd devices. 0=off, 1=on");
155module_param(dacmode, int, S_IRUGO|S_IWUSR); 155module_param(dacmode, int, S_IRUGO|S_IWUSR);
156MODULE_PARM_DESC(dacmode, "Control whether dma addressing is using 64 bit DAC. 0=off, 1=on"); 156MODULE_PARM_DESC(dacmode, "Control whether dma addressing is using 64 bit DAC. 0=off, 1=on");
157module_param(commit, int, S_IRUGO|S_IWUSR); 157module_param_named(commit, aac_commit, int, S_IRUGO|S_IWUSR);
158MODULE_PARM_DESC(commit, "Control whether a COMMIT_CONFIG is issued to the adapter for foreign arrays.\nThis is typically needed in systems that do not have a BIOS. 0=off, 1=on"); 158MODULE_PARM_DESC(commit, "Control whether a COMMIT_CONFIG is issued to the adapter for foreign arrays.\nThis is typically needed in systems that do not have a BIOS. 0=off, 1=on");
159module_param(startup_timeout, int, S_IRUGO|S_IWUSR); 159module_param(startup_timeout, int, S_IRUGO|S_IWUSR);
160MODULE_PARM_DESC(startup_timeout, "The duration of time in seconds to wait for adapter to have it's kernel up and\nrunning. This is typically adjusted for large systems that do not have a BIOS."); 160MODULE_PARM_DESC(startup_timeout, "The duration of time in seconds to wait for adapter to have it's kernel up and\nrunning. This is typically adjusted for large systems that do not have a BIOS.");
@@ -173,6 +173,9 @@ int expose_physicals = -1;
173module_param(expose_physicals, int, S_IRUGO|S_IWUSR); 173module_param(expose_physicals, int, S_IRUGO|S_IWUSR);
174MODULE_PARM_DESC(expose_physicals, "Expose physical components of the arrays. -1=protect 0=off, 1=on"); 174MODULE_PARM_DESC(expose_physicals, "Expose physical components of the arrays. -1=protect 0=off, 1=on");
175 175
176int aac_reset_devices = 0;
177module_param_named(reset_devices, aac_reset_devices, int, S_IRUGO|S_IWUSR);
178MODULE_PARM_DESC(reset_devices, "Force an adapter reset at initialization.");
176 179
177static inline int aac_valid_context(struct scsi_cmnd *scsicmd, 180static inline int aac_valid_context(struct scsi_cmnd *scsicmd,
178 struct fib *fibptr) { 181 struct fib *fibptr) {
@@ -246,7 +249,7 @@ int aac_get_config_status(struct aac_dev *dev, int commit_flag)
246 aac_fib_complete(fibptr); 249 aac_fib_complete(fibptr);
247 /* Send a CT_COMMIT_CONFIG to enable discovery of devices */ 250 /* Send a CT_COMMIT_CONFIG to enable discovery of devices */
248 if (status >= 0) { 251 if (status >= 0) {
249 if ((commit == 1) || commit_flag) { 252 if ((aac_commit == 1) || commit_flag) {
250 struct aac_commit_config * dinfo; 253 struct aac_commit_config * dinfo;
251 aac_fib_init(fibptr); 254 aac_fib_init(fibptr);
252 dinfo = (struct aac_commit_config *) fib_data(fibptr); 255 dinfo = (struct aac_commit_config *) fib_data(fibptr);
@@ -261,7 +264,7 @@ int aac_get_config_status(struct aac_dev *dev, int commit_flag)
261 1, 1, 264 1, 1,
262 NULL, NULL); 265 NULL, NULL);
263 aac_fib_complete(fibptr); 266 aac_fib_complete(fibptr);
264 } else if (commit == 0) { 267 } else if (aac_commit == 0) {
265 printk(KERN_WARNING 268 printk(KERN_WARNING
266 "aac_get_config_status: Foreign device configurations are being ignored\n"); 269 "aac_get_config_status: Foreign device configurations are being ignored\n");
267 } 270 }
@@ -340,7 +343,7 @@ int aac_get_containers(struct aac_dev *dev)
340static void aac_internal_transfer(struct scsi_cmnd *scsicmd, void *data, unsigned int offset, unsigned int len) 343static void aac_internal_transfer(struct scsi_cmnd *scsicmd, void *data, unsigned int offset, unsigned int len)
341{ 344{
342 void *buf; 345 void *buf;
343 unsigned int transfer_len; 346 int transfer_len;
344 struct scatterlist *sg = scsicmd->request_buffer; 347 struct scatterlist *sg = scsicmd->request_buffer;
345 348
346 if (scsicmd->use_sg) { 349 if (scsicmd->use_sg) {
@@ -351,7 +354,7 @@ static void aac_internal_transfer(struct scsi_cmnd *scsicmd, void *data, unsigne
351 transfer_len = min(scsicmd->request_bufflen, len + offset); 354 transfer_len = min(scsicmd->request_bufflen, len + offset);
352 } 355 }
353 transfer_len -= offset; 356 transfer_len -= offset;
354 if (buf && transfer_len) 357 if (buf && transfer_len > 0)
355 memcpy(buf + offset, data, transfer_len); 358 memcpy(buf + offset, data, transfer_len);
356 359
357 if (scsicmd->use_sg) 360 if (scsicmd->use_sg)
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 45ca3e801619..c81edf36913f 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -1823,9 +1823,12 @@ int aac_send_shutdown(struct aac_dev *dev);
1823int aac_probe_container(struct aac_dev *dev, int cid); 1823int aac_probe_container(struct aac_dev *dev, int cid);
1824int _aac_rx_init(struct aac_dev *dev); 1824int _aac_rx_init(struct aac_dev *dev);
1825int aac_rx_select_comm(struct aac_dev *dev, int comm); 1825int aac_rx_select_comm(struct aac_dev *dev, int comm);
1826int aac_rx_deliver_producer(struct fib * fib);
1826extern int numacb; 1827extern int numacb;
1827extern int acbsize; 1828extern int acbsize;
1828extern char aac_driver_version[]; 1829extern char aac_driver_version[];
1829extern int startup_timeout; 1830extern int startup_timeout;
1830extern int aif_timeout; 1831extern int aif_timeout;
1831extern int expose_physicals; 1832extern int expose_physicals;
1833extern int aac_reset_devices;
1834extern int aac_commit;
diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c
index 291cd14f4e98..ae978a373c56 100644
--- a/drivers/scsi/aacraid/rx.c
+++ b/drivers/scsi/aacraid/rx.c
@@ -378,7 +378,7 @@ static int aac_rx_check_health(struct aac_dev *dev)
378 * 378 *
379 * Will send a fib, returning 0 if successful. 379 * Will send a fib, returning 0 if successful.
380 */ 380 */
381static int aac_rx_deliver_producer(struct fib * fib) 381int aac_rx_deliver_producer(struct fib * fib)
382{ 382{
383 struct aac_dev *dev = fib->dev; 383 struct aac_dev *dev = fib->dev;
384 struct aac_queue *q = &dev->queues->queue[AdapNormCmdQueue]; 384 struct aac_queue *q = &dev->queues->queue[AdapNormCmdQueue];
@@ -488,6 +488,8 @@ static int aac_rx_restart_adapter(struct aac_dev *dev, int bled)
488 return -EINVAL; 488 return -EINVAL;
489 if (rx_readl(dev, MUnit.OMRx[0]) & KERNEL_PANIC) 489 if (rx_readl(dev, MUnit.OMRx[0]) & KERNEL_PANIC)
490 return -ENODEV; 490 return -ENODEV;
491 if (startup_timeout < 300)
492 startup_timeout = 300;
491 return 0; 493 return 0;
492} 494}
493 495
@@ -542,7 +544,7 @@ int _aac_rx_init(struct aac_dev *dev)
542 dev->a_ops.adapter_sync_cmd = rx_sync_cmd; 544 dev->a_ops.adapter_sync_cmd = rx_sync_cmd;
543 dev->a_ops.adapter_enable_int = aac_rx_disable_interrupt; 545 dev->a_ops.adapter_enable_int = aac_rx_disable_interrupt;
544 dev->OIMR = status = rx_readb (dev, MUnit.OIMR); 546 dev->OIMR = status = rx_readb (dev, MUnit.OIMR);
545 if ((((status & 0x0c) != 0x0c) || reset_devices) && 547 if ((((status & 0x0c) != 0x0c) || aac_reset_devices || reset_devices) &&
546 !aac_rx_restart_adapter(dev, 0)) 548 !aac_rx_restart_adapter(dev, 0))
547 ++restart; 549 ++restart;
548 /* 550 /*
@@ -594,6 +596,8 @@ int _aac_rx_init(struct aac_dev *dev)
594 } 596 }
595 msleep(1); 597 msleep(1);
596 } 598 }
599 if (restart)
600 aac_commit = 1;
597 /* 601 /*
598 * Fill in the common function dispatch table. 602 * Fill in the common function dispatch table.
599 */ 603 */
diff --git a/drivers/scsi/aacraid/sa.c b/drivers/scsi/aacraid/sa.c
index f4b5e9742ab0..85b91bc578c9 100644
--- a/drivers/scsi/aacraid/sa.c
+++ b/drivers/scsi/aacraid/sa.c
@@ -5,7 +5,7 @@
5 * based on the old aacraid driver that is.. 5 * based on the old aacraid driver that is..
6 * Adaptec aacraid device driver for Linux. 6 * Adaptec aacraid device driver for Linux.
7 * 7 *
8 * Copyright (c) 2000 Adaptec, Inc. (aacraid@adaptec.com) 8 * Copyright (c) 2000-2007 Adaptec, Inc. (aacraid@adaptec.com)
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
@@ -257,6 +257,11 @@ static void aac_sa_start_adapter(struct aac_dev *dev)
257 NULL, NULL, NULL, NULL, NULL); 257 NULL, NULL, NULL, NULL, NULL);
258} 258}
259 259
260static int aac_sa_restart_adapter(struct aac_dev *dev, int bled)
261{
262 return -EINVAL;
263}
264
260/** 265/**
261 * aac_sa_check_health 266 * aac_sa_check_health
262 * @dev: device to check if healthy 267 * @dev: device to check if healthy
@@ -366,7 +371,9 @@ int aac_sa_init(struct aac_dev *dev)
366 dev->a_ops.adapter_notify = aac_sa_notify_adapter; 371 dev->a_ops.adapter_notify = aac_sa_notify_adapter;
367 dev->a_ops.adapter_sync_cmd = sa_sync_cmd; 372 dev->a_ops.adapter_sync_cmd = sa_sync_cmd;
368 dev->a_ops.adapter_check_health = aac_sa_check_health; 373 dev->a_ops.adapter_check_health = aac_sa_check_health;
374 dev->a_ops.adapter_restart = aac_sa_restart_adapter;
369 dev->a_ops.adapter_intr = aac_sa_intr; 375 dev->a_ops.adapter_intr = aac_sa_intr;
376 dev->a_ops.adapter_deliver = aac_rx_deliver_producer;
370 dev->a_ops.adapter_ioremap = aac_sa_ioremap; 377 dev->a_ops.adapter_ioremap = aac_sa_ioremap;
371 378
372 /* 379 /*
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y b/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y
index c328596def3c..6066998ed562 100644
--- a/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y
+++ b/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y
@@ -106,6 +106,7 @@ static void make_expression(expression_t *immed, int value);
106static void add_conditional(symbol_t *symbol); 106static void add_conditional(symbol_t *symbol);
107static void add_version(const char *verstring); 107static void add_version(const char *verstring);
108static int is_download_const(expression_t *immed); 108static int is_download_const(expression_t *immed);
109void yyerror(const char *string);
109 110
110#define SRAM_SYMNAME "SRAM_BASE" 111#define SRAM_SYMNAME "SRAM_BASE"
111#define SCB_SYMNAME "SCB_BASE" 112#define SCB_SYMNAME "SCB_BASE"
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.y b/drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.y
index 439f760b34b5..ff46aa6801bf 100644
--- a/drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.y
+++ b/drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.y
@@ -65,6 +65,7 @@
65static symbol_t *macro_symbol; 65static symbol_t *macro_symbol;
66 66
67static void add_macro_arg(const char *argtext, int position); 67static void add_macro_arg(const char *argtext, int position);
68void mmerror(const char *string);
68 69
69%} 70%}
70 71
diff --git a/drivers/scsi/aic94xx/aic94xx_tmf.c b/drivers/scsi/aic94xx/aic94xx_tmf.c
index 9a14a6d97275..c0d0b7d7a8ce 100644
--- a/drivers/scsi/aic94xx/aic94xx_tmf.c
+++ b/drivers/scsi/aic94xx/aic94xx_tmf.c
@@ -290,6 +290,7 @@ static void asd_tmf_tasklet_complete(struct asd_ascb *ascb,
290static inline int asd_clear_nexus(struct sas_task *task) 290static inline int asd_clear_nexus(struct sas_task *task)
291{ 291{
292 int res = TMF_RESP_FUNC_FAILED; 292 int res = TMF_RESP_FUNC_FAILED;
293 int leftover;
293 struct asd_ascb *tascb = task->lldd_task; 294 struct asd_ascb *tascb = task->lldd_task;
294 unsigned long flags; 295 unsigned long flags;
295 296
@@ -298,10 +299,12 @@ static inline int asd_clear_nexus(struct sas_task *task)
298 res = asd_clear_nexus_tag(task); 299 res = asd_clear_nexus_tag(task);
299 else 300 else
300 res = asd_clear_nexus_index(task); 301 res = asd_clear_nexus_index(task);
301 wait_for_completion_timeout(&tascb->completion, 302 leftover = wait_for_completion_timeout(&tascb->completion,
302 AIC94XX_SCB_TIMEOUT); 303 AIC94XX_SCB_TIMEOUT);
303 ASD_DPRINTK("came back from clear nexus\n"); 304 ASD_DPRINTK("came back from clear nexus\n");
304 spin_lock_irqsave(&task->task_state_lock, flags); 305 spin_lock_irqsave(&task->task_state_lock, flags);
306 if (leftover < 1)
307 res = TMF_RESP_FUNC_FAILED;
305 if (task->task_state_flags & SAS_TASK_STATE_DONE) 308 if (task->task_state_flags & SAS_TASK_STATE_DONE)
306 res = TMF_RESP_FUNC_COMPLETE; 309 res = TMF_RESP_FUNC_COMPLETE;
307 spin_unlock_irqrestore(&task->task_state_lock, flags); 310 spin_unlock_irqrestore(&task->task_state_lock, flags);
@@ -350,6 +353,7 @@ int asd_abort_task(struct sas_task *task)
350 unsigned long flags; 353 unsigned long flags;
351 struct asd_ascb *ascb = NULL; 354 struct asd_ascb *ascb = NULL;
352 struct scb *scb; 355 struct scb *scb;
356 int leftover;
353 357
354 spin_lock_irqsave(&task->task_state_lock, flags); 358 spin_lock_irqsave(&task->task_state_lock, flags);
355 if (task->task_state_flags & SAS_TASK_STATE_DONE) { 359 if (task->task_state_flags & SAS_TASK_STATE_DONE) {
@@ -455,9 +459,11 @@ int asd_abort_task(struct sas_task *task)
455 break; 459 break;
456 case TF_TMF_TASK_DONE + 0xFF00: /* done but not reported yet */ 460 case TF_TMF_TASK_DONE + 0xFF00: /* done but not reported yet */
457 res = TMF_RESP_FUNC_FAILED; 461 res = TMF_RESP_FUNC_FAILED;
458 wait_for_completion_timeout(&tascb->completion, 462 leftover = wait_for_completion_timeout(&tascb->completion,
459 AIC94XX_SCB_TIMEOUT); 463 AIC94XX_SCB_TIMEOUT);
460 spin_lock_irqsave(&task->task_state_lock, flags); 464 spin_lock_irqsave(&task->task_state_lock, flags);
465 if (leftover < 1)
466 res = TMF_RESP_FUNC_FAILED;
461 if (task->task_state_flags & SAS_TASK_STATE_DONE) 467 if (task->task_state_flags & SAS_TASK_STATE_DONE)
462 res = TMF_RESP_FUNC_COMPLETE; 468 res = TMF_RESP_FUNC_COMPLETE;
463 spin_unlock_irqrestore(&task->task_state_lock, flags); 469 spin_unlock_irqrestore(&task->task_state_lock, flags);
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 4baa79e68679..fa6ff295e568 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -3954,6 +3954,13 @@ static int __ipr_eh_dev_reset(struct scsi_cmnd * scsi_cmd)
3954 spin_unlock_irq(scsi_cmd->device->host->host_lock); 3954 spin_unlock_irq(scsi_cmd->device->host->host_lock);
3955 ata_do_eh(ap, NULL, NULL, ipr_sata_reset, NULL); 3955 ata_do_eh(ap, NULL, NULL, ipr_sata_reset, NULL);
3956 spin_lock_irq(scsi_cmd->device->host->host_lock); 3956 spin_lock_irq(scsi_cmd->device->host->host_lock);
3957
3958 list_for_each_entry(ipr_cmd, &ioa_cfg->pending_q, queue) {
3959 if (ipr_cmd->ioarcb.res_handle == res->cfgte.res_handle) {
3960 rc = -EIO;
3961 break;
3962 }
3963 }
3957 } else 3964 } else
3958 rc = ipr_device_reset(ioa_cfg, res); 3965 rc = ipr_device_reset(ioa_cfg, res);
3959 res->resetting_device = 0; 3966 res->resetting_device = 0;
diff --git a/drivers/scsi/jazz_esp.c b/drivers/scsi/jazz_esp.c
index 19dd4b962e18..81e497d9eae0 100644
--- a/drivers/scsi/jazz_esp.c
+++ b/drivers/scsi/jazz_esp.c
@@ -1,307 +1,244 @@
1/* 1/* jazz_esp.c: ESP front-end for MIPS JAZZ systems.
2 * jazz_esp.c: Driver for SCSI chip on Mips Magnum Boards (JAZZ architecture)
3 * 2 *
4 * Copyright (C) 1997 Thomas Bogendoerfer (tsbogend@alpha.franken.de) 3 * Copyright (C) 2007 Thomas Bogendörfer (tsbogend@alpha.frankende)
5 *
6 * jazz_esp is based on David S. Miller's ESP driver and cyber_esp
7 */ 4 */
8 5
9#include <linux/init.h>
10#include <linux/kernel.h> 6#include <linux/kernel.h>
11#include <linux/delay.h>
12#include <linux/types.h> 7#include <linux/types.h>
13#include <linux/string.h> 8#include <linux/module.h>
14#include <linux/slab.h> 9#include <linux/init.h>
15#include <linux/blkdev.h> 10#include <linux/interrupt.h>
16#include <linux/proc_fs.h> 11#include <linux/platform_device.h>
17#include <linux/stat.h> 12#include <linux/dma-mapping.h>
18
19#include "scsi.h"
20#include <scsi/scsi_host.h>
21#include "NCR53C9x.h"
22 13
23#include <asm/irq.h> 14#include <asm/irq.h>
15#include <asm/io.h>
16#include <asm/dma.h>
17
24#include <asm/jazz.h> 18#include <asm/jazz.h>
25#include <asm/jazzdma.h> 19#include <asm/jazzdma.h>
26#include <asm/dma.h>
27 20
28#include <asm/pgtable.h> 21#include <scsi/scsi_host.h>
29
30static int dma_bytes_sent(struct NCR_ESP *esp, int fifo_count);
31static int dma_can_transfer(struct NCR_ESP *esp, struct scsi_cmnd *sp);
32static void dma_dump_state(struct NCR_ESP *esp);
33static void dma_init_read(struct NCR_ESP *esp, __u32 vaddress, int length);
34static void dma_init_write(struct NCR_ESP *esp, __u32 vaddress, int length);
35static void dma_ints_off(struct NCR_ESP *esp);
36static void dma_ints_on(struct NCR_ESP *esp);
37static int dma_irq_p(struct NCR_ESP *esp);
38static int dma_ports_p(struct NCR_ESP *esp);
39static void dma_setup(struct NCR_ESP *esp, __u32 addr, int count, int write);
40static void dma_mmu_get_scsi_one (struct NCR_ESP *esp, struct scsi_cmnd *sp);
41static void dma_mmu_get_scsi_sgl (struct NCR_ESP *esp, struct scsi_cmnd *sp);
42static void dma_mmu_release_scsi_one (struct NCR_ESP *esp, struct scsi_cmnd *sp);
43static void dma_mmu_release_scsi_sgl (struct NCR_ESP *esp, struct scsi_cmnd *sp);
44static void dma_advance_sg (struct scsi_cmnd *sp);
45static void dma_led_off(struct NCR_ESP *);
46static void dma_led_on(struct NCR_ESP *);
47
48
49static volatile unsigned char cmd_buffer[16];
50 /* This is where all commands are put
51 * before they are trasfered to the ESP chip
52 * via PIO.
53 */
54
55static int jazz_esp_release(struct Scsi_Host *shost)
56{
57 if (shost->irq)
58 free_irq(shost->irq, NULL);
59 if (shost->dma_channel != 0xff)
60 free_dma(shost->dma_channel);
61 if (shost->io_port && shost->n_io_port)
62 release_region(shost->io_port, shost->n_io_port);
63 scsi_unregister(shost);
64 return 0;
65}
66 22
67/***************************************************************** Detection */ 23#include "esp_scsi.h"
68static int jazz_esp_detect(struct scsi_host_template *tpnt)
69{
70 struct NCR_ESP *esp;
71 struct ConfigDev *esp_dev;
72
73 /*
74 * first assumption it is there:-)
75 */
76 if (1) {
77 esp_dev = NULL;
78 esp = esp_allocate(tpnt, esp_dev, 0);
79
80 /* Do command transfer with programmed I/O */
81 esp->do_pio_cmds = 1;
82
83 /* Required functions */
84 esp->dma_bytes_sent = &dma_bytes_sent;
85 esp->dma_can_transfer = &dma_can_transfer;
86 esp->dma_dump_state = &dma_dump_state;
87 esp->dma_init_read = &dma_init_read;
88 esp->dma_init_write = &dma_init_write;
89 esp->dma_ints_off = &dma_ints_off;
90 esp->dma_ints_on = &dma_ints_on;
91 esp->dma_irq_p = &dma_irq_p;
92 esp->dma_ports_p = &dma_ports_p;
93 esp->dma_setup = &dma_setup;
94
95 /* Optional functions */
96 esp->dma_barrier = NULL;
97 esp->dma_drain = NULL;
98 esp->dma_invalidate = NULL;
99 esp->dma_irq_entry = NULL;
100 esp->dma_irq_exit = NULL;
101 esp->dma_poll = NULL;
102 esp->dma_reset = NULL;
103 esp->dma_led_off = &dma_led_off;
104 esp->dma_led_on = &dma_led_on;
105
106 /* virtual DMA functions */
107 esp->dma_mmu_get_scsi_one = &dma_mmu_get_scsi_one;
108 esp->dma_mmu_get_scsi_sgl = &dma_mmu_get_scsi_sgl;
109 esp->dma_mmu_release_scsi_one = &dma_mmu_release_scsi_one;
110 esp->dma_mmu_release_scsi_sgl = &dma_mmu_release_scsi_sgl;
111 esp->dma_advance_sg = &dma_advance_sg;
112
113
114 /* SCSI chip speed */
115 esp->cfreq = 40000000;
116 24
117 /* 25#define DRV_MODULE_NAME "jazz_esp"
118 * we don't give the address of DMA channel, but the number 26#define PFX DRV_MODULE_NAME ": "
119 * of DMA channel, so we can use the jazz DMA functions 27#define DRV_VERSION "1.000"
120 * 28#define DRV_MODULE_RELDATE "May 19, 2007"
121 */
122 esp->dregs = (void *) JAZZ_SCSI_DMA;
123
124 /* ESP register base */
125 esp->eregs = (struct ESP_regs *)(JAZZ_SCSI_BASE);
126
127 /* Set the command buffer */
128 esp->esp_command = (volatile unsigned char *)cmd_buffer;
129
130 /* get virtual dma address for command buffer */
131 esp->esp_command_dvma = vdma_alloc(CPHYSADDR(cmd_buffer), sizeof (cmd_buffer));
132
133 esp->irq = JAZZ_SCSI_IRQ;
134 request_irq(JAZZ_SCSI_IRQ, esp_intr, IRQF_DISABLED, "JAZZ SCSI",
135 esp->ehost);
136
137 /*
138 * FIXME, look if the scsi id is available from NVRAM
139 */
140 esp->scsi_id = 7;
141
142 /* Check for differential SCSI-bus */
143 /* What is this stuff? */
144 esp->diff = 0;
145
146 esp_initialize(esp);
147
148 printk("ESP: Total of %d ESP hosts found, %d actually in use.\n", nesps,esps_in_use);
149 esps_running = esps_in_use;
150 return esps_in_use;
151 }
152 return 0;
153}
154 29
155/************************************************************* DMA Functions */ 30static void jazz_esp_write8(struct esp *esp, u8 val, unsigned long reg)
156static int dma_bytes_sent(struct NCR_ESP *esp, int fifo_count)
157{ 31{
158 return fifo_count; 32 *(volatile u8 *)(esp->regs + reg) = val;
159} 33}
160 34
161static int dma_can_transfer(struct NCR_ESP *esp, struct scsi_cmnd *sp) 35static u8 jazz_esp_read8(struct esp *esp, unsigned long reg)
162{ 36{
163 /* 37 return *(volatile u8 *)(esp->regs + reg);
164 * maximum DMA size is 1MB
165 */
166 unsigned long sz = sp->SCp.this_residual;
167 if(sz > 0x100000)
168 sz = 0x100000;
169 return sz;
170} 38}
171 39
172static void dma_dump_state(struct NCR_ESP *esp) 40static dma_addr_t jazz_esp_map_single(struct esp *esp, void *buf,
41 size_t sz, int dir)
173{ 42{
174 43 return dma_map_single(esp->dev, buf, sz, dir);
175 ESPLOG(("esp%d: dma -- enable <%08x> residue <%08x\n",
176 esp->esp_id, vdma_get_enable((int)esp->dregs), vdma_get_residue((int)esp->dregs)));
177} 44}
178 45
179static void dma_init_read(struct NCR_ESP *esp, __u32 vaddress, int length) 46static int jazz_esp_map_sg(struct esp *esp, struct scatterlist *sg,
47 int num_sg, int dir)
180{ 48{
181 dma_cache_wback_inv ((unsigned long)phys_to_virt(vdma_log2phys(vaddress)), length); 49 return dma_map_sg(esp->dev, sg, num_sg, dir);
182 vdma_disable ((int)esp->dregs);
183 vdma_set_mode ((int)esp->dregs, DMA_MODE_READ);
184 vdma_set_addr ((int)esp->dregs, vaddress);
185 vdma_set_count ((int)esp->dregs, length);
186 vdma_enable ((int)esp->dregs);
187} 50}
188 51
189static void dma_init_write(struct NCR_ESP *esp, __u32 vaddress, int length) 52static void jazz_esp_unmap_single(struct esp *esp, dma_addr_t addr,
53 size_t sz, int dir)
190{ 54{
191 dma_cache_wback_inv ((unsigned long)phys_to_virt(vdma_log2phys(vaddress)), length); 55 dma_unmap_single(esp->dev, addr, sz, dir);
192 vdma_disable ((int)esp->dregs);
193 vdma_set_mode ((int)esp->dregs, DMA_MODE_WRITE);
194 vdma_set_addr ((int)esp->dregs, vaddress);
195 vdma_set_count ((int)esp->dregs, length);
196 vdma_enable ((int)esp->dregs);
197} 56}
198 57
199static void dma_ints_off(struct NCR_ESP *esp) 58static void jazz_esp_unmap_sg(struct esp *esp, struct scatterlist *sg,
59 int num_sg, int dir)
200{ 60{
201 disable_irq(esp->irq); 61 dma_unmap_sg(esp->dev, sg, num_sg, dir);
202} 62}
203 63
204static void dma_ints_on(struct NCR_ESP *esp) 64static int jazz_esp_irq_pending(struct esp *esp)
205{ 65{
206 enable_irq(esp->irq); 66 if (jazz_esp_read8(esp, ESP_STATUS) & ESP_STAT_INTR)
67 return 1;
68 return 0;
207} 69}
208 70
209static int dma_irq_p(struct NCR_ESP *esp) 71static void jazz_esp_reset_dma(struct esp *esp)
210{ 72{
211 return (esp_read(esp->eregs->esp_status) & ESP_STAT_INTR); 73 vdma_disable ((int)esp->dma_regs);
212} 74}
213 75
214static int dma_ports_p(struct NCR_ESP *esp) 76static void jazz_esp_dma_drain(struct esp *esp)
215{ 77{
216 int enable = vdma_get_enable((int)esp->dregs); 78 /* nothing to do */
217
218 return (enable & R4030_CHNL_ENABLE);
219} 79}
220 80
221static void dma_setup(struct NCR_ESP *esp, __u32 addr, int count, int write) 81static void jazz_esp_dma_invalidate(struct esp *esp)
222{ 82{
223 /* 83 vdma_disable ((int)esp->dma_regs);
224 * On the Sparc, DMA_ST_WRITE means "move data from device to memory"
225 * so when (write) is true, it actually means READ!
226 */
227 if(write){
228 dma_init_read(esp, addr, count);
229 } else {
230 dma_init_write(esp, addr, count);
231 }
232} 84}
233 85
234static void dma_mmu_get_scsi_one (struct NCR_ESP *esp, struct scsi_cmnd *sp) 86static void jazz_esp_send_dma_cmd(struct esp *esp, u32 addr, u32 esp_count,
87 u32 dma_count, int write, u8 cmd)
235{ 88{
236 sp->SCp.have_data_in = vdma_alloc(CPHYSADDR(sp->SCp.buffer), sp->SCp.this_residual); 89 BUG_ON(!(cmd & ESP_CMD_DMA));
237 sp->SCp.ptr = (char *)((unsigned long)sp->SCp.have_data_in); 90
91 jazz_esp_write8(esp, (esp_count >> 0) & 0xff, ESP_TCLOW);
92 jazz_esp_write8(esp, (esp_count >> 8) & 0xff, ESP_TCMED);
93 vdma_disable ((int)esp->dma_regs);
94 if (write)
95 vdma_set_mode ((int)esp->dma_regs, DMA_MODE_READ);
96 else
97 vdma_set_mode ((int)esp->dma_regs, DMA_MODE_WRITE);
98
99 vdma_set_addr ((int)esp->dma_regs, addr);
100 vdma_set_count ((int)esp->dma_regs, dma_count);
101 vdma_enable ((int)esp->dma_regs);
102
103 scsi_esp_cmd(esp, cmd);
238} 104}
239 105
240static void dma_mmu_get_scsi_sgl (struct NCR_ESP *esp, struct scsi_cmnd *sp) 106static int jazz_esp_dma_error(struct esp *esp)
241{
242 int sz = sp->SCp.buffers_residual;
243 struct scatterlist *sg = (struct scatterlist *) sp->SCp.buffer;
244
245 while (sz >= 0) {
246 sg[sz].dma_address = vdma_alloc(CPHYSADDR(page_address(sg[sz].page) + sg[sz].offset), sg[sz].length);
247 sz--;
248 }
249 sp->SCp.ptr=(char *)(sp->SCp.buffer->dma_address);
250}
251
252static void dma_mmu_release_scsi_one (struct NCR_ESP *esp, struct scsi_cmnd *sp)
253{ 107{
254 vdma_free(sp->SCp.have_data_in); 108 u32 enable = vdma_get_enable((int)esp->dma_regs);
109
110 if (enable & (R4030_MEM_INTR|R4030_ADDR_INTR))
111 return 1;
112
113 return 0;
255} 114}
256 115
257static void dma_mmu_release_scsi_sgl (struct NCR_ESP *esp, struct scsi_cmnd *sp) 116static const struct esp_driver_ops jazz_esp_ops = {
117 .esp_write8 = jazz_esp_write8,
118 .esp_read8 = jazz_esp_read8,
119 .map_single = jazz_esp_map_single,
120 .map_sg = jazz_esp_map_sg,
121 .unmap_single = jazz_esp_unmap_single,
122 .unmap_sg = jazz_esp_unmap_sg,
123 .irq_pending = jazz_esp_irq_pending,
124 .reset_dma = jazz_esp_reset_dma,
125 .dma_drain = jazz_esp_dma_drain,
126 .dma_invalidate = jazz_esp_dma_invalidate,
127 .send_dma_cmd = jazz_esp_send_dma_cmd,
128 .dma_error = jazz_esp_dma_error,
129};
130
131static int __devinit esp_jazz_probe(struct platform_device *dev)
258{ 132{
259 int sz = sp->use_sg - 1; 133 struct scsi_host_template *tpnt = &scsi_esp_template;
260 struct scatterlist *sg = (struct scatterlist *)sp->request_buffer; 134 struct Scsi_Host *host;
261 135 struct esp *esp;
262 while(sz >= 0) { 136 struct resource *res;
263 vdma_free(sg[sz].dma_address); 137 int err;
264 sz--; 138
265 } 139 host = scsi_host_alloc(tpnt, sizeof(struct esp));
140
141 err = -ENOMEM;
142 if (!host)
143 goto fail;
144
145 host->max_id = 8;
146 esp = host_to_esp(host);
147
148 esp->host = host;
149 esp->dev = dev;
150 esp->ops = &jazz_esp_ops;
151
152 res = platform_get_resource(dev, IORESOURCE_MEM, 0);
153 if (!res)
154 goto fail_unlink;
155
156 esp->regs = (void __iomem *)res->start;
157 if (!esp->regs)
158 goto fail_unlink;
159
160 res = platform_get_resource(dev, IORESOURCE_MEM, 1);
161 if (!res)
162 goto fail_unlink;
163
164 esp->dma_regs = (void __iomem *)res->start;
165
166 esp->command_block = dma_alloc_coherent(esp->dev, 16,
167 &esp->command_block_dma,
168 GFP_KERNEL);
169 if (!esp->command_block)
170 goto fail_unmap_regs;
171
172 host->irq = platform_get_irq(dev, 0);
173 err = request_irq(host->irq, scsi_esp_intr, IRQF_SHARED, "ESP", esp);
174 if (err < 0)
175 goto fail_unmap_command_block;
176
177 esp->scsi_id = 7;
178 esp->host->this_id = esp->scsi_id;
179 esp->scsi_id_mask = (1 << esp->scsi_id);
180 esp->cfreq = 40000000;
181
182 dev_set_drvdata(&dev->dev, esp);
183
184 err = scsi_esp_register(esp, &dev->dev);
185 if (err)
186 goto fail_free_irq;
187
188 return 0;
189
190fail_free_irq:
191 free_irq(host->irq, esp);
192fail_unmap_command_block:
193 dma_free_coherent(esp->dev, 16,
194 esp->command_block,
195 esp->command_block_dma);
196fail_unmap_regs:
197fail_unlink:
198 scsi_host_put(host);
199fail:
200 return err;
266} 201}
267 202
268static void dma_advance_sg (struct scsi_cmnd *sp) 203static int __devexit esp_jazz_remove(struct platform_device *dev)
269{ 204{
270 sp->SCp.ptr = (char *)(sp->SCp.buffer->dma_address); 205 struct esp *esp = dev_get_drvdata(&dev->dev);
206 unsigned int irq = esp->host->irq;
207
208 scsi_esp_unregister(esp);
209
210 free_irq(irq, esp);
211 dma_free_coherent(esp->dev, 16,
212 esp->command_block,
213 esp->command_block_dma);
214
215 scsi_host_put(esp->host);
216
217 return 0;
271} 218}
272 219
273#define JAZZ_HDC_LED 0xe000d100 /* FIXME, find correct address */ 220static struct platform_driver esp_jazz_driver = {
221 .probe = esp_jazz_probe,
222 .remove = __devexit_p(esp_jazz_remove),
223 .driver = {
224 .name = "jazz_esp",
225 },
226};
274 227
275static void dma_led_off(struct NCR_ESP *esp) 228static int __init jazz_esp_init(void)
276{ 229{
277#if 0 230 return platform_driver_register(&esp_jazz_driver);
278 *(unsigned char *)JAZZ_HDC_LED = 0;
279#endif
280} 231}
281 232
282static void dma_led_on(struct NCR_ESP *esp) 233static void __exit jazz_esp_exit(void)
283{ 234{
284#if 0 235 platform_driver_unregister(&esp_jazz_driver);
285 *(unsigned char *)JAZZ_HDC_LED = 1;
286#endif
287} 236}
288 237
289static struct scsi_host_template driver_template = { 238MODULE_DESCRIPTION("JAZZ ESP SCSI driver");
290 .proc_name = "jazz_esp", 239MODULE_AUTHOR("Thomas Bogendoerfer (tsbogend@alpha.franken.de)");
291 .proc_info = esp_proc_info, 240MODULE_LICENSE("GPL");
292 .name = "ESP 100/100a/200", 241MODULE_VERSION(DRV_VERSION);
293 .detect = jazz_esp_detect, 242
294 .slave_alloc = esp_slave_alloc, 243module_init(jazz_esp_init);
295 .slave_destroy = esp_slave_destroy, 244module_exit(jazz_esp_exit);
296 .release = jazz_esp_release,
297 .info = esp_info,
298 .queuecommand = esp_queue,
299 .eh_abort_handler = esp_abort,
300 .eh_bus_reset_handler = esp_reset,
301 .can_queue = 7,
302 .this_id = 7,
303 .sg_tablesize = SG_ALL,
304 .cmd_per_lun = 1,
305 .use_clustering = DISABLE_CLUSTERING,
306};
307#include "scsi_module.c"
diff --git a/drivers/scsi/libsrp.c b/drivers/scsi/libsrp.c
index 5631c199a8eb..732446e63963 100644
--- a/drivers/scsi/libsrp.c
+++ b/drivers/scsi/libsrp.c
@@ -254,6 +254,7 @@ static int srp_indirect_data(struct scsi_cmnd *sc, struct srp_cmd *cmd,
254 254
255 sg_init_one(&dummy, md, id->table_desc.len); 255 sg_init_one(&dummy, md, id->table_desc.len);
256 sg_dma_address(&dummy) = token; 256 sg_dma_address(&dummy) = token;
257 sg_dma_len(&dummy) = id->table_desc.len;
257 err = rdma_io(sc, &dummy, 1, &id->table_desc, 1, DMA_TO_DEVICE, 258 err = rdma_io(sc, &dummy, 1, &id->table_desc, 1, DMA_TO_DEVICE,
258 id->table_desc.len); 259 id->table_desc.len);
259 if (err) { 260 if (err) {
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
index 7a812677ff8a..e2cf12ef3688 100644
--- a/drivers/scsi/megaraid/megaraid_sas.c
+++ b/drivers/scsi/megaraid/megaraid_sas.c
@@ -10,7 +10,7 @@
10 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
11 * 11 *
12 * FILE : megaraid_sas.c 12 * FILE : megaraid_sas.c
13 * Version : v00.00.03.10-rc1 13 * Version : v00.00.03.10-rc5
14 * 14 *
15 * Authors: 15 * Authors:
16 * (email-id : megaraidlinux@lsi.com) 16 * (email-id : megaraidlinux@lsi.com)
@@ -886,6 +886,7 @@ megasas_queue_command(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *))
886 goto out_return_cmd; 886 goto out_return_cmd;
887 887
888 cmd->scmd = scmd; 888 cmd->scmd = scmd;
889 scmd->SCp.ptr = (char *)cmd;
889 890
890 /* 891 /*
891 * Issue the command to the FW 892 * Issue the command to the FW
@@ -919,7 +920,7 @@ static int megasas_slave_configure(struct scsi_device *sdev)
919 * The RAID firmware may require extended timeouts. 920 * The RAID firmware may require extended timeouts.
920 */ 921 */
921 if (sdev->channel >= MEGASAS_MAX_PD_CHANNELS) 922 if (sdev->channel >= MEGASAS_MAX_PD_CHANNELS)
922 sdev->timeout = 90 * HZ; 923 sdev->timeout = MEGASAS_DEFAULT_CMD_TIMEOUT * HZ;
923 return 0; 924 return 0;
924} 925}
925 926
@@ -981,8 +982,8 @@ static int megasas_generic_reset(struct scsi_cmnd *scmd)
981 982
982 instance = (struct megasas_instance *)scmd->device->host->hostdata; 983 instance = (struct megasas_instance *)scmd->device->host->hostdata;
983 984
984 scmd_printk(KERN_NOTICE, scmd, "megasas: RESET -%ld cmd=%x\n", 985 scmd_printk(KERN_NOTICE, scmd, "megasas: RESET -%ld cmd=%x retries=%x\n",
985 scmd->serial_number, scmd->cmnd[0]); 986 scmd->serial_number, scmd->cmnd[0], scmd->retries);
986 987
987 if (instance->hw_crit_error) { 988 if (instance->hw_crit_error) {
988 printk(KERN_ERR "megasas: cannot recover from previous reset " 989 printk(KERN_ERR "megasas: cannot recover from previous reset "
@@ -1000,6 +1001,39 @@ static int megasas_generic_reset(struct scsi_cmnd *scmd)
1000} 1001}
1001 1002
1002/** 1003/**
1004 * megasas_reset_timer - quiesce the adapter if required
1005 * @scmd: scsi cmnd
1006 *
1007 * Sets the FW busy flag and reduces the host->can_queue if the
1008 * cmd has not been completed within the timeout period.
1009 */
1010static enum
1011scsi_eh_timer_return megasas_reset_timer(struct scsi_cmnd *scmd)
1012{
1013 struct megasas_cmd *cmd = (struct megasas_cmd *)scmd->SCp.ptr;
1014 struct megasas_instance *instance;
1015 unsigned long flags;
1016
1017 if (time_after(jiffies, scmd->jiffies_at_alloc +
1018 (MEGASAS_DEFAULT_CMD_TIMEOUT * 2) * HZ)) {
1019 return EH_NOT_HANDLED;
1020 }
1021
1022 instance = cmd->instance;
1023 if (!(instance->flag & MEGASAS_FW_BUSY)) {
1024 /* FW is busy, throttle IO */
1025 spin_lock_irqsave(instance->host->host_lock, flags);
1026
1027 instance->host->can_queue = 16;
1028 instance->last_time = jiffies;
1029 instance->flag |= MEGASAS_FW_BUSY;
1030
1031 spin_unlock_irqrestore(instance->host->host_lock, flags);
1032 }
1033 return EH_RESET_TIMER;
1034}
1035
1036/**
1003 * megasas_reset_device - Device reset handler entry point 1037 * megasas_reset_device - Device reset handler entry point
1004 */ 1038 */
1005static int megasas_reset_device(struct scsi_cmnd *scmd) 1039static int megasas_reset_device(struct scsi_cmnd *scmd)
@@ -1112,6 +1146,7 @@ static struct scsi_host_template megasas_template = {
1112 .eh_device_reset_handler = megasas_reset_device, 1146 .eh_device_reset_handler = megasas_reset_device,
1113 .eh_bus_reset_handler = megasas_reset_bus_host, 1147 .eh_bus_reset_handler = megasas_reset_bus_host,
1114 .eh_host_reset_handler = megasas_reset_bus_host, 1148 .eh_host_reset_handler = megasas_reset_bus_host,
1149 .eh_timed_out = megasas_reset_timer,
1115 .bios_param = megasas_bios_param, 1150 .bios_param = megasas_bios_param,
1116 .use_clustering = ENABLE_CLUSTERING, 1151 .use_clustering = ENABLE_CLUSTERING,
1117}; 1152};
@@ -1215,9 +1250,8 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
1215 int exception = 0; 1250 int exception = 0;
1216 struct megasas_header *hdr = &cmd->frame->hdr; 1251 struct megasas_header *hdr = &cmd->frame->hdr;
1217 1252
1218 if (cmd->scmd) { 1253 if (cmd->scmd)
1219 cmd->scmd->SCp.ptr = (char *)0; 1254 cmd->scmd->SCp.ptr = NULL;
1220 }
1221 1255
1222 switch (hdr->cmd) { 1256 switch (hdr->cmd) {
1223 1257
@@ -1806,6 +1840,7 @@ static void megasas_complete_cmd_dpc(unsigned long instance_addr)
1806 u32 context; 1840 u32 context;
1807 struct megasas_cmd *cmd; 1841 struct megasas_cmd *cmd;
1808 struct megasas_instance *instance = (struct megasas_instance *)instance_addr; 1842 struct megasas_instance *instance = (struct megasas_instance *)instance_addr;
1843 unsigned long flags;
1809 1844
1810 /* If we have already declared adapter dead, donot complete cmds */ 1845 /* If we have already declared adapter dead, donot complete cmds */
1811 if (instance->hw_crit_error) 1846 if (instance->hw_crit_error)
@@ -1828,6 +1863,22 @@ static void megasas_complete_cmd_dpc(unsigned long instance_addr)
1828 } 1863 }
1829 1864
1830 *instance->consumer = producer; 1865 *instance->consumer = producer;
1866
1867 /*
1868 * Check if we can restore can_queue
1869 */
1870 if (instance->flag & MEGASAS_FW_BUSY
1871 && time_after(jiffies, instance->last_time + 5 * HZ)
1872 && atomic_read(&instance->fw_outstanding) < 17) {
1873
1874 spin_lock_irqsave(instance->host->host_lock, flags);
1875 instance->flag &= ~MEGASAS_FW_BUSY;
1876 instance->host->can_queue =
1877 instance->max_fw_cmds - MEGASAS_INT_CMDS;
1878
1879 spin_unlock_irqrestore(instance->host->host_lock, flags);
1880 }
1881
1831} 1882}
1832 1883
1833/** 1884/**
@@ -2398,6 +2449,8 @@ megasas_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
2398 instance->init_id = MEGASAS_DEFAULT_INIT_ID; 2449 instance->init_id = MEGASAS_DEFAULT_INIT_ID;
2399 2450
2400 megasas_dbg_lvl = 0; 2451 megasas_dbg_lvl = 0;
2452 instance->flag = 0;
2453 instance->last_time = 0;
2401 2454
2402 /* 2455 /*
2403 * Initialize MFI Firmware 2456 * Initialize MFI Firmware
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h
index e862992ee377..4dffc918a414 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -18,9 +18,9 @@
18/* 18/*
19 * MegaRAID SAS Driver meta data 19 * MegaRAID SAS Driver meta data
20 */ 20 */
21#define MEGASAS_VERSION "00.00.03.10-rc1" 21#define MEGASAS_VERSION "00.00.03.10-rc5"
22#define MEGASAS_RELDATE "Feb 14, 2007" 22#define MEGASAS_RELDATE "May 17, 2007"
23#define MEGASAS_EXT_VERSION "Wed Feb 14 10:14:25 PST 2007" 23#define MEGASAS_EXT_VERSION "Thu May 17 10:09:32 PDT 2007"
24 24
25/* 25/*
26 * Device IDs 26 * Device IDs
@@ -539,6 +539,8 @@ struct megasas_ctrl_info {
539 539
540#define MEGASAS_DBG_LVL 1 540#define MEGASAS_DBG_LVL 1
541 541
542#define MEGASAS_FW_BUSY 1
543
542/* 544/*
543 * When SCSI mid-layer calls driver's reset routine, driver waits for 545 * When SCSI mid-layer calls driver's reset routine, driver waits for
544 * MEGASAS_RESET_WAIT_TIME seconds for all outstanding IO to complete. Note 546 * MEGASAS_RESET_WAIT_TIME seconds for all outstanding IO to complete. Note
@@ -549,8 +551,8 @@ struct megasas_ctrl_info {
549#define MEGASAS_RESET_WAIT_TIME 180 551#define MEGASAS_RESET_WAIT_TIME 180
550#define MEGASAS_INTERNAL_CMD_WAIT_TIME 180 552#define MEGASAS_INTERNAL_CMD_WAIT_TIME 180
551#define MEGASAS_RESET_NOTICE_INTERVAL 5 553#define MEGASAS_RESET_NOTICE_INTERVAL 5
552
553#define MEGASAS_IOCTL_CMD 0 554#define MEGASAS_IOCTL_CMD 0
555#define MEGASAS_DEFAULT_CMD_TIMEOUT 90
554 556
555/* 557/*
556 * FW reports the maximum of number of commands that it can accept (maximum 558 * FW reports the maximum of number of commands that it can accept (maximum
@@ -1073,7 +1075,6 @@ struct megasas_instance {
1073 struct megasas_register_set __iomem *reg_set; 1075 struct megasas_register_set __iomem *reg_set;
1074 1076
1075 s8 init_id; 1077 s8 init_id;
1076 u8 reserved[3];
1077 1078
1078 u16 max_num_sge; 1079 u16 max_num_sge;
1079 u16 max_fw_cmds; 1080 u16 max_fw_cmds;
@@ -1104,6 +1105,9 @@ struct megasas_instance {
1104 1105
1105 struct megasas_instance_template *instancet; 1106 struct megasas_instance_template *instancet;
1106 struct tasklet_struct isr_tasklet; 1107 struct tasklet_struct isr_tasklet;
1108
1109 u8 flag;
1110 unsigned long last_time;
1107}; 1111};
1108 1112
1109#define MEGASAS_IS_LOGICAL(scp) \ 1113#define MEGASAS_IS_LOGICAL(scp) \
diff --git a/drivers/scsi/pluto.c b/drivers/scsi/pluto.c
index 3b2e1a53e6e2..d953d43fe2e6 100644
--- a/drivers/scsi/pluto.c
+++ b/drivers/scsi/pluto.c
@@ -4,6 +4,7 @@
4 * 4 *
5 */ 5 */
6 6
7#include <linux/completion.h>
7#include <linux/kernel.h> 8#include <linux/kernel.h>
8#include <linux/delay.h> 9#include <linux/delay.h>
9#include <linux/types.h> 10#include <linux/types.h>
@@ -50,16 +51,10 @@ static struct ctrl_inquiry {
50} *fcs __initdata; 51} *fcs __initdata;
51static int fcscount __initdata = 0; 52static int fcscount __initdata = 0;
52static atomic_t fcss __initdata = ATOMIC_INIT(0); 53static atomic_t fcss __initdata = ATOMIC_INIT(0);
53DECLARE_MUTEX_LOCKED(fc_sem); 54static DECLARE_COMPLETION(fc_detect_complete);
54 55
55static int pluto_encode_addr(Scsi_Cmnd *SCpnt, u16 *addr, fc_channel *fc, fcp_cmnd *fcmd); 56static int pluto_encode_addr(Scsi_Cmnd *SCpnt, u16 *addr, fc_channel *fc, fcp_cmnd *fcmd);
56 57
57static void __init pluto_detect_timeout(unsigned long data)
58{
59 PLND(("Timeout\n"))
60 up(&fc_sem);
61}
62
63static void __init pluto_detect_done(Scsi_Cmnd *SCpnt) 58static void __init pluto_detect_done(Scsi_Cmnd *SCpnt)
64{ 59{
65 /* Do nothing */ 60 /* Do nothing */
@@ -69,7 +64,7 @@ static void __init pluto_detect_scsi_done(Scsi_Cmnd *SCpnt)
69{ 64{
70 PLND(("Detect done %08lx\n", (long)SCpnt)) 65 PLND(("Detect done %08lx\n", (long)SCpnt))
71 if (atomic_dec_and_test (&fcss)) 66 if (atomic_dec_and_test (&fcss))
72 up(&fc_sem); 67 complete(&fc_detect_complete);
73} 68}
74 69
75int pluto_slave_configure(struct scsi_device *device) 70int pluto_slave_configure(struct scsi_device *device)
@@ -96,7 +91,6 @@ int __init pluto_detect(struct scsi_host_template *tpnt)
96 int i, retry, nplutos; 91 int i, retry, nplutos;
97 fc_channel *fc; 92 fc_channel *fc;
98 struct scsi_device dev; 93 struct scsi_device dev;
99 DEFINE_TIMER(fc_timer, pluto_detect_timeout, 0, 0);
100 94
101 tpnt->proc_name = "pluto"; 95 tpnt->proc_name = "pluto";
102 fcscount = 0; 96 fcscount = 0;
@@ -187,15 +181,11 @@ int __init pluto_detect(struct scsi_host_template *tpnt)
187 } 181 }
188 } 182 }
189 183
190 fc_timer.expires = jiffies + 10 * HZ; 184 wait_for_completion_timeout(&fc_detect_complete, 10 * HZ);
191 add_timer(&fc_timer);
192
193 down(&fc_sem);
194 PLND(("Woken up\n")) 185 PLND(("Woken up\n"))
195 if (!atomic_read(&fcss)) 186 if (!atomic_read(&fcss))
196 break; /* All fc channels have answered us */ 187 break; /* All fc channels have answered us */
197 } 188 }
198 del_timer_sync(&fc_timer);
199 189
200 PLND(("Finished search\n")) 190 PLND(("Finished search\n"))
201 for (i = 0, nplutos = 0; i < fcscount; i++) { 191 for (i = 0, nplutos = 0; i < fcscount; i++) {
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
index ce63044b1ec8..18dd5cc4d7c6 100644
--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -209,6 +209,7 @@ static struct {
209 {"PIONEER", "CD-ROM DRM-602X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, 209 {"PIONEER", "CD-ROM DRM-602X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
210 {"PIONEER", "CD-ROM DRM-604X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, 210 {"PIONEER", "CD-ROM DRM-604X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
211 {"PIONEER", "CD-ROM DRM-624X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, 211 {"PIONEER", "CD-ROM DRM-624X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
212 {"Promise", "", NULL, BLIST_SPARSELUN},
212 {"REGAL", "CDC-4X", NULL, BLIST_MAX5LUN | BLIST_SINGLELUN}, 213 {"REGAL", "CDC-4X", NULL, BLIST_MAX5LUN | BLIST_SINGLELUN},
213 {"SanDisk", "ImageMate CF-SD1", NULL, BLIST_FORCELUN}, 214 {"SanDisk", "ImageMate CF-SD1", NULL, BLIST_FORCELUN},
214 {"SEAGATE", "ST34555N", "0930", BLIST_NOTQ}, /* Chokes on tagged INQUIRY */ 215 {"SEAGATE", "ST34555N", "0930", BLIST_NOTQ}, /* Chokes on tagged INQUIRY */
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 00e46662296f..3d8c9cb24f91 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1789,7 +1789,7 @@ static void sd_shutdown(struct device *dev)
1789static int sd_suspend(struct device *dev, pm_message_t mesg) 1789static int sd_suspend(struct device *dev, pm_message_t mesg)
1790{ 1790{
1791 struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); 1791 struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev);
1792 int ret; 1792 int ret = 0;
1793 1793
1794 if (!sdkp) 1794 if (!sdkp)
1795 return 0; /* this can happen */ 1795 return 0; /* this can happen */
@@ -1798,30 +1798,34 @@ static int sd_suspend(struct device *dev, pm_message_t mesg)
1798 sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n"); 1798 sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n");
1799 ret = sd_sync_cache(sdkp); 1799 ret = sd_sync_cache(sdkp);
1800 if (ret) 1800 if (ret)
1801 return ret; 1801 goto done;
1802 } 1802 }
1803 1803
1804 if (mesg.event == PM_EVENT_SUSPEND && 1804 if (mesg.event == PM_EVENT_SUSPEND &&
1805 sdkp->device->manage_start_stop) { 1805 sdkp->device->manage_start_stop) {
1806 sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n"); 1806 sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n");
1807 ret = sd_start_stop_device(sdkp, 0); 1807 ret = sd_start_stop_device(sdkp, 0);
1808 if (ret)
1809 return ret;
1810 } 1808 }
1811 1809
1812 return 0; 1810done:
1811 scsi_disk_put(sdkp);
1812 return ret;
1813} 1813}
1814 1814
1815static int sd_resume(struct device *dev) 1815static int sd_resume(struct device *dev)
1816{ 1816{
1817 struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); 1817 struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev);
1818 int ret = 0;
1818 1819
1819 if (!sdkp->device->manage_start_stop) 1820 if (!sdkp->device->manage_start_stop)
1820 return 0; 1821 goto done;
1821 1822
1822 sd_printk(KERN_NOTICE, sdkp, "Starting disk\n"); 1823 sd_printk(KERN_NOTICE, sdkp, "Starting disk\n");
1824 ret = sd_start_stop_device(sdkp, 1);
1823 1825
1824 return sd_start_stop_device(sdkp, 1); 1826done:
1827 scsi_disk_put(sdkp);
1828 return ret;
1825} 1829}
1826 1830
1827/** 1831/**
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index 69be1324b114..9ac83abc4028 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -32,11 +32,12 @@
32#include <scsi/scsi_cmnd.h> 32#include <scsi/scsi_cmnd.h>
33#include <scsi/scsi_host.h> 33#include <scsi/scsi_host.h>
34#include <scsi/scsi_tcq.h> 34#include <scsi/scsi_tcq.h>
35#include <scsi/scsi_dbg.h>
35 36
36#define DRV_NAME "stex" 37#define DRV_NAME "stex"
37#define ST_DRIVER_VERSION "3.1.0.1" 38#define ST_DRIVER_VERSION "3.6.0000.1"
38#define ST_VER_MAJOR 3 39#define ST_VER_MAJOR 3
39#define ST_VER_MINOR 1 40#define ST_VER_MINOR 6
40#define ST_OEM 0 41#define ST_OEM 0
41#define ST_BUILD_VER 1 42#define ST_BUILD_VER 1
42 43
@@ -113,10 +114,6 @@ enum {
113 SG_CF_64B = 0x40, /* 64 bit item */ 114 SG_CF_64B = 0x40, /* 64 bit item */
114 SG_CF_HOST = 0x20, /* sg in host memory */ 115 SG_CF_HOST = 0x20, /* sg in host memory */
115 116
116 ST_MAX_ARRAY_SUPPORTED = 16,
117 ST_MAX_TARGET_NUM = (ST_MAX_ARRAY_SUPPORTED+1),
118 ST_MAX_LUN_PER_TARGET = 16,
119
120 st_shasta = 0, 117 st_shasta = 0,
121 st_vsc = 1, 118 st_vsc = 1,
122 st_vsc1 = 2, 119 st_vsc1 = 2,
@@ -586,7 +583,7 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *))
586 u16 tag; 583 u16 tag;
587 host = cmd->device->host; 584 host = cmd->device->host;
588 id = cmd->device->id; 585 id = cmd->device->id;
589 lun = cmd->device->channel; /* firmware lun issue work around */ 586 lun = cmd->device->lun;
590 hba = (struct st_hba *) &host->hostdata[0]; 587 hba = (struct st_hba *) &host->hostdata[0];
591 588
592 switch (cmd->cmnd[0]) { 589 switch (cmd->cmnd[0]) {
@@ -605,8 +602,26 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *))
605 stex_invalid_field(cmd, done); 602 stex_invalid_field(cmd, done);
606 return 0; 603 return 0;
607 } 604 }
605 case REPORT_LUNS:
606 /*
607 * The shasta firmware does not report actual luns in the
608 * target, so fail the command to force sequential lun scan.
609 * Also, the console device does not support this command.
610 */
611 if (hba->cardtype == st_shasta || id == host->max_id - 1) {
612 stex_invalid_field(cmd, done);
613 return 0;
614 }
615 break;
616 case TEST_UNIT_READY:
617 if (id == host->max_id - 1) {
618 cmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
619 done(cmd);
620 return 0;
621 }
622 break;
608 case INQUIRY: 623 case INQUIRY:
609 if (id != ST_MAX_ARRAY_SUPPORTED) 624 if (id != host->max_id - 1)
610 break; 625 break;
611 if (lun == 0 && (cmd->cmnd[1] & INQUIRY_EVPD) == 0) { 626 if (lun == 0 && (cmd->cmnd[1] & INQUIRY_EVPD) == 0) {
612 stex_direct_copy(cmd, console_inq_page, 627 stex_direct_copy(cmd, console_inq_page,
@@ -624,7 +639,7 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *))
624 ver.oem = ST_OEM; 639 ver.oem = ST_OEM;
625 ver.build = ST_BUILD_VER; 640 ver.build = ST_BUILD_VER;
626 ver.signature[0] = PASSTHRU_SIGNATURE; 641 ver.signature[0] = PASSTHRU_SIGNATURE;
627 ver.console_id = ST_MAX_ARRAY_SUPPORTED; 642 ver.console_id = host->max_id - 1;
628 ver.host_no = hba->host->host_no; 643 ver.host_no = hba->host->host_no;
629 cmd->result = stex_direct_copy(cmd, &ver, sizeof(ver)) ? 644 cmd->result = stex_direct_copy(cmd, &ver, sizeof(ver)) ?
630 DID_OK << 16 | COMMAND_COMPLETE << 8 : 645 DID_OK << 16 | COMMAND_COMPLETE << 8 :
@@ -645,13 +660,8 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *))
645 660
646 req = stex_alloc_req(hba); 661 req = stex_alloc_req(hba);
647 662
648 if (hba->cardtype == st_yosemite) { 663 req->lun = lun;
649 req->lun = lun * (ST_MAX_TARGET_NUM - 1) + id; 664 req->target = id;
650 req->target = 0;
651 } else {
652 req->lun = lun;
653 req->target = id;
654 }
655 665
656 /* cdb */ 666 /* cdb */
657 memcpy(req->cdb, cmd->cmnd, STEX_CDB_LENGTH); 667 memcpy(req->cdb, cmd->cmnd, STEX_CDB_LENGTH);
@@ -767,18 +777,6 @@ static void stex_ys_commands(struct st_hba *hba,
767 ccb->srb_status = SRB_STATUS_SELECTION_TIMEOUT; 777 ccb->srb_status = SRB_STATUS_SELECTION_TIMEOUT;
768 else 778 else
769 ccb->srb_status = SRB_STATUS_SUCCESS; 779 ccb->srb_status = SRB_STATUS_SUCCESS;
770 } else if (ccb->cmd->cmnd[0] == REPORT_LUNS) {
771 u8 *report_lun_data = (u8 *)hba->copy_buffer;
772
773 count = STEX_EXTRA_SIZE;
774 stex_internal_copy(ccb->cmd, report_lun_data,
775 &count, ccb->sg_count, ST_FROM_CMD);
776 if (report_lun_data[2] || report_lun_data[3]) {
777 report_lun_data[2] = 0x00;
778 report_lun_data[3] = 0x08;
779 stex_internal_copy(ccb->cmd, report_lun_data,
780 &count, ccb->sg_count, ST_TO_CMD);
781 }
782 } 780 }
783} 781}
784 782
@@ -995,6 +993,11 @@ static int stex_abort(struct scsi_cmnd *cmd)
995 u32 data; 993 u32 data;
996 int result = SUCCESS; 994 int result = SUCCESS;
997 unsigned long flags; 995 unsigned long flags;
996
997 printk(KERN_INFO DRV_NAME
998 "(%s): aborting command\n", pci_name(hba->pdev));
999 scsi_print_command(cmd);
1000
998 base = hba->mmio_base; 1001 base = hba->mmio_base;
999 spin_lock_irqsave(host->host_lock, flags); 1002 spin_lock_irqsave(host->host_lock, flags);
1000 if (tag < host->can_queue && hba->ccb[tag].cmd == cmd) 1003 if (tag < host->can_queue && hba->ccb[tag].cmd == cmd)
@@ -1051,7 +1054,12 @@ static void stex_hard_reset(struct st_hba *hba)
1051 pci_read_config_byte(bus->self, PCI_BRIDGE_CONTROL, &pci_bctl); 1054 pci_read_config_byte(bus->self, PCI_BRIDGE_CONTROL, &pci_bctl);
1052 pci_bctl |= PCI_BRIDGE_CTL_BUS_RESET; 1055 pci_bctl |= PCI_BRIDGE_CTL_BUS_RESET;
1053 pci_write_config_byte(bus->self, PCI_BRIDGE_CONTROL, pci_bctl); 1056 pci_write_config_byte(bus->self, PCI_BRIDGE_CONTROL, pci_bctl);
1054 msleep(1); 1057
1058 /*
1059 * 1 ms may be enough for 8-port controllers. But 16-port controllers
1060 * require more time to finish bus reset. Use 100 ms here for safety
1061 */
1062 msleep(100);
1055 pci_bctl &= ~PCI_BRIDGE_CTL_BUS_RESET; 1063 pci_bctl &= ~PCI_BRIDGE_CTL_BUS_RESET;
1056 pci_write_config_byte(bus->self, PCI_BRIDGE_CONTROL, pci_bctl); 1064 pci_write_config_byte(bus->self, PCI_BRIDGE_CONTROL, pci_bctl);
1057 1065
@@ -1075,6 +1083,10 @@ static int stex_reset(struct scsi_cmnd *cmd)
1075 unsigned long before; 1083 unsigned long before;
1076 hba = (struct st_hba *) &cmd->device->host->hostdata[0]; 1084 hba = (struct st_hba *) &cmd->device->host->hostdata[0];
1077 1085
1086 printk(KERN_INFO DRV_NAME
1087 "(%s): resetting host\n", pci_name(hba->pdev));
1088 scsi_print_command(cmd);
1089
1078 hba->mu_status = MU_STATE_RESETTING; 1090 hba->mu_status = MU_STATE_RESETTING;
1079 1091
1080 if (hba->cardtype == st_shasta) 1092 if (hba->cardtype == st_shasta)
@@ -1194,7 +1206,7 @@ stex_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1194 goto out_scsi_host_put; 1206 goto out_scsi_host_put;
1195 } 1207 }
1196 1208
1197 hba->mmio_base = ioremap(pci_resource_start(pdev, 0), 1209 hba->mmio_base = ioremap_nocache(pci_resource_start(pdev, 0),
1198 pci_resource_len(pdev, 0)); 1210 pci_resource_len(pdev, 0));
1199 if ( !hba->mmio_base) { 1211 if ( !hba->mmio_base) {
1200 printk(KERN_ERR DRV_NAME "(%s): memory map failed\n", 1212 printk(KERN_ERR DRV_NAME "(%s): memory map failed\n",
@@ -1229,12 +1241,18 @@ stex_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1229 hba->copy_buffer = hba->dma_mem + MU_BUFFER_SIZE; 1241 hba->copy_buffer = hba->dma_mem + MU_BUFFER_SIZE;
1230 hba->mu_status = MU_STATE_STARTING; 1242 hba->mu_status = MU_STATE_STARTING;
1231 1243
1232 /* firmware uses id/lun pair for a logical drive, but lun would be 1244 if (hba->cardtype == st_shasta) {
1233 always 0 if CONFIG_SCSI_MULTI_LUN not configured, so we use 1245 host->max_lun = 8;
1234 channel to map lun here */ 1246 host->max_id = 16 + 1;
1235 host->max_channel = ST_MAX_LUN_PER_TARGET - 1; 1247 } else if (hba->cardtype == st_yosemite) {
1236 host->max_id = ST_MAX_TARGET_NUM; 1248 host->max_lun = 128;
1237 host->max_lun = 1; 1249 host->max_id = 1 + 1;
1250 } else {
1251 /* st_vsc and st_vsc1 */
1252 host->max_lun = 1;
1253 host->max_id = 128 + 1;
1254 }
1255 host->max_channel = 0;
1238 host->unique_id = host->host_no; 1256 host->unique_id = host->host_no;
1239 host->max_cmd_len = STEX_CDB_LENGTH; 1257 host->max_cmd_len = STEX_CDB_LENGTH;
1240 1258
diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c
index 1a9a24b82636..00d1255e4c12 100644
--- a/drivers/serial/amba-pl010.c
+++ b/drivers/serial/amba-pl010.c
@@ -167,8 +167,9 @@ static void pl010_rx_chars(struct uart_amba_port *uap)
167 ignore_char: 167 ignore_char:
168 status = readb(uap->port.membase + UART01x_FR); 168 status = readb(uap->port.membase + UART01x_FR);
169 } 169 }
170 spin_unlock(&port->lock);
170 tty_flip_buffer_push(tty); 171 tty_flip_buffer_push(tty);
171 return; 172 spin_lock(&port->lock);
172} 173}
173 174
174static void pl010_tx_chars(struct uart_amba_port *uap) 175static void pl010_tx_chars(struct uart_amba_port *uap)
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
index 44639e71372a..954073c6ce3a 100644
--- a/drivers/serial/amba-pl011.c
+++ b/drivers/serial/amba-pl011.c
@@ -153,8 +153,9 @@ static void pl011_rx_chars(struct uart_amba_port *uap)
153 ignore_char: 153 ignore_char:
154 status = readw(uap->port.membase + UART01x_FR); 154 status = readw(uap->port.membase + UART01x_FR);
155 } 155 }
156 spin_unlock(&uap->port.lock);
156 tty_flip_buffer_push(tty); 157 tty_flip_buffer_push(tty);
157 return; 158 spin_lock(&uap->port.lock);
158} 159}
159 160
160static void pl011_tx_chars(struct uart_amba_port *uap) 161static void pl011_tx_chars(struct uart_amba_port *uap)
diff --git a/drivers/serial/serial_ks8695.c b/drivers/serial/serial_ks8695.c
index 698763b28ddd..8721afe1ae4f 100644
--- a/drivers/serial/serial_ks8695.c
+++ b/drivers/serial/serial_ks8695.c
@@ -589,7 +589,7 @@ static int __init ks8695_console_setup(struct console *co, char *options)
589 return uart_set_options(port, co, baud, parity, bits, flow); 589 return uart_set_options(port, co, baud, parity, bits, flow);
590} 590}
591 591
592extern struct uart_driver ks8695_reg; 592static struct uart_driver ks8695_reg;
593 593
594static struct console ks8695_console = { 594static struct console ks8695_console = {
595 .name = SERIAL_KS8695_DEVNAME, 595 .name = SERIAL_KS8695_DEVNAME,
diff --git a/drivers/serial/suncore.c b/drivers/serial/suncore.c
index e35d9ab359f1..b45ba5392dd3 100644
--- a/drivers/serial/suncore.c
+++ b/drivers/serial/suncore.c
@@ -30,9 +30,9 @@ void
30sunserial_console_termios(struct console *con) 30sunserial_console_termios(struct console *con)
31{ 31{
32 char mode[16], buf[16], *s; 32 char mode[16], buf[16], *s;
33 char *mode_prop = "ttyX-mode"; 33 char mode_prop[] = "ttyX-mode";
34 char *cd_prop = "ttyX-ignore-cd"; 34 char cd_prop[] = "ttyX-ignore-cd";
35 char *dtr_prop = "ttyX-rts-dtr-off"; 35 char dtr_prop[] = "ttyX-rts-dtr-off";
36 char *ssp_console_modes_prop = "ssp-console-modes"; 36 char *ssp_console_modes_prop = "ssp-console-modes";
37 int baud, bits, stop, cflag; 37 int baud, bits, stop, cflag;
38 char parity; 38 char parity;
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c
index 0985193dc57d..15b6e1cb040b 100644
--- a/drivers/serial/sunzilog.c
+++ b/drivers/serial/sunzilog.c
@@ -1239,7 +1239,7 @@ static inline struct console *SUNZILOG_CONSOLE(void)
1239#define SUNZILOG_CONSOLE() (NULL) 1239#define SUNZILOG_CONSOLE() (NULL)
1240#endif 1240#endif
1241 1241
1242static void __init sunzilog_init_kbdms(struct uart_sunzilog_port *up, int channel) 1242static void __devinit sunzilog_init_kbdms(struct uart_sunzilog_port *up, int channel)
1243{ 1243{
1244 int baud, brg; 1244 int baud, brg;
1245 1245
@@ -1259,7 +1259,7 @@ static void __init sunzilog_init_kbdms(struct uart_sunzilog_port *up, int channe
1259} 1259}
1260 1260
1261#ifdef CONFIG_SERIO 1261#ifdef CONFIG_SERIO
1262static void __init sunzilog_register_serio(struct uart_sunzilog_port *up) 1262static void __devinit sunzilog_register_serio(struct uart_sunzilog_port *up)
1263{ 1263{
1264 struct serio *serio = &up->serio; 1264 struct serio *serio = &up->serio;
1265 1265
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index e277258df382..8969e42434b9 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1681,7 +1681,7 @@ void usb_remove_hcd(struct usb_hcd *hcd)
1681 spin_unlock_irq (&hcd_root_hub_lock); 1681 spin_unlock_irq (&hcd_root_hub_lock);
1682 1682
1683#ifdef CONFIG_PM 1683#ifdef CONFIG_PM
1684 flush_workqueue(ksuspend_usb_wq); 1684 cancel_work_sync(&hcd->wakeup_work);
1685#endif 1685#endif
1686 1686
1687 mutex_lock(&usb_bus_list_lock); 1687 mutex_lock(&usb_bus_list_lock);
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index caaa46f2dec7..24f10a19dbdb 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1158,6 +1158,30 @@ static void release_address(struct usb_device *udev)
1158 } 1158 }
1159} 1159}
1160 1160
1161#ifdef CONFIG_USB_SUSPEND
1162
1163static void usb_stop_pm(struct usb_device *udev)
1164{
1165 /* Synchronize with the ksuspend thread to prevent any more
1166 * autosuspend requests from being submitted, and decrement
1167 * the parent's count of unsuspended children.
1168 */
1169 usb_pm_lock(udev);
1170 if (udev->parent && !udev->discon_suspended)
1171 usb_autosuspend_device(udev->parent);
1172 usb_pm_unlock(udev);
1173
1174 /* Stop any autosuspend requests already submitted */
1175 cancel_rearming_delayed_work(&udev->autosuspend);
1176}
1177
1178#else
1179
1180static inline void usb_stop_pm(struct usb_device *udev)
1181{ }
1182
1183#endif
1184
1161/** 1185/**
1162 * usb_disconnect - disconnect a device (usbcore-internal) 1186 * usb_disconnect - disconnect a device (usbcore-internal)
1163 * @pdev: pointer to device being disconnected 1187 * @pdev: pointer to device being disconnected
@@ -1224,13 +1248,7 @@ void usb_disconnect(struct usb_device **pdev)
1224 *pdev = NULL; 1248 *pdev = NULL;
1225 spin_unlock_irq(&device_state_lock); 1249 spin_unlock_irq(&device_state_lock);
1226 1250
1227 /* Decrement the parent's count of unsuspended children */ 1251 usb_stop_pm(udev);
1228 if (udev->parent) {
1229 usb_pm_lock(udev);
1230 if (!udev->discon_suspended)
1231 usb_autosuspend_device(udev->parent);
1232 usb_pm_unlock(udev);
1233 }
1234 1252
1235 put_device(&udev->dev); 1253 put_device(&udev->dev);
1236} 1254}
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 80627b6a2bf9..4a6299bd0047 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -184,10 +184,6 @@ static void usb_release_dev(struct device *dev)
184 184
185 udev = to_usb_device(dev); 185 udev = to_usb_device(dev);
186 186
187#ifdef CONFIG_USB_SUSPEND
188 cancel_delayed_work(&udev->autosuspend);
189 flush_workqueue(ksuspend_usb_wq);
190#endif
191 usb_destroy_configuration(udev); 187 usb_destroy_configuration(udev);
192 usb_put_hcd(bus_to_hcd(udev->bus)); 188 usb_put_hcd(bus_to_hcd(udev->bus));
193 kfree(udev->product); 189 kfree(udev->product);
diff --git a/drivers/video/neofb.c b/drivers/video/neofb.c
index bd30aba242d0..731d7a5c5aa2 100644
--- a/drivers/video/neofb.c
+++ b/drivers/video/neofb.c
@@ -1286,34 +1286,36 @@ static int neofb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
1286 if (regno >= fb->cmap.len || regno > 255) 1286 if (regno >= fb->cmap.len || regno > 255)
1287 return -EINVAL; 1287 return -EINVAL;
1288 1288
1289 switch (fb->var.bits_per_pixel) { 1289 if (fb->var.bits_per_pixel <= 8) {
1290 case 8:
1291 outb(regno, 0x3c8); 1290 outb(regno, 0x3c8);
1292 1291
1293 outb(red >> 10, 0x3c9); 1292 outb(red >> 10, 0x3c9);
1294 outb(green >> 10, 0x3c9); 1293 outb(green >> 10, 0x3c9);
1295 outb(blue >> 10, 0x3c9); 1294 outb(blue >> 10, 0x3c9);
1296 break; 1295 } else if (regno < 16) {
1297 case 16: 1296 switch (fb->var.bits_per_pixel) {
1298 ((u32 *) fb->pseudo_palette)[regno] = 1297 case 16:
1298 ((u32 *) fb->pseudo_palette)[regno] =
1299 ((red & 0xf800)) | ((green & 0xfc00) >> 5) | 1299 ((red & 0xf800)) | ((green & 0xfc00) >> 5) |
1300 ((blue & 0xf800) >> 11); 1300 ((blue & 0xf800) >> 11);
1301 break; 1301 break;
1302 case 24: 1302 case 24:
1303 ((u32 *) fb->pseudo_palette)[regno] = 1303 ((u32 *) fb->pseudo_palette)[regno] =
1304 ((red & 0xff00) << 8) | ((green & 0xff00)) | 1304 ((red & 0xff00) << 8) | ((green & 0xff00)) |
1305 ((blue & 0xff00) >> 8); 1305 ((blue & 0xff00) >> 8);
1306 break; 1306 break;
1307#ifdef NO_32BIT_SUPPORT_YET 1307#ifdef NO_32BIT_SUPPORT_YET
1308 case 32: 1308 case 32:
1309 ((u32 *) fb->pseudo_palette)[regno] = 1309 ((u32 *) fb->pseudo_palette)[regno] =
1310 ((transp & 0xff00) << 16) | ((red & 0xff00) << 8) | 1310 ((transp & 0xff00) << 16) | ((red & 0xff00) << 8) |
1311 ((green & 0xff00)) | ((blue & 0xff00) >> 8); 1311 ((green & 0xff00)) | ((blue & 0xff00) >> 8);
1312 break; 1312 break;
1313#endif 1313#endif
1314 default: 1314 default:
1315 return 1; 1315 return 1;
1316 }
1316 } 1317 }
1318
1317 return 0; 1319 return 0;
1318} 1320}
1319 1321