lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Wed, 19 Oct 2022 14:29:16 +0100 From: "Russell King (Oracle)" <rmk+kernel@...linux.org.uk> To: "David S. Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org> Cc: Andrew Lunn <andrew@...n.ch>, Heiner Kallweit <hkallweit1@...il.com>, Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org Subject: [PATCH net-next 7/7] net: sfp: get rid of DM7052 hack when enabling high power Since we no longer mis-detect high-power mode with the DM7052 module, we no longer need the hack in sfp_module_enable_high_power(), and can now switch this to use sfp_modify_u8(). Signed-off-by: Russell King (Oracle) <rmk+kernel@...linux.org.uk> --- drivers/net/phy/sfp.c | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c index 921bbedd9b22..39fd1811375c 100644 --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c @@ -1837,31 +1837,14 @@ static int sfp_module_parse_power(struct sfp *sfp) static int sfp_sm_mod_hpower(struct sfp *sfp, bool enable) { - u8 val; int err; - err = sfp_read(sfp, true, SFP_EXT_STATUS, &val, sizeof(val)); - if (err != sizeof(val)) { - dev_err(sfp->dev, "Failed to read EEPROM: %pe\n", ERR_PTR(err)); - return -EAGAIN; - } - - /* DM7052 reports as a high power module, responds to reads (with - * all bytes 0xff) at 0x51 but does not accept writes. In any case, - * if the bit is already set, we're already in high power mode. - */ - if (!!(val & SFP_EXT_STATUS_PWRLVL_SELECT) == enable) - return 0; - - if (enable) - val |= SFP_EXT_STATUS_PWRLVL_SELECT; - else - val &= ~SFP_EXT_STATUS_PWRLVL_SELECT; - - err = sfp_write(sfp, true, SFP_EXT_STATUS, &val, sizeof(val)); - if (err != sizeof(val)) { - dev_err(sfp->dev, "Failed to write EEPROM: %pe\n", - ERR_PTR(err)); + err = sfp_modify_u8(sfp, true, SFP_EXT_STATUS, + SFP_EXT_STATUS_PWRLVL_SELECT, + enable ? SFP_EXT_STATUS_PWRLVL_SELECT : 0); + if (err != sizeof(u8)) { + dev_err(sfp->dev, "failed to %sable high power: %pe\n", + enable ? "en" : "dis", ERR_PTR(err)); return -EAGAIN; } -- 2.30.2
Powered by blists - more mailing lists