Skip to content

Commit 44aa986

Browse files
committed
Merge patch series "gpiolib: acpi: Fix missing info filling"
Andy Shevchenko <[email protected]> says: Kees reported that code, while being refactored, missed the point of filling the info structure which supplies GPIO flags to the upper layer. Indeed, without that part the GPIO expander get no IRQ on Intel Edison, for example. Fix this in this series. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Andy Shevchenko <[email protected]>
2 parents 71114cd + 7c010d4 commit 44aa986

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

drivers/gpio/gpiolib-acpi.c

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -743,8 +743,8 @@ static int acpi_gpio_update_gpiod_lookup_flags(unsigned long *lookupflags,
743743
}
744744

745745
struct acpi_gpio_lookup {
746-
struct acpi_gpio_info info;
747746
struct acpi_gpio_params params;
747+
struct acpi_gpio_info *info;
748748
struct gpio_desc *desc;
749749
int n;
750750
};
@@ -753,6 +753,7 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data)
753753
{
754754
struct acpi_gpio_lookup *lookup = data;
755755
struct acpi_gpio_params *params = &lookup->params;
756+
struct acpi_gpio_info *info = lookup->info;
756757

757758
if (ares->type != ACPI_RESOURCE_TYPE_GPIO)
758759
return 1;
@@ -763,7 +764,7 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data)
763764
struct gpio_desc *desc;
764765
u16 pin_index;
765766

766-
if (lookup->info.quirks & ACPI_GPIO_QUIRK_ONLY_GPIOIO && gpioint)
767+
if (info->quirks & ACPI_GPIO_QUIRK_ONLY_GPIOIO && gpioint)
767768
params->crs_entry_index++;
768769

769770
if (lookup->n++ != params->crs_entry_index)
@@ -773,16 +774,16 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data)
773774
if (pin_index >= agpio->pin_table_length)
774775
return 1;
775776

776-
if (lookup->info.quirks & ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER)
777+
if (info->quirks & ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER)
777778
desc = gpio_to_desc(agpio->pin_table[pin_index]);
778779
else
779780
desc = acpi_get_gpiod(agpio->resource_source.string_ptr,
780781
agpio->pin_table[pin_index]);
781782
lookup->desc = desc;
782-
lookup->info.pin_config = agpio->pin_config;
783-
lookup->info.debounce = agpio->debounce_timeout;
784-
lookup->info.gpioint = gpioint;
785-
lookup->info.wake_capable = acpi_gpio_irq_is_wake(&lookup->info.adev->dev, agpio);
783+
info->pin_config = agpio->pin_config;
784+
info->debounce = agpio->debounce_timeout;
785+
info->gpioint = gpioint;
786+
info->wake_capable = acpi_gpio_irq_is_wake(&info->adev->dev, agpio);
786787

787788
/*
788789
* Polarity and triggering are only specified for GpioInt
@@ -791,22 +792,23 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data)
791792
* - ACPI_ACTIVE_LOW == GPIO_ACTIVE_LOW
792793
* - ACPI_ACTIVE_HIGH == GPIO_ACTIVE_HIGH
793794
*/
794-
if (lookup->info.gpioint) {
795-
lookup->info.polarity = agpio->polarity;
796-
lookup->info.triggering = agpio->triggering;
795+
if (info->gpioint) {
796+
info->polarity = agpio->polarity;
797+
info->triggering = agpio->triggering;
797798
} else {
798-
lookup->info.polarity = params->active_low;
799+
info->polarity = params->active_low;
799800
}
800801

801-
lookup->info.flags = acpi_gpio_to_gpiod_flags(agpio, lookup->info.polarity);
802+
info->flags = acpi_gpio_to_gpiod_flags(agpio, info->polarity);
802803
}
803804

804805
return 1;
805806
}
806807

807808
static int acpi_gpio_resource_lookup(struct acpi_gpio_lookup *lookup)
808809
{
809-
struct acpi_device *adev = lookup->info.adev;
810+
struct acpi_gpio_info *info = lookup->info;
811+
struct acpi_device *adev = info->adev;
810812
struct list_head res_list;
811813
int ret;
812814

@@ -831,6 +833,7 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode, const char *p
831833
{
832834
struct fwnode_reference_args args;
833835
struct acpi_gpio_params *params = &lookup->params;
836+
struct acpi_gpio_info *info = lookup->info;
834837
unsigned int index = params->crs_entry_index;
835838
unsigned int quirks = 0;
836839
int ret;
@@ -858,8 +861,8 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode, const char *p
858861
params->line_index = args.args[1];
859862
params->active_low = !!args.args[2];
860863

861-
lookup->info.adev = to_acpi_device_node(args.fwnode);
862-
lookup->info.quirks = quirks;
864+
info->adev = to_acpi_device_node(args.fwnode);
865+
info->quirks = quirks;
863866

864867
return 0;
865868
}
@@ -891,8 +894,8 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode, const char *p
891894
static int acpi_get_gpiod_by_index(struct acpi_device *adev, const char *propname,
892895
struct acpi_gpio_lookup *lookup)
893896
{
894-
struct acpi_gpio_info *info = &lookup->info;
895897
struct acpi_gpio_params *params = &lookup->params;
898+
struct acpi_gpio_info *info = lookup->info;
896899
int ret;
897900

898901
if (propname) {
@@ -973,6 +976,7 @@ __acpi_find_gpio(struct fwnode_handle *fwnode, const char *con_id, unsigned int
973976

974977
memset(&lookup, 0, sizeof(lookup));
975978
lookup.params.crs_entry_index = idx;
979+
lookup.info = info;
976980

977981
/* Try first from _DSD */
978982
for_each_gpio_property_name(propname, con_id) {

0 commit comments

Comments
 (0)