From patchwork Wed Nov 15 21:01:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 13457365 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0A407C072A2 for ; Wed, 15 Nov 2023 21:02:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=sD6FzOrF3FKmMN6xtufISbVNk8nr2nn0M5JO9cadinQ=; b=MO0zxyqm1iYkMN EcuhacP6/iEhd+65ycmn9nKK8IUipjCSXQF3oM4fGZF9IKIJqLksaEm0OKMxxM5J7+0ALag34jEaj Jqrvbk1hRthfr5qm4dBOdnai93aQyZP2vT2y46LlPwvJ8o12sRhFqXOv4xCBPvAcVURldX6nvwU7a djFKGjU4n1++4e4fLpMu/pwM47aYR/Da+P/vwuF/Hf1ipKbfZAbi64UlBVd1A0ve/SAttAdYZ9q2G 2zl9W0kUbbbVd6lWLL53CD/viqJuiYwoMT3i1pZvh3YFyIbjx5ej1v2FoGbhzD3bU6+yD1NCafDj7 ud/6HNjJR5+bS7wwlLew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r3N11-001j74-0r; Wed, 15 Nov 2023 21:01:39 +0000 Received: from mail-oo1-f43.google.com ([209.85.161.43]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r3N0y-001j4q-00 for linux-arm-kernel@lists.infradead.org; Wed, 15 Nov 2023 21:01:37 +0000 Received: by mail-oo1-f43.google.com with SMTP id 006d021491bc7-589d412e8aeso53637eaf.3 for ; Wed, 15 Nov 2023 13:01:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700082094; x=1700686894; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Duhiu363zZXggZ2tT9xIehHJIKV7YXtPT/E+W7lu59o=; b=af70l7afsrt5erTINLlh3m2HjUz40beLpK6fhpGcCcoc1hXYcw7vM1p2gQJxu55wP0 +aSznfevrNsBzQir0KnPqU+x4u7mnj7+9ZJvVixbv9gNGXhYPG7+b5J1pJMkalj5Y12z O7cxAdpI/PPa4/rqJwCTyDTLmwyH+hSqThbUJnNfiyhxhU8EIaAj0rdycGgqPSwlPaWo RHFD9HpHg7m9QLRVr8uFuYeO0u49peKiGVyF27pBt8vXO8eA1dj+0GVVOd0hYp1nFIs9 QrPZoOMI4bQvw+pDIO8BoGAuwa/LP1WQ/6YVLZZDkrkxr6lQzf8Nceiy1JbJSNbj2RVW p6ow== X-Gm-Message-State: AOJu0YxQovA7YGfeTUfbD+VJF8WwzP3rZPlisFFyFHGsB2cRPn3mbCnB LeiMYztsuKJqiOBK94OSjw== X-Google-Smtp-Source: AGHT+IFPPnhO39v8qSE2EKT/HxIVWh6OStRmuQ0hHy6sDMZSxY8Jttc7oJW7BQ2s36jYm/8+/W5SXQ== X-Received: by 2002:a4a:3457:0:b0:56c:d297:164c with SMTP id n23-20020a4a3457000000b0056cd297164cmr13317917oof.4.1700082094065; Wed, 15 Nov 2023 13:01:34 -0800 (PST) Received: from herring.priv (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id 123-20020a4a0081000000b00584078d1e17sm826254ooh.45.2023.11.15.13.01.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 13:01:33 -0800 (PST) Received: (nullmailer pid 3740022 invoked by uid 1000); Wed, 15 Nov 2023 21:01:32 -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: [RESEND PATCH] net: can: Use device_get_match_data() Date: Wed, 15 Nov 2023 15:01:28 -0600 Message-ID: <20231115210129.3739377-1-robh@kernel.org> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231115_130136_037056_B7BE78B3 X-CRM114-Status: GOOD ( 16.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 @@ -259,17 +259,14 @@ static int c_can_plat_probe(struct platform_device *pdev) 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 = pdev->dev.of_node; - match = of_match_device(c_can_of_table, &pdev->dev); - if (match) { - drvdata = match->data; - } else if (pdev->id_entry->driver_data) { + drvdata = device_get_match_data(&pdev->dev); + if (!drvdata && pdev->id_entry->driver_data) { drvdata = (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/flexcan/flexcan-core.c index d15f85a40c1e..19ea7ebc04ab 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 @@ -2034,7 +2034,6 @@ MODULE_DEVICE_TABLE(platform, flexcan_id_table); 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; @@ -2090,10 +2089,8 @@ static int flexcan_probe(struct platform_device *pdev) if (IS_ERR(regs)) return PTR_ERR(regs); - of_id = of_match_device(flexcan_of_match, &pdev->dev); - if (of_id) - devtype_data = of_id->data; - else if (platform_get_device_id(pdev)->driver_data) + devtype_data = device_get_match_data(&pdev->dev); + if (!devtype_data && pdev->id_entry->driver_data) devtype_data = (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/mpc5xxx_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 *ofdev) int irq, mscan_clksrc = 0; int err = -ENOMEM; - data = of_device_get_match_data(&ofdev->dev); + data = device_get_match_data(&ofdev->dev); if (!data) return -EINVAL; @@ -351,13 +353,11 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev) 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 = platform_get_drvdata(ofdev); struct mscan_priv *priv = netdev_priv(dev); - match = of_match_device(mpc5xxx_can_table, &ofdev->dev); - data = match ? match->data : NULL; + data = device_get_match_data(&ofdev->dev); 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 = &xcan_axi_data; void __iomem *addr; int ret; @@ -1741,9 +1740,7 @@ static int xcan_probe(struct platform_device *pdev) goto err; } - of_id = of_match_device(xcan_of_match, &pdev->dev); - if (of_id && of_id->data) - devtype = of_id->data; + devtype = device_get_match_data(&pdev->dev); hw_tx_max_property = devtype->flags & XCAN_FLAG_TX_MAILBOXES ? "tx-mailbox-count" : "tx-fifo-depth";