From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
David Thompson <davthompson@nvidia.com>,
Linus Walleij <linus.walleij@linaro.org>,
Patrick Rudolph <patrick.rudolph@9elements.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-acpi@vger.kernel.org, netdev@vger.kernel.org
Cc: Bartosz Golaszewski <brgl@bgdev.pl>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Len Brown <lenb@kernel.org>
Subject: [PATCH v1 1/4] gpiolib: acpi: Extract __acpi_find_gpio() helper
Date: Thu, 11 Apr 2024 20:22:29 +0300 [thread overview]
Message-ID: <20240411172540.4122581-3-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20240411172540.4122581-2-andriy.shevchenko@linux.intel.com>
We want to reuse it later on in the code. In particular, it helps
to clean up the users of acpi_dev_gpio_irq_wake_get_by().
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/gpio/gpiolib-acpi.c | 32 +++++++++++++++++++++++---------
1 file changed, 23 insertions(+), 9 deletions(-)
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index c2a33beeec50..d47b22ac3ecb 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -945,14 +945,11 @@ static bool acpi_can_fallback_to_crs(struct acpi_device *adev,
return con_id == NULL;
}
-struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,
- const char *con_id,
- unsigned int idx,
- enum gpiod_flags *dflags,
- unsigned long *lookupflags)
+static struct gpio_desc *
+__acpi_find_gpio(struct fwnode_handle *fwnode, const char *con_id, unsigned int idx,
+ struct acpi_gpio_info *info)
{
struct acpi_device *adev = to_acpi_device_node(fwnode);
- struct acpi_gpio_info info;
struct gpio_desc *desc;
char propname[32];
int i;
@@ -969,10 +966,10 @@ struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,
if (adev)
desc = acpi_get_gpiod_by_index(adev,
- propname, idx, &info);
+ propname, idx, info);
else
desc = acpi_get_gpiod_from_data(fwnode,
- propname, idx, &info);
+ propname, idx, info);
if (PTR_ERR(desc) == -EPROBE_DEFER)
return ERR_CAST(desc);
@@ -985,11 +982,28 @@ struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,
if (!adev || !acpi_can_fallback_to_crs(adev, con_id))
return ERR_PTR(-ENOENT);
- desc = acpi_get_gpiod_by_index(adev, NULL, idx, &info);
+ desc = acpi_get_gpiod_by_index(adev, NULL, idx, info);
if (IS_ERR(desc))
return desc;
}
+ return desc;
+}
+
+struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,
+ const char *con_id,
+ unsigned int idx,
+ enum gpiod_flags *dflags,
+ unsigned long *lookupflags)
+{
+ struct acpi_device *adev = to_acpi_device_node(fwnode);
+ struct acpi_gpio_info info;
+ struct gpio_desc *desc;
+
+ desc = __acpi_find_gpio(fwnode, con_id, idx, &info);
+ if (IS_ERR(desc))
+ return desc;
+
if (info.gpioint &&
(*dflags == GPIOD_OUT_LOW || *dflags == GPIOD_OUT_HIGH)) {
dev_dbg(&adev->dev, "refusing GpioInt() entry when doing GPIOD_OUT_* lookup\n");
--
2.43.0.rc1.1336.g36b5255a03ac
next prev parent reply other threads:[~2024-04-11 17:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-11 17:22 [PATCH v1 0/4] gpiolib: acpi: Use con_id in acpi_dev_gpio_irq_get_by() Andy Shevchenko
2024-04-11 17:22 ` Andy Shevchenko [this message]
2024-04-11 17:22 ` [PATCH v1 2/4] gpiolib: acpi: Simplify error handling in __acpi_find_gpio() Andy Shevchenko
2024-04-11 17:22 ` [PATCH v1 3/4] gpiolib: acpi: Move acpi_can_fallback_to_crs() out of __acpi_find_gpio() Andy Shevchenko
2024-04-11 17:22 ` [PATCH v1 4/4] gpiolib: acpi: Pass con_id instead of property into acpi_dev_gpio_irq_get_by() Andy Shevchenko
2024-04-12 10:19 ` [PATCH v1 0/4] gpiolib: acpi: Use con_id in acpi_dev_gpio_irq_get_by() Mika Westerberg
2024-04-12 16:03 ` 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=20240411172540.4122581-3-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=bartosz.golaszewski@linaro.org \
--cc=brgl@bgdev.pl \
--cc=davem@davemloft.net \
--cc=davthompson@nvidia.com \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=lenb@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=patrick.rudolph@9elements.com \
--cc=rafael.j.wysocki@intel.com \
--cc=rafael@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.