* ACPI_COMPANION equivalent in older kernels
@ 2015-06-10 14:17 Arend van Spriel
2015-06-11 0:02 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Arend van Spriel @ 2015-06-10 14:17 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: ACPI Devel Maling List
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)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: ACPI_COMPANION equivalent in older kernels
2015-06-10 14:17 ACPI_COMPANION equivalent in older kernels Arend van Spriel
@ 2015-06-11 0:02 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2015-06-11 0:02 UTC (permalink / raw)
To: Arend van Spriel; +Cc: ACPI Devel Maling List
On Wednesday, June 10, 2015 04:17:44 PM Arend van Spriel wrote:
> 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.
> --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 majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-06-10 23:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-10 14:17 ACPI_COMPANION equivalent in older kernels Arend van Spriel
2015-06-11 0:02 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).