linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/3][v6] serial_mctrl_gpio: use gpiod_set_array function
@ 2014-11-04 16:12 Rojhalat Ibrahim
  2014-11-07  9:34 ` Alexandre Courbot
  2014-11-14  9:59 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Rojhalat Ibrahim @ 2014-11-04 16:12 UTC (permalink / raw)
  To: linux-gpio@vger.kernel.org
  Cc: Alexandre Courbot, Linus Walleij, Grant Likely, Mark Brown,
	Gerhard Sittig

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.

Signed-off-by: Rojhalat Ibrahim <imr@rtschenk.de>
---
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(-)

diff --git a/drivers/tty/serial/serial_mctrl_gpio.c b/drivers/tty/serial/serial_mctrl_gpio.c
index a3035f9..a38596c 100644
--- a/drivers/tty/serial/serial_mctrl_gpio.c
+++ b/drivers/tty/serial/serial_mctrl_gpio.c
@@ -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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 3/3][v6] serial_mctrl_gpio: use gpiod_set_array function
  2014-11-04 16:12 [PATCH 3/3][v6] serial_mctrl_gpio: use gpiod_set_array function Rojhalat Ibrahim
@ 2014-11-07  9:34 ` Alexandre Courbot
  2014-11-14  9:59 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Courbot @ 2014-11-07  9:34 UTC (permalink / raw)
  To: Rojhalat Ibrahim
  Cc: linux-gpio@vger.kernel.org, Linus Walleij, Grant Likely,
	Mark Brown, Gerhard Sittig

On Wed, Nov 5, 2014 at 1:12 AM, Rojhalat Ibrahim <imr@rtschenk.de> wrote:
> 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.
>
> Signed-off-by: Rojhalat Ibrahim <imr@rtschenk.de>

Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>

Nice use of gpiod_set_array(), with hopefully more to come.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 3/3][v6] serial_mctrl_gpio: use gpiod_set_array function
  2014-11-04 16:12 [PATCH 3/3][v6] serial_mctrl_gpio: use gpiod_set_array function Rojhalat Ibrahim
  2014-11-07  9:34 ` Alexandre Courbot
@ 2014-11-14  9:59 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2014-11-14  9:59 UTC (permalink / raw)
  To: Rojhalat Ibrahim, Greg Kroah-Hartman,
	linux-serial@vger.kernel.org
  Cc: linux-gpio@vger.kernel.org, Alexandre Courbot, Grant Likely,
	Mark Brown, Gerhard Sittig

On Tue, Nov 4, 2014 at 5:12 PM, Rojhalat Ibrahim <imr@rtschenk.de> wrote:

> 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.
>
> Signed-off-by: Rojhalat Ibrahim <imr@rtschenk.de>
> ---
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-11-14  9:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-04 16:12 [PATCH 3/3][v6] serial_mctrl_gpio: use gpiod_set_array function Rojhalat Ibrahim
2014-11-07  9:34 ` Alexandre Courbot
2014-11-14  9:59 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).