public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpiolib: acpi: Move ACPI device NULL check to acpi_can_fallback_to_crs()
@ 2024-05-13  9:56 Laura Nao
  2024-05-13 10:02 ` Andy Shevchenko
  0 siblings, 1 reply; 11+ messages in thread
From: Laura Nao @ 2024-05-13  9:56 UTC (permalink / raw)
  To: mika.westerberg, andriy.shevchenko
  Cc: linus.walleij, brgl, kernel, linux-kernel, linux-gpio, linux-acpi,
	Laura Nao, AngeloGioacchino Del Regno, kernelci.org bot

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


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-05-21 22:58 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-13  9:56 [PATCH] gpiolib: acpi: Move ACPI device NULL check to acpi_can_fallback_to_crs() Laura Nao
2024-05-13 10:02 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox