[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: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c
index bce9b3427..7b8baf1 100644
--- a/arch/um/drivers/chan_kern.c
+++ b/arch/um/drivers/chan_kern.c
@@ -354,8 +354,7 @@
return ret;
}
-int console_open_chan(struct line *line, struct console *co,
- const struct chan_opts *opts)
+int console_open_chan(struct line *line, struct console *co)
{
int err;
@@ -363,7 +362,7 @@
if(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;
}
diff --git a/arch/um/drivers/ssl.c b/arch/um/drivers/ssl.c
index fe400ac..475de52 100644
--- a/arch/um/drivers/ssl.c
+++ b/arch/um/drivers/ssl.c
@@ -38,6 +38,7 @@
dev_name);
}
+/* Almost const, except that xterm_title may be changed in an initcall */
static struct chan_opts opts = {
.announce = ssl_announce,
.xterm_title = "Serial Line #%d",
@@ -171,7 +172,7 @@
{
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 = {
diff --git a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c
index 0b1bca4..a83c42c 100644
--- a/arch/um/drivers/stdio_console.c
+++ b/arch/um/drivers/stdio_console.c
@@ -42,6 +42,7 @@
dev_name);
}
+/* Almost const, except that xterm_title may be changed in an initcall */
static struct chan_opts opts = {
.announce = stdio_announce,
.xterm_title = "Virtual Console #%d",
@@ -144,7 +145,7 @@
{
struct line *line = &vts[co->index];
- return console_open_chan(line, co, &opts);
+ return console_open_chan(line, co);
}
static struct console stdiocons = {
diff --git a/arch/um/include/chan_kern.h b/arch/um/include/chan_kern.h
index 2d9aa7e..c4b41bb 100644
--- a/arch/um/include/chan_kern.h
+++ b/arch/um/include/chan_kern.h
@@ -36,8 +36,7 @@
int write_irq);
extern int console_write_chan(struct list_head *chans, const char *buf,
int len);
-extern int console_open_chan(struct line *line, struct console *co,
- const struct chan_opts *opts);
+extern int console_open_chan(struct line *line, struct console *co);
extern void deactivate_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);
diff --git a/arch/um/include/chan_user.h b/arch/um/include/chan_user.h
index a795547..ad671eb 100644
--- a/arch/um/include/chan_user.h
+++ b/arch/um/include/chan_user.h
@@ -9,11 +9,11 @@
#include "init.h"
struct chan_opts {
- void (*announce)(char *dev_name, int dev);
+ void (*const announce)(char *dev_name, int dev);
char *xterm_title;
- int raw;
- unsigned long tramp_stack;
- int in_kernel;
+ const int raw;
+ const unsigned long tramp_stack;
+ const int in_kernel;
};
enum chan_init_pri { INIT_STATIC, INIT_ALL, INIT_ONE };