Skip to contentSkip to conversation

mtd: rawnand: gpmi: Use of_device_get_match_data()

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

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: rawnand: gpmi: Use of_device_get_match_data()

The retrieval of driver data via of_device_get_match_data() can make the code simpler.

Use of_device_get_match_data() to simplify the code.

---
 drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +1 -9
index b5f46f214a58..0d30f3fbb045 100644
@@ -2487,21 +2487,13 @@ MODULE_DEVICE_TABLE(of, gpmi_nand_id_table);
 static int gpmi_nand_probe(struct platform_device *pdev)
 {
 	struct gpmi_nand_data *this;
-	const struct of_device_id *of_id;
 	int ret;
 
 	this = devm_kzalloc(&pdev->dev, sizeof(*this), GFP_KERNEL);
 	if (!this)
 		return -ENOMEM;
 
-	of_id = of_match_device(gpmi_nand_id_table, &pdev->dev);
-	if (of_id) {
-		this->devdata = of_id->data;
-	} else {
-		dev_err(&pdev->dev, "Failed to find the right device id.\n");
-		return -ENODEV;
-	}
-
+	this->devdata = of_device_get_match_data(&pdev->dev);
 	platform_set_drvdata(pdev, this);
 	this->pdev  = pdev;
 	this->dev   = &pdev->dev;
Signature · 6 lines
2.17.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
maintainer Applied
#1 lore raw
Quoted 6 lines · Fabio Estevam

The retrieval of driver data via of_device_get_match_data() can make the code simpler.

Use of_device_get_match_data() to simplify the code.

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/