summaryrefslogtreecommitdiff
path: root/drivers/gpio/gpio-pch.c
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2016-01-05 14:23:47 +0100
committerLinus Walleij <linus.walleij@linaro.org>2016-01-05 15:46:34 +0100
commit166814d8413df49bf21293aacc808b2782cbd9a8 (patch)
tree5eb75448791b058dbd5e3b8d01511fa76b4bf56a /drivers/gpio/gpio-pch.c
parent446f59acb70b70a425ea4105277a71eb615327cd (diff)
downloadlinux-rt-166814d8413df49bf21293aacc808b2782cbd9a8.tar.gz
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 <jdelvare@suse.de> Cc: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-pch.c')
-rw-r--r--drivers/gpio/gpio-pch.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-pch.c b/drivers/gpio/gpio-pch.c
index 0475782a7e88..7c7135da5d4a 100644
--- a/drivers/gpio/gpio-pch.c
+++ b/drivers/gpio/gpio-pch.c
@@ -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,