From 5ed70d2fa244e9d680cb2f69153fcb2ea52ea57a Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Wed, 18 May 2016 10:27:24 +0200 Subject: net: eth: add name to struct eth_device Using dev_name often is not a good idea since it's a statically allocated string which gets overwritten by later calls to dev_name. Add a devname string to struct eth_device to have the name available for later use. Signed-off-by: Sascha Hauer --- include/net.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/net.h') diff --git a/include/net.h b/include/net.h index 81118d26dc..8f857c8f85 100644 --- a/include/net.h +++ b/include/net.h @@ -51,6 +51,7 @@ struct eth_device { struct phy_device *phydev; struct device_d dev; + char *devname; struct device_d *parent; char *nodepath; @@ -65,6 +66,11 @@ struct eth_device { #define dev_to_edev(d) container_of(d, struct eth_device, dev) +static inline const char *eth_name(struct eth_device *edev) +{ + return edev->devname; +} + int eth_register(struct eth_device* dev); /* Register network device */ void eth_unregister(struct eth_device* dev); /* Unregister network device */ int eth_set_ethaddr(struct eth_device *edev, const char *ethaddr); -- cgit v1.2.3