lkml.org 
[lkml]   [2011]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRE: [patch 2/2] [SCSI] bfa: test is always false in bfa_sfp_media_get()
>-----Original Message-----
>From: Dan Carpenter [mailto:error27@gmail.com]
>Sent: Wednesday, July 06, 2011 12:40 AM
>To: Jing Huang
>Cc: James E.J. Bottomley; open list:BROCADE BFA FC SC...; linux-
>kernel@vger.kernel.org; kernel-janitors@vger.kernel.org
>Subject: [patch 2/2] [SCSI] bfa: test is always false in bfa_sfp_media_get()
>
>e10g.r.e10g_unall is only 1 bit so "if (e10g.r.e10g_unall & 0x80)"
>is always false. e10g is a union between an unsigned char and named
>bitfields. The intent here was to test the named bitfield by
>itself.
>
>We can change the previous tests as well. That improves the
>readability and it looks like it fixes a endian bug as well.
>
>Signed-off-by: Dan Carpenter <error27@gmail.com>
>---
>I don't understand where __BIGENDIAN is defined. Only this driver
>references it. How does that work?
>
>diff --git a/drivers/scsi/bfa/bfa_ioc.c b/drivers/scsi/bfa/bfa_ioc.c
>index 052373b..090a19d 100644
>--- a/drivers/scsi/bfa/bfa_ioc.c
>+++ b/drivers/scsi/bfa/bfa_ioc.c
>@@ -3589,11 +3589,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_lr && e10g.r.e10g_lrm)
> *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);

Hi Dan,

__BIGENIDIAN is a bug and it needs to be replaced with __BIG_ENDIAN.
The first two changes will introduce endianness issue without having __BIGENDIAN fixed.
The third change is good but also needs the same fix to make the code endianness netural,.

Thanks
Jing


\
 
 \ /
  Last update: 2011-07-12 09:07    [W:0.090 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site