summaryrefslogtreecommitdiff
path: root/include/linux/acpi.h
diff options
context:
space:
mode:
authorOctavian Purdila <octavian.purdila@intel.com>2016-07-08 19:13:08 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-07-08 21:52:34 +0200
commit10c7e20b2ff3caa5a8c0e7d60aef5a9c86e60ce8 (patch)
tree8931f22bd95059c3872b4363314ba2bb547703ee /include/linux/acpi.h
parent14d24c39e7f4de1bd3aa3a0379ad3c0d8129a155 (diff)
ACPI / scan: fix enumeration (visited) flags for bus rescans
If the ACPI tables change as a result of a dinamically loaded table and a bus rescan is required the enumeration/visited flag are not consistent. I2C/SPI are not directly enumerated in acpi_bus_attach(), however the visited flag is set. This makes it impossible to check if an ACPI device has already been enumerated by the I2C and SPI subsystems. To fix this issue we only set the visited flags if the device is not I2C or SPI. With this change we also need to remove setting visited to false from acpi_bus_attach(), otherwise if we rescan already enumerated I2C/SPI devices we try to re-enumerate them. Note that I2C/SPI devices can be enumerated either via a scan handler (when using PRP0001) or via regular device_attach(). In either case the flow goes through acpi_default_enumeration() which makes it the ideal place to mark the ACPI device as enumerated. Signed-off-by: Octavian Purdila <octavian.purdila@intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/linux/acpi.h')
-rw-r--r--include/linux/acpi.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index ef2ad26abede..db680e8788c4 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -531,6 +531,16 @@ void acpi_walk_dep_device_list(acpi_handle handle);
struct platform_device *acpi_create_platform_device(struct acpi_device *);
#define ACPI_PTR(_ptr) (_ptr)
+static inline void acpi_device_set_enumerated(struct acpi_device *adev)
+{
+ adev->flags.visited = true;
+}
+
+static inline void acpi_device_clear_enumerated(struct acpi_device *adev)
+{
+ adev->flags.visited = false;
+}
+
#else /* !CONFIG_ACPI */
#define acpi_disabled 1
@@ -676,6 +686,14 @@ static inline enum dev_dma_attr acpi_get_dma_attr(struct acpi_device *adev)
#define ACPI_PTR(_ptr) (NULL)
+static inline void acpi_device_set_enumerated(struct acpi_device *adev)
+{
+}
+
+static inline void acpi_device_clear_enumerated(struct acpi_device *adev)
+{
+}
+
#endif /* !CONFIG_ACPI */
#ifdef CONFIG_ACPI