From patchwork Wed Aug 9 09:17:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Q2h1bmZlbmcgWXVuICjkupHmmKXls7Ap?= X-Patchwork-Id: 799582 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3xS5L56dkbz9s71 for ; Wed, 9 Aug 2017 19:18:53 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752840AbdHIJST (ORCPT ); Wed, 9 Aug 2017 05:18:19 -0400 Received: from mailgw01.mediatek.com ([218.249.47.110]:39375 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752465AbdHIJSR (ORCPT ); Wed, 9 Aug 2017 05:18:17 -0400 Received: from mtkcas34.mediatek.inc [(172.27.4.250)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 1354312011; Wed, 09 Aug 2017 17:18:12 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by MTKMBS31DR.mediatek.inc (172.27.6.102) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Wed, 9 Aug 2017 17:18:11 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Wed, 9 Aug 2017 17:18:04 +0800 From: Chunfeng Yun To: Kishon Vijay Abraham I CC: Heiko Stuebner , Kukjin Kim , Krzysztof Kozlowski , Kamil Debski , Sylwester Nawrocki , Thierry Reding , Jonathan Hunter , Matthias Brugger , Bartlomiej Zolnierkiewicz , Lee Jones , Vivek Gautam , Chunfeng Yun , Axel Lin , Baoyou Xie , Arnd Bergmann , Sekhar Nori , Viresh Kumar , Jaehoon Chung , , , , , , Subject: [PATCH 3/4] phy: ti: use of_device_get_match_data() Date: Wed, 9 Aug 2017 17:17:59 +0800 Message-ID: <1502270280-13792-3-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1502270280-13792-1-git-send-email-chunfeng.yun@mediatek.com> References: <1502270280-13792-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-MTK: N Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org reduce the boilerplate code to get the specific data Signed-off-by: Chunfeng Yun --- drivers/phy/ti/phy-omap-usb2.c | 11 ++++------- drivers/phy/ti/phy-ti-pipe3.c | 8 ++------ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/phy/ti/phy-omap-usb2.c b/drivers/phy/ti/phy-omap-usb2.c index fe909fd..70375b1 100644 --- a/drivers/phy/ti/phy-omap-usb2.c +++ b/drivers/phy/ti/phy-omap-usb2.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #define USB2PHY_DISCON_BYP_LATCH (1 << 31) @@ -280,16 +281,12 @@ static int omap_usb2_probe(struct platform_device *pdev) struct device_node *node = pdev->dev.of_node; struct device_node *control_node; struct platform_device *control_pdev; - const struct of_device_id *of_id; - struct usb_phy_data *phy_data; + const struct usb_phy_data *phy_data; - of_id = of_match_device(omap_usb2_id_table, &pdev->dev); - - if (!of_id) + phy_data = of_device_get_match_data(&pdev->dev); + if (!phy_data) return -EINVAL; - phy_data = (struct usb_phy_data *)of_id->data; - phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL); if (!phy) return -ENOMEM; diff --git a/drivers/phy/ti/phy-ti-pipe3.c b/drivers/phy/ti/phy-ti-pipe3.c index 9c84d32..063ab2e 100644 --- a/drivers/phy/ti/phy-ti-pipe3.c +++ b/drivers/phy/ti/phy-ti-pipe3.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -516,7 +517,6 @@ static int ti_pipe3_get_sysctrl(struct ti_pipe3 *phy) static int ti_pipe3_get_pll_base(struct ti_pipe3 *phy) { struct resource *res; - const struct of_device_id *match; struct device *dev = phy->dev; struct device_node *node = dev->of_node; struct platform_device *pdev = to_platform_device(dev); @@ -524,11 +524,7 @@ static int ti_pipe3_get_pll_base(struct ti_pipe3 *phy) if (of_device_is_compatible(node, "ti,phy-pipe3-pcie")) return 0; - match = of_match_device(ti_pipe3_id_table, dev); - if (!match) - return -EINVAL; - - phy->dpll_map = (struct pipe3_dpll_map *)match->data; + phy->dpll_map = of_device_get_match_data(dev); if (!phy->dpll_map) { dev_err(dev, "no DPLL data\n"); return -EINVAL;