Received: by 10.192.165.156 with SMTP id m28csp153178imm; Sun, 15 Apr 2018 19:35:50 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/wudCz3FkFpgRFUJ63RlaLab56KZvxWZ3Dz54oWcPjw+oB4js0Mo6gw1YcevICv/1L+bPd X-Received: by 10.167.130.76 with SMTP id e12mr19954958pfn.192.1523846150133; Sun, 15 Apr 2018 19:35:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523846150; cv=none; d=google.com; s=arc-20160816; b=LRAZ8iBNVt7QkSyuJexL8byJvVosZsxMxkKRsQ31AMQmfUKDZqdco+V/fW0TVcXHTQ qJUK4CYuyeQNarcdqp2LA3MTJzgH0lWLvIerwpkS8TZkwHT6q4yybkFhCHmfzns3UFuP wJ9YNIq7P0DlQU8lgmYb5dM7Mt9APYwH+us2D58+bzDzARt7e0YY1swSz9P7kU6UDB5X 8xPoj6oTcD8a4p2VAefz5lDk3UQopxdPBiJO3UfTxKg2veoJMLt0dErckINz9ZQpUY6W 4+uN60C+bue3notTLNDNsP96ccFOkbcYrW1zG0TILS6T3L42qGLtRU+Le7k9fDPj8wb9 2/cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=D+diJv7ThOgEYh4zcH3JtBVPk+Z/kdfxmAuqMQeXjis=; b=jzRzi5rdsPv82ucVG3Egcv0IA0P2fV3QyBwie6rMWW+y1elOdaUM933+2PeJYPFNzU rRTJMlxLG2I7SeaRh48av2bF+PMYxbB47SLO0QL1aVD/NFvDyWmSZWf9K2Q3yivu9ijM Cnw1Yw+RdBY+QPsm/kOsZ5Q/YJMyk+aZM2VK0A7MYZNKcHc6sQAnIfJaahg2lpMEzMyb geYUNy70Xb4d1kDodGzq1m/O8v8IwKCrbWWhPdsVAreSgsm56WqHFOr+i4dGECEnat9I b+mJH9kIYM+t8A8eULuKD+ujtZjWX9QgIzHt6xZfIv90Xszi+S+T6H5ZmZ83x8J4btJS ru7A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s3si482661pfg.175.2018.04.15.19.35.36; Sun, 15 Apr 2018 19:35:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752944AbeDPCdk (ORCPT + 99 others); Sun, 15 Apr 2018 22:33:40 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:61803 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752552AbeDPCdj (ORCPT ); Sun, 15 Apr 2018 22:33:39 -0400 X-UUID: 61a5ec34f1c548c3b2104c1059753a84-20180416 Received: from mtkcas09.mediatek.inc [(172.21.101.178)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1370093933; Mon, 16 Apr 2018 10:33:37 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Mon, 16 Apr 2018 10:33:35 +0800 Received: from mtkslt306.mediatek.inc (10.21.14.136) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Mon, 16 Apr 2018 10:33:35 +0800 From: Ryder Lee To: Matthias Brugger CC: , , , Ryder Lee Subject: [PATCH] soc: mediatek: use of_device_get_match_data() Date: Mon, 16 Apr 2018 10:33:34 +0800 Message-ID: X-Mailer: git-send-email 1.9.1 In-Reply-To: <31f944ab8dfcc1d7b6f03b35657a2a34825b5246.1523347340.git.ryder.lee@mediatek.com> References: <31f944ab8dfcc1d7b6f03b35657a2a34825b5246.1523347340.git.ryder.lee@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The usage of of_device_get_match_data() reduce the code size a bit. Also, the only way to call pwrap_probe() is to match an entry in of_pwrap_match_tbl[], so of_id cannot be NULL. Signed-off-by: Ryder Lee --- drivers/soc/mediatek/mtk-pmic-wrap.c | 13 +++---------- drivers/soc/mediatek/mtk-scpsys.c | 4 +--- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c index e9e054a..2afae64 100644 --- a/drivers/soc/mediatek/mtk-pmic-wrap.c +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c @@ -1458,19 +1458,12 @@ static int pwrap_probe(struct platform_device *pdev) int ret, irq; struct pmic_wrapper *wrp; struct device_node *np = pdev->dev.of_node; - const struct of_device_id *of_id = - of_match_device(of_pwrap_match_tbl, &pdev->dev); const struct of_device_id *of_slave_id = NULL; struct resource *res; - if (!of_id) { - dev_err(&pdev->dev, "Error: No device match found\n"); - return -ENODEV; - } + if (np->child) + of_slave_id = of_match_node(of_slave_match_tbl, np->child); - if (pdev->dev.of_node->child) - of_slave_id = of_match_node(of_slave_match_tbl, - pdev->dev.of_node->child); if (!of_slave_id) { dev_dbg(&pdev->dev, "slave pmic should be defined in dts\n"); return -EINVAL; @@ -1482,7 +1475,7 @@ static int pwrap_probe(struct platform_device *pdev) platform_set_drvdata(pdev, wrp); - wrp->master = of_id->data; + wrp->master = of_device_get_match_data(&pdev->dev); wrp->slave = of_slave_id->data; wrp->dev = &pdev->dev; diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c index 435ce5e..a02a18e 100644 --- a/drivers/soc/mediatek/mtk-scpsys.c +++ b/drivers/soc/mediatek/mtk-scpsys.c @@ -973,15 +973,13 @@ static void mtk_register_power_domains(struct platform_device *pdev, static int scpsys_probe(struct platform_device *pdev) { - const struct of_device_id *match; const struct scp_subdomain *sd; const struct scp_soc_data *soc; struct scp *scp; struct genpd_onecell_data *pd_data; int i, ret; - match = of_match_device(of_scpsys_match_tbl, &pdev->dev); - soc = (const struct scp_soc_data *)match->data; + soc = of_device_get_match_data(&pdev->dev); scp = init_scp(pdev, soc->domains, soc->num_domains, &soc->regs, soc->bus_prot_reg_update); -- 1.9.1