Skip to contentSkip to conversation

ACPI_COMPANION equivalent in older kernels

DISCUSSION Arend van Spriel 2 participants 2 messages Jun 10, 2015 ACPI

lore
Share & tools
lore
#0 lore raw

For backporting a driver to 3.11 kernel I would like to know how to get same functionality as ACPI_COMPANION(). I did it like below, but would like to have some confirmation on it.

Regards,
Arend --8<------------------------------------------------------------------ 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)

#1 lore raw
Quoted 3 lines · Arend van Spriel

For backporting a driver to 3.11 kernel I would like to know how to get same functionality as ACPI_COMPANION(). I did it like below, but would like to have some confirmation on it.

Yes, that should work in general.

Quoted 18 lines

--8<------------------------------------------------------------------ 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)
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.