From patchwork Thu Oct 26 12:50:27 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: 10028069 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 501186022E for ; Thu, 26 Oct 2017 12:52:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 407C7283C5 for ; Thu, 26 Oct 2017 12:52:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33B6728DCD; Thu, 26 Oct 2017 12:52:05 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham 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 C1AA528D9B for ; Thu, 26 Oct 2017 12:52:04 +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=L4UgahmJZyNVP9+OmInaD3h+giWFsFYWuesQu6qQsv4=; b=BobQsERfanN2aJ 9Ui0o/hYQxaGg01U1UFBROu+aJqDGJDgDEFP2Zx3qBTVY9FKWyykCrjohHlwKaxjSueL8+EFlq+fE TnWvdxTKt7WAMFFilf54xicNP4UCkpTLgd3JKroiFX6rth+ox4bp3TA34Im8igZU5JX6tYmTE+suy Fg6peDg/DFseF4Y36A9k5pgWOqVaNl4FDQTdSg5s/y31MR8MrRwNmWvwIcvlnTS+d1QtOpCHOn45U yhHntLttpIgEjlWDuSrpJqGvrqrXtiN+j8KrclTQhDaAudDyW5tWfVPloOE95rxoisYrgMvk2Bro+ Q95frFCICxMdFnEtnvVw==; 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 1e7hde-0007ge-Hm; Thu, 26 Oct 2017 12:51:58 +0000 Received: from [210.61.82.183] (helo=mailgw01.mediatek.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e7hcs-0006jU-Lv; Thu, 26 Oct 2017 12:51:14 +0000 X-UUID: ebf915ef1f5543e5bd3c49da636c6552-20171026 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 297660565; Thu, 26 Oct 2017 20:50:41 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Thu, 26 Oct 2017 20:50:40 +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; Thu, 26 Oct 2017 20:50:39 +0800 From: Chunfeng Yun To: Kishon Vijay Abraham I Subject: [PATCH 2/3] phy: phy-mtk-tphy: use of_device_get_match_data() Date: Thu, 26 Oct 2017 20:50:27 +0800 Message-ID: <0c63a4f0c8c20ceaba2e5173993b7ca69671f852.1509022150.git.chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171026_055110_979477_2DAE3E3F X-CRM114-Status: GOOD ( 12.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ryder Lee , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Chunfeng Yun , linux-mediatek@lists.infradead.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=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/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 54cc44b..cdd33bf 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);