Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Hauke Mehrtens <hauke@hauke-m.de>
To: Sergei Shtylyov <sshtylyov@mvista.com>
Cc: ralf@linux-mips.org, linux-mips@linux-mips.org
Subject: Re: [PATCH 5/5] MIPS: BCM47xx: Fix mac address parsing.
Date: Sat, 07 May 2011 18:15:35 +0200	[thread overview]
Message-ID: <4DC57027.2010806@hauke-m.de> (raw)
In-Reply-To: <4DC55F80.7010409@mvista.com>

On 05/07/2011 05:04 PM, Sergei Shtylyov wrote:
> Hello.
> 
> Hauke Mehrtens wrote:
> 
>> Some devices like the Netgear WGT634u are using minuses between the
>> blocks of the mac address and other devices are using colons to
>> separate them.
> 
>> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
>> ---
>>  arch/mips/include/asm/mach-bcm47xx/nvram.h |   11 +++++++++--
>>  1 files changed, 9 insertions(+), 2 deletions(-)
> 
>> diff --git a/arch/mips/include/asm/mach-bcm47xx/nvram.h
>> b/arch/mips/include/asm/mach-bcm47xx/nvram.h
>> index 9759588..fcdeca7 100644
>> --- a/arch/mips/include/asm/mach-bcm47xx/nvram.h
>> +++ b/arch/mips/include/asm/mach-bcm47xx/nvram.h
>> @@ -39,8 +39,15 @@ extern int nvram_getenv(char *name, char *val,
>> size_t val_len);
>>  
>>  static inline void nvram_parse_macaddr(char *buf, u8 *macaddr)
>>  {
>> -    sscanf(buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &macaddr[0],
>> &macaddr[1],
>> -           &macaddr[2], &macaddr[3], &macaddr[4], &macaddr[5]);
>> +    if (strchr(buf, ':')) {
>> +        sscanf(buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &macaddr[0],
>> &macaddr[1],
>> +            &macaddr[2], &macaddr[3], &macaddr[4], &macaddr[5]);
>> +    } else if (strchr(buf, '-')) {
>> +        sscanf(buf, "%hhx-%hhx-%hhx-%hhx-%hhx-%hhx", &macaddr[0],
>> &macaddr[1],
>> +            &macaddr[2], &macaddr[3], &macaddr[4], &macaddr[5]);
>> +    } else {
>> +        printk(KERN_WARNING "Can not parse mac address: %s\n", buf);
>> +    }
>>  }
>>  
>>  #endif
> 
>    checkcptach.pl says:
> 
> WARNING: line over 80 characters
> #21: FILE: arch/mips/include/asm/mach-bcm47xx/nvram.h:43:
> +        sscanf(buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &macaddr[0],
> &macaddr[1],
> 
> WARNING: line over 80 characters
> #24: FILE: arch/mips/include/asm/mach-bcm47xx/nvram.h:46:
> +        sscanf(buf, "%hhx-%hhx-%hhx-%hhx-%hhx-%hhx", &macaddr[0],
> &macaddr[1],
> 
> total: 0 errors, 2 warnings, 17 lines checked
> 
> patches/MIPS-BCM47xx-Fix-mac-address-parsing.patch has style problems,
> please review.  If any of these errors
> are false positives report them to the maintainer, see
> CHECKPATCH in MAINTAINERS.
> 
>    Additionally, though the script doesn't warn about this, {} are not
> necessary -- every branch is really a single statement.
> 
> WBR, Sergei
Hi Sergei,

I will fix this and send a new version. I checked it with checkpatch,
but changed some parts after that. ;-)

Hauke

  reply	other threads:[~2011-05-07 16:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-07 12:27 [PATCH 0/5] MIPS: BCM47xx: Enhancements in Parsing the NVRAM data Hauke Mehrtens
2011-05-07 12:27 ` [PATCH 1/5] ssb: Change fallback sprom to callback mechanism Hauke Mehrtens
2011-05-07 17:24   ` Jonas Gorski
2011-05-10 15:27     ` Ralf Baechle
2011-05-10 15:28       ` Michael Büsch
2011-05-07 12:27 ` [PATCH 2/5] MIPS: BCM47xx: extend bcm47xx_fill_sprom with prefix Hauke Mehrtens
2011-05-07 12:27 ` [PATCH 3/5] MIPS: BCM47xx: register ssb fallback sprom callback Hauke Mehrtens
2011-05-07 12:27 ` [PATCH 4/5] MIPS: BCM47xx: extend the filling of sprom from nvram Hauke Mehrtens
2011-05-07 12:27 ` [PATCH 5/5] MIPS: BCM47xx: Fix mac address parsing Hauke Mehrtens
2011-05-07 15:04   ` Sergei Shtylyov
2011-05-07 16:15     ` Hauke Mehrtens [this message]
2011-05-10 15:27 ` [PATCH 0/5] MIPS: BCM47xx: Enhancements in Parsing the NVRAM data Ralf Baechle
2011-05-10 15:29   ` Hauke Mehrtens

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=4DC57027.2010806@hauke-m.de \
    --to=hauke@hauke-m.de \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    --cc=sshtylyov@mvista.com \
    /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