* [PATCH] tty: st-asc: switch to using devm_gpiod_get()
@ 2020-01-04 20:23 Dmitry Torokhov
2020-01-06 18:58 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Torokhov @ 2020-01-04 20:23 UTC (permalink / raw)
To: Patrice Chotard, Greg Kroah-Hartman
Cc: Jiri Slaby, linux-arm-kernel, linux-serial, linux-kernel
The node pointer in question is not a child node, but the node assigned
to the port device itself, so we should not be using
devm_fwnode_get_gpiod_from_child() [that is going away], but standard
devm_gpiod_get().
To maintain the previous labeling we use gpiod_set_consumer_name() after
we acquire the GPIO.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/tty/serial/st-asc.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c
index fb6bbb5e22344..e7048515a79ca 100644
--- a/drivers/tty/serial/st-asc.c
+++ b/drivers/tty/serial/st-asc.c
@@ -504,7 +504,6 @@ static void asc_set_termios(struct uart_port *port, struct ktermios *termios,
struct ktermios *old)
{
struct asc_port *ascport = to_asc_port(port);
- struct device_node *np = port->dev->of_node;
struct gpio_desc *gpiod;
unsigned int baud;
u32 ctrl_val;
@@ -566,13 +565,12 @@ static void asc_set_termios(struct uart_port *port, struct ktermios *termios,
pinctrl_select_state(ascport->pinctrl,
ascport->states[NO_HW_FLOWCTRL]);
- gpiod = devm_fwnode_get_gpiod_from_child(port->dev,
- "rts",
- &np->fwnode,
- GPIOD_OUT_LOW,
- np->name);
- if (!IS_ERR(gpiod))
+ gpiod = devm_gpiod_get(port->dev, "rts", GPIOD_OUT_LOW);
+ if (!IS_ERR(gpiod)) {
+ gpiod_set_consumer_name(gpiod,
+ port->dev->of_node->name);
ascport->rts = gpiod;
+ }
}
}
--
2.24.1.735.g03f4e72817-goog
--
Dmitry
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tty: st-asc: switch to using devm_gpiod_get()
2020-01-04 20:23 [PATCH] tty: st-asc: switch to using devm_gpiod_get() Dmitry Torokhov
@ 2020-01-06 18:58 ` Greg Kroah-Hartman
2020-01-06 22:38 ` Dmitry Torokhov
0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2020-01-06 18:58 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Patrice Chotard, Jiri Slaby, linux-arm-kernel, linux-serial,
linux-kernel
On Sat, Jan 04, 2020 at 12:23:14PM -0800, Dmitry Torokhov wrote:
> The node pointer in question is not a child node, but the node assigned
> to the port device itself, so we should not be using
> devm_fwnode_get_gpiod_from_child() [that is going away], but standard
> devm_gpiod_get().
>
> To maintain the previous labeling we use gpiod_set_consumer_name() after
> we acquire the GPIO.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> drivers/tty/serial/st-asc.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
What changed from v1 of this patch? Please put that below the --- line
and versino your patches.
v3?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tty: st-asc: switch to using devm_gpiod_get()
2020-01-06 18:58 ` Greg Kroah-Hartman
@ 2020-01-06 22:38 ` Dmitry Torokhov
0 siblings, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2020-01-06 22:38 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Patrice Chotard, Jiri Slaby, linux-arm-kernel, linux-serial,
linux-kernel
On Mon, Jan 06, 2020 at 07:58:16PM +0100, Greg Kroah-Hartman wrote:
> On Sat, Jan 04, 2020 at 12:23:14PM -0800, Dmitry Torokhov wrote:
> > The node pointer in question is not a child node, but the node assigned
> > to the port device itself, so we should not be using
> > devm_fwnode_get_gpiod_from_child() [that is going away], but standard
> > devm_gpiod_get().
> >
> > To maintain the previous labeling we use gpiod_set_consumer_name() after
> > we acquire the GPIO.
> >
> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > ---
> > drivers/tty/serial/st-asc.c | 12 +++++-------
> > 1 file changed, 5 insertions(+), 7 deletions(-)
>
> What changed from v1 of this patch? Please put that below the --- line
> and versino your patches.
I did not add a version or changelog because I believe this is
essentially a different patch, with different justification and
different API that is being used.
The first one was a simple switch to devm_fwnode_gpiod_get(), the new
one is abandoning the use of explicit node reference, and instead uses
standard devm_gpiod_get() to get a GPIO assigned to a device +
gpiod_set_consumer_name() to maintain the naming.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-01-06 22:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-04 20:23 [PATCH] tty: st-asc: switch to using devm_gpiod_get() Dmitry Torokhov
2020-01-06 18:58 ` Greg Kroah-Hartman
2020-01-06 22:38 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).