From 2b85fda24319ed92cc7cf2d660503538ff4275be Mon Sep 17 00:00:00 2001 From: Federico Vaga <federico.vaga@cern.ch> Date: Tue, 24 Feb 2015 18:29:24 +0100 Subject: [PATCH] wr-nic-gpio: do not check on gpiochip_remove Since kernel 3.18 the gpiochip_remove function return void and not an error code as before. In case the gpiochip is removed while there is a requested gpio, the kernel will print an error message. By applying this patch without any control on the kernel version we are going to loose the error message in case of trouble with old kernels Signed-off-by: Federico Vaga <federico.vaga@cern.ch> --- kernel/wr-nic-gpio.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/kernel/wr-nic-gpio.c b/kernel/wr-nic-gpio.c index 7bb3562..aab957c 100644 --- a/kernel/wr-nic-gpio.c +++ b/kernel/wr-nic-gpio.c @@ -9,6 +9,7 @@ */ #include <linux/kernel.h> #include <linux/module.h> +#include <linux/version.h> #include <linux/slab.h> #include <linux/gpio.h> #include <linux/fmc.h> @@ -88,13 +89,18 @@ out_free: void wrn_gpio_exit(struct fmc_device *fmc) { - int ret; - struct wrn_drvdata *dd = fmc_get_drvdata(fmc); struct gpio_chip *gc = dd->gc; + +#if LINUX_VERSION_CODE > KERNEL_VERSION(3,17,0) + gpiochip_remove(gc); +#else + int ret; + ret = gpiochip_remove(gc); if (ret) dev_err(fmc->hwdev, "DANGER %i! gpio chip can't be removed\n", ret); +#endif return; } -- GitLab