diff options
Diffstat (limited to 'drivers/acpi/sysfs.c')
-rw-r--r-- | drivers/acpi/sysfs.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c index fcae5fa2e1b3..5c5d1624fa2c 100644 --- a/drivers/acpi/sysfs.c +++ b/drivers/acpi/sysfs.c | |||
@@ -780,6 +780,33 @@ void acpi_sysfs_add_hotplug_profile(struct acpi_hotplug_profile *hotplug, | |||
780 | pr_err(PREFIX "Unable to add hotplug profile '%s'\n", name); | 780 | pr_err(PREFIX "Unable to add hotplug profile '%s'\n", name); |
781 | } | 781 | } |
782 | 782 | ||
783 | static ssize_t force_remove_show(struct kobject *kobj, | ||
784 | struct kobj_attribute *attr, char *buf) | ||
785 | { | ||
786 | return sprintf(buf, "%d\n", !!acpi_force_hot_remove); | ||
787 | } | ||
788 | |||
789 | static ssize_t force_remove_store(struct kobject *kobj, | ||
790 | struct kobj_attribute *attr, | ||
791 | const char *buf, size_t size) | ||
792 | { | ||
793 | bool val; | ||
794 | int ret; | ||
795 | |||
796 | ret = strtobool(buf, &val); | ||
797 | if (ret < 0) | ||
798 | return ret; | ||
799 | |||
800 | lock_device_hotplug(); | ||
801 | acpi_force_hot_remove = val; | ||
802 | unlock_device_hotplug(); | ||
803 | return size; | ||
804 | } | ||
805 | |||
806 | static const struct kobj_attribute force_remove_attr = | ||
807 | __ATTR(force_remove, S_IRUGO | S_IWUSR, force_remove_show, | ||
808 | force_remove_store); | ||
809 | |||
783 | int __init acpi_sysfs_init(void) | 810 | int __init acpi_sysfs_init(void) |
784 | { | 811 | { |
785 | int result; | 812 | int result; |
@@ -789,6 +816,10 @@ int __init acpi_sysfs_init(void) | |||
789 | return result; | 816 | return result; |
790 | 817 | ||
791 | hotplug_kobj = kobject_create_and_add("hotplug", acpi_kobj); | 818 | hotplug_kobj = kobject_create_and_add("hotplug", acpi_kobj); |
819 | result = sysfs_create_file(hotplug_kobj, &force_remove_attr.attr); | ||
820 | if (result) | ||
821 | return result; | ||
822 | |||
792 | result = sysfs_create_file(acpi_kobj, &pm_profile_attr.attr); | 823 | result = sysfs_create_file(acpi_kobj, &pm_profile_attr.attr); |
793 | return result; | 824 | return result; |
794 | } | 825 | } |