From: Tom Gundersen <teg@jklm.no>
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, David Miller <davem@davemloft.net>,
David Herrmann <dh.herrmann@gmail.com>,
Kay Sievers <kay@vrfy.org>, Tom Gundersen <teg@jklm.no>,
Thomas Sailer <t.sailer@alumni.ethz.ch>,
Joerg Reuter <jreuter@yaina.de>,
Jean-Paul Roubelat <jpr@f6fbb.org>,
Wenliang Fan <fanwlexca@gmail.com>,
linux-hams@vger.kernel.org
Subject: [PATCH v7 22/33] net: hamradio - set name assign type
Date: Thu, 10 Jul 2014 10:17:27 +0200 [thread overview]
Message-ID: <1404980258-30853-23-git-send-email-teg@jklm.no> (raw)
In-Reply-To: <1404980258-30853-1-git-send-email-teg@jklm.no>
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 <teg@jklm.no>
Cc: Thomas Sailer <t.sailer@alumni.ethz.ch>
Cc: Joerg Reuter <jreuter@yaina.de>
Cc: Jean-Paul Roubelat <jpr@f6fbb.org>
Cc: Wenliang Fan <fanwlexca@gmail.com>
Cc: linux-hams@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
next prev parent reply other threads:[~2014-07-10 8:23 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-10 8:17 [PATCH v7 00/33] Provide netdev naming-policy via sysfs Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 01/33] net: add name_assign_type netdev attribute Tom Gundersen
2014-07-10 15:53 ` Nicolas Dichtel
2014-07-10 20:00 ` Tom Gundersen
2014-07-10 19:58 ` Arend van Spriel
2014-07-10 20:01 ` Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 02/33] net: set name assign type for renamed devices Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 03/33] net: set name_assign_type in alloc_netdev() Tom Gundersen
2014-07-10 9:16 ` Bjørn Mork
2014-07-10 10:21 ` Tom Gundersen
2014-07-10 11:29 ` Bjørn Mork
2014-07-10 13:02 ` Tom Gundersen
2014-07-10 13:27 ` Bjørn Mork
2014-07-10 8:17 ` [PATCH v7 04/33] net: set name assign type for names assigned using a static template Tom Gundersen
2014-07-10 8:52 ` Marc Kleine-Budde
2014-07-10 8:17 ` [PATCH v7 05/33] net: set name assign type for names assigned using a static string Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 06/33] net: set name assign type for names passed directly from userspace Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 07/33] net: rtnetlink - make create_link take name_assign_type Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 08/33] net: nl80211 - make rdev_add_virtual_intf " Tom Gundersen
2014-07-21 9:40 ` Johannes Berg
2014-07-21 17:03 ` Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 09/33] net: nl802154 - make add_iface take name assign type Tom Gundersen
2014-07-10 10:52 ` Alexander Aring
2014-07-10 8:17 ` [PATCH v7 10/33] net: dummy - set " Tom Gundersen
2014-07-10 9:31 ` Bjørn Mork
2014-07-10 10:12 ` Tom Gundersen
2014-07-10 10:26 ` David Herrmann
2014-07-10 10:33 ` Tom Gundersen
2014-07-10 11:44 ` Bjørn Mork
2014-07-10 12:18 ` Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 11/33] net: af_netrom " Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 12/33] net: af_rose " Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 13/33] net: mrt " Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 14/33] net: caif_serial " Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 15/33] net: xen-netback " Tom Gundersen
2014-07-10 8:25 ` Varka Bhadram
2014-07-10 9:01 ` Ian Campbell
2014-07-10 10:46 ` Tom Gundersen
2014-07-10 12:13 ` Ian Campbell
2014-07-10 8:17 ` [PATCH v7 16/33] net: gdm_lte " Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 17/33] net: airo " Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 18/33] net: arcdev - label alloc_arcdev names Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 19/33] net: isdn - set name assign type Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 20/33] net: irlan " Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 21/33] net: batman-adv " Tom Gundersen
2014-07-10 8:17 ` Tom Gundersen [this message]
2014-07-10 8:17 ` [PATCH v7 23/33] net: openvswitch " Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 24/33] net: vlan " Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 25/33] net: infiniband - steal ifname label Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 26/33] net: ipoib - set name assign type Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 27/33] net: tile " Tom Gundersen
2014-07-16 17:49 ` Chris Metcalf
2014-07-10 8:17 ` [PATCH v7 28/33] net: dsa " Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 29/33] net: brcmfmac " Tom Gundersen
2014-07-10 20:08 ` Arend van Spriel
2014-07-10 20:24 ` Tom Gundersen
2014-07-11 7:45 ` Arend van Spriel
2014-07-15 19:39 ` John W. Linville
2014-07-15 19:57 ` Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 30/33] net: ppp " Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 31/33] net: slcan " Tom Gundersen
2014-07-10 8:51 ` Marc Kleine-Budde
2014-07-10 8:17 ` [PATCH v7 32/33] net: x25_asy " Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 33/33] net: slip " Tom Gundersen
2014-07-10 8:43 ` [PATCH v7 00/33] Provide netdev naming-policy via sysfs David Miller
2014-07-10 9:19 ` Tom Gundersen
2014-07-10 19:11 ` Tom Gundersen
2014-07-10 19:19 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1404980258-30853-23-git-send-email-teg@jklm.no \
--to=teg@jklm.no \
--cc=davem@davemloft.net \
--cc=dh.herrmann@gmail.com \
--cc=fanwlexca@gmail.com \
--cc=jpr@f6fbb.org \
--cc=jreuter@yaina.de \
--cc=kay@vrfy.org \
--cc=linux-hams@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=t.sailer@alumni.ethz.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®