mtd: rawnand: ams-delta: Handle more GPIO pins as optional
authorJanusz Krzysztofik <jmkrzyszt@gmail.com>
Wed, 12 Feb 2020 00:39:24 +0000 (01:39 +0100)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Mon, 9 Mar 2020 13:51:02 +0000 (14:51 +0100)
In order to make the driver more useful on platforms other than Amstrad
Delta, allow GPIO descriptor pointers of possibly non-critical NWP and
NCE pins to be initialised as NULL.

Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20200212003929.6682-10-jmkrzyszt@gmail.com
drivers/mtd/nand/raw/ams-delta.c

index c481d73e3dcb4752299df74ede4376603c7a74eb..0c88e94e9b71f9b9a8bc5eed9baa8865e0d7514f 100644 (file)
@@ -264,14 +264,16 @@ static int ams_delta_init(struct platform_device *pdev)
        platform_set_drvdata(pdev, priv);
 
        /* Set chip enabled but write protected */
-       priv->gpiod_nwp = devm_gpiod_get(&pdev->dev, "nwp", GPIOD_OUT_HIGH);
+       priv->gpiod_nwp = devm_gpiod_get_optional(&pdev->dev, "nwp",
+                                                 GPIOD_OUT_HIGH);
        if (IS_ERR(priv->gpiod_nwp)) {
                err = PTR_ERR(priv->gpiod_nwp);
                dev_err(&pdev->dev, "NWP GPIO request failed (%d)\n", err);
                return err;
        }
 
-       priv->gpiod_nce = devm_gpiod_get(&pdev->dev, "nce", GPIOD_OUT_LOW);
+       priv->gpiod_nce = devm_gpiod_get_optional(&pdev->dev, "nce",
+                                                 GPIOD_OUT_LOW);
        if (IS_ERR(priv->gpiod_nce)) {
                err = PTR_ERR(priv->gpiod_nce);
                dev_err(&pdev->dev, "NCE GPIO request failed (%d)\n", err);