#include <linux/irq.h>
 #include <linux/gpio/driver.h>
 #include <linux/platform_device.h>
+#include <linux/bitops.h>
 #include <linux/of.h>
 
 #include <linux/mfd/twl6040.h>
        if (ret < 0)
                return ret;
 
-       return (ret >> offset) & 1;
+       return !!(ret & BIT(offset));
 }
 
 static int twl6040gpo_direction_out(struct gpio_chip *chip, unsigned offset,
                return;
 
        if (value)
-               gpoctl = ret | (1 << offset);
+               gpoctl = ret | BIT(offset);
        else
-               gpoctl = ret & ~(1 << offset);
+               gpoctl = ret & ~BIT(offset);
 
        twl6040_reg_write(twl6040, TWL6040_REG_GPOCTL, gpoctl);
 }