* [PATCH net-next-2.6] slcan: remove obsolete code in slcan initialisation
@ 2011-07-15 7:49 Oliver Hartkopp
2011-07-15 15:09 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Oliver Hartkopp @ 2011-07-15 7:49 UTC (permalink / raw)
To: David Miller; +Cc: Linux Netdev List, Matvejchikov Ilya
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>
---
diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
index 1b49df6..aa8ad73 100644
--- a/drivers/net/can/slcan.c
+++ b/drivers/net/can/slcan.c
@@ -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)
@@ -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 */
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next-2.6] slcan: remove obsolete code in slcan initialisation
2011-07-15 7:49 [PATCH net-next-2.6] slcan: remove obsolete code in slcan initialisation Oliver Hartkopp
@ 2011-07-15 15:09 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-07-15 15:09 UTC (permalink / raw)
To: socketcan; +Cc: netdev, matvejchikov
From: Oliver Hartkopp <socketcan@hartkopp.net>
Date: Fri, 15 Jul 2011 09:49:19 +0200
> 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>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-07-15 15:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-15 7:49 [PATCH net-next-2.6] slcan: remove obsolete code in slcan initialisation Oliver Hartkopp
2011-07-15 15:09 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).