aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/DAC960.c4
-rw-r--r--drivers/block/Kconfig4
-rw-r--r--drivers/block/aoe/aoeblk.c2
-rw-r--r--drivers/block/cciss.c332
-rw-r--r--drivers/block/cciss.h6
-rw-r--r--drivers/block/cciss_cmd.h3
-rw-r--r--drivers/block/nbd.c16
-rw-r--r--drivers/block/paride/aten.c4
-rw-r--r--drivers/block/paride/bpck.c4
-rw-r--r--drivers/block/paride/bpck6.c17
-rw-r--r--drivers/block/paride/comm.c4
-rw-r--r--drivers/block/paride/dstr.c4
-rw-r--r--drivers/block/paride/epat.c4
-rw-r--r--drivers/block/paride/epia.c4
-rw-r--r--drivers/block/paride/fit2.c4
-rw-r--r--drivers/block/paride/fit3.c4
-rw-r--r--drivers/block/paride/friq.c4
-rw-r--r--drivers/block/paride/frpw.c4
-rw-r--r--drivers/block/paride/jumbo70
-rw-r--r--drivers/block/paride/kbic.c14
-rw-r--r--drivers/block/paride/ktti.c4
-rw-r--r--drivers/block/paride/on20.c4
-rw-r--r--drivers/block/paride/on26.c4
-rw-r--r--drivers/block/paride/paride.c47
-rw-r--r--drivers/block/paride/paride.h4
-rw-r--r--drivers/block/paride/pcd.c8
-rw-r--r--drivers/block/paride/pf.c8
-rw-r--r--drivers/block/paride/pg.c4
-rw-r--r--drivers/block/paride/pt.c4
-rw-r--r--drivers/block/pktcdvd.c2
30 files changed, 256 insertions, 341 deletions
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c
index 742d07403101..8d81a3a64c07 100644
--- a/drivers/block/DAC960.c
+++ b/drivers/block/DAC960.c
@@ -324,13 +324,13 @@ static boolean DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller)
324 Command->Next = Controller->FreeCommands; 324 Command->Next = Controller->FreeCommands;
325 Controller->FreeCommands = Command; 325 Controller->FreeCommands = Command;
326 Controller->Commands[CommandIdentifier-1] = Command; 326 Controller->Commands[CommandIdentifier-1] = Command;
327 ScatterGatherCPU = pci_pool_alloc(ScatterGatherPool, SLAB_ATOMIC, 327 ScatterGatherCPU = pci_pool_alloc(ScatterGatherPool, GFP_ATOMIC,
328 &ScatterGatherDMA); 328 &ScatterGatherDMA);
329 if (ScatterGatherCPU == NULL) 329 if (ScatterGatherCPU == NULL)
330 return DAC960_Failure(Controller, "AUXILIARY STRUCTURE CREATION"); 330 return DAC960_Failure(Controller, "AUXILIARY STRUCTURE CREATION");
331 331
332 if (RequestSensePool != NULL) { 332 if (RequestSensePool != NULL) {
333 RequestSenseCPU = pci_pool_alloc(RequestSensePool, SLAB_ATOMIC, 333 RequestSenseCPU = pci_pool_alloc(RequestSensePool, GFP_ATOMIC,
334 &RequestSenseDMA); 334 &RequestSenseDMA);
335 if (RequestSenseCPU == NULL) { 335 if (RequestSenseCPU == NULL) {
336 pci_pool_free(ScatterGatherPool, ScatterGatherCPU, 336 pci_pool_free(ScatterGatherPool, ScatterGatherCPU,
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index 17dc22282e14..85072446d772 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -168,7 +168,8 @@ config BLK_CPQ_CISS_DA
168 168
169config CISS_SCSI_TAPE 169config CISS_SCSI_TAPE
170 bool "SCSI tape drive support for Smart Array 5xxx" 170 bool "SCSI tape drive support for Smart Array 5xxx"
171 depends on BLK_CPQ_CISS_DA && SCSI && PROC_FS 171 depends on BLK_CPQ_CISS_DA && PROC_FS
172 depends on SCSI=y || SCSI=BLK_CPQ_CISS_DA
172 help 173 help
173 When enabled (Y), this option allows SCSI tape drives and SCSI medium 174 When enabled (Y), this option allows SCSI tape drives and SCSI medium
174 changers (tape robots) to be accessed via a Compaq 5xxx array 175 changers (tape robots) to be accessed via a Compaq 5xxx array
@@ -305,6 +306,7 @@ config BLK_DEV_LOOP
305config BLK_DEV_CRYPTOLOOP 306config BLK_DEV_CRYPTOLOOP
306 tristate "Cryptoloop Support" 307 tristate "Cryptoloop Support"
307 select CRYPTO 308 select CRYPTO
309 select CRYPTO_CBC
308 depends on BLK_DEV_LOOP 310 depends on BLK_DEV_LOOP
309 ---help--- 311 ---help---
310 Say Y here if you want to be able to use the ciphers that are 312 Say Y here if you want to be able to use the ciphers that are
diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
index aa25f8b09fe3..478489c568a4 100644
--- a/drivers/block/aoe/aoeblk.c
+++ b/drivers/block/aoe/aoeblk.c
@@ -12,7 +12,7 @@
12#include <linux/netdevice.h> 12#include <linux/netdevice.h>
13#include "aoe.h" 13#include "aoe.h"
14 14
15static kmem_cache_t *buf_pool_cache; 15static struct kmem_cache *buf_pool_cache;
16 16
17static ssize_t aoedisk_show_state(struct gendisk * disk, char *page) 17static ssize_t aoedisk_show_state(struct gendisk * disk, char *page)
18{ 18{
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 4105c3bf3476..892e092afe9a 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -47,14 +47,15 @@
47#include <linux/completion.h> 47#include <linux/completion.h>
48 48
49#define CCISS_DRIVER_VERSION(maj,min,submin) ((maj<<16)|(min<<8)|(submin)) 49#define CCISS_DRIVER_VERSION(maj,min,submin) ((maj<<16)|(min<<8)|(submin))
50#define DRIVER_NAME "HP CISS Driver (v 3.6.10)" 50#define DRIVER_NAME "HP CISS Driver (v 3.6.14)"
51#define DRIVER_VERSION CCISS_DRIVER_VERSION(3,6,10) 51#define DRIVER_VERSION CCISS_DRIVER_VERSION(3,6,14)
52 52
53/* Embedded module documentation macros - see modules.h */ 53/* Embedded module documentation macros - see modules.h */
54MODULE_AUTHOR("Hewlett-Packard Company"); 54MODULE_AUTHOR("Hewlett-Packard Company");
55MODULE_DESCRIPTION("Driver for HP Controller SA5xxx SA6xxx version 3.6.10"); 55MODULE_DESCRIPTION("Driver for HP Controller SA5xxx SA6xxx version 3.6.14");
56MODULE_SUPPORTED_DEVICE("HP SA5i SA5i+ SA532 SA5300 SA5312 SA641 SA642 SA6400" 56MODULE_SUPPORTED_DEVICE("HP SA5i SA5i+ SA532 SA5300 SA5312 SA641 SA642 SA6400"
57 " SA6i P600 P800 P400 P400i E200 E200i E500"); 57 " SA6i P600 P800 P400 P400i E200 E200i E500");
58MODULE_VERSION("3.6.14");
58MODULE_LICENSE("GPL"); 59MODULE_LICENSE("GPL");
59 60
60#include "cciss_cmd.h" 61#include "cciss_cmd.h"
@@ -81,7 +82,9 @@ static const struct pci_device_id cciss_pci_device_id[] = {
81 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3213}, 82 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3213},
82 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3214}, 83 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3214},
83 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3215}, 84 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3215},
84 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSC, 0x103C, 0x3233}, 85 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSC, 0x103C, 0x3237},
86 {PCI_VENDOR_ID_HP, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
87 PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0},
85 {0,} 88 {0,}
86}; 89};
87 90
@@ -90,27 +93,29 @@ MODULE_DEVICE_TABLE(pci, cciss_pci_device_id);
90/* board_id = Subsystem Device ID & Vendor ID 93/* board_id = Subsystem Device ID & Vendor ID
91 * product = Marketing Name for the board 94 * product = Marketing Name for the board
92 * access = Address of the struct of function pointers 95 * access = Address of the struct of function pointers
96 * nr_cmds = Number of commands supported by controller
93 */ 97 */
94static struct board_type products[] = { 98static struct board_type products[] = {
95 {0x40700E11, "Smart Array 5300", &SA5_access}, 99 {0x40700E11, "Smart Array 5300", &SA5_access, 512},
96 {0x40800E11, "Smart Array 5i", &SA5B_access}, 100 {0x40800E11, "Smart Array 5i", &SA5B_access, 512},
97 {0x40820E11, "Smart Array 532", &SA5B_access}, 101 {0x40820E11, "Smart Array 532", &SA5B_access, 512},
98 {0x40830E11, "Smart Array 5312", &SA5B_access}, 102 {0x40830E11, "Smart Array 5312", &SA5B_access, 512},
99 {0x409A0E11, "Smart Array 641", &SA5_access}, 103 {0x409A0E11, "Smart Array 641", &SA5_access, 512},
100 {0x409B0E11, "Smart Array 642", &SA5_access}, 104 {0x409B0E11, "Smart Array 642", &SA5_access, 512},
101 {0x409C0E11, "Smart Array 6400", &SA5_access}, 105 {0x409C0E11, "Smart Array 6400", &SA5_access, 512},
102 {0x409D0E11, "Smart Array 6400 EM", &SA5_access}, 106 {0x409D0E11, "Smart Array 6400 EM", &SA5_access, 512},
103 {0x40910E11, "Smart Array 6i", &SA5_access}, 107 {0x40910E11, "Smart Array 6i", &SA5_access, 512},
104 {0x3225103C, "Smart Array P600", &SA5_access}, 108 {0x3225103C, "Smart Array P600", &SA5_access, 512},
105 {0x3223103C, "Smart Array P800", &SA5_access}, 109 {0x3223103C, "Smart Array P800", &SA5_access, 512},
106 {0x3234103C, "Smart Array P400", &SA5_access}, 110 {0x3234103C, "Smart Array P400", &SA5_access, 512},
107 {0x3235103C, "Smart Array P400i", &SA5_access}, 111 {0x3235103C, "Smart Array P400i", &SA5_access, 512},
108 {0x3211103C, "Smart Array E200i", &SA5_access}, 112 {0x3211103C, "Smart Array E200i", &SA5_access, 120},
109 {0x3212103C, "Smart Array E200", &SA5_access}, 113 {0x3212103C, "Smart Array E200", &SA5_access, 120},
110 {0x3213103C, "Smart Array E200i", &SA5_access}, 114 {0x3213103C, "Smart Array E200i", &SA5_access, 120},
111 {0x3214103C, "Smart Array E200i", &SA5_access}, 115 {0x3214103C, "Smart Array E200i", &SA5_access, 120},
112 {0x3215103C, "Smart Array E200i", &SA5_access}, 116 {0x3215103C, "Smart Array E200i", &SA5_access, 120},
113 {0x3233103C, "Smart Array E500", &SA5_access}, 117 {0x3237103C, "Smart Array E500", &SA5_access, 512},
118 {0xFFFF103C, "Unknown Smart Array", &SA5_access, 120},
114}; 119};
115 120
116/* How long to wait (in milliseconds) for board to go into simple mode */ 121/* How long to wait (in milliseconds) for board to go into simple mode */
@@ -121,7 +126,6 @@ static struct board_type products[] = {
121#define MAX_CMD_RETRIES 3 126#define MAX_CMD_RETRIES 3
122 127
123#define READ_AHEAD 1024 128#define READ_AHEAD 1024
124#define NR_CMDS 384 /* #commands that can be outstanding */
125#define MAX_CTLR 32 129#define MAX_CTLR 32
126 130
127/* Originally cciss driver only supports 8 major numbers */ 131/* Originally cciss driver only supports 8 major numbers */
@@ -137,7 +141,6 @@ static int cciss_ioctl(struct inode *inode, struct file *filep,
137 unsigned int cmd, unsigned long arg); 141 unsigned int cmd, unsigned long arg);
138static int cciss_getgeo(struct block_device *bdev, struct hd_geometry *geo); 142static int cciss_getgeo(struct block_device *bdev, struct hd_geometry *geo);
139 143
140static int revalidate_allvol(ctlr_info_t *host);
141static int cciss_revalidate(struct gendisk *disk); 144static int cciss_revalidate(struct gendisk *disk);
142static int rebuild_lun_table(ctlr_info_t *h, struct gendisk *del_disk); 145static int rebuild_lun_table(ctlr_info_t *h, struct gendisk *del_disk);
143static int deregister_disk(struct gendisk *disk, drive_info_struct *drv, 146static int deregister_disk(struct gendisk *disk, drive_info_struct *drv,
@@ -265,6 +268,7 @@ static int cciss_proc_get_info(char *buffer, char **start, off_t offset,
265 "Firmware Version: %c%c%c%c\n" 268 "Firmware Version: %c%c%c%c\n"
266 "IRQ: %d\n" 269 "IRQ: %d\n"
267 "Logical drives: %d\n" 270 "Logical drives: %d\n"
271 "Max sectors: %d\n"
268 "Current Q depth: %d\n" 272 "Current Q depth: %d\n"
269 "Current # commands on controller: %d\n" 273 "Current # commands on controller: %d\n"
270 "Max Q depth since init: %d\n" 274 "Max Q depth since init: %d\n"
@@ -275,7 +279,9 @@ static int cciss_proc_get_info(char *buffer, char **start, off_t offset,
275 (unsigned long)h->board_id, 279 (unsigned long)h->board_id,
276 h->firm_ver[0], h->firm_ver[1], h->firm_ver[2], 280 h->firm_ver[0], h->firm_ver[1], h->firm_ver[2],
277 h->firm_ver[3], (unsigned int)h->intr[SIMPLE_MODE_INT], 281 h->firm_ver[3], (unsigned int)h->intr[SIMPLE_MODE_INT],
278 h->num_luns, h->Qdepth, h->commands_outstanding, 282 h->num_luns,
283 h->cciss_max_sectors,
284 h->Qdepth, h->commands_outstanding,
279 h->maxQsinceinit, h->max_outstanding, h->maxSG); 285 h->maxQsinceinit, h->max_outstanding, h->maxSG);
280 286
281 pos += size; 287 pos += size;
@@ -400,8 +406,8 @@ static CommandList_struct *cmd_alloc(ctlr_info_t *h, int get_from_pool)
400 } else { /* get it out of the controllers pool */ 406 } else { /* get it out of the controllers pool */
401 407
402 do { 408 do {
403 i = find_first_zero_bit(h->cmd_pool_bits, NR_CMDS); 409 i = find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds);
404 if (i == NR_CMDS) 410 if (i == h->nr_cmds)
405 return NULL; 411 return NULL;
406 } while (test_and_set_bit 412 } while (test_and_set_bit
407 (i & (BITS_PER_LONG - 1), 413 (i & (BITS_PER_LONG - 1),
@@ -487,7 +493,7 @@ static int cciss_open(struct inode *inode, struct file *filep)
487 * but I'm already using way to many device nodes to claim another one 493 * but I'm already using way to many device nodes to claim another one
488 * for "raw controller". 494 * for "raw controller".
489 */ 495 */
490 if (drv->nr_blocks == 0) { 496 if (drv->heads == 0) {
491 if (iminor(inode) != 0) { /* not node 0? */ 497 if (iminor(inode) != 0) { /* not node 0? */
492 /* if not node 0 make sure it is a partition = 0 */ 498 /* if not node 0 make sure it is a partition = 0 */
493 if (iminor(inode) & 0x0f) { 499 if (iminor(inode) & 0x0f) {
@@ -850,9 +856,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep,
850 } 856 }
851 857
852 case CCISS_REVALIDVOLS: 858 case CCISS_REVALIDVOLS:
853 if (bdev != bdev->bd_contains || drv != host->drv) 859 return rebuild_lun_table(host, NULL);
854 return -ENXIO;
855 return revalidate_allvol(host);
856 860
857 case CCISS_GETLUNINFO:{ 861 case CCISS_GETLUNINFO:{
858 LogvolInfo_struct luninfo; 862 LogvolInfo_struct luninfo;
@@ -1152,75 +1156,6 @@ static int cciss_ioctl(struct inode *inode, struct file *filep,
1152 } 1156 }
1153} 1157}
1154 1158
1155/*
1156 * revalidate_allvol is for online array config utilities. After a
1157 * utility reconfigures the drives in the array, it can use this function
1158 * (through an ioctl) to make the driver zap any previous disk structs for
1159 * that controller and get new ones.
1160 *
1161 * Right now I'm using the getgeometry() function to do this, but this
1162 * function should probably be finer grained and allow you to revalidate one
1163 * particular logical volume (instead of all of them on a particular
1164 * controller).
1165 */
1166static int revalidate_allvol(ctlr_info_t *host)
1167{
1168 int ctlr = host->ctlr, i;
1169 unsigned long flags;
1170
1171 spin_lock_irqsave(CCISS_LOCK(ctlr), flags);
1172 if (host->usage_count > 1) {
1173 spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags);
1174 printk(KERN_WARNING "cciss: Device busy for volume"
1175 " revalidation (usage=%d)\n", host->usage_count);
1176 return -EBUSY;
1177 }
1178 host->usage_count++;
1179 spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags);
1180
1181 for (i = 0; i < NWD; i++) {
1182 struct gendisk *disk = host->gendisk[i];
1183 if (disk) {
1184 request_queue_t *q = disk->queue;
1185
1186 if (disk->flags & GENHD_FL_UP)
1187 del_gendisk(disk);
1188 if (q)
1189 blk_cleanup_queue(q);
1190 }
1191 }
1192
1193 /*
1194 * Set the partition and block size structures for all volumes
1195 * on this controller to zero. We will reread all of this data
1196 */
1197 memset(host->drv, 0, sizeof(drive_info_struct)
1198 * CISS_MAX_LUN);
1199 /*
1200 * Tell the array controller not to give us any interrupts while
1201 * we check the new geometry. Then turn interrupts back on when
1202 * we're done.
1203 */
1204 host->access.set_intr_mask(host, CCISS_INTR_OFF);
1205 cciss_getgeometry(ctlr);
1206 host->access.set_intr_mask(host, CCISS_INTR_ON);
1207
1208 /* Loop through each real device */
1209 for (i = 0; i < NWD; i++) {
1210 struct gendisk *disk = host->gendisk[i];
1211 drive_info_struct *drv = &(host->drv[i]);
1212 /* we must register the controller even if no disks exist */
1213 /* this is for the online array utilities */
1214 if (!drv->heads && i)
1215 continue;
1216 blk_queue_hardsect_size(drv->queue, drv->block_size);
1217 set_capacity(disk, drv->nr_blocks);
1218 add_disk(disk);
1219 }
1220 host->usage_count--;
1221 return 0;
1222}
1223
1224static inline void complete_buffers(struct bio *bio, int status) 1159static inline void complete_buffers(struct bio *bio, int status)
1225{ 1160{
1226 while (bio) { 1161 while (bio) {
@@ -1243,7 +1178,7 @@ static void cciss_check_queues(ctlr_info_t *h)
1243 * in case the interrupt we serviced was from an ioctl and did not 1178 * in case the interrupt we serviced was from an ioctl and did not
1244 * free any new commands. 1179 * free any new commands.
1245 */ 1180 */
1246 if ((find_first_zero_bit(h->cmd_pool_bits, NR_CMDS)) == NR_CMDS) 1181 if ((find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds)) == h->nr_cmds)
1247 return; 1182 return;
1248 1183
1249 /* We have room on the queue for more commands. Now we need to queue 1184 /* We have room on the queue for more commands. Now we need to queue
@@ -1262,7 +1197,7 @@ static void cciss_check_queues(ctlr_info_t *h)
1262 /* check to see if we have maxed out the number of commands 1197 /* check to see if we have maxed out the number of commands
1263 * that can be placed on the queue. 1198 * that can be placed on the queue.
1264 */ 1199 */
1265 if ((find_first_zero_bit(h->cmd_pool_bits, NR_CMDS)) == NR_CMDS) { 1200 if ((find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds)) == h->nr_cmds) {
1266 if (curr_queue == start_queue) { 1201 if (curr_queue == start_queue) {
1267 h->next_to_run = 1202 h->next_to_run =
1268 (start_queue + 1) % (h->highest_lun + 1); 1203 (start_queue + 1) % (h->highest_lun + 1);
@@ -1380,6 +1315,11 @@ static void cciss_update_drive_info(int ctlr, int drv_index)
1380 /* if it's the controller it's already added */ 1315 /* if it's the controller it's already added */
1381 if (drv_index) { 1316 if (drv_index) {
1382 disk->queue = blk_init_queue(do_cciss_request, &h->lock); 1317 disk->queue = blk_init_queue(do_cciss_request, &h->lock);
1318 sprintf(disk->disk_name, "cciss/c%dd%d", ctlr, drv_index);
1319 disk->major = h->major;
1320 disk->first_minor = drv_index << NWD_SHIFT;
1321 disk->fops = &cciss_fops;
1322 disk->private_data = &h->drv[drv_index];
1383 1323
1384 /* Set up queue information */ 1324 /* Set up queue information */
1385 disk->queue->backing_dev_info.ra_pages = READ_AHEAD; 1325 disk->queue->backing_dev_info.ra_pages = READ_AHEAD;
@@ -1391,7 +1331,7 @@ static void cciss_update_drive_info(int ctlr, int drv_index)
1391 /* This is a limit in the driver and could be eliminated. */ 1331 /* This is a limit in the driver and could be eliminated. */
1392 blk_queue_max_phys_segments(disk->queue, MAXSGENTRIES); 1332 blk_queue_max_phys_segments(disk->queue, MAXSGENTRIES);
1393 1333
1394 blk_queue_max_sectors(disk->queue, 512); 1334 blk_queue_max_sectors(disk->queue, h->cciss_max_sectors);
1395 1335
1396 blk_queue_softirq_done(disk->queue, cciss_softirq_done); 1336 blk_queue_softirq_done(disk->queue, cciss_softirq_done);
1397 1337
@@ -1458,11 +1398,6 @@ static int rebuild_lun_table(ctlr_info_t *h, struct gendisk *del_disk)
1458 1398
1459 /* Set busy_configuring flag for this operation */ 1399 /* Set busy_configuring flag for this operation */
1460 spin_lock_irqsave(CCISS_LOCK(h->ctlr), flags); 1400 spin_lock_irqsave(CCISS_LOCK(h->ctlr), flags);
1461 if (h->num_luns >= CISS_MAX_LUN) {
1462 spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags);
1463 return -EINVAL;
1464 }
1465
1466 if (h->busy_configuring) { 1401 if (h->busy_configuring) {
1467 spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); 1402 spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags);
1468 return -EBUSY; 1403 return -EBUSY;
@@ -1495,17 +1430,8 @@ static int rebuild_lun_table(ctlr_info_t *h, struct gendisk *del_disk)
1495 0, 0, TYPE_CMD); 1430 0, 0, TYPE_CMD);
1496 1431
1497 if (return_code == IO_OK) { 1432 if (return_code == IO_OK) {
1498 listlength |= 1433 listlength =
1499 (0xff & (unsigned int)(ld_buff->LUNListLength[0])) 1434 be32_to_cpu(*(__u32 *) ld_buff->LUNListLength);
1500 << 24;
1501 listlength |=
1502 (0xff & (unsigned int)(ld_buff->LUNListLength[1]))
1503 << 16;
1504 listlength |=
1505 (0xff & (unsigned int)(ld_buff->LUNListLength[2]))
1506 << 8;
1507 listlength |=
1508 0xff & (unsigned int)(ld_buff->LUNListLength[3]);
1509 } else { /* reading number of logical volumes failed */ 1435 } else { /* reading number of logical volumes failed */
1510 printk(KERN_WARNING "cciss: report logical volume" 1436 printk(KERN_WARNING "cciss: report logical volume"
1511 " command failed\n"); 1437 " command failed\n");
@@ -1556,6 +1482,14 @@ static int rebuild_lun_table(ctlr_info_t *h, struct gendisk *del_disk)
1556 if (drv_index == -1) 1482 if (drv_index == -1)
1557 goto freeret; 1483 goto freeret;
1558 1484
1485 /*Check if the gendisk needs to be allocated */
1486 if (!h->gendisk[drv_index]){
1487 h->gendisk[drv_index] = alloc_disk(1 << NWD_SHIFT);
1488 if (!h->gendisk[drv_index]){
1489 printk(KERN_ERR "cciss: could not allocate new disk %d\n", drv_index);
1490 goto mem_msg;
1491 }
1492 }
1559 } 1493 }
1560 h->drv[drv_index].LunID = lunid; 1494 h->drv[drv_index].LunID = lunid;
1561 cciss_update_drive_info(ctlr, drv_index); 1495 cciss_update_drive_info(ctlr, drv_index);
@@ -1593,6 +1527,7 @@ static int rebuild_lun_table(ctlr_info_t *h, struct gendisk *del_disk)
1593static int deregister_disk(struct gendisk *disk, drive_info_struct *drv, 1527static int deregister_disk(struct gendisk *disk, drive_info_struct *drv,
1594 int clear_all) 1528 int clear_all)
1595{ 1529{
1530 int i;
1596 ctlr_info_t *h = get_host(disk); 1531 ctlr_info_t *h = get_host(disk);
1597 1532
1598 if (!capable(CAP_SYS_RAWIO)) 1533 if (!capable(CAP_SYS_RAWIO))
@@ -1616,9 +1551,35 @@ static int deregister_disk(struct gendisk *disk, drive_info_struct *drv,
1616 del_gendisk(disk); 1551 del_gendisk(disk);
1617 if (q) { 1552 if (q) {
1618 blk_cleanup_queue(q); 1553 blk_cleanup_queue(q);
1554 /* Set drv->queue to NULL so that we do not try
1555 * to call blk_start_queue on this queue in the
1556 * interrupt handler
1557 */
1619 drv->queue = NULL; 1558 drv->queue = NULL;
1620 } 1559 }
1560 /* If clear_all is set then we are deleting the logical
1561 * drive, not just refreshing its info. For drives
1562 * other than disk 0 we will call put_disk. We do not
1563 * do this for disk 0 as we need it to be able to
1564 * configure the controller.
1565 */
1566 if (clear_all){
1567 /* This isn't pretty, but we need to find the
1568 * disk in our array and NULL our the pointer.
1569 * This is so that we will call alloc_disk if
1570 * this index is used again later.
1571 */
1572 for (i=0; i < CISS_MAX_LUN; i++){
1573 if(h->gendisk[i] == disk){
1574 h->gendisk[i] = NULL;
1575 break;
1576 }
1577 }
1578 put_disk(disk);
1579 }
1621 } 1580 }
1581 } else {
1582 set_capacity(disk, 0);
1622 } 1583 }
1623 1584
1624 --h->num_luns; 1585 --h->num_luns;
@@ -2136,7 +2097,7 @@ static int add_sendcmd_reject(__u8 cmd, int ctlr, unsigned long complete)
2136 2097
2137 /* We've sent down an abort or reset, but something else 2098 /* We've sent down an abort or reset, but something else
2138 has completed */ 2099 has completed */
2139 if (srl->ncompletions >= (NR_CMDS + 2)) { 2100 if (srl->ncompletions >= (hba[ctlr]->nr_cmds + 2)) {
2140 /* Uh oh. No room to save it for later... */ 2101 /* Uh oh. No room to save it for later... */
2141 printk(KERN_WARNING "cciss%d: Sendcmd: Invalid command addr, " 2102 printk(KERN_WARNING "cciss%d: Sendcmd: Invalid command addr, "
2142 "reject list overflow, command lost!\n", ctlr); 2103 "reject list overflow, command lost!\n", ctlr);
@@ -2673,7 +2634,7 @@ static irqreturn_t do_cciss_intr(int irq, void *dev_id)
2673 a1 = a; 2634 a1 = a;
2674 if ((a & 0x04)) { 2635 if ((a & 0x04)) {
2675 a2 = (a >> 3); 2636 a2 = (a >> 3);
2676 if (a2 >= NR_CMDS) { 2637 if (a2 >= h->nr_cmds) {
2677 printk(KERN_WARNING 2638 printk(KERN_WARNING
2678 "cciss: controller cciss%d failed, stopping.\n", 2639 "cciss: controller cciss%d failed, stopping.\n",
2679 h->ctlr); 2640 h->ctlr);
@@ -2827,23 +2788,21 @@ static void __devinit cciss_interrupt_mode(ctlr_info_t *c,
2827 if (err > 0) { 2788 if (err > 0) {
2828 printk(KERN_WARNING "cciss: only %d MSI-X vectors " 2789 printk(KERN_WARNING "cciss: only %d MSI-X vectors "
2829 "available\n", err); 2790 "available\n", err);
2791 goto default_int_mode;
2830 } else { 2792 } else {
2831 printk(KERN_WARNING "cciss: MSI-X init failed %d\n", 2793 printk(KERN_WARNING "cciss: MSI-X init failed %d\n",
2832 err); 2794 err);
2795 goto default_int_mode;
2833 } 2796 }
2834 } 2797 }
2835 if (pci_find_capability(pdev, PCI_CAP_ID_MSI)) { 2798 if (pci_find_capability(pdev, PCI_CAP_ID_MSI)) {
2836 if (!pci_enable_msi(pdev)) { 2799 if (!pci_enable_msi(pdev)) {
2837 c->intr[SIMPLE_MODE_INT] = pdev->irq;
2838 c->msi_vector = 1; 2800 c->msi_vector = 1;
2839 return;
2840 } else { 2801 } else {
2841 printk(KERN_WARNING "cciss: MSI init failed\n"); 2802 printk(KERN_WARNING "cciss: MSI init failed\n");
2842 c->intr[SIMPLE_MODE_INT] = pdev->irq;
2843 return;
2844 } 2803 }
2845 } 2804 }
2846 default_int_mode: 2805default_int_mode:
2847#endif /* CONFIG_PCI_MSI */ 2806#endif /* CONFIG_PCI_MSI */
2848 /* if we get here we're going to use the default interrupt mode */ 2807 /* if we get here we're going to use the default interrupt mode */
2849 c->intr[SIMPLE_MODE_INT] = pdev->irq; 2808 c->intr[SIMPLE_MODE_INT] = pdev->irq;
@@ -2956,16 +2915,10 @@ static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev)
2956 if (board_id == products[i].board_id) { 2915 if (board_id == products[i].board_id) {
2957 c->product_name = products[i].product_name; 2916 c->product_name = products[i].product_name;
2958 c->access = *(products[i].access); 2917 c->access = *(products[i].access);
2918 c->nr_cmds = products[i].nr_cmds;
2959 break; 2919 break;
2960 } 2920 }
2961 } 2921 }
2962 if (i == ARRAY_SIZE(products)) {
2963 printk(KERN_WARNING "cciss: Sorry, I don't know how"
2964 " to access the Smart Array controller %08lx\n",
2965 (unsigned long)board_id);
2966 err = -ENODEV;
2967 goto err_out_free_res;
2968 }
2969 if ((readb(&c->cfgtable->Signature[0]) != 'C') || 2922 if ((readb(&c->cfgtable->Signature[0]) != 'C') ||
2970 (readb(&c->cfgtable->Signature[1]) != 'I') || 2923 (readb(&c->cfgtable->Signature[1]) != 'I') ||
2971 (readb(&c->cfgtable->Signature[2]) != 'S') || 2924 (readb(&c->cfgtable->Signature[2]) != 'S') ||
@@ -2974,6 +2927,27 @@ static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev)
2974 err = -ENODEV; 2927 err = -ENODEV;
2975 goto err_out_free_res; 2928 goto err_out_free_res;
2976 } 2929 }
2930 /* We didn't find the controller in our list. We know the
2931 * signature is valid. If it's an HP device let's try to
2932 * bind to the device and fire it up. Otherwise we bail.
2933 */
2934 if (i == ARRAY_SIZE(products)) {
2935 if (subsystem_vendor_id == PCI_VENDOR_ID_HP) {
2936 c->product_name = products[i-1].product_name;
2937 c->access = *(products[i-1].access);
2938 c->nr_cmds = products[i-1].nr_cmds;
2939 printk(KERN_WARNING "cciss: This is an unknown "
2940 "Smart Array controller.\n"
2941 "cciss: Please update to the latest driver "
2942 "available from www.hp.com.\n");
2943 } else {
2944 printk(KERN_WARNING "cciss: Sorry, I don't know how"
2945 " to access the Smart Array controller %08lx\n"
2946 , (unsigned long)board_id);
2947 err = -ENODEV;
2948 goto err_out_free_res;
2949 }
2950 }
2977#ifdef CONFIG_X86 2951#ifdef CONFIG_X86
2978 { 2952 {
2979 /* Need to enable prefetch in the SCSI core for 6400 in x86 */ 2953 /* Need to enable prefetch in the SCSI core for 6400 in x86 */
@@ -2984,6 +2958,17 @@ static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev)
2984 } 2958 }
2985#endif 2959#endif
2986 2960
2961 /* Disabling DMA prefetch for the P600
2962 * An ASIC bug may result in a prefetch beyond
2963 * physical memory.
2964 */
2965 if(board_id == 0x3225103C) {
2966 __u32 dma_prefetch;
2967 dma_prefetch = readl(c->vaddr + I2O_DMA1_CFG);
2968 dma_prefetch |= 0x8000;
2969 writel(dma_prefetch, c->vaddr + I2O_DMA1_CFG);
2970 }
2971
2987#ifdef CCISS_DEBUG 2972#ifdef CCISS_DEBUG
2988 printk("Trying to put board into Simple mode\n"); 2973 printk("Trying to put board into Simple mode\n");
2989#endif /* CCISS_DEBUG */ 2974#endif /* CCISS_DEBUG */
@@ -3158,13 +3143,7 @@ geo_inq:
3158/* Returns -1 if no free entries are left. */ 3143/* Returns -1 if no free entries are left. */
3159static int alloc_cciss_hba(void) 3144static int alloc_cciss_hba(void)
3160{ 3145{
3161 struct gendisk *disk[NWD]; 3146 int i;
3162 int i, n;
3163 for (n = 0; n < NWD; n++) {
3164 disk[n] = alloc_disk(1 << NWD_SHIFT);
3165 if (!disk[n])
3166 goto out;
3167 }
3168 3147
3169 for (i = 0; i < MAX_CTLR; i++) { 3148 for (i = 0; i < MAX_CTLR; i++) {
3170 if (!hba[i]) { 3149 if (!hba[i]) {
@@ -3172,20 +3151,18 @@ static int alloc_cciss_hba(void)
3172 p = kzalloc(sizeof(ctlr_info_t), GFP_KERNEL); 3151 p = kzalloc(sizeof(ctlr_info_t), GFP_KERNEL);
3173 if (!p) 3152 if (!p)
3174 goto Enomem; 3153 goto Enomem;
3175 for (n = 0; n < NWD; n++) 3154 p->gendisk[0] = alloc_disk(1 << NWD_SHIFT);
3176 p->gendisk[n] = disk[n]; 3155 if (!p->gendisk[0])
3156 goto Enomem;
3177 hba[i] = p; 3157 hba[i] = p;
3178 return i; 3158 return i;
3179 } 3159 }
3180 } 3160 }
3181 printk(KERN_WARNING "cciss: This driver supports a maximum" 3161 printk(KERN_WARNING "cciss: This driver supports a maximum"
3182 " of %d controllers.\n", MAX_CTLR); 3162 " of %d controllers.\n", MAX_CTLR);
3183 goto out; 3163 return -1;
3184 Enomem: 3164Enomem:
3185 printk(KERN_ERR "cciss: out of memory.\n"); 3165 printk(KERN_ERR "cciss: out of memory.\n");
3186 out:
3187 while (n--)
3188 put_disk(disk[n]);
3189 return -1; 3166 return -1;
3190} 3167}
3191 3168
@@ -3195,7 +3172,7 @@ static void free_hba(int i)
3195 int n; 3172 int n;
3196 3173
3197 hba[i] = NULL; 3174 hba[i] = NULL;
3198 for (n = 0; n < NWD; n++) 3175 for (n = 0; n < CISS_MAX_LUN; n++)
3199 put_disk(p->gendisk[n]); 3176 put_disk(p->gendisk[n]);
3200 kfree(p); 3177 kfree(p);
3201} 3178}
@@ -3208,9 +3185,8 @@ static void free_hba(int i)
3208static int __devinit cciss_init_one(struct pci_dev *pdev, 3185static int __devinit cciss_init_one(struct pci_dev *pdev,
3209 const struct pci_device_id *ent) 3186 const struct pci_device_id *ent)
3210{ 3187{
3211 request_queue_t *q;
3212 int i; 3188 int i;
3213 int j; 3189 int j = 0;
3214 int rc; 3190 int rc;
3215 int dac; 3191 int dac;
3216 3192
@@ -3269,15 +3245,15 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
3269 hba[i]->intr[SIMPLE_MODE_INT], dac ? "" : " not"); 3245 hba[i]->intr[SIMPLE_MODE_INT], dac ? "" : " not");
3270 3246
3271 hba[i]->cmd_pool_bits = 3247 hba[i]->cmd_pool_bits =
3272 kmalloc(((NR_CMDS + BITS_PER_LONG - 3248 kmalloc(((hba[i]->nr_cmds + BITS_PER_LONG -
3273 1) / BITS_PER_LONG) * sizeof(unsigned long), GFP_KERNEL); 3249 1) / BITS_PER_LONG) * sizeof(unsigned long), GFP_KERNEL);
3274 hba[i]->cmd_pool = (CommandList_struct *) 3250 hba[i]->cmd_pool = (CommandList_struct *)
3275 pci_alloc_consistent(hba[i]->pdev, 3251 pci_alloc_consistent(hba[i]->pdev,
3276 NR_CMDS * sizeof(CommandList_struct), 3252 hba[i]->nr_cmds * sizeof(CommandList_struct),
3277 &(hba[i]->cmd_pool_dhandle)); 3253 &(hba[i]->cmd_pool_dhandle));
3278 hba[i]->errinfo_pool = (ErrorInfo_struct *) 3254 hba[i]->errinfo_pool = (ErrorInfo_struct *)
3279 pci_alloc_consistent(hba[i]->pdev, 3255 pci_alloc_consistent(hba[i]->pdev,
3280 NR_CMDS * sizeof(ErrorInfo_struct), 3256 hba[i]->nr_cmds * sizeof(ErrorInfo_struct),
3281 &(hba[i]->errinfo_pool_dhandle)); 3257 &(hba[i]->errinfo_pool_dhandle));
3282 if ((hba[i]->cmd_pool_bits == NULL) 3258 if ((hba[i]->cmd_pool_bits == NULL)
3283 || (hba[i]->cmd_pool == NULL) 3259 || (hba[i]->cmd_pool == NULL)
@@ -3288,7 +3264,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
3288#ifdef CONFIG_CISS_SCSI_TAPE 3264#ifdef CONFIG_CISS_SCSI_TAPE
3289 hba[i]->scsi_rejects.complete = 3265 hba[i]->scsi_rejects.complete =
3290 kmalloc(sizeof(hba[i]->scsi_rejects.complete[0]) * 3266 kmalloc(sizeof(hba[i]->scsi_rejects.complete[0]) *
3291 (NR_CMDS + 5), GFP_KERNEL); 3267 (hba[i]->nr_cmds + 5), GFP_KERNEL);
3292 if (hba[i]->scsi_rejects.complete == NULL) { 3268 if (hba[i]->scsi_rejects.complete == NULL) {
3293 printk(KERN_ERR "cciss: out of memory"); 3269 printk(KERN_ERR "cciss: out of memory");
3294 goto clean4; 3270 goto clean4;
@@ -3302,7 +3278,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
3302 /* command and error info recs zeroed out before 3278 /* command and error info recs zeroed out before
3303 they are used */ 3279 they are used */
3304 memset(hba[i]->cmd_pool_bits, 0, 3280 memset(hba[i]->cmd_pool_bits, 0,
3305 ((NR_CMDS + BITS_PER_LONG - 3281 ((hba[i]->nr_cmds + BITS_PER_LONG -
3306 1) / BITS_PER_LONG) * sizeof(unsigned long)); 3282 1) / BITS_PER_LONG) * sizeof(unsigned long));
3307 3283
3308#ifdef CCISS_DEBUG 3284#ifdef CCISS_DEBUG
@@ -3317,18 +3293,34 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
3317 hba[i]->access.set_intr_mask(hba[i], CCISS_INTR_ON); 3293 hba[i]->access.set_intr_mask(hba[i], CCISS_INTR_ON);
3318 3294
3319 cciss_procinit(i); 3295 cciss_procinit(i);
3296
3297 hba[i]->cciss_max_sectors = 2048;
3298
3320 hba[i]->busy_initializing = 0; 3299 hba[i]->busy_initializing = 0;
3321 3300
3322 for (j = 0; j < NWD; j++) { /* mfm */ 3301 do {
3323 drive_info_struct *drv = &(hba[i]->drv[j]); 3302 drive_info_struct *drv = &(hba[i]->drv[j]);
3324 struct gendisk *disk = hba[i]->gendisk[j]; 3303 struct gendisk *disk = hba[i]->gendisk[j];
3304 request_queue_t *q;
3305
3306 /* Check if the disk was allocated already */
3307 if (!disk){
3308 hba[i]->gendisk[j] = alloc_disk(1 << NWD_SHIFT);
3309 disk = hba[i]->gendisk[j];
3310 }
3311
3312 /* Check that the disk was able to be allocated */
3313 if (!disk) {
3314 printk(KERN_ERR "cciss: unable to allocate memory for disk %d\n", j);
3315 goto clean4;
3316 }
3325 3317
3326 q = blk_init_queue(do_cciss_request, &hba[i]->lock); 3318 q = blk_init_queue(do_cciss_request, &hba[i]->lock);
3327 if (!q) { 3319 if (!q) {
3328 printk(KERN_ERR 3320 printk(KERN_ERR
3329 "cciss: unable to allocate queue for disk %d\n", 3321 "cciss: unable to allocate queue for disk %d\n",
3330 j); 3322 j);
3331 break; 3323 goto clean4;
3332 } 3324 }
3333 drv->queue = q; 3325 drv->queue = q;
3334 3326
@@ -3341,7 +3333,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
3341 /* This is a limit in the driver and could be eliminated. */ 3333 /* This is a limit in the driver and could be eliminated. */
3342 blk_queue_max_phys_segments(q, MAXSGENTRIES); 3334 blk_queue_max_phys_segments(q, MAXSGENTRIES);
3343 3335
3344 blk_queue_max_sectors(q, 512); 3336 blk_queue_max_sectors(q, hba[i]->cciss_max_sectors);
3345 3337
3346 blk_queue_softirq_done(q, cciss_softirq_done); 3338 blk_queue_softirq_done(q, cciss_softirq_done);
3347 3339
@@ -3360,7 +3352,8 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
3360 blk_queue_hardsect_size(q, drv->block_size); 3352 blk_queue_hardsect_size(q, drv->block_size);
3361 set_capacity(disk, drv->nr_blocks); 3353 set_capacity(disk, drv->nr_blocks);
3362 add_disk(disk); 3354 add_disk(disk);
3363 } 3355 j++;
3356 } while (j <= hba[i]->highest_lun);
3364 3357
3365 return 1; 3358 return 1;
3366 3359
@@ -3371,11 +3364,11 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
3371 kfree(hba[i]->cmd_pool_bits); 3364 kfree(hba[i]->cmd_pool_bits);
3372 if (hba[i]->cmd_pool) 3365 if (hba[i]->cmd_pool)
3373 pci_free_consistent(hba[i]->pdev, 3366 pci_free_consistent(hba[i]->pdev,
3374 NR_CMDS * sizeof(CommandList_struct), 3367 hba[i]->nr_cmds * sizeof(CommandList_struct),
3375 hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle); 3368 hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle);
3376 if (hba[i]->errinfo_pool) 3369 if (hba[i]->errinfo_pool)
3377 pci_free_consistent(hba[i]->pdev, 3370 pci_free_consistent(hba[i]->pdev,
3378 NR_CMDS * sizeof(ErrorInfo_struct), 3371 hba[i]->nr_cmds * sizeof(ErrorInfo_struct),
3379 hba[i]->errinfo_pool, 3372 hba[i]->errinfo_pool,
3380 hba[i]->errinfo_pool_dhandle); 3373 hba[i]->errinfo_pool_dhandle);
3381 free_irq(hba[i]->intr[SIMPLE_MODE_INT], hba[i]); 3374 free_irq(hba[i]->intr[SIMPLE_MODE_INT], hba[i]);
@@ -3383,6 +3376,15 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
3383 unregister_blkdev(hba[i]->major, hba[i]->devname); 3376 unregister_blkdev(hba[i]->major, hba[i]->devname);
3384 clean1: 3377 clean1:
3385 hba[i]->busy_initializing = 0; 3378 hba[i]->busy_initializing = 0;
3379 /* cleanup any queues that may have been initialized */
3380 for (j=0; j <= hba[i]->highest_lun; j++){
3381 drive_info_struct *drv = &(hba[i]->drv[j]);
3382 if (drv->queue)
3383 blk_cleanup_queue(drv->queue);
3384 }
3385 pci_release_regions(pdev);
3386 pci_disable_device(pdev);
3387 pci_set_drvdata(pdev, NULL);
3386 free_hba(i); 3388 free_hba(i);
3387 return -1; 3389 return -1;
3388} 3390}
@@ -3430,7 +3432,7 @@ static void __devexit cciss_remove_one(struct pci_dev *pdev)
3430 remove_proc_entry(hba[i]->devname, proc_cciss); 3432 remove_proc_entry(hba[i]->devname, proc_cciss);
3431 3433
3432 /* remove it from the disk list */ 3434 /* remove it from the disk list */
3433 for (j = 0; j < NWD; j++) { 3435 for (j = 0; j < CISS_MAX_LUN; j++) {
3434 struct gendisk *disk = hba[i]->gendisk[j]; 3436 struct gendisk *disk = hba[i]->gendisk[j];
3435 if (disk) { 3437 if (disk) {
3436 request_queue_t *q = disk->queue; 3438 request_queue_t *q = disk->queue;
@@ -3442,9 +3444,9 @@ static void __devexit cciss_remove_one(struct pci_dev *pdev)
3442 } 3444 }
3443 } 3445 }
3444 3446
3445 pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof(CommandList_struct), 3447 pci_free_consistent(hba[i]->pdev, hba[i]->nr_cmds * sizeof(CommandList_struct),
3446 hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle); 3448 hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle);
3447 pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof(ErrorInfo_struct), 3449 pci_free_consistent(hba[i]->pdev, hba[i]->nr_cmds * sizeof(ErrorInfo_struct),
3448 hba[i]->errinfo_pool, hba[i]->errinfo_pool_dhandle); 3450 hba[i]->errinfo_pool, hba[i]->errinfo_pool_dhandle);
3449 kfree(hba[i]->cmd_pool_bits); 3451 kfree(hba[i]->cmd_pool_bits);
3450#ifdef CONFIG_CISS_SCSI_TAPE 3452#ifdef CONFIG_CISS_SCSI_TAPE
diff --git a/drivers/block/cciss.h b/drivers/block/cciss.h
index 562235c1445a..b70988dd33ec 100644
--- a/drivers/block/cciss.h
+++ b/drivers/block/cciss.h
@@ -6,7 +6,6 @@
6#include "cciss_cmd.h" 6#include "cciss_cmd.h"
7 7
8 8
9#define NWD 16
10#define NWD_SHIFT 4 9#define NWD_SHIFT 4
11#define MAX_PART (1 << NWD_SHIFT) 10#define MAX_PART (1 << NWD_SHIFT)
12 11
@@ -60,6 +59,7 @@ struct ctlr_info
60 __u32 board_id; 59 __u32 board_id;
61 void __iomem *vaddr; 60 void __iomem *vaddr;
62 unsigned long paddr; 61 unsigned long paddr;
62 int nr_cmds; /* Number of commands allowed on this controller */
63 CfgTable_struct __iomem *cfgtable; 63 CfgTable_struct __iomem *cfgtable;
64 int interrupts_enabled; 64 int interrupts_enabled;
65 int major; 65 int major;
@@ -76,6 +76,7 @@ struct ctlr_info
76 unsigned int intr[4]; 76 unsigned int intr[4];
77 unsigned int msix_vector; 77 unsigned int msix_vector;
78 unsigned int msi_vector; 78 unsigned int msi_vector;
79 int cciss_max_sectors;
79 BYTE cciss_read; 80 BYTE cciss_read;
80 BYTE cciss_write; 81 BYTE cciss_write;
81 BYTE cciss_read_capacity; 82 BYTE cciss_read_capacity;
@@ -110,7 +111,7 @@ struct ctlr_info
110 int next_to_run; 111 int next_to_run;
111 112
112 // Disk structures we need to pass back 113 // Disk structures we need to pass back
113 struct gendisk *gendisk[NWD]; 114 struct gendisk *gendisk[CISS_MAX_LUN];
114#ifdef CONFIG_CISS_SCSI_TAPE 115#ifdef CONFIG_CISS_SCSI_TAPE
115 void *scsi_ctlr; /* ptr to structure containing scsi related stuff */ 116 void *scsi_ctlr; /* ptr to structure containing scsi related stuff */
116 /* list of block side commands the scsi error handling sucked up */ 117 /* list of block side commands the scsi error handling sucked up */
@@ -282,6 +283,7 @@ struct board_type {
282 __u32 board_id; 283 __u32 board_id;
283 char *product_name; 284 char *product_name;
284 struct access_method *access; 285 struct access_method *access;
286 int nr_cmds; /* Max cmds this kind of ctlr can handle. */
285}; 287};
286 288
287#define CCISS_LOCK(i) (&hba[i]->lock) 289#define CCISS_LOCK(i) (&hba[i]->lock)
diff --git a/drivers/block/cciss_cmd.h b/drivers/block/cciss_cmd.h
index 4af7c4c0c7af..43bf5593b59b 100644
--- a/drivers/block/cciss_cmd.h
+++ b/drivers/block/cciss_cmd.h
@@ -55,6 +55,7 @@
55#define I2O_INT_MASK 0x34 55#define I2O_INT_MASK 0x34
56#define I2O_IBPOST_Q 0x40 56#define I2O_IBPOST_Q 0x40
57#define I2O_OBPOST_Q 0x44 57#define I2O_OBPOST_Q 0x44
58#define I2O_DMA1_CFG 0x214
58 59
59//Configuration Table 60//Configuration Table
60#define CFGTBL_ChangeReq 0x00000001l 61#define CFGTBL_ChangeReq 0x00000001l
@@ -88,7 +89,7 @@ typedef union _u64bit
88//########################################################################### 89//###########################################################################
89//STRUCTURES 90//STRUCTURES
90//########################################################################### 91//###########################################################################
91#define CISS_MAX_LUN 16 92#define CISS_MAX_LUN 1024
92#define CISS_MAX_PHYS_LUN 1024 93#define CISS_MAX_PHYS_LUN 1024
93// SCSI-3 Cmmands 94// SCSI-3 Cmmands
94 95
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 9d1035e8d9d8..7bf2cfbd6285 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -355,14 +355,30 @@ harderror:
355 return NULL; 355 return NULL;
356} 356}
357 357
358static ssize_t pid_show(struct gendisk *disk, char *page)
359{
360 return sprintf(page, "%ld\n",
361 (long) ((struct nbd_device *)disk->private_data)->pid);
362}
363
364static struct disk_attribute pid_attr = {
365 .attr = { .name = "pid", .mode = S_IRUGO },
366 .show = pid_show,
367};
368
358static void nbd_do_it(struct nbd_device *lo) 369static void nbd_do_it(struct nbd_device *lo)
359{ 370{
360 struct request *req; 371 struct request *req;
361 372
362 BUG_ON(lo->magic != LO_MAGIC); 373 BUG_ON(lo->magic != LO_MAGIC);
363 374
375 lo->pid = current->pid;
376 sysfs_create_file(&lo->disk->kobj, &pid_attr.attr);
377
364 while ((req = nbd_read_stat(lo)) != NULL) 378 while ((req = nbd_read_stat(lo)) != NULL)
365 nbd_end_request(req); 379 nbd_end_request(req);
380
381 sysfs_remove_file(&lo->disk->kobj, &pid_attr.attr);
366 return; 382 return;
367} 383}
368 384
diff --git a/drivers/block/paride/aten.c b/drivers/block/paride/aten.c
index c4d696d43dc1..2695465568ad 100644
--- a/drivers/block/paride/aten.c
+++ b/drivers/block/paride/aten.c
@@ -149,12 +149,12 @@ static struct pi_protocol aten = {
149 149
150static int __init aten_init(void) 150static int __init aten_init(void)
151{ 151{
152 return pi_register(&aten)-1; 152 return paride_register(&aten);
153} 153}
154 154
155static void __exit aten_exit(void) 155static void __exit aten_exit(void)
156{ 156{
157 pi_unregister( &aten ); 157 paride_unregister( &aten );
158} 158}
159 159
160MODULE_LICENSE("GPL"); 160MODULE_LICENSE("GPL");
diff --git a/drivers/block/paride/bpck.c b/drivers/block/paride/bpck.c
index d462ff6b139d..4f27e7392e38 100644
--- a/drivers/block/paride/bpck.c
+++ b/drivers/block/paride/bpck.c
@@ -464,12 +464,12 @@ static struct pi_protocol bpck = {
464 464
465static int __init bpck_init(void) 465static int __init bpck_init(void)
466{ 466{
467 return pi_register(&bpck)-1; 467 return paride_register(&bpck);
468} 468}
469 469
470static void __exit bpck_exit(void) 470static void __exit bpck_exit(void)
471{ 471{
472 pi_unregister(&bpck); 472 paride_unregister(&bpck);
473} 473}
474 474
475MODULE_LICENSE("GPL"); 475MODULE_LICENSE("GPL");
diff --git a/drivers/block/paride/bpck6.c b/drivers/block/paride/bpck6.c
index 41a237c5957d..ad124525ac23 100644
--- a/drivers/block/paride/bpck6.c
+++ b/drivers/block/paride/bpck6.c
@@ -31,10 +31,7 @@ static int verbose; /* set this to 1 to see debugging messages and whatnot */
31#include <linux/slab.h> 31#include <linux/slab.h>
32#include <linux/types.h> 32#include <linux/types.h>
33#include <asm/io.h> 33#include <asm/io.h>
34
35#if defined(CONFIG_PARPORT_MODULE)||defined(CONFIG_PARPORT)
36#include <linux/parport.h> 34#include <linux/parport.h>
37#endif
38 35
39#include "ppc6lnx.c" 36#include "ppc6lnx.c"
40#include "paride.h" 37#include "paride.h"
@@ -139,11 +136,6 @@ static int bpck6_test_port ( PIA *pi ) /* check for 8-bit port */
139 PPCSTRUCT(pi)->ppc_id=pi->unit; 136 PPCSTRUCT(pi)->ppc_id=pi->unit;
140 PPCSTRUCT(pi)->lpt_addr=pi->port; 137 PPCSTRUCT(pi)->lpt_addr=pi->port;
141 138
142#ifdef CONFIG_PARPORT_PC_MODULE
143#define CONFIG_PARPORT_PC
144#endif
145
146#ifdef CONFIG_PARPORT_PC
147 /* look at the parport device to see if what modes we can use */ 139 /* look at the parport device to see if what modes we can use */
148 if(((struct pardevice *)(pi->pardev))->port->modes & 140 if(((struct pardevice *)(pi->pardev))->port->modes &
149 (PARPORT_MODE_EPP) 141 (PARPORT_MODE_EPP)
@@ -161,11 +153,6 @@ static int bpck6_test_port ( PIA *pi ) /* check for 8-bit port */
161 { 153 {
162 return 1; 154 return 1;
163 } 155 }
164#else
165 /* there is no way of knowing what kind of port we have
166 default to the highest mode possible */
167 return 5;
168#endif
169} 156}
170 157
171static int bpck6_probe_unit ( PIA *pi ) 158static int bpck6_probe_unit ( PIA *pi )
@@ -265,12 +252,12 @@ static int __init bpck6_init(void)
265 printk(KERN_INFO "bpck6: Copyright 2001 by Micro Solutions, Inc., DeKalb IL. USA\n"); 252 printk(KERN_INFO "bpck6: Copyright 2001 by Micro Solutions, Inc., DeKalb IL. USA\n");
266 if(verbose) 253 if(verbose)
267 printk(KERN_DEBUG "bpck6: verbose debug enabled.\n"); 254 printk(KERN_DEBUG "bpck6: verbose debug enabled.\n");
268 return pi_register(&bpck6) - 1; 255 return paride_register(&bpck6);
269} 256}
270 257
271static void __exit bpck6_exit(void) 258static void __exit bpck6_exit(void)
272{ 259{
273 pi_unregister(&bpck6); 260 paride_unregister(&bpck6);
274} 261}
275 262
276MODULE_LICENSE("GPL"); 263MODULE_LICENSE("GPL");
diff --git a/drivers/block/paride/comm.c b/drivers/block/paride/comm.c
index 43d61359d8ec..9bcd35495323 100644
--- a/drivers/block/paride/comm.c
+++ b/drivers/block/paride/comm.c
@@ -205,12 +205,12 @@ static struct pi_protocol comm = {
205 205
206static int __init comm_init(void) 206static int __init comm_init(void)
207{ 207{
208 return pi_register(&comm)-1; 208 return paride_register(&comm);
209} 209}
210 210
211static void __exit comm_exit(void) 211static void __exit comm_exit(void)
212{ 212{
213 pi_unregister(&comm); 213 paride_unregister(&comm);
214} 214}
215 215
216MODULE_LICENSE("GPL"); 216MODULE_LICENSE("GPL");
diff --git a/drivers/block/paride/dstr.c b/drivers/block/paride/dstr.c
index 04d53bf58e8c..accc5c777cbb 100644
--- a/drivers/block/paride/dstr.c
+++ b/drivers/block/paride/dstr.c
@@ -220,12 +220,12 @@ static struct pi_protocol dstr = {
220 220
221static int __init dstr_init(void) 221static int __init dstr_init(void)
222{ 222{
223 return pi_register(&dstr)-1; 223 return paride_register(&dstr);
224} 224}
225 225
226static void __exit dstr_exit(void) 226static void __exit dstr_exit(void)
227{ 227{
228 pi_unregister(&dstr); 228 paride_unregister(&dstr);
229} 229}
230 230
231MODULE_LICENSE("GPL"); 231MODULE_LICENSE("GPL");
diff --git a/drivers/block/paride/epat.c b/drivers/block/paride/epat.c
index 55d1c0a1fb90..1bcdff77322e 100644
--- a/drivers/block/paride/epat.c
+++ b/drivers/block/paride/epat.c
@@ -327,12 +327,12 @@ static int __init epat_init(void)
327#ifdef CONFIG_PARIDE_EPATC8 327#ifdef CONFIG_PARIDE_EPATC8
328 epatc8 = 1; 328 epatc8 = 1;
329#endif 329#endif
330 return pi_register(&epat)-1; 330 return paride_register(&epat);
331} 331}
332 332
333static void __exit epat_exit(void) 333static void __exit epat_exit(void)
334{ 334{
335 pi_unregister(&epat); 335 paride_unregister(&epat);
336} 336}
337 337
338MODULE_LICENSE("GPL"); 338MODULE_LICENSE("GPL");
diff --git a/drivers/block/paride/epia.c b/drivers/block/paride/epia.c
index 0f2e0c292d82..fb0e782d055e 100644
--- a/drivers/block/paride/epia.c
+++ b/drivers/block/paride/epia.c
@@ -303,12 +303,12 @@ static struct pi_protocol epia = {
303 303
304static int __init epia_init(void) 304static int __init epia_init(void)
305{ 305{
306 return pi_register(&epia)-1; 306 return paride_register(&epia);
307} 307}
308 308
309static void __exit epia_exit(void) 309static void __exit epia_exit(void)
310{ 310{
311 pi_unregister(&epia); 311 paride_unregister(&epia);
312} 312}
313 313
314MODULE_LICENSE("GPL"); 314MODULE_LICENSE("GPL");
diff --git a/drivers/block/paride/fit2.c b/drivers/block/paride/fit2.c
index e0f0691d8bc2..381283753ae4 100644
--- a/drivers/block/paride/fit2.c
+++ b/drivers/block/paride/fit2.c
@@ -138,12 +138,12 @@ static struct pi_protocol fit2 = {
138 138
139static int __init fit2_init(void) 139static int __init fit2_init(void)
140{ 140{
141 return pi_register(&fit2)-1; 141 return paride_register(&fit2);
142} 142}
143 143
144static void __exit fit2_exit(void) 144static void __exit fit2_exit(void)
145{ 145{
146 pi_unregister(&fit2); 146 paride_unregister(&fit2);
147} 147}
148 148
149MODULE_LICENSE("GPL"); 149MODULE_LICENSE("GPL");
diff --git a/drivers/block/paride/fit3.c b/drivers/block/paride/fit3.c
index 15400e7bc666..275d269458eb 100644
--- a/drivers/block/paride/fit3.c
+++ b/drivers/block/paride/fit3.c
@@ -198,12 +198,12 @@ static struct pi_protocol fit3 = {
198 198
199static int __init fit3_init(void) 199static int __init fit3_init(void)
200{ 200{
201 return pi_register(&fit3)-1; 201 return paride_register(&fit3);
202} 202}
203 203
204static void __exit fit3_exit(void) 204static void __exit fit3_exit(void)
205{ 205{
206 pi_unregister(&fit3); 206 paride_unregister(&fit3);
207} 207}
208 208
209MODULE_LICENSE("GPL"); 209MODULE_LICENSE("GPL");
diff --git a/drivers/block/paride/friq.c b/drivers/block/paride/friq.c
index 5ea2904d2815..4f2ba244689b 100644
--- a/drivers/block/paride/friq.c
+++ b/drivers/block/paride/friq.c
@@ -263,12 +263,12 @@ static struct pi_protocol friq = {
263 263
264static int __init friq_init(void) 264static int __init friq_init(void)
265{ 265{
266 return pi_register(&friq)-1; 266 return paride_register(&friq);
267} 267}
268 268
269static void __exit friq_exit(void) 269static void __exit friq_exit(void)
270{ 270{
271 pi_unregister(&friq); 271 paride_unregister(&friq);
272} 272}
273 273
274MODULE_LICENSE("GPL"); 274MODULE_LICENSE("GPL");
diff --git a/drivers/block/paride/frpw.c b/drivers/block/paride/frpw.c
index 56b3824b1538..c3cde364603a 100644
--- a/drivers/block/paride/frpw.c
+++ b/drivers/block/paride/frpw.c
@@ -300,12 +300,12 @@ static struct pi_protocol frpw = {
300 300
301static int __init frpw_init(void) 301static int __init frpw_init(void)
302{ 302{
303 return pi_register(&frpw)-1; 303 return paride_register(&frpw);
304} 304}
305 305
306static void __exit frpw_exit(void) 306static void __exit frpw_exit(void)
307{ 307{
308 pi_unregister(&frpw); 308 paride_unregister(&frpw);
309} 309}
310 310
311MODULE_LICENSE("GPL"); 311MODULE_LICENSE("GPL");
diff --git a/drivers/block/paride/jumbo b/drivers/block/paride/jumbo
deleted file mode 100644
index e793b9cb7e72..000000000000
--- a/drivers/block/paride/jumbo
+++ /dev/null
@@ -1,70 +0,0 @@
1#!/bin/sh
2#
3# This script can be used to build "jumbo" modules that contain the
4# base PARIDE support, one protocol module and one high-level driver.
5#
6echo -n "High level driver [pcd] : "
7read X
8HLD=${X:-pcd}
9#
10echo -n "Protocol module [bpck] : "
11read X
12PROTO=${X:-bpck}
13#
14echo -n "Use MODVERSIONS [y] ? "
15read X
16UMODV=${X:-y}
17#
18echo -n "For SMP kernel [n] ? "
19read X
20USMP=${X:-n}
21#
22echo -n "Support PARPORT [n] ? "
23read X
24UPARP=${X:-n}
25#
26echo
27#
28case $USMP in
29 y* | Y* ) FSMP="-DCONFIG_SMP"
30 ;;
31 *) FSMP=""
32 ;;
33esac
34#
35MODI="-include ../../../include/linux/modversions.h"
36#
37case $UMODV in
38 y* | Y* ) FMODV="-DMODVERSIONS $MODI"
39 ;;
40 *) FMODV=""
41 ;;
42esac
43#
44case $UPARP in
45 y* | Y* ) FPARP="-DCONFIG_PARPORT"
46 ;;
47 *) FPARP=""
48 ;;
49esac
50#
51TARG=$HLD-$PROTO.o
52FPROTO=-DCONFIG_PARIDE_`echo "$PROTO" | tr [a-z] [A-Z]`
53FK="-D__KERNEL__ -I ../../../include"
54FLCH=-D_LINUX_CONFIG_H
55#
56echo cc $FK $FSMP $FLCH $FPARP $FPROTO $FMODV -Wall -O2 -o Jb.o -c paride.c
57cc $FK $FSMP $FLCH $FPARP $FPROTO $FMODV -Wall -O2 -o Jb.o -c paride.c
58#
59echo cc $FK $FSMP $FMODV -Wall -O2 -o Jp.o -c $PROTO.c
60cc $FK $FSMP $FMODV -Wall -O2 -o Jp.o -c $PROTO.c
61#
62echo cc $FK $FSMP $FMODV -DMODULE -DPARIDE_JUMBO -Wall -O2 -o Jd.o -c $HLD.c
63cc $FK $FSMP $FMODV -DMODULE -DPARIDE_JUMBO -Wall -O2 -o Jd.o -c $HLD.c
64#
65echo ld -r -o $TARG Jp.o Jb.o Jd.o
66ld -r -o $TARG Jp.o Jb.o Jd.o
67#
68#
69rm Jp.o Jb.o Jd.o
70#
diff --git a/drivers/block/paride/kbic.c b/drivers/block/paride/kbic.c
index d983bcea76fe..35999c415ee3 100644
--- a/drivers/block/paride/kbic.c
+++ b/drivers/block/paride/kbic.c
@@ -283,13 +283,21 @@ static struct pi_protocol k971 = {
283 283
284static int __init kbic_init(void) 284static int __init kbic_init(void)
285{ 285{
286 return (pi_register(&k951)||pi_register(&k971))-1; 286 int rv;
287
288 rv = paride_register(&k951);
289 if (rv < 0)
290 return rv;
291 rv = paride_register(&k971);
292 if (rv < 0)
293 paride_unregister(&k951);
294 return rv;
287} 295}
288 296
289static void __exit kbic_exit(void) 297static void __exit kbic_exit(void)
290{ 298{
291 pi_unregister(&k951); 299 paride_unregister(&k951);
292 pi_unregister(&k971); 300 paride_unregister(&k971);
293} 301}
294 302
295MODULE_LICENSE("GPL"); 303MODULE_LICENSE("GPL");
diff --git a/drivers/block/paride/ktti.c b/drivers/block/paride/ktti.c
index 6c7edbfba9a0..117ab0e8ccf0 100644
--- a/drivers/block/paride/ktti.c
+++ b/drivers/block/paride/ktti.c
@@ -115,12 +115,12 @@ static struct pi_protocol ktti = {
115 115
116static int __init ktti_init(void) 116static int __init ktti_init(void)
117{ 117{
118 return pi_register(&ktti)-1; 118 return paride_register(&ktti);
119} 119}
120 120
121static void __exit ktti_exit(void) 121static void __exit ktti_exit(void)
122{ 122{
123 pi_unregister(&ktti); 123 paride_unregister(&ktti);
124} 124}
125 125
126MODULE_LICENSE("GPL"); 126MODULE_LICENSE("GPL");
diff --git a/drivers/block/paride/on20.c b/drivers/block/paride/on20.c
index 9f8e01096809..0173697a1a4d 100644
--- a/drivers/block/paride/on20.c
+++ b/drivers/block/paride/on20.c
@@ -140,12 +140,12 @@ static struct pi_protocol on20 = {
140 140
141static int __init on20_init(void) 141static int __init on20_init(void)
142{ 142{
143 return pi_register(&on20)-1; 143 return paride_register(&on20);
144} 144}
145 145
146static void __exit on20_exit(void) 146static void __exit on20_exit(void)
147{ 147{
148 pi_unregister(&on20); 148 paride_unregister(&on20);
149} 149}
150 150
151MODULE_LICENSE("GPL"); 151MODULE_LICENSE("GPL");
diff --git a/drivers/block/paride/on26.c b/drivers/block/paride/on26.c
index 0f833caa2101..95ba256921f2 100644
--- a/drivers/block/paride/on26.c
+++ b/drivers/block/paride/on26.c
@@ -306,12 +306,12 @@ static struct pi_protocol on26 = {
306 306
307static int __init on26_init(void) 307static int __init on26_init(void)
308{ 308{
309 return pi_register(&on26)-1; 309 return paride_register(&on26);
310} 310}
311 311
312static void __exit on26_exit(void) 312static void __exit on26_exit(void)
313{ 313{
314 pi_unregister(&on26); 314 paride_unregister(&on26);
315} 315}
316 316
317MODULE_LICENSE("GPL"); 317MODULE_LICENSE("GPL");
diff --git a/drivers/block/paride/paride.c b/drivers/block/paride/paride.c
index 4b258f7836f3..48c50f11f63b 100644
--- a/drivers/block/paride/paride.c
+++ b/drivers/block/paride/paride.c
@@ -29,14 +29,7 @@
29#include <linux/spinlock.h> 29#include <linux/spinlock.h>
30#include <linux/wait.h> 30#include <linux/wait.h>
31#include <linux/sched.h> /* TASK_* */ 31#include <linux/sched.h> /* TASK_* */
32
33#ifdef CONFIG_PARPORT_MODULE
34#define CONFIG_PARPORT
35#endif
36
37#ifdef CONFIG_PARPORT
38#include <linux/parport.h> 32#include <linux/parport.h>
39#endif
40 33
41#include "paride.h" 34#include "paride.h"
42 35
@@ -76,8 +69,6 @@ void pi_read_block(PIA * pi, char *buf, int count)
76 69
77EXPORT_SYMBOL(pi_read_block); 70EXPORT_SYMBOL(pi_read_block);
78 71
79#ifdef CONFIG_PARPORT
80
81static void pi_wake_up(void *p) 72static void pi_wake_up(void *p)
82{ 73{
83 PIA *pi = (PIA *) p; 74 PIA *pi = (PIA *) p;
@@ -100,11 +91,8 @@ static void pi_wake_up(void *p)
100 cont(); 91 cont();
101} 92}
102 93
103#endif
104
105int pi_schedule_claimed(PIA * pi, void (*cont) (void)) 94int pi_schedule_claimed(PIA * pi, void (*cont) (void))
106{ 95{
107#ifdef CONFIG_PARPORT
108 unsigned long flags; 96 unsigned long flags;
109 97
110 spin_lock_irqsave(&pi_spinlock, flags); 98 spin_lock_irqsave(&pi_spinlock, flags);
@@ -115,7 +103,6 @@ int pi_schedule_claimed(PIA * pi, void (*cont) (void))
115 } 103 }
116 pi->claimed = 1; 104 pi->claimed = 1;
117 spin_unlock_irqrestore(&pi_spinlock, flags); 105 spin_unlock_irqrestore(&pi_spinlock, flags);
118#endif
119 return 1; 106 return 1;
120} 107}
121EXPORT_SYMBOL(pi_schedule_claimed); 108EXPORT_SYMBOL(pi_schedule_claimed);
@@ -133,20 +120,16 @@ static void pi_claim(PIA * pi)
133 if (pi->claimed) 120 if (pi->claimed)
134 return; 121 return;
135 pi->claimed = 1; 122 pi->claimed = 1;
136#ifdef CONFIG_PARPORT
137 if (pi->pardev) 123 if (pi->pardev)
138 wait_event(pi->parq, 124 wait_event(pi->parq,
139 !parport_claim((struct pardevice *) pi->pardev)); 125 !parport_claim((struct pardevice *) pi->pardev));
140#endif
141} 126}
142 127
143static void pi_unclaim(PIA * pi) 128static void pi_unclaim(PIA * pi)
144{ 129{
145 pi->claimed = 0; 130 pi->claimed = 0;
146#ifdef CONFIG_PARPORT
147 if (pi->pardev) 131 if (pi->pardev)
148 parport_release((struct pardevice *) (pi->pardev)); 132 parport_release((struct pardevice *) (pi->pardev));
149#endif
150} 133}
151 134
152void pi_connect(PIA * pi) 135void pi_connect(PIA * pi)
@@ -167,21 +150,15 @@ EXPORT_SYMBOL(pi_disconnect);
167 150
168static void pi_unregister_parport(PIA * pi) 151static void pi_unregister_parport(PIA * pi)
169{ 152{
170#ifdef CONFIG_PARPORT
171 if (pi->pardev) { 153 if (pi->pardev) {
172 parport_unregister_device((struct pardevice *) (pi->pardev)); 154 parport_unregister_device((struct pardevice *) (pi->pardev));
173 pi->pardev = NULL; 155 pi->pardev = NULL;
174 } 156 }
175#endif
176} 157}
177 158
178void pi_release(PIA * pi) 159void pi_release(PIA * pi)
179{ 160{
180 pi_unregister_parport(pi); 161 pi_unregister_parport(pi);
181#ifndef CONFIG_PARPORT
182 if (pi->reserved)
183 release_region(pi->port, pi->reserved);
184#endif /* !CONFIG_PARPORT */
185 if (pi->proto->release_proto) 162 if (pi->proto->release_proto)
186 pi->proto->release_proto(pi); 163 pi->proto->release_proto(pi);
187 module_put(pi->proto->owner); 164 module_put(pi->proto->owner);
@@ -229,7 +206,7 @@ static int pi_test_proto(PIA * pi, char *scratch, int verbose)
229 return res; 206 return res;
230} 207}
231 208
232int pi_register(PIP * pr) 209int paride_register(PIP * pr)
233{ 210{
234 int k; 211 int k;
235 212
@@ -237,24 +214,24 @@ int pi_register(PIP * pr)
237 if (protocols[k] && !strcmp(pr->name, protocols[k]->name)) { 214 if (protocols[k] && !strcmp(pr->name, protocols[k]->name)) {
238 printk("paride: %s protocol already registered\n", 215 printk("paride: %s protocol already registered\n",
239 pr->name); 216 pr->name);
240 return 0; 217 return -1;
241 } 218 }
242 k = 0; 219 k = 0;
243 while ((k < MAX_PROTOS) && (protocols[k])) 220 while ((k < MAX_PROTOS) && (protocols[k]))
244 k++; 221 k++;
245 if (k == MAX_PROTOS) { 222 if (k == MAX_PROTOS) {
246 printk("paride: protocol table full\n"); 223 printk("paride: protocol table full\n");
247 return 0; 224 return -1;
248 } 225 }
249 protocols[k] = pr; 226 protocols[k] = pr;
250 pr->index = k; 227 pr->index = k;
251 printk("paride: %s registered as protocol %d\n", pr->name, k); 228 printk("paride: %s registered as protocol %d\n", pr->name, k);
252 return 1; 229 return 0;
253} 230}
254 231
255EXPORT_SYMBOL(pi_register); 232EXPORT_SYMBOL(paride_register);
256 233
257void pi_unregister(PIP * pr) 234void paride_unregister(PIP * pr)
258{ 235{
259 if (!pr) 236 if (!pr)
260 return; 237 return;
@@ -265,12 +242,10 @@ void pi_unregister(PIP * pr)
265 protocols[pr->index] = NULL; 242 protocols[pr->index] = NULL;
266} 243}
267 244
268EXPORT_SYMBOL(pi_unregister); 245EXPORT_SYMBOL(paride_unregister);
269 246
270static int pi_register_parport(PIA * pi, int verbose) 247static int pi_register_parport(PIA * pi, int verbose)
271{ 248{
272#ifdef CONFIG_PARPORT
273
274 struct parport *port; 249 struct parport *port;
275 250
276 port = parport_find_base(pi->port); 251 port = parport_find_base(pi->port);
@@ -290,7 +265,6 @@ static int pi_register_parport(PIA * pi, int verbose)
290 printk("%s: 0x%x is %s\n", pi->device, pi->port, port->name); 265 printk("%s: 0x%x is %s\n", pi->device, pi->port, port->name);
291 266
292 pi->parname = (char *) port->name; 267 pi->parname = (char *) port->name;
293#endif
294 268
295 return 1; 269 return 1;
296} 270}
@@ -447,13 +421,6 @@ int pi_init(PIA * pi, int autoprobe, int port, int mode,
447 printk("%s: Adapter not found\n", device); 421 printk("%s: Adapter not found\n", device);
448 return 0; 422 return 0;
449 } 423 }
450#ifndef CONFIG_PARPORT
451 if (!request_region(pi->port, pi->reserved, pi->device)) {
452 printk(KERN_WARNING "paride: Unable to request region 0x%x\n",
453 pi->port);
454 return 0;
455 }
456#endif /* !CONFIG_PARPORT */
457 424
458 if (pi->parname) 425 if (pi->parname)
459 printk("%s: Sharing %s at 0x%x\n", pi->device, 426 printk("%s: Sharing %s at 0x%x\n", pi->device,
diff --git a/drivers/block/paride/paride.h b/drivers/block/paride/paride.h
index c6d98ef09e48..2bddbf45518b 100644
--- a/drivers/block/paride/paride.h
+++ b/drivers/block/paride/paride.h
@@ -163,8 +163,8 @@ struct pi_protocol {
163 163
164typedef struct pi_protocol PIP; 164typedef struct pi_protocol PIP;
165 165
166extern int pi_register( PIP * ); 166extern int paride_register( PIP * );
167extern void pi_unregister ( PIP * ); 167extern void paride_unregister ( PIP * );
168 168
169#endif /* __DRIVERS_PARIDE_H__ */ 169#endif /* __DRIVERS_PARIDE_H__ */
170/* end of paride.h */ 170/* end of paride.h */
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c
index ac5ba462710b..c852eed91e4b 100644
--- a/drivers/block/paride/pcd.c
+++ b/drivers/block/paride/pcd.c
@@ -912,12 +912,12 @@ static int __init pcd_init(void)
912 int unit; 912 int unit;
913 913
914 if (disable) 914 if (disable)
915 return -1; 915 return -EINVAL;
916 916
917 pcd_init_units(); 917 pcd_init_units();
918 918
919 if (pcd_detect()) 919 if (pcd_detect())
920 return -1; 920 return -ENODEV;
921 921
922 /* get the atapi capabilities page */ 922 /* get the atapi capabilities page */
923 pcd_probe_capabilities(); 923 pcd_probe_capabilities();
@@ -925,7 +925,7 @@ static int __init pcd_init(void)
925 if (register_blkdev(major, name)) { 925 if (register_blkdev(major, name)) {
926 for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) 926 for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++)
927 put_disk(cd->disk); 927 put_disk(cd->disk);
928 return -1; 928 return -EBUSY;
929 } 929 }
930 930
931 pcd_queue = blk_init_queue(do_pcd_request, &pcd_lock); 931 pcd_queue = blk_init_queue(do_pcd_request, &pcd_lock);
@@ -933,7 +933,7 @@ static int __init pcd_init(void)
933 unregister_blkdev(major, name); 933 unregister_blkdev(major, name);
934 for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) 934 for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++)
935 put_disk(cd->disk); 935 put_disk(cd->disk);
936 return -1; 936 return -ENOMEM;
937 } 937 }
938 938
939 for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) { 939 for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) {
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c
index 1a9dee19efcf..7cdaa1951260 100644
--- a/drivers/block/paride/pf.c
+++ b/drivers/block/paride/pf.c
@@ -933,25 +933,25 @@ static int __init pf_init(void)
933 int unit; 933 int unit;
934 934
935 if (disable) 935 if (disable)
936 return -1; 936 return -EINVAL;
937 937
938 pf_init_units(); 938 pf_init_units();
939 939
940 if (pf_detect()) 940 if (pf_detect())
941 return -1; 941 return -ENODEV;
942 pf_busy = 0; 942 pf_busy = 0;
943 943
944 if (register_blkdev(major, name)) { 944 if (register_blkdev(major, name)) {
945 for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) 945 for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++)
946 put_disk(pf->disk); 946 put_disk(pf->disk);
947 return -1; 947 return -EBUSY;
948 } 948 }
949 pf_queue = blk_init_queue(do_pf_request, &pf_spin_lock); 949 pf_queue = blk_init_queue(do_pf_request, &pf_spin_lock);
950 if (!pf_queue) { 950 if (!pf_queue) {
951 unregister_blkdev(major, name); 951 unregister_blkdev(major, name);
952 for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) 952 for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++)
953 put_disk(pf->disk); 953 put_disk(pf->disk);
954 return -1; 954 return -ENOMEM;
955 } 955 }
956 956
957 blk_queue_max_phys_segments(pf_queue, cluster); 957 blk_queue_max_phys_segments(pf_queue, cluster);
diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c
index 13f998aa1cd3..9970aedbb5d9 100644
--- a/drivers/block/paride/pg.c
+++ b/drivers/block/paride/pg.c
@@ -646,14 +646,14 @@ static int __init pg_init(void)
646 int err; 646 int err;
647 647
648 if (disable){ 648 if (disable){
649 err = -1; 649 err = -EINVAL;
650 goto out; 650 goto out;
651 } 651 }
652 652
653 pg_init_units(); 653 pg_init_units();
654 654
655 if (pg_detect()) { 655 if (pg_detect()) {
656 err = -1; 656 err = -ENODEV;
657 goto out; 657 goto out;
658 } 658 }
659 659
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c
index 35fb26636721..c902b25e4869 100644
--- a/drivers/block/paride/pt.c
+++ b/drivers/block/paride/pt.c
@@ -946,12 +946,12 @@ static int __init pt_init(void)
946 int err; 946 int err;
947 947
948 if (disable) { 948 if (disable) {
949 err = -1; 949 err = -EINVAL;
950 goto out; 950 goto out;
951 } 951 }
952 952
953 if (pt_detect()) { 953 if (pt_detect()) {
954 err = -1; 954 err = -ENODEV;
955 goto out; 955 goto out;
956 } 956 }
957 957
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index f2904f67af47..e45eaa264119 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -54,7 +54,7 @@
54#include <linux/proc_fs.h> 54#include <linux/proc_fs.h>
55#include <linux/seq_file.h> 55#include <linux/seq_file.h>
56#include <linux/miscdevice.h> 56#include <linux/miscdevice.h>
57#include <linux/suspend.h> 57#include <linux/freezer.h>
58#include <linux/mutex.h> 58#include <linux/mutex.h>
59#include <scsi/scsi_cmnd.h> 59#include <scsi/scsi_cmnd.h>
60#include <scsi/scsi_ioctl.h> 60#include <scsi/scsi_ioctl.h>