Skip to contentSkip to conversation

mtd: rawnand: mxc: Use device_get_match_data()

PATCH Applied Fabio Estevam 2 participants 4 messages Dec 4, 2020 – Dec 7, 2020

Subsystems (3)
lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH 1/2 mtd: rawnand: mxc: Use device_get_match_data()

The retrieval of driver data can be a bit simplified by using device_get_match_data(), so switch to it.

---
 drivers/mtd/nand/raw/mxc_nand.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mtd/nand/raw/mxc_nand.c +1 -3
index f896364968d8..d5c445eb93ad 100644
@@ -1714,7 +1714,6 @@ static const struct nand_controller_ops mxcnd_controller_ops = {
 
 static int mxcnd_probe(struct platform_device *pdev)
 {
-	const struct of_device_id *of_id;
 	struct nand_chip *this;
 	struct mtd_info *mtd;
 	struct mxc_nand_host *host;
@@ -1756,8 +1755,7 @@ static int mxcnd_probe(struct platform_device *pdev)
 	if (IS_ERR(host->clk))
 		return PTR_ERR(host->clk);
 
-	of_id = of_match_device(mxcnd_dt_ids, host->dev);
-	host->devtype_data = of_id->data;
+	host->devtype_data = device_get_match_data(&pdev->dev);
 
 	if (!host->devtype_data->setup_interface)
 		this->options |= NAND_KEEP_TIMINGS;
Signature · 6 lines
2.17.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
author reviewer
#1 lore raw

PATCH 2/2 mtd: rawnand: mxc: Use a single line for of_device_id

The .compatible and .data pairs can be stored in a single line, which makes the code more concise.

---
 drivers/mtd/nand/raw/mxc_nand.c | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)
drivers/mtd/nand/raw/mxc_nand.c +5 -16
index d5c445eb93ad..fd705dd1768d 100644
@@ -1610,22 +1610,11 @@ static inline int is_imx53_nfc(struct mxc_nand_host *host)
 }
 
 static const struct of_device_id mxcnd_dt_ids[] = {
-	{
-		.compatible = "fsl,imx21-nand",
-		.data = &imx21_nand_devtype_data,
-	}, {
-		.compatible = "fsl,imx27-nand",
-		.data = &imx27_nand_devtype_data,
-	}, {
-		.compatible = "fsl,imx25-nand",
-		.data = &imx25_nand_devtype_data,
-	}, {
-		.compatible = "fsl,imx51-nand",
-		.data = &imx51_nand_devtype_data,
-	}, {
-		.compatible = "fsl,imx53-nand",
-		.data = &imx53_nand_devtype_data,
-	},
+	{ .compatible = "fsl,imx21-nand", .data = &imx21_nand_devtype_data, },
+	{ .compatible = "fsl,imx27-nand", .data = &imx27_nand_devtype_data, },
+	{ .compatible = "fsl,imx25-nand", .data = &imx25_nand_devtype_data, },
+	{ .compatible = "fsl,imx51-nand", .data = &imx51_nand_devtype_data, },
+	{ .compatible = "fsl,imx53-nand", .data = &imx53_nand_devtype_data, },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, mxcnd_dt_ids);
Signature · 6 lines
2.17.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
maintainer Applied
#2 lore raw

Re: [PATCH 2/2] mtd: rawnand: mxc: Use a single line for of_device_id

Quoted 4 lines · Fabio Estevam

The .compatible and .data pairs can be stored in a single line, which makes the code more concise.

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

maintainer Applied
#3 lore raw
In reply to Fabio Estevam
Quoted 4 lines · Fabio Estevam

The retrieval of driver data can be a bit simplified by using device_get_match_data(), so switch to it.

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/