[SCSI] libsas: Convert sas_proto users to sas_protocol
authorDarrick J. Wong <djwong@us.ibm.com>
Mon, 5 Nov 2007 19:51:17 +0000 (11:51 -0800)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Sat, 12 Jan 2008 00:22:41 +0000 (18:22 -0600)
sparse complains about the mixing of enums in libsas.  Since the
underlying numeric values of both enums are the same, combine them
to get rid of the warning.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
12 files changed:
drivers/scsi/aic94xx/aic94xx_dev.c
drivers/scsi/aic94xx/aic94xx_dump.c
drivers/scsi/aic94xx/aic94xx_hwi.c
drivers/scsi/aic94xx/aic94xx_scb.c
drivers/scsi/aic94xx/aic94xx_task.c
drivers/scsi/aic94xx/aic94xx_tmf.c
drivers/scsi/libsas/sas_discover.c
drivers/scsi/libsas/sas_expander.c
drivers/scsi/libsas/sas_internal.h
include/scsi/libsas.h
include/scsi/sas.h
include/scsi/scsi_transport_sas.h

index 3dce618bf4148c293f4eff51b7f2ac27c1c22277..72042cae7768551a68e597c4a1734ec1eb9f74f1 100644 (file)
@@ -165,7 +165,7 @@ static int asd_init_target_ddb(struct domain_device *dev)
        if (dev->port->oob_mode != SATA_OOB_MODE) {
                flags |= OPEN_REQUIRED;
                if ((dev->dev_type == SATA_DEV) ||
-                   (dev->tproto & SAS_PROTO_STP)) {
+                   (dev->tproto & SAS_PROTOCOL_STP)) {
                        struct smp_resp *rps_resp = &dev->sata_dev.rps_resp;
                        if (rps_resp->frame_type == SMP_RESPONSE &&
                            rps_resp->function == SMP_REPORT_PHY_SATA &&
@@ -193,7 +193,7 @@ static int asd_init_target_ddb(struct domain_device *dev)
        asd_ddbsite_write_byte(asd_ha, ddb, DDB_TARG_FLAGS, flags);
 
        flags = 0;
-       if (dev->tproto & SAS_PROTO_STP)
+       if (dev->tproto & SAS_PROTOCOL_STP)
                flags |= STP_CL_POL_NO_TX;
        asd_ddbsite_write_byte(asd_ha, ddb, DDB_TARG_FLAGS2, flags);
 
@@ -201,7 +201,7 @@ static int asd_init_target_ddb(struct domain_device *dev)
        asd_ddbsite_write_word(asd_ha, ddb, SEND_QUEUE_TAIL, 0xFFFF);
        asd_ddbsite_write_word(asd_ha, ddb, SISTER_DDB, 0xFFFF);
 
-       if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTO_STP)) {
+       if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) {
                i = asd_init_sata(dev);
                if (i < 0) {
                        asd_free_ddb(asd_ha, ddb);
index 6bd8e3059d27d8a551b823c7dc54007f956d3380..3d8c4ff1f2efe225628f6d082b47c4bf84d1374f 100644 (file)
@@ -903,11 +903,11 @@ void asd_dump_frame_rcvd(struct asd_phy *phy,
        int i;
 
        switch ((dl->status_block[1] & 0x70) >> 3) {
-       case SAS_PROTO_STP:
+       case SAS_PROTOCOL_STP:
                ASD_DPRINTK("STP proto device-to-host FIS:\n");
                break;
        default:
-       case SAS_PROTO_SSP:
+       case SAS_PROTOCOL_SSP:
                ASD_DPRINTK("SAS proto IDENTIFY:\n");
                break;
        }
index 0cd7eed9196c44eec8065fd71be58d9c2359af0c..098b5f39cd31b3a2da7954e8488e265de442fdf0 100644 (file)
@@ -91,7 +91,7 @@ static int asd_init_phy(struct asd_phy *phy)
 
        sas_phy->enabled = 1;
        sas_phy->class = SAS;
-       sas_phy->iproto = SAS_PROTO_ALL;
+       sas_phy->iproto = SAS_PROTOCOL_ALL;
        sas_phy->tproto = 0;
        sas_phy->type = PHY_TYPE_PHYSICAL;
        sas_phy->role = PHY_ROLE_INITIATOR;
index db6ab1a3b81e888f5ae9469c70285b6c6af0a965..0febad4dd75f69bdf631fb0c847cc25cfe4ec518 100644 (file)
@@ -788,12 +788,12 @@ void asd_build_control_phy(struct asd_ascb *ascb, int phy_id, u8 subfunc)
 
                /* initiator port settings are in the hi nibble */
                if (phy->sas_phy.role == PHY_ROLE_INITIATOR)
-                       control_phy->port_type = SAS_PROTO_ALL << 4;
+                       control_phy->port_type = SAS_PROTOCOL_ALL << 4;
                else if (phy->sas_phy.role == PHY_ROLE_TARGET)
-                       control_phy->port_type = SAS_PROTO_ALL;
+                       control_phy->port_type = SAS_PROTOCOL_ALL;
                else
                        control_phy->port_type =
-                               (SAS_PROTO_ALL << 4) | SAS_PROTO_ALL;
+                               (SAS_PROTOCOL_ALL << 4) | SAS_PROTOCOL_ALL;
 
                /* link reset retries, this should be nominal */
                control_phy->link_reset_retries = 10;
index ee0a98bffcd4c0fec572afd6e67e707c4ddb1cca..663fdef38c52fecf009e1e3a19220c6e9d1e7169 100644 (file)
@@ -187,7 +187,7 @@ static void asd_get_response_tasklet(struct asd_ascb *ascb,
        ts->buf_valid_size = 0;
        edb = asd_ha->seq.edb_arr[edb_id + escb->edb_index];
        r = edb->vaddr;
-       if (task->task_proto == SAS_PROTO_SSP) {
+       if (task->task_proto == SAS_PROTOCOL_SSP) {
                struct ssp_response_iu *iu =
                        r + 16 + sizeof(struct ssp_frame_hdr);
 
@@ -341,14 +341,14 @@ Again:
        }
 
        switch (task->task_proto) {
-       case SATA_PROTO:
-       case SAS_PROTO_STP:
+       case SAS_PROTOCOL_SATA:
+       case SAS_PROTOCOL_STP:
                asd_unbuild_ata_ascb(ascb);
                break;
-       case SAS_PROTO_SMP:
+       case SAS_PROTOCOL_SMP:
                asd_unbuild_smp_ascb(ascb);
                break;
-       case SAS_PROTO_SSP:
+       case SAS_PROTOCOL_SSP:
                asd_unbuild_ssp_ascb(ascb);
        default:
                break;
@@ -586,17 +586,17 @@ int asd_execute_task(struct sas_task *task, const int num,
        list_for_each_entry(a, &alist, list) {
                t = a->uldd_task;
                a->uldd_timer = 1;
-               if (t->task_proto & SAS_PROTO_STP)
-                       t->task_proto = SAS_PROTO_STP;
+               if (t->task_proto & SAS_PROTOCOL_STP)
+                       t->task_proto = SAS_PROTOCOL_STP;
                switch (t->task_proto) {
-               case SATA_PROTO:
-               case SAS_PROTO_STP:
+               case SAS_PROTOCOL_SATA:
+               case SAS_PROTOCOL_STP:
                        res = asd_build_ata_ascb(a, t, gfp_flags);
                        break;
-               case SAS_PROTO_SMP:
+               case SAS_PROTOCOL_SMP:
                        res = asd_build_smp_ascb(a, t, gfp_flags);
                        break;
-               case SAS_PROTO_SSP:
+               case SAS_PROTOCOL_SSP:
                        res = asd_build_ssp_ascb(a, t, gfp_flags);
                        break;
                default:
@@ -633,14 +633,14 @@ out_err_unmap:
                        t->task_state_flags &= ~SAS_TASK_AT_INITIATOR;
                        spin_unlock_irqrestore(&t->task_state_lock, flags);
                        switch (t->task_proto) {
-                       case SATA_PROTO:
-                       case SAS_PROTO_STP:
+                       case SAS_PROTOCOL_SATA:
+                       case SAS_PROTOCOL_STP:
                                asd_unbuild_ata_ascb(a);
                                break;
-                       case SAS_PROTO_SMP:
+                       case SAS_PROTOCOL_SMP:
                                asd_unbuild_smp_ascb(a);
                                break;
-                       case SAS_PROTO_SSP:
+                       case SAS_PROTOCOL_SSP:
                                asd_unbuild_ssp_ascb(a);
                        default:
                                break;
index c0d0b7d7a8ce0d34b33dc7b4a8ea3990e6212155..87b2f6e6adfef417b346014ba7c566ea4a4a6e10 100644 (file)
@@ -372,21 +372,21 @@ int asd_abort_task(struct sas_task *task)
        scb->header.opcode = ABORT_TASK;
 
        switch (task->task_proto) {
-       case SATA_PROTO:
-       case SAS_PROTO_STP:
+       case SAS_PROTOCOL_SATA:
+       case SAS_PROTOCOL_STP:
                scb->abort_task.proto_conn_rate = (1 << 5); /* STP */
                break;
-       case SAS_PROTO_SSP:
+       case SAS_PROTOCOL_SSP:
                scb->abort_task.proto_conn_rate  = (1 << 4); /* SSP */
                scb->abort_task.proto_conn_rate |= task->dev->linkrate;
                break;
-       case SAS_PROTO_SMP:
+       case SAS_PROTOCOL_SMP:
                break;
        default:
                break;
        }
 
-       if (task->task_proto == SAS_PROTO_SSP) {
+       if (task->task_proto == SAS_PROTOCOL_SSP) {
                scb->abort_task.ssp_frame.frame_type = SSP_TASK;
                memcpy(scb->abort_task.ssp_frame.hashed_dest_addr,
                       task->dev->hashed_sas_addr, HASHED_SAS_ADDR_SIZE);
@@ -512,7 +512,7 @@ static int asd_initiate_ssp_tmf(struct domain_device *dev, u8 *lun,
        int res = 1;
        struct scb *scb;
 
-       if (!(dev->tproto & SAS_PROTO_SSP))
+       if (!(dev->tproto & SAS_PROTOCOL_SSP))
                return TMF_RESP_FUNC_ESUPP;
 
        ascb = asd_ascb_alloc_list(asd_ha, &res, GFP_KERNEL);
index 5f3a0d7b18de9db796d4ada15df39d8ef29c1b61..31b9af224243d2e73c54bf2b4c8d19944eee0c30 100644 (file)
@@ -98,7 +98,7 @@ static int sas_get_port_device(struct asd_sas_port *port)
                        dev->dev_type = SATA_PM;
                else
                        dev->dev_type = SATA_DEV;
-               dev->tproto = SATA_PROTO;
+               dev->tproto = SAS_PROTOCOL_SATA;
        } else {
                struct sas_identify_frame *id =
                        (struct sas_identify_frame *) dev->frame_rcvd;
index 8727436b222d340f269556d2b7054a31416700c6..27674fe468f5bb16f45ccdc1de3762140dba89f3 100644 (file)
@@ -656,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;
@@ -695,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 */
index 2b8213b1832dae44a778a176063aee2286f626eb..baa0666ffa80d772e13a290655ab5a5204ad274d 100644 (file)
@@ -45,7 +45,7 @@
 void sas_scsi_recover_host(struct Scsi_Host *shost);
 
 int sas_show_class(enum sas_class class, char *buf);
-int sas_show_proto(enum sas_proto proto, char *buf);
+int sas_show_proto(enum sas_protocol proto, char *buf);
 int sas_show_linkrate(enum sas_linkrate linkrate, char *buf);
 int sas_show_oob_mode(enum sas_oob_mode oob_mode, char *buf);
 
index a466c2cb8955b5f0955a7a194b44475abfce3e31..e42374cebf957cc68d328b3ebfb3621e2ac7613f 100644 (file)
@@ -122,8 +122,8 @@ struct ex_phy {
        u8   attached_sata_dev:1;
        u8   attached_sata_ps:1;
 
-       enum sas_proto attached_tproto;
-       enum sas_proto attached_iproto;
+       enum sas_protocol attached_tproto;
+       enum sas_protocol attached_iproto;
 
        u8   attached_sas_addr[SAS_ADDR_SIZE];
        u8   attached_phy_id;
@@ -191,8 +191,8 @@ struct domain_device {
 
         struct list_head dev_list_node;
 
-        enum sas_proto    iproto;
-        enum sas_proto    tproto;
+        enum sas_protocol    iproto;
+        enum sas_protocol    tproto;
 
         struct sas_rphy *rphy;
 
@@ -245,8 +245,8 @@ struct asd_sas_port {
        enum sas_class   class;
        u8               sas_addr[SAS_ADDR_SIZE];
        u8               attached_sas_addr[SAS_ADDR_SIZE];
-       enum sas_proto   iproto;
-       enum sas_proto   tproto;
+       enum sas_protocol   iproto;
+       enum sas_protocol   tproto;
 
        enum sas_oob_mode oob_mode;
 
@@ -289,8 +289,8 @@ struct asd_sas_phy {
 
        int            id;        /* must be set */
        enum sas_class class;
-       enum sas_proto iproto;
-       enum sas_proto tproto;
+       enum sas_protocol iproto;
+       enum sas_protocol tproto;
 
        enum sas_phy_type  type;
        enum sas_phy_role  role;
@@ -537,7 +537,7 @@ struct sas_task {
        spinlock_t   task_state_lock;
        unsigned     task_state_flags;
 
-       enum   sas_proto      task_proto;
+       enum   sas_protocol      task_proto;
 
        /* Used by the discovery code. */
        struct timer_list     timer;
index 2f4b6afa34fc3ae20015c0e18a29aa982a45bfc3..e9fd022813814145726c2296e459909de9ae3676 100644 (file)
@@ -102,13 +102,12 @@ enum sas_dev_type {
        SATA_PM_PORT= 8,
 };
 
-/* Partly from IDENTIFY address frame. */
-enum sas_proto {
-       SATA_PROTO    = 1,
-       SAS_PROTO_SMP = 2,        /* protocol */
-       SAS_PROTO_STP = 4,        /* protocol */
-       SAS_PROTO_SSP = 8,        /* protocol */
-       SAS_PROTO_ALL = 0xE,
+enum sas_protocol {
+       SAS_PROTOCOL_SATA               = 0x01,
+       SAS_PROTOCOL_SMP                = 0x02,
+       SAS_PROTOCOL_STP                = 0x04,
+       SAS_PROTOCOL_SSP                = 0x08,
+       SAS_PROTOCOL_ALL                = 0x0E,
 };
 
 /* From the spec; local phys only */
index abdfd2e27dd7dee85993d9199acb099b13a229c2..007d92904207c9e3f4b66c35fa24fddbc83d8611 100644 (file)
@@ -4,6 +4,7 @@
 #include <linux/transport_class.h>
 #include <linux/types.h>
 #include <linux/mutex.h>
+#include <scsi/sas.h>
 
 struct scsi_transport_template;
 struct sas_rphy;
@@ -16,13 +17,6 @@ enum sas_device_type {
        SAS_FANOUT_EXPANDER_DEVICE,
 };
 
-enum sas_protocol {
-       SAS_PROTOCOL_SATA               = 0x01,
-       SAS_PROTOCOL_SMP                = 0x02,
-       SAS_PROTOCOL_STP                = 0x04,
-       SAS_PROTOCOL_SSP                = 0x08,
-};
-
 static inline int sas_protocol_ata(enum sas_protocol proto)
 {
        return ((proto & SAS_PROTOCOL_SATA) ||