kernel: bump 4.14 to 4.14.125 (FS#2305 FS#2297)
[oweals/openwrt.git] / target / linux / mediatek / patches-4.14 / 0179-phy-phy-mtk-tphy-use-of_device_get_match_data.patch
1 From 3e53007a55e70d5036a527900befecf9a6316d05 Mon Sep 17 00:00:00 2001
2 From: Chunfeng Yun <chunfeng.yun@mediatek.com>
3 Date: Thu, 28 Dec 2017 16:40:36 +0530
4 Subject: [PATCH 179/224] phy: phy-mtk-tphy: use of_device_get_match_data()
5
6 reduce the boilerplate code to get the specific data
7
8 Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
9 Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
10 ---
11  drivers/phy/mediatek/phy-mtk-tphy.c | 11 +++++------
12  1 file changed, 5 insertions(+), 6 deletions(-)
13
14 --- a/drivers/phy/mediatek/phy-mtk-tphy.c
15 +++ b/drivers/phy/mediatek/phy-mtk-tphy.c
16 @@ -20,6 +20,7 @@
17  #include <linux/iopoll.h>
18  #include <linux/module.h>
19  #include <linux/of_address.h>
20 +#include <linux/of_device.h>
21  #include <linux/phy/phy.h>
22  #include <linux/platform_device.h>
23  
24 @@ -995,7 +996,6 @@ MODULE_DEVICE_TABLE(of, mtk_tphy_id_tabl
25  
26  static int mtk_tphy_probe(struct platform_device *pdev)
27  {
28 -       const struct of_device_id *match;
29         struct device *dev = &pdev->dev;
30         struct device_node *np = dev->of_node;
31         struct device_node *child_np;
32 @@ -1005,15 +1005,14 @@ static int mtk_tphy_probe(struct platfor
33         struct resource res;
34         int port, retval;
35  
36 -       match = of_match_node(mtk_tphy_id_table, pdev->dev.of_node);
37 -       if (!match)
38 -               return -EINVAL;
39 -
40         tphy = devm_kzalloc(dev, sizeof(*tphy), GFP_KERNEL);
41         if (!tphy)
42                 return -ENOMEM;
43  
44 -       tphy->pdata = match->data;
45 +       tphy->pdata = of_device_get_match_data(dev);
46 +       if (!tphy->pdata)
47 +               return -EINVAL;
48 +
49         tphy->nphys = of_get_child_count(np);
50         tphy->phys = devm_kcalloc(dev, tphy->nphys,
51                                        sizeof(*tphy->phys), GFP_KERNEL);