summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand
diff options
context:
space:
mode:
authorFabio Estevam <festevam@gmail.com>2020-11-26 04:09:46 +0100
committerMiquel Raynal <miquel.raynal@bootlin.com>2020-12-10 22:37:33 +0100
commitd1c3ede6a3374b8046d6b6cccdecf8645292bf39 (patch)
tree002973711024929b7e3e55ecc760e638661bf49f /drivers/mtd/nand
parentmtd: rawnand: Add NAND controller support on Intel LGM SoC (diff)
downloadlinux-d1c3ede6a3374b8046d6b6cccdecf8645292bf39.tar.xz
linux-d1c3ede6a3374b8046d6b6cccdecf8645292bf39.zip
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. Signed-off-by: Fabio Estevam <festevam@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20201126030946.2058-1-festevam@gmail.com
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r--drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
index b5f46f214a58..0d30f3fbb045 100644
--- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
@@ -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;