From: Stanislaw Gruszka <sgruszka@redhat.com>
To: Mathias Kresin <dev@kresin.me>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH] rt2x00: add support for mac addr from device tree
Date: Thu, 25 Aug 2016 11:33:31 +0200 [thread overview]
Message-ID: <20160825093330.GA2827@redhat.com> (raw)
In-Reply-To: <1472113162-26915-1-git-send-email-dev@kresin.me>
On Thu, Aug 25, 2016 at 10:19:22AM +0200, Mathias Kresin wrote:
> The EEPROM used on some CPEs has for every device the same generic
> ralink mac in EEPROM and needs to be overridden.
I don't know what is CPE, but even if I would know that, I most likely
sill will not understand that description.
> +++ b/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
> @@ -1459,10 +1459,7 @@ static int rt2400pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)
> * Start validation of the data that has been read.
> */
> mac = rt2x00_eeprom_addr(rt2x00dev, EEPROM_MAC_ADDR_0);
> - if (!is_valid_ether_addr(mac)) {
> - eth_random_addr(mac);
> - rt2x00_eeprom_dbg(rt2x00dev, "MAC: %pM\n", mac);
> - }
> + rt2x00lib_set_mac_address(rt2x00dev, mac);
<snip>
> +#include <linux/of.h>
> +#include <linux/of_net.h>
>
> #include "rt2x00.h"
> #include "rt2x00lib.h"
> @@ -931,6 +933,21 @@ static void rt2x00lib_rate(struct ieee80211_rate *entry,
> entry->flags |= IEEE80211_RATE_SHORT_PREAMBLE;
> }
>
> +void rt2x00lib_set_mac_address(struct rt2x00_dev *rt2x00dev, u8 *eeprom_mac_addr)
> +{
> + const char *mac_addr;
> +
> + mac_addr = of_get_mac_address(rt2x00dev->dev->of_node);
Shouldn't use dev_of_node(&rt2x00dev->dev) and check against NULL ?
> + if (mac_addr)
> + ether_addr_copy(eeprom_mac_addr, mac_addr);
Why we do not read MAC from EEPROM if fail to get it from of_node?
Thanks
Stanislaw
next prev parent reply other threads:[~2016-08-25 9:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-25 8:19 [PATCH] rt2x00: add support for mac addr from device tree Mathias Kresin
2016-08-25 9:33 ` Stanislaw Gruszka [this message]
2016-08-25 11:12 ` Mathias Kresin
2016-08-25 13:19 ` Stanislaw Gruszka
2016-08-25 15:03 ` Mathias Kresin
2016-08-25 15:18 ` Stanislaw Gruszka
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=20160825093330.GA2827@redhat.com \
--to=sgruszka@redhat.com \
--cc=dev@kresin.me \
--cc=linux-wireless@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).