aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2006-09-29 04:58:50 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-29 12:18:04 -0400
commit730760e90a173ef81f89beed2f1dad2fab310f68 (patch)
treee60039deb19683fac30e58277450c657ecd33e07 /arch
parentb10aeeef554eb1ff80e10111829f6e7484877811 (diff)
[PATCH] uml: locking documentation
Some locking documentation and a cleanup. uml_exitcode is copied into a local before sprintf sees it, in case sprintf does anything non-atomic with it. The rest are comments about why certain globals don't need any kind of locking. Signed-off-by: Jeff Dike <jdike@addtoit.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/um/drivers/null.c1
-rw-r--r--arch/um/drivers/random.c4
-rw-r--r--arch/um/drivers/stderr_console.c2
-rw-r--r--arch/um/drivers/stdio_console.c1
-rw-r--r--arch/um/kernel/exitcode.c8
5 files changed, 14 insertions, 2 deletions
diff --git a/arch/um/drivers/null.c b/arch/um/drivers/null.c
index 3683ed44315d..9016c68beee8 100644
--- a/arch/um/drivers/null.c
+++ b/arch/um/drivers/null.c
@@ -8,6 +8,7 @@
8#include "chan_user.h" 8#include "chan_user.h"
9#include "os.h" 9#include "os.h"
10 10
11/* This address is used only as a unique identifer */
11static int null_chan; 12static int null_chan;
12 13
13static void *null_init(char *str, int device, const struct chan_opts *opts) 14static void *null_init(char *str, int device, const struct chan_opts *opts)
diff --git a/arch/um/drivers/random.c b/arch/um/drivers/random.c
index ae9909415b9c..73b2bdd6d2d3 100644
--- a/arch/um/drivers/random.c
+++ b/arch/um/drivers/random.c
@@ -20,6 +20,10 @@
20 20
21#define RNG_MISCDEV_MINOR 183 /* official */ 21#define RNG_MISCDEV_MINOR 183 /* official */
22 22
23/* Changed at init time, in the non-modular case, and at module load
24 * time, in the module case. Presumably, the module subsystem
25 * protects against a module being loaded twice at the same time.
26 */
23static int random_fd = -1; 27static int random_fd = -1;
24 28
25static int rng_dev_open (struct inode *inode, struct file *filp) 29static int rng_dev_open (struct inode *inode, struct file *filp)
diff --git a/arch/um/drivers/stderr_console.c b/arch/um/drivers/stderr_console.c
index 6d2cf32a9e8f..911539293871 100644
--- a/arch/um/drivers/stderr_console.c
+++ b/arch/um/drivers/stderr_console.c
@@ -9,6 +9,8 @@
9/* 9/*
10 * Don't register by default -- as this registeres very early in the 10 * Don't register by default -- as this registeres very early in the
11 * boot process it becomes the default console. 11 * boot process it becomes the default console.
12 *
13 * Initialized at init time.
12 */ 14 */
13static int use_stderr_console = 0; 15static int use_stderr_console = 0;
14 16
diff --git a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c
index 5e44adb07051..e4bfcfe8550b 100644
--- a/arch/um/drivers/stdio_console.c
+++ b/arch/um/drivers/stdio_console.c
@@ -108,6 +108,7 @@ static int con_open(struct tty_struct *tty, struct file *filp)
108 return line_open(vts, tty); 108 return line_open(vts, tty);
109} 109}
110 110
111/* Set in an initcall, checked in an exitcall */
111static int con_init_done = 0; 112static int con_init_done = 0;
112 113
113static const struct tty_operations console_ops = { 114static const struct tty_operations console_ops = {
diff --git a/arch/um/kernel/exitcode.c b/arch/um/kernel/exitcode.c
index d21ebad666b4..8b7f2cdedf94 100644
--- a/arch/um/kernel/exitcode.c
+++ b/arch/um/kernel/exitcode.c
@@ -16,9 +16,13 @@ int uml_exitcode = 0;
16static int read_proc_exitcode(char *page, char **start, off_t off, 16static int read_proc_exitcode(char *page, char **start, off_t off,
17 int count, int *eof, void *data) 17 int count, int *eof, void *data)
18{ 18{
19 int len; 19 int len, val;
20 20
21 len = sprintf(page, "%d\n", uml_exitcode); 21 /* Save uml_exitcode in a local so that we don't need to guarantee
22 * that sprintf accesses it atomically.
23 */
24 val = uml_exitcode;
25 len = sprintf(page, "%d\n", val);
22 len -= off; 26 len -= off;
23 if(len <= off+count) *eof = 1; 27 if(len <= off+count) *eof = 1;
24 *start = page + off; 28 *start = page + off;