From patchwork Thu Jul 15 02:46:44 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Rui" X-Patchwork-Id: 112170 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6F2i7Ys004310 for ; Thu, 15 Jul 2010 02:44:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932156Ab0GOCok (ORCPT ); Wed, 14 Jul 2010 22:44:40 -0400 Received: from mga09.intel.com ([134.134.136.24]:24435 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932128Ab0GOCoj (ORCPT ); Wed, 14 Jul 2010 22:44:39 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 14 Jul 2010 19:43:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.55,205,1278313200"; d="scan'208";a="535639805" Received: from rzhang1-desktop.sh.intel.com (HELO [10.239.36.208]) ([10.239.36.208]) by orsmga002.jf.intel.com with ESMTP; 14 Jul 2010 19:45:09 -0700 Subject: [PATCH 9/9] ACPI thermal: make procfs I/F depend on CONFIG_ACPI_PROCFS From: Zhang Rui To: "Brown, Len" Cc: "linux-acpi@vger.kernel.org" , "Zhang, Rui" Date: Thu, 15 Jul 2010 10:46:44 +0800 Message-ID: <1279162004.4537.8522.camel@rzhang1-desktop> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 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]); Thu, 15 Jul 2010 02:44:41 +0000 (UTC) Index: linux-2.6/drivers/acpi/thermal.c =================================================================== --- linux-2.6.orig/drivers/acpi/thermal.c +++ linux-2.6/drivers/acpi/thermal.c @@ -37,10 +37,14 @@ #include #include #include + +#ifdef CONFIG_ACPI_PROCFS #include +#include +#endif + #include #include -#include #include #include #include @@ -102,16 +106,6 @@ static int acpi_thermal_add(struct acpi_ static int acpi_thermal_remove(struct acpi_device *device, int type); static int acpi_thermal_resume(struct acpi_device *device); static void acpi_thermal_notify(struct acpi_device *device, u32 event); -static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file); -static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file); -static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file); -static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file); -static ssize_t acpi_thermal_write_cooling_mode(struct file *, - const char __user *, size_t, - loff_t *); -static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file); -static ssize_t acpi_thermal_write_polling(struct file *, const char __user *, - size_t, loff_t *); static const struct acpi_device_id thermal_device_ids[] = { {ACPI_THERMAL_HID, 0}, @@ -201,6 +195,18 @@ struct acpi_thermal { struct mutex lock; }; +#ifdef CONFIG_ACPI_PROCFS +static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file); +static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file); +static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file); +static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file); +static ssize_t acpi_thermal_write_cooling_mode(struct file *, + const char __user *, size_t, + loff_t *); +static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file); +static ssize_t acpi_thermal_write_polling(struct file *, const char __user *, + size_t, loff_t *); + static const struct file_operations acpi_thermal_state_fops = { .owner = THIS_MODULE, .open = acpi_thermal_state_open_fs, @@ -242,6 +248,7 @@ static const struct file_operations acpi .llseek = seq_lseek, .release = single_release, }; +#endif /* CONFIG_ACPI_PROCFS*/ /* -------------------------------------------------------------------------- Thermal Zone Management @@ -287,26 +294,6 @@ static int acpi_thermal_get_polling_freq return 0; } -static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds) -{ - - if (!tz) - return -EINVAL; - - tz->polling_frequency = seconds * 10; /* Convert value to deci-seconds */ - - tz->thermal_zone->polling_delay = seconds * 1000; - - if (tz->tz_enabled) - thermal_zone_device_update(tz->thermal_zone); - - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Polling frequency set to %lu seconds\n", - tz->polling_frequency/10)); - - return 0; -} - static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode) { acpi_status status = AE_OK; @@ -973,7 +960,7 @@ static void acpi_thermal_unregister_ther /* -------------------------------------------------------------------------- FS Interface (/proc) -------------------------------------------------------------------------- */ - +#ifdef CONFIG_ACPI_PROCFS static struct proc_dir_entry *acpi_thermal_dir; static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset) @@ -1187,6 +1174,26 @@ static int acpi_thermal_polling_open_fs( PDE(inode)->data); } +static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds) +{ + if (!tz) + return -EINVAL; + + /* Convert value to deci-seconds */ + tz->polling_frequency = seconds * 10; + + tz->thermal_zone->polling_delay = seconds * 1000; + + if (tz->tz_enabled) + thermal_zone_device_update(tz->thermal_zone); + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Polling frequency set to %lu seconds\n", + tz->polling_frequency/10)); + + return 0; +} + static ssize_t acpi_thermal_write_polling(struct file *file, const char __user * buffer, @@ -1295,7 +1302,13 @@ static int acpi_thermal_remove_fs(struct return 0; } - +#else +static inline int acpi_thermal_add_fs(struct acpi_device *device) { return 0; } +static inline int acpi_thermal_remove_fs(struct acpi_device *device) +{ + return 0; +} +#endif /* CONFIG_ACPI_PROCFS */ /* -------------------------------------------------------------------------- Driver Interface -------------------------------------------------------------------------- */ @@ -1566,13 +1579,18 @@ static int __init acpi_thermal_init(void 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; } @@ -1584,7 +1602,9 @@ static void __exit acpi_thermal_exit(voi acpi_bus_unregister_driver(&acpi_thermal_driver); +#ifdef CONFIG_ACPI_PROCFS remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); +#endif return; } Index: linux-2.6/drivers/acpi/Kconfig =================================================================== --- linux-2.6.orig/drivers/acpi/Kconfig +++ linux-2.6/drivers/acpi/Kconfig @@ -57,6 +57,7 @@ config ACPI_PROCFS /proc/acpi/processor/*/throttling (/sys/class/thermal/ cooling_device*/*) /proc/acpi/video/*/brightness (/sys/class/backlight/) + /proc/acpi/thermal_zone/*/* (/sys/class/thermal/) This option has no effect on /proc/acpi/ files and functions which do not yet exist in /sys.