ar71xx: Add kernel 4.9 support
[openwrt/openwrt.git] / target / linux / ar71xx / files / drivers / spi / spi-rb4xx-cpld.c
index 0534c7c37452c0ff903644803d7dc573c044fe77..18af83b67c85892d5f0dc1a47b1cc95bdac1dc72 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/spi/spi.h>
 #include <linux/gpio.h>
 #include <linux/slab.h>
+#include <linux/version.h>
 
 #include <asm/mach-ath79/rb4xx_cpld.h>
 
@@ -246,7 +247,11 @@ static int rb4xx_cpld_gpio_init(struct rb4xx_cpld *cpld, unsigned int base)
        cpld->chip.base = base;
        cpld->chip.ngpio = CPLD_NUM_GPIOS;
        cpld->chip.can_sleep = 1;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0)
        cpld->chip.dev = &cpld->spi->dev;
+#else
+       cpld->chip.parent = &cpld->spi->dev;
+#endif
        cpld->chip.owner = THIS_MODULE;
 
        err = gpiochip_add(&cpld->chip);