The hamradio devices are created the same way with the same names on module
init time so should therefore be PREDICTABLE rather than ENUM.

Signed-off-by: Tom Gundersen <t...@jklm.no>
Cc: Thomas Sailer <t.sai...@alumni.ethz.ch>
Cc: Joerg Reuter <jreu...@yaina.de>
Cc: Jean-Paul Roubelat <j...@f6fbb.org>
Cc: Wenliang Fan <fanwle...@gmail.com>
Cc: linux-h...@vger.kernel.org
---
 drivers/net/hamradio/baycom_par.c     |  3 ++-
 drivers/net/hamradio/baycom_ser_fdx.c |  3 ++-
 drivers/net/hamradio/baycom_ser_hdx.c |  3 ++-
 drivers/net/hamradio/dmascc.c         |  1 +
 drivers/net/hamradio/hdlcdrv.c        |  3 ++-
 drivers/net/hamradio/scc.c            | 11 ++++++-----
 drivers/net/hamradio/yam.c            |  2 +-
 include/linux/hdlcdrv.h               |  1 +
 8 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/drivers/net/hamradio/baycom_par.c 
b/drivers/net/hamradio/baycom_par.c
index acb6369..234df52 100644
--- a/drivers/net/hamradio/baycom_par.c
+++ b/drivers/net/hamradio/baycom_par.c
@@ -513,7 +513,8 @@ static int __init init_baycompar(void)
 
                dev = hdlcdrv_register(&par96_ops,
                                       sizeof(struct baycom_state),
-                                      ifname, iobase[i], 0, 0);
+                                      ifname, NET_NAME_PREDICTABLE,
+                                      iobase[i], 0, 0);
                if (IS_ERR(dev)) 
                        break;
 
diff --git a/drivers/net/hamradio/baycom_ser_fdx.c 
b/drivers/net/hamradio/baycom_ser_fdx.c
index 636b65c..c7786fc 100644
--- a/drivers/net/hamradio/baycom_ser_fdx.c
+++ b/drivers/net/hamradio/baycom_ser_fdx.c
@@ -648,7 +648,8 @@ static int __init init_baycomserfdx(void)
 
                dev = hdlcdrv_register(&ser12_ops, 
                                       sizeof(struct baycom_state),
-                                      ifname, iobase[i], irq[i], 0);
+                                      ifname, NET_NAME_PREDICTABLE,
+                                      iobase[i], irq[i], 0);
                if (IS_ERR(dev)) 
                        break;
 
diff --git a/drivers/net/hamradio/baycom_ser_hdx.c 
b/drivers/net/hamradio/baycom_ser_hdx.c
index f9a8976..8d9f85f 100644
--- a/drivers/net/hamradio/baycom_ser_hdx.c
+++ b/drivers/net/hamradio/baycom_ser_hdx.c
@@ -676,7 +676,8 @@ static int __init init_baycomserhdx(void)
 
                dev = hdlcdrv_register(&ser12_ops, 
                                       sizeof(struct baycom_state),
-                                      ifname, iobase[i], irq[i], 0);
+                                      ifname, NET_NAME_PREDICTABLE,
+                                      iobase[i], irq[i], 0);
                if (IS_ERR(dev)) 
                        break;
 
diff --git a/drivers/net/hamradio/dmascc.c b/drivers/net/hamradio/dmascc.c
index 0fad408..d7918ce 100644
--- a/drivers/net/hamradio/dmascc.c
+++ b/drivers/net/hamradio/dmascc.c
@@ -577,6 +577,7 @@ static int __init setup_adapter(int card_base, int type, 
int n)
                INIT_WORK(&priv->rx_work, rx_bh);
                dev->ml_priv = priv;
                sprintf(dev->name, "dmascc%i", 2 * n + i);
+               dev->name_assign_type =  NET_NAME_ENUM;
                dev->base_addr = card_base;
                dev->irq = irq;
                dev->netdev_ops = &scc_netdev_ops;
diff --git a/drivers/net/hamradio/hdlcdrv.c b/drivers/net/hamradio/hdlcdrv.c
index c67a272..13cbfde 100644
--- a/drivers/net/hamradio/hdlcdrv.c
+++ b/drivers/net/hamradio/hdlcdrv.c
@@ -687,6 +687,7 @@ static void hdlcdrv_setup(struct net_device *dev)
 /* --------------------------------------------------------------------- */
 struct net_device *hdlcdrv_register(const struct hdlcdrv_ops *ops,
                                    unsigned int privsize, const char *ifname,
+                                   unsigned char name_assign_type,
                                    unsigned int baseaddr, unsigned int irq, 
                                    unsigned int dma) 
 {
@@ -699,7 +700,7 @@ struct net_device *hdlcdrv_register(const struct 
hdlcdrv_ops *ops,
        if (privsize < sizeof(struct hdlcdrv_state))
                privsize = sizeof(struct hdlcdrv_state);
 
-       dev = alloc_netdev(privsize, ifname, NET_NAME_UNKNOWN, hdlcdrv_setup);
+       dev = alloc_netdev(privsize, ifname, name_assign_type, hdlcdrv_setup);
        if (!dev)
                return ERR_PTR(-ENOMEM);
 
diff --git a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c
index 57be9e0..a4fe9ba 100644
--- a/drivers/net/hamradio/scc.c
+++ b/drivers/net/hamradio/scc.c
@@ -202,7 +202,7 @@ static void init_channel(struct scc_channel *scc);
 static void scc_key_trx (struct scc_channel *scc, char tx);
 static void scc_init_timer(struct scc_channel *scc);
 
-static int scc_net_alloc(const char *name, struct scc_channel *scc);
+static int scc_net_alloc(const char *name, unsigned char name_assign_type, 
struct scc_channel *scc);
 static void scc_net_setup(struct net_device *dev);
 static int scc_net_open(struct net_device *dev);
 static int scc_net_close(struct net_device *dev);
@@ -1510,12 +1510,13 @@ static void z8530_init(void)
  * Allocate device structure, err, instance, and register driver
  */
 
-static int scc_net_alloc(const char *name, struct scc_channel *scc)
+static int scc_net_alloc(const char *name, unsigned char name_assign_type,
+                        struct scc_channel *scc)
 {
        int err;
        struct net_device *dev;
 
-       dev = alloc_netdev(0, name, NET_NAME_UNKNOWN, scc_net_setup);
+       dev = alloc_netdev(0, name, name_assign_type, scc_net_setup);
        if (!dev) 
                return -ENOMEM;
 
@@ -1815,7 +1816,7 @@ static int scc_net_ioctl(struct net_device *dev, struct 
ifreq *ifr, int cmd)
                                        
request_region(SCC_Info[2*Nchips+chan].ctrl, 1, "scc ctrl");
                                        
request_region(SCC_Info[2*Nchips+chan].data, 1, "scc data");
                                        if (Nchips+chan != 0 &&
-                                           scc_net_alloc(device_name, 
+                                           scc_net_alloc(device_name, 
NET_NAME_PREDICTABLE,
                                                          
&SCC_Info[2*Nchips+chan]))
                                            return -EINVAL;
                                }
@@ -2111,7 +2112,7 @@ static int __init scc_init_driver (void)
        sprintf(devname,"%s0", SCC_DriverName);
        
        rtnl_lock();
-       if (scc_net_alloc(devname, SCC_Info)) {
+       if (scc_net_alloc(devname, NET_NAME_PREDICTABLE, SCC_Info)) {
                rtnl_unlock();
                printk(KERN_ERR "z8530drv: cannot initialize module\n");
                return -EIO;
diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
index 717433c..3e73e4d 100644
--- a/drivers/net/hamradio/yam.c
+++ b/drivers/net/hamradio/yam.c
@@ -1147,7 +1147,7 @@ static int __init yam_init_driver(void)
                sprintf(name, "yam%d", i);
                
                dev = alloc_netdev(sizeof(struct yam_port), name,
-                                  NET_NAME_UNKNOWN, yam_setup);
+                                  NET_NAME_PREDICTABLE, yam_setup);
                if (!dev) {
                        pr_err("yam: cannot allocate net device\n");
                        err = -ENOMEM;
diff --git a/include/linux/hdlcdrv.h b/include/linux/hdlcdrv.h
index be3be25..2cb8295 100644
--- a/include/linux/hdlcdrv.h
+++ b/include/linux/hdlcdrv.h
@@ -264,6 +264,7 @@ void hdlcdrv_transmitter(struct net_device *, struct 
hdlcdrv_state *);
 void hdlcdrv_arbitrate(struct net_device *, struct hdlcdrv_state *);
 struct net_device *hdlcdrv_register(const struct hdlcdrv_ops *ops,
                                    unsigned int privsize, const char *ifname,
+                                   unsigned char name_assign_type,
                                    unsigned int baseaddr, unsigned int irq, 
                                    unsigned int dma);
 void hdlcdrv_unregister(struct net_device *dev);
-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to