]> Git Repo - J-linux.git/commitdiff
Merge remote-tracking branch 'linux-pm/acpi-scan' into review-hans
authorHans de Goede <[email protected]>
Wed, 16 Jun 2021 15:48:22 +0000 (17:48 +0200)
committerHans de Goede <[email protected]>
Wed, 16 Jun 2021 15:48:22 +0000 (17:48 +0200)
1  2 
drivers/gpio/gpiolib-acpi.c
drivers/platform/surface/aggregator/core.c
include/linux/acpi.h

index cf99a5752fe096dd9f1b4439d230203d0d16cde8,5b4111e4be3f4e34614ecee6310f6ed3e5b8744b..411525ac4cc45c020642592946d215ccd81363ee
@@@ -128,34 -128,6 +128,34 @@@ static struct gpio_desc *acpi_get_gpiod
        return gpiochip_get_desc(chip, pin);
  }
  
 +/**
 + * acpi_get_and_request_gpiod - Translate ACPI GPIO pin to GPIO descriptor and
 + *                              hold a refcount to the GPIO device.
 + * @path:      ACPI GPIO controller full path name, (e.g. "\\_SB.GPO1")
 + * @pin:       ACPI GPIO pin number (0-based, controller-relative)
 + * @label:     Label to pass to gpiod_request()
 + *
 + * This function is a simple pass-through to acpi_get_gpiod(), except that
 + * as it is intended for use outside of the GPIO layer (in a similar fashion to
 + * gpiod_get_index() for example) it also holds a reference to the GPIO device.
 + */
 +struct gpio_desc *acpi_get_and_request_gpiod(char *path, int pin, char *label)
 +{
 +      struct gpio_desc *gpio;
 +      int ret;
 +
 +      gpio = acpi_get_gpiod(path, pin);
 +      if (IS_ERR(gpio))
 +              return gpio;
 +
 +      ret = gpiod_request(gpio, label);
 +      if (ret)
 +              return ERR_PTR(ret);
 +
 +      return gpio;
 +}
 +EXPORT_SYMBOL_GPL(acpi_get_and_request_gpiod);
 +
  static irqreturn_t acpi_gpio_irq_handler(int irq, void *data)
  {
        struct acpi_gpio_event *event = data;
@@@ -196,29 -168,6 +196,29 @@@ bool acpi_gpio_get_irq_resource(struct 
  }
  EXPORT_SYMBOL_GPL(acpi_gpio_get_irq_resource);
  
 +/**
 + * acpi_gpio_get_io_resource - Fetch details of an ACPI resource if it is a GPIO
 + *                           I/O resource or return False if not.
 + * @ares:     Pointer to the ACPI resource to fetch
 + * @agpio:    Pointer to a &struct acpi_resource_gpio to store the output pointer
 + */
 +bool acpi_gpio_get_io_resource(struct acpi_resource *ares,
 +                             struct acpi_resource_gpio **agpio)
 +{
 +      struct acpi_resource_gpio *gpio;
 +
 +      if (ares->type != ACPI_RESOURCE_TYPE_GPIO)
 +              return false;
 +
 +      gpio = &ares->data.gpio;
 +      if (gpio->connection_type != ACPI_RESOURCE_GPIO_TYPE_IO)
 +              return false;
 +
 +      *agpio = gpio;
 +      return true;
 +}
 +EXPORT_SYMBOL_GPL(acpi_gpio_get_io_resource);
 +
  static void acpi_gpiochip_request_irq(struct acpi_gpio_chip *acpi_gpio,
                                      struct acpi_gpio_event *event)
  {
@@@ -1284,14 -1233,14 +1284,14 @@@ static void acpi_gpiochip_scan_gpios(st
  void acpi_gpiochip_add(struct gpio_chip *chip)
  {
        struct acpi_gpio_chip *acpi_gpio;
-       acpi_handle handle;
+       struct acpi_device *adev;
        acpi_status status;
  
        if (!chip || !chip->parent)
                return;
  
-       handle = ACPI_HANDLE(chip->parent);
-       if (!handle)
+       adev = ACPI_COMPANION(chip->parent);
+       if (!adev)
                return;
  
        acpi_gpio = kzalloc(sizeof(*acpi_gpio), GFP_KERNEL);
        INIT_LIST_HEAD(&acpi_gpio->events);
        INIT_LIST_HEAD(&acpi_gpio->deferred_req_irqs_list_entry);
  
-       status = acpi_attach_data(handle, acpi_gpio_chip_dh, acpi_gpio);
+       status = acpi_attach_data(adev->handle, acpi_gpio_chip_dh, acpi_gpio);
        if (ACPI_FAILURE(status)) {
                dev_err(chip->parent, "Failed to attach ACPI GPIO chip\n");
                kfree(acpi_gpio);
  
        acpi_gpiochip_request_regions(acpi_gpio);
        acpi_gpiochip_scan_gpios(acpi_gpio);
-       acpi_walk_dep_device_list(handle);
+       acpi_dev_clear_dependencies(adev);
  }
  
  void acpi_gpiochip_remove(struct gpio_chip *chip)
index 5d780e55f4a1ea60b72dc9a3c44316f6b5d4bd62,517f774a6e60f17efc935dcc7b10016741525c08..279d9df19c0174f5dfcf8649eb3506133d56d67e
@@@ -7,7 -7,7 +7,7 @@@
   * Handles communication via requests as well as enabling, disabling, and
   * relaying of events.
   *
 - * Copyright (C) 2019-2020 Maximilian Luz <[email protected]>
 + * Copyright (C) 2019-2021 Maximilian Luz <[email protected]>
   */
  
  #include <linux/acpi.h>
@@@ -621,8 -621,8 +621,8 @@@ static const struct acpi_gpio_mapping s
  
  static int ssam_serial_hub_probe(struct serdev_device *serdev)
  {
+       struct acpi_device *ssh = ACPI_COMPANION(&serdev->dev);
        struct ssam_controller *ctrl;
-       acpi_handle *ssh = ACPI_HANDLE(&serdev->dev);
        acpi_status astatus;
        int status;
  
        if (status)
                goto err_devopen;
  
-       astatus = ssam_serdev_setup_via_acpi(ssh, serdev);
+       astatus = ssam_serdev_setup_via_acpi(ssh->handle, serdev);
        if (ACPI_FAILURE(astatus)) {
                status = -ENXIO;
                goto err_devinit;
         *       For now let's thus default power/wakeup to false.
         */
        device_set_wakeup_capable(&serdev->dev, true);
-       acpi_walk_dep_device_list(ssh);
+       acpi_dev_clear_dependencies(ssh);
  
        return 0;
  
diff --combined include/linux/acpi.h
index a74d37a3b6185ac692891535fec36e1beddc1c14,170b9bebdb2be4c9bd567857499b37b86e51d29a..e8ba7063c000cdc1a1b5dc2d5cfc5532c3c28771
@@@ -666,7 -666,9 +666,9 @@@ extern bool acpi_driver_match_device(st
                                     const struct device_driver *drv);
  int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *);
  int acpi_device_modalias(struct device *, char *, int);
- void acpi_walk_dep_device_list(acpi_handle handle);
+ int acpi_walk_dep_device_list(acpi_handle handle,
+                             int (*callback)(struct acpi_dep_data *, void *),
+                             void *data);
  
  struct platform_device *acpi_create_platform_device(struct acpi_device *,
                                                    struct property_entry *);
@@@ -1096,8 -1098,6 +1098,8 @@@ void __acpi_handle_debug(struct _ddebu
  #if defined(CONFIG_ACPI) && defined(CONFIG_GPIOLIB)
  bool acpi_gpio_get_irq_resource(struct acpi_resource *ares,
                                struct acpi_resource_gpio **agpio);
 +bool acpi_gpio_get_io_resource(struct acpi_resource *ares,
 +                             struct acpi_resource_gpio **agpio);
  int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, const char *name, int index);
  #else
  static inline bool acpi_gpio_get_irq_resource(struct acpi_resource *ares,
  {
        return false;
  }
 +static inline bool acpi_gpio_get_io_resource(struct acpi_resource *ares,
 +                                           struct acpi_resource_gpio **agpio)
 +{
 +      return false;
 +}
  static inline int acpi_dev_gpio_irq_get_by(struct acpi_device *adev,
                                           const char *name, int index)
  {
This page took 0.077668 seconds and 4 git commands to generate.