Skip to content

Commit

Permalink
slcan: remove obsolete code in slcan initialisation
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Oliver Hartkopp authored and David S. Miller committed Jul 15, 2011
1 parent 8279171 commit 2af4ba8
Showing 1 changed file with 6 additions and 21 deletions.
27 changes: 6 additions & 21 deletions drivers/net/can/slcan.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,12 +473,10 @@ static void slc_sync(void)
static struct slcan *slc_alloc(dev_t line)
{
int i;
char name[IFNAMSIZ];
struct net_device *dev = NULL;
struct slcan *sl;

if (slcan_devs == NULL)
return NULL; /* Master array missing ! */

for (i = 0; i < maxdev; i++) {
dev = slcan_devs[i];
if (dev == NULL)
Expand All @@ -490,25 +488,12 @@ static struct slcan *slc_alloc(dev_t line)
if (i >= maxdev)
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);

dev = alloc_netdev(sizeof(*sl), name, slc_setup);
if (!dev)
return NULL;
dev->base_addr = i;
}
sprintf(name, "slcan%d", i);
dev = alloc_netdev(sizeof(*sl), name, slc_setup);
if (!dev)
return NULL;

dev->base_addr = i;
sl = netdev_priv(dev);

/* Initialize channel control data */
Expand Down

0 comments on commit 2af4ba8

Please sign in to comment.