From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753157AbdLGLyE (ORCPT ); Thu, 7 Dec 2017 06:54:04 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:63527 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753062AbdLGLyC (ORCPT ); Thu, 7 Dec 2017 06:54:02 -0500 X-UUID: a648a09af0da411b9303fc68fe05999b-20171207 From: Chunfeng Yun To: Kishon Vijay Abraham I CC: Matthias Brugger , Ryder Lee , Chunfeng Yun , , , , Subject: [PATCH 3/3] phy: phy-mtk-tphy: use of_device_get_match_data() Date: Thu, 7 Dec 2017 19:53:36 +0800 Message-ID: <808e7e783be76e0d5d5eab9f805e8be2d77a7a1b.1512647458.git.chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org reduce the boilerplate code to get the specific data Signed-off-by: Chunfeng Yun --- 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 #include #include +#include #include #include @@ -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