* [PATCH] net: mediatek: use of_device_get_match_data()
[not found] <31f944ab8dfcc1d7b6f03b35657a2a34825b5246.1523347340.git.ryder.lee@mediatek.com>
@ 2018-04-16 2:33 ` Ryder Lee
2018-04-16 17:43 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Ryder Lee @ 2018-04-16 2:33 UTC (permalink / raw)
To: David S. Miller
Cc: Sean Wang, netdev, linux-kernel, linux-arm-kernel, linux-mediatek,
Ryder Lee
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>
---
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index e0b72bf..d8ebf0a 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -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;
@@ -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);
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: mediatek: use of_device_get_match_data()
2018-04-16 2:33 ` [PATCH] net: mediatek: use of_device_get_match_data() Ryder Lee
@ 2018-04-16 17:43 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-04-16 17:43 UTC (permalink / raw)
To: ryder.lee
Cc: sean.wang, netdev, linux-kernel, linux-arm-kernel, linux-mediatek
From: Ryder Lee <ryder.lee@mediatek.com>
Date: Mon, 16 Apr 2018 10:33:41 +0800
> 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>
Applied to net-next.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-04-16 17:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <31f944ab8dfcc1d7b6f03b35657a2a34825b5246.1523347340.git.ryder.lee@mediatek.com>
2018-04-16 2:33 ` [PATCH] net: mediatek: use of_device_get_match_data() Ryder Lee
2018-04-16 17:43 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).