[PATCH] backports: include: introduce backport for ACPI_COMPANION() macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
---
Not sure if this correctly does conversion from ACPI handle to acpi_device.

Regards,
Arend
---
 backport/backport-include/linux/acpi.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/backport/backport-include/linux/acpi.h b/backport/backport-include/linux/acpi.h
index 506df15..ff55d76 100644
--- a/backport/backport-include/linux/acpi.h
+++ b/backport/backport-include/linux/acpi.h
@@ -36,4 +36,22 @@
 #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 */
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux