static void gpiodevice_release(struct device *dev)
 {
-       struct gpio_device *gdev = container_of(dev, struct gpio_device, dev);
+       struct gpio_device *gdev = to_gpio_device(dev);
        unsigned long flags;
 
        spin_lock_irqsave(&gpio_lock, flags);
 
 
 /**
  * struct gpio_device - internal state container for GPIO devices
- * @id: numerical ID number for the GPIO chip
  * @dev: the GPIO device struct
  * @chrdev: character device for the GPIO device
+ * @id: numerical ID number for the GPIO chip
  * @mockdev: class device used by the deprecated sysfs interface (may be
  * NULL)
  * @owner: helps prevent removal of modules exporting active GPIOs
  * userspace.
  */
 struct gpio_device {
-       int                     id;
        struct device           dev;
        struct cdev             chrdev;
+       int                     id;
        struct device           *mockdev;
        struct module           *owner;
        struct gpio_chip        *chip;
 #endif
 };
 
+static inline struct gpio_device *to_gpio_device(struct device *dev)
+{
+       return container_of(dev, struct gpio_device, dev);
+}
+
 /* gpio suffixes used for ACPI and device tree lookup */
 static __maybe_unused const char * const gpio_suffixes[] = { "gpios", "gpio" };