From fd2ac0f677998a95fd813ef97f7aeaededad31bc Mon Sep 17 00:00:00 2001 From: Marian Rotariu Date: Tue, 4 Feb 2014 18:34:45 +0200 Subject: dpaa_eth: fix PM functions for proxy driver Run-time information regarding proxy interface should be stored and acquired only through dev_set_drvdata() and dev_get_drvdata() primitives. This information is essential for macless driver capability of controling a MAC device. Change-Id: Icaad66952874e5835b1086c0aa225ae331fc6f5f Signed-off-by: Marian Rotariu Reviewed-on: http://git.am.freescale.net:8181/8725 Tested-by: Review Code-CDREVIEW Reviewed-by: Cristian-Constantin Sovaiala Reviewed-by: Madalin-Cristian Bucur (cherry picked from commit 50e51c4f00960b29644398532cf2481e46945f9e) Reviewed-on: http://git.am.freescale.net:8181/8908 Tested-by: Madalin-Cristian Bucur diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth_proxy.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth_proxy.c index 293eb58..41478fd 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth_proxy.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth_proxy.c @@ -58,14 +58,13 @@ module_param(debug, byte, S_IRUGO); MODULE_PARM_DESC(debug, "Module/Driver verbosity level"); static int __cold dpa_eth_proxy_remove(struct platform_device *of_dev); -static struct proxy_device *proxy_dev; - #ifdef CONFIG_PM static int proxy_suspend_noirq(struct device *dev) { - struct mac_device *mac_dev = proxy_dev->mac_dev; - int err = 0; + struct proxy_device *proxy_dev = dev_get_drvdata(dev); + struct mac_device *mac_dev = proxy_dev->mac_dev; + int err = 0; err = fm_port_suspend(mac_dev->port_dev[RX]); if (err) @@ -81,6 +80,7 @@ port_suspend_failed: static int proxy_resume_noirq(struct device *dev) { + struct proxy_device *proxy_dev = dev_get_drvdata(dev); struct mac_device *mac_dev = proxy_dev->mac_dev; int err = 0; @@ -120,6 +120,7 @@ static int dpaa_eth_proxy_probe(struct platform_device *_of_dev) struct fm_port_fqs port_fqs; struct dpa_buffer_layout_s *buf_layout = NULL; struct mac_device *mac_dev; + struct proxy_device *proxy_dev; dev = &_of_dev->dev; @@ -304,13 +305,13 @@ int dpa_proxy_stop(struct proxy_device *proxy_dev, struct net_device *net_dev) static int __cold dpa_eth_proxy_remove(struct platform_device *of_dev) { - struct device *dev; - - dev = &of_dev->dev; - dev_set_drvdata(dev, NULL); + struct device *dev = &of_dev->dev; + struct proxy_device *proxy_dev = dev_get_drvdata(dev); kfree(proxy_dev); + dev_set_drvdata(dev, NULL); + return 0; } -- cgit v0.10.2