diff mbox

serial: st-asc: Use new GPIOD API to obtain RTS pin

Message ID 20170305125412.24373-1-linus.walleij@linaro.org
State Accepted
Commit 0043c1dfbec7b6e2427409059b05347d6f51aa9f
Headers show

Commit Message

Linus Walleij March 5, 2017, 12:54 p.m. UTC
From: Lee Jones <lee.jones@linaro.org>


The commits mentioned below adapt the GPIO API to allow more information
to be passed directly through devm_get_gpiod_from_child() in the first
instance.  This facilitates the removal of subsequent calls, such as
gpiod_direction_output().  This patch firstly moves to utilise the new
API and secondly removes the now superfluous call do set the direction.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

[Also drop the header file dummies that only this driver was using]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

---
Greg: please go ahead and merge this for the -rc:s, or toss in an
ACK and I will merge it as a GPIO fix.

THANKS for pointing out this painless way to phase out APIs.
---
 drivers/tty/serial/st-asc.c   | 11 ++++++-----
 include/linux/gpio/consumer.h | 16 ----------------
 2 files changed, 6 insertions(+), 21 deletions(-)

-- 
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Greg KH March 14, 2017, 2:57 a.m. UTC | #1
On Sun, Mar 05, 2017 at 01:54:12PM +0100, Linus Walleij wrote:
> From: Lee Jones <lee.jones@linaro.org>

> 

> The commits mentioned below adapt the GPIO API to allow more information

> to be passed directly through devm_get_gpiod_from_child() in the first

> instance.  This facilitates the removal of subsequent calls, such as

> gpiod_direction_output().  This patch firstly moves to utilise the new

> API and secondly removes the now superfluous call do set the direction.

> 

> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>

> Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>

> Signed-off-by: Lee Jones <lee.jones@linaro.org>

> [Also drop the header file dummies that only this driver was using]

> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

> ---

> Greg: please go ahead and merge this for the -rc:s, or toss in an

> ACK and I will merge it as a GPIO fix.

> 

> THANKS for pointing out this painless way to phase out APIs.


Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c
index bcf1d33e6ffe..c334bcc59c64 100644
--- a/drivers/tty/serial/st-asc.c
+++ b/drivers/tty/serial/st-asc.c
@@ -575,12 +575,13 @@  static void asc_set_termios(struct uart_port *port, struct ktermios *termios,
 			pinctrl_select_state(ascport->pinctrl,
 					     ascport->states[NO_HW_FLOWCTRL]);
 
-			gpiod =	devm_get_gpiod_from_child(port->dev, "rts",
-							  &np->fwnode);
-			if (!IS_ERR(gpiod)) {
-				gpiod_direction_output(gpiod, 0);
+			gpiod = devm_fwnode_get_gpiod_from_child(port->dev,
+								 "rts",
+								 &np->fwnode,
+								 GPIOD_OUT_LOW,
+								 np->name);
+			if (!IS_ERR(gpiod))
 				ascport->rts = gpiod;
-			}
 		}
 	}
 
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
index 2484b2fcc6eb..933d93656605 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -143,15 +143,6 @@  struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev,
 						struct fwnode_handle *child,
 						enum gpiod_flags flags,
 						const char *label);
-/* FIXME: delete this helper when users are switched over */
-static inline struct gpio_desc *devm_get_gpiod_from_child(struct device *dev,
-			  const char *con_id, struct fwnode_handle *child)
-{
-	return devm_fwnode_get_index_gpiod_from_child(dev, con_id,
-						      0, child,
-						      GPIOD_ASIS,
-						      "?");
-}
 
 #else /* CONFIG_GPIOLIB */
 
@@ -444,13 +435,6 @@  struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev,
 	return ERR_PTR(-ENOSYS);
 }
 
-/* FIXME: delete this when all users are switched over */
-static inline struct gpio_desc *devm_get_gpiod_from_child(struct device *dev,
-			  const char *con_id, struct fwnode_handle *child)
-{
-	return ERR_PTR(-ENOSYS);
-}
-
 #endif /* CONFIG_GPIOLIB */
 
 static inline