* [PATCH net 1/4] sfp: fix RX_LOS signal handling
@ 2017-11-30 13:59 Russell King
0 siblings, 0 replies; only message in thread
From: Russell King @ 2017-11-30 13:59 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli; +Cc: netdev
The options word is a be16 quantity, so we need to test the flags
having converted the endian-ness. Convert the flag bits to be16,
which can be optimised by the compiler, rather than converting a
variable at runtime.
Reported-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
drivers/net/phy/sfp.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
index e381811e5f11..3355141688a6 100644
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -355,7 +355,7 @@ static void sfp_sm_link_check_los(struct sfp *sfp)
* SFP_OPTIONS_LOS_NORMAL are set? For now, we assume
* the same as SFP_OPTIONS_LOS_NORMAL set.
*/
- if (sfp->id.ext.options & SFP_OPTIONS_LOS_INVERTED)
+ if (sfp->id.ext.options & cpu_to_be16(SFP_OPTIONS_LOS_INVERTED))
los ^= SFP_F_LOS;
if (los)
@@ -582,7 +582,8 @@ static void sfp_sm_event(struct sfp *sfp, unsigned int event)
if (event == SFP_E_TX_FAULT)
sfp_sm_fault(sfp, true);
else if (event ==
- (sfp->id.ext.options & SFP_OPTIONS_LOS_INVERTED ?
+ (sfp->id.ext.options &
+ cpu_to_be16(SFP_OPTIONS_LOS_INVERTED) ?
SFP_E_LOS_HIGH : SFP_E_LOS_LOW))
sfp_sm_link_up(sfp);
break;
@@ -592,7 +593,8 @@ static void sfp_sm_event(struct sfp *sfp, unsigned int event)
sfp_sm_link_down(sfp);
sfp_sm_fault(sfp, true);
} else if (event ==
- (sfp->id.ext.options & SFP_OPTIONS_LOS_INVERTED ?
+ (sfp->id.ext.options &
+ cpu_to_be16(SFP_OPTIONS_LOS_INVERTED) ?
SFP_E_LOS_LOW : SFP_E_LOS_HIGH)) {
sfp_sm_link_down(sfp);
sfp_sm_next(sfp, SFP_S_WAIT_LOS, 0);
--
2.7.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2017-11-30 13:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-30 13:59 [PATCH net 1/4] sfp: fix RX_LOS signal handling Russell King
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox