tmp_suning_uos_patched/drivers/net/phy
Maciej W. Rozycki 0ac4952731 PHYLIB: IRQ event workqueue handling fixes
Keep track of disable_irq_nosync() invocations and call enable_irq() the
right number of times if work has been cancelled that would include them.

Now that the call to flush_work_keventd() (problematic because of
rtnl_mutex being held) has been replaced by cancel_work_sync() another
issue has arisen and been left unresolved.  As the MDIO bus cannot be
accessed from the interrupt context the PHY interrupt handler uses
disable_irq_nosync() to prevent from looping and schedules some work to be
done as a softirq, which, apart from handling the state change of the
originating PHY, is responsible for reenabling the interrupt.  Now if the
interrupt line is shared by another device and a call to the softirq
handler has been cancelled, that call to enable_irq() never happens and the
other device cannot use its interrupt anymore as its stuck disabled.

I decided to use a counter rather than a flag because there may be more
than one call to phy_change() cancelled in the queue -- a real one and a
fake one triggered by free_irq() if DEBUG_SHIRQ is used, if nothing else.
Therefore because of its nesting property enable_irq() has to be called the
right number of times to match the number disable_irq_nosync() was called
and restore the original state.  This DEBUG_SHIRQ feature is also the
reason why free_irq() has to be called before cancel_work_sync().

While at it I updated the comment about phy_stop_interrupts() being called
from `keventd' -- this is no longer relevant as the use of
cancel_work_sync() makes such an approach unnecessary.  OTOH a similar
comment referring to flush_scheduled_work() in phy_stop() still applies as
using cancel_work_sync() there would be dangerous.

Checked with checkpatch.pl and at the run time (with and without
DEBUG_SHIRQ).

Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
Cc: Andy Fleming <afleming@freescale.com>
Cc: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-10 16:53:55 -07:00
..
broadcom.c [PATCH] 2.6.18: sb1250-mac: Broadcom PHY support 2006-12-02 00:11:54 -05:00
cicada.c [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
davicom.c Add support for the Davicom DM9161A PHY 2007-05-11 17:53:43 -04:00
fixed.c PHY fixed driver: rework release path and update phy_id notation 2007-10-10 16:53:50 -07:00
icplus.c phylib: add the ICPlus IP175C PHY driver 2007-07-08 22:16:38 -04:00
Kconfig PHY fixed driver: rework release path and update phy_id notation 2007-10-10 16:53:50 -07:00
lxt.c [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
Makefile phylib: add the ICPlus IP175C PHY driver 2007-07-08 22:16:38 -04:00
marvell.c phylib: Add Marvell 88E1112 phy id 2007-07-10 12:41:09 -04:00
mdio_bus.c phy: Fix phy_id for Vitesse 824x PHY 2007-06-28 13:26:06 -05:00
phy_device.c PHYLIB: Spinlock fixes for softirqs 2007-10-10 16:53:54 -07:00
phy.c PHYLIB: IRQ event workqueue handling fixes 2007-10-10 16:53:55 -07:00
qsemi.c [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
smsc.c [PATCH] remove unnecessary config.h includes from drivers/net/ 2006-08-14 14:00:43 -04:00
vitesse.c Fix error checking in Vitesse IRQ config 2007-07-24 16:28:41 -04:00