aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/drivers
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2006-09-26 02:33:00 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-26 11:49:05 -0400
commit91b165c0594ab78c64f26d26e3174e6dfd60ed9d (patch)
tree0730eefa9d4ce786f7f561e3b40700418d6d0970 /arch/um/drivers
parent13c06be399902c9ebda08e092edb1614bb4a3761 (diff)
[PATCH] uml: Use ARRAY_SIZE more assiduously
There were a bunch of missed ARRAY_SIZE opportunities. Also, some formatting fixes in the affected areas of code. 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/um/drivers')
-rw-r--r--arch/um/drivers/chan_kern.c2
-rw-r--r--arch/um/drivers/mconsole_kern.c2
-rw-r--r--arch/um/drivers/mconsole_user.c7
-rw-r--r--arch/um/drivers/pcap_kern.c2
4 files changed, 7 insertions, 6 deletions
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c
index 7218c754505b..e82764f75e7f 100644
--- a/arch/um/drivers/chan_kern.c
+++ b/arch/um/drivers/chan_kern.c
@@ -544,7 +544,7 @@ static struct chan *parse_chan(struct line *line, char *str, int device,
544 544
545 ops = NULL; 545 ops = NULL;
546 data = NULL; 546 data = NULL;
547 for(i = 0; i < sizeof(chan_table)/sizeof(chan_table[0]); i++){ 547 for(i = 0; i < ARRAY_SIZE(chan_table); i++){
548 entry = &chan_table[i]; 548 entry = &chan_table[i];
549 if(!strncmp(str, entry->key, strlen(entry->key))){ 549 if(!strncmp(str, entry->key, strlen(entry->key))){
550 ops = entry->ops; 550 ops = entry->ops;
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index b414522f7686..79610b5ce67e 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -497,7 +497,7 @@ static void mconsole_get_config(int (*get_config)(char *, char *, int,
497 } 497 }
498 498
499 error = NULL; 499 error = NULL;
500 size = sizeof(default_buf)/sizeof(default_buf[0]); 500 size = ARRAY_SIZE(default_buf);
501 buf = default_buf; 501 buf = default_buf;
502 502
503 while(1){ 503 while(1){
diff --git a/arch/um/drivers/mconsole_user.c b/arch/um/drivers/mconsole_user.c
index 9bfd405c3bd8..5b2f5fe9e426 100644
--- a/arch/um/drivers/mconsole_user.c
+++ b/arch/um/drivers/mconsole_user.c
@@ -16,6 +16,7 @@
16#include "user.h" 16#include "user.h"
17#include "mconsole.h" 17#include "mconsole.h"
18#include "umid.h" 18#include "umid.h"
19#include "user_util.h"
19 20
20static struct mconsole_command commands[] = { 21static struct mconsole_command commands[] = {
21 /* With uts namespaces, uts information becomes process-specific, so 22 /* With uts namespaces, uts information becomes process-specific, so
@@ -65,14 +66,14 @@ static struct mconsole_command *mconsole_parse(struct mc_request *req)
65 struct mconsole_command *cmd; 66 struct mconsole_command *cmd;
66 int i; 67 int i;
67 68
68 for(i=0;i<sizeof(commands)/sizeof(commands[0]);i++){ 69 for(i = 0; i < ARRAY_SIZE(commands); i++){
69 cmd = &commands[i]; 70 cmd = &commands[i];
70 if(!strncmp(req->request.data, cmd->command, 71 if(!strncmp(req->request.data, cmd->command,
71 strlen(cmd->command))){ 72 strlen(cmd->command))){
72 return(cmd); 73 return cmd;
73 } 74 }
74 } 75 }
75 return(NULL); 76 return NULL;
76} 77}
77 78
78#define MIN(a,b) ((a)<(b) ? (a):(b)) 79#define MIN(a,b) ((a)<(b) ? (a):(b))
diff --git a/arch/um/drivers/pcap_kern.c b/arch/um/drivers/pcap_kern.c
index 466ff2c2f918..4c767c7adb96 100644
--- a/arch/um/drivers/pcap_kern.c
+++ b/arch/um/drivers/pcap_kern.c
@@ -76,7 +76,7 @@ int pcap_setup(char *str, char **mac_out, void *data)
76 if(host_if != NULL) 76 if(host_if != NULL)
77 init->host_if = host_if; 77 init->host_if = host_if;
78 78
79 for(i = 0; i < sizeof(options)/sizeof(options[0]); i++){ 79 for(i = 0; i < ARRAY_SIZE(options); i++){
80 if(options[i] == NULL) 80 if(options[i] == NULL)
81 continue; 81 continue;
82 if(!strcmp(options[i], "promisc")) 82 if(!strcmp(options[i], "promisc"))