From: Axel Lin <axel.lin@ingics.com>
To: Kishon Vijay Abraham I <kishon@ti.com>, Felipe Balbi <balbi@ti.com>
Cc: Kishon Vijay Abraham I <kishon@ti.com>,
Felipe Balbi <balbi@ti.com>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
David Cohen <david.a.cohen@linux.intel.com>,
linux-kernel@vger.kernel.org,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: [PATCH RESEND] phy: tusb1210: Use devm_gpiod_get_optional for optional GPIOs
Date: Sat, 20 Jun 2015 15:39:57 +0800 [thread overview]
Message-ID: <1434785997.6159.5.camel@ingics.com> (raw)
Also simplify the code a bit by specify direction and initial value for
output in devm_gpiod_get_optional function.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
---
Hi
This patch was sent on https://lkml.org/lkml/2015/5/31/221 with ACKs.
It's still not in linux-next, so here is a resend.
drivers/phy/phy-tusb1210.c | 28 ++++++++++------------------
1 file changed, 10 insertions(+), 18 deletions(-)
diff --git a/drivers/phy/phy-tusb1210.c b/drivers/phy/phy-tusb1210.c
index 07efdd3..e0174da 100644
--- a/drivers/phy/phy-tusb1210.c
+++ b/drivers/phy/phy-tusb1210.c
@@ -61,32 +61,24 @@ static struct phy_ops phy_ops = {
static int tusb1210_probe(struct ulpi *ulpi)
{
- struct gpio_desc *gpio;
struct tusb1210 *tusb;
u8 val, reg;
- int ret;
tusb = devm_kzalloc(&ulpi->dev, sizeof(*tusb), GFP_KERNEL);
if (!tusb)
return -ENOMEM;
- gpio = devm_gpiod_get(&ulpi->dev, "reset");
- if (!IS_ERR(gpio)) {
- ret = gpiod_direction_output(gpio, 0);
- if (ret)
- return ret;
- gpiod_set_value_cansleep(gpio, 1);
- tusb->gpio_reset = gpio;
- }
+ tusb->gpio_reset = devm_gpiod_get_optional(&ulpi->dev, "reset",
+ GPIOD_OUT_LOW);
+ if (IS_ERR(tusb->gpio_reset))
+ return PTR_ERR(tusb->gpio_reset);
+ gpiod_set_value_cansleep(tusb->gpio_reset, 1);
- gpio = devm_gpiod_get(&ulpi->dev, "cs");
- if (!IS_ERR(gpio)) {
- ret = gpiod_direction_output(gpio, 0);
- if (ret)
- return ret;
- gpiod_set_value_cansleep(gpio, 1);
- tusb->gpio_cs = gpio;
- }
+ tusb->gpio_cs = devm_gpiod_get_optional(&ulpi->dev, "cs",
+ GPIOD_OUT_LOW);
+ if (IS_ERR(tusb->gpio_cs))
+ return PTR_ERR(tusb->gpio_cs);
+ gpiod_set_value_cansleep(tusb->gpio_cs, 1);
/*
* VENDOR_SPECIFIC2 register in TUSB1210 can be used for configuring eye
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at http://www.tux.org/lkml/
next reply other threads:[~2015-06-20 7:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-20 7:39 Axel Lin [this message]
2015-07-15 7:04 ` [PATCH RESEND] phy: tusb1210: Use devm_gpiod_get_optional for optional GPIOs Axel Lin
2015-07-15 8:15 ` Kishon Vijay Abraham I
2015-07-15 8:29 ` Uwe Kleine-König
2015-07-15 8:35 ` Axel Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1434785997.6159.5.camel@ingics.com \
--to=axel.lin@ingics.com \
--cc=balbi@ti.com \
--cc=david.a.cohen@linux.intel.com \
--cc=heikki.krogerus@linux.intel.com \
--cc=kishon@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.