[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <8cf4bdaa-bd05-1962-f1d0-6cb84db31588@googlemail.com>
Date: Thu, 4 Jan 2018 08:00:53 +0100
From: Heiner Kallweit <hkallweit1@...il.com>
To: Russell King <rmk+kernel@...linux.org.uk>,
Andrew Lunn <andrew@...n.ch>,
"David S. Miller" <davem@...emloft.net>
Cc: "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Issue with commit fea23fb591cc "net: phy: convert read-modify-write
to phy_modify()"
Parameter mask of phy_modify() holds the bits to be cleared.
In the mentioned commit parameter mask seems to be inverted in
few cases, what IMO is wrong (see example).
Maybe I miss something, could you please check?
And somehow related:
When adding such helpers, wouldn't it make sense to add
helpers for setting / clearing bits too? Something like:
phy_set_bits(phydev, reg, val) -> phy_modify(phydev, reg, 0, val)
Rgds, Heiner
int genphy_resume(struct phy_device *phydev)
{
- int value;
-
- value = phy_read(phydev, MII_BMCR);
- phy_write(phydev, MII_BMCR, value & ~BMCR_PDOWN);
-
- return 0;
+ return phy_modify(phydev, MII_BMCR, ~BMCR_PDOWN, 0);
}
Powered by blists - more mailing lists