]> asedeno.scripts.mit.edu Git - linux.git/commit
net: fec: only restart or stop the device if it is present and running
authorRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 8 Jul 2014 11:40:07 +0000 (12:40 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 Jul 2014 03:02:58 +0000 (20:02 -0700)
commit8ce5624f5bbb991ae3aea2fcdae86d808351e173
treef1fa4fca6e1b256be169541d8f24bd5642488f0b
parent8bbbd3c19c469a1c6b8e97e9f5a083d029657be5
net: fec: only restart or stop the device if it is present and running

Avoid calling fec_restart() or fec_stop() while the device is down
or not present (iow suspended.)

Although the ndo_timeout method will only be called if the device is
present and running, we defer this to a work queue.  The work queue
can run independently, and so needs to repeat these checks to ensure
that a restart doesn't occur after the device has been taken down or
detached for suspend.  In this case, we call fec_restart() in the
resume path, so nothing is lost.

For fec_set_features, we add a call to fec_restart() in fec_enet_open()
to ensure that the hardware is appropriate programmed when the interface
is opened.  fec_set_features() call should not occur while we're
suspended, so we don't have to worry about that case.

The adjust_link needs similar treatment - this also is called from a
work queue, which may be run independently after we have taken the
device down and detached it.  In this case, we just mark the link
down and take no further action.  We will reset things appropriately
once the device is up and running again, at which point we will receive
another adjust_link callback.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/fec_main.c