Commit 4fb9a54c authored by Dimitris Lampridis's avatar Dimitris Lampridis Committed by Federico Vaga

kernel: fix kernel >4.4 compatibility

Compiling on kernel >=4.5 produces the following error:

  CC [M]  spec-sw/kernel/wr-nic-gpio.o
spec-sw/kernel/wr-nic-gpio.c: In function ‘gc_to_fmc’:
spec-sw/kernel/wr-nic-gpio.c:20:25: error: ‘struct gpio_chip’ has no member named ‘dev’
  struct device *dev = gc->dev;
spec-sw/kernel/wr-nic-gpio.c: In function ‘wrn_gpio_init’:
spec-sw/kernel/wr-nic-gpio.c:75:4: error: ‘struct gpio_chip’ has no member named ‘dev’
  gc->dev = &fmc->dev;

This is due to a change in struct gpio_chip introduced in 4.5,
where the "dev" field was renamed to "parent".

58383c7 gpio: change member .dev to .parent

This patch makes our code compatible with modern kernel versions
Signed-off-by: Federico Vaga's avatarFederico Vaga <>
Signed-off-by: 's avatarDimitris Lampridis <>
parent 62898528
......@@ -7,6 +7,7 @@
* This work is part of the White Rabbit project, a research effort led
* by CERN, the European Institute for Nuclear Research.
#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/version.h>
......@@ -17,7 +18,11 @@
static inline struct fmc_device *gc_to_fmc(struct gpio_chip *gc)
struct device *dev = gc->dev;
struct device *dev = gc->parent;
return container_of(dev, struct fmc_device, dev);
......@@ -72,7 +77,11 @@ int wrn_gpio_init(struct fmc_device *fmc)
if (!gc)
return -ENOMEM;
*gc = wrn_gpio_template;
gc->dev = &fmc->dev;
gc->parent = &fmc->dev;
ret = gpiochip_add(gc);
if (ret < 0)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment