From nobody Fri Jan 2 17:24:06 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 38832CD6115 for ; Mon, 9 Oct 2023 17:30:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377403AbjJIRaZ (ORCPT ); Mon, 9 Oct 2023 13:30:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377524AbjJIRaU (ORCPT ); Mon, 9 Oct 2023 13:30:20 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0032A3 for ; Mon, 9 Oct 2023 10:30:18 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7D75C433C8; Mon, 9 Oct 2023 17:30:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696872618; bh=sx1WoOjHaMFdTQ94kKpqfTIrZkWzcWgNOPYR3IAiEnA=; h=From:To:Cc:Subject:Date:From; b=Erz4h7PnwGdYsKPPDmpKjzmwgGq/yPUJJag64Hhs/bUOEcgTxiXmDSbq+fA/JmaNA gvkkYTsvOE6uoY+QT1L37QqfzSeXuQZqGoqO61cPxYgiu71sdA9GpFkNw5Vb8Hs2Az YDB5bLjFu4C5OwC4UuJYg/lpw7IW5lPdZbnUTJIGkFaFJ9hHN/CdiSxz8R4+Rfy0J9 TDrBeKfgo4mXCw44hz/4yIyO8BNYZrQ79CGH2WI6n8FSWBL1oSIT7QiMCPKElYWsck EJaaOqVSzBNIW+dPfMkep+MB4n05HuNCF2dJKVbYH9xixhkmPNCHPKiN+XWIEDON5D pglJS28VkhafA== Received: (nullmailer pid 2480196 invoked by uid 1000); Mon, 09 Oct 2023 17:30:16 -0000 From: Rob Herring To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Stefan Agner Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] mtd: Use device_get_match_data() Date: Mon, 9 Oct 2023 12:28:56 -0500 Message-ID: <20231009172923.2457844-1-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/mtd/maps/physmap-core.c | 10 +++------- drivers/mtd/nand/raw/cadence-nand-controller.c | 12 +++++------- drivers/mtd/nand/raw/vf610_nfc.c | 10 ++++------ 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/drivers/mtd/maps/physmap-core.c b/drivers/mtd/maps/physmap-cor= e.c index fc8721339282..c99db9c6d25a 100644 --- a/drivers/mtd/maps/physmap-core.c +++ b/drivers/mtd/maps/physmap-core.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -37,7 +38,7 @@ #include #include #include -#include +#include #include #include =20 @@ -296,14 +297,9 @@ static const char * const *of_get_part_probes(struct p= latform_device *dev) static const char *of_select_probe_type(struct platform_device *dev) { struct device_node *dp =3D dev->dev.of_node; - const struct of_device_id *match; const char *probe_type; =20 - match =3D of_match_device(of_flash_match, &dev->dev); - if (!match) - return NULL; - - probe_type =3D match->data; + probe_type =3D device_get_match_data(&dev->dev); if (probe_type) return probe_type; =20 diff --git a/drivers/mtd/nand/raw/cadence-nand-controller.c b/drivers/mtd/n= and/raw/cadence-nand-controller.c index 034ec564c2ed..f19bf06e9e05 100644 --- a/drivers/mtd/nand/raw/cadence-nand-controller.c +++ b/drivers/mtd/nand/raw/cadence-nand-controller.c @@ -15,8 +15,10 @@ #include #include #include -#include #include +#include +#include +#include #include =20 /* @@ -2995,15 +2997,11 @@ static int cadence_nand_dt_probe(struct platform_de= vice *ofdev) struct cadence_nand_dt *dt; struct cdns_nand_ctrl *cdns_ctrl; int ret; - const struct of_device_id *of_id; const struct cadence_nand_dt_devdata *devdata; u32 val; =20 - of_id =3D of_match_device(cadence_nand_dt_ids, &ofdev->dev); - if (of_id) { - ofdev->id_entry =3D of_id->data; - devdata =3D of_id->data; - } else { + devdata =3D device_get_match_data(&ofdev->dev); + if (!devdata) { pr_err("Failed to find the right device id.\n"); return -ENOMEM; } diff --git a/drivers/mtd/nand/raw/vf610_nfc.c b/drivers/mtd/nand/raw/vf610_= nfc.c index 3f783b8f76c9..f31d23219f91 100644 --- a/drivers/mtd/nand/raw/vf610_nfc.c +++ b/drivers/mtd/nand/raw/vf610_nfc.c @@ -29,8 +29,9 @@ #include #include #include -#include +#include #include +#include #include #include =20 @@ -810,7 +811,6 @@ static int vf610_nfc_probe(struct platform_device *pdev) struct mtd_info *mtd; struct nand_chip *chip; struct device_node *child; - const struct of_device_id *of_id; int err; int irq; =20 @@ -840,12 +840,10 @@ static int vf610_nfc_probe(struct platform_device *pd= ev) return PTR_ERR(nfc->clk); } =20 - of_id =3D of_match_device(vf610_nfc_dt_ids, &pdev->dev); - if (!of_id) + nfc->variant =3D (enum vf610_nfc_variant)device_get_match_data(&pdev->dev= ); + if (!nfc->variant) return -ENODEV; =20 - nfc->variant =3D (uintptr_t)of_id->data; - for_each_available_child_of_node(nfc->dev->of_node, child) { if (of_device_is_compatible(child, "fsl,vf610-nfc-nandcs")) { =20 --=20 2.42.0