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 3/4] gpiolib: acpi: Move acpi_can_fallback_to_crs() out of __acpi_find_gpio()
Date: Thu, 11 Apr 2024 20:22:31 +0300 [thread overview]
Message-ID: <20240411172540.4122581-5-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20240411172540.4122581-2-andriy.shevchenko@linux.intel.com>
New coming user may need to check for _CRS fallback slightly differently.
Move the current check out of the helper function to allow that user to
use it.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/gpio/gpiolib-acpi.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index fb2e14670b7a..2b3fd43b13fc 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -947,7 +947,7 @@ static bool acpi_can_fallback_to_crs(struct acpi_device *adev,
static struct gpio_desc *
__acpi_find_gpio(struct fwnode_handle *fwnode, const char *con_id, unsigned int idx,
- struct acpi_gpio_info *info)
+ bool can_fallback, struct acpi_gpio_info *info)
{
struct acpi_device *adev = to_acpi_device_node(fwnode);
struct gpio_desc *desc;
@@ -978,7 +978,7 @@ __acpi_find_gpio(struct fwnode_handle *fwnode, const char *con_id, unsigned int
}
/* Then from plain _CRS GPIOs */
- if (!adev || !acpi_can_fallback_to_crs(adev, con_id))
+ if (!adev || !can_fallback)
return ERR_PTR(-ENOENT);
return acpi_get_gpiod_by_index(adev, NULL, idx, info);
@@ -991,10 +991,11 @@ struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,
unsigned long *lookupflags)
{
struct acpi_device *adev = to_acpi_device_node(fwnode);
+ bool can_fallback = acpi_can_fallback_to_crs(adev, con_id);
struct acpi_gpio_info info;
struct gpio_desc *desc;
- desc = __acpi_find_gpio(fwnode, con_id, idx, &info);
+ desc = __acpi_find_gpio(fwnode, con_id, idx, can_fallback, &info);
if (IS_ERR(desc))
return desc;
--
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 ` [PATCH v1 1/4] gpiolib: acpi: Extract __acpi_find_gpio() helper Andy Shevchenko
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 ` Andy Shevchenko [this message]
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-5-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.