Subject: Re: [patch 09/11] b44: fix eeprom endianess issue

From: Jeff Garzik <[email-masked]>
Date: Mon, 25 Sep 2006 19:59:34 -0400

[email-masked] wrote:
> From: Michael Buesch <[email-masked]>
> 
> This fixes eeprom read on big-endian architectures.
> 
> Signed-off-by: Michael Buesch <[email-masked]>
> Cc: Jeff Garzik <[email-masked]>
> Signed-off-by: Andrew Morton <[email-masked]>
> ---
> 
>  drivers/net/b44.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff -puN drivers/net/b44.c~b44-fix-eeprom-endianess-issue drivers/net/b44.c
> --- a/drivers/net/b44.c~b44-fix-eeprom-endianess-issue
> +++ a/drivers/net/b44.c
> @@ -2055,7 +2055,7 @@ static int b44_read_eeprom(struct b44 *b
>  	u16 *ptr = (u16 *) data;
>  
>  	for (i = 0; i < 128; i += 2)
> -		ptr[i / 2] = readw(bp->regs + 4096 + i);
> +		ptr[i / 2] = cpu_to_le16(readw(bp->regs + 4096 + i));

Seems highly silly to me:  readw() already swaps on big endian, so 
you're just swapping again.  And then...  read the call of 
b44_read_eeprom():  bp->dev->dev_addr[] assignment is such that it swaps 
YET AGAIN.

Seems like a better solution would be to remove the manual swap from the 
caller of b44_read_eeprom().

	Jeff