• S
    net: tlan: Replace in_irq() usage · beca9282
    Sebastian Andrzej Siewior 提交于
    The driver uses in_irq() to determine if the tlan_priv::lock has to be
    acquired in tlan_mii_read_reg() and tlan_mii_write_reg().
    
    The interrupt handler acquires the lock outside of these functions so the
    in_irq() check is meant to prevent a lock recursion deadlock. But this
    check is incorrect when interrupt force threading is enabled because then
    the handler runs in thread context and in_irq() correctly returns false.
    
    The usage of in_*() in drivers is phased out and Linus clearly requested
    that code which changes behaviour depending on context should either be
    seperated or the context be conveyed in an argument passed by the caller,
    which usually knows the context.
    
    tlan_set_timer() has this conditional as well, but this function is only
    invoked from task context or the timer callback itself. So it always has to
    lock and the check can be removed.
    
    tlan_mii_read_reg(), tlan_mii_write_reg() and tlan_phy_print() are invoked
    from interrupt and other contexts.
    
    Split out the actual function body into helper variants which are called
    from interrupt context and make the original functions wrappers which
    acquire tlan_priv::lock unconditionally.
    Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
    Cc: Samuel Chessman <chessman@tux.org>
    Signed-off-by: NJakub Kicinski <kuba@kernel.org>
    beca9282
tlan.c 86.1 KB