History

net: phy: add callback for custom interrupt handler to struct phy_driver

The phylib interrupt handler handles link change events only currently. However PHY drivers may want to use other interrupt sources too, e.g. to report temperature monitoring events. Therefore add a callback to struct phy_driver allowing PHY drivers to implement a custom interrupt handler.

Heiner Kallweit committed 7 years ago

Commit 49644e61 parent 07b09282 files · +10 −2Browse files

Unified · Split

2 files
  1. drivers/net/phy/phy.c +7 −2
  2. include/linux/phy.h +3 −0
drivers/net/phy/phy.c+7−2
@@ -772,8 +772,13 @@ static irqreturn_t phy_interrupt(int irq, void *phy_dat) · 771 unmodified lines
772772 if (phydev->drv->did_interrupt && !phydev->drv->did_interrupt(phydev))
773773 return IRQ_NONE;
774774
775− /* reschedule state queue work to run as soon as possible */
776− phy_trigger_machine(phydev);
775+ if (phydev->drv->handle_interrupt) {
776+ if (phydev->drv->handle_interrupt(phydev))
777+ goto phy_err;
778+ } else {
779+ /* reschedule state queue work to run as soon as possible */
780+ phy_trigger_machine(phydev);
781+ }
777782
778783 if (phy_clear_interrupt(phydev))
779784 goto phy_err;
include/linux/phy.h+3−0
@@ -537,6 +537,9 @@ struct phy_driver { · 536 unmodified lines
537537 */
538538 int (*did_interrupt)(struct phy_device *phydev);
539539
540+ /* Override default interrupt handling */
541+ int (*handle_interrupt)(struct phy_device *phydev);
542+
540543 /* Clears up any memory if needed */
541544 void (*remove)(struct phy_device *phydev);
542545

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t