From: Joachim Eastwood Date: Tue, 6 Sep 2016 21:38:45 +0000 (+0200) Subject: stmmac: introduce get_stmmac_bsp_priv() helper X-Git-Tag: v4.9-rc1~74^2~3^2~9 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=1b0acbfdb8a8884f18fdb2caa85b4beded2390fb;p=karo-tx-linux.git stmmac: introduce get_stmmac_bsp_priv() helper Create a helper to retrieve dwmac private data from a dev pointer. This is useful in PM callbacks and driver remove. Signed-off-by: Joachim Eastwood Tested-by: Martin Blumenstingl Acked-by: David S. Miller Signed-off-by: Kevin Hilman --- diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h index ffeb8d9e2b2e..64e147f53a9c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h @@ -30,4 +30,12 @@ int stmmac_get_platform_resources(struct platform_device *pdev, int stmmac_pltfr_remove(struct platform_device *pdev); extern const struct dev_pm_ops stmmac_pltfr_pm_ops; +static inline void *get_stmmac_bsp_priv(struct device *dev) +{ + struct net_device *ndev = dev_get_drvdata(dev); + struct stmmac_priv *priv = netdev_priv(ndev); + + return priv->plat->bsp_priv; +} + #endif /* __STMMAC_PLATFORM_H__ */