mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	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. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Suggested-by: Russell King - ARM Linux admin <linux@armlinux.org.uk> Acked-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									07b0928918
								
							
						
					
					
						commit
						49644e68f4
					
				
					 2 changed files with 10 additions and 2 deletions
				
			
		| 
						 | 
					@ -772,8 +772,13 @@ static irqreturn_t phy_interrupt(int irq, void *phy_dat)
 | 
				
			||||||
	if (phydev->drv->did_interrupt && !phydev->drv->did_interrupt(phydev))
 | 
						if (phydev->drv->did_interrupt && !phydev->drv->did_interrupt(phydev))
 | 
				
			||||||
		return IRQ_NONE;
 | 
							return IRQ_NONE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (phydev->drv->handle_interrupt) {
 | 
				
			||||||
 | 
							if (phydev->drv->handle_interrupt(phydev))
 | 
				
			||||||
 | 
								goto phy_err;
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
		/* 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_clear_interrupt(phydev))
 | 
						if (phy_clear_interrupt(phydev))
 | 
				
			||||||
		goto phy_err;
 | 
							goto phy_err;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -537,6 +537,9 @@ struct phy_driver {
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	int (*did_interrupt)(struct phy_device *phydev);
 | 
						int (*did_interrupt)(struct phy_device *phydev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* Override default interrupt handling */
 | 
				
			||||||
 | 
						int (*handle_interrupt)(struct phy_device *phydev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Clears up any memory if needed */
 | 
						/* Clears up any memory if needed */
 | 
				
			||||||
	void (*remove)(struct phy_device *phydev);
 | 
						void (*remove)(struct phy_device *phydev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue