Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1779522pxb; Mon, 23 Aug 2021 04:35:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfGsur4wIsER82XzBIiyuHiMoAO5Y3TMgGxuM8QXEvBvEQ9OqSJSLLY3quINdhek2N6Fnl X-Received: by 2002:a5d:974f:: with SMTP id c15mr25255566ioo.190.1629718510609; Mon, 23 Aug 2021 04:35:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629718510; cv=none; d=google.com; s=arc-20160816; b=A1rpQu9+Jl9pHCcxTQ5CLBzQqlvbCiZ0eE6spz6gZO9MwjaCGc9REPdRZrdi95L0K+ lw4brEHwAl0Z5fvHwDsbJ7ykpZOux28fI1wRzRRKkPEQD2GOPFeaBQ20i4NYEm0HNfWc XTqxRH+POlZsLlxKP4lcrGX3Ghll2GNBCrbnjKqwjQrTsYftxUICeiCy2HdpVcO3PaFc ZRCapuFKpwoXdPvHY47mCIb9Sf5zo2emxW0QHYsYlHmVnZRH/+9rs5rCWmYTNpkHURb9 b1mCTIVMGbbE6/Liklp9VpZlIj2k5LlNzlKTsv+KK2DE9y6OlJOLo9wqXHBjgGLu8eRx +wHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=YxmO4TdB9mn+fBmkmgvqRDcFpP4IiCnc3Iygq4hA2GY=; b=VzQJwkEGgZbh+annZLQPyzjCL7um2waDWA7F9elMtH6YhlnxCwLOmO58d4t/b1JKVq 4yV2ZsnEnBKkT3dXPL3lEaULNzwbyZi42HtzrH00ezKYtrKTpZVyzDWoEwGZizi4Iy/Y cyNVI47ouGwnUi7T/xX+W1FVI0/8ucgfJHft979yBv/CZR9p03KmGw0mDcIDt1m/zRdy jBes6vdiv5ur9MAO7SLohTv25wpmwV3o3DgcqPMGTIbkUBYPe1jTTTvQ9n65vxZRdDDa 6XXWcQqCB5HOsSatjy7WXXLqlb7IsHpP+X3LJ4o8+3jdecCnmtVua6Rc2pP6XrJxrnd0 SzHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 11si14443545ilq.55.2021.08.23.04.34.59; Mon, 23 Aug 2021 04:35:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236623AbhHWLeE (ORCPT + 99 others); Mon, 23 Aug 2021 07:34:04 -0400 Received: from cmccmta1.chinamobile.com ([221.176.66.79]:44190 "EHLO cmccmta1.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236520AbhHWLeB (ORCPT ); Mon, 23 Aug 2021 07:34:01 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.3]) by rmmx-syy-dmz-app01-12001 (RichMail) with SMTP id 2ee16123876fd13-04795; Mon, 23 Aug 2021 19:33:05 +0800 (CST) X-RM-TRANSID: 2ee16123876fd13-04795 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from localhost.localdomain (unknown[223.112.105.130]) by rmsmtp-syy-appsvr02-12002 (RichMail) with SMTP id 2ee261238767421-c70da; Mon, 23 Aug 2021 19:33:05 +0800 (CST) X-RM-TRANSID: 2ee261238767421-c70da From: Tang Bin To: davem@davemloft.net, wg@grandegger.com, mkl@pengutronix.de, kuba@kernel.org, kevinbrace@bracecomputerlab.com, romieu@fr.zoreil.com Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Tang Bin Subject: [PATCH 3/3] can: mscan: mpc5xxx_can: Use of_device_get_match_data to simplify code Date: Mon, 23 Aug 2021 19:33:38 +0800 Message-Id: <20210823113338.3568-4-tangbin@cmss.chinamobile.com> X-Mailer: git-send-email 2.20.1.windows.1 In-Reply-To: <20210823113338.3568-1-tangbin@cmss.chinamobile.com> References: <20210823113338.3568-1-tangbin@cmss.chinamobile.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Retrieve OF match data, it's better and cleaner to use 'of_device_get_match_data' over 'of_match_device'. Signed-off-by: Tang Bin --- drivers/net/can/mscan/mpc5xxx_can.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c index e254e04ae..3b7465acd 100644 --- a/drivers/net/can/mscan/mpc5xxx_can.c +++ b/drivers/net/can/mscan/mpc5xxx_can.c @@ -279,7 +279,6 @@ static u32 mpc512x_can_get_clock(struct platform_device *ofdev, static const struct of_device_id mpc5xxx_can_table[]; static int mpc5xxx_can_probe(struct platform_device *ofdev) { - const struct of_device_id *match; const struct mpc5xxx_can_data *data; struct device_node *np = ofdev->dev.of_node; struct net_device *dev; @@ -289,10 +288,9 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev) int irq, mscan_clksrc = 0; int err = -ENOMEM; - match = of_match_device(mpc5xxx_can_table, &ofdev->dev); - if (!match) + data = of_device_get_match_data(&ofdev->dev); + if (!data) return -EINVAL; - data = match->data; base = of_iomap(np, 0); if (!base) { -- 2.20.1.windows.1