[Xenomai] drivers/gpio/gpio-core.c is broken on 4.4.9

Giulio Moro g.moro at qmul.ac.uk
Sun Jun 18 17:09:26 CEST 2017


the `dev` member of `struct gpio_chip` was replaced by `parent` as of 

commit 58383c78425e4ee1c077253cf297b641c861c02e
Author: Linus Walleij <linus.walleij at linaro.org>
Date:   Wed Nov 4 09:56:26 2015 +0100

    gpio: change member .dev to .parent
    
    The name .dev in a struct is normally reserved for a struct device
    that is let us say a superclass to the thing described by the struct.
    struct gpio_chip stands out by confusingly using a struct device *dev
    to point to the parent device (such as a platform_device) that
    represents the hardware. As we want to give gpio_chip:s real devices,
    this is not working. We need to rename this member to parent.


Therefore the following patch is needed to compile drivers/xenomai/gpio/gpio-core.c. on 4.9.x

Notes:
a) Unfortunately I am not able to verify that it works because I am not on one of the devices supported by the gpio drivers
b) you need ifdefs around the change to make sure you do not break older builds (e.g.: on 4.4.x the original version works fine).

diff --git a/drivers/xenomai/gpio/gpio-core.c b/drivers/xenomai/gpio/gpio-core.c
index b8cb044..17d201c 100644
--- a/drivers/xenomai/gpio/gpio-core.c
+++ b/drivers/xenomai/gpio/gpio-core.c
@@ -428,7 +428,7 @@ static int match_gpio_chip(struct gpio_chip *gc, void *data)
 {
        struct device *dev = data;
 
-       return gc->dev == dev;
+       return gc->parent == dev;
 }



More information about the Xenomai mailing list