All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Buesch <mb@bu3sch.de>
To: bryan.wu@analog.com
Cc: Mike Frysinger <vapier.adi@gmail.com>,
	Jeff Garzik <jeff@garzik.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	netdev@vger.kernel.org
Subject: Re: [PATCH try#2] Blackfin ethernet driver: on chip ethernet MAC controller driver
Date: Sun, 15 Jul 2007 14:17:10 +0200	[thread overview]
Message-ID: <200707151417.10964.mb@bu3sch.de> (raw)
In-Reply-To: <1184501264.3140.71.camel@roc-laptop>

On Sunday 15 July 2007 14:07:44 Bryan Wu wrote:
> @@ -483,9 +487,12 @@
>  
>  void setup_mac_addr(u8 * mac_addr)
>  {
> +	u32 addr_low = le32_to_cpu(*(u32 *) & mac_addr[0]);
> +	u16 addr_hi = le16_to_cpu(*(u16 *) & mac_addr[4]);
> +
>  	/* this depends on a little-endian machine */
> -	bfin_write_EMAC_ADDRLO(*(u32 *) & mac_addr[0]);
> -	bfin_write_EMAC_ADDRHI(*(u16 *) & mac_addr[4]);
> +	bfin_write_EMAC_ADDRLO(addr_low);
> +	bfin_write_EMAC_ADDRHI(addr_hi);
>  }
>  
>  static void adjust_tx_list(void)
> @@ -866,10 +873,10 @@
>  	int retval;
>  
>  	/* Grab the MAC address in the MAC */
> -	*(u32 *) (&(dev->dev_addr[0])) = bfin_read_EMAC_ADDRLO();
> -	*(u16 *) (&(dev->dev_addr[4])) = (u16) bfin_read_EMAC_ADDRHI();
> +	*(u32 *) (&(dev->dev_addr[0])) = cpu_to_le32(bfin_read_EMAC_ADDRLO());
> +	*(u16 *) (&(dev->dev_addr[4])) = cpu_to_le16((u16) bfin_read_EMAC_ADDRHI());

Try something like this:

@@ -483,9 +487,12 @@
 
 void setup_mac_addr(u8 * mac_addr)
 {
+       u32 addr_low = le32_to_cpu(*(__le32 *) & mac_addr[0]);
+       u16 addr_hi = le16_to_cpu(*(__le16 *) & mac_addr[4]);
+
-       /* this depends on a little-endian machine */
-       bfin_write_EMAC_ADDRLO(*(u32 *) & mac_addr[0]);
-       bfin_write_EMAC_ADDRHI(*(u16 *) & mac_addr[4]);
+       bfin_write_EMAC_ADDRLO(addr_low);
+       bfin_write_EMAC_ADDRHI(addr_hi);
 }
 
 static void adjust_tx_list(void)
@@ -866,10 +873,10 @@
        int retval;
 
        /* Grab the MAC address in the MAC */
-       *(u32 *) (&(dev->dev_addr[0])) = bfin_read_EMAC_ADDRLO();
-       *(u16 *) (&(dev->dev_addr[4])) = (u16) bfin_read_EMAC_ADDRHI();
+       *(__le32 *) (&(dev->dev_addr[0])) = cpu_to_le32(bfin_read_EMAC_ADDRLO());
+       *(__le16 *) (&(dev->dev_addr[4])) = cpu_to_le16((u16) bfin_read_EMAC_ADDRHI());

-- 
Greetings Michael.

  reply	other threads:[~2007-07-15 12:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-15  9:27 [PATCH try#2] Blackfin ethernet driver: on chip ethernet MAC controller driver Bryan Wu
2007-07-15 10:36 ` Michael Buesch
2007-07-15 10:53   ` Christoph Hellwig
2007-07-15 12:10     ` Bryan Wu
2007-07-15 12:07   ` Bryan Wu
2007-07-15 12:17     ` Michael Buesch [this message]
2007-07-15 14:01       ` Bryan Wu
2007-07-15 21:20         ` Michael Buesch
     [not found] <fa.5lu+DP35wuS4CFlDsNA/BKJaNLI@ifi.uio.no>
     [not found] ` <fa.IGI2ikYsGUxtIMQBx6oB1nxippo@ifi.uio.no>
     [not found]   ` <fa.FVZq5uXBDDioKCwtChqo2Evai8U@ifi.uio.no>
     [not found]     ` <fa.4ke11capcBR0kfkUX3qhQonKSzQ@ifi.uio.no>
     [not found]       ` <fa.d13aWxWKs5IcQxfZHLSYGoam7rQ@ifi.uio.no>
2007-07-15 18:27         ` Robert Hancock

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=200707151417.10964.mb@bu3sch.de \
    --to=mb@bu3sch.de \
    --cc=akpm@linux-foundation.org \
    --cc=bryan.wu@analog.com \
    --cc=jeff@garzik.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=vapier.adi@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.