From: Chunfeng Yun <chunfeng.yun@mediatek.com>
To: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>,
Ryder Lee <ryder.lee@mediatek.com>,
Chunfeng Yun <chunfeng.yun@mediatek.com>,
<linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-usb@vger.kernel.org>, <linux-mediatek@lists.infradead.org>
Subject: [PATCH 3/3] phy: phy-mtk-tphy: use of_device_get_match_data()
Date: Thu, 7 Dec 2017 19:53:36 +0800 [thread overview]
Message-ID: <808e7e783be76e0d5d5eab9f805e8be2d77a7a1b.1512647458.git.chunfeng.yun@mediatek.com> (raw)
In-Reply-To: <ff2797a0487a0b30a2292c2685dedcbbfeead293.1512647458.git.chunfeng.yun@mediatek.com>
reduce the boilerplate code to get the specific data
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
drivers/phy/mediatek/phy-mtk-tphy.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
index d99f79b1..bd26de3 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 @@ static struct phy *mtk_phy_xlate(struct device *dev,
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);
--
1.9.1
next prev parent reply other threads:[~2017-12-07 11:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-07 11:53 [PATCH 1/3] phy: phy-mtk-tphy: use auto instead of force to bypass utmi signals Chunfeng Yun
2017-12-07 11:53 ` [PATCH 2/3] phy: phy-mtk-tphy: make shared banks optional for V1 TPHY Chunfeng Yun
2017-12-07 11:53 ` Chunfeng Yun [this message]
2017-12-28 11:14 ` [PATCH 1/3] phy: phy-mtk-tphy: use auto instead of force to bypass utmi signals Kishon Vijay Abraham I
2018-01-02 1:41 ` Chunfeng Yun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=808e7e783be76e0d5d5eab9f805e8be2d77a7a1b.1512647458.git.chunfeng.yun@mediatek.com \
--to=chunfeng.yun@mediatek.com \
--cc=kishon@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=ryder.lee@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®