Skip to contentSkip to conversation

backports: include: introduce backport for ACPI_COMPANION() macro

PATCH In review Arend van Spriel 2 participants 2 messages May 27, 2015 – Jun 9, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 backports: include: introduce backport for ACPI_COMPANION() macro

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.

---
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(+)
backport/backport-include/linux/acpi.h +18 -0
index 506df15..ff55d76 100644
@@ -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 */
Signature · 1 line
1.9.1
#1 lore raw
Quoted 5 lines · Arend van Spriel

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.

Thanks Arend, applied and pushed!

Luis