Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1822437pxb; Mon, 23 Aug 2021 05:38:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjAhuBWyR0I1GcDqI8CVKSNFWFBxXqmeoFGkVIKuG2Y7l9rSd1CU4P8OwCyStbF/ULVt78 X-Received: by 2002:a05:6e02:1250:: with SMTP id j16mr23061157ilq.215.1629722306721; Mon, 23 Aug 2021 05:38:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629722306; cv=none; d=google.com; s=arc-20160816; b=VjC3LhlnS2ic5hDVN7bJlxVCCtEm3bsY0quQtLvSaUQ/WW8to1gzF82cd8QHryAPkE jRhRsts7iGYFrnwcbA03mp/n8xA6EP6YbTlJji/3zQNpBRd/Xast1H1TqLh63wRU+iKh ZFKOxycZc/BPaRZFkN+Fn5Ter5pAO+/gEcBOigJcNdzii3fPtI0muukF/fIe9UOEJ/NI dSiTJXDHsUTuTzQqtsbTdrA8iF2PSmSy8lF3ssDR8+vPJ895SrX/4oTLw4HlkimHqApY QBFxTk1D+ph+EKegYJA11oblaKP3NxnE0Mzfd/2lEniKnSWvJ6vXc1khy9KizRmy3hH2 ywfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=n/GPVRiVwUIziTQduC6vw9eM2WmWAUZqVAXQjJM8WDY=; b=d9Eaxoh2KT3S0J367bWdb5XyCnlw/YraUTBDaWefhXlrXivVHxHu1mw0ahRPDn8w/h yVa1Uycj0IDo9K9z+l3aEiDY1CZTZfxdlDvKTZrupemx+CV8Y29POZ/BycZkTmJ+Ok6h bXwx1rq0Yoz4vts1XsaJ5UHQ5tBFrWpeZTkbAjsdgoSsqaXqhhknGrS79AFZ/PV/q9pc /4WEC0fYRpyPR2V1JzRVfvbDiuBTm9bpRASLKaYTcN1KsHZ5EJaDiQ9A9/i2/L6ARJJa E0cJlx9C81Bui7CdfayUrTTfyXxj2SRYUlIVl4F3zWkRUC1cdayFbShz429RPe5smUN9 dZWQ== 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 k8si15870752jad.90.2021.08.23.05.38.14; Mon, 23 Aug 2021 05:38:26 -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 S236663AbhHWMiN (ORCPT + 99 others); Mon, 23 Aug 2021 08:38:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235881AbhHWMiM (ORCPT ); Mon, 23 Aug 2021 08:38:12 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57E7DC061575 for ; Mon, 23 Aug 2021 05:37:30 -0700 (PDT) Received: from gallifrey.ext.pengutronix.de ([2001:67c:670:201:5054:ff:fe8d:eefb] helo=bjornoya.blackshift.org) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mI9Cb-0007g8-I4; Mon, 23 Aug 2021 14:37:21 +0200 Received: from pengutronix.de (2a03-f580-87bc-d400-5f1f-6edb-8f7f-ac9e.ip6.dokom21.de [IPv6:2a03:f580:87bc:d400:5f1f:6edb:8f7f:ac9e]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: mkl-all@blackshift.org) by smtp.blackshift.org (Postfix) with ESMTPSA id D09D366D61D; Mon, 23 Aug 2021 12:37:16 +0000 (UTC) Date: Mon, 23 Aug 2021 14:37:15 +0200 From: Marc Kleine-Budde To: Tang Bin Cc: davem@davemloft.net, wg@grandegger.com, kuba@kernel.org, kevinbrace@bracecomputerlab.com, romieu@fr.zoreil.com, linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] can: mscan: mpc5xxx_can: Use of_device_get_match_data to simplify code Message-ID: <20210823123715.j4khoyld5mfl6kdv@pengutronix.de> References: <20210823113338.3568-1-tangbin@cmss.chinamobile.com> <20210823113338.3568-4-tangbin@cmss.chinamobile.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="tzba5ik5srkh4lwi" Content-Disposition: inline In-Reply-To: <20210823113338.3568-4-tangbin@cmss.chinamobile.com> X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: mkl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --tzba5ik5srkh4lwi Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 23.08.2021 19:33:38, Tang Bin wrote: > Retrieve OF match data, it's better and cleaner to use > 'of_device_get_match_data' over 'of_match_device'. >=20 > Signed-off-by: Tang Bin Thanks for the patch! LGTM, comment inside. > --- > drivers/net/can/mscan/mpc5xxx_can.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) >=20 > 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_devi= ce *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 =3D 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 =3D 0; > int err =3D -ENOMEM; > =20 > - match =3D of_match_device(mpc5xxx_can_table, &ofdev->dev); > - if (!match) > + data =3D of_device_get_match_data(&ofdev->dev); > + if (!data) > return -EINVAL; Please remove the "BUG_ON(!data)", which comes later. > - data =3D match->data; > =20 > base =3D of_iomap(np, 0); > if (!base) { > --=20 > 2.20.1.windows.1 >=20 >=20 >=20 >=20 regards, Marc --=20 Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | --tzba5ik5srkh4lwi Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEK3kIWJt9yTYMP3ehqclaivrt76kFAmEjlnkACgkQqclaivrt 76lOCgf+KYF+o99Kg2iOCfI60mHHeBPkPjnzLl7AFALXMjkAiWjh9nL0c3mybPpU XkVqIxlJ1OEXOLdHXNhsguxrPMLrampXYBgLajVcQQH1EWj0p9Ty2bqth6NptZXz hOcKIltTJ04uOwsHcziYt54EsE7RlOcoAN+y1/aQCDd6GF+tC7Vm9g3QwukpLEcT ZvaDPa+CwljvPznAjB77QSfJMPwcl8ggh4Y9wS2aQZkVKbuecgN7PGMIa2NxrlWH g9XyFKWpXa1Gl7+fubXpgCLhcPqK1B8Hstjd3nonh2qJjA0GJYzvdaMvYc2FnWPz O6WExKQvp89qzAGfKhyKL1tyoZdChw== =Dg0F -----END PGP SIGNATURE----- --tzba5ik5srkh4lwi--