aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/sysfs.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-04-30 18:21:02 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-30 18:21:02 -0400
commit3ed1c478eff8db80e234d5446cb378b503135888 (patch)
treee1c8e0f488ca49c49b5a31fe59add4254381dd4b /drivers/acpi/sysfs.c
parent151173e8ce9b95bbbbd7eedb9035cfaffbdb7cb2 (diff)
parent371deb9500831ad1afbf9ea00e373f650deaed2f (diff)
Merge tag 'pm+acpi-3.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management and ACPI updates from Rafael J Wysocki: - ARM big.LITTLE cpufreq driver from Viresh Kumar. - exynos5440 cpufreq driver from Amit Daniel Kachhap. - cpufreq core cleanup and code consolidation from Viresh Kumar and Stratos Karafotis. - cpufreq scalability improvement from Nathan Zimmer. - AMD "frequency sensitivity feedback" powersave bias for the ondemand cpufreq governor from Jacob Shin. - cpuidle code consolidation and cleanups from Daniel Lezcano. - ARM OMAP cpuidle fixes from Santosh Shilimkar and Daniel Lezcano. - ACPICA fixes and other improvements from Bob Moore, Jung-uk Kim, Lv Zheng, Yinghai Lu, Tang Chen, Colin Ian King, and Linn Crosetto. - ACPI core updates related to hotplug from Toshi Kani, Paul Bolle, Yasuaki Ishimatsu, and Rafael J Wysocki. - Intel Lynxpoint LPSS (Low-Power Subsystem) support improvements from Rafael J Wysocki and Andy Shevchenko. * tag 'pm+acpi-3.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (192 commits) cpufreq: Revert incorrect commit 5800043 cpufreq: MAINTAINERS: Add co-maintainer cpuidle: add maintainer entry ACPI / thermal: do not always return THERMAL_TREND_RAISING for active trip points ARM: s3c64xx: cpuidle: use init/exit common routine cpufreq: pxa2xx: initialize variables ACPI: video: correct acpi_video_bus_add error processing SH: cpuidle: use init/exit common routine ARM: S5pv210: compiling issue, ARM_S5PV210_CPUFREQ needs CONFIG_CPU_FREQ_TABLE=y ACPI: Fix wrong parameter passed to memblock_reserve cpuidle: fix comment format pnp: use %*phC to dump small buffers isapnp: remove debug leftovers ARM: imx: cpuidle: use init/exit common routine ARM: davinci: cpuidle: use init/exit common routine ARM: kirkwood: cpuidle: use init/exit common routine ARM: calxeda: cpuidle: use init/exit common routine ARM: tegra: cpuidle: use init/exit common routine for tegra3 ARM: tegra: cpuidle: use init/exit common routine for tegra2 ARM: OMAP4: cpuidle: use init/exit common routine ...
Diffstat (limited to 'drivers/acpi/sysfs.c')
-rw-r--r--drivers/acpi/sysfs.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 41c0504470db..fcae5fa2e1b3 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -7,6 +7,8 @@
7#include <linux/moduleparam.h> 7#include <linux/moduleparam.h>
8#include <acpi/acpi_drivers.h> 8#include <acpi/acpi_drivers.h>
9 9
10#include "internal.h"
11
10#define _COMPONENT ACPI_SYSTEM_COMPONENT 12#define _COMPONENT ACPI_SYSTEM_COMPONENT
11ACPI_MODULE_NAME("sysfs"); 13ACPI_MODULE_NAME("sysfs");
12 14
@@ -249,6 +251,7 @@ module_param_call(acpica_version, NULL, param_get_acpica_version, NULL, 0444);
249static LIST_HEAD(acpi_table_attr_list); 251static LIST_HEAD(acpi_table_attr_list);
250static struct kobject *tables_kobj; 252static struct kobject *tables_kobj;
251static struct kobject *dynamic_tables_kobj; 253static struct kobject *dynamic_tables_kobj;
254static struct kobject *hotplug_kobj;
252 255
253struct acpi_table_attr { 256struct acpi_table_attr {
254 struct bin_attribute attr; 257 struct bin_attribute attr;
@@ -716,6 +719,67 @@ acpi_show_profile(struct device *dev, struct device_attribute *attr,
716static const struct device_attribute pm_profile_attr = 719static const struct device_attribute pm_profile_attr =
717 __ATTR(pm_profile, S_IRUGO, acpi_show_profile, NULL); 720 __ATTR(pm_profile, S_IRUGO, acpi_show_profile, NULL);
718 721
722static ssize_t hotplug_enabled_show(struct kobject *kobj,
723 struct kobj_attribute *attr, char *buf)
724{
725 struct acpi_hotplug_profile *hotplug = to_acpi_hotplug_profile(kobj);
726
727 return sprintf(buf, "%d\n", hotplug->enabled);
728}
729
730static ssize_t hotplug_enabled_store(struct kobject *kobj,
731 struct kobj_attribute *attr,
732 const char *buf, size_t size)
733{
734 struct acpi_hotplug_profile *hotplug = to_acpi_hotplug_profile(kobj);
735 unsigned int val;
736
737 if (kstrtouint(buf, 10, &val) || val > 1)
738 return -EINVAL;
739
740 acpi_scan_hotplug_enabled(hotplug, val);
741 return size;
742}
743
744static struct kobj_attribute hotplug_enabled_attr =
745 __ATTR(enabled, S_IRUGO | S_IWUSR, hotplug_enabled_show,
746 hotplug_enabled_store);
747
748static struct attribute *hotplug_profile_attrs[] = {
749 &hotplug_enabled_attr.attr,
750 NULL
751};
752
753static struct kobj_type acpi_hotplug_profile_ktype = {
754 .sysfs_ops = &kobj_sysfs_ops,
755 .default_attrs = hotplug_profile_attrs,
756};
757
758void acpi_sysfs_add_hotplug_profile(struct acpi_hotplug_profile *hotplug,
759 const char *name)
760{
761 int error;
762
763 if (!hotplug_kobj)
764 goto err_out;
765
766 kobject_init(&hotplug->kobj, &acpi_hotplug_profile_ktype);
767 error = kobject_set_name(&hotplug->kobj, "%s", name);
768 if (error)
769 goto err_out;
770
771 hotplug->kobj.parent = hotplug_kobj;
772 error = kobject_add(&hotplug->kobj, hotplug_kobj, NULL);
773 if (error)
774 goto err_out;
775
776 kobject_uevent(&hotplug->kobj, KOBJ_ADD);
777 return;
778
779 err_out:
780 pr_err(PREFIX "Unable to add hotplug profile '%s'\n", name);
781}
782
719int __init acpi_sysfs_init(void) 783int __init acpi_sysfs_init(void)
720{ 784{
721 int result; 785 int result;
@@ -723,6 +787,8 @@ int __init acpi_sysfs_init(void)
723 result = acpi_tables_sysfs_init(); 787 result = acpi_tables_sysfs_init();
724 if (result) 788 if (result)
725 return result; 789 return result;
790
791 hotplug_kobj = kobject_create_and_add("hotplug", acpi_kobj);
726 result = sysfs_create_file(acpi_kobj, &pm_profile_attr.attr); 792 result = sysfs_create_file(acpi_kobj, &pm_profile_attr.attr);
727 return result; 793 return result;
728} 794}