Received: by 10.192.165.156 with SMTP id m28csp152709imm; Sun, 15 Apr 2018 19:35:00 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/cWPOiXwnNbJ3E/jBhyAR6ULc4cssto1tyNO7kNJ9I5+a+MV+HQTIrRTK3yQpZwoaYG9zb X-Received: by 10.167.129.10 with SMTP id b10mr20089867pfi.186.1523846099968; Sun, 15 Apr 2018 19:34:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523846099; cv=none; d=google.com; s=arc-20160816; b=tqAzeCXzPwuqhdhDE0ami5LDAS+NMgXvJs+jNce37aG2WP+ToPXgRaym4AzpVVyQBk 0ZSghTTVBII21IAEu3lZcB0EZtKqWtGtYccIwRLW/wxHD/2Sv2V3Lazjo9M60vRm+mOZ UAxiAEkNGiTmHk8wstQuFcEqB9AFJ6V8kRcKm/iBVOiJODnuzffZDpoOabauT90aZ8Au xZWgktX0KPBe6aUGwZLdrx54Jvy2lPNcW0ceNvNP5RMmxszyVuCDJvP6I+vZ1YHNnbs3 voi+un13J6QxLlQ/rIe0gSpQ3QrIsFxPwXvFs4OKkf2qiWihbL6kQrN8X3EFS9fBee+I /OJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=+2Et/KXtieiWbErm1ZkVPO15OrxOJxFk8VvNd/HFw48=; b=DO4amsLGkmx/ZkA77ZDtduQW+aAEhqKKhLMU9ADVMEfRS4WOuUjjP+UpUZec+ANYf5 SPfqjVMvez2NYE/KRqMlmXX2yRdqOQMoatr3MAdImbOnRnStD3YBEGyLMO8TIa6bvsBr OVcvSoPHG68J/5ER/+t+zXaAzQiMZ8uKlSHfB+1E5qYp27Dlk6NpyYqGja5Ws9TTIK6e dQcdyBeae566izhRE9Fgq3tGSYJ0BBKyUkPMz3+DppzrtPU9DFOzm+okAS8dukC3aUy1 w/Z4cf+JEmjDG2ZXVTcSF+6SyQic4May3745hJuCZSdw4bW30qa29gdLpkkcxn0Pt9oy uCRw== 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 a90si3682305pfg.266.2018.04.15.19.34.46; Sun, 15 Apr 2018 19:34:59 -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 S1753084AbeDPCdB (ORCPT + 99 others); Sun, 15 Apr 2018 22:33:01 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:7448 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751774AbeDPCdA (ORCPT ); Sun, 15 Apr 2018 22:33:00 -0400 X-UUID: 67316a4ddc064d1bb3612b02b363bce5-20180416 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 932315890; Mon, 16 Apr 2018 10:32:55 +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:32:54 +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:32:54 +0800 From: Ryder Lee To: Wolfram Sang CC: Jun Gao , , , , , Ryder Lee Subject: [PATCH] i2c: mediatek: use of_device_get_match_data() Date: Mon, 16 Apr 2018 10:32:52 +0800 Message-ID: <31f944ab8dfcc1d7b6f03b35657a2a34825b5246.1523347340.git.ryder.lee@mediatek.com> X-Mailer: git-send-email 1.9.1 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 mtk_i2c_probe() is to match an entry in mtk_i2c_of_match[], so of_id cannot be NULL. Signed-off-by: Ryder Lee --- drivers/i2c/busses/i2c-mt65xx.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c index cf23a74..1e57f58 100644 --- a/drivers/i2c/busses/i2c-mt65xx.c +++ b/drivers/i2c/busses/i2c-mt65xx.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -734,7 +735,6 @@ static int mtk_i2c_parse_dt(struct device_node *np, struct mtk_i2c *i2c) static int mtk_i2c_probe(struct platform_device *pdev) { - const struct of_device_id *of_id; int ret = 0; struct mtk_i2c *i2c; struct clk *clk; @@ -761,11 +761,7 @@ static int mtk_i2c_probe(struct platform_device *pdev) init_completion(&i2c->msg_complete); - of_id = of_match_node(mtk_i2c_of_match, pdev->dev.of_node); - if (!of_id) - return -EINVAL; - - i2c->dev_comp = of_id->data; + i2c->dev_comp = of_device_get_match_data(&pdev->dev); i2c->adap.dev.of_node = pdev->dev.of_node; i2c->dev = &pdev->dev; i2c->adap.dev.parent = &pdev->dev; -- 1.9.1