Commit 5870cff4 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Linus Walleij

gpiolib: acpi: Move adev member to struct acpi_gpio_info

The further improvements are based on this change since
struct acpi_gpio_lookup is not available in some cases.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 08be1a79
...@@ -494,7 +494,6 @@ struct acpi_gpio_lookup { ...@@ -494,7 +494,6 @@ struct acpi_gpio_lookup {
int index; int index;
int pin_index; int pin_index;
bool active_low; bool active_low;
struct acpi_device *adev;
struct gpio_desc *desc; struct gpio_desc *desc;
int n; int n;
}; };
...@@ -541,12 +540,13 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data) ...@@ -541,12 +540,13 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data)
static int acpi_gpio_resource_lookup(struct acpi_gpio_lookup *lookup, static int acpi_gpio_resource_lookup(struct acpi_gpio_lookup *lookup,
struct acpi_gpio_info *info) struct acpi_gpio_info *info)
{ {
struct acpi_device *adev = lookup->info.adev;
struct list_head res_list; struct list_head res_list;
int ret; int ret;
INIT_LIST_HEAD(&res_list); INIT_LIST_HEAD(&res_list);
ret = acpi_dev_get_resources(lookup->adev, &res_list, ret = acpi_dev_get_resources(adev, &res_list,
acpi_populate_gpio_lookup, acpi_populate_gpio_lookup,
lookup); lookup);
if (ret < 0) if (ret < 0)
...@@ -592,7 +592,7 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode, ...@@ -592,7 +592,7 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode,
lookup->pin_index = args.args[1]; lookup->pin_index = args.args[1];
lookup->active_low = !!args.args[2]; lookup->active_low = !!args.args[2];
lookup->adev = args.adev; lookup->info.adev = args.adev;
return 0; return 0;
} }
...@@ -640,11 +640,11 @@ static struct gpio_desc *acpi_get_gpiod_by_index(struct acpi_device *adev, ...@@ -640,11 +640,11 @@ static struct gpio_desc *acpi_get_gpiod_by_index(struct acpi_device *adev,
return ERR_PTR(ret); return ERR_PTR(ret);
dev_dbg(&adev->dev, "GPIO: _DSD returned %s %d %d %u\n", dev_dbg(&adev->dev, "GPIO: _DSD returned %s %d %d %u\n",
dev_name(&lookup.adev->dev), lookup.index, dev_name(&lookup.info.adev->dev), lookup.index,
lookup.pin_index, lookup.active_low); lookup.pin_index, lookup.active_low);
} else { } else {
dev_dbg(&adev->dev, "GPIO: looking up %d in _CRS\n", index); dev_dbg(&adev->dev, "GPIO: looking up %d in _CRS\n", index);
lookup.adev = adev; lookup.info.adev = adev;
} }
ret = acpi_gpio_resource_lookup(&lookup, info); ret = acpi_gpio_resource_lookup(&lookup, info);
......
...@@ -75,12 +75,14 @@ struct gpio_device { ...@@ -75,12 +75,14 @@ struct gpio_device {
/** /**
* struct acpi_gpio_info - ACPI GPIO specific information * struct acpi_gpio_info - ACPI GPIO specific information
* @adev: reference to ACPI device which consumes GPIO resource
* @flags: GPIO initialization flags * @flags: GPIO initialization flags
* @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo * @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo
* @polarity: interrupt polarity as provided by ACPI * @polarity: interrupt polarity as provided by ACPI
* @triggering: triggering type as provided by ACPI * @triggering: triggering type as provided by ACPI
*/ */
struct acpi_gpio_info { struct acpi_gpio_info {
struct acpi_device *adev;
enum gpiod_flags flags; enum gpiod_flags flags;
bool gpioint; bool gpioint;
int polarity; int polarity;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment