diff options
author | Oliver Hartkopp <socketcan@hartkopp.net> | 2011-07-14 17:49:19 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-07-15 11:08:26 -0400 |
commit | 2af4ba85913bb1755a06193109917c3ddc130265 (patch) | |
tree | 2bc140b52c0c5826ba10cf7c70b9f9007916bc32 /drivers/net/can/slcan.c | |
parent | 8279171a5fe95902be12f4018907f246d51616d4 (diff) |
slcan: remove obsolete code in slcan initialisation
This patch removes obsolete code in the initialisation/creation of
slcan devices.
It follows the suggested cleanups from Ilya Matvejchikov in
drivers/net/slip.c that where recently applied to net-next-2.6:
- slip: remove dead code within the slip initialization
- slip: remove redundant check slip_devs for NULL
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/can/slcan.c')
-rw-r--r-- | drivers/net/can/slcan.c | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c index 1b49df6b2470..aa8ad73477ba 100644 --- a/drivers/net/can/slcan.c +++ b/drivers/net/can/slcan.c | |||
@@ -473,12 +473,10 @@ static void slc_sync(void) | |||
473 | static struct slcan *slc_alloc(dev_t line) | 473 | static struct slcan *slc_alloc(dev_t line) |
474 | { | 474 | { |
475 | int i; | 475 | int i; |
476 | char name[IFNAMSIZ]; | ||
476 | struct net_device *dev = NULL; | 477 | struct net_device *dev = NULL; |
477 | struct slcan *sl; | 478 | struct slcan *sl; |
478 | 479 | ||
479 | if (slcan_devs == NULL) | ||
480 | return NULL; /* Master array missing ! */ | ||
481 | |||
482 | for (i = 0; i < maxdev; i++) { | 480 | for (i = 0; i < maxdev; i++) { |
483 | dev = slcan_devs[i]; | 481 | dev = slcan_devs[i]; |
484 | if (dev == NULL) | 482 | if (dev == NULL) |
@@ -490,25 +488,12 @@ static struct slcan *slc_alloc(dev_t line) | |||
490 | if (i >= maxdev) | 488 | if (i >= maxdev) |
491 | return NULL; | 489 | return NULL; |
492 | 490 | ||
493 | if (dev) { | 491 | sprintf(name, "slcan%d", i); |
494 | sl = netdev_priv(dev); | 492 | dev = alloc_netdev(sizeof(*sl), name, slc_setup); |
495 | if (test_bit(SLF_INUSE, &sl->flags)) { | 493 | if (!dev) |
496 | unregister_netdevice(dev); | 494 | return NULL; |
497 | dev = NULL; | ||
498 | slcan_devs[i] = NULL; | ||
499 | } | ||
500 | } | ||
501 | |||
502 | if (!dev) { | ||
503 | char name[IFNAMSIZ]; | ||
504 | sprintf(name, "slcan%d", i); | ||
505 | |||
506 | dev = alloc_netdev(sizeof(*sl), name, slc_setup); | ||
507 | if (!dev) | ||
508 | return NULL; | ||
509 | dev->base_addr = i; | ||
510 | } | ||
511 | 495 | ||
496 | dev->base_addr = i; | ||
512 | sl = netdev_priv(dev); | 497 | sl = netdev_priv(dev); |
513 | 498 | ||
514 | /* Initialize channel control data */ | 499 | /* Initialize channel control data */ |