All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ivan Vecera <ivecera@redhat.com>
To: Jiri Pirko <jpirko@redhat.com>
Cc: Michal Schmidt <mschmidt@redhat.com>,
	linux-kernel@vger.kernel.org, jgarzik@pobox.com,
	davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH] 8139cp: allow to set mac address on running device
Date: Fri, 13 Mar 2009 10:01:21 +0100	[thread overview]
Message-ID: <49BA20E1.70607@redhat.com> (raw)
In-Reply-To: <20090312174641.GC20153@psychotron.englab.brq.redhat.com>

Jiri Pirko wrote:
> Thu, Mar 12, 2009 at 06:11:21PM CET, mschmidt@redhat.com wrote:
>> On Thu, 12 Mar 2009 17:27:31 +0100
>> Jiri Pirko <jpirko@redhat.com> wrote:
>>
>>> +	cpw32_f(MAC0 + 0, le32_to_cpu (*(__le32 *) (dev->dev_addr +
>>> 0)));
>>> +	cpw32_f(MAC0 + 4, le32_to_cpu (*(__le32 *) (dev->dev_addr +
>>> 4)));
>> You're writing to the card, so using *_to_cpu looks suspicious.
> Well, I'm using the same approach as it is already done in function
> cp_init_hw(). Quote:
> 
>  /* Restore our idea of the MAC address. */
>  cpw32_f (MAC0 + 0, le32_to_cpu (*(__le32 *) (dev->dev_addr + 0)));
>  cpw32_f (MAC0 + 4, le32_to_cpu (*(__le32 *) (dev->dev_addr + 4)));
> 
Yes, that's right but I would use more cleaner approach:
===
u32 low, high;
low  = addr[0] | (addr[1] << 8) | (addr[2] << 16) | (addr[3] << 24);
high = addr[4] | (addr[5] << 8);
cpw32_f(MAC0 + 0, low);
cpw32_f(MAC0 + 4, high);
===

Ivan

  reply	other threads:[~2009-03-13  9:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-12 16:27 [PATCH] 8139cp: allow to set mac address on running device Jiri Pirko
2009-03-12 17:11 ` Michal Schmidt
2009-03-12 17:46   ` Jiri Pirko
2009-03-13  9:01     ` Ivan Vecera [this message]
2009-03-13 11:16       ` Jiri Pirko
2009-03-13 13:11         ` Ivan Vecera
2009-03-13 13:36           ` Jeff Garzik
2009-03-13 13:39             ` Ivan Vecera
2009-03-13 18:47 ` David Miller

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=49BA20E1.70607@redhat.com \
    --to=ivecera@redhat.com \
    --cc=davem@davemloft.net \
    --cc=jgarzik@pobox.com \
    --cc=jpirko@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mschmidt@redhat.com \
    --cc=netdev@vger.kernel.org \
    /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.