aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVeaceslav Falico <vfalico@gmail.com>2014-07-17 13:46:09 -0400
committerDavid S. Miller <davem@davemloft.net>2014-07-20 23:38:42 -0400
commitc6f854d57d704a97adbf952ef0948acc68f3312c (patch)
tree2b8a21dfe3c0af6c2a879b78d01ef6e6f024f7b3
parent3e403a77779faf046862d91c36ef79fb4b12be9a (diff)
net: use dev->name in netdev_pr* when it's available
netdev_name() returns dev->name only when the net_device is in NETREG_REGISTERED state. However, dev->name is always populated on creation, so we can easily use it. There are two cases when there's no real name - when it's an empty string or when the name is in form of "eth%d", then netdev_name() returns "unnamed net_device". CC: "David S. Miller" <davem@davemloft.net> CC: Tom Gundersen <teg@jklm.no> Signed-off-by: Veaceslav Falico <vfalico@gmail.com> Acked-by: Tom Gundersen <teg@jklm.no> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/linux/netdevice.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 15ed750458ad..70256aa2ae81 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3383,8 +3383,8 @@ extern struct pernet_operations __net_initdata loopback_net_ops;
3383 3383
3384static inline const char *netdev_name(const struct net_device *dev) 3384static inline const char *netdev_name(const struct net_device *dev)
3385{ 3385{
3386 if (dev->reg_state != NETREG_REGISTERED) 3386 if (!dev->name[0] || strchr(dev->name, '%'))
3387 return "(unregistered net_device)"; 3387 return "(unnamed net_device)";
3388 return dev->name; 3388 return dev->name;
3389} 3389}
3390 3390