Linux-GPIO Archive mirror
 help / color / mirror / Atom feed
From: Laura Nao <laura.nao@collabora.com>
To: mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com
Cc: linus.walleij@linaro.org, brgl@bgdev.pl, kernel@collabora.com,
	linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,
	linux-acpi@vger.kernel.org, Laura Nao <laura.nao@collabora.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	"kernelci.org bot" <bot@kernelci.org>
Subject: [PATCH] gpiolib: acpi: Move ACPI device NULL check to acpi_can_fallback_to_crs()
Date: Mon, 13 May 2024 11:56:10 +0200	[thread overview]
Message-ID: <20240513095610.216668-1-laura.nao@collabora.com> (raw)

Following the relocation of the function call outside of
__acpi_find_gpio(), move the ACPI device NULL check to
acpi_can_fallback_to_crs().

Signed-off-by: Laura Nao <laura.nao@collabora.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reported-by: "kernelci.org bot" <bot@kernelci.org>
Closes: https://lore.kernel.org/all/20240426154208.81894-1-laura.nao@collabora.com/
Fixes: 49c02f6e901c ("gpiolib: acpi: Move acpi_can_fallback_to_crs() out of __acpi_find_gpio()")
---
v1: https://lore.kernel.org/all/20240509104605.538274-1-laura.nao@collabora.com/T/#u
---
 drivers/gpio/gpiolib-acpi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index 553a5f94c00a..c7483cd800ee 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -939,7 +939,7 @@ static bool acpi_can_fallback_to_crs(struct acpi_device *adev,
 				     const char *con_id)
 {
 	/* Never allow fallback if the device has properties */
-	if (acpi_dev_has_props(adev) || adev->driver_gpios)
+	if (!adev || acpi_dev_has_props(adev) || adev->driver_gpios)
 		return false;
 
 	return con_id == NULL;
@@ -978,10 +978,10 @@ __acpi_find_gpio(struct fwnode_handle *fwnode, const char *con_id, unsigned int
 	}
 
 	/* Then from plain _CRS GPIOs */
-	if (!adev || !can_fallback)
-		return ERR_PTR(-ENOENT);
+	if (can_fallback)
+		return acpi_get_gpiod_by_index(adev, NULL, idx, info);
 
-	return acpi_get_gpiod_by_index(adev, NULL, idx, info);
+	return ERR_PTR(-ENOENT);
 }
 
 struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,
-- 
2.30.2


             reply	other threads:[~2024-05-13  9:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-13  9:56 Laura Nao [this message]
2024-05-13 10:02 ` [PATCH] gpiolib: acpi: Move ACPI device NULL check to acpi_can_fallback_to_crs() Andy Shevchenko
2024-05-21 10:01   ` Linux regression tracking (Thorsten Leemhuis)
2024-05-21 14:00     ` Andy Shevchenko
2024-05-21 14:26       ` Linux regression tracking (Thorsten Leemhuis)
2024-05-21 14:53         ` Andy Shevchenko
2024-05-21 15:14           ` Linux regression tracking (Thorsten Leemhuis)
2024-05-21 15:27             ` Andy Shevchenko
2024-05-21 16:50               ` Andy Shevchenko
2024-05-21 18:41               ` Linux regression tracking (Thorsten Leemhuis)
2024-05-21 22:58       ` Stephen Rothwell

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=20240513095610.216668-1-laura.nao@collabora.com \
    --to=laura.nao@collabora.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=bot@kernelci.org \
    --cc=brgl@bgdev.pl \
    --cc=kernel@collabora.com \
    --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 \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).