Hello Yegor, On Mon, May 23, 2016 at 09:30:56AM +0200, yegorslists@xxxxxxxxxxxxxx wrote: > From: Yegor Yefremov <yegorslists@xxxxxxxxxxxxxx> > > mctrl_gpio_get_outputs() returns the state of following signals: > > RTS, DTR > > Signed-off-by: Yegor Yefremov <yegorslists@xxxxxxxxxxxxxx> > --- > drivers/tty/serial/serial_mctrl_gpio.c | 18 ++++++++++++++++++ > drivers/tty/serial/serial_mctrl_gpio.h | 15 ++++++++++++++- > 2 files changed, 32 insertions(+), 1 deletion(-) > > diff --git a/drivers/tty/serial/serial_mctrl_gpio.c b/drivers/tty/serial/serial_mctrl_gpio.c > index e8dd509..a868595 100644 > --- a/drivers/tty/serial/serial_mctrl_gpio.c > +++ b/drivers/tty/serial/serial_mctrl_gpio.c > @@ -86,6 +86,24 @@ unsigned int mctrl_gpio_get(struct mctrl_gpios *gpios, unsigned int *mctrl) > } > EXPORT_SYMBOL_GPL(mctrl_gpio_get); > > +unsigned int > +mctrl_gpio_get_outputs(struct mctrl_gpios *gpios, unsigned int *mctrl) > +{ > + enum mctrl_gpio_idx i; > + > + for (i = 0; i < UART_GPIO_MAX; i++) { > + if (gpios->gpio[i] && mctrl_gpios_desc[i].dir_out) { > + if (gpiod_get_value(gpios->gpio[i])) > + *mctrl |= mctrl_gpios_desc[i].mctrl; > + else > + *mctrl &= ~mctrl_gpios_desc[i].mctrl; Given that get_value for outputs isn't well defined I'd prefer if there were no usecase for this. This is intended for probe-time, right? Otherwise the state of these lines should be known. > + } > + } > + > + return *mctrl; > +} > +EXPORT_SYMBOL_GPL(mctrl_gpio_get_outputs); > + > struct mctrl_gpios *mctrl_gpio_init_noauto(struct device *dev, unsigned int idx) > { > struct mctrl_gpios *gpios; > diff --git a/drivers/tty/serial/serial_mctrl_gpio.h b/drivers/tty/serial/serial_mctrl_gpio.h > index 332a33a..fa000bc 100644 > --- a/drivers/tty/serial/serial_mctrl_gpio.h > +++ b/drivers/tty/serial/serial_mctrl_gpio.h > @@ -48,12 +48,19 @@ struct mctrl_gpios; > void mctrl_gpio_set(struct mctrl_gpios *gpios, unsigned int mctrl); > > /* > - * Get state of the modem control output lines from GPIOs. > + * Get state of the modem control input lines from GPIOs. This looks right, should be a separate patch or mentioned in the commit log. > +unsigned int > +mctrl_gpio_get_outputs(struct mctrl_gpios *gpios, unsigned int *mctrl); Personally I'd prefer the following formatting: unsigned int mctrl_gpio_get_outputs(struct mctrl_gpios *gpios, unsigned int *mctrl) I didn't check though which of these two is more consistent in that file. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ | -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html