]> err.no Git - linux-2.6/blobdiff - drivers/scsi/ipr.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild
[linux-2.6] / drivers / scsi / ipr.c
index 072f5771565823284eaa5c273203facc2d9bf027..c316a0bcae6cc8f9ca717153fb266dda5f8fe3fb 100644 (file)
@@ -2439,6 +2439,7 @@ restart:
 /**
  * ipr_read_trace - Dump the adapter trace
  * @kobj:              kobject struct
+ * @bin_attr:          bin_attribute struct
  * @buf:               buffer
  * @off:               offset
  * @count:             buffer size
@@ -2446,8 +2447,9 @@ restart:
  * Return value:
  *     number of bytes printed to buffer
  **/
-static ssize_t ipr_read_trace(struct kobject *kobj, char *buf,
-                             loff_t off, size_t count)
+static ssize_t ipr_read_trace(struct kobject *kobj,
+                             struct bin_attribute *bin_attr,
+                             char *buf, loff_t off, size_t count)
 {
        struct class_device *cdev = container_of(kobj,struct class_device,kobj);
        struct Scsi_Host *shost = class_to_shost(cdev);
@@ -3140,6 +3142,7 @@ static struct class_device_attribute *ipr_ioa_attrs[] = {
 /**
  * ipr_read_dump - Dump the adapter
  * @kobj:              kobject struct
+ * @bin_attr:          bin_attribute struct
  * @buf:               buffer
  * @off:               offset
  * @count:             buffer size
@@ -3147,8 +3150,9 @@ static struct class_device_attribute *ipr_ioa_attrs[] = {
  * Return value:
  *     number of bytes printed to buffer
  **/
-static ssize_t ipr_read_dump(struct kobject *kobj, char *buf,
-                             loff_t off, size_t count)
+static ssize_t ipr_read_dump(struct kobject *kobj,
+                            struct bin_attribute *bin_attr,
+                            char *buf, loff_t off, size_t count)
 {
        struct class_device *cdev = container_of(kobj,struct class_device,kobj);
        struct Scsi_Host *shost = class_to_shost(cdev);
@@ -3301,6 +3305,7 @@ static int ipr_free_dump(struct ipr_ioa_cfg *ioa_cfg)
 /**
  * ipr_write_dump - Setup dump state of adapter
  * @kobj:              kobject struct
+ * @bin_attr:          bin_attribute struct
  * @buf:               buffer
  * @off:               offset
  * @count:             buffer size
@@ -3308,8 +3313,9 @@ static int ipr_free_dump(struct ipr_ioa_cfg *ioa_cfg)
  * Return value:
  *     number of bytes printed to buffer
  **/
-static ssize_t ipr_write_dump(struct kobject *kobj, char *buf,
-                             loff_t off, size_t count)
+static ssize_t ipr_write_dump(struct kobject *kobj,
+                             struct bin_attribute *bin_attr,
+                             char *buf, loff_t off, size_t count)
 {
        struct class_device *cdev = container_of(kobj,struct class_device,kobj);
        struct Scsi_Host *shost = class_to_shost(cdev);
@@ -3823,18 +3829,18 @@ static int ipr_device_reset(struct ipr_ioa_cfg *ioa_cfg,
 
 /**
  * ipr_sata_reset - Reset the SATA port
- * @ap:                SATA port to reset
+ * @link:      SATA link to reset
  * @classes:   class of the attached device
  *
- * This function issues a SATA phy reset to the affected ATA port.
+ * This function issues a SATA phy reset to the affected ATA link.
  *
  * Return value:
  *     0 on success / non-zero on failure
  **/
-static int ipr_sata_reset(struct ata_port *ap, unsigned int *classes,
+static int ipr_sata_reset(struct ata_link *link, unsigned int *classes,
                                unsigned long deadline)
 {
-       struct ipr_sata_port *sata_port = ap->private_data;
+       struct ipr_sata_port *sata_port = link->ap->private_data;
        struct ipr_ioa_cfg *ioa_cfg = sata_port->ioa_cfg;
        struct ipr_resource_entry *res;
        unsigned long lock_flags = 0;
@@ -4975,22 +4981,22 @@ static void ipr_ata_phy_reset(struct ata_port *ap)
        rc = ipr_device_reset(ioa_cfg, res);
 
        if (rc) {
-               ap->ops->port_disable(ap);
+               ata_port_disable(ap);
                goto out_unlock;
        }
 
        switch(res->cfgte.proto) {
        case IPR_PROTO_SATA:
        case IPR_PROTO_SAS_STP:
-               ap->device[0].class = ATA_DEV_ATA;
+               ap->link.device[0].class = ATA_DEV_ATA;
                break;
        case IPR_PROTO_SATA_ATAPI:
        case IPR_PROTO_SAS_STP_ATAPI:
-               ap->device[0].class = ATA_DEV_ATAPI;
+               ap->link.device[0].class = ATA_DEV_ATAPI;
                break;
        default:
-               ap->device[0].class = ATA_DEV_UNKNOWN;
-               ap->ops->port_disable(ap);
+               ap->link.device[0].class = ATA_DEV_UNKNOWN;
+               ata_port_disable(ap);
                break;
        };
 
@@ -5128,6 +5134,7 @@ static void ipr_build_ata_ioadl(struct ipr_cmnd *ipr_cmd,
        u32 ioadl_flags = 0;
        struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb;
        struct ipr_ioadl_desc *ioadl = ipr_cmd->ioadl;
+       struct ipr_ioadl_desc *last_ioadl = NULL;
        int len = qc->nbytes + qc->pad_len;
        struct scatterlist *sg;
 
@@ -5150,11 +5157,13 @@ static void ipr_build_ata_ioadl(struct ipr_cmnd *ipr_cmd,
        ata_for_each_sg(sg, qc) {
                ioadl->flags_and_data_len = cpu_to_be32(ioadl_flags | sg_dma_len(sg));
                ioadl->address = cpu_to_be32(sg_dma_address(sg));
-               if (ata_sg_is_last(sg, qc))
-                       ioadl->flags_and_data_len |= cpu_to_be32(IPR_IOADL_FLAGS_LAST);
-               else
-                       ioadl++;
+
+               last_ioadl = ioadl;
+               ioadl++;
        }
+
+       if (likely(last_ioadl))
+               last_ioadl->flags_and_data_len |= cpu_to_be32(IPR_IOADL_FLAGS_LAST);
 }
 
 /**
@@ -5256,7 +5265,6 @@ static u8 ipr_ata_check_altstatus(struct ata_port *ap)
 }
 
 static struct ata_port_operations ipr_sata_ops = {
-       .port_disable = ata_port_disable,
        .check_status = ipr_ata_check_status,
        .check_altstatus = ipr_ata_check_altstatus,
        .dev_select = ata_noop_dev_select,
@@ -5303,18 +5311,12 @@ static const u16 ipr_blocked_processors[] = {
  **/
 static int ipr_invalid_adapter(struct ipr_ioa_cfg *ioa_cfg)
 {
-       u8 rev_id;
        int i;
 
-       if (ioa_cfg->type == 0x5702) {
-               if (pci_read_config_byte(ioa_cfg->pdev, PCI_REVISION_ID,
-                                        &rev_id) == PCIBIOS_SUCCESSFUL) {
-                       if (rev_id < 4) {
-                               for (i = 0; i < ARRAY_SIZE(ipr_blocked_processors); i++){
-                                       if (__is_processor(ipr_blocked_processors[i]))
-                                               return 1;
-                               }
-                       }
+       if ((ioa_cfg->type == 0x5702) && (ioa_cfg->pdev->revision < 4)) {
+               for (i = 0; i < ARRAY_SIZE(ipr_blocked_processors); i++){
+                       if (__is_processor(ipr_blocked_processors[i]))
+                               return 1;
                }
        }
        return 0;
@@ -7471,13 +7473,7 @@ static int __devinit ipr_probe_ioa(struct pci_dev *pdev,
        else
                ioa_cfg->transop_timeout = IPR_OPERATIONAL_TIMEOUT;
 
-       rc = pci_read_config_byte(pdev, PCI_REVISION_ID, &ioa_cfg->revid);
-
-       if (rc != PCIBIOS_SUCCESSFUL) {
-               dev_err(&pdev->dev, "Failed to read PCI revision ID\n");
-               rc = -EIO;
-               goto out_scsi_host_put;
-       }
+       ioa_cfg->revid = pdev->revision;
 
        ipr_regs_pci = pci_resource_start(pdev, 0);