From nobody Fri Jan 2 22:22:27 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 7D836E94139 for ; Fri, 6 Oct 2023 22:44:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233779AbjJFWoJ (ORCPT ); Fri, 6 Oct 2023 18:44:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233726AbjJFWoH (ORCPT ); Fri, 6 Oct 2023 18:44:07 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC9C3A2 for ; Fri, 6 Oct 2023 15:44:06 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 840CEC433C8; Fri, 6 Oct 2023 22:44:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696632246; bh=dnirAMJtell24Xii/tGE5TPebFmYLUGZvNx2LSkG0CE=; h=From:To:Cc:Subject:Date:From; b=L1shalJmrPTSFqzG8WwKnc2FFJ5EbudW62Hyu9km14/lsK/LDkhVfPgd/iObyRi7C pcxIGgNp4xeJyeSC4SWg6Ii94FsPueKK5AStZqHXan4NuMWU3IOJFroY0kM9RpvLnL +VrYLSJskkPXsGq2HBEBvRkba9nRwWoCA5AAU3RKwhGzMTwWzWqk8UM+aruNjSO5zA hLV1orJTpKHq+IDn8DpZBSnZvb50hDG54NFnTgYMdvmkemMyk2f5bLmp42/WvZvzP8 mW+G1oeZX6yK8QTNOPOspnLBuYNvbWx8E0H816749AwlJKTveATWaWqsKKQ46YINj5 lr39oKS6BPTyw== Received: (nullmailer pid 442177 invoked by uid 1000); Fri, 06 Oct 2023 22:44:04 -0000 From: Rob Herring To: Krzysztof Kozlowski , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Florian Fainelli , Broadcom internal kernel review list Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] memory: Use device_get_match_data() Date: Fri, 6 Oct 2023 17:44:01 -0500 Message-Id: <20231006224402.442078-1-robh@kernel.org> X-Mailer: git-send-email 2.40.1 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 Reviewed-by: Florian Fainelli --- drivers/memory/atmel-ebi.c | 14 +++++++------- drivers/memory/brcmstb_memc.c | 9 +++------ drivers/memory/fsl-corenet-cf.c | 11 ++--------- 3 files changed, 12 insertions(+), 22 deletions(-) diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c index ec6100bc94c5..e8bb5f37f5cb 100644 --- a/drivers/memory/atmel-ebi.c +++ b/drivers/memory/atmel-ebi.c @@ -12,7 +12,10 @@ #include #include #include -#include +#include +#include +#include +#include #include #include =20 @@ -515,16 +518,11 @@ static int atmel_ebi_probe(struct platform_device *pd= ev) { struct device *dev =3D &pdev->dev; struct device_node *child, *np =3D dev->of_node, *smc_np; - const struct of_device_id *match; struct atmel_ebi *ebi; int ret, reg_cells; struct clk *clk; u32 val; =20 - match =3D of_match_device(atmel_ebi_id_table, dev); - if (!match || !match->data) - return -EINVAL; - ebi =3D devm_kzalloc(dev, sizeof(*ebi), GFP_KERNEL); if (!ebi) return -ENOMEM; @@ -532,7 +530,9 @@ static int atmel_ebi_probe(struct platform_device *pdev) platform_set_drvdata(pdev, ebi); =20 INIT_LIST_HEAD(&ebi->devs); - ebi->caps =3D match->data; + ebi->caps =3D device_get_match_data(dev); + if (!ebi->caps) + return -EINVAL; ebi->dev =3D dev; =20 clk =3D devm_clk_get(dev, NULL); diff --git a/drivers/memory/brcmstb_memc.c b/drivers/memory/brcmstb_memc.c index 233a53f5bce1..a6ea51996522 100644 --- a/drivers/memory/brcmstb_memc.c +++ b/drivers/memory/brcmstb_memc.c @@ -8,8 +8,9 @@ #include #include #include -#include +#include #include +#include =20 #define REG_MEMC_CNTRLR_CONFIG 0x00 #define CNTRLR_CONFIG_LPDDR4_SHIFT 5 @@ -121,12 +122,9 @@ static struct attribute_group dev_attr_group =3D { .attrs =3D dev_attrs, }; =20 -static const struct of_device_id brcmstb_memc_of_match[]; - static int brcmstb_memc_probe(struct platform_device *pdev) { const struct brcmstb_memc_data *memc_data; - const struct of_device_id *of_id; struct device *dev =3D &pdev->dev; struct brcmstb_memc *memc; int ret; @@ -137,8 +135,7 @@ static int brcmstb_memc_probe(struct platform_device *p= dev) =20 dev_set_drvdata(dev, memc); =20 - of_id =3D of_match_device(brcmstb_memc_of_match, dev); - memc_data =3D of_id->data; + memc_data =3D device_get_match_data(dev); memc->srpd_offset =3D memc_data->srpd_offset; =20 memc->ddr_ctrl =3D devm_platform_ioremap_resource(pdev, 0); diff --git a/drivers/memory/fsl-corenet-cf.c b/drivers/memory/fsl-corenet-c= f.c index 7fc9f57ae278..8096c4f33303 100644 --- a/drivers/memory/fsl-corenet-cf.c +++ b/drivers/memory/fsl-corenet-cf.c @@ -10,10 +10,8 @@ #include #include #include -#include -#include -#include #include +#include =20 enum ccf_version { CCF1, @@ -172,14 +170,9 @@ static irqreturn_t ccf_irq(int irq, void *dev_id) static int ccf_probe(struct platform_device *pdev) { struct ccf_private *ccf; - const struct of_device_id *match; u32 errinten; int ret, irq; =20 - match =3D of_match_device(ccf_matches, &pdev->dev); - if (WARN_ON(!match)) - return -ENODEV; - ccf =3D devm_kzalloc(&pdev->dev, sizeof(*ccf), GFP_KERNEL); if (!ccf) return -ENOMEM; @@ -189,7 +182,7 @@ static int ccf_probe(struct platform_device *pdev) return PTR_ERR(ccf->regs); =20 ccf->dev =3D &pdev->dev; - ccf->info =3D match->data; + ccf->info =3D device_get_match_data(&pdev->dev); ccf->err_regs =3D ccf->regs + ccf->info->err_reg_offs; =20 if (ccf->info->has_brr) { --=20 2.40.1