Skip to content

Commit

Permalink
tty: st-asc: switch to using devm_gpiod_get()
Browse files Browse the repository at this point in the history
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>
Link: https://lore.kernel.org/r/20200104202314.GA13591@dtor-ws
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Dmitry Torokhov authored and Greg Kroah-Hartman committed Jan 10, 2020
1 parent cdcc41a commit 8c44f9b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions drivers/tty/serial/st-asc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}
}

Expand Down

0 comments on commit 8c44f9b

Please sign in to comment.