static void pch_gpio_set(struct gpio_chip *gpio, unsigned nr, int val)
 {
        u32 reg_val;
-       struct pch_gpio *chip = container_of(gpio, struct pch_gpio, gpio);
+       struct pch_gpio *chip = gpiochip_get_data(gpio);
        unsigned long flags;
 
        spin_lock_irqsave(&chip->spinlock, flags);
 
 static int pch_gpio_get(struct gpio_chip *gpio, unsigned nr)
 {
-       struct pch_gpio *chip = container_of(gpio, struct pch_gpio, gpio);
+       struct pch_gpio *chip = gpiochip_get_data(gpio);
 
        return !!(ioread32(&chip->reg->pi) & (1 << nr));
 }
 static int pch_gpio_direction_output(struct gpio_chip *gpio, unsigned nr,
                                     int val)
 {
-       struct pch_gpio *chip = container_of(gpio, struct pch_gpio, gpio);
+       struct pch_gpio *chip = gpiochip_get_data(gpio);
        u32 pm;
        u32 reg_val;
        unsigned long flags;
 
 static int pch_gpio_direction_input(struct gpio_chip *gpio, unsigned nr)
 {
-       struct pch_gpio *chip = container_of(gpio, struct pch_gpio, gpio);
+       struct pch_gpio *chip = gpiochip_get_data(gpio);
        u32 pm;
        unsigned long flags;
 
 
 static int pch_gpio_to_irq(struct gpio_chip *gpio, unsigned offset)
 {
-       struct pch_gpio *chip = container_of(gpio, struct pch_gpio, gpio);
+       struct pch_gpio *chip = gpiochip_get_data(gpio);
        return chip->irq_base + offset;
 }
 
 #ifdef CONFIG_OF_GPIO
        chip->gpio.of_node = pdev->dev.of_node;
 #endif
-       ret = gpiochip_add(&chip->gpio);
+       ret = gpiochip_add_data(&chip->gpio, chip);
        if (ret) {
                dev_err(&pdev->dev, "PCH gpio: Failed to register GPIO\n");
                goto err_gpiochip_add;