Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
72555cc0
Commit
72555cc0
authored
Nov 23, 2002
by
Aristeu Sergio Rozanski Filho
Committed by
Arnaldo Carvalho de Melo
Nov 23, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
o acpi: convert drivers/acpi/sleep.c to seq_file
parent
d4705f43
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
58 deletions
+44
-58
drivers/acpi/sleep.c
drivers/acpi/sleep.c
+44
-58
No files found.
drivers/acpi/sleep.c
View file @
72555cc0
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
#include <linux/pm.h>
#include <linux/pm.h>
#include <linux/device.h>
#include <linux/device.h>
#include <linux/suspend.h>
#include <linux/suspend.h>
#include <linux/seq_file.h>
#include <asm/uaccess.h>
#include <asm/uaccess.h>
#include <asm/acpi.h>
#include <asm/acpi.h>
...
@@ -32,8 +33,25 @@ ACPI_MODULE_NAME ("sleep")
...
@@ -32,8 +33,25 @@ ACPI_MODULE_NAME ("sleep")
#define ACPI_SYSTEM_FILE_SLEEP "sleep"
#define ACPI_SYSTEM_FILE_SLEEP "sleep"
#define ACPI_SYSTEM_FILE_ALARM "alarm"
#define ACPI_SYSTEM_FILE_ALARM "alarm"
static
int
acpi_system_sleep_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
int
acpi_system_alarm_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
static
u8
sleep_states
[
ACPI_S_STATE_COUNT
];
static
u8
sleep_states
[
ACPI_S_STATE_COUNT
];
static
struct
file_operations
acpi_system_sleep_fops
=
{
.
open
=
acpi_system_sleep_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
static
struct
file_operations
acpi_system_alarm_fops
=
{
.
open
=
acpi_system_alarm_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
static
void
static
void
acpi_power_off
(
void
)
acpi_power_off
(
void
)
{
{
...
@@ -271,43 +289,26 @@ acpi_suspend (
...
@@ -271,43 +289,26 @@ acpi_suspend (
return
status
;
return
status
;
}
}
static
int
acpi_system_sleep_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
static
int
acpi_system_read_sleep
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
data
)
{
{
char
*
p
=
page
;
int
size
;
int
i
;
int
i
;
ACPI_FUNCTION_TRACE
(
"acpi_system_read_sleep"
);
ACPI_FUNCTION_TRACE
(
"acpi_system_sleep_seq_show"
);
if
(
off
!=
0
)
goto
end
;
for
(
i
=
0
;
i
<=
ACPI_STATE_S5
;
i
++
)
{
for
(
i
=
0
;
i
<=
ACPI_STATE_S5
;
i
++
)
{
if
(
sleep_states
[
i
])
if
(
sleep_states
[
i
])
p
+=
sprintf
(
p
,
"S%d "
,
i
);
seq_printf
(
seq
,
"S%d "
,
i
);
}
}
p
+=
sprintf
(
p
,
"
\n
"
);
seq_puts
(
seq
,
"
\n
"
);
end:
return
0
;
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_sleep_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
single_open
(
file
,
acpi_system_sleep_seq_show
,
PDE
(
inode
)
->
data
);
}
static
int
static
int
acpi_system_write_sleep
(
acpi_system_write_sleep
(
...
@@ -349,25 +350,12 @@ acpi_system_write_sleep (
...
@@ -349,25 +350,12 @@ acpi_system_write_sleep (
return_VALUE
(
count
);
return_VALUE
(
count
);
}
}
static
int
acpi_system_alarm_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
static
int
acpi_system_read_alarm
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
context
)
{
{
char
*
p
=
page
;
int
size
=
0
;
u32
sec
,
min
,
hr
;
u32
sec
,
min
,
hr
;
u32
day
,
mo
,
yr
;
u32
day
,
mo
,
yr
;
ACPI_FUNCTION_TRACE
(
"acpi_system_read_alarm"
);
ACPI_FUNCTION_TRACE
(
"acpi_system_alarm_seq_show"
);
if
(
off
!=
0
)
goto
end
;
spin_lock
(
&
rtc_lock
);
spin_lock
(
&
rtc_lock
);
...
@@ -427,21 +415,19 @@ acpi_system_read_alarm (
...
@@ -427,21 +415,19 @@ acpi_system_read_alarm (
yr
+=
2000
;
yr
+=
2000
;
#endif
#endif
p
+=
sprintf
(
p
,
"%4.4u-"
,
yr
);
seq_printf
(
seq
,
"%4.4u-"
,
yr
);
p
+=
(
mo
>
12
)
?
sprintf
(
p
,
"**-"
)
:
sprintf
(
p
,
"%2.2u-"
,
mo
);
(
mo
>
12
)
?
seq_puts
(
seq
,
"**-"
)
:
seq_printf
(
seq
,
"%2.2u-"
,
mo
);
p
+=
(
day
>
31
)
?
sprintf
(
p
,
"** "
)
:
sprintf
(
p
,
"%2.2u "
,
day
);
(
day
>
31
)
?
seq_puts
(
seq
,
"** "
)
:
seq_printf
(
seq
,
"%2.2u "
,
day
);
p
+=
(
hr
>
23
)
?
sprintf
(
p
,
"**:"
)
:
sprintf
(
p
,
"%2.2u:"
,
hr
);
(
hr
>
23
)
?
seq_puts
(
seq
,
"**:"
)
:
seq_printf
(
seq
,
"%2.2u:"
,
hr
);
p
+=
(
min
>
59
)
?
sprintf
(
p
,
"**:"
)
:
sprintf
(
p
,
"%2.2u:"
,
min
);
(
min
>
59
)
?
seq_puts
(
seq
,
"**:"
)
:
seq_printf
(
seq
,
"%2.2u:"
,
min
);
p
+=
(
sec
>
59
)
?
sprintf
(
p
,
"**
\n
"
)
:
sprintf
(
p
,
"%2.2u
\n
"
,
sec
);
(
sec
>
59
)
?
seq_puts
(
seq
,
"**
\n
"
)
:
seq_printf
(
seq
,
"%2.2u
\n
"
,
sec
);
end:
return
0
;
size
=
p
-
page
;
}
if
(
size
<
count
)
*
eof
=
1
;
else
if
(
size
>
count
)
size
=
count
;
static
int
acpi_system_alarm_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
if
(
size
<
0
)
size
=
0
;
{
*
start
=
page
;
return
single_open
(
file
,
acpi_system_alarm_seq_show
,
PDE
(
inode
)
->
data
);
return_VALUE
(
size
);
}
}
...
@@ -687,7 +673,7 @@ static int __init acpi_sleep_init(void)
...
@@ -687,7 +673,7 @@ static int __init acpi_sleep_init(void)
"Unable to create '%s' fs entry
\n
"
,
"Unable to create '%s' fs entry
\n
"
,
ACPI_SYSTEM_FILE_SLEEP
));
ACPI_SYSTEM_FILE_SLEEP
));
else
{
else
{
entry
->
read_proc
=
acpi_system_read_sleep
;
entry
->
proc_fops
=
&
acpi_system_sleep_fops
;
entry
->
write_proc
=
acpi_system_write_sleep
;
entry
->
write_proc
=
acpi_system_write_sleep
;
}
}
...
@@ -699,7 +685,7 @@ static int __init acpi_sleep_init(void)
...
@@ -699,7 +685,7 @@ static int __init acpi_sleep_init(void)
"Unable to create '%s' fs entry
\n
"
,
"Unable to create '%s' fs entry
\n
"
,
ACPI_SYSTEM_FILE_ALARM
));
ACPI_SYSTEM_FILE_ALARM
));
else
{
else
{
entry
->
read_proc
=
acpi_system_read_alarm
;
entry
->
proc_fops
=
&
acpi_system_alarm_fops
;
entry
->
write_proc
=
acpi_system_write_alarm
;
entry
->
write_proc
=
acpi_system_write_alarm
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment