Commit e7de38c1 authored by Len Brown's avatar Len Brown Committed by Len Brown

[ACPI] migrate to seq_file() interface

http://bugzilla.kernel.org/show_bug.cgi?id=3333Signed-off-by: default avatarDavid Shaohua Li <shaohua.li@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 474821ca
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <acpi/acpi_bus.h> #include <acpi/acpi_bus.h>
...@@ -341,32 +342,22 @@ acpi_battery_check ( ...@@ -341,32 +342,22 @@ acpi_battery_check (
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
struct proc_dir_entry *acpi_battery_dir; struct proc_dir_entry *acpi_battery_dir;
static int acpi_battery_read_info(struct seq_file *seq, void *offset)
static int
acpi_battery_read_info (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data)
{ {
int result = 0; int result = 0;
struct acpi_battery *battery = (struct acpi_battery *) data; struct acpi_battery *battery = (struct acpi_battery *) seq->private;
struct acpi_battery_info *bif = NULL; struct acpi_battery_info *bif = NULL;
char *units = "?"; char *units = "?";
char *p = page;
int len = 0;
ACPI_FUNCTION_TRACE("acpi_battery_read_info"); ACPI_FUNCTION_TRACE("acpi_battery_read_info");
if (!battery || (off != 0)) if (!battery)
goto end; goto end;
if (battery->flags.present) if (battery->flags.present)
p += sprintf(p, "present: yes\n"); seq_printf(seq, "present: yes\n");
else { else {
p += sprintf(p, "present: no\n"); seq_printf(seq, "present: no\n");
goto end; goto end;
} }
...@@ -374,98 +365,88 @@ acpi_battery_read_info ( ...@@ -374,98 +365,88 @@ acpi_battery_read_info (
result = acpi_battery_get_info(battery, &bif); result = acpi_battery_get_info(battery, &bif);
if (result || !bif) { if (result || !bif) {
p += sprintf(p, "ERROR: Unable to read battery information\n"); seq_printf(seq, "ERROR: Unable to read battery information\n");
goto end; goto end;
} }
units = bif->power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS; units = bif->power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS;
if (bif->design_capacity == ACPI_BATTERY_VALUE_UNKNOWN) if (bif->design_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
p += sprintf(p, "design capacity: unknown\n"); seq_printf(seq, "design capacity: unknown\n");
else else
p += sprintf(p, "design capacity: %d %sh\n", seq_printf(seq, "design capacity: %d %sh\n",
(u32) bif->design_capacity, units); (u32) bif->design_capacity, units);
if (bif->last_full_capacity == ACPI_BATTERY_VALUE_UNKNOWN) if (bif->last_full_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
p += sprintf(p, "last full capacity: unknown\n"); seq_printf(seq, "last full capacity: unknown\n");
else else
p += sprintf(p, "last full capacity: %d %sh\n", seq_printf(seq, "last full capacity: %d %sh\n",
(u32) bif->last_full_capacity, units); (u32) bif->last_full_capacity, units);
switch ((u32) bif->battery_technology) { switch ((u32) bif->battery_technology) {
case 0: case 0:
p += sprintf(p, "battery technology: non-rechargeable\n"); seq_printf(seq, "battery technology: non-rechargeable\n");
break; break;
case 1: case 1:
p += sprintf(p, "battery technology: rechargeable\n"); seq_printf(seq, "battery technology: rechargeable\n");
break; break;
default: default:
p += sprintf(p, "battery technology: unknown\n"); seq_printf(seq, "battery technology: unknown\n");
break; break;
} }
if (bif->design_voltage == ACPI_BATTERY_VALUE_UNKNOWN) if (bif->design_voltage == ACPI_BATTERY_VALUE_UNKNOWN)
p += sprintf(p, "design voltage: unknown\n"); seq_printf(seq, "design voltage: unknown\n");
else else
p += sprintf(p, "design voltage: %d mV\n", seq_printf(seq, "design voltage: %d mV\n",
(u32) bif->design_voltage); (u32) bif->design_voltage);
p += sprintf(p, "design capacity warning: %d %sh\n", seq_printf(seq, "design capacity warning: %d %sh\n",
(u32) bif->design_capacity_warning, units); (u32) bif->design_capacity_warning, units);
p += sprintf(p, "design capacity low: %d %sh\n", seq_printf(seq, "design capacity low: %d %sh\n",
(u32) bif->design_capacity_low, units); (u32) bif->design_capacity_low, units);
p += sprintf(p, "capacity granularity 1: %d %sh\n", seq_printf(seq, "capacity granularity 1: %d %sh\n",
(u32) bif->battery_capacity_granularity_1, units); (u32) bif->battery_capacity_granularity_1, units);
p += sprintf(p, "capacity granularity 2: %d %sh\n", seq_printf(seq, "capacity granularity 2: %d %sh\n",
(u32) bif->battery_capacity_granularity_2, units); (u32) bif->battery_capacity_granularity_2, units);
p += sprintf(p, "model number: %s\n", seq_printf(seq, "model number: %s\n",
bif->model_number); bif->model_number);
p += sprintf(p, "serial number: %s\n", seq_printf(seq, "serial number: %s\n",
bif->serial_number); bif->serial_number);
p += sprintf(p, "battery type: %s\n", seq_printf(seq, "battery type: %s\n",
bif->battery_type); bif->battery_type);
p += sprintf(p, "OEM info: %s\n", seq_printf(seq, "OEM info: %s\n",
bif->oem_info); bif->oem_info);
end: end:
kfree(bif); kfree(bif);
len = (p - page); return_VALUE(0);
if (len <= off+count) *eof = 1; }
*start = page + off;
len -= off;
if (len>count) len = count;
if (len<0) len = 0;
return_VALUE(len); static int acpi_battery_info_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, acpi_battery_read_info, PDE(inode)->data);
} }
static int static int
acpi_battery_read_state ( acpi_battery_read_state (struct seq_file *seq, void *offset)
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data)
{ {
int result = 0; int result = 0;
struct acpi_battery *battery = (struct acpi_battery *) data; struct acpi_battery *battery = (struct acpi_battery *) seq->private;
struct acpi_battery_status *bst = NULL; struct acpi_battery_status *bst = NULL;
char *units = "?"; char *units = "?";
char *p = page;
int len = 0;
ACPI_FUNCTION_TRACE("acpi_battery_read_state"); ACPI_FUNCTION_TRACE("acpi_battery_read_state");
if (!battery || (off != 0)) if (!battery)
goto end; goto end;
if (battery->flags.present) if (battery->flags.present)
p += sprintf(p, "present: yes\n"); seq_printf(seq, "present: yes\n");
else { else {
p += sprintf(p, "present: no\n"); seq_printf(seq, "present: no\n");
goto end; goto end;
} }
...@@ -477,81 +458,71 @@ acpi_battery_read_state ( ...@@ -477,81 +458,71 @@ acpi_battery_read_state (
result = acpi_battery_get_status(battery, &bst); result = acpi_battery_get_status(battery, &bst);
if (result || !bst) { if (result || !bst) {
p += sprintf(p, "ERROR: Unable to read battery status\n"); seq_printf(seq, "ERROR: Unable to read battery status\n");
goto end; goto end;
} }
if (!(bst->state & 0x04)) if (!(bst->state & 0x04))
p += sprintf(p, "capacity state: ok\n"); seq_printf(seq, "capacity state: ok\n");
else else
p += sprintf(p, "capacity state: critical\n"); seq_printf(seq, "capacity state: critical\n");
if ((bst->state & 0x01) && (bst->state & 0x02)){ if ((bst->state & 0x01) && (bst->state & 0x02)){
p += sprintf(p, "charging state: charging/discharging\n"); seq_printf(seq, "charging state: charging/discharging\n");
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Battery Charging and Discharging?\n")); "Battery Charging and Discharging?\n"));
} }
else if (bst->state & 0x01) else if (bst->state & 0x01)
p += sprintf(p, "charging state: discharging\n"); seq_printf(seq, "charging state: discharging\n");
else if (bst->state & 0x02) else if (bst->state & 0x02)
p += sprintf(p, "charging state: charging\n"); seq_printf(seq, "charging state: charging\n");
else { else {
p += sprintf(p, "charging state: charged\n"); seq_printf(seq, "charging state: charged\n");
} }
if (bst->present_rate == ACPI_BATTERY_VALUE_UNKNOWN) if (bst->present_rate == ACPI_BATTERY_VALUE_UNKNOWN)
p += sprintf(p, "present rate: unknown\n"); seq_printf(seq, "present rate: unknown\n");
else else
p += sprintf(p, "present rate: %d %s\n", seq_printf(seq, "present rate: %d %s\n",
(u32) bst->present_rate, units); (u32) bst->present_rate, units);
if (bst->remaining_capacity == ACPI_BATTERY_VALUE_UNKNOWN) if (bst->remaining_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
p += sprintf(p, "remaining capacity: unknown\n"); seq_printf(seq, "remaining capacity: unknown\n");
else else
p += sprintf(p, "remaining capacity: %d %sh\n", seq_printf(seq, "remaining capacity: %d %sh\n",
(u32) bst->remaining_capacity, units); (u32) bst->remaining_capacity, units);
if (bst->present_voltage == ACPI_BATTERY_VALUE_UNKNOWN) if (bst->present_voltage == ACPI_BATTERY_VALUE_UNKNOWN)
p += sprintf(p, "present voltage: unknown\n"); seq_printf(seq, "present voltage: unknown\n");
else else
p += sprintf(p, "present voltage: %d mV\n", seq_printf(seq, "present voltage: %d mV\n",
(u32) bst->present_voltage); (u32) bst->present_voltage);
end: end:
kfree(bst); kfree(bst);
len = (p - page); return_VALUE(0);
if (len <= off+count) *eof = 1; }
*start = page + off;
len -= off;
if (len>count) len = count;
if (len<0) len = 0;
return_VALUE(len); static int acpi_battery_state_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, acpi_battery_read_state, PDE(inode)->data);
} }
static int static int
acpi_battery_read_alarm ( acpi_battery_read_alarm (struct seq_file *seq, void *offset)
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data)
{ {
struct acpi_battery *battery = (struct acpi_battery *) data; struct acpi_battery *battery = (struct acpi_battery *) seq->private;
char *units = "?"; char *units = "?";
char *p = page;
int len = 0;
ACPI_FUNCTION_TRACE("acpi_battery_read_alarm"); ACPI_FUNCTION_TRACE("acpi_battery_read_alarm");
if (!battery || (off != 0)) if (!battery)
goto end; goto end;
if (!battery->flags.present) { if (!battery->flags.present) {
p += sprintf(p, "present: no\n"); seq_printf(seq, "present: no\n");
goto end; goto end;
} }
...@@ -561,34 +532,28 @@ acpi_battery_read_alarm ( ...@@ -561,34 +532,28 @@ acpi_battery_read_alarm (
/* Battery Alarm */ /* Battery Alarm */
p += sprintf(p, "alarm: "); seq_printf(seq, "alarm: ");
if (!battery->alarm) if (!battery->alarm)
p += sprintf(p, "unsupported\n"); seq_printf(seq, "unsupported\n");
else else
p += sprintf(p, "%d %sh\n", (u32) battery->alarm, units); seq_printf(seq, "%d %sh\n", (u32) battery->alarm, units);
end: end:
len = (p - page); return_VALUE(0);
if (len <= off+count) *eof = 1;
*start = page + off;
len -= off;
if (len>count) len = count;
if (len<0) len = 0;
return_VALUE(len);
} }
static int static ssize_t
acpi_battery_write_alarm ( acpi_battery_write_alarm (
struct file *file, struct file *file,
const char __user *buffer, const char __user *buffer,
unsigned long count, size_t count,
void *data) loff_t *ppos)
{ {
int result = 0; int result = 0;
struct acpi_battery *battery = (struct acpi_battery *) data;
char alarm_string[12] = {'\0'}; char alarm_string[12] = {'\0'};
struct seq_file *m = (struct seq_file *)file->private_data;
struct acpi_battery *battery = (struct acpi_battery *)m->private;
ACPI_FUNCTION_TRACE("acpi_battery_write_alarm"); ACPI_FUNCTION_TRACE("acpi_battery_write_alarm");
...@@ -611,6 +576,35 @@ acpi_battery_write_alarm ( ...@@ -611,6 +576,35 @@ acpi_battery_write_alarm (
return_VALUE(count); return_VALUE(count);
} }
static int acpi_battery_alarm_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, acpi_battery_read_alarm, PDE(inode)->data);
}
static struct file_operations acpi_battery_info_ops = {
.open = acpi_battery_info_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
.owner = THIS_MODULE,
};
static struct file_operations acpi_battery_state_ops = {
.open = acpi_battery_state_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
.owner = THIS_MODULE,
};
static struct file_operations acpi_battery_alarm_ops = {
.open = acpi_battery_alarm_open_fs,
.read = seq_read,
.write = acpi_battery_write_alarm,
.llseek = seq_lseek,
.release = single_release,
.owner = THIS_MODULE,
};
static int static int
acpi_battery_add_fs ( acpi_battery_add_fs (
...@@ -636,7 +630,7 @@ acpi_battery_add_fs ( ...@@ -636,7 +630,7 @@ acpi_battery_add_fs (
"Unable to create '%s' fs entry\n", "Unable to create '%s' fs entry\n",
ACPI_BATTERY_FILE_INFO)); ACPI_BATTERY_FILE_INFO));
else { else {
entry->read_proc = acpi_battery_read_info; entry->proc_fops = &acpi_battery_info_ops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE; entry->owner = THIS_MODULE;
} }
...@@ -649,7 +643,7 @@ acpi_battery_add_fs ( ...@@ -649,7 +643,7 @@ acpi_battery_add_fs (
"Unable to create '%s' fs entry\n", "Unable to create '%s' fs entry\n",
ACPI_BATTERY_FILE_STATUS)); ACPI_BATTERY_FILE_STATUS));
else { else {
entry->read_proc = acpi_battery_read_state; entry->proc_fops = &acpi_battery_state_ops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE; entry->owner = THIS_MODULE;
} }
...@@ -662,8 +656,7 @@ acpi_battery_add_fs ( ...@@ -662,8 +656,7 @@ acpi_battery_add_fs (
"Unable to create '%s' fs entry\n", "Unable to create '%s' fs entry\n",
ACPI_BATTERY_FILE_ALARM)); ACPI_BATTERY_FILE_ALARM));
else { else {
entry->read_proc = acpi_battery_read_alarm; entry->proc_fops = &acpi_battery_alarm_ops;
entry->write_proc = acpi_battery_write_alarm;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE; entry->owner = THIS_MODULE;
} }
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <asm/io.h> #include <asm/io.h>
#include <acpi/acpi_bus.h> #include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h> #include <acpi/acpi_drivers.h>
...@@ -491,41 +492,38 @@ struct proc_dir_entry *acpi_ec_dir; ...@@ -491,41 +492,38 @@ struct proc_dir_entry *acpi_ec_dir;
static int static int
acpi_ec_read_info ( acpi_ec_read_info (struct seq_file *seq, void *offset)
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data)
{ {
struct acpi_ec *ec = (struct acpi_ec *) data; struct acpi_ec *ec = (struct acpi_ec *) seq->private;
char *p = page;
int len = 0;
ACPI_FUNCTION_TRACE("acpi_ec_read_info"); ACPI_FUNCTION_TRACE("acpi_ec_read_info");
if (!ec || (off != 0)) if (!ec)
goto end; goto end;
p += sprintf(p, "gpe bit: 0x%02x\n", seq_printf(seq, "gpe bit: 0x%02x\n",
(u32) ec->gpe_bit); (u32) ec->gpe_bit);
p += sprintf(p, "ports: 0x%02x, 0x%02x\n", seq_printf(seq, "ports: 0x%02x, 0x%02x\n",
(u32) ec->status_addr.address, (u32) ec->data_addr.address); (u32) ec->status_addr.address, (u32) ec->data_addr.address);
p += sprintf(p, "use global lock: %s\n", seq_printf(seq, "use global lock: %s\n",
ec->global_lock?"yes":"no"); ec->global_lock?"yes":"no");
end: end:
len = (p - page); return_VALUE(0);
if (len <= off+count) *eof = 1;
*start = page + off;
len -= off;
if (len>count) len = count;
if (len<0) len = 0;
return_VALUE(len);
} }
static int acpi_ec_info_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, acpi_ec_read_info, PDE(inode)->data);
}
static struct file_operations acpi_ec_info_ops = {
.open = acpi_ec_info_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
.owner = THIS_MODULE,
};
static int static int
acpi_ec_add_fs ( acpi_ec_add_fs (
...@@ -542,13 +540,17 @@ acpi_ec_add_fs ( ...@@ -542,13 +540,17 @@ acpi_ec_add_fs (
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
} }
entry = create_proc_read_entry(ACPI_EC_FILE_INFO, S_IRUGO, entry = create_proc_entry(ACPI_EC_FILE_INFO, S_IRUGO,
acpi_device_dir(device), acpi_ec_read_info, acpi_device_dir(device));
acpi_driver_data(device));
if (!entry) if (!entry)
ACPI_DEBUG_PRINT((ACPI_DB_WARN, ACPI_DEBUG_PRINT((ACPI_DB_WARN,
"Unable to create '%s' fs entry\n", "Unable to create '%s' fs entry\n",
ACPI_EC_FILE_INFO)); ACPI_EC_FILE_INFO));
else {
entry->proc_fops = &acpi_ec_info_ops;
entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
}
return_VALUE(0); return_VALUE(0);
} }
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <acpi/acpi_bus.h> #include <acpi/acpi_bus.h>
...@@ -75,51 +76,41 @@ struct proc_dir_entry *acpi_fan_dir; ...@@ -75,51 +76,41 @@ struct proc_dir_entry *acpi_fan_dir;
static int static int
acpi_fan_read_state ( acpi_fan_read_state (struct seq_file *seq, void *offset)
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data)
{ {
struct acpi_fan *fan = (struct acpi_fan *) data; struct acpi_fan *fan = (struct acpi_fan *) seq->private;
char *p = page;
int len = 0;
int state = 0; int state = 0;
ACPI_FUNCTION_TRACE("acpi_fan_read_state"); ACPI_FUNCTION_TRACE("acpi_fan_read_state");
if (!fan || (off != 0)) if (!fan)
goto end; goto end;
if (acpi_bus_get_power(fan->handle, &state)) if (acpi_bus_get_power(fan->handle, &state))
goto end; goto end;
p += sprintf(p, "status: %s\n", seq_printf(seq, "status: %s\n",
!state?"on":"off"); !state?"on":"off");
end: end:
len = (p - page); return_VALUE(0);
if (len <= off+count) *eof = 1;
*start = page + off;
len -= off;
if (len>count) len = count;
if (len<0) len = 0;
return_VALUE(len);
} }
static int acpi_fan_state_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, acpi_fan_read_state, PDE(inode)->data);
}
static int static ssize_t
acpi_fan_write_state ( acpi_fan_write_state (
struct file *file, struct file *file,
const char __user *buffer, const char __user *buffer,
unsigned long count, size_t count,
void *data) loff_t *ppos)
{ {
int result = 0; int result = 0;
struct acpi_fan *fan = (struct acpi_fan *) data; struct seq_file *m = (struct seq_file *)file->private_data;
struct acpi_fan *fan = (struct acpi_fan *) m->private;
char state_string[12] = {'\0'}; char state_string[12] = {'\0'};
ACPI_FUNCTION_TRACE("acpi_fan_write_state"); ACPI_FUNCTION_TRACE("acpi_fan_write_state");
...@@ -140,6 +131,14 @@ acpi_fan_write_state ( ...@@ -140,6 +131,14 @@ acpi_fan_write_state (
return_VALUE(count); return_VALUE(count);
} }
static struct file_operations acpi_fan_state_ops = {
.open = acpi_fan_state_open_fs,
.read = seq_read,
.write = acpi_fan_write_state,
.llseek = seq_lseek,
.release = single_release,
.owner = THIS_MODULE,
};
static int static int
acpi_fan_add_fs ( acpi_fan_add_fs (
...@@ -168,8 +167,7 @@ acpi_fan_add_fs ( ...@@ -168,8 +167,7 @@ acpi_fan_add_fs (
"Unable to create '%s' fs entry\n", "Unable to create '%s' fs entry\n",
ACPI_FAN_FILE_STATE)); ACPI_FAN_FILE_STATE));
else { else {
entry->read_proc = acpi_fan_read_state; entry->proc_fops = &acpi_fan_state_ops;
entry->write_proc = acpi_fan_write_state;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE; entry->owner = THIS_MODULE;
} }
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
*/ */
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -48,35 +49,26 @@ extern FADT_DESCRIPTOR acpi_fadt; ...@@ -48,35 +49,26 @@ extern FADT_DESCRIPTOR acpi_fadt;
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
static int static int
acpi_system_read_info ( acpi_system_read_info (struct seq_file *seq, void *offset)
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data)
{ {
char *p = page;
int size = 0;
ACPI_FUNCTION_TRACE("acpi_system_read_info"); ACPI_FUNCTION_TRACE("acpi_system_read_info");
if (off != 0) seq_printf(seq, "version: %x\n", ACPI_CA_VERSION);
goto end; return_VALUE(0);
}
p += sprintf(p, "version: %x\n", ACPI_CA_VERSION);
end:
size = (p - page);
if (size <= off+count) *eof = 1;
*start = page + off;
size -= off;
if (size>count) size = count;
if (size<0) size = 0;
return_VALUE(size); static int acpi_system_info_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, acpi_system_read_info, PDE(inode)->data);
} }
static struct file_operations acpi_system_info_ops = {
.open = acpi_system_info_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static ssize_t acpi_system_read_dsdt (struct file*, char __user *, size_t, loff_t*); static ssize_t acpi_system_read_dsdt (struct file*, char __user *, size_t, loff_t*);
static struct file_operations acpi_system_dsdt_ops = { static struct file_operations acpi_system_dsdt_ops = {
...@@ -152,10 +144,13 @@ static int __init acpi_system_init (void) ...@@ -152,10 +144,13 @@ static int __init acpi_system_init (void)
/* 'info' [R] */ /* 'info' [R] */
name = ACPI_SYSTEM_FILE_INFO; name = ACPI_SYSTEM_FILE_INFO;
entry = create_proc_read_entry(name, entry = create_proc_entry(name,
S_IRUGO, acpi_root_dir, acpi_system_read_info,NULL); S_IRUGO, acpi_root_dir);
if (!entry) if (!entry)
goto Error; goto Error;
else {
entry->proc_fops = &acpi_system_info_ops;
}
/* 'dsdt' [R] */ /* 'dsdt' [R] */
name = ACPI_SYSTEM_FILE_DSDT; name = ACPI_SYSTEM_FILE_DSDT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment