struct pinctrl_gpio_range       *range;
 };
 
+#define to_byt_gpio(c) container_of(c, struct byt_gpio, chip)
+
 static void __iomem *byt_gpio_reg(struct gpio_chip *chip, unsigned offset,
                                 int reg)
 {
-       struct byt_gpio *vg = container_of(chip, struct byt_gpio, chip);
+       struct byt_gpio *vg = to_byt_gpio(chip);
        u32 reg_offset;
 
        if (reg == BYT_INT_STAT_REG)
 
 static int byt_gpio_request(struct gpio_chip *chip, unsigned offset)
 {
-       struct byt_gpio *vg = container_of(chip, struct byt_gpio, chip);
+       struct byt_gpio *vg = to_byt_gpio(chip);
 
        pm_runtime_get(&vg->pdev->dev);
 
 
 static void byt_gpio_free(struct gpio_chip *chip, unsigned offset)
 {
-       struct byt_gpio *vg = container_of(chip, struct byt_gpio, chip);
+       struct byt_gpio *vg = to_byt_gpio(chip);
        void __iomem *reg = byt_gpio_reg(&vg->chip, offset, BYT_CONF0_REG);
        u32 value;
 
 
 static void byt_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 {
-       struct byt_gpio *vg = container_of(chip, struct byt_gpio, chip);
+       struct byt_gpio *vg = to_byt_gpio(chip);
        void __iomem *reg = byt_gpio_reg(chip, offset, BYT_VAL_REG);
        unsigned long flags;
        u32 old_val;
 
 static int byt_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
 {
-       struct byt_gpio *vg = container_of(chip, struct byt_gpio, chip);
+       struct byt_gpio *vg = to_byt_gpio(chip);
        void __iomem *reg = byt_gpio_reg(chip, offset, BYT_VAL_REG);
        unsigned long flags;
        u32 value;
 static int byt_gpio_direction_output(struct gpio_chip *chip,
                                     unsigned gpio, int value)
 {
-       struct byt_gpio *vg = container_of(chip, struct byt_gpio, chip);
+       struct byt_gpio *vg = to_byt_gpio(chip);
        void __iomem *reg = byt_gpio_reg(chip, gpio, BYT_VAL_REG);
        unsigned long flags;
        u32 reg_val;
 
 static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
 {
-       struct byt_gpio *vg = container_of(chip, struct byt_gpio, chip);
+       struct byt_gpio *vg = to_byt_gpio(chip);
        int i;
        unsigned long flags;
        u32 conf0, val, offs;
 
 static int byt_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
 {
-       struct byt_gpio *vg = container_of(chip, struct byt_gpio, chip);
+       struct byt_gpio *vg = to_byt_gpio(chip);
        return irq_create_mapping(vg->domain, offset);
 }