Skip to contentSkip to conversation

serial_mctrl_gpio: use gpiod_set_array function

PATCH RESEND In review Rojhalat Ibrahim 4 participants 4 messages Nov 17, 2014 – Nov 28, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 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.

---
Resend: Add Greg Kroah-Hartman and the linux-serial list to the recipients
in hopes of getting an ACK.

 drivers/tty/serial/serial_mctrl_gpio.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/tty/serial/serial_mctrl_gpio.c +9 -3
index a3035f9..a38596c 100644
@@ -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

#1 lore raw

Hello.

Good patch but I'd prefer to introduce separate function for mctrl_gpio.
I'm not conviced whether it is useful for 2 gpio lines (outputs: RTS, DTR) of mctrl_gpio. It adds some overhead for all drivers which use mctrl_gpio but likely they don't require it.

best regards
Janusz

Acked-by on v1 1/1
#2 lore raw
In reply to Rojhalat Ibrahim
Quoted 10 lines · Rojhalat Ibrahim

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.

---
Resend: Add Greg Kroah-Hartman and the linux-serial list to the recipients
in hopes of getting an ACK.