mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Lucas Stach <dev@lynxeye.de>
To: barebox@lists.infradead.org
Subject: [PATCH 3/4] parameter: always build MAC dev param functions
Date: Fri, 26 Jun 2015 20:59:22 +0200	[thread overview]
Message-ID: <1435345163-16565-3-git-send-email-dev@lynxeye.de> (raw)
In-Reply-To: <1435345163-16565-1-git-send-email-dev@lynxeye.de>

The MAC dev parameter functions would only be built when CONFIG_NET is
set. This was okay as long as only network devices were using MAC dev
params. This has changed with the merge of the state framework, so
always compile them in if CONFIG_PARAMETER is set.

This moves some trivial functions to the header, to avoid the need to
also build net/eth.c in that case.

Fixes:
common/built-in.o: In function `state_mac_create':
common/state.c:387: undefined reference to `dev_add_param_mac'

Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
 include/net.h   | 30 ++++++++++++++++++++++++++++--
 lib/parameter.c |  2 --
 net/net.c       | 29 -----------------------------
 3 files changed, 28 insertions(+), 33 deletions(-)

diff --git a/include/net.h b/include/net.h
index 364011b..245d2b5 100644
--- a/include/net.h
+++ b/include/net.h
@@ -310,8 +310,34 @@ int string_to_ip(const char *s, IPaddr_t *ip);
 IPaddr_t getenv_ip(const char *name);
 int setenv_ip(const char *name, IPaddr_t ip);
 
-int string_to_ethaddr(const char *str, u8 enetaddr[6]);
-void ethaddr_to_string(const u8 enetaddr[6], char *str);
+static inline int string_to_ethaddr(const char *str, u8 enetaddr[6])
+{
+	int reg;
+	char *e;
+
+	if (!str || strlen(str) != 17) {
+		memset(enetaddr, 0, 6);
+		return -EINVAL;
+	}
+
+	if (str[2] != ':' || str[5] != ':' || str[8] != ':' ||
+	    str[11] != ':' || str[14] != ':')
+		return -EINVAL;
+
+	for (reg = 0; reg < 6; ++reg) {
+		enetaddr[reg] = simple_strtoul (str, &e, 16);
+		str = e + 1;
+	}
+
+	return 0;
+}
+
+static inline void ethaddr_to_string(const u8 enetaddr[6], char *str)
+{
+	sprintf(str, "%02x:%02x:%02x:%02x:%02x:%02x",
+		enetaddr[0], enetaddr[1], enetaddr[2], enetaddr[3],
+		enetaddr[4], enetaddr[5]);
+}
 
 #ifdef CONFIG_NET_RESOLV
 IPaddr_t resolv(char *host);
diff --git a/lib/parameter.c b/lib/parameter.c
index 865ad9f..f39b98d 100644
--- a/lib/parameter.c
+++ b/lib/parameter.c
@@ -575,7 +575,6 @@ struct param_d *dev_add_param_llint_ro(struct device_d *dev, const char *name,
 	return &piro->param;
 }
 
-#ifdef CONFIG_NET
 struct param_ip {
 	struct param_d param;
 	IPaddr_t *ip;
@@ -739,7 +738,6 @@ struct param_d *dev_add_param_mac(struct device_d *dev, const char *name,
 
 	return &pm->param;
 }
-#endif
 
 /**
  * dev_remove_param - remove a parameter from a device and free its
diff --git a/net/net.c b/net/net.c
index 07350ad..867ec07 100644
--- a/net/net.c
+++ b/net/net.c
@@ -136,35 +136,6 @@ void print_IPaddr (IPaddr_t x)
 	puts(ip_to_string(x));
 }
 
-int string_to_ethaddr(const char *str, u8 enetaddr[6])
-{
-	int reg;
-	char *e;
-
-        if (!str || strlen(str) != 17) {
-		memset(enetaddr, 0, 6);
-		return -EINVAL;
-	}
-
-        if (str[2] != ':' || str[5] != ':' || str[8] != ':' ||
-                        str[11] != ':' || str[14] != ':')
-                return -EINVAL;
-
-	for (reg = 0; reg < 6; ++reg) {
-		enetaddr[reg] = simple_strtoul (str, &e, 16);
-			str = e + 1;
-	}
-
-	return 0;
-}
-
-void ethaddr_to_string(const u8 enetaddr[6], char *str)
-{
-	sprintf(str, "%02x:%02x:%02x:%02x:%02x:%02x",
-		 enetaddr[0], enetaddr[1], enetaddr[2], enetaddr[3],
-		 enetaddr[4], enetaddr[5]);
-}
-
 static unsigned char *arp_ether;
 static IPaddr_t arp_wait_ip;
 
-- 
2.1.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2015-06-26 19:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-26 18:59 [PATCH 1/4] mtd: m25p80: explicitly cast name pointer Lucas Stach
2015-06-26 18:59 ` [PATCH 2/4] commands: digest: fix harmless warning Lucas Stach
2015-06-29  5:23   ` Sascha Hauer
2015-06-26 18:59 ` Lucas Stach [this message]
2015-06-26 18:59 ` [PATCH 4/4] mtd: spi-nor: depend on SPI Lucas Stach
2015-06-29  5:22   ` Sascha Hauer
2015-06-29  5:17 ` [PATCH 1/4] mtd: m25p80: explicitly cast name pointer Sascha Hauer

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=1435345163-16565-3-git-send-email-dev@lynxeye.de \
    --to=dev@lynxeye.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