aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOctavian Purdila <octavian.purdila@intel.com>2016-07-08 12:13:13 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-07-08 15:52:35 -0400
commit0bf54fcd95042bd178cb25368422cf4474fc8492 (patch)
treea2fe90bbf9bc61e98537458bdf1ade479288f669
parent475fb4e8b2f4444d1d7b406ff3a7d21bc89a1e6f (diff)
ACPI: add support for configfs
Register the ACPI subsystem with configfs. Signed-off-by: Octavian Purdila <octavian.purdila@intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--Documentation/ABI/testing/configfs-acpi7
-rw-r--r--MAINTAINERS1
-rw-r--r--drivers/acpi/Kconfig8
-rw-r--r--drivers/acpi/Makefile1
-rw-r--r--drivers/acpi/configfs.c53
5 files changed, 70 insertions, 0 deletions
diff --git a/Documentation/ABI/testing/configfs-acpi b/Documentation/ABI/testing/configfs-acpi
new file mode 100644
index 000000000000..17b19dc2822d
--- /dev/null
+++ b/Documentation/ABI/testing/configfs-acpi
@@ -0,0 +1,7 @@
1What: /config/acpi
2Date: July 2016
3KernelVersion: 4.8
4Contact: linux-acpi@vger.kernel.org
5Description:
6 This represents the ACPI subsystem entry point directory. It
7 contains sub-groups corresponding to ACPI configurable options.
diff --git a/MAINTAINERS b/MAINTAINERS
index e1b090f86e0d..d01d8e2cf268 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -288,6 +288,7 @@ F: include/linux/acpi.h
288F: include/acpi/ 288F: include/acpi/
289F: Documentation/acpi/ 289F: Documentation/acpi/
290F: Documentation/ABI/testing/sysfs-bus-acpi 290F: Documentation/ABI/testing/sysfs-bus-acpi
291F: Documentation/ABI/testing/configfs-acpi
291F: drivers/pci/*acpi* 292F: drivers/pci/*acpi*
292F: drivers/pci/*/*acpi* 293F: drivers/pci/*/*acpi*
293F: drivers/pci/*/*/*acpi* 294F: drivers/pci/*/*/*acpi*
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 0a8e41a52d09..b420e5dd8a56 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -524,4 +524,12 @@ config XPOWER_PMIC_OPREGION
524 524
525endif 525endif
526 526
527config ACPI_CONFIGFS
528 tristate "ACPI configfs support"
529 select CONFIGFS_FS
530 help
531 Select this option to enable support for ACPI configuration from
532 userspace. The configurable ACPI groups will be visible under
533 /config/acpi, assuming configfs is mounted under /config.
534
527endif # ACPI 535endif # ACPI
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index 251ce85a66fb..1dc2173ad8d0 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -99,5 +99,6 @@ obj-$(CONFIG_ACPI_EXTLOG) += acpi_extlog.o
99obj-$(CONFIG_PMIC_OPREGION) += pmic/intel_pmic.o 99obj-$(CONFIG_PMIC_OPREGION) += pmic/intel_pmic.o
100obj-$(CONFIG_CRC_PMIC_OPREGION) += pmic/intel_pmic_crc.o 100obj-$(CONFIG_CRC_PMIC_OPREGION) += pmic/intel_pmic_crc.o
101obj-$(CONFIG_XPOWER_PMIC_OPREGION) += pmic/intel_pmic_xpower.o 101obj-$(CONFIG_XPOWER_PMIC_OPREGION) += pmic/intel_pmic_xpower.o
102obj-$(CONFIG_ACPI_CONFIGFS) += configfs.o
102 103
103video-objs += acpi_video.o video_detect.o 104video-objs += acpi_video.o video_detect.o
diff --git a/drivers/acpi/configfs.c b/drivers/acpi/configfs.c
new file mode 100644
index 000000000000..44b463f6fca5
--- /dev/null
+++ b/drivers/acpi/configfs.c
@@ -0,0 +1,53 @@
1/*
2 * ACPI configfs support
3 *
4 * Copyright (c) 2016 Intel Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by
8 * the Free Software Foundation.
9 */
10
11#include <linux/init.h>
12#include <linux/module.h>
13#include <linux/configfs.h>
14#include <linux/acpi.h>
15
16static struct config_item_type acpi_root_group_type = {
17 .ct_owner = THIS_MODULE,
18};
19
20static struct configfs_subsystem acpi_configfs = {
21 .su_group = {
22 .cg_item = {
23 .ci_namebuf = "acpi",
24 .ci_type = &acpi_root_group_type,
25 },
26 },
27 .su_mutex = __MUTEX_INITIALIZER(acpi_configfs.su_mutex),
28};
29
30static int __init acpi_configfs_init(void)
31{
32 int ret;
33 struct config_group *root = &acpi_configfs.su_group;
34
35 config_group_init(root);
36
37 ret = configfs_register_subsystem(&acpi_configfs);
38 if (ret)
39 return ret;
40
41 return 0;
42}
43module_init(acpi_configfs_init);
44
45static void __exit acpi_configfs_exit(void)
46{
47 configfs_unregister_subsystem(&acpi_configfs);
48}
49module_exit(acpi_configfs_exit);
50
51MODULE_AUTHOR("Octavian Purdila <octavian.purdila@intel.com>");
52MODULE_DESCRIPTION("ACPI configfs support");
53MODULE_LICENSE("GPL v2");