Commit 834296a3 authored by Rojhalat Ibrahim's avatar Rojhalat Ibrahim Committed by Linus Walleij

serial: mctrl_gpio: use gpiod_set_array function

Make the serial_mctrl_gpio driver the first user of the new gpiod_set_array
function, which is now available in the linux-gpio devel tree.
All modem control output signals are now set simultaneously.
Signed-off-by: default avatarRojhalat Ibrahim <imr@rtschenk.de>
Reviewed-by: default avatarAlexandre Courbot <acourbot@nvidia.com>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 441e0026
...@@ -44,15 +44,21 @@ static const struct { ...@@ -44,15 +44,21 @@ static const struct {
void mctrl_gpio_set(struct mctrl_gpios *gpios, unsigned int mctrl) void mctrl_gpio_set(struct mctrl_gpios *gpios, unsigned int mctrl)
{ {
enum mctrl_gpio_idx i; 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)) if (IS_ERR_OR_NULL(gpios))
return; return;
for (i = 0; i < UART_GPIO_MAX; i++) for (i = 0; i < UART_GPIO_MAX; i++)
if (!IS_ERR_OR_NULL(gpios->gpio[i]) && if (!IS_ERR_OR_NULL(gpios->gpio[i]) &&
mctrl_gpios_desc[i].dir_out) mctrl_gpios_desc[i].dir_out) {
gpiod_set_value(gpios->gpio[i], desc_array[count] = gpios->gpio[i];
!!(mctrl & mctrl_gpios_desc[i].mctrl)); value_array[count] = !!(mctrl & mctrl_gpios_desc[i].mctrl);
count++;
}
gpiod_set_array(count, desc_array, value_array);
} }
EXPORT_SYMBOL_GPL(mctrl_gpio_set); EXPORT_SYMBOL_GPL(mctrl_gpio_set);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment