From: Jeff Garzik <jgarzik@pobox.com>
To: Ivan Vecera <ivecera@redhat.com>
Cc: Jiri Pirko <jpirko@redhat.com>,
Michal Schmidt <mschmidt@redhat.com>,
linux-kernel@vger.kernel.org, davem@davemloft.net,
netdev@vger.kernel.org
Subject: Re: [PATCH] 8139cp: allow to set mac address on running device
Date: Fri, 13 Mar 2009 09:36:43 -0400 [thread overview]
Message-ID: <49BA616B.5080902@pobox.com> (raw)
In-Reply-To: <49BA5B98.90604@redhat.com>
Ivan Vecera wrote:
> Jiri Pirko wrote:
>> Fri, Mar 13, 2009 at 10:01:21AM CET, ivecera@redhat.com wrote:
>>> 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);
>>> ===
>> Well, I have no problem with this (in fact I like this more). I just wanted to
>> stay consistent to existing code. Maybe it would be good to change this chunk
>> of code in cp_init_hw() too, don't you think?
> Yes, you're right.
The existing code is correct, and works. How about just leaving it alone?
You can grep around and see other drivers doing this when necessary, too.
Jeff
next prev parent reply other threads:[~2009-03-13 13:36 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
2009-03-13 11:16 ` Jiri Pirko
2009-03-13 13:11 ` Ivan Vecera
2009-03-13 13:36 ` Jeff Garzik [this message]
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=49BA616B.5080902@pobox.com \
--to=jgarzik@pobox.com \
--cc=davem@davemloft.net \
--cc=ivecera@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).