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: Chunfeng Yun X-Patchwork-Id: 9889971 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B0EB4602D7 for ; Wed, 9 Aug 2017 09:30:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9EBF628A39 for ; Wed, 9 Aug 2017 09:30:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 92CD728A4C; Wed, 9 Aug 2017 09:30:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4E4F628A39 for ; Wed, 9 Aug 2017 09:30:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/eqpTtbr9mcQClB7CzWSxK5ZULdAyPekrlW7HXVhDxA=; b=EMn8HfnGjI3yxY fxITsiGB4RaCmWywWwPEKYErg4nFGVn6elSK3ZUmGRktCoD3vdXmC6FaWQddcuES8uzZgaYKN5p5d 5YAa+Bwvqvy3WVKeRS3QPG742aDyqCvlQqUKsnix2zlafLwR+Vh/yNc0YJeKm+45wJz81z9Q25fp8 b7zo6qLtcIniKDCnZMhfWSg7b8HxjsIsE/l68gry8veOKJVkEodWH8Lz533N96CGtkMGQfn7sRPV+ RmlChdq7U7YALT7jhm2me6i/R8LRgVZ5BlYDtG0H/lVJfmiXXeR1hI+sKoslUzrlQJxzGFp/gDxsX e5NKzcl7UauPoQEI5KQw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dfNJn-00017x-HB; Wed, 09 Aug 2017 09:30:23 +0000 Received: from [218.249.47.110] (helo=mailgw01.mediatek.com) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dfNIv-0007Mr-2Q; Wed, 09 Aug 2017 09:29:34 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170809_022929_786319_BF921ACB X-CRM114-Status: GOOD ( 11.53 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Stuebner , Viresh Kumar , Sekhar Nori , Kamil Debski , linux-tegra@vger.kernel.org, Thierry Reding , Vivek Gautam , Sylwester Nawrocki , Baoyou Xie , Lee Jones , linux-samsung-soc@vger.kernel.org, Axel Lin , Krzysztof Kozlowski , Jonathan Hunter , Jaehoon Chung , linux-rockchip@lists.infradead.org, Kukjin Kim , Chunfeng Yun , Arnd Bergmann , Bartlomiej Zolnierkiewicz , linux-mediatek@lists.infradead.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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;