Skip to content

Commit

Permalink
net: mediatek: use of_device_get_match_data()
Browse files Browse the repository at this point in the history
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: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ryder Lee authored and David S. Miller committed Apr 16, 2018
1 parent 5d13659 commit eda7d46
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/net/ethernet/mediatek/mtk_eth_soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2503,7 +2503,6 @@ static int mtk_probe(struct platform_device *pdev)
{
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
struct device_node *mac_np;
const struct of_device_id *match;
struct mtk_eth *eth;
int err;
int i;
Expand All @@ -2512,8 +2511,7 @@ static int mtk_probe(struct platform_device *pdev)
if (!eth)
return -ENOMEM;

match = of_match_device(of_mtk_match, &pdev->dev);
eth->soc = (struct mtk_soc_data *)match->data;
eth->soc = of_device_get_match_data(&pdev->dev);

eth->dev = &pdev->dev;
eth->base = devm_ioremap_resource(&pdev->dev, res);
Expand Down

0 comments on commit eda7d46

Please sign in to comment.