summaryrefslogtreecommitdiffstats
path: root/drivers/phy/mediatek
diff options
context:
space:
mode:
authorChunfeng Yun <chunfeng.yun@mediatek.com>2017-12-28 16:40:36 +0530
committerKishon Vijay Abraham I <kishon@ti.com>2017-12-29 13:00:35 +0530
commite4b227c1ca70ae779c39e5284742555b9e1cdf9f (patch)
tree0a902551b787a0d6fbaf39180f810946061edee3 /drivers/phy/mediatek
parent93a04f4f1607c55452c85c7adaee043321afb3ae (diff)
downloadlinux-e4b227c1ca70ae779c39e5284742555b9e1cdf9f.tar.bz2
phy: phy-mtk-tphy: use of_device_get_match_data()
reduce the boilerplate code to get the specific data Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Diffstat (limited to 'drivers/phy/mediatek')
-rw-r--r--drivers/phy/mediatek/phy-mtk-tphy.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
index 11cab1d84a02..1e96d0740ef5 100644
--- a/drivers/phy/mediatek/phy-mtk-tphy.c
+++ b/drivers/phy/mediatek/phy-mtk-tphy.c
@@ -20,6 +20,7 @@
#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/of_address.h>
+#include <linux/of_device.h>
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
@@ -995,7 +996,6 @@ MODULE_DEVICE_TABLE(of, mtk_tphy_id_table);
static int mtk_tphy_probe(struct platform_device *pdev)
{
- const struct of_device_id *match;
struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
struct device_node *child_np;
@@ -1005,15 +1005,14 @@ static int mtk_tphy_probe(struct platform_device *pdev)
struct resource res;
int port, retval;
- match = of_match_node(mtk_tphy_id_table, pdev->dev.of_node);
- if (!match)
- return -EINVAL;
-
tphy = devm_kzalloc(dev, sizeof(*tphy), GFP_KERNEL);
if (!tphy)
return -ENOMEM;
- tphy->pdata = match->data;
+ tphy->pdata = of_device_get_match_data(dev);
+ if (!tphy->pdata)
+ return -EINVAL;
+
tphy->nphys = of_get_child_count(np);
tphy->phys = devm_kcalloc(dev, tphy->nphys,
sizeof(*tphy->phys), GFP_KERNEL);