Commit a52f362f authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds

[PATCH] uml: mostly const a structure

The chan_opts structure is mostly const, and needs no locking.  Comment the
lack of locking on the one field that can change.

Make all the other fields const.  It turned out that console_open_chan didn't
use its chan_opts argument, so that is deleted from the function and its
callers.
Signed-off-by: default avatarJeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 99b0278f
...@@ -354,8 +354,7 @@ int console_write_chan(struct list_head *chans, const char *buf, int len) ...@@ -354,8 +354,7 @@ int console_write_chan(struct list_head *chans, const char *buf, int len)
return ret; return ret;
} }
int console_open_chan(struct line *line, struct console *co, int console_open_chan(struct line *line, struct console *co)
const struct chan_opts *opts)
{ {
int err; int err;
...@@ -363,7 +362,7 @@ int console_open_chan(struct line *line, struct console *co, ...@@ -363,7 +362,7 @@ int console_open_chan(struct line *line, struct console *co,
if(err) if(err)
return err; return err;
printk("Console initialized on /dev/%s%d\n",co->name,co->index); printk("Console initialized on /dev/%s%d\n", co->name, co->index);
return 0; return 0;
} }
......
...@@ -38,6 +38,7 @@ static void ssl_announce(char *dev_name, int dev) ...@@ -38,6 +38,7 @@ static void ssl_announce(char *dev_name, int dev)
dev_name); dev_name);
} }
/* Almost const, except that xterm_title may be changed in an initcall */
static struct chan_opts opts = { static struct chan_opts opts = {
.announce = ssl_announce, .announce = ssl_announce,
.xterm_title = "Serial Line #%d", .xterm_title = "Serial Line #%d",
...@@ -171,7 +172,7 @@ static int ssl_console_setup(struct console *co, char *options) ...@@ -171,7 +172,7 @@ static int ssl_console_setup(struct console *co, char *options)
{ {
struct line *line = &serial_lines[co->index]; struct line *line = &serial_lines[co->index];
return console_open_chan(line, co, &opts); return console_open_chan(line, co);
} }
static struct console ssl_cons = { static struct console ssl_cons = {
......
...@@ -42,6 +42,7 @@ void stdio_announce(char *dev_name, int dev) ...@@ -42,6 +42,7 @@ void stdio_announce(char *dev_name, int dev)
dev_name); dev_name);
} }
/* Almost const, except that xterm_title may be changed in an initcall */
static struct chan_opts opts = { static struct chan_opts opts = {
.announce = stdio_announce, .announce = stdio_announce,
.xterm_title = "Virtual Console #%d", .xterm_title = "Virtual Console #%d",
...@@ -144,7 +145,7 @@ static int uml_console_setup(struct console *co, char *options) ...@@ -144,7 +145,7 @@ static int uml_console_setup(struct console *co, char *options)
{ {
struct line *line = &vts[co->index]; struct line *line = &vts[co->index];
return console_open_chan(line, co, &opts); return console_open_chan(line, co);
} }
static struct console stdiocons = { static struct console stdiocons = {
......
...@@ -36,8 +36,7 @@ extern int write_chan(struct list_head *chans, const char *buf, int len, ...@@ -36,8 +36,7 @@ extern int write_chan(struct list_head *chans, const char *buf, int len,
int write_irq); int write_irq);
extern int console_write_chan(struct list_head *chans, const char *buf, extern int console_write_chan(struct list_head *chans, const char *buf,
int len); int len);
extern int console_open_chan(struct line *line, struct console *co, extern int console_open_chan(struct line *line, struct console *co);
const struct chan_opts *opts);
extern void deactivate_chan(struct list_head *chans, int irq); extern void deactivate_chan(struct list_head *chans, int irq);
extern void reactivate_chan(struct list_head *chans, int irq); extern void reactivate_chan(struct list_head *chans, int irq);
extern void chan_enable_winch(struct list_head *chans, struct tty_struct *tty); extern void chan_enable_winch(struct list_head *chans, struct tty_struct *tty);
......
...@@ -9,11 +9,11 @@ ...@@ -9,11 +9,11 @@
#include "init.h" #include "init.h"
struct chan_opts { struct chan_opts {
void (*announce)(char *dev_name, int dev); void (*const announce)(char *dev_name, int dev);
char *xterm_title; char *xterm_title;
int raw; const int raw;
unsigned long tramp_stack; const unsigned long tramp_stack;
int in_kernel; const int in_kernel;
}; };
enum chan_init_pri { INIT_STATIC, INIT_ALL, INIT_ONE }; enum chan_init_pri { INIT_STATIC, INIT_ALL, INIT_ONE };
......
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