From 2ccf2d7e314398fe4680c164bf972e59633e2a6e Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Mon, 6 Jun 2016 02:20:29 +0200 Subject: [PATCH] Define ACPI_HANDLE macro for older versions ACPI_HANDLE was added in Linux 3.8, DEVICE_ACPI_HANDLE is gone in Linux 3.13. Move the definition a bit higher, maybe we can reuse it later. --- bbswitch.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/bbswitch.c b/bbswitch.c index 341608f..15ab30c 100644 --- a/bbswitch.c +++ b/bbswitch.c @@ -35,6 +35,11 @@ #include #include #include +#include + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0) +# define ACPI_HANDLE DEVICE_ACPI_HANDLE +#endif #define BBSWITCH_VERSION "0.8" @@ -403,13 +408,7 @@ static int __init bbswitch_init(void) { pci_class != PCI_CLASS_DISPLAY_3D) continue; -#ifdef ACPI_HANDLE - /* since Linux 3.8 */ handle = ACPI_HANDLE(&pdev->dev); -#else - /* removed since Linux 3.13 */ - handle = DEVICE_ACPI_HANDLE(&pdev->dev); -#endif if (!handle) { pr_warn("cannot find ACPI handle for VGA device %s\n", dev_name(&pdev->dev));