diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2023-03-07 20:25:56 +0200 |
---|---|---|
committer | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2023-03-08 11:50:20 +0100 |
commit | c135f401265ae1b8b15c8fd607a4a113c61d79f8 (patch) | |
tree | 8b172ec54fa8c664d14a892bbd3452de3a019529 /drivers/gpio/gpiolib.c | |
parent | 67f64d1589ba946970aaaed35ee6335d043a4933 (diff) | |
download | linux-stable-c135f401265ae1b8b15c8fd607a4a113c61d79f8.tar.gz linux-stable-c135f401265ae1b8b15c8fd607a4a113c61d79f8.tar.bz2 linux-stable-c135f401265ae1b8b15c8fd607a4a113c61d79f8.zip |
gpiolib: Get rid of gpio_bus_match() forward declaration
There is nothing specific about gpio_bus_match(), so we may
simply move it to the top of the file and get rid of forward
declaration.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Diffstat (limited to 'drivers/gpio/gpiolib.c')
-rw-r--r-- | drivers/gpio/gpiolib.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index b1aa13d1b7e3..7c75e0e5fe22 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -61,7 +61,20 @@ static DEFINE_IDA(gpio_ida); static dev_t gpio_devt; #define GPIO_DEV_MAX 256 /* 256 GPIO chip devices supported */ -static int gpio_bus_match(struct device *dev, struct device_driver *drv); + +static int gpio_bus_match(struct device *dev, struct device_driver *drv) +{ + struct fwnode_handle *fwnode = dev_fwnode(dev); + + /* + * Only match if the fwnode doesn't already have a proper struct device + * created for it. + */ + if (fwnode && fwnode->dev != dev) + return 0; + return 1; +} + static struct bus_type gpio_bus_type = { .name = "gpio", .match = gpio_bus_match, @@ -4417,20 +4430,6 @@ void gpiod_put_array(struct gpio_descs *descs) } EXPORT_SYMBOL_GPL(gpiod_put_array); - -static int gpio_bus_match(struct device *dev, struct device_driver *drv) -{ - struct fwnode_handle *fwnode = dev_fwnode(dev); - - /* - * Only match if the fwnode doesn't already have a proper struct device - * created for it. - */ - if (fwnode && fwnode->dev != dev) - return 0; - return 1; -} - static int gpio_stub_drv_probe(struct device *dev) { /* |