gpio: pch: Optimize pch_gpio_get()
Subsystems (2)
PATCH 1/1 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 Jean Delvare <[email protected]>
Cc Linus Walleij <[email protected]>
--- drivers/gpio/gpio-pch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-pch.c +1 -1
@@ -127,7 +127,7 @@ static int pch_gpio_get(struct gpio_chip {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,
Signature · 2 lines
Jean Delvare SUSE L3 Support
Quoted 5 lines · Jean Delvare
The double negation is costly and can be avoided by shifting the register value before masking the requested bit.
Signed-off-by Jean Delvare <[email protected]>Cc Linus Walleij <[email protected]>
Patch applied.
Yours,
Linus Walleij