* [PATCH 1/2] bootwrapper: Factor out dt_set_mac_address().
@ 2007-09-20 22:06 Scott Wood
2007-09-21 0:49 ` David Gibson
0 siblings, 1 reply; 2+ messages in thread
From: Scott Wood @ 2007-09-20 22:06 UTC (permalink / raw)
To: galak; +Cc: linuxppc-dev
This allows callers to set addresses one at a time when that would be more
convenient.
Signed-off-by: Scott Wood <scottwood@freescale.com>
---
arch/powerpc/boot/devtree.c | 31 +++++++++++++++++--------------
arch/powerpc/boot/ops.h | 1 +
2 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/arch/powerpc/boot/devtree.c b/arch/powerpc/boot/devtree.c
index 549463b..d78e8b4 100644
--- a/arch/powerpc/boot/devtree.c
+++ b/arch/powerpc/boot/devtree.c
@@ -88,29 +88,32 @@ void dt_fixup_clock(const char *path, u32 freq)
}
}
+void dt_set_mac_address(u32 index, const u8 *addr)
+{
+ void *devp = find_node_by_prop_value(NULL, "linux,network-index",
+ (void*)&index, sizeof(index));
+
+ if (devp) {
+ printf("ENET%d: local-mac-address <-"
+ " %02x:%02x:%02x:%02x:%02x:%02x\n\r", index,
+ addr[0], addr[1], addr[2],
+ addr[3], addr[4], addr[5]);
+
+ setprop(devp, "local-mac-address", addr, 6);
+ }
+}
+
void __dt_fixup_mac_addresses(u32 startindex, ...)
{
va_list ap;
u32 index = startindex;
- void *devp;
const u8 *addr;
va_start(ap, startindex);
- while ((addr = va_arg(ap, const u8 *))) {
- devp = find_node_by_prop_value(NULL, "linux,network-index",
- (void*)&index, sizeof(index));
- if (devp) {
- printf("ENET%d: local-mac-address <-"
- " %02x:%02x:%02x:%02x:%02x:%02x\n\r", index,
- addr[0], addr[1], addr[2],
- addr[3], addr[4], addr[5]);
+ while ((addr = va_arg(ap, const u8 *)))
+ dt_set_mac_address(index++, addr);
- setprop(devp, "local-mac-address", addr, 6);
- }
-
- index++;
- }
va_end(ap);
}
diff --git a/arch/powerpc/boot/ops.h b/arch/powerpc/boot/ops.h
index 703255b..d7a9a28 100644
--- a/arch/powerpc/boot/ops.h
+++ b/arch/powerpc/boot/ops.h
@@ -160,6 +160,7 @@ static inline void *find_node_by_devtype(const void *prev,
void dt_fixup_memory(u64 start, u64 size);
void dt_fixup_cpu_clocks(u32 cpufreq, u32 tbfreq, u32 busfreq);
void dt_fixup_clock(const char *path, u32 freq);
+void dt_set_mac_address(u32 index, const u8 *addr);
void __dt_fixup_mac_addresses(u32 startindex, ...);
#define dt_fixup_mac_addresses(...) \
__dt_fixup_mac_addresses(0, __VA_ARGS__, NULL)
--
1.5.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/2] bootwrapper: Factor out dt_set_mac_address().
2007-09-20 22:06 [PATCH 1/2] bootwrapper: Factor out dt_set_mac_address() Scott Wood
@ 2007-09-21 0:49 ` David Gibson
0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2007-09-21 0:49 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev
On Thu, Sep 20, 2007 at 05:06:15PM -0500, Scott Wood wrote:
> This allows callers to set addresses one at a time when that would be more
> convenient.
>
> Signed-off-by: Scott Wood <scottwood@freescale.com>
Um... I feel bad whinging about such a tiny nit, but...
> +void dt_set_mac_address(u32 index, const u8 *addr)
.. I'd prefer it was called dt_fixup_mac_address() to match the other
functions.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-09-21 0:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-20 22:06 [PATCH 1/2] bootwrapper: Factor out dt_set_mac_address() Scott Wood
2007-09-21 0:49 ` David Gibson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).