Some quirks may need an additional data to be provided. Introduce special quirks data field. Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> --- drivers/gpio/gpiolib-acpi.c | 13 +++++++------ drivers/gpio/gpiolib-acpi.h | 2 ++ include/linux/gpio/consumer.h | 1 + 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 9276051663da..3aa976f9ad1a 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -502,7 +502,7 @@ EXPORT_SYMBOL_GPL(devm_acpi_dev_remove_driver_gpios); static bool acpi_get_driver_gpio_data(struct acpi_device *adev, const char *name, int index, struct fwnode_reference_args *args, - unsigned int *quirks) + struct acpi_gpio_info *info) { const struct acpi_gpio_mapping *gm; @@ -519,7 +519,8 @@ static bool acpi_get_driver_gpio_data(struct acpi_device *adev, args->args[2] = par->active_low; args->nargs = 3; - *quirks = gm->quirks; + info->quirks = gm->quirks; + info->quirks_data = gm->quirks_data; return true; } @@ -716,7 +717,7 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode, struct acpi_gpio_lookup *lookup) { struct fwnode_reference_args args; - unsigned int quirks = 0; + struct acpi_gpio_info info = {}; int ret; memset(&args, 0, sizeof(args)); @@ -728,8 +729,7 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode, if (!adev) return ret; - if (!acpi_get_driver_gpio_data(adev, propname, index, &args, - &quirks)) + if (!acpi_get_driver_gpio_data(adev, propname, index, &args, &info)) return ret; } /* @@ -746,7 +746,8 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode, lookup->active_low = !!args.args[2]; lookup->info.adev = to_acpi_device_node(args.fwnode); - lookup->info.quirks = quirks; + lookup->info.quirks = info.quirks; + lookup->info.quirks_data = info.quirks_data; return 0; } diff --git a/drivers/gpio/gpiolib-acpi.h b/drivers/gpio/gpiolib-acpi.h index 1c6d65cf0629..44cf55c9d35d 100644 --- a/drivers/gpio/gpiolib-acpi.h +++ b/drivers/gpio/gpiolib-acpi.h @@ -19,6 +19,7 @@ struct acpi_device; * @polarity: interrupt polarity as provided by ACPI * @triggering: triggering type as provided by ACPI * @quirks: Linux specific quirks as provided by struct acpi_gpio_mapping + * @quirks_data: optional data for the specific @quirks */ struct acpi_gpio_info { struct acpi_device *adev; @@ -28,6 +29,7 @@ struct acpi_gpio_info { int polarity; int triggering; unsigned int quirks; + unsigned long quirks_data; }; #ifdef CONFIG_ACPI diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h index 901aab89d025..49743a499fda 100644 --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h @@ -676,6 +676,7 @@ struct acpi_gpio_mapping { #define ACPI_GPIO_QUIRK_ONLY_GPIOIO BIT(1) unsigned int quirks; + unsigned long quirks_data; }; #if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_ACPI) -- 2.26.2