linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][ATM] get lec net_device names correct
@ 2003-03-03 22:55 chas williams
  0 siblings, 0 replies; only message in thread
From: chas williams @ 2003-03-03 22:55 UTC (permalink / raw)
  To: David S. Miller; +Cc: linux-kernel

init_etherdev() allocates and registers the network device in one
step.  it uses eth%d as the template for the device names.  this
conflicts with already registered ethernet devices, like eth0.  since
we want a fixed (and different name) this patch uses alloc_etherdev,
rewrites the device name and then registers our interface.

Index: linux/net/atm/lec.c
===================================================================
RCS file: /home/chas/CVSROOT/linux/net/atm/lec.c,v
retrieving revision 1.12
diff -u -r1.12 lec.c
--- linux/net/atm/lec.c	3 Mar 2003 22:23:13 -0000	1.12
+++ linux/net/atm/lec.c	3 Mar 2003 22:29:02 -0000
@@ -784,15 +784,19 @@
                 size = sizeof(struct lec_priv);
 #ifdef CONFIG_TR
                 if (is_trdev)
-                        dev_lec[i] = init_trdev(NULL, size);
+                        dev_lec[i] = alloc_trdev(size);
                 else
 #endif
-                dev_lec[i] = init_etherdev(NULL, size);
+                dev_lec[i] = alloc_etherdev(size);
                 if (!dev_lec[i])
                         return -ENOMEM;
+                snprintf(dev_lec[i]->name, IFNAMSIZ, "lec%d", i);
+                if (register_netdev(dev_lec[i])) {
+                        kfree(dev_lec[i]);
+                        return -EINVAL;
+                }
                 priv = dev_lec[i]->priv;
                 priv->is_trdev = is_trdev;
-                sprintf(dev_lec[i]->name, "lec%d", i);
                 lec_init(dev_lec[i]);
         } else {
                 priv = dev_lec[i]->priv;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-03-03 22:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-03 22:55 [PATCH][ATM] get lec net_device names correct chas williams

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).