From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Hershberger Date: Wed, 4 Apr 2012 10:06:12 -0500 Subject: [U-Boot] [PATCH v4] net: allow setting env enetaddr from net device setting In-Reply-To: <1331089414-15080-1-git-send-email-robherring2@gmail.com> References: <1328138854-28612-1-git-send-email-robherring2@gmail.com> <1331089414-15080-1-git-send-email-robherring2@gmail.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Rob, On Tue, Mar 6, 2012 at 9:03 PM, Rob Herring wrote: > From: Rob Herring > > If the net driver has setup a valid ethernet address and an ethernet > address is not set in the environment already, then set the environment > variables from the net driver setting. > > This enables pxe booting on boards which don't set ethaddr env variable. > > Signed-off-by: Rob Herring > --- > v4: > - rewrite of documentation from Wolfgang > > v3: > - print a warning if using mac address from the net device > > v2: > - Re-wrote to always setup ethaddr env variables > > ?doc/README.enetaddr | ? ?6 +++++- > ?net/eth.c ? ? ? ? ? | ? 21 ++++++++++++++++++--- > ?2 files changed, 23 insertions(+), 4 deletions(-) checkpatch.pl failures: ------------------------------------- ERROR: trailing whitespace #48: FILE: doc/README.enetaddr:38: + If the environment variable is not set, it will be initialized from $ WARNING: line over 80 characters #80: FILE: net/eth.c:184: + if (!eth_getenv_enetaddr_by_index(base_name, eth_number, env_enetaddr)) { total: 1 errors, 1 warnings, 45 lines checked NOTE: whitespace errors detected, you may wish to use scripts/cleanpatch or scripts/cleanfile NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX MULTISTATEMENT_MACRO_USE_DO_WHILE U-Boot-v4-net-allow-setting-env-enetaddr-from-net-device-setting.patch has style problems, please review. ---------------------- Also, it seems that just because the enetaddr was read from dev (possibly from an eeprom or elsewhere) doesn't mean that the MAC doesn't need you to call write_hwaddr(). I think you shouldn't return 0 if you use the net device's addr, but rather should make the if (memcmp... into an else if. -Joe