From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH] net: take eth id from devicetree alias
Date: Thu, 15 May 2014 10:05:23 +0200 [thread overview]
Message-ID: <1400141123-17004-1-git-send-email-s.hauer@pengutronix.de> (raw)
If the devicetree has an alias for the ethernet device, then use
it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
net/eth.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/net/eth.c b/net/eth.c
index 26a5ff7..b830f79 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -330,12 +330,21 @@ int eth_register(struct eth_device *edev)
}
strcpy(edev->dev.name, "eth");
- edev->dev.id = DEVICE_ID_DYNAMIC;
if (edev->parent)
edev->dev.parent = edev->parent;
- register_device(&edev->dev);
+ if (edev->dev.parent && edev->dev.parent->device_node) {
+ edev->dev.id = of_alias_get_id(edev->dev.parent->device_node, "ethernet");
+ if (edev->dev.id < 0)
+ edev->dev.id = DEVICE_ID_DYNAMIC;
+ } else {
+ edev->dev.id = DEVICE_ID_DYNAMIC;
+ }
+
+ ret = register_device(&edev->dev);
+ if (ret)
+ return ret;
dev_add_param_ip(dev, "ipaddr", NULL, NULL, &edev->ipaddr, edev);
dev_add_param_ip(dev, "serverip", NULL, NULL, &edev->serverip, edev);
--
2.0.0.rc0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
reply other threads:[~2014-05-15 8:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1400141123-17004-1-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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