Re: [PATCH] ata: ahci-imx: Covert to use GPIO descriptor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello!

On 05.01.2019 3:14, Linus Walleij wrote:

This converts the i.MX AHCI driver to use a GPIO descriptor
instead of parsing the device tree by itself.

This driver is quite obviously device tree only, and the
GPIO line is treated as optional, so let's keep it as
optional.

None of the device trees in the kernek use this GPIO

   Kernel. :-)

facility today, so it is hard to test.

Cc: Egor Starkov <egor.starkov@xxxxxx>
Cc: Richard Zhu <hongxing.zhu@xxxxxxx>
Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
---
  drivers/ata/ahci_imx.c | 24 ++++++++----------------
  1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c
index b00799d208f5..1c9d35c2f89c 100644
--- a/drivers/ata/ahci_imx.c
+++ b/drivers/ata/ahci_imx.c
[...]
@@ -1044,19 +1043,12 @@ static int imx8_sata_probe(struct device *dev, struct imx_ahci_priv *imxpriv)
  	}
/* Fetch GPIO, then enable the external OSC */
-	imxpriv->clkreq_gpio = of_get_named_gpio(np, "clkreq-gpio", 0);
-	if (gpio_is_valid(imxpriv->clkreq_gpio)) {
-		ret = devm_gpio_request_one(dev, imxpriv->clkreq_gpio,
-					    GPIOF_OUT_INIT_LOW,
-					    "SATA CLKREQ");
-		if (ret == -EBUSY) {
-			dev_info(dev, "clkreq had been initialized.\n");
-		} else if (ret) {
-			dev_err(dev, "%d unable to get clkreq.\n", ret);
-			return ret;
-		}
-	} else if (imxpriv->clkreq_gpio == -EPROBE_DEFER) {
-		return imxpriv->clkreq_gpio;
+	imxpriv->clkreq_gpiod = devm_gpiod_get_optional(dev, "clkreq", GPIOD_OUT_LOW);
+	if (IS_ERR(imxpriv->clkreq_gpiod))
+		return PTR_ERR(imxpriv->clkreq_gpiod);
+	if (imxpriv->clkreq_gpiod) {
+		gpiod_set_consumer_name(imxpriv->clkreq_gpiod, "SATA CLKREQ");
+		dev_info(dev, "clkreq had been initialized.\n");

   Hm, this message was printed on -EBUSY error, now you print it on success...

MBR, Sergei



[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux