diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2016-05-18 10:27:24 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2016-07-14 22:24:53 +0200 |
commit | 5ed70d2fa244e9d680cb2f69153fcb2ea52ea57a (patch) | |
tree | 9719c35a44551b951524b5e6f0be485e5c09eda1 /include/net.h | |
parent | 8b3244d3a8e06d743c58324ab407e3746c4e1e84 (diff) | |
download | barebox-5ed70d2fa244e9d680cb2f69153fcb2ea52ea57a.tar.gz barebox-5ed70d2fa244e9d680cb2f69153fcb2ea52ea57a.tar.xz |
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 <s.hauer@pengutronix.de>
Diffstat (limited to 'include/net.h')
-rw-r--r-- | include/net.h | 6 |
1 files changed, 6 insertions, 0 deletions
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); |