Re: [PATCH v2 2/3] MIPS: OCTEON: device_tree_init: don't fill mac if already set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.

On 2/24/2016 1:52 AM, Aaro Koskinen wrote:

Don't fill MAC address if it's already set. This allows DTB to
override the bootinfo.

Acked-by: David Daney <david.daney@xxxxxxxxxx>
Signed-off-by: Aaro Koskinen <aaro.koskinen@xxxxxx>
---
  arch/mips/cavium-octeon/octeon-platform.c | 8 ++++++++
  1 file changed, 8 insertions(+)

diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c
index a7d9f07..7aeafed 100644
--- a/arch/mips/cavium-octeon/octeon-platform.c
+++ b/arch/mips/cavium-octeon/octeon-platform.c
@@ -13,6 +13,7 @@
  #include <linux/i2c.h>
  #include <linux/usb.h>
  #include <linux/dma-mapping.h>
+#include <linux/etherdevice.h>
  #include <linux/module.h>
  #include <linux/mutex.h>
  #include <linux/slab.h>
@@ -525,10 +526,17 @@ static void __init octeon_fdt_set_phy(int eth, int phy_addr)

  static void __init octeon_fdt_set_mac_addr(int n, u64 *pmac)
  {
+	const u8 *old_mac;
+	int old_len;
  	u8 new_mac[6];
  	u64 mac = *pmac;
  	int r;

+	old_mac = fdt_getprop(initial_boot_params, n, "local-mac-address",
+			      &old_len);
+	if (!old_mac || old_len != 6 || is_valid_ether_addr(old_mac))
+		return;

   So if there's no such prop or the length is not 6, you just return?

[...]

MBR, Sergei





[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux