diff options
| -rw-r--r-- | drivers/gpio/gpiolib.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 86a171e96b0e..d85c97bc158f 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -11,6 +11,7 @@ #include <linux/errno.h> #include <linux/file.h> #include <linux/fs.h> +#include <linux/fwnode.h> #include <linux/idr.h> #include <linux/interrupt.h> #include <linux/irq.h> @@ -1394,7 +1395,16 @@ EXPORT_SYMBOL_GPL(gpio_device_find_by_label); static int gpio_chip_match_by_fwnode(struct gpio_chip *gc, const void *fwnode) { - return device_match_fwnode(&gc->gpiodev->dev, fwnode); + struct device *dev = &gc->gpiodev->dev; + struct fwnode_handle *node = dev_fwnode(dev); + + if (IS_ERR(fwnode)) + return 0; + + if (device_match_fwnode(dev, fwnode)) + return 1; + + return node && node->secondary == fwnode; } /** |
