Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Heiner Kallweit and committed by
David S. Miller
695bce8f a4bec00b

+7 -7
+2 -2
drivers/net/phy/phy.c
··· 115 115 * 116 116 * Returns 0 on success or < 0 on error. 117 117 */ 118 - static int phy_config_interrupt(struct phy_device *phydev, u32 interrupts) 118 + static int phy_config_interrupt(struct phy_device *phydev, bool interrupts) 119 119 { 120 - phydev->interrupts = interrupts; 120 + phydev->interrupts = interrupts ? 1 : 0; 121 121 if (phydev->drv->config_intr) 122 122 return phydev->drv->config_intr(phydev); 123 123
+5 -5
include/linux/phy.h
··· 263 263 void devm_mdiobus_free(struct device *dev, struct mii_bus *bus); 264 264 struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr); 265 265 266 - #define PHY_INTERRUPT_DISABLED 0x0 267 - #define PHY_INTERRUPT_ENABLED 0x80000000 266 + #define PHY_INTERRUPT_DISABLED false 267 + #define PHY_INTERRUPT_ENABLED true 268 268 269 269 /* PHY state machine states: 270 270 * ··· 410 410 /* The most recently read link state */ 411 411 unsigned link:1; 412 412 413 + /* Interrupts are enabled */ 414 + unsigned interrupts:1; 415 + 413 416 enum phy_state state; 414 417 415 418 u32 dev_flags; ··· 427 424 int duplex; 428 425 int pause; 429 426 int asym_pause; 430 - 431 - /* Enabled Interrupts */ 432 - u32 interrupts; 433 427 434 428 /* Union of PHY and Attached devices' supported modes */ 435 429 /* See mii.h for more info */