From: Zhang Rui <rui.zhang@intel.com>
To: lenb@kernel.org
Cc: "linux-acpi@vger" <linux-acpi@vger.kernel.org>, linux-pm@osdl.org
Subject: [PATCH 6/6] [-mm]: ACPI: duplicate ACPI "info" attribute in sysfs
Date: Sat, 06 Jan 2007 19:35:33 +0800 [thread overview]
Message-ID: <1168083333.5619.40.camel@localhost.localdomain> (raw)
From: Zhang Rui <rui.zhang@intel.com>
Add "info" attribute to indicates ACPICA version.
/proc/acpi/info is deprecated by /sys/firmware/acpi/info.
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
drivers/acpi/Kconfig | 3 ++-
drivers/acpi/system.c | 48 +++++++++++++++++++++++++++++++++++++++++++-----
2 files changed, 45 insertions(+), 6 deletions(-)
Index: linux-2.6.20-rc2-mm1/drivers/acpi/system.c
===================================================================
--- linux-2.6.20-rc2-mm1.orig/drivers/acpi/system.c 2007-01-06 13:51:39.000000000 +0800
+++ linux-2.6.20-rc2-mm1/drivers/acpi/system.c 2007-01-06 14:49:45.000000000 +0800
@@ -29,6 +29,7 @@
#include <asm/uaccess.h>
#include <acpi/acpi_drivers.h>
+#include <acpi/acpi_bus.h>
#define _COMPONENT ACPI_SYSTEM_COMPONENT
ACPI_MODULE_NAME("acpi_system")
@@ -42,8 +43,32 @@ ACPI_MODULE_NAME("acpi_system")
extern struct fadt_descriptor acpi_fadt;
/* --------------------------------------------------------------------------
+ FS Interface (/sys)
+ -------------------------------------------------------------------------- */
+extern struct subsystem acpi_subsys;
+
+static ssize_t info_show(struct subsystem *subsys, char *buf)
+{
+ return sprintf(buf, "version: %x\n", ACPI_CA_VERSION);
+}
+
+static struct subsys_attribute info_attr = {
+ .attr = {
+ .name = __stringify(info),
+ .mode = 0444,
+ },
+ .show = info_show,
+ .store = NULL,
+};
+
+static int acpi_system_info_add_sysfs(void)
+{
+ return sysfs_create_file(&acpi_subsys.kset.kobj, &info_attr.attr);
+}
+/* --------------------------------------------------------------------------
FS Interface (/proc)
-------------------------------------------------------------------------- */
+#ifdef CONFIG_ACPI_PROCFS
static int acpi_system_read_info(struct seq_file *seq, void *offset)
{
@@ -63,6 +88,7 @@ static const struct file_operations acpi
.llseek = seq_lseek,
.release = single_release,
};
+#endif
static ssize_t acpi_system_read_dsdt(struct file *, char __user *, size_t,
loff_t *);
@@ -118,16 +144,13 @@ acpi_system_read_fadt(struct file *file,
return res;
}
-static int __init acpi_system_init(void)
+static int acpi_system_procfs_init(void)
{
struct proc_dir_entry *entry;
int error = 0;
char *name;
-
- if (acpi_disabled)
- return 0;
-
+#ifdef CONFIG_ACPI_PROCFS
/* 'info' [R] */
name = ACPI_SYSTEM_FILE_INFO;
entry = create_proc_entry(name, S_IRUGO, acpi_root_dir);
@@ -136,6 +159,7 @@ static int __init acpi_system_init(void)
else {
entry->proc_fops = &acpi_system_info_ops;
}
+#endif
/* 'dsdt' [R] */
name = ACPI_SYSTEM_FILE_DSDT;
@@ -165,4 +189,18 @@ static int __init acpi_system_init(void)
goto Done;
}
+static int __init acpi_system_init(void) {
+ int result;
+
+ if (acpi_disabled)
+ return 0;
+
+ result = acpi_system_info_add_sysfs();
+ if(result)
+ return result;
+
+ result = acpi_system_procfs_init();
+
+ return result;
+}
subsys_initcall(acpi_system_init);
Index: linux-2.6.20-rc2-mm1/drivers/acpi/Kconfig
===================================================================
--- linux-2.6.20-rc2-mm1.orig/drivers/acpi/Kconfig 2007-01-06 14:37:10.000000000 +0800
+++ linux-2.6.20-rc2-mm1/drivers/acpi/Kconfig 2007-01-06 14:46:24.000000000 +0800
@@ -78,7 +78,8 @@ config ACPI_PROCFS
/proc/acpi/sleep is deprecated by /sys/power/state.
/proc/acpi/alarm is deprecated by /sys/power/alarm.
/proc/acpi/wakeup is deprecated by
- /sys/devices/acpi_system/.../device/sleep_state && wakeup. )
+ /sys/devices/acpi_system/.../device/sleep_state && wakeup.
+ /proc/acpi/info is deprecated by /sys/firmware/acpi/info. )
config ACPI_AC
tristate "AC Adapter"
next reply other threads:[~2007-01-06 11:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-06 11:35 Zhang Rui [this message]
2007-01-06 21:36 ` [PATCH 6/6] [-mm]: ACPI: duplicate ACPI "info" attribute in sysfs David Brownell
2007-01-07 15:39 ` [linux-pm] " Pavel Machek
2007-01-21 5:50 ` [PATCH 3/3] [-mm]: ACPI: add ACPICA version " Zhang Rui
2007-01-25 2:42 ` Len Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1168083333.5619.40.camel@localhost.localdomain \
--to=rui.zhang@intel.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-pm@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).