From patchwork Mon Feb 1 21:16:09 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthew W. S. Bell" X-Patchwork-Id: 76168 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o11LsNsi024234 for ; Mon, 1 Feb 2010 21:54:24 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752499Ab0BAVyY (ORCPT ); Mon, 1 Feb 2010 16:54:24 -0500 Received: from garuda.bells23.org.uk ([85.13.250.28]:59524 "EHLO garuda.bells23.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752293Ab0BAVyX (ORCPT ); Mon, 1 Feb 2010 16:54:23 -0500 Received: from localhost ([127.0.0.1] helo=garuda.bells23.org.uk) by garuda.bells23.org.uk with esmtp (Exim 4.69) (envelope-from ) id 1Nc3fB-0003UP-B7 for linux-acpi@vger.kernel.org; Mon, 01 Feb 2010 21:18:29 +0000 Received: from [80.65.240.47] (port=56938 helo=[192.168.1.230]) by garuda.bells23.org.uk with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1Nc3fA-0003UL-6Y for linux-acpi@vger.kernel.org; Mon, 01 Feb 2010 21:18:29 +0000 Subject: [PATCH 1/2] Gracefully handle disabled ACPI and a lack of procfs. From: "Matthew W. S. Bell" Reply-To: matthew@bells23.org.uk, linux-acpi@vger.kernel.org To: linux-acpi@vger.kernel.org Date: Mon, 01 Feb 2010 21:16:09 +0000 Message-ID: <1265058969.3824.10.camel@ibis.bells> Mime-Version: 1.0 X-Mailer: Evolution 2.29.5 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 01 Feb 2010 21:54:25 +0000 (UTC) diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index 28ccdbc..1477243 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c @@ -529,9 +529,12 @@ static int __init acpi_memory_device_init(void) int result; acpi_status status; + if (acpi_disabled) { + printk(KERN_ERR AE_INFO ": ACPI is disabled.\n"); + return -ENODEV; + } result = acpi_bus_register_driver(&acpi_memory_device_driver); - if (result < 0) return -ENODEV; @@ -539,7 +542,6 @@ static int __init acpi_memory_device_init(void) ACPI_UINT32_MAX, acpi_memory_register_notify_handler, NULL, NULL); - if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "walk_namespace failed")); acpi_bus_unregister_driver(&acpi_memory_device_driver); diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index 0d2cdb8..e53cb6b 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c @@ -495,6 +495,11 @@ static struct acpi_driver acpi_pad_driver = { static int __init acpi_pad_init(void) { + if (acpi_disabled) { + printk(KERN_ERR AE_INFO ": ACPI is disabled.\n"); + return -ENODEV; + } + power_saving_mwait_init(); if (power_saving_mwait_eax == 0) return -EINVAL; diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 8a95e83..a5a6f84 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c @@ -456,13 +456,22 @@ static int __init acpi_button_init(void) { int result; + if (acpi_disabled) { + printk(KERN_ERR AE_INFO ": ACPI is disabled.\n"); + return -ENODEV; + } + +#ifdef CONFIG_ACPI_PROCFS acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir); if (!acpi_button_dir) return -ENODEV; +#endif result = acpi_bus_register_driver(&acpi_button_driver); if (result < 0) { +#ifdef CONFIG_ACPI_PROCFS remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); +#endif return -ENODEV; } diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index 642bb30..46ae7df 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c @@ -249,6 +249,11 @@ static int __init acpi_container_init(void) int result = 0; int action = INSTALL_NOTIFY_HANDLER; + if (acpi_disabled) { + printk(KERN_ERR AE_INFO ": ACPI is disabled.\n"); + return -ENODEV; + } + result = acpi_bus_register_driver(&acpi_container_driver); if (result < 0) { return (result); diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index f419849..52f6419 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c @@ -347,6 +347,10 @@ static int __init acpi_fan_init(void) { int result = 0; + if (acpi_disabled) { + printk(KERN_ERR AE_INFO ": ACPI is disabled.\n"); + return -ENODEV; + } #ifdef CONFIG_ACPI_PROCFS acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir); @@ -356,7 +360,9 @@ static int __init acpi_fan_init(void) result = acpi_bus_register_driver(&acpi_fan_driver); if (result < 0) { +#ifdef CONFIG_ACPI_PROCFS remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir); +#endif return -ENODEV; } diff --git a/drivers/acpi/pci_slot.c b/drivers/acpi/pci_slot.c index 45da2ba..91de70f 100644 --- a/drivers/acpi/pci_slot.c +++ b/drivers/acpi/pci_slot.c @@ -355,7 +355,12 @@ static struct dmi_system_id acpi_pci_slot_dmi_table[] __initdata = { static int __init acpi_pci_slot_init(void) -{ +{ + if (acpi_disabled) { + printk(KERN_ERR AE_INFO ": ACPI is disabled.\n"); + return -ENODEV; + } + dmi_check_system(acpi_pci_slot_dmi_table); acpi_pci_register_driver(&acpi_pci_slot_driver); return 0; diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c index d933980..f00780e 100644 --- a/drivers/acpi/sbshc.c +++ b/drivers/acpi/sbshc.c @@ -312,6 +312,11 @@ static int __init acpi_smb_hc_init(void) { int result; + if (acpi_disabled) { + printk(KERN_ERR AE_INFO ": ACPI is disabled.\n"); + return -ENODEV; + } + result = acpi_bus_register_driver(&acpi_smb_hc_driver); if (result < 0) return -ENODEV; diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 65f6781..cdbb827 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -1534,19 +1534,29 @@ static int __init acpi_thermal_init(void) { int result = 0; + if (acpi_disabled) { + printk(KERN_ERR AE_INFO ": ACPI is disabled.\n"); + return -ENODEV; + } + dmi_check_system(thermal_dmi_table); if (off) { printk(KERN_NOTICE "ACPI: thermal control disabled\n"); return -ENODEV; } + +#ifdef CONFIG_ACPI_PROCFS acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir); if (!acpi_thermal_dir) return -ENODEV; +#endif result = acpi_bus_register_driver(&acpi_thermal_driver); if (result < 0) { +#ifdef CONFIG_ACPI_PROCFS remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); +#endif return -ENODEV; } diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 05dff63..045e634 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -2379,13 +2379,17 @@ int acpi_video_register(void) return 0; } +#ifdef CONFIG_ACPI_PROCFS acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir); if (!acpi_video_dir) return -ENODEV; +#endif result = acpi_bus_register_driver(&acpi_video_bus); if (result < 0) { +#ifdef CONFIG_ACPI_PROCFS remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir); +#endif return -ENODEV; } @@ -2427,6 +2431,11 @@ EXPORT_SYMBOL(acpi_video_unregister); static int __init acpi_video_init(void) { + if (acpi_disabled) { + printk(KERN_ERR AE_INFO ": ACPI is disabled.\n"); + return -ENODEV; + } + dmi_check_system(video_dmi_table); if (intel_opregion_present())