summaryrefslogtreecommitdiff
path: root/drivers/gpio/gpio-rcar.c
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2020-10-28 15:15:01 +0100
committerBartosz Golaszewski <bgolaszewski@baylibre.com>2020-10-30 15:57:12 +0100
commit714d3a295854c14295fc633be1abbb947d2059a1 (patch)
treee230599e03a4ef7209954beaf404356acfe7feab /drivers/gpio/gpio-rcar.c
parent5e2ca893d772560a0926a31b88f8c83efbc6b058 (diff)
gpio: rcar: Cache gpiochip_get_data() return value
Since commit 43c54ecade400cf6 ("gpio: move the subdriver data pointer into gpio_device") changed gpiochip_get_data() to an out-of-line function, it is now worthwhile to avoid multiple calls in a row by caching its return value in a local variable. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Diffstat (limited to 'drivers/gpio/gpio-rcar.c')
-rw-r--r--drivers/gpio/gpio-rcar.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index 3ef19cef8da9..a75bbc9af1f1 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -295,14 +295,15 @@ static int gpio_rcar_direction_input(struct gpio_chip *chip, unsigned offset)
static int gpio_rcar_get(struct gpio_chip *chip, unsigned offset)
{
+ struct gpio_rcar_priv *p = gpiochip_get_data(chip);
u32 bit = BIT(offset);
/* testing on r8a7790 shows that INDT does not show correct pin state
* when configured as output, so use OUTDT in case of output pins */
- if (gpio_rcar_read(gpiochip_get_data(chip), INOUTSEL) & bit)
- return !!(gpio_rcar_read(gpiochip_get_data(chip), OUTDT) & bit);
+ if (gpio_rcar_read(p, INOUTSEL) & bit)
+ return !!(gpio_rcar_read(p, OUTDT) & bit);
else
- return !!(gpio_rcar_read(gpiochip_get_data(chip), INDT) & bit);
+ return !!(gpio_rcar_read(p, INDT) & bit);
}
static void gpio_rcar_set(struct gpio_chip *chip, unsigned offset, int value)