tunnels: fix netns vs proto registration ordering
[safe/jmp/linux-2.6] / drivers / scsi / aacraid / linit.c
index 5797b2c..e9373a2 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *     Adaptec AAC series RAID controller driver
- *     (c) Copyright 2001 Red Hat Inc. <alan@redhat.com>
+ *     (c) Copyright 2001 Red Hat Inc.
  *
  * based on the old aacraid driver that is..
  * Adaptec aacraid device driver for Linux.
@@ -38,6 +38,7 @@
 #include <linux/moduleparam.h>
 #include <linux/pci.h>
 #include <linux/slab.h>
+#include <linux/smp_lock.h>
 #include <linux/spinlock.h>
 #include <linux/syscalls.h>
 #include <linux/delay.h>
@@ -85,7 +86,13 @@ char aac_driver_version[] = AAC_DRIVER_FULL_VERSION;
  *
  * Note: The last field is used to index into aac_drivers below.
  */
-static struct pci_device_id aac_pci_tbl[] = {
+#ifdef DECLARE_PCI_DEVICE_TABLE
+static DECLARE_PCI_DEVICE_TABLE(aac_pci_tbl) = {
+#elif defined(__devinitconst)
+static const struct pci_device_id aac_pci_tbl[] __devinitconst = {
+#else
+static const struct pci_device_id aac_pci_tbl[] __devinitdata = {
+#endif
        { 0x1028, 0x0001, 0x1028, 0x0001, 0, 0, 0 }, /* PERC 2/Si (Iguana/PERC2Si) */
        { 0x1028, 0x0002, 0x1028, 0x0002, 0, 0, 1 }, /* PERC 3/Di (Opal/PERC3Di) */
        { 0x1028, 0x0003, 0x1028, 0x0003, 0, 0, 2 }, /* PERC 3/Si (SlimFast/PERC3Si */
@@ -174,8 +181,8 @@ static struct aac_driver_ident aac_drivers[] = {
        { aac_rx_init, "percraid", "DELL    ", "PERCRAID        ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* PERC 3/Di (Boxster/PERC3DiB) */
        { aac_rx_init, "aacraid",  "ADAPTEC ", "catapult        ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* catapult */
        { aac_rx_init, "aacraid",  "ADAPTEC ", "tomcat          ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* tomcat */
-       { aac_rx_init, "aacraid",  "ADAPTEC ", "Adaptec 2120S   ", 1, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* Adaptec 2120S (Crusader) */
-       { aac_rx_init, "aacraid",  "ADAPTEC ", "Adaptec 2200S   ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* Adaptec 2200S (Vulcan) */
+       { aac_rx_init, "aacraid",  "ADAPTEC ", "Adaptec 2120S   ", 1, AAC_QUIRK_31BIT | AAC_QUIRK_34SG },                     /* Adaptec 2120S (Crusader) */
+       { aac_rx_init, "aacraid",  "ADAPTEC ", "Adaptec 2200S   ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG },                     /* Adaptec 2200S (Vulcan) */
        { aac_rx_init, "aacraid",  "ADAPTEC ", "Adaptec 2200S   ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* Adaptec 2200S (Vulcan-2m) */
        { aac_rx_init, "aacraid",  "Legend  ", "Legend S220     ", 1, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* Legend S220 (Legend Crusader) */
        { aac_rx_init, "aacraid",  "Legend  ", "Legend S230     ", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG | AAC_QUIRK_SCSI_32 }, /* Legend S230 (Legend Vulcan) */
@@ -426,8 +433,8 @@ static int aac_slave_configure(struct scsi_device *sdev)
                 * Firmware has an individual device recovery time typically
                 * of 35 seconds, give us a margin.
                 */
-               if (sdev->timeout < (45 * HZ))
-                       sdev->timeout = 45 * HZ;
+               if (sdev->request_queue->rq_timeout < (45 * HZ))
+                       blk_queue_rq_timeout(sdev->request_queue, 45*HZ);
                for (cid = 0; cid < aac->maximum_num_containers; ++cid)
                        if (aac->fsa_dev[cid].valid)
                                ++num_lsu;
@@ -465,8 +472,12 @@ static int aac_slave_configure(struct scsi_device *sdev)
  *     total capacity and the queue depth supported by the target device.
  */
 
-static int aac_change_queue_depth(struct scsi_device *sdev, int depth)
+static int aac_change_queue_depth(struct scsi_device *sdev, int depth,
+                                 int reason)
 {
+       if (reason != SCSI_QDEPTH_DEFAULT)
+               return -EOPNOTSUPP;
+
        if (sdev->tagged_supported && (sdev->type == TYPE_DISK) &&
            (sdev_channel(sdev) == CONTAINER_CHANNEL)) {
                struct scsi_device * dev;
@@ -667,6 +678,7 @@ static int aac_cfg_open(struct inode *inode, struct file *file)
        unsigned minor_number = iminor(inode);
        int err = -ENODEV;
 
+       lock_kernel();  /* BKL pushdown: nothing else protects this list */
        list_for_each_entry(aac, &aac_devices, entry) {
                if (aac->id == minor_number) {
                        file->private_data = aac;
@@ -674,6 +686,7 @@ static int aac_cfg_open(struct inode *inode, struct file *file)
                        break;
                }
        }
+       unlock_kernel();
 
        return err;
 }
@@ -1086,16 +1099,16 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
                goto out;
        error = -ENODEV;
 
-       if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) ||
-                       pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK))
+       if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) ||
+                       pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)))
                goto out_disable_pdev;
        /*
         * If the quirk31 bit is set, the adapter needs adapter
         * to driver communication memory to be allocated below 2gig
         */
        if (aac_drivers[index].quirks & AAC_QUIRK_31BIT)
-               if (pci_set_dma_mask(pdev, DMA_31BIT_MASK) ||
-                               pci_set_consistent_dma_mask(pdev, DMA_31BIT_MASK))
+               if (pci_set_dma_mask(pdev, DMA_BIT_MASK(31)) ||
+                               pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(31)))
                        goto out_disable_pdev;
 
        pci_set_master(pdev);
@@ -1145,7 +1158,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
         * address space.
         */
        if (aac_drivers[index].quirks & AAC_QUIRK_31BIT)
-               if (pci_set_dma_mask(pdev, DMA_32BIT_MASK))
+               if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))
                        goto out_deinit;
 
        aac->maximum_num_channels = aac_drivers[index].channels;