diff options
author | Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> | 2007-05-06 17:51:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-07 15:13:02 -0400 |
commit | c74c69b442364125fd13259ecaa4cd2ee43b9172 (patch) | |
tree | 431e362c3402bd0f554aac1730d0264da71c0807 /arch/um | |
parent | 8c8408358f19a386298744829bf67b90c129ff18 (diff) |
uml: Replace one-element array with zero-element array
To look at users I did:
$ find arch/um/ include/asm-um -name '*.[ch]'|xargs grep -r 'net_kern\.h'
+-l|xargs grep '\<user\>'
Most users just cast user to the appropriate pointer, the remaining ones are
fixed here. In net_kern.c, I'm almost sure that save trick is not needed
anymore, but I've not verified it.
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/drivers/net_kern.c | 14 | ||||
-rw-r--r-- | arch/um/include/net_kern.h | 2 |
2 files changed, 4 insertions, 12 deletions
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c index 3f5e8e634308..b2c292a66218 100644 --- a/arch/um/drivers/net_kern.c +++ b/arch/um/drivers/net_kern.c | |||
@@ -347,10 +347,9 @@ static void eth_configure(int n, void *init, char *mac, | |||
347 | struct uml_net *device; | 347 | struct uml_net *device; |
348 | struct net_device *dev; | 348 | struct net_device *dev; |
349 | struct uml_net_private *lp; | 349 | struct uml_net_private *lp; |
350 | int save, err, size; | 350 | int err, size; |
351 | 351 | ||
352 | size = transport->private_size + sizeof(struct uml_net_private) + | 352 | size = transport->private_size + sizeof(struct uml_net_private); |
353 | sizeof(((struct uml_net_private *) 0)->user); | ||
354 | 353 | ||
355 | device = kzalloc(sizeof(*device), GFP_KERNEL); | 354 | device = kzalloc(sizeof(*device), GFP_KERNEL); |
356 | if (device == NULL) { | 355 | if (device == NULL) { |
@@ -409,12 +408,6 @@ static void eth_configure(int n, void *init, char *mac, | |||
409 | */ | 408 | */ |
410 | (*transport->kern->init)(dev, init); | 409 | (*transport->kern->init)(dev, init); |
411 | 410 | ||
412 | /* lp.user is the first four bytes of the transport data, which | ||
413 | * has already been initialized. This structure assignment will | ||
414 | * overwrite that, so we make sure that .user gets overwritten with | ||
415 | * what it already has. | ||
416 | */ | ||
417 | save = lp->user[0]; | ||
418 | *lp = ((struct uml_net_private) | 411 | *lp = ((struct uml_net_private) |
419 | { .list = LIST_HEAD_INIT(lp->list), | 412 | { .list = LIST_HEAD_INIT(lp->list), |
420 | .dev = dev, | 413 | .dev = dev, |
@@ -428,8 +421,7 @@ static void eth_configure(int n, void *init, char *mac, | |||
428 | .write = transport->kern->write, | 421 | .write = transport->kern->write, |
429 | .add_address = transport->user->add_address, | 422 | .add_address = transport->user->add_address, |
430 | .delete_address = transport->user->delete_address, | 423 | .delete_address = transport->user->delete_address, |
431 | .set_mtu = transport->user->set_mtu, | 424 | .set_mtu = transport->user->set_mtu }); |
432 | .user = { save } }); | ||
433 | 425 | ||
434 | init_timer(&lp->tl); | 426 | init_timer(&lp->tl); |
435 | spin_lock_init(&lp->lock); | 427 | spin_lock_init(&lp->lock); |
diff --git a/arch/um/include/net_kern.h b/arch/um/include/net_kern.h index 125ab42df18a..9237056b9103 100644 --- a/arch/um/include/net_kern.h +++ b/arch/um/include/net_kern.h | |||
@@ -40,7 +40,7 @@ struct uml_net_private { | |||
40 | void (*add_address)(unsigned char *, unsigned char *, void *); | 40 | void (*add_address)(unsigned char *, unsigned char *, void *); |
41 | void (*delete_address)(unsigned char *, unsigned char *, void *); | 41 | void (*delete_address)(unsigned char *, unsigned char *, void *); |
42 | int (*set_mtu)(int mtu, void *); | 42 | int (*set_mtu)(int mtu, void *); |
43 | int user[1]; | 43 | char user[0]; |
44 | }; | 44 | }; |
45 | 45 | ||
46 | struct net_kern_info { | 46 | struct net_kern_info { |