From nobody Fri Jan 2 17:24:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FB1BCD6115 for ; Mon, 9 Oct 2023 17:31:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377905AbjJIRbt (ORCPT ); Mon, 9 Oct 2023 13:31:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377880AbjJIRbr (ORCPT ); Mon, 9 Oct 2023 13:31:47 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEB419E; Mon, 9 Oct 2023 10:31:45 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23FB0C433C8; Mon, 9 Oct 2023 17:31:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696872705; bh=OhjQeQRnExrpooqKh3gh9c6wU+rd8LzpqzmrgKzmc1o=; h=From:To:Cc:Subject:Date:From; b=kKZXKZ6G5xb7CpuYYHYWBpSUVmVlufI1wRkUJBTC7MaTrnX9pu4RW64/9fhopzTyU N/kqKCVUtoospBJ9FMM3D4arIyg6JcahLl+0PiJQ2JPJhA6eKVUf0o6X8dC21t+zbM 1Na/83qcJeyJvDxGYHgl0K86pmV8qxGHn89x1kwIRp5thPEBueG8dGKVGIH66LO+uR mRKR10lUSWIEJ/7WhjQDx3VSvFvSpGIo0vvhOB/vT9UAEf6BLqVEELVVb+xUDuWdR8 Pc5FM+8A5D2Ov9o751mQme1EzDwf3CpIt4UqhAeNtzMm8SexP38NZOTdaHVDgcKFdS SnMK4KehDfC8w== Received: (nullmailer pid 2511395 invoked by uid 1000); Mon, 09 Oct 2023 17:31:43 -0000 From: Rob Herring To: Wolfgang Grandegger , Marc Kleine-Budde , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Appana Durga Kedareswara rao , Naga Sureshkumar Relli , Michal Simek Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH net-next] net: can: Use device_get_match_data() Date: Mon, 9 Oct 2023 12:29:02 -0500 Message-ID: <20231009172923.2457844-7-robh@kernel.org> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use preferred device_get_match_data() instead of of_match_device() to get the driver match data. With this, adjust the includes to explicitly include the correct headers. Signed-off-by: Rob Herring --- drivers/net/can/c_can/c_can_platform.c | 9 +++------ drivers/net/can/flexcan/flexcan-core.c | 9 +++------ drivers/net/can/mscan/mpc5xxx_can.c | 8 ++++---- drivers/net/can/xilinx_can.c | 7 ++----- 4 files changed, 12 insertions(+), 21 deletions(-) diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can= /c_can_platform.c index f44ba2600415..caa781018b09 100644 --- a/drivers/net/can/c_can/c_can_platform.c +++ b/drivers/net/can/c_can/c_can_platform.c @@ -30,9 +30,9 @@ #include #include #include +#include #include #include -#include #include #include =20 @@ -259,17 +259,14 @@ static int c_can_plat_probe(struct platform_device *p= dev) void __iomem *addr; struct net_device *dev; struct c_can_priv *priv; - const struct of_device_id *match; struct resource *mem; int irq; struct clk *clk; const struct c_can_driver_data *drvdata; struct device_node *np =3D pdev->dev.of_node; =20 - match =3D of_match_device(c_can_of_table, &pdev->dev); - if (match) { - drvdata =3D match->data; - } else if (pdev->id_entry->driver_data) { + drvdata =3D device_get_match_data(&pdev->dev); + if (!drvdata && pdev->id_entry->driver_data) { drvdata =3D (struct c_can_driver_data *) platform_get_device_id(pdev)->driver_data; } else { diff --git a/drivers/net/can/flexcan/flexcan-core.c b/drivers/net/can/flexc= an/flexcan-core.c index add39e922b89..b9dd9597fc97 100644 --- a/drivers/net/can/flexcan/flexcan-core.c +++ b/drivers/net/can/flexcan/flexcan-core.c @@ -23,11 +23,11 @@ #include #include #include -#include #include #include #include #include +#include #include #include =20 @@ -2040,7 +2040,6 @@ MODULE_DEVICE_TABLE(platform, flexcan_id_table); =20 static int flexcan_probe(struct platform_device *pdev) { - const struct of_device_id *of_id; const struct flexcan_devtype_data *devtype_data; struct net_device *dev; struct flexcan_priv *priv; @@ -2096,10 +2095,8 @@ static int flexcan_probe(struct platform_device *pde= v) if (IS_ERR(regs)) return PTR_ERR(regs); =20 - of_id =3D of_match_device(flexcan_of_match, &pdev->dev); - if (of_id) - devtype_data =3D of_id->data; - else if (platform_get_device_id(pdev)->driver_data) + devtype_data =3D device_get_match_data(&pdev->dev); + if (!devtype_data && pdev->id_entry->driver_data) devtype_data =3D (struct flexcan_devtype_data *) platform_get_device_id(pdev)->driver_data; else diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mp= c5xxx_can.c index 4837df6efa92..5b3d69c3b6b6 100644 --- a/drivers/net/can/mscan/mpc5xxx_can.c +++ b/drivers/net/can/mscan/mpc5xxx_can.c @@ -12,8 +12,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -290,7 +292,7 @@ static int mpc5xxx_can_probe(struct platform_device *of= dev) int irq, mscan_clksrc =3D 0; int err =3D -ENOMEM; =20 - data =3D of_device_get_match_data(&ofdev->dev); + data =3D device_get_match_data(&ofdev->dev); if (!data) return -EINVAL; =20 @@ -351,13 +353,11 @@ static int mpc5xxx_can_probe(struct platform_device *= ofdev) =20 static void mpc5xxx_can_remove(struct platform_device *ofdev) { - const struct of_device_id *match; const struct mpc5xxx_can_data *data; struct net_device *dev =3D platform_get_drvdata(ofdev); struct mscan_priv *priv =3D netdev_priv(dev); =20 - match =3D of_match_device(mpc5xxx_can_table, &ofdev->dev); - data =3D match ? match->data : NULL; + data =3D device_get_match_data(&ofdev->dev); =20 unregister_mscandev(dev); if (data && data->put_clock) diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c index abe58f103043..f17fd43d03c0 100644 --- a/drivers/net/can/xilinx_can.c +++ b/drivers/net/can/xilinx_can.c @@ -20,8 +20,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -1726,7 +1726,6 @@ static int xcan_probe(struct platform_device *pdev) struct net_device *ndev; struct xcan_priv *priv; struct phy *transceiver; - const struct of_device_id *of_id; const struct xcan_devtype_data *devtype =3D &xcan_axi_data; void __iomem *addr; int ret; @@ -1741,9 +1740,7 @@ static int xcan_probe(struct platform_device *pdev) goto err; } =20 - of_id =3D of_match_device(xcan_of_match, &pdev->dev); - if (of_id && of_id->data) - devtype =3D of_id->data; + devtype =3D device_get_match_data(&pdev->dev); =20 hw_tx_max_property =3D devtype->flags & XCAN_FLAG_TX_MAILBOXES ? "tx-mailbox-count" : "tx-fifo-depth"; --=20 2.42.0