Commit 695bce8f authored by Heiner Kallweit's avatar Heiner Kallweit Committed by David S. Miller

net: phy: improve struct phy_device member interrupts handling

As a heritage from the very early days of phylib member interrupts is
defined as u32 even though it's just a flag whether interrupts are
enabled. So we can change it to a bitfield member. In addition change
the code dealing with this member in a way that it's clear we're
dealing with a bool value.
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a4bec00b
...@@ -115,9 +115,9 @@ static int phy_clear_interrupt(struct phy_device *phydev) ...@@ -115,9 +115,9 @@ static int phy_clear_interrupt(struct phy_device *phydev)
* *
* Returns 0 on success or < 0 on error. * Returns 0 on success or < 0 on error.
*/ */
static int phy_config_interrupt(struct phy_device *phydev, u32 interrupts) static int phy_config_interrupt(struct phy_device *phydev, bool interrupts)
{ {
phydev->interrupts = interrupts; phydev->interrupts = interrupts ? 1 : 0;
if (phydev->drv->config_intr) if (phydev->drv->config_intr)
return phydev->drv->config_intr(phydev); return phydev->drv->config_intr(phydev);
......
...@@ -263,8 +263,8 @@ static inline struct mii_bus *devm_mdiobus_alloc(struct device *dev) ...@@ -263,8 +263,8 @@ static inline struct mii_bus *devm_mdiobus_alloc(struct device *dev)
void devm_mdiobus_free(struct device *dev, struct mii_bus *bus); void devm_mdiobus_free(struct device *dev, struct mii_bus *bus);
struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr); struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr);
#define PHY_INTERRUPT_DISABLED 0x0 #define PHY_INTERRUPT_DISABLED false
#define PHY_INTERRUPT_ENABLED 0x80000000 #define PHY_INTERRUPT_ENABLED true
/* PHY state machine states: /* PHY state machine states:
* *
...@@ -410,6 +410,9 @@ struct phy_device { ...@@ -410,6 +410,9 @@ struct phy_device {
/* The most recently read link state */ /* The most recently read link state */
unsigned link:1; unsigned link:1;
/* Interrupts are enabled */
unsigned interrupts:1;
enum phy_state state; enum phy_state state;
u32 dev_flags; u32 dev_flags;
...@@ -425,9 +428,6 @@ struct phy_device { ...@@ -425,9 +428,6 @@ struct phy_device {
int pause; int pause;
int asym_pause; int asym_pause;
/* Enabled Interrupts */
u32 interrupts;
/* Union of PHY and Attached devices' supported modes */ /* Union of PHY and Attached devices' supported modes */
/* See mii.h for more info */ /* See mii.h for more info */
u32 supported; u32 supported;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment