Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
[pandora-kernel.git] / drivers / block / cciss.c
index 370dfe1..1be82d5 100644 (file)
@@ -87,6 +87,7 @@ static const struct pci_device_id cciss_pci_device_id[] = {
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSD,     0x103C, 0x3214},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSD,     0x103C, 0x3215},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSC,     0x103C, 0x3237},
+       {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSC,     0x103C, 0x323D},
        {PCI_VENDOR_ID_HP,     PCI_ANY_ID,      PCI_ANY_ID, PCI_ANY_ID,
                PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0},
        {0,}
@@ -119,6 +120,7 @@ static struct board_type products[] = {
        {0x3214103C, "Smart Array E200i", &SA5_access, 120},
        {0x3215103C, "Smart Array E200i", &SA5_access, 120},
        {0x3237103C, "Smart Array E500", &SA5_access, 512},
+       {0x323D103C, "Smart Array P700m", &SA5_access, 512},
        {0xFFFF103C, "Unknown Smart Array", &SA5_access, 120},
 };
 
@@ -137,7 +139,7 @@ static struct board_type products[] = {
 
 static ctlr_info_t *hba[MAX_CTLR];
 
-static void do_cciss_request(request_queue_t *q);
+static void do_cciss_request(struct request_queue *q);
 static irqreturn_t do_cciss_intr(int irq, void *dev_id);
 static int cciss_open(struct inode *inode, struct file *filep);
 static int cciss_release(struct inode *inode, struct file *filep);
@@ -1168,7 +1170,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep,
        case SG_EMULATED_HOST:
        case SG_IO:
        case SCSI_IOCTL_SEND_COMMAND:
-               return scsi_cmd_ioctl(filep, disk, cmd, argp);
+               return scsi_cmd_ioctl(filep, disk->queue, disk, cmd, argp);
 
        /* scsi_cmd_ioctl would normally handle these, below, but */
        /* they aren't a good fit for cciss, as CD-ROMs are */
@@ -1582,7 +1584,7 @@ static int deregister_disk(struct gendisk *disk, drive_info_struct *drv,
         */
        if (h->gendisk[0] != disk) {
                if (disk) {
-                       request_queue_t *q = disk->queue;
+                       struct request_queue *q = disk->queue;
                        if (disk->flags & GENHD_FL_UP)
                                del_gendisk(disk);
                        if (q) {
@@ -2509,7 +2511,7 @@ after_error_processing:
 /*
  * Get a request and submit it to the controller.
  */
-static void do_cciss_request(request_queue_t *q)
+static void do_cciss_request(struct request_queue *q)
 {
        ctlr_info_t *h = q->queuedata;
        CommandList_struct *c;
@@ -3378,7 +3380,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
        do {
                drive_info_struct *drv = &(hba[i]->drv[j]);
                struct gendisk *disk = hba[i]->gendisk[j];
-               request_queue_t *q;
+               struct request_queue *q;
 
                /* Check if the disk was allocated already */
                if (!disk){
@@ -3469,13 +3471,39 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
        return -1;
 }
 
-static void cciss_remove_one(struct pci_dev *pdev)
+static void cciss_shutdown(struct pci_dev *pdev)
 {
        ctlr_info_t *tmp_ptr;
-       int i, j;
+       int i;
        char flush_buf[4];
        int return_code;
 
+       tmp_ptr = pci_get_drvdata(pdev);
+       if (tmp_ptr == NULL)
+               return;
+       i = tmp_ptr->ctlr;
+       if (hba[i] == NULL)
+               return;
+
+       /* Turn board interrupts off  and send the flush cache command */
+       /* sendcmd will turn off interrupt, and send the flush...
+        * To write all data in the battery backed cache to disks */
+       memset(flush_buf, 0, 4);
+       return_code = sendcmd(CCISS_CACHE_FLUSH, i, flush_buf, 4, 0, 0, 0, NULL,
+                             TYPE_CMD);
+       if (return_code == IO_OK) {
+               printk(KERN_INFO "Completed flushing cache on controller %d\n", i);
+       } else {
+               printk(KERN_WARNING "Error flushing cache on controller %d\n", i);
+       }
+       free_irq(hba[i]->intr[2], hba[i]);
+}
+
+static void __devexit cciss_remove_one(struct pci_dev *pdev)
+{
+       ctlr_info_t *tmp_ptr;
+       int i, j;
+
        if (pci_get_drvdata(pdev) == NULL) {
                printk(KERN_ERR "cciss: Unable to remove device \n");
                return;
@@ -3495,7 +3523,7 @@ static void cciss_remove_one(struct pci_dev *pdev)
        for (j = 0; j < CISS_MAX_LUN; j++) {
                struct gendisk *disk = hba[i]->gendisk[j];
                if (disk) {
-                       request_queue_t *q = disk->queue;
+                       struct request_queue *q = disk->queue;
 
                        if (disk->flags & GENHD_FL_UP)
                                del_gendisk(disk);
@@ -3506,18 +3534,7 @@ static void cciss_remove_one(struct pci_dev *pdev)
 
        cciss_unregister_scsi(i);       /* unhook from SCSI subsystem */
 
-       /* Turn board interrupts off  and send the flush cache command */
-       /* sendcmd will turn off interrupt, and send the flush...
-        * To write all data in the battery backed cache to disks */
-       memset(flush_buf, 0, 4);
-       return_code = sendcmd(CCISS_CACHE_FLUSH, i, flush_buf, 4, 0, 0, 0, NULL,
-                             TYPE_CMD);
-       if (return_code == IO_OK) {
-               printk(KERN_INFO "Completed flushing cache on controller %d\n", i);
-       } else {
-               printk(KERN_WARNING "Error flushing cache on controller %d\n", i);
-       }
-       free_irq(hba[i]->intr[2], hba[i]);
+       cciss_shutdown(pdev);
 
 #ifdef CONFIG_PCI_MSI
        if (hba[i]->msix_vector)
@@ -3550,7 +3567,7 @@ static struct pci_driver cciss_pci_driver = {
        .probe = cciss_init_one,
        .remove = __devexit_p(cciss_remove_one),
        .id_table = cciss_pci_device_id,        /* id_table */
-       .shutdown = cciss_remove_one,
+       .shutdown = cciss_shutdown,
 };
 
 /*