Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 166814d8 authored by Jean Delvare's avatar Jean Delvare Committed by Linus Walleij
Browse files

gpio: pch: Optimize pch_gpio_get()



The double negation is costly and can be avoided by shifting the
register value before masking the requested bit.

Signed-off-by: default avatarJean Delvare <jdelvare@suse.de>
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 446f59ac
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -127,7 +127,7 @@ static int pch_gpio_get(struct gpio_chip *gpio, unsigned nr)
{
	struct pch_gpio *chip =	gpiochip_get_data(gpio);

	return !!(ioread32(&chip->reg->pi) & (1 << nr));
	return (ioread32(&chip->reg->pi) >> nr) & 1;
}

static int pch_gpio_direction_output(struct gpio_chip *gpio, unsigned nr,