Commit 902b1607 authored by Joachim Eastwood's avatar Joachim Eastwood Committed by David S. Miller

stmmac: prepare stmmac platform to support stand alone drivers

Prepare the stmmac platform code to support standalone drivers
by exporting the need functions and having of_match_device use
the match table reference already present in the driver struct.

This will allow us to reuse the platform driver functions from
this code easily in other stand alone platform drivers.
Signed-off-by: default avatarJoachim Eastwood <manabian@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f8cff12b
...@@ -130,11 +130,12 @@ static int stmmac_probe_config_dt(struct platform_device *pdev, ...@@ -130,11 +130,12 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
struct stmmac_dma_cfg *dma_cfg; struct stmmac_dma_cfg *dma_cfg;
const struct of_device_id *device; const struct of_device_id *device;
struct device *dev = &pdev->dev;
if (!np) if (!np)
return -ENODEV; return -ENODEV;
device = of_match_device(stmmac_dt_ids, &pdev->dev); device = of_match_device(dev->driver->of_match_table, dev);
if (!device) if (!device)
return -ENODEV; return -ENODEV;
...@@ -269,7 +270,7 @@ static int stmmac_probe_config_dt(struct platform_device *pdev, ...@@ -269,7 +270,7 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
* the necessary platform resources, invoke custom helper (if required) and * the necessary platform resources, invoke custom helper (if required) and
* invoke the main probe function. * invoke the main probe function.
*/ */
static int stmmac_pltfr_probe(struct platform_device *pdev) int stmmac_pltfr_probe(struct platform_device *pdev)
{ {
int ret = 0; int ret = 0;
struct resource *res; struct resource *res;
...@@ -375,6 +376,7 @@ static int stmmac_pltfr_probe(struct platform_device *pdev) ...@@ -375,6 +376,7 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(stmmac_pltfr_probe);
/** /**
* stmmac_pltfr_remove * stmmac_pltfr_remove
...@@ -382,7 +384,7 @@ static int stmmac_pltfr_probe(struct platform_device *pdev) ...@@ -382,7 +384,7 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
* Description: this function calls the main to free the net resources * Description: this function calls the main to free the net resources
* and calls the platforms hook and release the resources (e.g. mem). * and calls the platforms hook and release the resources (e.g. mem).
*/ */
static int stmmac_pltfr_remove(struct platform_device *pdev) int stmmac_pltfr_remove(struct platform_device *pdev)
{ {
struct net_device *ndev = platform_get_drvdata(pdev); struct net_device *ndev = platform_get_drvdata(pdev);
struct stmmac_priv *priv = netdev_priv(ndev); struct stmmac_priv *priv = netdev_priv(ndev);
...@@ -396,6 +398,7 @@ static int stmmac_pltfr_remove(struct platform_device *pdev) ...@@ -396,6 +398,7 @@ static int stmmac_pltfr_remove(struct platform_device *pdev)
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(stmmac_pltfr_remove);
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
/** /**
...@@ -439,8 +442,9 @@ static int stmmac_pltfr_resume(struct device *dev) ...@@ -439,8 +442,9 @@ static int stmmac_pltfr_resume(struct device *dev)
} }
#endif /* CONFIG_PM_SLEEP */ #endif /* CONFIG_PM_SLEEP */
static SIMPLE_DEV_PM_OPS(stmmac_pltfr_pm_ops, SIMPLE_DEV_PM_OPS(stmmac_pltfr_pm_ops, stmmac_pltfr_suspend,
stmmac_pltfr_suspend, stmmac_pltfr_resume); stmmac_pltfr_resume);
EXPORT_SYMBOL_GPL(stmmac_pltfr_pm_ops);
static struct platform_driver stmmac_pltfr_driver = { static struct platform_driver stmmac_pltfr_driver = {
.probe = stmmac_pltfr_probe, .probe = stmmac_pltfr_probe,
......
...@@ -19,6 +19,10 @@ ...@@ -19,6 +19,10 @@
#ifndef __STMMAC_PLATFORM_H__ #ifndef __STMMAC_PLATFORM_H__
#define __STMMAC_PLATFORM_H__ #define __STMMAC_PLATFORM_H__
int stmmac_pltfr_probe(struct platform_device *pdev);
int stmmac_pltfr_remove(struct platform_device *pdev);
extern const struct dev_pm_ops stmmac_pltfr_pm_ops;
extern const struct stmmac_of_data lpc18xx_dwmac_data; extern const struct stmmac_of_data lpc18xx_dwmac_data;
extern const struct stmmac_of_data meson6_dwmac_data; extern const struct stmmac_of_data meson6_dwmac_data;
extern const struct stmmac_of_data sun7i_gmac_data; extern const struct stmmac_of_data sun7i_gmac_data;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment