backports: include: introduce backport for ACPI_COMPANION() macro
authorArend van Spriel <arend@broadcom.com>
Wed, 27 May 2015 19:15:05 +0000 (21:15 +0200)
committerLuis R. Rodriguez <mcgrof@do-not-panic.com>
Tue, 9 Jun 2015 21:56:32 +0000 (14:56 -0700)
The brcmfmac driver now uses the ACPI_COMPANION() macro which was
introduced in v3.13 kernel. This provides a backport of that macro
for older kernels.

Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
backport/backport-include/linux/acpi.h

index 506df15a5dc2b2791230532b6f1044491a21662e..ff55d76e5536849eae4fd26d8b9e48eb8f29f36e 100644 (file)
 #endif /* CONFIG_ACPI */
 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0) */
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
+#ifdef CONFIG_ACPI
+static inline struct acpi_device *_acpi_get_companion(struct device *dev)
+{
+       struct acpi_device *adev;
+       int ret;
+
+       ret = acpi_bus_get_device(ACPI_HANDLE(dev), &adev);
+       if (ret < 0)
+               adev = NULL;
+
+       return adev;
+}
+#define ACPI_COMPANION(dev)    _acpi_get_companion(dev)
+#else
+#define ACPI_COMPANION(dev)    (NULL)
+#endif /* CONFIG_ACPI */
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) */
 #endif /* __BACKPORT_LINUX_ACPI_H */