From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>
Subject: [PATCH v1 2/3] gpiolib: Get rid of gpio_bus_match() forward declaration
Date: Tue, 7 Mar 2023 20:25:56 +0200 [thread overview]
Message-ID: <20230307182557.42215-3-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20230307182557.42215-1-andriy.shevchenko@linux.intel.com>
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>
---
drivers/gpio/gpiolib.c | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index c7f35f0e7d15..a44a1b0f2766 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -62,7 +62,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)
{
/*
--
2.39.1
next prev parent reply other threads:[~2023-03-07 18:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-07 18:25 [PATCH v1 0/3] gpiolib: cleanups WRT GPIO device handling Andy Shevchenko
2023-03-07 18:25 ` [PATCH v1 1/3] gpiolib: Access device's fwnode via dev_fwnode() Andy Shevchenko
2023-03-09 13:58 ` Linus Walleij
2023-03-07 18:25 ` Andy Shevchenko [this message]
2023-03-09 13:58 ` [PATCH v1 2/3] gpiolib: Get rid of gpio_bus_match() forward declaration Linus Walleij
2023-03-07 18:25 ` [PATCH v1 3/3] gpiolib: Move gpiodevice_*() to gpiodev namespace Andy Shevchenko
2023-03-08 10:49 ` Bartosz Golaszewski
2023-03-09 18:52 ` Andy Shevchenko
2023-03-10 16:48 ` Bartosz Golaszewski
2023-03-10 17:01 ` Andy Shevchenko
2023-03-15 9:44 ` Bartosz Golaszewski
2023-03-08 10:50 ` [PATCH v1 0/3] gpiolib: cleanups WRT GPIO device handling Bartosz Golaszewski
2023-03-08 13:01 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230307182557.42215-3-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=bartosz.golaszewski@linaro.org \
--cc=brgl@bgdev.pl \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).