]> err.no Git - linux-2.6/blobdiff - drivers/scsi/libsas/sas_expander.c
[SCSI] libsas: Convert sas_proto users to sas_protocol
[linux-2.6] / drivers / scsi / libsas / sas_expander.c
index b500f0c1449c5d7da0a8b9005541556d4b757ac3..27674fe468f5bb16f45ccdc1de3762140dba89f3 100644 (file)
@@ -507,14 +507,21 @@ static int sas_dev_present_in_domain(struct asd_sas_port *port,
 int sas_smp_get_phy_events(struct sas_phy *phy)
 {
        int res;
+       u8 *req;
+       u8 *resp;
        struct sas_rphy *rphy = dev_to_rphy(phy->dev.parent);
        struct domain_device *dev = sas_find_dev_by_rphy(rphy);
-       u8 *req = alloc_smp_req(RPEL_REQ_SIZE);
-       u8 *resp = kzalloc(RPEL_RESP_SIZE, GFP_KERNEL);
 
-       if (!resp)
+       req = alloc_smp_req(RPEL_REQ_SIZE);
+       if (!req)
                return -ENOMEM;
 
+       resp = alloc_smp_resp(RPEL_RESP_SIZE);
+       if (!resp) {
+               kfree(req);
+               return -ENOMEM;
+       }
+
        req[1] = SMP_REPORT_PHY_ERR_LOG;
        req[9] = phy->number;
 
@@ -649,9 +656,9 @@ static struct domain_device *sas_ex_discover_end_dev(
        sas_ex_get_linkrate(parent, child, phy);
 
 #ifdef CONFIG_SCSI_SAS_ATA
-       if ((phy->attached_tproto & SAS_PROTO_STP) || phy->attached_sata_dev) {
+       if ((phy->attached_tproto & SAS_PROTOCOL_STP) || phy->attached_sata_dev) {
                child->dev_type = SATA_DEV;
-               if (phy->attached_tproto & SAS_PROTO_STP)
+               if (phy->attached_tproto & SAS_PROTOCOL_STP)
                        child->tproto = phy->attached_tproto;
                if (phy->attached_sata_dev)
                        child->tproto |= SATA_DEV;
@@ -688,7 +695,7 @@ static struct domain_device *sas_ex_discover_end_dev(
                }
        } else
 #endif
-         if (phy->attached_tproto & SAS_PROTO_SSP) {
+         if (phy->attached_tproto & SAS_PROTOCOL_SSP) {
                child->dev_type = SAS_END_DEV;
                rphy = sas_end_device_alloc(phy->port);
                /* FIXME: error handling */
@@ -1879,7 +1886,7 @@ int sas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
                    struct request *req)
 {
        struct domain_device *dev;
-       int ret, type = rphy->identify.device_type;
+       int ret, type;
        struct request *rsp = req->next_rq;
 
        if (!rsp) {
@@ -1888,12 +1895,13 @@ int sas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
                return -EINVAL;
        }
 
-       /* seems aic94xx doesn't support */
+       /* no rphy means no smp target support (ie aic94xx host) */
        if (!rphy) {
                printk("%s: can we send a smp request to a host?\n",
                       __FUNCTION__);
                return -EINVAL;
        }
+       type = rphy->identify.device_type;
 
        if (type != SAS_EDGE_EXPANDER_DEVICE &&
            type != SAS_FANOUT_EXPANDER_DEVICE) {