]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/ipr.c
[PATCH] driver core: fix built-in drivers sysfs links
[linux-2.6-omap-h63xx.git] / drivers / scsi / ipr.c
index 94345e79ef1eb942a2a56c3202faff1f4857f1d6..95045e33710d488b758374d17956f0f4074b837a 100644 (file)
@@ -595,10 +595,8 @@ static int ipr_save_pcix_cmd_reg(struct ipr_ioa_cfg *ioa_cfg)
 {
        int pcix_cmd_reg = pci_find_capability(ioa_cfg->pdev, PCI_CAP_ID_PCIX);
 
-       if (pcix_cmd_reg == 0) {
-               dev_err(&ioa_cfg->pdev->dev, "Failed to save PCI-X command register\n");
-               return -EIO;
-       }
+       if (pcix_cmd_reg == 0)
+               return 0;
 
        if (pci_read_config_word(ioa_cfg->pdev, pcix_cmd_reg + PCI_X_CMD,
                                 &ioa_cfg->saved_pcix_cmd_reg) != PCIBIOS_SUCCESSFUL) {
@@ -627,10 +625,6 @@ static int ipr_set_pcix_cmd_reg(struct ipr_ioa_cfg *ioa_cfg)
                        dev_err(&ioa_cfg->pdev->dev, "Failed to setup PCI-X command register\n");
                        return -EIO;
                }
-       } else {
-               dev_err(&ioa_cfg->pdev->dev,
-                       "Failed to setup PCI-X command register\n");
-               return -EIO;
        }
 
        return 0;
@@ -1249,19 +1243,23 @@ static void ipr_log_array_error(struct ipr_ioa_cfg *ioa_cfg,
 
 /**
  * ipr_log_hex_data - Log additional hex IOA error data.
+ * @ioa_cfg:   ioa config struct
  * @data:              IOA error data
  * @len:               data length
  *
  * Return value:
  *     none
  **/
-static void ipr_log_hex_data(u32 *data, int len)
+static void ipr_log_hex_data(struct ipr_ioa_cfg *ioa_cfg, u32 *data, int len)
 {
        int i;
 
        if (len == 0)
                return;
 
+       if (ioa_cfg->log_level <= IPR_DEFAULT_LOG_LEVEL)
+               len = min_t(int, len, IPR_DEFAULT_MAX_ERROR_DUMP);
+
        for (i = 0; i < len / 4; i += 4) {
                ipr_err("%08X: %08X %08X %08X %08X\n", i*4,
                        be32_to_cpu(data[i]),
@@ -1290,7 +1288,7 @@ static void ipr_log_enhanced_dual_ioa_error(struct ipr_ioa_cfg *ioa_cfg,
        ipr_err("%s\n", error->failure_reason);
        ipr_err("Remote Adapter VPD:\n");
        ipr_log_ext_vpd(&error->vpd);
-       ipr_log_hex_data(error->data,
+       ipr_log_hex_data(ioa_cfg, error->data,
                         be32_to_cpu(hostrcb->hcam.length) -
                         (offsetof(struct ipr_hostrcb_error, u) +
                          offsetof(struct ipr_hostrcb_type_17_error, data)));
@@ -1315,7 +1313,7 @@ static void ipr_log_dual_ioa_error(struct ipr_ioa_cfg *ioa_cfg,
        ipr_err("%s\n", error->failure_reason);
        ipr_err("Remote Adapter VPD:\n");
        ipr_log_vpd(&error->vpd);
-       ipr_log_hex_data(error->data,
+       ipr_log_hex_data(ioa_cfg, error->data,
                         be32_to_cpu(hostrcb->hcam.length) -
                         (offsetof(struct ipr_hostrcb_error, u) +
                          offsetof(struct ipr_hostrcb_type_07_error, data)));
@@ -1531,7 +1529,7 @@ static void ipr_log_fabric_error(struct ipr_ioa_cfg *ioa_cfg,
                        ((unsigned long)fabric + be16_to_cpu(fabric->length));
        }
 
-       ipr_log_hex_data((u32 *)fabric, add_len);
+       ipr_log_hex_data(ioa_cfg, (u32 *)fabric, add_len);
 }
 
 /**
@@ -1545,7 +1543,7 @@ static void ipr_log_fabric_error(struct ipr_ioa_cfg *ioa_cfg,
 static void ipr_log_generic_error(struct ipr_ioa_cfg *ioa_cfg,
                                  struct ipr_hostrcb *hostrcb)
 {
-       ipr_log_hex_data(hostrcb->hcam.u.raw.data,
+       ipr_log_hex_data(ioa_cfg, hostrcb->hcam.u.raw.data,
                         be32_to_cpu(hostrcb->hcam.length));
 }
 
@@ -2303,7 +2301,7 @@ static void ipr_release_dump(struct kref *kref)
 
 /**
  * ipr_worker_thread - Worker thread
- * @data:              ioa config struct
+ * @work:              ioa config struct
  *
  * Called at task level from a work thread. This function takes care
  * of adding and removing device from the mid-layer as configuration
@@ -2312,13 +2310,14 @@ static void ipr_release_dump(struct kref *kref)
  * Return value:
  *     nothing
  **/
-static void ipr_worker_thread(void *data)
+static void ipr_worker_thread(struct work_struct *work)
 {
        unsigned long lock_flags;
        struct ipr_resource_entry *res;
        struct scsi_device *sdev;
        struct ipr_dump *dump;
-       struct ipr_ioa_cfg *ioa_cfg = data;
+       struct ipr_ioa_cfg *ioa_cfg =
+               container_of(work, struct ipr_ioa_cfg, work_q);
        u8 bus, target, lun;
        int did_work;
 
@@ -4833,7 +4832,7 @@ static int ipr_queuecommand(struct scsi_cmnd *scsi_cmd,
  * Return value:
  *     0 on success / other on failure
  **/
-int ipr_ioctl(struct scsi_device *sdev, int cmd, void __user *arg)
+static int ipr_ioctl(struct scsi_device *sdev, int cmd, void __user *arg)
 {
        struct ipr_resource_entry *res;
 
@@ -6309,7 +6308,6 @@ static int ipr_reset_restore_cfg_space(struct ipr_cmnd *ipr_cmd)
        int rc;
 
        ENTER;
-       pci_unblock_user_cfg_access(ioa_cfg->pdev);
        rc = pci_restore_state(ioa_cfg->pdev);
 
        if (rc != PCIBIOS_SUCCESSFUL) {
@@ -6349,6 +6347,24 @@ static int ipr_reset_restore_cfg_space(struct ipr_cmnd *ipr_cmd)
        return IPR_RC_JOB_CONTINUE;
 }
 
+/**
+ * ipr_reset_bist_done - BIST has completed on the adapter.
+ * @ipr_cmd:   ipr command struct
+ *
+ * Description: Unblock config space and resume the reset process.
+ *
+ * Return value:
+ *     IPR_RC_JOB_CONTINUE
+ **/
+static int ipr_reset_bist_done(struct ipr_cmnd *ipr_cmd)
+{
+       ENTER;
+       pci_unblock_user_cfg_access(ipr_cmd->ioa_cfg->pdev);
+       ipr_cmd->job_step = ipr_reset_restore_cfg_space;
+       LEAVE;
+       return IPR_RC_JOB_CONTINUE;
+}
+
 /**
  * ipr_reset_start_bist - Run BIST on the adapter.
  * @ipr_cmd:   ipr command struct
@@ -6371,7 +6387,7 @@ static int ipr_reset_start_bist(struct ipr_cmnd *ipr_cmd)
                ipr_cmd->ioasa.ioasc = cpu_to_be32(IPR_IOASC_PCI_ACCESS_ERROR);
                rc = IPR_RC_JOB_CONTINUE;
        } else {
-               ipr_cmd->job_step = ipr_reset_restore_cfg_space;
+               ipr_cmd->job_step = ipr_reset_bist_done;
                ipr_reset_start_timer(ipr_cmd, IPR_WAIT_FOR_BIST_TIMEOUT);
                rc = IPR_RC_JOB_RETURN;
        }
@@ -6935,7 +6951,7 @@ static int __devinit ipr_alloc_cmd_blks(struct ipr_ioa_cfg *ioa_cfg)
                return -ENOMEM;
 
        for (i = 0; i < IPR_NUM_CMD_BLKS; i++) {
-               ipr_cmd = pci_pool_alloc (ioa_cfg->ipr_cmd_pool, SLAB_KERNEL, &dma_addr);
+               ipr_cmd = pci_pool_alloc (ioa_cfg->ipr_cmd_pool, GFP_KERNEL, &dma_addr);
 
                if (!ipr_cmd) {
                        ipr_free_cmd_blks(ioa_cfg);
@@ -7117,7 +7133,7 @@ static void __devinit ipr_init_ioa_cfg(struct ipr_ioa_cfg *ioa_cfg,
        INIT_LIST_HEAD(&ioa_cfg->hostrcb_pending_q);
        INIT_LIST_HEAD(&ioa_cfg->free_res_q);
        INIT_LIST_HEAD(&ioa_cfg->used_res_q);
-       INIT_WORK(&ioa_cfg->work_q, ipr_worker_thread, ioa_cfg);
+       INIT_WORK(&ioa_cfg->work_q, ipr_worker_thread);
        init_waitqueue_head(&ioa_cfg->reset_wait_q);
        ioa_cfg->sdt_state = INACTIVE;
        if (ipr_enable_cache)
@@ -7161,9 +7177,6 @@ ipr_get_chip_cfg(const struct pci_device_id *dev_id)
 {
        int i;
 
-       if (dev_id->driver_data)
-               return (const struct ipr_chip_cfg_t *)dev_id->driver_data;
-
        for (i = 0; i < ARRAY_SIZE(ipr_chip); i++)
                if (ipr_chip[i].vendor == dev_id->vendor &&
                    ipr_chip[i].device == dev_id->device)
@@ -7512,65 +7525,43 @@ static void ipr_shutdown(struct pci_dev *pdev)
 
 static struct pci_device_id ipr_pci_table[] __devinitdata = {
        { PCI_VENDOR_ID_MYLEX, PCI_DEVICE_ID_IBM_GEMSTONE,
-               PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_5702,
-               0, 0, (kernel_ulong_t)&ipr_chip_cfg[0] },
+               PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_5702, 0, 0, 0 },
        { PCI_VENDOR_ID_MYLEX, PCI_DEVICE_ID_IBM_GEMSTONE,
-               PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_5703,
-             0, 0, (kernel_ulong_t)&ipr_chip_cfg[0] },
+               PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_5703, 0, 0, 0 },
        { PCI_VENDOR_ID_MYLEX, PCI_DEVICE_ID_IBM_GEMSTONE,
-               PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_573D,
-             0, 0, (kernel_ulong_t)&ipr_chip_cfg[0] },
+               PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_573D, 0, 0, 0 },
        { PCI_VENDOR_ID_MYLEX, PCI_DEVICE_ID_IBM_GEMSTONE,
-               PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_573E,
-             0, 0, (kernel_ulong_t)&ipr_chip_cfg[0] },
+               PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_573E, 0, 0, 0 },
        { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CITRINE,
-               PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_571B,
-             0, 0, (kernel_ulong_t)&ipr_chip_cfg[0] },
+               PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_571B, 0, 0, 0 },
        { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CITRINE,
-               PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572E,
-             0, 0, (kernel_ulong_t)&ipr_chip_cfg[0] },
+               PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572E, 0, 0, 0 },
        { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CITRINE,
-               PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_571A,
-             0, 0, (kernel_ulong_t)&ipr_chip_cfg[0] },
+               PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_571A, 0, 0, 0 },
        { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CITRINE,
-               PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_575B,
-               0, 0, (kernel_ulong_t)&ipr_chip_cfg[0] },
+               PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_575B, 0, 0, 0 },
        { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_OBSIDIAN,
-             PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572A,
-             0, 0, (kernel_ulong_t)&ipr_chip_cfg[0] },
+             PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572A, 0, 0, 0 },
        { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_OBSIDIAN,
-             PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572B,
-             0, 0, (kernel_ulong_t)&ipr_chip_cfg[0] },
+             PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572B, 0, 0, 0 },
        { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_OBSIDIAN,
-             PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_575C,
-             0, 0, (kernel_ulong_t)&ipr_chip_cfg[0] },
-       { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN,
-             PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572A,
-             0, 0, (kernel_ulong_t)&ipr_chip_cfg[0] },
+             PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_575C, 0, 0, 0 },
        { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN,
-             PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572B,
-             0, 0, (kernel_ulong_t)&ipr_chip_cfg[0] },
+             PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572A, 0, 0, 0 },
        { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN,
-             PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_575C,
-             0, 0, (kernel_ulong_t)&ipr_chip_cfg[0] },
+             PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572B, 0, 0, 0 },
        { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN,
-             PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_57B8,
-             0, 0, (kernel_ulong_t)&ipr_chip_cfg[0] },
+             PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_575C, 0, 0, 0 },
        { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN_E,
-             PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_57B7,
-             0, 0, (kernel_ulong_t)&ipr_chip_cfg[0] },
+             PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_57B7, 0, 0, 0 },
        { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_SNIPE,
-               PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_2780,
-               0, 0, (kernel_ulong_t)&ipr_chip_cfg[1] },
+               PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_2780, 0, 0, 0 },
        { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_SCAMP,
-               PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_571E,
-               0, 0, (kernel_ulong_t)&ipr_chip_cfg[1] },
+               PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_571E, 0, 0, 0 },
        { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_SCAMP,
-               PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_571F,
-               0, 0, (kernel_ulong_t)&ipr_chip_cfg[1] },
+               PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_571F, 0, 0, 0 },
        { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_SCAMP,
-               PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572F,
-               0, 0, (kernel_ulong_t)&ipr_chip_cfg[1] },
+               PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572F, 0, 0, 0 },
        { }
 };
 MODULE_DEVICE_TABLE(pci, ipr_pci_table);