[v1] gpiolib: Consistent use of ->get_direction() inside gpiolib

Message ID 20180709184721.34667-1-andriy.shevchenko@linux.intel.com
State New
Headers show
Series
  • [v1] gpiolib: Consistent use of ->get_direction() inside gpiolib
Related show

Commit Message

Andy Shevchenko July 9, 2018, 6:47 p.m.
Two out of three calls to ->get_direction (excluding, of course,
gpiod_get_direction() itself) are using gpiod_get_direction() and
one is still open coded.

Replace the latter one to use same API for sake of consistency.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpiolib.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Linus Walleij July 13, 2018, 7:03 a.m. | #1
On Mon, Jul 9, 2018 at 8:47 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> Two out of three calls to ->get_direction (excluding, of course,
> gpiod_get_direction() itself) are using gpiod_get_direction() and
> one is still open coded.
>
> Replace the latter one to use same API for sake of consistency.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Patch applied!

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 8ec51b7777c6..45d399a878bb 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -3260,18 +3260,13 @@  int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset)
 	 * behind our back
 	 */
 	if (!chip->can_sleep && chip->get_direction) {
-		int dir = chip->get_direction(chip, offset);
+		int dir = gpiod_get_direction(desc);
 
 		if (dir < 0) {
 			chip_err(chip, "%s: cannot get GPIO direction\n",
 				 __func__);
 			return dir;
 		}
-
-		if (dir)
-			clear_bit(FLAG_IS_OUT, &desc->flags);
-		else
-			set_bit(FLAG_IS_OUT, &desc->flags);
 	}
 
 	if (test_bit(FLAG_IS_OUT, &desc->flags)) {