Commit 34d884e3 authored by Heiner Kallweit's avatar Heiner Kallweit Committed by David S. Miller

net: phy: improve and inline phy_change

Now that phy_mac_interrupt() doesn't call phy_change() any longer it's
called from phy_interrupt() only. Therefore phy_interrupt_is_valid()
returns true always and the check can be removed.
In case of PHY_HALTED phy_interrupt() bails out immediately,
therefore the second check for PHY_HALTED including the call to
phy_disable_interrupts() can be removed.
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d73a2156
...@@ -723,25 +723,26 @@ static int phy_disable_interrupts(struct phy_device *phydev) ...@@ -723,25 +723,26 @@ static int phy_disable_interrupts(struct phy_device *phydev)
} }
/** /**
* phy_change - Called by the phy_interrupt to handle PHY changes * phy_interrupt - PHY interrupt handler
* @phydev: phy_device struct that interrupted * @irq: interrupt line
* @phy_dat: phy_device pointer
*
* Description: Handle PHY interrupt
*/ */
static irqreturn_t phy_change(struct phy_device *phydev) static irqreturn_t phy_interrupt(int irq, void *phy_dat)
{ {
if (phy_interrupt_is_valid(phydev)) { struct phy_device *phydev = phy_dat;
if (phydev->drv->did_interrupt &&
!phydev->drv->did_interrupt(phydev))
return IRQ_NONE;
if (phydev->state == PHY_HALTED) if (PHY_HALTED == phydev->state)
if (phy_disable_interrupts(phydev)) return IRQ_NONE; /* It can't be ours. */
goto phy_err;
} if (phydev->drv->did_interrupt && !phydev->drv->did_interrupt(phydev))
return IRQ_NONE;
/* reschedule state queue work to run as soon as possible */ /* reschedule state queue work to run as soon as possible */
phy_trigger_machine(phydev); phy_trigger_machine(phydev);
if (phy_interrupt_is_valid(phydev) && phy_clear_interrupt(phydev)) if (phy_clear_interrupt(phydev))
goto phy_err; goto phy_err;
return IRQ_HANDLED; return IRQ_HANDLED;
...@@ -750,24 +751,6 @@ static irqreturn_t phy_change(struct phy_device *phydev) ...@@ -750,24 +751,6 @@ static irqreturn_t phy_change(struct phy_device *phydev)
return IRQ_NONE; return IRQ_NONE;
} }
/**
* phy_interrupt - PHY interrupt handler
* @irq: interrupt line
* @phy_dat: phy_device pointer
*
* Description: When a PHY interrupt occurs, the handler disables
* interrupts, and uses phy_change to handle the interrupt.
*/
static irqreturn_t phy_interrupt(int irq, void *phy_dat)
{
struct phy_device *phydev = phy_dat;
if (PHY_HALTED == phydev->state)
return IRQ_NONE; /* It can't be ours. */
return phy_change(phydev);
}
/** /**
* phy_enable_interrupts - Enable the interrupts from the PHY side * phy_enable_interrupts - Enable the interrupts from the PHY side
* @phydev: target phy_device struct * @phydev: target phy_device struct
...@@ -846,7 +829,7 @@ void phy_stop(struct phy_device *phydev) ...@@ -846,7 +829,7 @@ void phy_stop(struct phy_device *phydev)
phy_state_machine(&phydev->state_queue.work); phy_state_machine(&phydev->state_queue.work);
/* Cannot call flush_scheduled_work() here as desired because /* Cannot call flush_scheduled_work() here as desired because
* of rtnl_lock(), but PHY_HALTED shall guarantee phy_change() * of rtnl_lock(), but PHY_HALTED shall guarantee irq handler
* will not reenable interrupts. * will not reenable interrupts.
*/ */
} }
......
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