diff options
author | Cristian Sovaiala <cristian.sovaiala@freescale.com> | 2014-04-18 13:01:25 (GMT) |
---|---|---|
committer | Madalin-Cristian Bucur <madalin.bucur@freescale.com> | 2014-04-24 07:19:47 (GMT) |
commit | 92c11b3278f0e8d7429f8794f62ae726ea6792a8 (patch) | |
tree | d42984fc95e3f5c5571f8a15f38ccfc832e3286b /drivers/net/ethernet/freescale/dpa | |
parent | 8cc211a153e11a11ecda4aeb7aa5514ac1af82f1 (diff) | |
download | linux-fsl-qoriq-92c11b3278f0e8d7429f8794f62ae726ea6792a8.tar.xz |
dpaa_eth: Cleaning up port suspend/resume error paths
Add goto labels and relevant error messages when RX/TX port
suspend/resume or set WoL fail.
Returning a != 0 value from suspend callback we trigger a
rollback of the suspend sequence.
In resume callback, in case RX port resume fails we suspend the
TX port and keep WoL disabled.
Change-Id: I330249c06525785d7045c627dcf218d031028857
Signed-off-by: Cristian Sovaiala <cristian.sovaiala@freescale.com>
Reviewed-on: http://git.am.freescale.net:8181/11367
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Bogdan Hamciuc <bogdan.hamciuc@freescale.com>
Reviewed-by: Madalin-Cristian Bucur <madalin.bucur@freescale.com>
(cherry picked from commit 56956b78e098c2ae9166bfe93efaaac97758c0cf)
Reviewed-on: http://git.am.freescale.net:8181/11437
Tested-by: Madalin-Cristian Bucur <madalin.bucur@freescale.com>
Diffstat (limited to 'drivers/net/ethernet/freescale/dpa')
-rw-r--r-- | drivers/net/ethernet/freescale/dpa/dpaa_eth.c | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth.c index 862357a..3231725 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth.c @@ -124,22 +124,34 @@ static int dpaa_suspend_noirq(struct device *dev) mac_dev = priv->mac_dev; err = fm_port_suspend(mac_dev->port_dev[RX]); - if (err) - goto port_suspend_failed; + if (err) { + netdev_err(net_dev, "fm_port_suspend(RX) = %d\n", err); + goto rx_port_suspend_failed; + } err = fm_port_suspend(mac_dev->port_dev[TX]); - if (err) - err = fm_port_resume(mac_dev->port_dev[RX]); + if (err) { + netdev_err(net_dev, "fm_port_suspend(TX) = %d\n", err); + goto tx_port_suspend_failed; + } if (priv->wol & DPAA_WOL_MAGIC) { err = priv->mac_dev->set_wol(mac_dev->port_dev[RX], priv->mac_dev->get_mac_handle(mac_dev), true); - if (unlikely(err < 0)) + if (err) { netdev_err(net_dev, "set_wol() = %d\n", err); + goto set_wol_failed; + } } } -port_suspend_failed: + return 0; + +set_wol_failed: + fm_port_resume(mac_dev->port_dev[TX]); +tx_port_suspend_failed: + fm_port_resume(mac_dev->port_dev[RX]); +rx_port_suspend_failed: return err; } @@ -159,20 +171,31 @@ static int dpaa_resume_noirq(struct device *dev) if (priv->wol & DPAA_WOL_MAGIC) { err = priv->mac_dev->set_wol(mac_dev->port_dev[RX], priv->mac_dev->get_mac_handle(mac_dev), false); - if (unlikely(err < 0)) + if (err) { netdev_err(net_dev, "set_wol() = %d\n", err); + goto set_wol_failed; + } } err = fm_port_resume(mac_dev->port_dev[TX]); - if (err) - goto port_resume_failed; + if (err) { + netdev_err(net_dev, "fm_port_resume(TX) = %d\n", err); + goto tx_port_resume_failed; + } err = fm_port_resume(mac_dev->port_dev[RX]); - if (err) - err = fm_port_suspend(mac_dev->port_dev[TX]); + if (err) { + netdev_err(net_dev, "fm_port_resume(RX) = %d\n", err); + goto rx_port_resume_failed; + } } -port_resume_failed: + return 0; + +rx_port_resume_failed: + fm_port_suspend(mac_dev->port_dev[TX]); +tx_port_resume_failed: +set_wol_failed: return err; } |