[SCSI] bfa: fix endian and bit field check bug
authorJing Huang <huangj@brocade.com>
Wed, 16 Nov 2011 20:29:26 +0000 (12:29 -0800)
committerJames Bottomley <JBottomley@Parallels.com>
Thu, 15 Dec 2011 06:55:01 +0000 (10:55 +0400)
Fix some endian issue. __BIGENDIAN is not defined and it needs to be
replaced with __BIG_ENDIAN. Also fixed a bug in bit field access.
These two issues were reported by Dan Carpenter.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/bfa/bfa_defs.h
drivers/scsi/bfa/bfa_ioc.c

index 7b3d235d20b4638fb62d270b5a5a37980230055e..b5a1595cc0a523f6e71e8b1c8c438257c5897f70 100644 (file)
@@ -902,7 +902,7 @@ struct sfp_mem_s {
 union sfp_xcvr_e10g_code_u {
        u8              b;
        struct {
-#ifdef __BIGENDIAN
+#ifdef __BIG_ENDIAN
                u8      e10g_unall:1;   /* 10G Ethernet compliance */
                u8      e10g_lrm:1;
                u8      e10g_lr:1;
@@ -982,7 +982,7 @@ union sfp_xcvr_fc2_code_u {
 union sfp_xcvr_fc3_code_u {
        u8              b;
        struct {
-#ifdef __BIGENDIAN
+#ifdef __BIG_ENDIAN
                u8      rsv4:1;
                u8      mb800:1;    /* 800 Mbytes/sec */
                u8      mb1600:1;   /* 1600 Mbytes/sec */
index 1ac5aecf25a68a14c2c98011cf1af357b60ead26..eca7ab78085bef2664d63d173e4a5510cdb61cfd 100644 (file)
@@ -3727,11 +3727,11 @@ bfa_sfp_media_get(struct bfa_sfp_s *sfp)
                         (xmtr_tech & SFP_XMTR_TECH_SA))
                        *media = BFA_SFP_MEDIA_SW;
                /* Check 10G Ethernet Compilance code */
-               else if (e10g.b & 0x10)
+               else if (e10g.r.e10g_sr)
                        *media = BFA_SFP_MEDIA_SW;
-               else if (e10g.b & 0x60)
+               else if (e10g.r.e10g_lrm && e10g.r.e10g_lr)
                        *media = BFA_SFP_MEDIA_LW;
-               else if (e10g.r.e10g_unall & 0x80)
+               else if (e10g.r.e10g_unall)
                        *media = BFA_SFP_MEDIA_UNKNOWN;
                else
                        bfa_trc(sfp, 0);