Commit 2af4ba85 authored by Oliver Hartkopp's avatar Oliver Hartkopp Committed by David S. Miller

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: default avatarOliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8279171a
...@@ -473,12 +473,10 @@ static void slc_sync(void) ...@@ -473,12 +473,10 @@ static void slc_sync(void)
static struct slcan *slc_alloc(dev_t line) static struct slcan *slc_alloc(dev_t line)
{ {
int i; int i;
char name[IFNAMSIZ];
struct net_device *dev = NULL; struct net_device *dev = NULL;
struct slcan *sl; struct slcan *sl;
if (slcan_devs == NULL)
return NULL; /* Master array missing ! */
for (i = 0; i < maxdev; i++) { for (i = 0; i < maxdev; i++) {
dev = slcan_devs[i]; dev = slcan_devs[i];
if (dev == NULL) if (dev == NULL)
...@@ -490,25 +488,12 @@ static struct slcan *slc_alloc(dev_t line) ...@@ -490,25 +488,12 @@ static struct slcan *slc_alloc(dev_t line)
if (i >= maxdev) if (i >= maxdev)
return NULL; return NULL;
if (dev) {
sl = netdev_priv(dev);
if (test_bit(SLF_INUSE, &sl->flags)) {
unregister_netdevice(dev);
dev = NULL;
slcan_devs[i] = NULL;
}
}
if (!dev) {
char name[IFNAMSIZ];
sprintf(name, "slcan%d", i); sprintf(name, "slcan%d", i);
dev = alloc_netdev(sizeof(*sl), name, slc_setup); dev = alloc_netdev(sizeof(*sl), name, slc_setup);
if (!dev) if (!dev)
return NULL; return NULL;
dev->base_addr = i;
}
dev->base_addr = i;
sl = netdev_priv(dev); sl = netdev_priv(dev);
/* Initialize channel control data */ /* Initialize channel control data */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment