Commit eda7d46d authored by Ryder Lee's avatar Ryder Lee Committed by David S. Miller

net: mediatek: use of_device_get_match_data()

The usage of of_device_get_match_data() reduce the code size a bit.

Also, the only way to call mtk_probe() is to match an entry in
of_mtk_match[], so match cannot be NULL.
Signed-off-by: default avatarRyder Lee <ryder.lee@mediatek.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5d136594
...@@ -2503,7 +2503,6 @@ static int mtk_probe(struct platform_device *pdev) ...@@ -2503,7 +2503,6 @@ static int mtk_probe(struct platform_device *pdev)
{ {
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
struct device_node *mac_np; struct device_node *mac_np;
const struct of_device_id *match;
struct mtk_eth *eth; struct mtk_eth *eth;
int err; int err;
int i; int i;
...@@ -2512,8 +2511,7 @@ static int mtk_probe(struct platform_device *pdev) ...@@ -2512,8 +2511,7 @@ static int mtk_probe(struct platform_device *pdev)
if (!eth) if (!eth)
return -ENOMEM; return -ENOMEM;
match = of_match_device(of_mtk_match, &pdev->dev); eth->soc = of_device_get_match_data(&pdev->dev);
eth->soc = (struct mtk_soc_data *)match->data;
eth->dev = &pdev->dev; eth->dev = &pdev->dev;
eth->base = devm_ioremap_resource(&pdev->dev, res); eth->base = devm_ioremap_resource(&pdev->dev, res);
......
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