Hello. On 27-03-2014 10:18, Zhao Qiang wrote:
The at8031 can work on polling mode and interrupt mode. Add ack_interrupt and config intr funcs to enable interrupt mode for it.
Signed-off-by: Zhao Qiang <b45...@freescale.com> --- drivers/net/phy/at803x.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index bc71947..d034ef5 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c
[...]
@@ -191,6 +194,31 @@ static int at803x_config_init(struct phy_device *phydev) return 0; } +static int at803x_ack_interrupt(struct phy_device *phydev) +{ + int err; + + err = phy_read(phydev, AT803X_INSR);
Could make this an initializer...
+ + return (err < 0) ? err : 0; +} + +static int at803x_config_intr(struct phy_device *phydev) +{ + int err; + int value; + + value = phy_read(phydev, AT803X_INER); + + if (phydev->interrupts == PHY_INTERRUPT_ENABLED) + err = phy_write(phydev, AT803X_INER, + (value | AT803X_INER_INIT));
Inner parens not needed.
+ else + err = phy_write(phydev, AT803X_INER, value);
Why are you not clearing the bits here? Why write back what has been read at all?
WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/