if (start >= gc->ngpio || start + count > gc->ngpio)
                        continue;
 
-               bitmap_clear(gc->valid_mask, start, count);
+               bitmap_clear(gc->gpiodev->valid_mask, start, count);
        }
 
        kfree(ranges);
        if (!(gpiochip_count_reserved_ranges(gc) || gc->init_valid_mask))
                return 0;
 
-       gc->valid_mask = gpiochip_allocate_mask(gc);
-       if (!gc->valid_mask)
+       gc->gpiodev->valid_mask = gpiochip_allocate_mask(gc);
+       if (!gc->gpiodev->valid_mask)
                return -ENOMEM;
 
        ret = gpiochip_apply_reserved_ranges(gc);
 
        if (gc->init_valid_mask)
                return gc->init_valid_mask(gc,
-                                          gc->valid_mask,
+                                          gc->gpiodev->valid_mask,
                                           gc->ngpio);
 
        return 0;
 
 static void gpiochip_free_valid_mask(struct gpio_chip *gc)
 {
-       gpiochip_free_mask(&gc->valid_mask);
+       gpiochip_free_mask(&gc->gpiodev->valid_mask);
 }
 
 static int gpiochip_add_pin_ranges(struct gpio_chip *gc)
  */
 const unsigned long *gpiochip_query_valid_mask(const struct gpio_chip *gc)
 {
-       return gc->valid_mask;
+       return gc->gpiodev->valid_mask;
 }
 EXPORT_SYMBOL_GPL(gpiochip_query_valid_mask);
 
                                unsigned int offset)
 {
        /* No mask means all valid */
-       if (likely(!gc->valid_mask))
+       if (likely(!gc->gpiodev->valid_mask))
                return true;
-       return test_bit(offset, gc->valid_mask);
+       return test_bit(offset, gc->gpiodev->valid_mask);
 }
 EXPORT_SYMBOL_GPL(gpiochip_line_is_valid);
 
 
  * @chip: pointer to the corresponding gpiochip, holding static
  * data for this device
  * @descs: array of ngpio descriptors.
+ * @valid_mask: If not %NULL, holds bitmask of GPIOs which are valid to be
+ * used from the chip.
  * @desc_srcu: ensures consistent state of GPIO descriptors exposed to users
  * @ngpio: the number of GPIO lines on this GPIO device, equal to the size
  * of the @descs array.
        struct module           *owner;
        struct gpio_chip __rcu  *chip;
        struct gpio_desc        *descs;
+       unsigned long           *valid_mask;
        struct srcu_struct      desc_srcu;
        unsigned int            base;
        u16                     ngpio;
 
        struct gpio_irq_chip irq;
 #endif /* CONFIG_GPIOLIB_IRQCHIP */
 
-       /**
-        * @valid_mask:
-        *
-        * If not %NULL, holds bitmask of GPIOs which are valid to be used
-        * from the chip.
-        */
-       unsigned long *valid_mask;
-
 #if defined(CONFIG_OF_GPIO)
        /*
         * If CONFIG_OF_GPIO is enabled, then all GPIO controllers described in