serial_mctrl_gpio: use gpiod_set_array function
Subsystems (2)
PATCH v6 3/3 serial_mctrl_gpio: use gpiod_set_array function
Make the serial_mctrl_gpio driver the first user of the new gpiod_set_array function. All modem control output signals are now set simultaneously.
---
This patch depends on my previous patch "gpiolib: allow simultaneous setting of multiple GPIO outputs".
Change log:
v6: - add this patch to the series
drivers/tty/serial/serial_mctrl_gpio.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/tty/serial/serial_mctrl_gpio.c +9 -3
@@ -44,15 +44,21 @@ static const struct {void mctrl_gpio_set (struct mctrl_gpios *gpios,unsigned int mctrl) {enum mctrl_gpio_idx i; +struct gpio_desc *desc_array[UART_GPIO_MAX ]; +int value_array[UART_GPIO_MAX ]; +unsigned int count =0 ;if (IS_ERR_OR_NULL (gpios))return ;for (i =0 ; i <UART_GPIO_MAX ; i++)if (!IS_ERR_OR_NULL (gpios->gpio[i]) && - mctrl_gpios_desc[i].dir_out) -gpiod_set_value (gpios->gpio[i], - !!(mctrl & mctrl_gpios_desc[i].mctrl)); + mctrl_gpios_desc[i].dir_out) { + desc_array[count] = gpios->gpio[i]; + value_array[count] = !!(mctrl & mctrl_gpios_desc[i].mctrl); + count++; + } +gpiod_set_array (count, desc_array, value_array); }EXPORT_SYMBOL_GPL (mctrl_gpio_set);
--
2.0.4
Quoted 4 lines · Rojhalat Ibrahim
Make the
serial_mctrl_gpiodriver the first user of the newgpiod_set_arrayfunction. All modem control output signals are now set simultaneously.Signed-off-by Rojhalat Ibrahim <[email protected]>
Nice use of gpiod_set_array(), with hopefully more to come.
Quoted 10 lines · Rojhalat Ibrahim
Make the
serial_mctrl_gpiodriver the first user of the newgpiod_set_arrayfunction. All modem control output signals are now set simultaneously.Signed-off-by Rojhalat Ibrahim <[email protected]>---
This patch depends on my previous patch "gpiolib: allow simultaneous setting of multiple GPIO outputs".Change log:
v6: - add this patch to the series
You need to send this patch to Greg and the Linux-serial mailing list so I can get an ACK from Greg on it.
But I totally accept it as a good first in-kernel usecase!
Yours,
Linus Walleij