[PATCH 07/10] net: use dev_add_param_string

Sascha Hauer s.hauer at pengutronix.de
Mon Apr 10 00:14:17 PDT 2017


dev_add_param_string allows to pass a priv * so that the device_d *
argument is not needed and can be removed later.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 net/net.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/net/net.c b/net/net.c
index 3c0e715601..19b081f6cf 100644
--- a/net/net.c
+++ b/net/net.c
@@ -573,6 +573,9 @@ static struct device_d net_device = {
 	.id = DEVICE_ID_SINGLE,
 };
 
+static char *net_nameserver;
+static char *net_domainname;
+
 static int net_init(void)
 {
 	int i;
@@ -581,8 +584,12 @@ static int net_init(void)
 		NetRxPackets[i] = net_alloc_packet();
 
 	register_device(&net_device);
-	dev_add_param(&net_device, "nameserver", NULL, NULL, 0);
-	dev_add_param(&net_device, "domainname", NULL, NULL, 0);
+	net_nameserver = xstrdup("");
+	dev_add_param_string(&net_device, "nameserver", NULL, NULL,
+			     &net_nameserver, NULL);
+	net_domainname = xstrdup("");
+	dev_add_param_string(&net_device, "domainname", NULL, NULL,
+			     &net_domainname, NULL);
 
 	return 0;
 }
-- 
2.11.0




More information about the barebox mailing list