aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2006-01-06 03:18:51 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-06 11:33:45 -0500
commit0834cc77af6a8a650f803d4a7c3c0f134b366f87 (patch)
treea23d3746dfed759b28c250a7b5365e035a0a6542 /arch/um
parentd50084a2991f3d9490d5c0f3af72e6fe1515a493 (diff)
[PATCH] uml: use ARRAY_SIZE
This patch replaces instances of "sizeof(foo)/sizeof(foo[0])" with ARRAY_SIZE(foo), which expands to the same thing. Signed-off-by: Jeff Dike <jdike@addtoit.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um')
-rw-r--r--arch/um/drivers/ssl.c20
-rw-r--r--arch/um/drivers/stdio_console.c13
2 files changed, 13 insertions, 20 deletions
diff --git a/arch/um/drivers/ssl.c b/arch/um/drivers/ssl.c
index 95a3eaa7163c..8564784cd2e1 100644
--- a/arch/um/drivers/ssl.c
+++ b/arch/um/drivers/ssl.c
@@ -84,21 +84,18 @@ static struct lines lines = LINES_INIT(NR_PORTS);
84 84
85static int ssl_config(char *str) 85static int ssl_config(char *str)
86{ 86{
87 return line_config(serial_lines, 87 return line_config(serial_lines, ARRAY_SIZE(serial_lines), str);
88 sizeof(serial_lines)/sizeof(serial_lines[0]), str);
89} 88}
90 89
91static int ssl_get_config(char *dev, char *str, int size, char **error_out) 90static int ssl_get_config(char *dev, char *str, int size, char **error_out)
92{ 91{
93 return line_get_config(dev, serial_lines, 92 return line_get_config(dev, serial_lines, ARRAY_SIZE(serial_lines), str,
94 sizeof(serial_lines)/sizeof(serial_lines[0]), 93 size, error_out);
95 str, size, error_out);
96} 94}
97 95
98static int ssl_remove(int n) 96static int ssl_remove(int n)
99{ 97{
100 return line_remove(serial_lines, 98 return line_remove(serial_lines, ARRAY_SIZE(serial_lines), n);
101 sizeof(serial_lines)/sizeof(serial_lines[0]), n);
102} 99}
103 100
104int ssl_open(struct tty_struct *tty, struct file *filp) 101int ssl_open(struct tty_struct *tty, struct file *filp)
@@ -205,7 +202,7 @@ int ssl_init(void)
205 serial_lines, 202 serial_lines,
206 ARRAY_SIZE(serial_lines)); 203 ARRAY_SIZE(serial_lines));
207 204
208 lines_init(serial_lines, sizeof(serial_lines)/sizeof(serial_lines[0])); 205 lines_init(serial_lines, ARRAY_SIZE(serial_lines));
209 206
210 new_title = add_xterm_umid(opts.xterm_title); 207 new_title = add_xterm_umid(opts.xterm_title);
211 if (new_title != NULL) 208 if (new_title != NULL)
@@ -221,16 +218,13 @@ static void ssl_exit(void)
221{ 218{
222 if (!ssl_init_done) 219 if (!ssl_init_done)
223 return; 220 return;
224 close_lines(serial_lines, 221 close_lines(serial_lines, ARRAY_SIZE(serial_lines));
225 sizeof(serial_lines)/sizeof(serial_lines[0]));
226} 222}
227__uml_exitcall(ssl_exit); 223__uml_exitcall(ssl_exit);
228 224
229static int ssl_chan_setup(char *str) 225static int ssl_chan_setup(char *str)
230{ 226{
231 return line_setup(serial_lines, 227 return line_setup(serial_lines, ARRAY_SIZE(serial_lines), str, 1);
232 sizeof(serial_lines)/sizeof(serial_lines[0]),
233 str, 1);
234} 228}
235 229
236__setup("ssl", ssl_chan_setup); 230__setup("ssl", ssl_chan_setup);
diff --git a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c
index 8f3b168a4b6a..b77f7d2ab83b 100644
--- a/arch/um/drivers/stdio_console.c
+++ b/arch/um/drivers/stdio_console.c
@@ -91,18 +91,17 @@ struct line vts[MAX_TTYS] = { LINE_INIT(CONFIG_CON_ZERO_CHAN, &driver),
91 91
92static int con_config(char *str) 92static int con_config(char *str)
93{ 93{
94 return line_config(vts, sizeof(vts)/sizeof(vts[0]), str); 94 return line_config(vts, ARRAY_SIZE(vts), str);
95} 95}
96 96
97static int con_get_config(char *dev, char *str, int size, char **error_out) 97static int con_get_config(char *dev, char *str, int size, char **error_out)
98{ 98{
99 return line_get_config(dev, vts, sizeof(vts)/sizeof(vts[0]), str, 99 return line_get_config(dev, vts, ARRAY_SIZE(vts), str, size, error_out);
100 size, error_out);
101} 100}
102 101
103static int con_remove(int n) 102static int con_remove(int n)
104{ 103{
105 return line_remove(vts, sizeof(vts)/sizeof(vts[0]), n); 104 return line_remove(vts, ARRAY_SIZE(vts), n);
106} 105}
107 106
108static int con_open(struct tty_struct *tty, struct file *filp) 107static int con_open(struct tty_struct *tty, struct file *filp)
@@ -170,7 +169,7 @@ int stdio_init(void)
170 return -1; 169 return -1;
171 printk(KERN_INFO "Initialized stdio console driver\n"); 170 printk(KERN_INFO "Initialized stdio console driver\n");
172 171
173 lines_init(vts, sizeof(vts)/sizeof(vts[0])); 172 lines_init(vts, ARRAY_SIZE(vts));
174 173
175 new_title = add_xterm_umid(opts.xterm_title); 174 new_title = add_xterm_umid(opts.xterm_title);
176 if(new_title != NULL) 175 if(new_title != NULL)
@@ -186,13 +185,13 @@ static void console_exit(void)
186{ 185{
187 if (!con_init_done) 186 if (!con_init_done)
188 return; 187 return;
189 close_lines(vts, sizeof(vts)/sizeof(vts[0])); 188 close_lines(vts, ARRAY_SIZE(vts));
190} 189}
191__uml_exitcall(console_exit); 190__uml_exitcall(console_exit);
192 191
193static int console_chan_setup(char *str) 192static int console_chan_setup(char *str)
194{ 193{
195 return line_setup(vts, sizeof(vts)/sizeof(vts[0]), str, 1); 194 return line_setup(vts, ARRAY_SIZE(vts), str, 1);
196} 195}
197__setup("con", console_chan_setup); 196__setup("con", console_chan_setup);
198__channel_help(console_chan_setup, "con"); 197__channel_help(console_chan_setup, "con");