[U-Boot] [RFC PATCH 1/7] net: Provide a function to get the current MAC address

Simon Glass sjg at chromium.org
Thu Jan 29 02:46:00 CET 2015


Hi Joe,

On 28 January 2015 at 02:45, Joe Hershberger <joe.hershberger at gmail.com> wrote:
> On Tue, Jan 27, 2015 at 8:33 PM, Simon Glass <sjg at chromium.org> wrote:
>>
>> Hi Joe,
>>
>> On 27 January 2015 at 16:27, Joe Hershberger <joe.hershberger at ni.com>
>> wrote:
>> > The current implementation exposes the eth_device struct to code that
>> > needs to access the MAC address.  Add a wrapper function for this to
>> > abstract away the pointer for this operation.
>> >
>> > Signed-off-by: Joe Hershberger <joe.hershberger at ni.com>
>> > ---
>> >
>> >  arch/mips/cpu/mips32/au1x00/au1x00_eth.c | 2 +-
>> >  arch/powerpc/cpu/mpc8260/ether_fcc.c     | 2 +-
>> >  arch/powerpc/cpu/mpc85xx/ether_fcc.c     | 2 +-
>> >  arch/powerpc/cpu/mpc8xx/scc.c            | 2 +-
>> >  include/net.h                            | 8 ++++++++
>> >  net/net.c                                | 2 +-
>> >  6 files changed, 13 insertions(+), 5 deletions(-)
>> >
>> > diff --git a/arch/mips/cpu/mips32/au1x00/au1x00_eth.c
>> > b/arch/mips/cpu/mips32/au1x00/au1x00_eth.c
>> > index 4770f56..535d713 100644
>> > --- a/arch/mips/cpu/mips32/au1x00/au1x00_eth.c
>> > +++ b/arch/mips/cpu/mips32/au1x00/au1x00_eth.c
>> > @@ -238,7 +238,7 @@ static int au1x00_init(struct eth_device* dev, bd_t
>> > * bd){
>> >         }
>> >
>> >         /* Put mac addr in little endian */
>> > -#define ea eth_get_dev()->enetaddr
>> > +#define ea eth_get_ethaddr()
>> >         *mac_addr_high  =       (ea[5] <<  8) | (ea[4]      ) ;
>> >         *mac_addr_low   =       (ea[3] << 24) | (ea[2] << 16) |
>>
>> I know this is existing code, but (perhaps separately) it might be
>> nice to remove the #define and assign it it to a local variable, i.e.:
>>
>> unsigned char *ea = eth_get_ethaddr();
>
> I'm sure that if this code is not deleted before it is reworked that this
> sort of improvement will be made.  For this series I just wanted to change
> as little as possible.  I agree that the #define is ugly.

OK sounds good.

Regards,
Simon


More information about the U-Boot mailing list