netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] Initialize dev_id sysfs attribute to -1 by default
@ 2013-05-30 13:25 Narendra_K
  2013-05-30 13:38 ` Bjørn Mork
  0 siblings, 1 reply; 9+ messages in thread
From: Narendra_K @ 2013-05-30 13:25 UTC (permalink / raw)
  To: netdev; +Cc: bhutchings

From: Narendra K <narendra_k@dell.com>

'dev_id' sysfs attribute is initialized to zero by default.
It is also zero based. This creates ambiguity in differentiating
whether the driver set it to zero or it is the default value.
Initialize 'dev_id' to -1 to make the scenario unambiguous.

Signed-off-by: Narendra K <narendra_k@dell.com>
---
The patch applies to net-next tree.

 include/linux/netdevice.h | 2 +-
 net/core/dev.c            | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 8f967e3..986867e 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1142,7 +1142,7 @@ struct net_device {
 	unsigned char		addr_assign_type; /* hw address assignment type */
 	unsigned char		addr_len;	/* hardware address length	*/
 	unsigned char		neigh_priv_len;
-	unsigned short          dev_id;		/* for shared network cards */
+	short 			dev_id;		/* physical port number */
 
 	spinlock_t		addr_list_lock;
 	struct netdev_hw_addr_list	uc;	/* Unicast mac addresses */
diff --git a/net/core/dev.c b/net/core/dev.c
index d4d874a..aca6002 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5727,6 +5727,7 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
 	INIT_LIST_HEAD(&dev->upper_dev_list);
 	dev->priv_flags = IFF_XMIT_DST_RELEASE;
 	setup(dev);
+	dev->dev_id = -1;
 
 	dev->num_tx_queues = txqs;
 	dev->real_num_tx_queues = txqs;
-- 
1.8.0.1

-- 
With regards,
Narendra K
Linux Engineering
Dell Inc.

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-06-10 18:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-30 13:25 [RFC PATCH] Initialize dev_id sysfs attribute to -1 by default Narendra_K
2013-05-30 13:38 ` Bjørn Mork
2013-05-31 12:17   ` Narendra_K
2013-06-07 14:45     ` John Fastabend
2013-06-07 15:23       ` Ben Hutchings
2013-06-07 17:15         ` John Fastabend
2013-06-10 18:11           ` Narendra_K
2013-06-10 18:43             ` John Fastabend
2013-06-07 17:02       ` Ben Hutchings

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