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.
Unified · Split
| @@ -772,8 +772,13 @@ static irqreturn_t phy_interrupt(int irq, void *phy_dat) · 771 unmodified lines | |||
| 772 | if (phydev->drv->did_interrupt && !phydev->drv->did_interrupt(phydev)) | 772 | if (phydev->drv->did_interrupt && !phydev->drv->did_interrupt(phydev)) |
| 773 | return IRQ_NONE; | 773 | return IRQ_NONE; |
| 774 | 774 | ||
| 775 | /* reschedule state queue work to run as soon as possible */ | 775 | if (phydev->drv->handle_interrupt) { |
| 776 | phy_trigger_machine(phydev); | 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 | } | ||
| 777 | 782 | ||
| 778 | if (phy_clear_interrupt(phydev)) | 783 | if (phy_clear_interrupt(phydev)) |
| 779 | goto phy_err; | 784 | goto phy_err; |
| @@ -537,6 +537,9 @@ struct phy_driver { · 536 unmodified lines | |||
| 537 | */ | 537 | */ |
| 538 | int (*did_interrupt)(struct phy_device *phydev); | 538 | int (*did_interrupt)(struct phy_device *phydev); |
| 539 | 539 | ||
| 540 | /* Override default interrupt handling */ | ||
| 541 | int (*handle_interrupt)(struct phy_device *phydev); | ||
| 542 | |||
| 540 | /* Clears up any memory if needed */ | 543 | /* Clears up any memory if needed */ |
| 541 | void (*remove)(struct phy_device *phydev); | 544 | void (*remove)(struct phy_device *phydev); |
| 542 | 545 | ||