summaryrefslogtreecommitdiff
path: root/drivers/misc/pvpanic.c
diff options
context:
space:
mode:
authorPeng Hao <peng.hao2@zte.com.cn>2018-11-06 17:57:18 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-11-07 15:53:04 +0300
commit77703e0b0326a1fb06b5cb5b468a633472c5a8e9 (patch)
treed794dfe9005c4db3cfd510a9fdb35403002e2c8e /drivers/misc/pvpanic.c
parenta8b71d2735791f09788a13dda928f690a417c14a (diff)
downloadlinux-77703e0b0326a1fb06b5cb5b468a633472c5a8e9.tar.xz
misc/pvpanic : break dependency on ACPI
The pvpanic driver is available for architectures that do not support ACPI.So break the dependency. Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Peng Hao <peng.hao2@zte.com.cn> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/pvpanic.c')
-rw-r--r--drivers/misc/pvpanic.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/drivers/misc/pvpanic.c b/drivers/misc/pvpanic.c
index eabb53d077c5..aab06b890bb6 100644
--- a/drivers/misc/pvpanic.c
+++ b/drivers/misc/pvpanic.c
@@ -57,6 +57,7 @@ static struct notifier_block pvpanic_panic_nb = {
.priority = 1, /* let this called before broken drm_fb_helper */
};
+#ifdef CONFIG_ACPI
static int pvpanic_add(struct acpi_device *device);
static int pvpanic_remove(struct acpi_device *device);
@@ -126,6 +127,24 @@ static int pvpanic_remove(struct acpi_device *device)
return 0;
}
+static int pvpanic_register_acpi_driver(void)
+{
+ return acpi_bus_register_driver(&pvpanic_driver);
+}
+
+static void pvpanic_unregister_acpi_driver(void)
+{
+ acpi_bus_unregister_driver(&pvpanic_driver);
+}
+#else
+static int pvpanic_register_acpi_driver(void)
+{
+ return -ENODEV;
+}
+
+static void pvpanic_unregister_acpi_driver(void) {}
+#endif
+
static int pvpanic_mmio_probe(struct platform_device *pdev)
{
struct resource *mem;
@@ -172,7 +191,7 @@ static int __init pvpanic_mmio_init(void)
if (acpi_disabled)
return platform_driver_register(&pvpanic_mmio_driver);
else
- return acpi_bus_register_driver(&pvpanic_driver);
+ return pvpanic_register_acpi_driver();
}
static void __exit pvpanic_mmio_exit(void)
@@ -180,7 +199,7 @@ static void __exit pvpanic_mmio_exit(void)
if (acpi_disabled)
platform_driver_unregister(&pvpanic_mmio_driver);
else
- acpi_bus_unregister_driver(&pvpanic_driver);
+ pvpanic_unregister_acpi_driver();
}
module_init(pvpanic_mmio_init);