aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/DAC960.c11
-rw-r--r--drivers/block/Kconfig11
-rw-r--r--drivers/block/aoe/aoeblk.c77
-rw-r--r--drivers/block/aoe/aoechr.c7
-rw-r--r--drivers/block/cciss.c42
-rw-r--r--drivers/block/cciss_scsi.c14
-rw-r--r--drivers/block/cciss_scsi.h14
-rw-r--r--drivers/block/cpqarray.c36
-rw-r--r--drivers/block/floppy.c16
-rw-r--r--drivers/block/loop.c2
-rw-r--r--drivers/block/nbd.c26
-rw-r--r--drivers/block/paride/pf.c25
-rw-r--r--drivers/block/paride/pg.c6
-rw-r--r--drivers/block/paride/pt.c14
-rw-r--r--drivers/block/pktcdvd.c38
-rw-r--r--drivers/block/ps3disk.c12
-rw-r--r--drivers/block/rd.c13
-rw-r--r--drivers/block/sunvdc.c13
-rw-r--r--drivers/block/sx8.c58
-rw-r--r--drivers/block/ub.c33
-rw-r--r--drivers/block/umem.c240
-rw-r--r--drivers/block/viodasd.c15
-rw-r--r--drivers/block/virtio_blk.c10
-rw-r--r--drivers/block/xen-blkfront.c10
-rw-r--r--drivers/block/xsysace.c9
25 files changed, 316 insertions, 436 deletions
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c
index 9030c373ce67..cd03473f3547 100644
--- a/drivers/block/DAC960.c
+++ b/drivers/block/DAC960.c
@@ -3455,19 +3455,12 @@ static inline bool DAC960_ProcessCompletedRequest(DAC960_Command_T *Command,
3455 bool SuccessfulIO) 3455 bool SuccessfulIO)
3456{ 3456{
3457 struct request *Request = Command->Request; 3457 struct request *Request = Command->Request;
3458 int UpToDate; 3458 int Error = SuccessfulIO ? 0 : -EIO;
3459
3460 UpToDate = 0;
3461 if (SuccessfulIO)
3462 UpToDate = 1;
3463 3459
3464 pci_unmap_sg(Command->Controller->PCIDevice, Command->cmd_sglist, 3460 pci_unmap_sg(Command->Controller->PCIDevice, Command->cmd_sglist,
3465 Command->SegmentCount, Command->DmaDirection); 3461 Command->SegmentCount, Command->DmaDirection);
3466 3462
3467 if (!end_that_request_first(Request, UpToDate, Command->BlockCount)) { 3463 if (!__blk_end_request(Request, Error, Command->BlockCount << 9)) {
3468 add_disk_randomness(Request->rq_disk);
3469 end_that_request_last(Request, UpToDate);
3470
3471 if (Command->Completion) { 3464 if (Command->Completion) {
3472 complete(Command->Completion); 3465 complete(Command->Completion);
3473 Command->Completion = NULL; 3466 Command->Completion = NULL;
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index 4d0119ea9e35..f2122855d4ec 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -105,6 +105,17 @@ config PARIDE
105 "MicroSolutions backpack protocol", "DataStor Commuter protocol" 105 "MicroSolutions backpack protocol", "DataStor Commuter protocol"
106 etc.). 106 etc.).
107 107
108config GDROM
109 tristate "SEGA Dreamcast GD-ROM drive"
110 depends on SH_DREAMCAST
111 help
112 A standard SEGA Dreamcast comes with a modified CD ROM drive called a
113 "GD-ROM" by SEGA to signify it is capable of reading special disks
114 with up to 1 GB of data. This drive will also read standard CD ROM
115 disks. Select this option to access any disks in your GD ROM drive.
116 Most users will want to say "Y" here.
117 You can also build this as a module which will be called gdrom.ko
118
108source "drivers/block/paride/Kconfig" 119source "drivers/block/paride/Kconfig"
109 120
110config BLK_CPQ_DA 121config BLK_CPQ_DA
diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
index b1d00ef6659c..826d12381e21 100644
--- a/drivers/block/aoe/aoeblk.c
+++ b/drivers/block/aoe/aoeblk.c
@@ -6,6 +6,7 @@
6 6
7#include <linux/hdreg.h> 7#include <linux/hdreg.h>
8#include <linux/blkdev.h> 8#include <linux/blkdev.h>
9#include <linux/backing-dev.h>
9#include <linux/fs.h> 10#include <linux/fs.h>
10#include <linux/ioctl.h> 11#include <linux/ioctl.h>
11#include <linux/genhd.h> 12#include <linux/genhd.h>
@@ -14,8 +15,10 @@
14 15
15static struct kmem_cache *buf_pool_cache; 16static struct kmem_cache *buf_pool_cache;
16 17
17static ssize_t aoedisk_show_state(struct gendisk * disk, char *page) 18static ssize_t aoedisk_show_state(struct device *dev,
19 struct device_attribute *attr, char *page)
18{ 20{
21 struct gendisk *disk = dev_to_disk(dev);
19 struct aoedev *d = disk->private_data; 22 struct aoedev *d = disk->private_data;
20 23
21 return snprintf(page, PAGE_SIZE, 24 return snprintf(page, PAGE_SIZE,
@@ -25,50 +28,47 @@ static ssize_t aoedisk_show_state(struct gendisk * disk, char *page)
25 (d->nopen && !(d->flags & DEVFL_UP)) ? ",closewait" : ""); 28 (d->nopen && !(d->flags & DEVFL_UP)) ? ",closewait" : "");
26 /* I'd rather see nopen exported so we can ditch closewait */ 29 /* I'd rather see nopen exported so we can ditch closewait */
27} 30}
28static ssize_t aoedisk_show_mac(struct gendisk * disk, char *page) 31static ssize_t aoedisk_show_mac(struct device *dev,
32 struct device_attribute *attr, char *page)
29{ 33{
34 struct gendisk *disk = dev_to_disk(dev);
30 struct aoedev *d = disk->private_data; 35 struct aoedev *d = disk->private_data;
31 36
32 return snprintf(page, PAGE_SIZE, "%012llx\n", 37 return snprintf(page, PAGE_SIZE, "%012llx\n",
33 (unsigned long long)mac_addr(d->addr)); 38 (unsigned long long)mac_addr(d->addr));
34} 39}
35static ssize_t aoedisk_show_netif(struct gendisk * disk, char *page) 40static ssize_t aoedisk_show_netif(struct device *dev,
41 struct device_attribute *attr, char *page)
36{ 42{
43 struct gendisk *disk = dev_to_disk(dev);
37 struct aoedev *d = disk->private_data; 44 struct aoedev *d = disk->private_data;
38 45
39 return snprintf(page, PAGE_SIZE, "%s\n", d->ifp->name); 46 return snprintf(page, PAGE_SIZE, "%s\n", d->ifp->name);
40} 47}
41/* firmware version */ 48/* firmware version */
42static ssize_t aoedisk_show_fwver(struct gendisk * disk, char *page) 49static ssize_t aoedisk_show_fwver(struct device *dev,
50 struct device_attribute *attr, char *page)
43{ 51{
52 struct gendisk *disk = dev_to_disk(dev);
44 struct aoedev *d = disk->private_data; 53 struct aoedev *d = disk->private_data;
45 54
46 return snprintf(page, PAGE_SIZE, "0x%04x\n", (unsigned int) d->fw_ver); 55 return snprintf(page, PAGE_SIZE, "0x%04x\n", (unsigned int) d->fw_ver);
47} 56}
48 57
49static struct disk_attribute disk_attr_state = { 58static DEVICE_ATTR(state, S_IRUGO, aoedisk_show_state, NULL);
50 .attr = {.name = "state", .mode = S_IRUGO }, 59static DEVICE_ATTR(mac, S_IRUGO, aoedisk_show_mac, NULL);
51 .show = aoedisk_show_state 60static DEVICE_ATTR(netif, S_IRUGO, aoedisk_show_netif, NULL);
52}; 61static struct device_attribute dev_attr_firmware_version = {
53static struct disk_attribute disk_attr_mac = { 62 .attr = { .name = "firmware-version", .mode = S_IRUGO, .owner = THIS_MODULE },
54 .attr = {.name = "mac", .mode = S_IRUGO }, 63 .show = aoedisk_show_fwver,
55 .show = aoedisk_show_mac
56};
57static struct disk_attribute disk_attr_netif = {
58 .attr = {.name = "netif", .mode = S_IRUGO },
59 .show = aoedisk_show_netif
60};
61static struct disk_attribute disk_attr_fwver = {
62 .attr = {.name = "firmware-version", .mode = S_IRUGO },
63 .show = aoedisk_show_fwver
64}; 64};
65 65
66static struct attribute *aoe_attrs[] = { 66static struct attribute *aoe_attrs[] = {
67 &disk_attr_state.attr, 67 &dev_attr_state.attr,
68 &disk_attr_mac.attr, 68 &dev_attr_mac.attr,
69 &disk_attr_netif.attr, 69 &dev_attr_netif.attr,
70 &disk_attr_fwver.attr, 70 &dev_attr_firmware_version.attr,
71 NULL 71 NULL,
72}; 72};
73 73
74static const struct attribute_group attr_group = { 74static const struct attribute_group attr_group = {
@@ -78,12 +78,12 @@ static const struct attribute_group attr_group = {
78static int 78static int
79aoedisk_add_sysfs(struct aoedev *d) 79aoedisk_add_sysfs(struct aoedev *d)
80{ 80{
81 return sysfs_create_group(&d->gd->kobj, &attr_group); 81 return sysfs_create_group(&d->gd->dev.kobj, &attr_group);
82} 82}
83void 83void
84aoedisk_rm_sysfs(struct aoedev *d) 84aoedisk_rm_sysfs(struct aoedev *d)
85{ 85{
86 sysfs_remove_group(&d->gd->kobj, &attr_group); 86 sysfs_remove_group(&d->gd->dev.kobj, &attr_group);
87} 87}
88 88
89static int 89static int
@@ -210,25 +210,20 @@ aoeblk_gdalloc(void *vp)
210 if (gd == NULL) { 210 if (gd == NULL) {
211 printk(KERN_ERR "aoe: cannot allocate disk structure for %ld.%ld\n", 211 printk(KERN_ERR "aoe: cannot allocate disk structure for %ld.%ld\n",
212 d->aoemajor, d->aoeminor); 212 d->aoemajor, d->aoeminor);
213 spin_lock_irqsave(&d->lock, flags); 213 goto err;
214 d->flags &= ~DEVFL_GDALLOC;
215 spin_unlock_irqrestore(&d->lock, flags);
216 return;
217 } 214 }
218 215
219 d->bufpool = mempool_create_slab_pool(MIN_BUFS, buf_pool_cache); 216 d->bufpool = mempool_create_slab_pool(MIN_BUFS, buf_pool_cache);
220 if (d->bufpool == NULL) { 217 if (d->bufpool == NULL) {
221 printk(KERN_ERR "aoe: cannot allocate bufpool for %ld.%ld\n", 218 printk(KERN_ERR "aoe: cannot allocate bufpool for %ld.%ld\n",
222 d->aoemajor, d->aoeminor); 219 d->aoemajor, d->aoeminor);
223 put_disk(gd); 220 goto err_disk;
224 spin_lock_irqsave(&d->lock, flags);
225 d->flags &= ~DEVFL_GDALLOC;
226 spin_unlock_irqrestore(&d->lock, flags);
227 return;
228 } 221 }
229 222
230 spin_lock_irqsave(&d->lock, flags);
231 blk_queue_make_request(&d->blkq, aoeblk_make_request); 223 blk_queue_make_request(&d->blkq, aoeblk_make_request);
224 if (bdi_init(&d->blkq.backing_dev_info))
225 goto err_mempool;
226 spin_lock_irqsave(&d->lock, flags);
232 gd->major = AOE_MAJOR; 227 gd->major = AOE_MAJOR;
233 gd->first_minor = d->sysminor * AOE_PARTITIONS; 228 gd->first_minor = d->sysminor * AOE_PARTITIONS;
234 gd->fops = &aoe_bdops; 229 gd->fops = &aoe_bdops;
@@ -246,6 +241,16 @@ aoeblk_gdalloc(void *vp)
246 241
247 add_disk(gd); 242 add_disk(gd);
248 aoedisk_add_sysfs(d); 243 aoedisk_add_sysfs(d);
244 return;
245
246err_mempool:
247 mempool_destroy(d->bufpool);
248err_disk:
249 put_disk(gd);
250err:
251 spin_lock_irqsave(&d->lock, flags);
252 d->flags &= ~DEVFL_GDALLOC;
253 spin_unlock_irqrestore(&d->lock, flags);
249} 254}
250 255
251void 256void
diff --git a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c
index 39e563ea0878..d5480e34cb22 100644
--- a/drivers/block/aoe/aoechr.c
+++ b/drivers/block/aoe/aoechr.c
@@ -259,9 +259,8 @@ aoechr_init(void)
259 return PTR_ERR(aoe_class); 259 return PTR_ERR(aoe_class);
260 } 260 }
261 for (i = 0; i < ARRAY_SIZE(chardevs); ++i) 261 for (i = 0; i < ARRAY_SIZE(chardevs); ++i)
262 class_device_create(aoe_class, NULL, 262 device_create(aoe_class, NULL,
263 MKDEV(AOE_MAJOR, chardevs[i].minor), 263 MKDEV(AOE_MAJOR, chardevs[i].minor), chardevs[i].name);
264 NULL, chardevs[i].name);
265 264
266 return 0; 265 return 0;
267} 266}
@@ -272,7 +271,7 @@ aoechr_exit(void)
272 int i; 271 int i;
273 272
274 for (i = 0; i < ARRAY_SIZE(chardevs); ++i) 273 for (i = 0; i < ARRAY_SIZE(chardevs); ++i)
275 class_device_destroy(aoe_class, MKDEV(AOE_MAJOR, chardevs[i].minor)); 274 device_destroy(aoe_class, MKDEV(AOE_MAJOR, chardevs[i].minor));
276 class_destroy(aoe_class); 275 class_destroy(aoe_class);
277 unregister_chrdev(AOE_MAJOR, "aoechr"); 276 unregister_chrdev(AOE_MAJOR, "aoechr");
278} 277}
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 5a6fe17fc638..855ce8e5efba 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1,20 +1,20 @@
1/* 1/*
2 * Disk Array driver for HP SA 5xxx and 6xxx Controllers 2 * Disk Array driver for HP Smart Array controllers.
3 * Copyright 2000, 2006 Hewlett-Packard Development Company, L.P. 3 * (C) Copyright 2000, 2007 Hewlett-Packard Development Company, L.P.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or 7 * the Free Software Foundation; version 2 of the License.
8 * (at your option) any later version.
9 * 8 *
10 * This program is distributed in the hope that it will be useful, 9 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or 11 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * NON INFRINGEMENT. See the GNU General Public License for more details. 12 * General Public License for more details.
14 * 13 *
15 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 * 02111-1307, USA.
18 * 18 *
19 * Questions/Comments/Bugfixes to iss_storagedev@hp.com 19 * Questions/Comments/Bugfixes to iss_storagedev@hp.com
20 * 20 *
@@ -1187,17 +1187,6 @@ static int cciss_ioctl(struct inode *inode, struct file *filep,
1187 } 1187 }
1188} 1188}
1189 1189
1190static inline void complete_buffers(struct bio *bio, int status)
1191{
1192 while (bio) {
1193 struct bio *xbh = bio->bi_next;
1194
1195 bio->bi_next = NULL;
1196 bio_endio(bio, status ? 0 : -EIO);
1197 bio = xbh;
1198 }
1199}
1200
1201static void cciss_check_queues(ctlr_info_t *h) 1190static void cciss_check_queues(ctlr_info_t *h)
1202{ 1191{
1203 int start_queue = h->next_to_run; 1192 int start_queue = h->next_to_run;
@@ -1263,21 +1252,14 @@ static void cciss_softirq_done(struct request *rq)
1263 pci_unmap_page(h->pdev, temp64.val, cmd->SG[i].Len, ddir); 1252 pci_unmap_page(h->pdev, temp64.val, cmd->SG[i].Len, ddir);
1264 } 1253 }
1265 1254
1266 complete_buffers(rq->bio, (rq->errors == 0));
1267
1268 if (blk_fs_request(rq)) {
1269 const int rw = rq_data_dir(rq);
1270
1271 disk_stat_add(rq->rq_disk, sectors[rw], rq->nr_sectors);
1272 }
1273
1274#ifdef CCISS_DEBUG 1255#ifdef CCISS_DEBUG
1275 printk("Done with %p\n", rq); 1256 printk("Done with %p\n", rq);
1276#endif /* CCISS_DEBUG */ 1257#endif /* CCISS_DEBUG */
1277 1258
1278 add_disk_randomness(rq->rq_disk); 1259 if (blk_end_request(rq, (rq->errors == 0) ? 0 : -EIO, blk_rq_bytes(rq)))
1260 BUG();
1261
1279 spin_lock_irqsave(&h->lock, flags); 1262 spin_lock_irqsave(&h->lock, flags);
1280 end_that_request_last(rq, (rq->errors == 0));
1281 cmd_free(h, cmd, 1); 1263 cmd_free(h, cmd, 1);
1282 cciss_check_queues(h); 1264 cciss_check_queues(h);
1283 spin_unlock_irqrestore(&h->lock, flags); 1265 spin_unlock_irqrestore(&h->lock, flags);
@@ -2542,9 +2524,7 @@ after_error_processing:
2542 resend_cciss_cmd(h, cmd); 2524 resend_cciss_cmd(h, cmd);
2543 return; 2525 return;
2544 } 2526 }
2545 cmd->rq->data_len = 0;
2546 cmd->rq->completion_data = cmd; 2527 cmd->rq->completion_data = cmd;
2547 blk_add_trace_rq(cmd->rq->q, cmd->rq, BLK_TA_COMPLETE);
2548 blk_complete_request(cmd->rq); 2528 blk_complete_request(cmd->rq);
2549} 2529}
2550 2530
@@ -2927,7 +2907,7 @@ default_int_mode:
2927 return; 2907 return;
2928} 2908}
2929 2909
2930static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) 2910static int __devinit cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev)
2931{ 2911{
2932 ushort subsystem_vendor_id, subsystem_device_id, command; 2912 ushort subsystem_vendor_id, subsystem_device_id, command;
2933 __u32 board_id, scratchpad = 0; 2913 __u32 board_id, scratchpad = 0;
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c
index 4aca7ddfdddf..63ee6c076cb3 100644
--- a/drivers/block/cciss_scsi.c
+++ b/drivers/block/cciss_scsi.c
@@ -1,20 +1,20 @@
1/* 1/*
2 * Disk Array driver for Compaq SA53xx Controllers, SCSI Tape module 2 * Disk Array driver for HP Smart Array controllers, SCSI Tape module.
3 * Copyright 2001 Compaq Computer Corporation 3 * (C) Copyright 2001, 2007 Hewlett-Packard Development Company, L.P.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or 7 * the Free Software Foundation; version 2 of the License.
8 * (at your option) any later version.
9 * 8 *
10 * This program is distributed in the hope that it will be useful, 9 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or 11 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * NON INFRINGEMENT. See the GNU General Public License for more details. 12 * General Public License for more details.
14 * 13 *
15 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 16 * Foundation, Inc., 59 Temple Place, Suite 300, Boston, MA
17 * 02111-1307, USA.
18 * 18 *
19 * Questions/Comments/Bugfixes to iss_storagedev@hp.com 19 * Questions/Comments/Bugfixes to iss_storagedev@hp.com
20 * 20 *
diff --git a/drivers/block/cciss_scsi.h b/drivers/block/cciss_scsi.h
index 5e7e06c07d6c..d9c2c586502f 100644
--- a/drivers/block/cciss_scsi.h
+++ b/drivers/block/cciss_scsi.h
@@ -1,20 +1,20 @@
1/* 1/*
2 * Disk Array driver for Compaq SA53xx Controllers, SCSI Tape module 2 * Disk Array driver for HP Smart Array controllers, SCSI Tape module.
3 * Copyright 2001 Compaq Computer Corporation 3 * (C) Copyright 2001, 2007 Hewlett-Packard Development Company, L.P.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or 7 * the Free Software Foundation; version 2 of the License.
8 * (at your option) any later version.
9 * 8 *
10 * This program is distributed in the hope that it will be useful, 9 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or 11 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * NON INFRINGEMENT. See the GNU General Public License for more details. 12 * General Public License for more details.
14 * 13 *
15 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 16 * Foundation, Inc., 59 Temple Place, Suite 300, Boston, MA
17 * 02111-1307, USA.
18 * 18 *
19 * Questions/Comments/Bugfixes to iss_storagedev@hp.com 19 * Questions/Comments/Bugfixes to iss_storagedev@hp.com
20 * 20 *
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c
index c8132d958795..69199185ff4b 100644
--- a/drivers/block/cpqarray.c
+++ b/drivers/block/cpqarray.c
@@ -167,7 +167,6 @@ static void start_io(ctlr_info_t *h);
167 167
168static inline void addQ(cmdlist_t **Qptr, cmdlist_t *c); 168static inline void addQ(cmdlist_t **Qptr, cmdlist_t *c);
169static inline cmdlist_t *removeQ(cmdlist_t **Qptr, cmdlist_t *c); 169static inline cmdlist_t *removeQ(cmdlist_t **Qptr, cmdlist_t *c);
170static inline void complete_buffers(struct bio *bio, int ok);
171static inline void complete_command(cmdlist_t *cmd, int timeout); 170static inline void complete_command(cmdlist_t *cmd, int timeout);
172 171
173static irqreturn_t do_ida_intr(int irq, void *dev_id); 172static irqreturn_t do_ida_intr(int irq, void *dev_id);
@@ -980,26 +979,13 @@ static void start_io(ctlr_info_t *h)
980 } 979 }
981} 980}
982 981
983static inline void complete_buffers(struct bio *bio, int ok)
984{
985 struct bio *xbh;
986
987 while (bio) {
988 xbh = bio->bi_next;
989 bio->bi_next = NULL;
990
991 bio_endio(bio, ok ? 0 : -EIO);
992
993 bio = xbh;
994 }
995}
996/* 982/*
997 * Mark all buffers that cmd was responsible for 983 * Mark all buffers that cmd was responsible for
998 */ 984 */
999static inline void complete_command(cmdlist_t *cmd, int timeout) 985static inline void complete_command(cmdlist_t *cmd, int timeout)
1000{ 986{
1001 struct request *rq = cmd->rq; 987 struct request *rq = cmd->rq;
1002 int ok=1; 988 int error = 0;
1003 int i, ddir; 989 int i, ddir;
1004 990
1005 if (cmd->req.hdr.rcode & RCODE_NONFATAL && 991 if (cmd->req.hdr.rcode & RCODE_NONFATAL &&
@@ -1011,16 +997,17 @@ static inline void complete_command(cmdlist_t *cmd, int timeout)
1011 if (cmd->req.hdr.rcode & RCODE_FATAL) { 997 if (cmd->req.hdr.rcode & RCODE_FATAL) {
1012 printk(KERN_WARNING "Fatal error on ida/c%dd%d\n", 998 printk(KERN_WARNING "Fatal error on ida/c%dd%d\n",
1013 cmd->ctlr, cmd->hdr.unit); 999 cmd->ctlr, cmd->hdr.unit);
1014 ok = 0; 1000 error = -EIO;
1015 } 1001 }
1016 if (cmd->req.hdr.rcode & RCODE_INVREQ) { 1002 if (cmd->req.hdr.rcode & RCODE_INVREQ) {
1017 printk(KERN_WARNING "Invalid request on ida/c%dd%d = (cmd=%x sect=%d cnt=%d sg=%d ret=%x)\n", 1003 printk(KERN_WARNING "Invalid request on ida/c%dd%d = (cmd=%x sect=%d cnt=%d sg=%d ret=%x)\n",
1018 cmd->ctlr, cmd->hdr.unit, cmd->req.hdr.cmd, 1004 cmd->ctlr, cmd->hdr.unit, cmd->req.hdr.cmd,
1019 cmd->req.hdr.blk, cmd->req.hdr.blk_cnt, 1005 cmd->req.hdr.blk, cmd->req.hdr.blk_cnt,
1020 cmd->req.hdr.sg_cnt, cmd->req.hdr.rcode); 1006 cmd->req.hdr.sg_cnt, cmd->req.hdr.rcode);
1021 ok = 0; 1007 error = -EIO;
1022 } 1008 }
1023 if (timeout) ok = 0; 1009 if (timeout)
1010 error = -EIO;
1024 /* unmap the DMA mapping for all the scatter gather elements */ 1011 /* unmap the DMA mapping for all the scatter gather elements */
1025 if (cmd->req.hdr.cmd == IDA_READ) 1012 if (cmd->req.hdr.cmd == IDA_READ)
1026 ddir = PCI_DMA_FROMDEVICE; 1013 ddir = PCI_DMA_FROMDEVICE;
@@ -1030,18 +1017,9 @@ static inline void complete_command(cmdlist_t *cmd, int timeout)
1030 pci_unmap_page(hba[cmd->ctlr]->pci_dev, cmd->req.sg[i].addr, 1017 pci_unmap_page(hba[cmd->ctlr]->pci_dev, cmd->req.sg[i].addr,
1031 cmd->req.sg[i].size, ddir); 1018 cmd->req.sg[i].size, ddir);
1032 1019
1033 complete_buffers(rq->bio, ok);
1034
1035 if (blk_fs_request(rq)) {
1036 const int rw = rq_data_dir(rq);
1037
1038 disk_stat_add(rq->rq_disk, sectors[rw], rq->nr_sectors);
1039 }
1040
1041 add_disk_randomness(rq->rq_disk);
1042
1043 DBGPX(printk("Done with %p\n", rq);); 1020 DBGPX(printk("Done with %p\n", rq););
1044 end_that_request_last(rq, ok ? 1 : -EIO); 1021 if (__blk_end_request(rq, error, blk_rq_bytes(rq)))
1022 BUG();
1045} 1023}
1046 1024
1047/* 1025/*
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 639ed14bb08d..32c79a55511b 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -2287,21 +2287,19 @@ static int do_format(int drive, struct format_descr *tmp_format_req)
2287 * ============================= 2287 * =============================
2288 */ 2288 */
2289 2289
2290static void floppy_end_request(struct request *req, int uptodate) 2290static void floppy_end_request(struct request *req, int error)
2291{ 2291{
2292 unsigned int nr_sectors = current_count_sectors; 2292 unsigned int nr_sectors = current_count_sectors;
2293 unsigned int drive = (unsigned long)req->rq_disk->private_data;
2293 2294
2294 /* current_count_sectors can be zero if transfer failed */ 2295 /* current_count_sectors can be zero if transfer failed */
2295 if (!uptodate) 2296 if (error)
2296 nr_sectors = req->current_nr_sectors; 2297 nr_sectors = req->current_nr_sectors;
2297 if (end_that_request_first(req, uptodate, nr_sectors)) 2298 if (__blk_end_request(req, error, nr_sectors << 9))
2298 return; 2299 return;
2299 add_disk_randomness(req->rq_disk);
2300 floppy_off((long)req->rq_disk->private_data);
2301 blkdev_dequeue_request(req);
2302 end_that_request_last(req, uptodate);
2303 2300
2304 /* We're done with the request */ 2301 /* We're done with the request */
2302 floppy_off(drive);
2305 current_req = NULL; 2303 current_req = NULL;
2306} 2304}
2307 2305
@@ -2332,7 +2330,7 @@ static void request_done(int uptodate)
2332 2330
2333 /* unlock chained buffers */ 2331 /* unlock chained buffers */
2334 spin_lock_irqsave(q->queue_lock, flags); 2332 spin_lock_irqsave(q->queue_lock, flags);
2335 floppy_end_request(req, 1); 2333 floppy_end_request(req, 0);
2336 spin_unlock_irqrestore(q->queue_lock, flags); 2334 spin_unlock_irqrestore(q->queue_lock, flags);
2337 } else { 2335 } else {
2338 if (rq_data_dir(req) == WRITE) { 2336 if (rq_data_dir(req) == WRITE) {
@@ -2346,7 +2344,7 @@ static void request_done(int uptodate)
2346 DRWE->last_error_generation = DRS->generation; 2344 DRWE->last_error_generation = DRS->generation;
2347 } 2345 }
2348 spin_lock_irqsave(q->queue_lock, flags); 2346 spin_lock_irqsave(q->queue_lock, flags);
2349 floppy_end_request(req, 0); 2347 floppy_end_request(req, -EIO);
2350 spin_unlock_irqrestore(q->queue_lock, flags); 2348 spin_unlock_irqrestore(q->queue_lock, flags);
2351 } 2349 }
2352} 2350}
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 56e23042728a..b8af22e610df 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -610,7 +610,7 @@ static int loop_thread(void *data)
610static int loop_switch(struct loop_device *lo, struct file *file) 610static int loop_switch(struct loop_device *lo, struct file *file)
611{ 611{
612 struct switch_request w; 612 struct switch_request w;
613 struct bio *bio = bio_alloc(GFP_KERNEL, 1); 613 struct bio *bio = bio_alloc(GFP_KERNEL, 0);
614 if (!bio) 614 if (!bio)
615 return -ENOMEM; 615 return -ENOMEM;
616 init_completion(&w.wait); 616 init_completion(&w.wait);
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 6332acad078c..ae3106045ee5 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -28,6 +28,7 @@
28#include <linux/err.h> 28#include <linux/err.h>
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <net/sock.h> 30#include <net/sock.h>
31#include <linux/net.h>
31 32
32#include <asm/uaccess.h> 33#include <asm/uaccess.h>
33#include <asm/system.h> 34#include <asm/system.h>
@@ -99,17 +100,15 @@ static const char *nbdcmd_to_ascii(int cmd)
99 100
100static void nbd_end_request(struct request *req) 101static void nbd_end_request(struct request *req)
101{ 102{
102 int uptodate = (req->errors == 0) ? 1 : 0; 103 int error = req->errors ? -EIO : 0;
103 struct request_queue *q = req->q; 104 struct request_queue *q = req->q;
104 unsigned long flags; 105 unsigned long flags;
105 106
106 dprintk(DBG_BLKDEV, "%s: request %p: %s\n", req->rq_disk->disk_name, 107 dprintk(DBG_BLKDEV, "%s: request %p: %s\n", req->rq_disk->disk_name,
107 req, uptodate? "done": "failed"); 108 req, error ? "failed" : "done");
108 109
109 spin_lock_irqsave(q->queue_lock, flags); 110 spin_lock_irqsave(q->queue_lock, flags);
110 if (!end_that_request_first(req, uptodate, req->nr_sectors)) { 111 __blk_end_request(req, error, req->nr_sectors << 9);
111 end_that_request_last(req, uptodate);
112 }
113 spin_unlock_irqrestore(q->queue_lock, flags); 112 spin_unlock_irqrestore(q->queue_lock, flags);
114} 113}
115 114
@@ -126,7 +125,7 @@ static void sock_shutdown(struct nbd_device *lo, int lock)
126 if (lo->sock) { 125 if (lo->sock) {
127 printk(KERN_WARNING "%s: shutting down socket\n", 126 printk(KERN_WARNING "%s: shutting down socket\n",
128 lo->disk->disk_name); 127 lo->disk->disk_name);
129 lo->sock->ops->shutdown(lo->sock, SEND_SHUTDOWN|RCV_SHUTDOWN); 128 kernel_sock_shutdown(lo->sock, SHUT_RDWR);
130 lo->sock = NULL; 129 lo->sock = NULL;
131 } 130 }
132 if (lock) 131 if (lock)
@@ -374,14 +373,17 @@ harderror:
374 return NULL; 373 return NULL;
375} 374}
376 375
377static ssize_t pid_show(struct gendisk *disk, char *page) 376static ssize_t pid_show(struct device *dev,
377 struct device_attribute *attr, char *buf)
378{ 378{
379 return sprintf(page, "%ld\n", 379 struct gendisk *disk = dev_to_disk(dev);
380
381 return sprintf(buf, "%ld\n",
380 (long) ((struct nbd_device *)disk->private_data)->pid); 382 (long) ((struct nbd_device *)disk->private_data)->pid);
381} 383}
382 384
383static struct disk_attribute pid_attr = { 385static struct device_attribute pid_attr = {
384 .attr = { .name = "pid", .mode = S_IRUGO }, 386 .attr = { .name = "pid", .mode = S_IRUGO, .owner = THIS_MODULE },
385 .show = pid_show, 387 .show = pid_show,
386}; 388};
387 389
@@ -393,7 +395,7 @@ static int nbd_do_it(struct nbd_device *lo)
393 BUG_ON(lo->magic != LO_MAGIC); 395 BUG_ON(lo->magic != LO_MAGIC);
394 396
395 lo->pid = current->pid; 397 lo->pid = current->pid;
396 ret = sysfs_create_file(&lo->disk->kobj, &pid_attr.attr); 398 ret = sysfs_create_file(&lo->disk->dev.kobj, &pid_attr.attr);
397 if (ret) { 399 if (ret) {
398 printk(KERN_ERR "nbd: sysfs_create_file failed!"); 400 printk(KERN_ERR "nbd: sysfs_create_file failed!");
399 return ret; 401 return ret;
@@ -402,7 +404,7 @@ static int nbd_do_it(struct nbd_device *lo)
402 while ((req = nbd_read_stat(lo)) != NULL) 404 while ((req = nbd_read_stat(lo)) != NULL)
403 nbd_end_request(req); 405 nbd_end_request(req);
404 406
405 sysfs_remove_file(&lo->disk->kobj, &pid_attr.attr); 407 sysfs_remove_file(&lo->disk->dev.kobj, &pid_attr.attr);
406 return 0; 408 return 0;
407} 409}
408 410
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c
index ceffa6034e20..e7fe6ca97dd8 100644
--- a/drivers/block/paride/pf.c
+++ b/drivers/block/paride/pf.c
@@ -488,13 +488,11 @@ static int pf_atapi(struct pf_unit *pf, char *cmd, int dlen, char *buf, char *fu
488 return r; 488 return r;
489} 489}
490 490
491#define DBMSG(msg) ((verbose>1)?(msg):NULL)
492
493static void pf_lock(struct pf_unit *pf, int func) 491static void pf_lock(struct pf_unit *pf, int func)
494{ 492{
495 char lo_cmd[12] = { ATAPI_LOCK, pf->lun << 5, 0, 0, func, 0, 0, 0, 0, 0, 0, 0 }; 493 char lo_cmd[12] = { ATAPI_LOCK, pf->lun << 5, 0, 0, func, 0, 0, 0, 0, 0, 0, 0 };
496 494
497 pf_atapi(pf, lo_cmd, 0, pf_scratch, func ? "unlock" : "lock"); 495 pf_atapi(pf, lo_cmd, 0, pf_scratch, func ? "lock" : "unlock");
498} 496}
499 497
500static void pf_eject(struct pf_unit *pf) 498static void pf_eject(struct pf_unit *pf)
@@ -555,7 +553,7 @@ static void pf_mode_sense(struct pf_unit *pf)
555 { ATAPI_MODE_SENSE, pf->lun << 5, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0 }; 553 { ATAPI_MODE_SENSE, pf->lun << 5, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0 };
556 char buf[8]; 554 char buf[8];
557 555
558 pf_atapi(pf, ms_cmd, 8, buf, DBMSG("mode sense")); 556 pf_atapi(pf, ms_cmd, 8, buf, "mode sense");
559 pf->media_status = PF_RW; 557 pf->media_status = PF_RW;
560 if (buf[3] & 0x80) 558 if (buf[3] & 0x80)
561 pf->media_status = PF_RO; 559 pf->media_status = PF_RO;
@@ -591,7 +589,7 @@ static void pf_get_capacity(struct pf_unit *pf)
591 char buf[8]; 589 char buf[8];
592 int bs; 590 int bs;
593 591
594 if (pf_atapi(pf, rc_cmd, 8, buf, DBMSG("get capacity"))) { 592 if (pf_atapi(pf, rc_cmd, 8, buf, "get capacity")) {
595 pf->media_status = PF_NM; 593 pf->media_status = PF_NM;
596 return; 594 return;
597 } 595 }
@@ -804,13 +802,18 @@ static int pf_next_buf(void)
804 pf_buf += 512; 802 pf_buf += 512;
805 pf_block++; 803 pf_block++;
806 if (!pf_run) 804 if (!pf_run)
807 return 0;
808 if (!pf_count)
809 return 1; 805 return 1;
810 spin_lock_irqsave(&pf_spin_lock, saved_flags); 806 if (!pf_count) {
811 pf_end_request(1); 807 spin_lock_irqsave(&pf_spin_lock, saved_flags);
812 spin_unlock_irqrestore(&pf_spin_lock, saved_flags); 808 pf_end_request(1);
813 return 1; 809 pf_req = elv_next_request(pf_queue);
810 spin_unlock_irqrestore(&pf_spin_lock, saved_flags);
811 if (!pf_req)
812 return 1;
813 pf_count = pf_req->current_nr_sectors;
814 pf_buf = pf_req->buffer;
815 }
816 return 0;
814} 817}
815 818
816static inline void next_request(int success) 819static inline void next_request(int success)
diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c
index d89e7d32a3b6..ab86e23ddc69 100644
--- a/drivers/block/paride/pg.c
+++ b/drivers/block/paride/pg.c
@@ -676,8 +676,8 @@ static int __init pg_init(void)
676 for (unit = 0; unit < PG_UNITS; unit++) { 676 for (unit = 0; unit < PG_UNITS; unit++) {
677 struct pg *dev = &devices[unit]; 677 struct pg *dev = &devices[unit];
678 if (dev->present) 678 if (dev->present)
679 class_device_create(pg_class, NULL, MKDEV(major, unit), 679 device_create(pg_class, NULL, MKDEV(major, unit),
680 NULL, "pg%u", unit); 680 "pg%u", unit);
681 } 681 }
682 err = 0; 682 err = 0;
683 goto out; 683 goto out;
@@ -695,7 +695,7 @@ static void __exit pg_exit(void)
695 for (unit = 0; unit < PG_UNITS; unit++) { 695 for (unit = 0; unit < PG_UNITS; unit++) {
696 struct pg *dev = &devices[unit]; 696 struct pg *dev = &devices[unit];
697 if (dev->present) 697 if (dev->present)
698 class_device_destroy(pg_class, MKDEV(major, unit)); 698 device_destroy(pg_class, MKDEV(major, unit));
699 } 699 }
700 class_destroy(pg_class); 700 class_destroy(pg_class);
701 unregister_chrdev(major, name); 701 unregister_chrdev(major, name);
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c
index 9f4e67ee1eb0..76096cad798f 100644
--- a/drivers/block/paride/pt.c
+++ b/drivers/block/paride/pt.c
@@ -664,7 +664,7 @@ static int pt_open(struct inode *inode, struct file *file)
664 goto out; 664 goto out;
665 665
666 err = -EROFS; 666 err = -EROFS;
667 if ((!tape->flags & PT_WRITE_OK) && (file->f_mode & 2)) 667 if ((!(tape->flags & PT_WRITE_OK)) && (file->f_mode & 2))
668 goto out; 668 goto out;
669 669
670 if (!(iminor(inode) & 128)) 670 if (!(iminor(inode) & 128))
@@ -972,10 +972,10 @@ static int __init pt_init(void)
972 972
973 for (unit = 0; unit < PT_UNITS; unit++) 973 for (unit = 0; unit < PT_UNITS; unit++)
974 if (pt[unit].present) { 974 if (pt[unit].present) {
975 class_device_create(pt_class, NULL, MKDEV(major, unit), 975 device_create(pt_class, NULL, MKDEV(major, unit),
976 NULL, "pt%d", unit); 976 "pt%d", unit);
977 class_device_create(pt_class, NULL, MKDEV(major, unit + 128), 977 device_create(pt_class, NULL, MKDEV(major, unit + 128),
978 NULL, "pt%dn", unit); 978 "pt%dn", unit);
979 } 979 }
980 goto out; 980 goto out;
981 981
@@ -990,8 +990,8 @@ static void __exit pt_exit(void)
990 int unit; 990 int unit;
991 for (unit = 0; unit < PT_UNITS; unit++) 991 for (unit = 0; unit < PT_UNITS; unit++)
992 if (pt[unit].present) { 992 if (pt[unit].present) {
993 class_device_destroy(pt_class, MKDEV(major, unit)); 993 device_destroy(pt_class, MKDEV(major, unit));
994 class_device_destroy(pt_class, MKDEV(major, unit + 128)); 994 device_destroy(pt_class, MKDEV(major, unit + 128));
995 } 995 }
996 class_destroy(pt_class); 996 class_destroy(pt_class);
997 unregister_chrdev(major, name); 997 unregister_chrdev(major, name);
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index a8130a4ad6d4..e9de1712e5a0 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -110,15 +110,18 @@ static struct pktcdvd_kobj* pkt_kobj_create(struct pktcdvd_device *pd,
110 struct kobj_type* ktype) 110 struct kobj_type* ktype)
111{ 111{
112 struct pktcdvd_kobj *p; 112 struct pktcdvd_kobj *p;
113 int error;
114
113 p = kzalloc(sizeof(*p), GFP_KERNEL); 115 p = kzalloc(sizeof(*p), GFP_KERNEL);
114 if (!p) 116 if (!p)
115 return NULL; 117 return NULL;
116 kobject_set_name(&p->kobj, "%s", name);
117 p->kobj.parent = parent;
118 p->kobj.ktype = ktype;
119 p->pd = pd; 118 p->pd = pd;
120 if (kobject_register(&p->kobj) != 0) 119 error = kobject_init_and_add(&p->kobj, ktype, parent, "%s", name);
120 if (error) {
121 kobject_put(&p->kobj);
121 return NULL; 122 return NULL;
123 }
124 kobject_uevent(&p->kobj, KOBJ_ADD);
122 return p; 125 return p;
123} 126}
124/* 127/*
@@ -127,7 +130,7 @@ static struct pktcdvd_kobj* pkt_kobj_create(struct pktcdvd_device *pd,
127static void pkt_kobj_remove(struct pktcdvd_kobj *p) 130static void pkt_kobj_remove(struct pktcdvd_kobj *p)
128{ 131{
129 if (p) 132 if (p)
130 kobject_unregister(&p->kobj); 133 kobject_put(&p->kobj);
131} 134}
132/* 135/*
133 * default release function for pktcdvd kernel objects. 136 * default release function for pktcdvd kernel objects.
@@ -299,18 +302,16 @@ static struct kobj_type kobj_pkt_type_wqueue = {
299static void pkt_sysfs_dev_new(struct pktcdvd_device *pd) 302static void pkt_sysfs_dev_new(struct pktcdvd_device *pd)
300{ 303{
301 if (class_pktcdvd) { 304 if (class_pktcdvd) {
302 pd->clsdev = class_device_create(class_pktcdvd, 305 pd->dev = device_create(class_pktcdvd, NULL, pd->pkt_dev, "%s", pd->name);
303 NULL, pd->pkt_dev, 306 if (IS_ERR(pd->dev))
304 NULL, "%s", pd->name); 307 pd->dev = NULL;
305 if (IS_ERR(pd->clsdev))
306 pd->clsdev = NULL;
307 } 308 }
308 if (pd->clsdev) { 309 if (pd->dev) {
309 pd->kobj_stat = pkt_kobj_create(pd, "stat", 310 pd->kobj_stat = pkt_kobj_create(pd, "stat",
310 &pd->clsdev->kobj, 311 &pd->dev->kobj,
311 &kobj_pkt_type_stat); 312 &kobj_pkt_type_stat);
312 pd->kobj_wqueue = pkt_kobj_create(pd, "write_queue", 313 pd->kobj_wqueue = pkt_kobj_create(pd, "write_queue",
313 &pd->clsdev->kobj, 314 &pd->dev->kobj,
314 &kobj_pkt_type_wqueue); 315 &kobj_pkt_type_wqueue);
315 } 316 }
316} 317}
@@ -320,7 +321,7 @@ static void pkt_sysfs_dev_remove(struct pktcdvd_device *pd)
320 pkt_kobj_remove(pd->kobj_stat); 321 pkt_kobj_remove(pd->kobj_stat);
321 pkt_kobj_remove(pd->kobj_wqueue); 322 pkt_kobj_remove(pd->kobj_wqueue);
322 if (class_pktcdvd) 323 if (class_pktcdvd)
323 class_device_destroy(class_pktcdvd, pd->pkt_dev); 324 device_destroy(class_pktcdvd, pd->pkt_dev);
324} 325}
325 326
326 327
@@ -358,10 +359,19 @@ static ssize_t class_pktcdvd_store_add(struct class *c, const char *buf,
358 size_t count) 359 size_t count)
359{ 360{
360 unsigned int major, minor; 361 unsigned int major, minor;
362
361 if (sscanf(buf, "%u:%u", &major, &minor) == 2) { 363 if (sscanf(buf, "%u:%u", &major, &minor) == 2) {
364 /* pkt_setup_dev() expects caller to hold reference to self */
365 if (!try_module_get(THIS_MODULE))
366 return -ENODEV;
367
362 pkt_setup_dev(MKDEV(major, minor), NULL); 368 pkt_setup_dev(MKDEV(major, minor), NULL);
369
370 module_put(THIS_MODULE);
371
363 return count; 372 return count;
364 } 373 }
374
365 return -EINVAL; 375 return -EINVAL;
366} 376}
367 377
diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c
index e354bfc070e1..7483f947f0e9 100644
--- a/drivers/block/ps3disk.c
+++ b/drivers/block/ps3disk.c
@@ -229,7 +229,7 @@ static irqreturn_t ps3disk_interrupt(int irq, void *data)
229 struct ps3_storage_device *dev = data; 229 struct ps3_storage_device *dev = data;
230 struct ps3disk_private *priv; 230 struct ps3disk_private *priv;
231 struct request *req; 231 struct request *req;
232 int res, read, uptodate; 232 int res, read, error;
233 u64 tag, status; 233 u64 tag, status;
234 unsigned long num_sectors; 234 unsigned long num_sectors;
235 const char *op; 235 const char *op;
@@ -270,21 +270,17 @@ static irqreturn_t ps3disk_interrupt(int irq, void *data)
270 if (status) { 270 if (status) {
271 dev_dbg(&dev->sbd.core, "%s:%u: %s failed 0x%lx\n", __func__, 271 dev_dbg(&dev->sbd.core, "%s:%u: %s failed 0x%lx\n", __func__,
272 __LINE__, op, status); 272 __LINE__, op, status);
273 uptodate = 0; 273 error = -EIO;
274 } else { 274 } else {
275 dev_dbg(&dev->sbd.core, "%s:%u: %s completed\n", __func__, 275 dev_dbg(&dev->sbd.core, "%s:%u: %s completed\n", __func__,
276 __LINE__, op); 276 __LINE__, op);
277 uptodate = 1; 277 error = 0;
278 if (read) 278 if (read)
279 ps3disk_scatter_gather(dev, req, 0); 279 ps3disk_scatter_gather(dev, req, 0);
280 } 280 }
281 281
282 spin_lock(&priv->lock); 282 spin_lock(&priv->lock);
283 if (!end_that_request_first(req, uptodate, num_sectors)) { 283 __blk_end_request(req, error, num_sectors << 9);
284 add_disk_randomness(req->rq_disk);
285 blkdev_dequeue_request(req);
286 end_that_request_last(req, uptodate);
287 }
288 priv->req = NULL; 284 priv->req = NULL;
289 ps3disk_do_request(dev, priv->queue); 285 ps3disk_do_request(dev, priv->queue);
290 spin_unlock(&priv->lock); 286 spin_unlock(&priv->lock);
diff --git a/drivers/block/rd.c b/drivers/block/rd.c
index 47f8ac6cce57..82f4eecc8699 100644
--- a/drivers/block/rd.c
+++ b/drivers/block/rd.c
@@ -189,6 +189,18 @@ static int ramdisk_set_page_dirty(struct page *page)
189 return 0; 189 return 0;
190} 190}
191 191
192/*
193 * releasepage is called by pagevec_strip/try_to_release_page if
194 * buffers_heads_over_limit is true. Without a releasepage function
195 * try_to_free_buffers is called instead. That can unset the dirty
196 * bit of our ram disk pages, which will be eventually freed, even
197 * if the page is still in use.
198 */
199static int ramdisk_releasepage(struct page *page, gfp_t dummy)
200{
201 return 0;
202}
203
192static const struct address_space_operations ramdisk_aops = { 204static const struct address_space_operations ramdisk_aops = {
193 .readpage = ramdisk_readpage, 205 .readpage = ramdisk_readpage,
194 .prepare_write = ramdisk_prepare_write, 206 .prepare_write = ramdisk_prepare_write,
@@ -196,6 +208,7 @@ static const struct address_space_operations ramdisk_aops = {
196 .writepage = ramdisk_writepage, 208 .writepage = ramdisk_writepage,
197 .set_page_dirty = ramdisk_set_page_dirty, 209 .set_page_dirty = ramdisk_set_page_dirty,
198 .writepages = ramdisk_writepages, 210 .writepages = ramdisk_writepages,
211 .releasepage = ramdisk_releasepage,
199}; 212};
200 213
201static int rd_blkdev_pagecache_IO(int rw, struct bio_vec *vec, sector_t sector, 214static int rd_blkdev_pagecache_IO(int rw, struct bio_vec *vec, sector_t sector,
diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c
index fac4c6cd04f7..a8de037ecd4a 100644
--- a/drivers/block/sunvdc.c
+++ b/drivers/block/sunvdc.c
@@ -212,12 +212,9 @@ static void vdc_end_special(struct vdc_port *port, struct vio_disk_desc *desc)
212 vdc_finish(&port->vio, -err, WAITING_FOR_GEN_CMD); 212 vdc_finish(&port->vio, -err, WAITING_FOR_GEN_CMD);
213} 213}
214 214
215static void vdc_end_request(struct request *req, int uptodate, int num_sectors) 215static void vdc_end_request(struct request *req, int error, int num_sectors)
216{ 216{
217 if (end_that_request_first(req, uptodate, num_sectors)) 217 __blk_end_request(req, error, num_sectors << 9);
218 return;
219 add_disk_randomness(req->rq_disk);
220 end_that_request_last(req, uptodate);
221} 218}
222 219
223static void vdc_end_one(struct vdc_port *port, struct vio_dring_state *dr, 220static void vdc_end_one(struct vdc_port *port, struct vio_dring_state *dr,
@@ -242,7 +239,7 @@ static void vdc_end_one(struct vdc_port *port, struct vio_dring_state *dr,
242 239
243 rqe->req = NULL; 240 rqe->req = NULL;
244 241
245 vdc_end_request(req, !desc->status, desc->size >> 9); 242 vdc_end_request(req, (desc->status ? -EIO : 0), desc->size >> 9);
246 243
247 if (blk_queue_stopped(port->disk->queue)) 244 if (blk_queue_stopped(port->disk->queue))
248 blk_start_queue(port->disk->queue); 245 blk_start_queue(port->disk->queue);
@@ -456,7 +453,7 @@ static void do_vdc_request(struct request_queue *q)
456 453
457 blkdev_dequeue_request(req); 454 blkdev_dequeue_request(req);
458 if (__send_request(req) < 0) 455 if (__send_request(req) < 0)
459 vdc_end_request(req, 0, req->hard_nr_sectors); 456 vdc_end_request(req, -EIO, req->hard_nr_sectors);
460 } 457 }
461} 458}
462 459
@@ -735,7 +732,7 @@ static struct vio_driver_ops vdc_vio_ops = {
735 .handshake_complete = vdc_handshake_complete, 732 .handshake_complete = vdc_handshake_complete,
736}; 733};
737 734
738static void print_version(void) 735static void __devinit print_version(void)
739{ 736{
740 static int version_printed; 737 static int version_printed;
741 738
diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c
index 52dc5e131718..cd5674b63faf 100644
--- a/drivers/block/sx8.c
+++ b/drivers/block/sx8.c
@@ -744,16 +744,14 @@ static unsigned int carm_fill_get_fw_ver(struct carm_host *host,
744 744
745static inline void carm_end_request_queued(struct carm_host *host, 745static inline void carm_end_request_queued(struct carm_host *host,
746 struct carm_request *crq, 746 struct carm_request *crq,
747 int uptodate) 747 int error)
748{ 748{
749 struct request *req = crq->rq; 749 struct request *req = crq->rq;
750 int rc; 750 int rc;
751 751
752 rc = end_that_request_first(req, uptodate, req->hard_nr_sectors); 752 rc = __blk_end_request(req, error, blk_rq_bytes(req));
753 assert(rc == 0); 753 assert(rc == 0);
754 754
755 end_that_request_last(req, uptodate);
756
757 rc = carm_put_request(host, crq); 755 rc = carm_put_request(host, crq);
758 assert(rc == 0); 756 assert(rc == 0);
759} 757}
@@ -793,9 +791,9 @@ static inline void carm_round_robin(struct carm_host *host)
793} 791}
794 792
795static inline void carm_end_rq(struct carm_host *host, struct carm_request *crq, 793static inline void carm_end_rq(struct carm_host *host, struct carm_request *crq,
796 int is_ok) 794 int error)
797{ 795{
798 carm_end_request_queued(host, crq, is_ok); 796 carm_end_request_queued(host, crq, error);
799 if (max_queue == 1) 797 if (max_queue == 1)
800 carm_round_robin(host); 798 carm_round_robin(host);
801 else if ((host->n_msgs <= CARM_MSG_LOW_WATER) && 799 else if ((host->n_msgs <= CARM_MSG_LOW_WATER) &&
@@ -873,14 +871,14 @@ queue_one_request:
873 sg = &crq->sg[0]; 871 sg = &crq->sg[0];
874 n_elem = blk_rq_map_sg(q, rq, sg); 872 n_elem = blk_rq_map_sg(q, rq, sg);
875 if (n_elem <= 0) { 873 if (n_elem <= 0) {
876 carm_end_rq(host, crq, 0); 874 carm_end_rq(host, crq, -EIO);
877 return; /* request with no s/g entries? */ 875 return; /* request with no s/g entries? */
878 } 876 }
879 877
880 /* map scatterlist to PCI bus addresses */ 878 /* map scatterlist to PCI bus addresses */
881 n_elem = pci_map_sg(host->pdev, sg, n_elem, pci_dir); 879 n_elem = pci_map_sg(host->pdev, sg, n_elem, pci_dir);
882 if (n_elem <= 0) { 880 if (n_elem <= 0) {
883 carm_end_rq(host, crq, 0); 881 carm_end_rq(host, crq, -EIO);
884 return; /* request with no s/g entries? */ 882 return; /* request with no s/g entries? */
885 } 883 }
886 crq->n_elem = n_elem; 884 crq->n_elem = n_elem;
@@ -941,7 +939,7 @@ queue_one_request:
941 939
942static void carm_handle_array_info(struct carm_host *host, 940static void carm_handle_array_info(struct carm_host *host,
943 struct carm_request *crq, u8 *mem, 941 struct carm_request *crq, u8 *mem,
944 int is_ok) 942 int error)
945{ 943{
946 struct carm_port *port; 944 struct carm_port *port;
947 u8 *msg_data = mem + sizeof(struct carm_array_info); 945 u8 *msg_data = mem + sizeof(struct carm_array_info);
@@ -952,9 +950,9 @@ static void carm_handle_array_info(struct carm_host *host,
952 950
953 DPRINTK("ENTER\n"); 951 DPRINTK("ENTER\n");
954 952
955 carm_end_rq(host, crq, is_ok); 953 carm_end_rq(host, crq, error);
956 954
957 if (!is_ok) 955 if (error)
958 goto out; 956 goto out;
959 if (le32_to_cpu(desc->array_status) & ARRAY_NO_EXIST) 957 if (le32_to_cpu(desc->array_status) & ARRAY_NO_EXIST)
960 goto out; 958 goto out;
@@ -1001,7 +999,7 @@ out:
1001 999
1002static void carm_handle_scan_chan(struct carm_host *host, 1000static void carm_handle_scan_chan(struct carm_host *host,
1003 struct carm_request *crq, u8 *mem, 1001 struct carm_request *crq, u8 *mem,
1004 int is_ok) 1002 int error)
1005{ 1003{
1006 u8 *msg_data = mem + IOC_SCAN_CHAN_OFFSET; 1004 u8 *msg_data = mem + IOC_SCAN_CHAN_OFFSET;
1007 unsigned int i, dev_count = 0; 1005 unsigned int i, dev_count = 0;
@@ -1009,9 +1007,9 @@ static void carm_handle_scan_chan(struct carm_host *host,
1009 1007
1010 DPRINTK("ENTER\n"); 1008 DPRINTK("ENTER\n");
1011 1009
1012 carm_end_rq(host, crq, is_ok); 1010 carm_end_rq(host, crq, error);
1013 1011
1014 if (!is_ok) { 1012 if (error) {
1015 new_state = HST_ERROR; 1013 new_state = HST_ERROR;
1016 goto out; 1014 goto out;
1017 } 1015 }
@@ -1033,23 +1031,23 @@ out:
1033} 1031}
1034 1032
1035static void carm_handle_generic(struct carm_host *host, 1033static void carm_handle_generic(struct carm_host *host,
1036 struct carm_request *crq, int is_ok, 1034 struct carm_request *crq, int error,
1037 int cur_state, int next_state) 1035 int cur_state, int next_state)
1038{ 1036{
1039 DPRINTK("ENTER\n"); 1037 DPRINTK("ENTER\n");
1040 1038
1041 carm_end_rq(host, crq, is_ok); 1039 carm_end_rq(host, crq, error);
1042 1040
1043 assert(host->state == cur_state); 1041 assert(host->state == cur_state);
1044 if (is_ok) 1042 if (error)
1045 host->state = next_state;
1046 else
1047 host->state = HST_ERROR; 1043 host->state = HST_ERROR;
1044 else
1045 host->state = next_state;
1048 schedule_work(&host->fsm_task); 1046 schedule_work(&host->fsm_task);
1049} 1047}
1050 1048
1051static inline void carm_handle_rw(struct carm_host *host, 1049static inline void carm_handle_rw(struct carm_host *host,
1052 struct carm_request *crq, int is_ok) 1050 struct carm_request *crq, int error)
1053{ 1051{
1054 int pci_dir; 1052 int pci_dir;
1055 1053
@@ -1062,7 +1060,7 @@ static inline void carm_handle_rw(struct carm_host *host,
1062 1060
1063 pci_unmap_sg(host->pdev, &crq->sg[0], crq->n_elem, pci_dir); 1061 pci_unmap_sg(host->pdev, &crq->sg[0], crq->n_elem, pci_dir);
1064 1062
1065 carm_end_rq(host, crq, is_ok); 1063 carm_end_rq(host, crq, error);
1066} 1064}
1067 1065
1068static inline void carm_handle_resp(struct carm_host *host, 1066static inline void carm_handle_resp(struct carm_host *host,
@@ -1071,7 +1069,7 @@ static inline void carm_handle_resp(struct carm_host *host,
1071 u32 handle = le32_to_cpu(ret_handle_le); 1069 u32 handle = le32_to_cpu(ret_handle_le);
1072 unsigned int msg_idx; 1070 unsigned int msg_idx;
1073 struct carm_request *crq; 1071 struct carm_request *crq;
1074 int is_ok = (status == RMSG_OK); 1072 int error = (status == RMSG_OK) ? 0 : -EIO;
1075 u8 *mem; 1073 u8 *mem;
1076 1074
1077 VPRINTK("ENTER, handle == 0x%x\n", handle); 1075 VPRINTK("ENTER, handle == 0x%x\n", handle);
@@ -1090,7 +1088,7 @@ static inline void carm_handle_resp(struct carm_host *host,
1090 /* fast path */ 1088 /* fast path */
1091 if (likely(crq->msg_type == CARM_MSG_READ || 1089 if (likely(crq->msg_type == CARM_MSG_READ ||
1092 crq->msg_type == CARM_MSG_WRITE)) { 1090 crq->msg_type == CARM_MSG_WRITE)) {
1093 carm_handle_rw(host, crq, is_ok); 1091 carm_handle_rw(host, crq, error);
1094 return; 1092 return;
1095 } 1093 }
1096 1094
@@ -1100,7 +1098,7 @@ static inline void carm_handle_resp(struct carm_host *host,
1100 case CARM_MSG_IOCTL: { 1098 case CARM_MSG_IOCTL: {
1101 switch (crq->msg_subtype) { 1099 switch (crq->msg_subtype) {
1102 case CARM_IOC_SCAN_CHAN: 1100 case CARM_IOC_SCAN_CHAN:
1103 carm_handle_scan_chan(host, crq, mem, is_ok); 1101 carm_handle_scan_chan(host, crq, mem, error);
1104 break; 1102 break;
1105 default: 1103 default:
1106 /* unknown / invalid response */ 1104 /* unknown / invalid response */
@@ -1112,21 +1110,21 @@ static inline void carm_handle_resp(struct carm_host *host,
1112 case CARM_MSG_MISC: { 1110 case CARM_MSG_MISC: {
1113 switch (crq->msg_subtype) { 1111 switch (crq->msg_subtype) {
1114 case MISC_ALLOC_MEM: 1112 case MISC_ALLOC_MEM:
1115 carm_handle_generic(host, crq, is_ok, 1113 carm_handle_generic(host, crq, error,
1116 HST_ALLOC_BUF, HST_SYNC_TIME); 1114 HST_ALLOC_BUF, HST_SYNC_TIME);
1117 break; 1115 break;
1118 case MISC_SET_TIME: 1116 case MISC_SET_TIME:
1119 carm_handle_generic(host, crq, is_ok, 1117 carm_handle_generic(host, crq, error,
1120 HST_SYNC_TIME, HST_GET_FW_VER); 1118 HST_SYNC_TIME, HST_GET_FW_VER);
1121 break; 1119 break;
1122 case MISC_GET_FW_VER: { 1120 case MISC_GET_FW_VER: {
1123 struct carm_fw_ver *ver = (struct carm_fw_ver *) 1121 struct carm_fw_ver *ver = (struct carm_fw_ver *)
1124 mem + sizeof(struct carm_msg_get_fw_ver); 1122 mem + sizeof(struct carm_msg_get_fw_ver);
1125 if (is_ok) { 1123 if (!error) {
1126 host->fw_ver = le32_to_cpu(ver->version); 1124 host->fw_ver = le32_to_cpu(ver->version);
1127 host->flags |= (ver->features & FL_FW_VER_MASK); 1125 host->flags |= (ver->features & FL_FW_VER_MASK);
1128 } 1126 }
1129 carm_handle_generic(host, crq, is_ok, 1127 carm_handle_generic(host, crq, error,
1130 HST_GET_FW_VER, HST_PORT_SCAN); 1128 HST_GET_FW_VER, HST_PORT_SCAN);
1131 break; 1129 break;
1132 } 1130 }
@@ -1140,7 +1138,7 @@ static inline void carm_handle_resp(struct carm_host *host,
1140 case CARM_MSG_ARRAY: { 1138 case CARM_MSG_ARRAY: {
1141 switch (crq->msg_subtype) { 1139 switch (crq->msg_subtype) {
1142 case CARM_ARRAY_INFO: 1140 case CARM_ARRAY_INFO:
1143 carm_handle_array_info(host, crq, mem, is_ok); 1141 carm_handle_array_info(host, crq, mem, error);
1144 break; 1142 break;
1145 default: 1143 default:
1146 /* unknown / invalid response */ 1144 /* unknown / invalid response */
@@ -1159,7 +1157,7 @@ static inline void carm_handle_resp(struct carm_host *host,
1159err_out: 1157err_out:
1160 printk(KERN_WARNING DRV_NAME "(%s): BUG: unhandled message type %d/%d\n", 1158 printk(KERN_WARNING DRV_NAME "(%s): BUG: unhandled message type %d/%d\n",
1161 pci_name(host->pdev), crq->msg_type, crq->msg_subtype); 1159 pci_name(host->pdev), crq->msg_type, crq->msg_subtype);
1162 carm_end_rq(host, crq, 0); 1160 carm_end_rq(host, crq, -EIO);
1163} 1161}
1164 1162
1165static inline void carm_handle_responses(struct carm_host *host) 1163static inline void carm_handle_responses(struct carm_host *host)
diff --git a/drivers/block/ub.c b/drivers/block/ub.c
index 08e909dc7944..a70c1c29a7aa 100644
--- a/drivers/block/ub.c
+++ b/drivers/block/ub.c
@@ -808,16 +808,16 @@ static void ub_rw_cmd_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
808 808
809static void ub_end_rq(struct request *rq, unsigned int scsi_status) 809static void ub_end_rq(struct request *rq, unsigned int scsi_status)
810{ 810{
811 int uptodate; 811 int error;
812 812
813 if (scsi_status == 0) { 813 if (scsi_status == 0) {
814 uptodate = 1; 814 error = 0;
815 } else { 815 } else {
816 uptodate = 0; 816 error = -EIO;
817 rq->errors = scsi_status; 817 rq->errors = scsi_status;
818 } 818 }
819 end_that_request_first(rq, uptodate, rq->hard_nr_sectors); 819 if (__blk_end_request(rq, error, blk_rq_bytes(rq)))
820 end_that_request_last(rq, uptodate); 820 BUG();
821} 821}
822 822
823static int ub_rw_cmd_retry(struct ub_dev *sc, struct ub_lun *lun, 823static int ub_rw_cmd_retry(struct ub_dev *sc, struct ub_lun *lun,
@@ -922,11 +922,6 @@ static int ub_scsi_cmd_start(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
922 usb_fill_bulk_urb(&sc->work_urb, sc->dev, sc->send_bulk_pipe, 922 usb_fill_bulk_urb(&sc->work_urb, sc->dev, sc->send_bulk_pipe,
923 bcb, US_BULK_CB_WRAP_LEN, ub_urb_complete, sc); 923 bcb, US_BULK_CB_WRAP_LEN, ub_urb_complete, sc);
924 924
925 /* Fill what we shouldn't be filling, because usb-storage did so. */
926 sc->work_urb.actual_length = 0;
927 sc->work_urb.error_count = 0;
928 sc->work_urb.status = 0;
929
930 if ((rc = usb_submit_urb(&sc->work_urb, GFP_ATOMIC)) != 0) { 925 if ((rc = usb_submit_urb(&sc->work_urb, GFP_ATOMIC)) != 0) {
931 /* XXX Clear stalls */ 926 /* XXX Clear stalls */
932 ub_complete(&sc->work_done); 927 ub_complete(&sc->work_done);
@@ -1313,9 +1308,6 @@ static void ub_data_start(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
1313 sc->last_pipe = pipe; 1308 sc->last_pipe = pipe;
1314 usb_fill_bulk_urb(&sc->work_urb, sc->dev, pipe, sg_virt(sg), 1309 usb_fill_bulk_urb(&sc->work_urb, sc->dev, pipe, sg_virt(sg),
1315 sg->length, ub_urb_complete, sc); 1310 sg->length, ub_urb_complete, sc);
1316 sc->work_urb.actual_length = 0;
1317 sc->work_urb.error_count = 0;
1318 sc->work_urb.status = 0;
1319 1311
1320 if ((rc = usb_submit_urb(&sc->work_urb, GFP_ATOMIC)) != 0) { 1312 if ((rc = usb_submit_urb(&sc->work_urb, GFP_ATOMIC)) != 0) {
1321 /* XXX Clear stalls */ 1313 /* XXX Clear stalls */
@@ -1356,9 +1348,6 @@ static int __ub_state_stat(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
1356 sc->last_pipe = sc->recv_bulk_pipe; 1348 sc->last_pipe = sc->recv_bulk_pipe;
1357 usb_fill_bulk_urb(&sc->work_urb, sc->dev, sc->recv_bulk_pipe, 1349 usb_fill_bulk_urb(&sc->work_urb, sc->dev, sc->recv_bulk_pipe,
1358 &sc->work_bcs, US_BULK_CS_WRAP_LEN, ub_urb_complete, sc); 1350 &sc->work_bcs, US_BULK_CS_WRAP_LEN, ub_urb_complete, sc);
1359 sc->work_urb.actual_length = 0;
1360 sc->work_urb.error_count = 0;
1361 sc->work_urb.status = 0;
1362 1351
1363 if ((rc = usb_submit_urb(&sc->work_urb, GFP_ATOMIC)) != 0) { 1352 if ((rc = usb_submit_urb(&sc->work_urb, GFP_ATOMIC)) != 0) {
1364 /* XXX Clear stalls */ 1353 /* XXX Clear stalls */
@@ -1473,9 +1462,6 @@ static int ub_submit_clear_stall(struct ub_dev *sc, struct ub_scsi_cmd *cmd,
1473 1462
1474 usb_fill_control_urb(&sc->work_urb, sc->dev, sc->send_ctrl_pipe, 1463 usb_fill_control_urb(&sc->work_urb, sc->dev, sc->send_ctrl_pipe,
1475 (unsigned char*) cr, NULL, 0, ub_urb_complete, sc); 1464 (unsigned char*) cr, NULL, 0, ub_urb_complete, sc);
1476 sc->work_urb.actual_length = 0;
1477 sc->work_urb.error_count = 0;
1478 sc->work_urb.status = 0;
1479 1465
1480 if ((rc = usb_submit_urb(&sc->work_urb, GFP_ATOMIC)) != 0) { 1466 if ((rc = usb_submit_urb(&sc->work_urb, GFP_ATOMIC)) != 0) {
1481 ub_complete(&sc->work_done); 1467 ub_complete(&sc->work_done);
@@ -1953,9 +1939,6 @@ static int ub_sync_reset(struct ub_dev *sc)
1953 1939
1954 usb_fill_control_urb(&sc->work_urb, sc->dev, sc->send_ctrl_pipe, 1940 usb_fill_control_urb(&sc->work_urb, sc->dev, sc->send_ctrl_pipe,
1955 (unsigned char*) cr, NULL, 0, ub_probe_urb_complete, &compl); 1941 (unsigned char*) cr, NULL, 0, ub_probe_urb_complete, &compl);
1956 sc->work_urb.actual_length = 0;
1957 sc->work_urb.error_count = 0;
1958 sc->work_urb.status = 0;
1959 1942
1960 if ((rc = usb_submit_urb(&sc->work_urb, GFP_KERNEL)) != 0) { 1943 if ((rc = usb_submit_urb(&sc->work_urb, GFP_KERNEL)) != 0) {
1961 printk(KERN_WARNING 1944 printk(KERN_WARNING
@@ -2007,9 +1990,6 @@ static int ub_sync_getmaxlun(struct ub_dev *sc)
2007 1990
2008 usb_fill_control_urb(&sc->work_urb, sc->dev, sc->recv_ctrl_pipe, 1991 usb_fill_control_urb(&sc->work_urb, sc->dev, sc->recv_ctrl_pipe,
2009 (unsigned char*) cr, p, 1, ub_probe_urb_complete, &compl); 1992 (unsigned char*) cr, p, 1, ub_probe_urb_complete, &compl);
2010 sc->work_urb.actual_length = 0;
2011 sc->work_urb.error_count = 0;
2012 sc->work_urb.status = 0;
2013 1993
2014 if ((rc = usb_submit_urb(&sc->work_urb, GFP_KERNEL)) != 0) 1994 if ((rc = usb_submit_urb(&sc->work_urb, GFP_KERNEL)) != 0)
2015 goto err_submit; 1995 goto err_submit;
@@ -2077,9 +2057,6 @@ static int ub_probe_clear_stall(struct ub_dev *sc, int stalled_pipe)
2077 2057
2078 usb_fill_control_urb(&sc->work_urb, sc->dev, sc->send_ctrl_pipe, 2058 usb_fill_control_urb(&sc->work_urb, sc->dev, sc->send_ctrl_pipe,
2079 (unsigned char*) cr, NULL, 0, ub_probe_urb_complete, &compl); 2059 (unsigned char*) cr, NULL, 0, ub_probe_urb_complete, &compl);
2080 sc->work_urb.actual_length = 0;
2081 sc->work_urb.error_count = 0;
2082 sc->work_urb.status = 0;
2083 2060
2084 if ((rc = usb_submit_urb(&sc->work_urb, GFP_KERNEL)) != 0) { 2061 if ((rc = usb_submit_urb(&sc->work_urb, GFP_KERNEL)) != 0) {
2085 printk(KERN_WARNING 2062 printk(KERN_WARNING
diff --git a/drivers/block/umem.c b/drivers/block/umem.c
index 99806f9ee4ce..c24e1bdbad43 100644
--- a/drivers/block/umem.c
+++ b/drivers/block/umem.c
@@ -34,7 +34,7 @@
34 * - set initialised bit then. 34 * - set initialised bit then.
35 */ 35 */
36 36
37//#define DEBUG /* uncomment if you want debugging info (pr_debug) */ 37#undef DEBUG /* #define DEBUG if you want debugging info (pr_debug) */
38#include <linux/fs.h> 38#include <linux/fs.h>
39#include <linux/bio.h> 39#include <linux/bio.h>
40#include <linux/kernel.h> 40#include <linux/kernel.h>
@@ -143,17 +143,12 @@ static struct cardinfo cards[MM_MAXCARDS];
143static struct block_device_operations mm_fops; 143static struct block_device_operations mm_fops;
144static struct timer_list battery_timer; 144static struct timer_list battery_timer;
145 145
146static int num_cards = 0; 146static int num_cards;
147 147
148static struct gendisk *mm_gendisk[MM_MAXCARDS]; 148static struct gendisk *mm_gendisk[MM_MAXCARDS];
149 149
150static void check_batteries(struct cardinfo *card); 150static void check_batteries(struct cardinfo *card);
151 151
152/*
153-----------------------------------------------------------------------------------
154-- get_userbit
155-----------------------------------------------------------------------------------
156*/
157static int get_userbit(struct cardinfo *card, int bit) 152static int get_userbit(struct cardinfo *card, int bit)
158{ 153{
159 unsigned char led; 154 unsigned char led;
@@ -161,11 +156,7 @@ static int get_userbit(struct cardinfo *card, int bit)
161 led = readb(card->csr_remap + MEMCTRLCMD_LEDCTRL); 156 led = readb(card->csr_remap + MEMCTRLCMD_LEDCTRL);
162 return led & bit; 157 return led & bit;
163} 158}
164/* 159
165-----------------------------------------------------------------------------------
166-- set_userbit
167-----------------------------------------------------------------------------------
168*/
169static int set_userbit(struct cardinfo *card, int bit, unsigned char state) 160static int set_userbit(struct cardinfo *card, int bit, unsigned char state)
170{ 161{
171 unsigned char led; 162 unsigned char led;
@@ -179,11 +170,7 @@ static int set_userbit(struct cardinfo *card, int bit, unsigned char state)
179 170
180 return 0; 171 return 0;
181} 172}
182/* 173
183-----------------------------------------------------------------------------------
184-- set_led
185-----------------------------------------------------------------------------------
186*/
187/* 174/*
188 * NOTE: For the power LED, use the LED_POWER_* macros since they differ 175 * NOTE: For the power LED, use the LED_POWER_* macros since they differ
189 */ 176 */
@@ -203,11 +190,6 @@ static void set_led(struct cardinfo *card, int shift, unsigned char state)
203} 190}
204 191
205#ifdef MM_DIAG 192#ifdef MM_DIAG
206/*
207-----------------------------------------------------------------------------------
208-- dump_regs
209-----------------------------------------------------------------------------------
210*/
211static void dump_regs(struct cardinfo *card) 193static void dump_regs(struct cardinfo *card)
212{ 194{
213 unsigned char *p; 195 unsigned char *p;
@@ -224,32 +206,28 @@ static void dump_regs(struct cardinfo *card)
224 } 206 }
225} 207}
226#endif 208#endif
227/* 209
228-----------------------------------------------------------------------------------
229-- dump_dmastat
230-----------------------------------------------------------------------------------
231*/
232static void dump_dmastat(struct cardinfo *card, unsigned int dmastat) 210static void dump_dmastat(struct cardinfo *card, unsigned int dmastat)
233{ 211{
234 dev_printk(KERN_DEBUG, &card->dev->dev, "DMAstat - "); 212 dev_printk(KERN_DEBUG, &card->dev->dev, "DMAstat - ");
235 if (dmastat & DMASCR_ANY_ERR) 213 if (dmastat & DMASCR_ANY_ERR)
236 printk("ANY_ERR "); 214 printk(KERN_CONT "ANY_ERR ");
237 if (dmastat & DMASCR_MBE_ERR) 215 if (dmastat & DMASCR_MBE_ERR)
238 printk("MBE_ERR "); 216 printk(KERN_CONT "MBE_ERR ");
239 if (dmastat & DMASCR_PARITY_ERR_REP) 217 if (dmastat & DMASCR_PARITY_ERR_REP)
240 printk("PARITY_ERR_REP "); 218 printk(KERN_CONT "PARITY_ERR_REP ");
241 if (dmastat & DMASCR_PARITY_ERR_DET) 219 if (dmastat & DMASCR_PARITY_ERR_DET)
242 printk("PARITY_ERR_DET "); 220 printk(KERN_CONT "PARITY_ERR_DET ");
243 if (dmastat & DMASCR_SYSTEM_ERR_SIG) 221 if (dmastat & DMASCR_SYSTEM_ERR_SIG)
244 printk("SYSTEM_ERR_SIG "); 222 printk(KERN_CONT "SYSTEM_ERR_SIG ");
245 if (dmastat & DMASCR_TARGET_ABT) 223 if (dmastat & DMASCR_TARGET_ABT)
246 printk("TARGET_ABT "); 224 printk(KERN_CONT "TARGET_ABT ");
247 if (dmastat & DMASCR_MASTER_ABT) 225 if (dmastat & DMASCR_MASTER_ABT)
248 printk("MASTER_ABT "); 226 printk(KERN_CONT "MASTER_ABT ");
249 if (dmastat & DMASCR_CHAIN_COMPLETE) 227 if (dmastat & DMASCR_CHAIN_COMPLETE)
250 printk("CHAIN_COMPLETE "); 228 printk(KERN_CONT "CHAIN_COMPLETE ");
251 if (dmastat & DMASCR_DMA_COMPLETE) 229 if (dmastat & DMASCR_DMA_COMPLETE)
252 printk("DMA_COMPLETE "); 230 printk(KERN_CONT "DMA_COMPLETE ");
253 printk("\n"); 231 printk("\n");
254} 232}
255 233
@@ -286,7 +264,8 @@ static void mm_start_io(struct cardinfo *card)
286 264
287 /* make the last descriptor end the chain */ 265 /* make the last descriptor end the chain */
288 page = &card->mm_pages[card->Active]; 266 page = &card->mm_pages[card->Active];
289 pr_debug("start_io: %d %d->%d\n", card->Active, page->headcnt, page->cnt-1); 267 pr_debug("start_io: %d %d->%d\n",
268 card->Active, page->headcnt, page->cnt - 1);
290 desc = &page->desc[page->cnt-1]; 269 desc = &page->desc[page->cnt-1];
291 270
292 desc->control_bits |= cpu_to_le32(DMASCR_CHAIN_COMP_EN); 271 desc->control_bits |= cpu_to_le32(DMASCR_CHAIN_COMP_EN);
@@ -310,8 +289,8 @@ static void mm_start_io(struct cardinfo *card)
310 writel(0, card->csr_remap + DMA_SEMAPHORE_ADDR); 289 writel(0, card->csr_remap + DMA_SEMAPHORE_ADDR);
311 writel(0, card->csr_remap + DMA_SEMAPHORE_ADDR + 4); 290 writel(0, card->csr_remap + DMA_SEMAPHORE_ADDR + 4);
312 291
313 offset = ((char*)desc) - ((char*)page->desc); 292 offset = ((char *)desc) - ((char *)page->desc);
314 writel(cpu_to_le32((page->page_dma+offset)&0xffffffff), 293 writel(cpu_to_le32((page->page_dma+offset) & 0xffffffff),
315 card->csr_remap + DMA_DESCRIPTOR_ADDR); 294 card->csr_remap + DMA_DESCRIPTOR_ADDR);
316 /* Force the value to u64 before shifting otherwise >> 32 is undefined C 295 /* Force the value to u64 before shifting otherwise >> 32 is undefined C
317 * and on some ports will do nothing ! */ 296 * and on some ports will do nothing ! */
@@ -352,7 +331,7 @@ static inline void reset_page(struct mm_page *page)
352 page->cnt = 0; 331 page->cnt = 0;
353 page->headcnt = 0; 332 page->headcnt = 0;
354 page->bio = NULL; 333 page->bio = NULL;
355 page->biotail = & page->bio; 334 page->biotail = &page->bio;
356} 335}
357 336
358static void mm_unplug_device(struct request_queue *q) 337static void mm_unplug_device(struct request_queue *q)
@@ -408,7 +387,7 @@ static int add_bio(struct cardinfo *card)
408 vec->bv_page, 387 vec->bv_page,
409 vec->bv_offset, 388 vec->bv_offset,
410 len, 389 len,
411 (rw==READ) ? 390 (rw == READ) ?
412 PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE); 391 PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE);
413 392
414 p = &card->mm_pages[card->Ready]; 393 p = &card->mm_pages[card->Ready];
@@ -427,10 +406,10 @@ static int add_bio(struct cardinfo *card)
427 desc->pci_addr = cpu_to_le64((u64)desc->data_dma_handle); 406 desc->pci_addr = cpu_to_le64((u64)desc->data_dma_handle);
428 desc->local_addr = cpu_to_le64(card->current_sector << 9); 407 desc->local_addr = cpu_to_le64(card->current_sector << 9);
429 desc->transfer_size = cpu_to_le32(len); 408 desc->transfer_size = cpu_to_le32(len);
430 offset = ( ((char*)&desc->sem_control_bits) - ((char*)p->desc)); 409 offset = (((char *)&desc->sem_control_bits) - ((char *)p->desc));
431 desc->sem_addr = cpu_to_le64((u64)(p->page_dma+offset)); 410 desc->sem_addr = cpu_to_le64((u64)(p->page_dma+offset));
432 desc->zero1 = desc->zero2 = 0; 411 desc->zero1 = desc->zero2 = 0;
433 offset = ( ((char*)(desc+1)) - ((char*)p->desc)); 412 offset = (((char *)(desc+1)) - ((char *)p->desc));
434 desc->next_desc_addr = cpu_to_le64(p->page_dma+offset); 413 desc->next_desc_addr = cpu_to_le64(p->page_dma+offset);
435 desc->control_bits = cpu_to_le32(DMASCR_GO|DMASCR_ERR_INT_EN| 414 desc->control_bits = cpu_to_le32(DMASCR_GO|DMASCR_ERR_INT_EN|
436 DMASCR_PARITY_INT_EN| 415 DMASCR_PARITY_INT_EN|
@@ -455,11 +434,11 @@ static void process_page(unsigned long data)
455 /* check if any of the requests in the page are DMA_COMPLETE, 434 /* check if any of the requests in the page are DMA_COMPLETE,
456 * and deal with them appropriately. 435 * and deal with them appropriately.
457 * If we find a descriptor without DMA_COMPLETE in the semaphore, then 436 * If we find a descriptor without DMA_COMPLETE in the semaphore, then
458 * dma must have hit an error on that descriptor, so use dma_status instead 437 * dma must have hit an error on that descriptor, so use dma_status
459 * and assume that all following descriptors must be re-tried. 438 * instead and assume that all following descriptors must be re-tried.
460 */ 439 */
461 struct mm_page *page; 440 struct mm_page *page;
462 struct bio *return_bio=NULL; 441 struct bio *return_bio = NULL;
463 struct cardinfo *card = (struct cardinfo *)data; 442 struct cardinfo *card = (struct cardinfo *)data;
464 unsigned int dma_status = card->dma_status; 443 unsigned int dma_status = card->dma_status;
465 444
@@ -472,24 +451,25 @@ static void process_page(unsigned long data)
472 struct bio *bio = page->bio; 451 struct bio *bio = page->bio;
473 struct mm_dma_desc *desc = &page->desc[page->headcnt]; 452 struct mm_dma_desc *desc = &page->desc[page->headcnt];
474 int control = le32_to_cpu(desc->sem_control_bits); 453 int control = le32_to_cpu(desc->sem_control_bits);
475 int last=0; 454 int last = 0;
476 int idx; 455 int idx;
477 456
478 if (!(control & DMASCR_DMA_COMPLETE)) { 457 if (!(control & DMASCR_DMA_COMPLETE)) {
479 control = dma_status; 458 control = dma_status;
480 last=1; 459 last = 1;
481 } 460 }
482 page->headcnt++; 461 page->headcnt++;
483 idx = page->idx; 462 idx = page->idx;
484 page->idx++; 463 page->idx++;
485 if (page->idx >= bio->bi_vcnt) { 464 if (page->idx >= bio->bi_vcnt) {
486 page->bio = bio->bi_next; 465 page->bio = bio->bi_next;
487 page->idx = page->bio->bi_idx; 466 if (page->bio)
467 page->idx = page->bio->bi_idx;
488 } 468 }
489 469
490 pci_unmap_page(card->dev, desc->data_dma_handle, 470 pci_unmap_page(card->dev, desc->data_dma_handle,
491 bio_iovec_idx(bio,idx)->bv_len, 471 bio_iovec_idx(bio, idx)->bv_len,
492 (control& DMASCR_TRANSFER_READ) ? 472 (control & DMASCR_TRANSFER_READ) ?
493 PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE); 473 PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE);
494 if (control & DMASCR_HARD_ERROR) { 474 if (control & DMASCR_HARD_ERROR) {
495 /* error */ 475 /* error */
@@ -500,9 +480,10 @@ static void process_page(unsigned long data)
500 le32_to_cpu(desc->transfer_size)); 480 le32_to_cpu(desc->transfer_size));
501 dump_dmastat(card, control); 481 dump_dmastat(card, control);
502 } else if (test_bit(BIO_RW, &bio->bi_rw) && 482 } else if (test_bit(BIO_RW, &bio->bi_rw) &&
503 le32_to_cpu(desc->local_addr)>>9 == card->init_size) { 483 le32_to_cpu(desc->local_addr) >> 9 ==
504 card->init_size += le32_to_cpu(desc->transfer_size)>>9; 484 card->init_size) {
505 if (card->init_size>>1 >= card->mm_size) { 485 card->init_size += le32_to_cpu(desc->transfer_size) >> 9;
486 if (card->init_size >> 1 >= card->mm_size) {
506 dev_printk(KERN_INFO, &card->dev->dev, 487 dev_printk(KERN_INFO, &card->dev->dev,
507 "memory now initialised\n"); 488 "memory now initialised\n");
508 set_userbit(card, MEMORY_INITIALIZED, 1); 489 set_userbit(card, MEMORY_INITIALIZED, 1);
@@ -513,7 +494,8 @@ static void process_page(unsigned long data)
513 return_bio = bio; 494 return_bio = bio;
514 } 495 }
515 496
516 if (last) break; 497 if (last)
498 break;
517 } 499 }
518 500
519 if (debug & DEBUG_LED_ON_TRANSFER) 501 if (debug & DEBUG_LED_ON_TRANSFER)
@@ -535,7 +517,7 @@ static void process_page(unsigned long data)
535 out_unlock: 517 out_unlock:
536 spin_unlock_bh(&card->lock); 518 spin_unlock_bh(&card->lock);
537 519
538 while(return_bio) { 520 while (return_bio) {
539 struct bio *bio = return_bio; 521 struct bio *bio = return_bio;
540 522
541 return_bio = bio->bi_next; 523 return_bio = bio->bi_next;
@@ -544,11 +526,6 @@ static void process_page(unsigned long data)
544 } 526 }
545} 527}
546 528
547/*
548-----------------------------------------------------------------------------------
549-- mm_make_request
550-----------------------------------------------------------------------------------
551*/
552static int mm_make_request(struct request_queue *q, struct bio *bio) 529static int mm_make_request(struct request_queue *q, struct bio *bio)
553{ 530{
554 struct cardinfo *card = q->queuedata; 531 struct cardinfo *card = q->queuedata;
@@ -565,11 +542,6 @@ static int mm_make_request(struct request_queue *q, struct bio *bio)
565 return 0; 542 return 0;
566} 543}
567 544
568/*
569-----------------------------------------------------------------------------------
570-- mm_interrupt
571-----------------------------------------------------------------------------------
572*/
573static irqreturn_t mm_interrupt(int irq, void *__card) 545static irqreturn_t mm_interrupt(int irq, void *__card)
574{ 546{
575 struct cardinfo *card = (struct cardinfo *) __card; 547 struct cardinfo *card = (struct cardinfo *) __card;
@@ -583,15 +555,15 @@ HW_TRACE(0x30);
583 if (!(dma_status & (DMASCR_ERROR_MASK | DMASCR_CHAIN_COMPLETE))) { 555 if (!(dma_status & (DMASCR_ERROR_MASK | DMASCR_CHAIN_COMPLETE))) {
584 /* interrupt wasn't for me ... */ 556 /* interrupt wasn't for me ... */
585 return IRQ_NONE; 557 return IRQ_NONE;
586 } 558 }
587 559
588 /* clear COMPLETION interrupts */ 560 /* clear COMPLETION interrupts */
589 if (card->flags & UM_FLAG_NO_BYTE_STATUS) 561 if (card->flags & UM_FLAG_NO_BYTE_STATUS)
590 writel(cpu_to_le32(DMASCR_DMA_COMPLETE|DMASCR_CHAIN_COMPLETE), 562 writel(cpu_to_le32(DMASCR_DMA_COMPLETE|DMASCR_CHAIN_COMPLETE),
591 card->csr_remap+ DMA_STATUS_CTRL); 563 card->csr_remap + DMA_STATUS_CTRL);
592 else 564 else
593 writeb((DMASCR_DMA_COMPLETE|DMASCR_CHAIN_COMPLETE) >> 16, 565 writeb((DMASCR_DMA_COMPLETE|DMASCR_CHAIN_COMPLETE) >> 16,
594 card->csr_remap+ DMA_STATUS_CTRL + 2); 566 card->csr_remap + DMA_STATUS_CTRL + 2);
595 567
596 /* log errors and clear interrupt status */ 568 /* log errors and clear interrupt status */
597 if (dma_status & DMASCR_ANY_ERR) { 569 if (dma_status & DMASCR_ANY_ERR) {
@@ -601,9 +573,12 @@ HW_TRACE(0x30);
601 573
602 stat = readb(card->csr_remap + MEMCTRLCMD_ERRSTATUS); 574 stat = readb(card->csr_remap + MEMCTRLCMD_ERRSTATUS);
603 575
604 data_log1 = le32_to_cpu(readl(card->csr_remap + ERROR_DATA_LOG)); 576 data_log1 = le32_to_cpu(readl(card->csr_remap +
605 data_log2 = le32_to_cpu(readl(card->csr_remap + ERROR_DATA_LOG + 4)); 577 ERROR_DATA_LOG));
606 addr_log1 = le32_to_cpu(readl(card->csr_remap + ERROR_ADDR_LOG)); 578 data_log2 = le32_to_cpu(readl(card->csr_remap +
579 ERROR_DATA_LOG + 4));
580 addr_log1 = le32_to_cpu(readl(card->csr_remap +
581 ERROR_ADDR_LOG));
607 addr_log2 = readb(card->csr_remap + ERROR_ADDR_LOG + 4); 582 addr_log2 = readb(card->csr_remap + ERROR_ADDR_LOG + 4);
608 583
609 count = readb(card->csr_remap + ERROR_COUNT); 584 count = readb(card->csr_remap + ERROR_COUNT);
@@ -670,11 +645,7 @@ HW_TRACE(0x36);
670 645
671 return IRQ_HANDLED; 646 return IRQ_HANDLED;
672} 647}
673/* 648
674-----------------------------------------------------------------------------------
675-- set_fault_to_battery_status
676-----------------------------------------------------------------------------------
677*/
678/* 649/*
679 * If both batteries are good, no LED 650 * If both batteries are good, no LED
680 * If either battery has been warned, solid LED 651 * If either battery has been warned, solid LED
@@ -695,12 +666,6 @@ static void set_fault_to_battery_status(struct cardinfo *card)
695 666
696static void init_battery_timer(void); 667static void init_battery_timer(void);
697 668
698
699/*
700-----------------------------------------------------------------------------------
701-- check_battery
702-----------------------------------------------------------------------------------
703*/
704static int check_battery(struct cardinfo *card, int battery, int status) 669static int check_battery(struct cardinfo *card, int battery, int status)
705{ 670{
706 if (status != card->battery[battery].good) { 671 if (status != card->battery[battery].good) {
@@ -729,11 +694,7 @@ static int check_battery(struct cardinfo *card, int battery, int status)
729 694
730 return 0; 695 return 0;
731} 696}
732/* 697
733-----------------------------------------------------------------------------------
734-- check_batteries
735-----------------------------------------------------------------------------------
736*/
737static void check_batteries(struct cardinfo *card) 698static void check_batteries(struct cardinfo *card)
738{ 699{
739 /* NOTE: this must *never* be called while the card 700 /* NOTE: this must *never* be called while the card
@@ -774,11 +735,7 @@ static void check_all_batteries(unsigned long ptr)
774 735
775 init_battery_timer(); 736 init_battery_timer();
776} 737}
777/* 738
778-----------------------------------------------------------------------------------
779-- init_battery_timer
780-----------------------------------------------------------------------------------
781*/
782static void init_battery_timer(void) 739static void init_battery_timer(void)
783{ 740{
784 init_timer(&battery_timer); 741 init_timer(&battery_timer);
@@ -786,20 +743,12 @@ static void init_battery_timer(void)
786 battery_timer.expires = jiffies + (HZ * 60); 743 battery_timer.expires = jiffies + (HZ * 60);
787 add_timer(&battery_timer); 744 add_timer(&battery_timer);
788} 745}
789/* 746
790-----------------------------------------------------------------------------------
791-- del_battery_timer
792-----------------------------------------------------------------------------------
793*/
794static void del_battery_timer(void) 747static void del_battery_timer(void)
795{ 748{
796 del_timer(&battery_timer); 749 del_timer(&battery_timer);
797} 750}
798/* 751
799-----------------------------------------------------------------------------------
800-- mm_revalidate
801-----------------------------------------------------------------------------------
802*/
803/* 752/*
804 * Note no locks taken out here. In a worst case scenario, we could drop 753 * Note no locks taken out here. In a worst case scenario, we could drop
805 * a chunk of system memory. But that should never happen, since validation 754 * a chunk of system memory. But that should never happen, since validation
@@ -832,33 +781,23 @@ static int mm_getgeo(struct block_device *bdev, struct hd_geometry *geo)
832} 781}
833 782
834/* 783/*
835----------------------------------------------------------------------------------- 784 * Future support for removable devices
836-- mm_check_change 785 */
837-----------------------------------------------------------------------------------
838 Future support for removable devices
839*/
840static int mm_check_change(struct gendisk *disk) 786static int mm_check_change(struct gendisk *disk)
841{ 787{
842/* struct cardinfo *dev = disk->private_data; */ 788/* struct cardinfo *dev = disk->private_data; */
843 return 0; 789 return 0;
844} 790}
845/* 791
846-----------------------------------------------------------------------------------
847-- mm_fops
848-----------------------------------------------------------------------------------
849*/
850static struct block_device_operations mm_fops = { 792static struct block_device_operations mm_fops = {
851 .owner = THIS_MODULE, 793 .owner = THIS_MODULE,
852 .getgeo = mm_getgeo, 794 .getgeo = mm_getgeo,
853 .revalidate_disk= mm_revalidate, 795 .revalidate_disk = mm_revalidate,
854 .media_changed = mm_check_change, 796 .media_changed = mm_check_change,
855}; 797};
856/* 798
857----------------------------------------------------------------------------------- 799static int __devinit mm_pci_probe(struct pci_dev *dev,
858-- mm_pci_probe 800 const struct pci_device_id *id)
859-----------------------------------------------------------------------------------
860*/
861static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
862{ 801{
863 int ret = -ENODEV; 802 int ret = -ENODEV;
864 struct cardinfo *card = &cards[num_cards]; 803 struct cardinfo *card = &cards[num_cards];
@@ -888,7 +827,7 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
888 return -ENODEV; 827 return -ENODEV;
889 828
890 dev_printk(KERN_INFO, &dev->dev, 829 dev_printk(KERN_INFO, &dev->dev,
891 "Micro Memory(tm) controller found (PCI Mem Module (Battery Backup))\n"); 830 "Micro Memory(tm) controller found (PCI Mem Module (Battery Backup))\n");
892 831
893 if (pci_set_dma_mask(dev, DMA_64BIT_MASK) && 832 if (pci_set_dma_mask(dev, DMA_64BIT_MASK) &&
894 pci_set_dma_mask(dev, DMA_32BIT_MASK)) { 833 pci_set_dma_mask(dev, DMA_32BIT_MASK)) {
@@ -916,7 +855,7 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
916 "CSR 0x%08lx -> 0x%p (0x%lx)\n", 855 "CSR 0x%08lx -> 0x%p (0x%lx)\n",
917 csr_base, card->csr_remap, csr_len); 856 csr_base, card->csr_remap, csr_len);
918 857
919 switch(card->dev->device) { 858 switch (card->dev->device) {
920 case 0x5415: 859 case 0x5415:
921 card->flags |= UM_FLAG_NO_BYTE_STATUS | UM_FLAG_NO_BATTREG; 860 card->flags |= UM_FLAG_NO_BYTE_STATUS | UM_FLAG_NO_BATTREG;
922 magic_number = 0x59; 861 magic_number = 0x59;
@@ -928,7 +867,8 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
928 break; 867 break;
929 868
930 case 0x6155: 869 case 0x6155:
931 card->flags |= UM_FLAG_NO_BYTE_STATUS | UM_FLAG_NO_BATTREG | UM_FLAG_NO_BATT; 870 card->flags |= UM_FLAG_NO_BYTE_STATUS |
871 UM_FLAG_NO_BATTREG | UM_FLAG_NO_BATT;
932 magic_number = 0x99; 872 magic_number = 0x99;
933 break; 873 break;
934 874
@@ -944,11 +884,11 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
944 } 884 }
945 885
946 card->mm_pages[0].desc = pci_alloc_consistent(card->dev, 886 card->mm_pages[0].desc = pci_alloc_consistent(card->dev,
947 PAGE_SIZE*2, 887 PAGE_SIZE * 2,
948 &card->mm_pages[0].page_dma); 888 &card->mm_pages[0].page_dma);
949 card->mm_pages[1].desc = pci_alloc_consistent(card->dev, 889 card->mm_pages[1].desc = pci_alloc_consistent(card->dev,
950 PAGE_SIZE*2, 890 PAGE_SIZE * 2,
951 &card->mm_pages[1].page_dma); 891 &card->mm_pages[1].page_dma);
952 if (card->mm_pages[0].desc == NULL || 892 if (card->mm_pages[0].desc == NULL ||
953 card->mm_pages[1].desc == NULL) { 893 card->mm_pages[1].desc == NULL) {
954 dev_printk(KERN_ERR, &card->dev->dev, "alloc failed\n"); 894 dev_printk(KERN_ERR, &card->dev->dev, "alloc failed\n");
@@ -1012,9 +952,9 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
1012 dev_printk(KERN_INFO, &card->dev->dev, 952 dev_printk(KERN_INFO, &card->dev->dev,
1013 "Size %d KB, Battery 1 %s (%s), Battery 2 %s (%s)\n", 953 "Size %d KB, Battery 1 %s (%s), Battery 2 %s (%s)\n",
1014 card->mm_size, 954 card->mm_size,
1015 (batt_status & BATTERY_1_DISABLED ? "Disabled" : "Enabled"), 955 batt_status & BATTERY_1_DISABLED ? "Disabled" : "Enabled",
1016 card->battery[0].good ? "OK" : "FAILURE", 956 card->battery[0].good ? "OK" : "FAILURE",
1017 (batt_status & BATTERY_2_DISABLED ? "Disabled" : "Enabled"), 957 batt_status & BATTERY_2_DISABLED ? "Disabled" : "Enabled",
1018 card->battery[1].good ? "OK" : "FAILURE"); 958 card->battery[1].good ? "OK" : "FAILURE");
1019 959
1020 set_fault_to_battery_status(card); 960 set_fault_to_battery_status(card);
@@ -1029,18 +969,18 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
1029 data = ~data; 969 data = ~data;
1030 data += 1; 970 data += 1;
1031 971
1032 if (request_irq(dev->irq, mm_interrupt, IRQF_SHARED, DRIVER_NAME, card)) { 972 if (request_irq(dev->irq, mm_interrupt, IRQF_SHARED, DRIVER_NAME,
973 card)) {
1033 dev_printk(KERN_ERR, &card->dev->dev, 974 dev_printk(KERN_ERR, &card->dev->dev,
1034 "Unable to allocate IRQ\n"); 975 "Unable to allocate IRQ\n");
1035 ret = -ENODEV; 976 ret = -ENODEV;
1036
1037 goto failed_req_irq; 977 goto failed_req_irq;
1038 } 978 }
1039 979
1040 dev_printk(KERN_INFO, &card->dev->dev, 980 dev_printk(KERN_INFO, &card->dev->dev,
1041 "Window size %d bytes, IRQ %d\n", data, dev->irq); 981 "Window size %d bytes, IRQ %d\n", data, dev->irq);
1042 982
1043 spin_lock_init(&card->lock); 983 spin_lock_init(&card->lock);
1044 984
1045 pci_set_drvdata(dev, card); 985 pci_set_drvdata(dev, card);
1046 986
@@ -1059,7 +999,7 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
1059 999
1060 if (!get_userbit(card, MEMORY_INITIALIZED)) { 1000 if (!get_userbit(card, MEMORY_INITIALIZED)) {
1061 dev_printk(KERN_INFO, &card->dev->dev, 1001 dev_printk(KERN_INFO, &card->dev->dev,
1062 "memory NOT initialized. Consider over-writing whole device.\n"); 1002 "memory NOT initialized. Consider over-writing whole device.\n");
1063 card->init_size = 0; 1003 card->init_size = 0;
1064 } else { 1004 } else {
1065 dev_printk(KERN_INFO, &card->dev->dev, 1005 dev_printk(KERN_INFO, &card->dev->dev,
@@ -1090,11 +1030,7 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
1090 1030
1091 return ret; 1031 return ret;
1092} 1032}
1093/* 1033
1094-----------------------------------------------------------------------------------
1095-- mm_pci_remove
1096-----------------------------------------------------------------------------------
1097*/
1098static void mm_pci_remove(struct pci_dev *dev) 1034static void mm_pci_remove(struct pci_dev *dev)
1099{ 1035{
1100 struct cardinfo *card = pci_get_drvdata(dev); 1036 struct cardinfo *card = pci_get_drvdata(dev);
@@ -1118,16 +1054,16 @@ static void mm_pci_remove(struct pci_dev *dev)
1118} 1054}
1119 1055
1120static const struct pci_device_id mm_pci_ids[] = { 1056static const struct pci_device_id mm_pci_ids[] = {
1121 {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY,PCI_DEVICE_ID_MICRO_MEMORY_5415CN)}, 1057 {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY, PCI_DEVICE_ID_MICRO_MEMORY_5415CN)},
1122 {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY,PCI_DEVICE_ID_MICRO_MEMORY_5425CN)}, 1058 {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY, PCI_DEVICE_ID_MICRO_MEMORY_5425CN)},
1123 {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY,PCI_DEVICE_ID_MICRO_MEMORY_6155)}, 1059 {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY, PCI_DEVICE_ID_MICRO_MEMORY_6155)},
1124 { 1060 {
1125 .vendor = 0x8086, 1061 .vendor = 0x8086,
1126 .device = 0xB555, 1062 .device = 0xB555,
1127 .subvendor= 0x1332, 1063 .subvendor = 0x1332,
1128 .subdevice= 0x5460, 1064 .subdevice = 0x5460,
1129 .class = 0x050000, 1065 .class = 0x050000,
1130 .class_mask= 0, 1066 .class_mask = 0,
1131 }, { /* end: all zeroes */ } 1067 }, { /* end: all zeroes */ }
1132}; 1068};
1133 1069
@@ -1140,12 +1076,6 @@ static struct pci_driver mm_pci_driver = {
1140 .remove = mm_pci_remove, 1076 .remove = mm_pci_remove,
1141}; 1077};
1142 1078
1143/*
1144-----------------------------------------------------------------------------------
1145-- mm_init
1146-----------------------------------------------------------------------------------
1147*/
1148
1149static int __init mm_init(void) 1079static int __init mm_init(void)
1150{ 1080{
1151 int retval, i; 1081 int retval, i;
@@ -1192,18 +1122,14 @@ out:
1192 put_disk(mm_gendisk[i]); 1122 put_disk(mm_gendisk[i]);
1193 return -ENOMEM; 1123 return -ENOMEM;
1194} 1124}
1195/* 1125
1196-----------------------------------------------------------------------------------
1197-- mm_cleanup
1198-----------------------------------------------------------------------------------
1199*/
1200static void __exit mm_cleanup(void) 1126static void __exit mm_cleanup(void)
1201{ 1127{
1202 int i; 1128 int i;
1203 1129
1204 del_battery_timer(); 1130 del_battery_timer();
1205 1131
1206 for (i=0; i < num_cards ; i++) { 1132 for (i = 0; i < num_cards ; i++) {
1207 del_gendisk(mm_gendisk[i]); 1133 del_gendisk(mm_gendisk[i]);
1208 put_disk(mm_gendisk[i]); 1134 put_disk(mm_gendisk[i]);
1209 } 1135 }
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c
index ab5d404faa11..9e61fca46117 100644
--- a/drivers/block/viodasd.c
+++ b/drivers/block/viodasd.c
@@ -229,13 +229,10 @@ static struct block_device_operations viodasd_fops = {
229/* 229/*
230 * End a request 230 * End a request
231 */ 231 */
232static void viodasd_end_request(struct request *req, int uptodate, 232static void viodasd_end_request(struct request *req, int error,
233 int num_sectors) 233 int num_sectors)
234{ 234{
235 if (end_that_request_first(req, uptodate, num_sectors)) 235 __blk_end_request(req, error, num_sectors << 9);
236 return;
237 add_disk_randomness(req->rq_disk);
238 end_that_request_last(req, uptodate);
239} 236}
240 237
241/* 238/*
@@ -374,12 +371,12 @@ static void do_viodasd_request(struct request_queue *q)
374 blkdev_dequeue_request(req); 371 blkdev_dequeue_request(req);
375 /* check that request contains a valid command */ 372 /* check that request contains a valid command */
376 if (!blk_fs_request(req)) { 373 if (!blk_fs_request(req)) {
377 viodasd_end_request(req, 0, req->hard_nr_sectors); 374 viodasd_end_request(req, -EIO, req->hard_nr_sectors);
378 continue; 375 continue;
379 } 376 }
380 /* Try sending the request */ 377 /* Try sending the request */
381 if (send_request(req) != 0) 378 if (send_request(req) != 0)
382 viodasd_end_request(req, 0, req->hard_nr_sectors); 379 viodasd_end_request(req, -EIO, req->hard_nr_sectors);
383 } 380 }
384} 381}
385 382
@@ -591,7 +588,7 @@ static int viodasd_handle_read_write(struct vioblocklpevent *bevent)
591 num_req_outstanding--; 588 num_req_outstanding--;
592 spin_unlock_irqrestore(&viodasd_spinlock, irq_flags); 589 spin_unlock_irqrestore(&viodasd_spinlock, irq_flags);
593 590
594 error = event->xRc != HvLpEvent_Rc_Good; 591 error = (event->xRc == HvLpEvent_Rc_Good) ? 0 : -EIO;
595 if (error) { 592 if (error) {
596 const struct vio_error_entry *err; 593 const struct vio_error_entry *err;
597 err = vio_lookup_rc(viodasd_err_table, bevent->sub_result); 594 err = vio_lookup_rc(viodasd_err_table, bevent->sub_result);
@@ -601,7 +598,7 @@ static int viodasd_handle_read_write(struct vioblocklpevent *bevent)
601 } 598 }
602 qlock = req->q->queue_lock; 599 qlock = req->q->queue_lock;
603 spin_lock_irqsave(qlock, irq_flags); 600 spin_lock_irqsave(qlock, irq_flags);
604 viodasd_end_request(req, !error, num_sect); 601 viodasd_end_request(req, error, num_sect);
605 spin_unlock_irqrestore(qlock, irq_flags); 602 spin_unlock_irqrestore(qlock, irq_flags);
606 603
607 /* Finally, try to get more requests off of this device's queue */ 604 /* Finally, try to get more requests off of this device's queue */
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 3cf7129d83e6..924ddd8bccd2 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -223,7 +223,7 @@ static int virtblk_probe(struct virtio_device *vdev)
223 err = virtio_config_val(vdev, VIRTIO_CONFIG_BLK_F_CAPACITY, &cap); 223 err = virtio_config_val(vdev, VIRTIO_CONFIG_BLK_F_CAPACITY, &cap);
224 if (err) { 224 if (err) {
225 dev_err(&vdev->dev, "Bad/missing capacity in config\n"); 225 dev_err(&vdev->dev, "Bad/missing capacity in config\n");
226 goto out_put_disk; 226 goto out_cleanup_queue;
227 } 227 }
228 228
229 /* If capacity is too big, truncate with warning. */ 229 /* If capacity is too big, truncate with warning. */
@@ -239,7 +239,7 @@ static int virtblk_probe(struct virtio_device *vdev)
239 blk_queue_max_segment_size(vblk->disk->queue, v); 239 blk_queue_max_segment_size(vblk->disk->queue, v);
240 else if (err != -ENOENT) { 240 else if (err != -ENOENT) {
241 dev_err(&vdev->dev, "Bad SIZE_MAX in config\n"); 241 dev_err(&vdev->dev, "Bad SIZE_MAX in config\n");
242 goto out_put_disk; 242 goto out_cleanup_queue;
243 } 243 }
244 244
245 err = virtio_config_val(vdev, VIRTIO_CONFIG_BLK_F_SEG_MAX, &v); 245 err = virtio_config_val(vdev, VIRTIO_CONFIG_BLK_F_SEG_MAX, &v);
@@ -247,12 +247,14 @@ static int virtblk_probe(struct virtio_device *vdev)
247 blk_queue_max_hw_segments(vblk->disk->queue, v); 247 blk_queue_max_hw_segments(vblk->disk->queue, v);
248 else if (err != -ENOENT) { 248 else if (err != -ENOENT) {
249 dev_err(&vdev->dev, "Bad SEG_MAX in config\n"); 249 dev_err(&vdev->dev, "Bad SEG_MAX in config\n");
250 goto out_put_disk; 250 goto out_cleanup_queue;
251 } 251 }
252 252
253 add_disk(vblk->disk); 253 add_disk(vblk->disk);
254 return 0; 254 return 0;
255 255
256out_cleanup_queue:
257 blk_cleanup_queue(vblk->disk->queue);
256out_put_disk: 258out_put_disk:
257 put_disk(vblk->disk); 259 put_disk(vblk->disk);
258out_unregister_blkdev: 260out_unregister_blkdev:
@@ -277,6 +279,8 @@ static void virtblk_remove(struct virtio_device *vdev)
277 put_disk(vblk->disk); 279 put_disk(vblk->disk);
278 unregister_blkdev(major, "virtblk"); 280 unregister_blkdev(major, "virtblk");
279 mempool_destroy(vblk->pool); 281 mempool_destroy(vblk->pool);
282 /* There should be nothing in the queue now, so no need to shutdown */
283 vdev->config->del_vq(vblk->vq);
280 kfree(vblk); 284 kfree(vblk);
281} 285}
282 286
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 2bdebcb3ff16..8afce67c0aa5 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -452,7 +452,7 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id)
452 RING_IDX i, rp; 452 RING_IDX i, rp;
453 unsigned long flags; 453 unsigned long flags;
454 struct blkfront_info *info = (struct blkfront_info *)dev_id; 454 struct blkfront_info *info = (struct blkfront_info *)dev_id;
455 int uptodate; 455 int error;
456 456
457 spin_lock_irqsave(&blkif_io_lock, flags); 457 spin_lock_irqsave(&blkif_io_lock, flags);
458 458
@@ -477,13 +477,13 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id)
477 477
478 add_id_to_freelist(info, id); 478 add_id_to_freelist(info, id);
479 479
480 uptodate = (bret->status == BLKIF_RSP_OKAY); 480 error = (bret->status == BLKIF_RSP_OKAY) ? 0 : -EIO;
481 switch (bret->operation) { 481 switch (bret->operation) {
482 case BLKIF_OP_WRITE_BARRIER: 482 case BLKIF_OP_WRITE_BARRIER:
483 if (unlikely(bret->status == BLKIF_RSP_EOPNOTSUPP)) { 483 if (unlikely(bret->status == BLKIF_RSP_EOPNOTSUPP)) {
484 printk(KERN_WARNING "blkfront: %s: write barrier op failed\n", 484 printk(KERN_WARNING "blkfront: %s: write barrier op failed\n",
485 info->gd->disk_name); 485 info->gd->disk_name);
486 uptodate = -EOPNOTSUPP; 486 error = -EOPNOTSUPP;
487 info->feature_barrier = 0; 487 info->feature_barrier = 0;
488 xlvbd_barrier(info); 488 xlvbd_barrier(info);
489 } 489 }
@@ -494,10 +494,8 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id)
494 dev_dbg(&info->xbdev->dev, "Bad return from blkdev data " 494 dev_dbg(&info->xbdev->dev, "Bad return from blkdev data "
495 "request: %x\n", bret->status); 495 "request: %x\n", bret->status);
496 496
497 ret = end_that_request_first(req, uptodate, 497 ret = __blk_end_request(req, error, blk_rq_bytes(req));
498 req->hard_nr_sectors);
499 BUG_ON(ret); 498 BUG_ON(ret);
500 end_that_request_last(req, uptodate);
501 break; 499 break;
502 default: 500 default:
503 BUG(); 501 BUG();
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index 82effce97c51..78ebfffc77e3 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -483,7 +483,6 @@ static void ace_fsm_dostate(struct ace_device *ace)
483 u32 status; 483 u32 status;
484 u16 val; 484 u16 val;
485 int count; 485 int count;
486 int i;
487 486
488#if defined(DEBUG) 487#if defined(DEBUG)
489 dev_dbg(ace->dev, "fsm_state=%i, id_req_count=%i\n", 488 dev_dbg(ace->dev, "fsm_state=%i, id_req_count=%i\n",
@@ -688,7 +687,6 @@ static void ace_fsm_dostate(struct ace_device *ace)
688 } 687 }
689 688
690 /* Transfer the next buffer */ 689 /* Transfer the next buffer */
691 i = 16;
692 if (ace->fsm_task == ACE_TASK_WRITE) 690 if (ace->fsm_task == ACE_TASK_WRITE)
693 ace->reg_ops->dataout(ace); 691 ace->reg_ops->dataout(ace);
694 else 692 else
@@ -702,8 +700,8 @@ static void ace_fsm_dostate(struct ace_device *ace)
702 } 700 }
703 701
704 /* bio finished; is there another one? */ 702 /* bio finished; is there another one? */
705 i = ace->req->current_nr_sectors; 703 if (__blk_end_request(ace->req, 0,
706 if (end_that_request_first(ace->req, 1, i)) { 704 blk_rq_cur_bytes(ace->req))) {
707 /* dev_dbg(ace->dev, "next block; h=%li c=%i\n", 705 /* dev_dbg(ace->dev, "next block; h=%li c=%i\n",
708 * ace->req->hard_nr_sectors, 706 * ace->req->hard_nr_sectors,
709 * ace->req->current_nr_sectors); 707 * ace->req->current_nr_sectors);
@@ -718,9 +716,6 @@ static void ace_fsm_dostate(struct ace_device *ace)
718 break; 716 break;
719 717
720 case ACE_FSM_STATE_REQ_COMPLETE: 718 case ACE_FSM_STATE_REQ_COMPLETE:
721 /* Complete the block request */
722 blkdev_dequeue_request(ace->req);
723 end_that_request_last(ace->req, 1);
724 ace->req = NULL; 719 ace->req = NULL;
725 720
726 /* Finished request; go to idle state */ 721 /* Finished request; go to idle state */