Skip to content

Commit 49c02f6

Browse files
committed
gpiolib: acpi: Move acpi_can_fallback_to_crs() out of __acpi_find_gpio()
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. Acked-by: Mika Westerberg <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]>
1 parent 4cd3ef0 commit 49c02f6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/gpio/gpiolib-acpi.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ static bool acpi_can_fallback_to_crs(struct acpi_device *adev,
947947

948948
static struct gpio_desc *
949949
__acpi_find_gpio(struct fwnode_handle *fwnode, const char *con_id, unsigned int idx,
950-
struct acpi_gpio_info *info)
950+
bool can_fallback, struct acpi_gpio_info *info)
951951
{
952952
struct acpi_device *adev = to_acpi_device_node(fwnode);
953953
struct gpio_desc *desc;
@@ -978,7 +978,7 @@ __acpi_find_gpio(struct fwnode_handle *fwnode, const char *con_id, unsigned int
978978
}
979979

980980
/* Then from plain _CRS GPIOs */
981-
if (!adev || !acpi_can_fallback_to_crs(adev, con_id))
981+
if (!adev || !can_fallback)
982982
return ERR_PTR(-ENOENT);
983983

984984
return acpi_get_gpiod_by_index(adev, NULL, idx, info);
@@ -991,10 +991,11 @@ struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,
991991
unsigned long *lookupflags)
992992
{
993993
struct acpi_device *adev = to_acpi_device_node(fwnode);
994+
bool can_fallback = acpi_can_fallback_to_crs(adev, con_id);
994995
struct acpi_gpio_info info;
995996
struct gpio_desc *desc;
996997

997-
desc = __acpi_find_gpio(fwnode, con_id, idx, &info);
998+
desc = __acpi_find_gpio(fwnode, con_id, idx, can_fallback, &info);
998999
if (IS_ERR(desc))
9991000
return desc;
10001001

0 commit comments

Comments
 (0)