ACPI: Add helper acpi_use_parent_companion
authorHeiner Kallweit <hkallweit1@gmail.com>
Sun, 15 Oct 2023 21:34:25 +0000 (23:34 +0200)
committerWolfram Sang <wsa@kernel.org>
Sat, 28 Oct 2023 13:30:24 +0000 (15:30 +0200)
In several drivers devices use the ACPI companion of the parent.
Add a helper for this use case to avoid code duplication.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
include/linux/acpi.h

index a73246c3c35e083541b2e33638c575b6910497ba..d17a280ce7c7c8913e37de79fc6675e8eb8855b9 100644 (file)
@@ -1539,4 +1539,9 @@ static inline void acpi_device_notify(struct device *dev) { }
 static inline void acpi_device_notify_remove(struct device *dev) { }
 #endif
 
+static inline void acpi_use_parent_companion(struct device *dev)
+{
+       ACPI_COMPANION_SET(dev, ACPI_COMPANION(dev->parent));
+}
+
 #endif /*_LINUX_ACPI_H*/