From patchwork Fri Jul 1 20:19:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Octavian Purdila X-Patchwork-Id: 9210451 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A2303607D6 for ; Fri, 1 Jul 2016 20:22:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9449327FA8 for ; Fri, 1 Jul 2016 20:22:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8936E28505; Fri, 1 Jul 2016 20:22:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 152E427FA8 for ; Fri, 1 Jul 2016 20:22:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752633AbcGAUVN (ORCPT ); Fri, 1 Jul 2016 16:21:13 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:36759 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752168AbcGAUUH (ORCPT ); Fri, 1 Jul 2016 16:20:07 -0400 Received: by mail-wm0-f66.google.com with SMTP id c82so7585308wme.3; Fri, 01 Jul 2016 13:19:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=lTq3JnnyhHbm0R6R3ubbH1B3D8UiAgM/hOecT7HEuIY=; b=QaQla4MIWiWafNfc2bwDozfMHFkI9cZdbiqnacEZ9FKffHHFvWSIR1dOT8VgyXB7QZ rSTEKBMcQQSE3OuY810yuzUcTem1XXnSDXJDGGvY0YdvXY0LJ9uFwC8dOqObuuvrirXs zaHEblFz3YOl246oqDGNQ6Fo5C+s+i0jf/1vZSoJtnAq2YetEWstjDYY9Wa4BXjEEz0K QgTyPHR/P2Gbxn/hK75mAyiEZ3uax17o/NZcInWD94ouF5usHhaYB1or6ebsBD07toE/ CaHTZWl4n2LsHnDidZ6HLvEsXd2ouzmRe0rH1m27J+0vv+HmtCtJuxLZCsDgzh49Ssr6 Io7Q== X-Gm-Message-State: ALyK8tI45yet/UCUw2fLyagLFQiSvOA6VM5FLvkCl0ivxoE9J7w32Dq1hjz/fahydQbDEg== X-Received: by 10.28.0.130 with SMTP id 124mr64890wma.23.1467404386026; Fri, 01 Jul 2016 13:19:46 -0700 (PDT) Received: from localhost.localdomain ([109.98.36.115]) by smtp.gmail.com with ESMTPSA id zb9sm3890411wjc.34.2016.07.01.13.19.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 01 Jul 2016 13:19:45 -0700 (PDT) From: Octavian Purdila To: "Rafael J . Wysocki" , Len Brown , Matt Fleming , Mark Brown , Wolfram Sang Cc: Joel Becker , linux-acpi@vger.kernel.org, linux-efi@vger.kernel.org, linux-i2c@vger.kernel.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, irina.tirdea@intel.com, leonard.crestez@intel.com, Octavian Purdila Subject: [PATCH v5 7/8] acpi: add support for configfs Date: Fri, 1 Jul 2016 23:19:11 +0300 Message-Id: <1467404352-27101-8-git-send-email-octavian.purdila@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1467404352-27101-1-git-send-email-octavian.purdila@intel.com> References: <1467404352-27101-1-git-send-email-octavian.purdila@intel.com> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Register the ACPI subsystem with configfs. Signed-off-by: Octavian Purdila Reviewed-by: Mika Westerberg --- Documentation/ABI/testing/configfs-acpi | 7 +++++ MAINTAINERS | 1 + drivers/acpi/Kconfig | 9 ++++++ drivers/acpi/Makefile | 1 + drivers/acpi/configfs.c | 53 +++++++++++++++++++++++++++++++++ 5 files changed, 71 insertions(+) create mode 100644 Documentation/ABI/testing/configfs-acpi create mode 100644 drivers/acpi/configfs.c diff --git a/Documentation/ABI/testing/configfs-acpi b/Documentation/ABI/testing/configfs-acpi new file mode 100644 index 0000000..17b19dc --- /dev/null +++ b/Documentation/ABI/testing/configfs-acpi @@ -0,0 +1,7 @@ +What: /config/acpi +Date: July 2016 +KernelVersion: 4.8 +Contact: linux-acpi@vger.kernel.org +Description: + This represents the ACPI subsystem entry point directory. It + contains sub-groups corresponding to ACPI configurable options. diff --git a/MAINTAINERS b/MAINTAINERS index 16700e4..9c5365f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -288,6 +288,7 @@ F: include/linux/acpi.h F: include/acpi/ F: Documentation/acpi/ F: Documentation/ABI/testing/sysfs-bus-acpi +F: Documentation/ABI/testing/configfs-acpi F: drivers/pci/*acpi* F: drivers/pci/*/*acpi* F: drivers/pci/*/*/*acpi* diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index b7e2e77..a039433 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -521,4 +521,13 @@ config XPOWER_PMIC_OPREGION endif +config ACPI_CONFIGFS + tristate "ACPI configfs support" + select CONFIGFS_FS + default n + help + Select this option to enable support for ACPI configuration from + userspace. The configurable ACPI groups will be visible under + /config/acpi, assuming configfs is mounted under /config. + endif # ACPI diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 251ce85..1dc2173 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile @@ -99,5 +99,6 @@ obj-$(CONFIG_ACPI_EXTLOG) += acpi_extlog.o obj-$(CONFIG_PMIC_OPREGION) += pmic/intel_pmic.o obj-$(CONFIG_CRC_PMIC_OPREGION) += pmic/intel_pmic_crc.o obj-$(CONFIG_XPOWER_PMIC_OPREGION) += pmic/intel_pmic_xpower.o +obj-$(CONFIG_ACPI_CONFIGFS) += configfs.o video-objs += acpi_video.o video_detect.o diff --git a/drivers/acpi/configfs.c b/drivers/acpi/configfs.c new file mode 100644 index 0000000..44a72ff --- /dev/null +++ b/drivers/acpi/configfs.c @@ -0,0 +1,53 @@ +/* + * ACPI configfs support + * + * Copyright (c) 2015 Intel Corporation + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ + +#include +#include +#include +#include + +static struct config_item_type acpi_root_group_type = { + .ct_owner = THIS_MODULE, +}; + +static struct configfs_subsystem acpi_configfs = { + .su_group = { + .cg_item = { + .ci_namebuf = "acpi", + .ci_type = &acpi_root_group_type, + }, + }, + .su_mutex = __MUTEX_INITIALIZER(acpi_configfs.su_mutex), +}; + +static int __init acpi_configfs_init(void) +{ + int ret; + struct config_group *root = &acpi_configfs.su_group; + + config_group_init(root); + + ret = configfs_register_subsystem(&acpi_configfs); + if (ret) + return ret; + + return 0; +} +module_init(acpi_configfs_init); + +static void __exit acpi_configfs_exit(void) +{ + configfs_unregister_subsystem(&acpi_configfs); +} +module_exit(acpi_configfs_exit); + +MODULE_AUTHOR("Octavian Purdila "); +MODULE_DESCRIPTION("ACPI configfs support"); +MODULE_LICENSE("GPL v2");