Skip to content

Commit 1c8fce2

Browse files
zhang-ruilenb
authored andcommitted
ACPI: introduce drivers/acpi/sysfs.c
Introduce drivers/acpi/sysfs.c. code for ACPI sysfs I/F, including #ifdef ACPI_DEBUG /sys/module/acpi/parameters/debug_layer /sys/module/acpi/parameters/debug_level /sys/module/acpi/parameters/trace_method_name /sys/module/acpi/parameters/trace_debug_layer /sys/module/acpi/parameters/trace_debug_level /sys/module/acpi/parameters/trace_state #endif /sys/module/acpi/parameters/acpica_version /sys/firmware/acpi/tables/ /sys/firmware/acpi/interrupts/ is moved to this file. No function change in this patch. Signed-off-by: Zhang Rui <[email protected]> Signed-off-by: Len Brown <[email protected]>
1 parent c172cb7 commit 1c8fce2

File tree

6 files changed

+688
-571
lines changed

6 files changed

+688
-571
lines changed

drivers/acpi/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ acpi-$(CONFIG_ACPI_DOCK) += dock.o
3838
acpi-y += pci_root.o pci_link.o pci_irq.o pci_bind.o
3939
acpi-y += power.o
4040
acpi-y += system.o event.o
41+
acpi-y += sysfs.o
4142
acpi-$(CONFIG_ACPI_DEBUG) += debug.o
4243
acpi-$(CONFIG_DEBUG_FS) += debugfs.o
4344
acpi-$(CONFIG_ACPI_NUMA) += numa.o

drivers/acpi/bus.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,6 +1036,7 @@ static int __init acpi_init(void)
10361036
acpi_power_init();
10371037
acpi_system_init();
10381038
acpi_debug_init();
1039+
acpi_sysfs_init();
10391040
acpi_debugfs_init();
10401041
acpi_sleep_proc_init();
10411042
acpi_wakeup_device_init();

drivers/acpi/debug.c

Lines changed: 0 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -93,110 +93,6 @@ static const struct acpi_dlevel acpi_debug_levels[] = {
9393
ACPI_DEBUG_INIT(ACPI_LV_EVENTS),
9494
};
9595

96-
/* --------------------------------------------------------------------------
97-
FS Interface (/sys)
98-
-------------------------------------------------------------------------- */
99-
static int param_get_debug_layer(char *buffer, struct kernel_param *kp) {
100-
int result = 0;
101-
int i;
102-
103-
result = sprintf(buffer, "%-25s\tHex SET\n", "Description");
104-
105-
for(i = 0; i <ARRAY_SIZE(acpi_debug_layers); i++) {
106-
result += sprintf(buffer+result, "%-25s\t0x%08lX [%c]\n",
107-
acpi_debug_layers[i].name,
108-
acpi_debug_layers[i].value,
109-
(acpi_dbg_layer & acpi_debug_layers[i].value) ? '*' : ' ');
110-
}
111-
result += sprintf(buffer+result, "%-25s\t0x%08X [%c]\n", "ACPI_ALL_DRIVERS",
112-
ACPI_ALL_DRIVERS,
113-
(acpi_dbg_layer & ACPI_ALL_DRIVERS) ==
114-
ACPI_ALL_DRIVERS ? '*' : (acpi_dbg_layer &
115-
ACPI_ALL_DRIVERS) == 0 ? ' ' : '-');
116-
result += sprintf(buffer+result, "--\ndebug_layer = 0x%08X ( * = enabled)\n", acpi_dbg_layer);
117-
118-
return result;
119-
}
120-
121-
static int param_get_debug_level(char *buffer, struct kernel_param *kp) {
122-
int result = 0;
123-
int i;
124-
125-
result = sprintf(buffer, "%-25s\tHex SET\n", "Description");
126-
127-
for (i = 0; i < ARRAY_SIZE(acpi_debug_levels); i++) {
128-
result += sprintf(buffer+result, "%-25s\t0x%08lX [%c]\n",
129-
acpi_debug_levels[i].name,
130-
acpi_debug_levels[i].value,
131-
(acpi_dbg_level & acpi_debug_levels[i].
132-
value) ? '*' : ' ');
133-
}
134-
result += sprintf(buffer+result, "--\ndebug_level = 0x%08X (* = enabled)\n",
135-
acpi_dbg_level);
136-
137-
return result;
138-
}
139-
140-
module_param_call(debug_layer, param_set_uint, param_get_debug_layer, &acpi_dbg_layer, 0644);
141-
module_param_call(debug_level, param_set_uint, param_get_debug_level, &acpi_dbg_level, 0644);
142-
143-
static char trace_method_name[6];
144-
module_param_string(trace_method_name, trace_method_name, 6, 0644);
145-
static unsigned int trace_debug_layer;
146-
module_param(trace_debug_layer, uint, 0644);
147-
static unsigned int trace_debug_level;
148-
module_param(trace_debug_level, uint, 0644);
149-
150-
static int param_set_trace_state(const char *val, struct kernel_param *kp)
151-
{
152-
int result = 0;
153-
154-
if (!strncmp(val, "enable", strlen("enable") - 1)) {
155-
result = acpi_debug_trace(trace_method_name, trace_debug_level,
156-
trace_debug_layer, 0);
157-
if (result)
158-
result = -EBUSY;
159-
goto exit;
160-
}
161-
162-
if (!strncmp(val, "disable", strlen("disable") - 1)) {
163-
int name = 0;
164-
result = acpi_debug_trace((char *)&name, trace_debug_level,
165-
trace_debug_layer, 0);
166-
if (result)
167-
result = -EBUSY;
168-
goto exit;
169-
}
170-
171-
if (!strncmp(val, "1", 1)) {
172-
result = acpi_debug_trace(trace_method_name, trace_debug_level,
173-
trace_debug_layer, 1);
174-
if (result)
175-
result = -EBUSY;
176-
goto exit;
177-
}
178-
179-
result = -EINVAL;
180-
exit:
181-
return result;
182-
}
183-
184-
static int param_get_trace_state(char *buffer, struct kernel_param *kp)
185-
{
186-
if (!acpi_gbl_trace_method_name)
187-
return sprintf(buffer, "disable");
188-
else {
189-
if (acpi_gbl_trace_flags & 1)
190-
return sprintf(buffer, "1");
191-
else
192-
return sprintf(buffer, "enable");
193-
}
194-
return 0;
195-
}
196-
197-
module_param_call(trace_state, param_set_trace_state, param_get_trace_state,
198-
NULL, 0644);
199-
20096
/* --------------------------------------------------------------------------
20197
FS Interface (/proc)
20298
-------------------------------------------------------------------------- */

drivers/acpi/internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
int init_acpi_device_notify(void);
2424
int acpi_scan_init(void);
2525
int acpi_system_init(void);
26+
int acpi_sysfs_init(void);
2627

2728
#ifdef CONFIG_ACPI_DEBUG
2829
int acpi_debug_init(void);

0 commit comments

Comments
 (0)