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
268a3cf5
Commit
268a3cf5
authored
Apr 04, 2002
by
Patrick Mochel
Committed by
Patrick Mochel
Apr 04, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add device_shutdown() calls to reboot and power off transitions (and let the user know)
parent
456f5a1c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
drivers/base/power.c
drivers/base/power.c
+6
-0
kernel/sys.c
kernel/sys.c
+5
-0
No files found.
drivers/base/power.c
View file @
268a3cf5
...
@@ -29,6 +29,8 @@ int device_suspend(u32 state, u32 level)
...
@@ -29,6 +29,8 @@ int device_suspend(u32 state, u32 level)
struct
device
*
prev
=
&
device_root
;
struct
device
*
prev
=
&
device_root
;
int
error
=
0
;
int
error
=
0
;
printk
(
KERN_EMERG
"Suspending Devices
\n
"
);
get_device
(
prev
);
get_device
(
prev
);
spin_lock
(
&
device_lock
);
spin_lock
(
&
device_lock
);
...
@@ -82,6 +84,8 @@ void device_resume(u32 level)
...
@@ -82,6 +84,8 @@ void device_resume(u32 level)
}
}
spin_unlock
(
&
device_root
);
spin_unlock
(
&
device_root
);
put_device
(
prev
);
put_device
(
prev
);
printk
(
KERN_EMERG
"Devices Resumed
\n
"
);
}
}
/**
/**
...
@@ -97,6 +101,8 @@ void device_shutdown(void)
...
@@ -97,6 +101,8 @@ void device_shutdown(void)
struct
device
*
dev
;
struct
device
*
dev
;
struct
device
*
prev
=
&
device_root
;
struct
device
*
prev
=
&
device_root
;
printk
(
KERN_EMERG
"Shutting down devices
\n
"
);
get_device
(
prev
);
get_device
(
prev
);
spin_lock
(
&
device_lock
);
spin_lock
(
&
device_lock
);
...
...
kernel/sys.c
View file @
268a3cf5
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
#include <linux/init.h>
#include <linux/init.h>
#include <linux/highuid.h>
#include <linux/highuid.h>
#include <linux/fs.h>
#include <linux/fs.h>
#include <linux/device.h>
#include <asm/uaccess.h>
#include <asm/uaccess.h>
#include <asm/io.h>
#include <asm/io.h>
...
@@ -298,6 +299,7 @@ asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void * arg)
...
@@ -298,6 +299,7 @@ asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void * arg)
switch
(
cmd
)
{
switch
(
cmd
)
{
case
LINUX_REBOOT_CMD_RESTART
:
case
LINUX_REBOOT_CMD_RESTART
:
notifier_call_chain
(
&
reboot_notifier_list
,
SYS_RESTART
,
NULL
);
notifier_call_chain
(
&
reboot_notifier_list
,
SYS_RESTART
,
NULL
);
device_shutdown
();
printk
(
KERN_EMERG
"Restarting system.
\n
"
);
printk
(
KERN_EMERG
"Restarting system.
\n
"
);
machine_restart
(
NULL
);
machine_restart
(
NULL
);
break
;
break
;
...
@@ -312,6 +314,7 @@ asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void * arg)
...
@@ -312,6 +314,7 @@ asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void * arg)
case
LINUX_REBOOT_CMD_HALT
:
case
LINUX_REBOOT_CMD_HALT
:
notifier_call_chain
(
&
reboot_notifier_list
,
SYS_HALT
,
NULL
);
notifier_call_chain
(
&
reboot_notifier_list
,
SYS_HALT
,
NULL
);
device_shutdown
();
printk
(
KERN_EMERG
"System halted.
\n
"
);
printk
(
KERN_EMERG
"System halted.
\n
"
);
machine_halt
();
machine_halt
();
do_exit
(
0
);
do_exit
(
0
);
...
@@ -319,6 +322,7 @@ asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void * arg)
...
@@ -319,6 +322,7 @@ asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void * arg)
case
LINUX_REBOOT_CMD_POWER_OFF
:
case
LINUX_REBOOT_CMD_POWER_OFF
:
notifier_call_chain
(
&
reboot_notifier_list
,
SYS_POWER_OFF
,
NULL
);
notifier_call_chain
(
&
reboot_notifier_list
,
SYS_POWER_OFF
,
NULL
);
device_shutdown
();
printk
(
KERN_EMERG
"Power down.
\n
"
);
printk
(
KERN_EMERG
"Power down.
\n
"
);
machine_power_off
();
machine_power_off
();
do_exit
(
0
);
do_exit
(
0
);
...
@@ -332,6 +336,7 @@ asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void * arg)
...
@@ -332,6 +336,7 @@ asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void * arg)
buffer
[
sizeof
(
buffer
)
-
1
]
=
'\0'
;
buffer
[
sizeof
(
buffer
)
-
1
]
=
'\0'
;
notifier_call_chain
(
&
reboot_notifier_list
,
SYS_RESTART
,
buffer
);
notifier_call_chain
(
&
reboot_notifier_list
,
SYS_RESTART
,
buffer
);
device_shutdown
();
printk
(
KERN_EMERG
"Restarting system with command '%s'.
\n
"
,
buffer
);
printk
(
KERN_EMERG
"Restarting system with command '%s'.
\n
"
,
buffer
);
machine_restart
(
buffer
);
machine_restart
(
buffer
);
break
;
break
;
...
...
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