summaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorThomas Renninger <trenn@suse.de>2011-11-04 03:33:46 +0100
committerLen Brown <len.brown@intel.com>2011-11-06 20:48:42 -0500
commit362b646062b2073bd5c38efb42171d86e4f717e6 (patch)
tree6c98cdb7aa5d9be22e2b24ca06b822455ef4b9f5 /drivers/acpi
parentc3b92c8787367a8bb53d57d9789b558f1295cc96 (diff)
downloadop-kernel-dev-362b646062b2073bd5c38efb42171d86e4f717e6.zip
op-kernel-dev-362b646062b2073bd5c38efb42171d86e4f717e6.tar.gz
ACPI: Export FADT pm_profile integer value to userspace
There are a lot userspace approaches to detect the usage of the platform (laptop, workstation, server, ...) and adjust kernel tunables accordingly (io/process scheduler, power management, ...). These approaches need constant maintaining and are ugly to implement (detect PCMCIA controller -> laptop, does not work on recent systems anymore, ...) On ACPI systems there is an easy and reliable way (if implemented in BIOS and most recent platforms have this value set). -> export it to userspace. Signed-off-by: Thomas Renninger <trenn@suse.de> Acked-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/sysfs.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index c538d0e..9f66181 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -706,11 +706,23 @@ static void __exit interrupt_stats_exit(void)
return;
}
+static ssize_t
+acpi_show_profile(struct device *dev, struct device_attribute *attr,
+ char *buf)
+{
+ return sprintf(buf, "%d\n", acpi_gbl_FADT.preferred_profile);
+}
+
+static const struct device_attribute pm_profile_attr =
+ __ATTR(pm_profile, S_IRUGO, acpi_show_profile, NULL);
+
int __init acpi_sysfs_init(void)
{
int result;
result = acpi_tables_sysfs_init();
-
+ if (result)
+ return result;
+ result = sysfs_create_file(acpi_kobj, &pm_profile_attr.attr);
return result;
}
OpenPOWER on IntegriCloud