From: Gabor Juhos <juhosg@openwrt.org>
To: Stanislaw Gruszka <stf_xl@wp.pl>
Cc: John Linville <linville@tuxdriver.com>,
linux-wireless@vger.kernel.org, users@rt2x00.serialmonkey.com
Subject: Re: [rt2x00-users] [PATCH 4/5] rt2x00: rt2800lib: introduce rt2800_eeprom_word_index helper
Date: Wed, 03 Jul 2013 22:23:26 +0200 [thread overview]
Message-ID: <51D4883E.2050607@openwrt.org> (raw)
In-Reply-To: <20130703192813.GD2245@localhost.localdomain>
Hi Stanislaw,
Thank you for the comments.
> On Wed, Jun 26, 2013 at 07:55:17PM +0200, Gabor Juhos wrote:
>> Instead of assign the offset value to the
>> enum directly use a new helper function to
>> convert a rt2800_eeprom_word enum into an
>> index of the rt2x00_dev->eeprom array.
>>
>> The patch does not change the existing
>> behaviour, but makes it possible to add
>> support for three-chain devices which are
>> using a different EEPROM layout.
>>
>> Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
>
> Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
>
> I have two nit-picks, but they can be fixed later on top of your current
> patches.
>
>> + if (WARN_ON(word >= EEPROM_WORD_COUNT)) {
>> + rt2x00_warn(rt2x00dev, "invalid EEPROM word %d\n", word);
>> + return 0;
>> + }
>
> Since we take "enum rt2800_eeprom_word" as word argument, it can not
> have different values than already listed, so this warning is not needed.
EEPROM_WORD_COUNT is listed in the enums and the word argument can be equal to
that, however it is not a valid index for the EEPROM map. Additionally, if
someone puts a new enum value after EEPROM_WORD_COUNT by mistake that will be an
invalid index as well.
>
>> + map = rt2800_eeprom_map;
>> + index = map[word];
>> +
>> + if (WARN_ON(word != EEPROM_CHIP_ID && index == 0)) {
>> + /* Index 0 is valid only for EEPROM_CHIP_ID.
>> + * Otherwise it means that the offset of the
>> + * given word is not initialized in the map,
>> + * or that the field is not usable on the
>> + * actual chipset.
>> + */
>> + rt2x00_warn(rt2x00dev, "invalid access of EEPROM word %d\n",
>> + word);
>
> I prefer not to use WARN_ON() and rt2x00_warn() together, please use just
> one of them, i.e:
>
> WARN_ONCE(word != EEPROM_CHIP_ID && index == 0,
> "invalid access of EEPROM word %d\n", word);
My reason behind the rt2x00_warn call was that it shows the wiphy name. If you
are testing different devices in parallel it is good to know which one causes
the warning. However I can use 'wiphy_name(rt2x00dev->hw->wiphy)' to get that
information.
I will send a follow-up patch which removes the rt2x00_warn calls. Do you also
prefer WARN_ONCE instead of WARN?
-Gabor
next prev parent reply other threads:[~2013-07-03 20:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-26 17:55 [PATCH 0/5] rt2x00: rt2800lib: add support for extended EEPROM of three-cain devices Gabor Juhos
2013-06-26 17:55 ` [PATCH 1/5] rt2x00: rt2800lib: introduce rt2800_eeprom_word enum Gabor Juhos
2013-07-03 19:14 ` [rt2x00-users] " Stanislaw Gruszka
2013-07-05 9:05 ` Helmut Schaa
2013-06-26 17:55 ` [PATCH 2/5] rt2x00: rt2800lib: introduce local EEPROM access functions Gabor Juhos
2013-07-03 19:15 ` [rt2x00-users] " Stanislaw Gruszka
2013-06-26 17:55 ` [PATCH 3/5] rt2x00: rt2800lib: introduce rt2800_eeprom_read_from_array helper Gabor Juhos
2013-07-03 19:15 ` [rt2x00-users] " Stanislaw Gruszka
2013-06-26 17:55 ` [PATCH 4/5] rt2x00: rt2800lib: introduce rt2800_eeprom_word_index helper Gabor Juhos
2013-07-03 19:28 ` [rt2x00-users] " Stanislaw Gruszka
2013-07-03 20:23 ` Gabor Juhos [this message]
2013-07-04 18:27 ` Stanislaw Gruszka
2013-07-08 9:26 ` Gabor Juhos
2013-06-26 17:55 ` [PATCH 5/5] rt2x00: rt2800lib: add EEPROM map for the RT3593 chipset Gabor Juhos
2013-07-03 19:28 ` [rt2x00-users] " 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=51D4883E.2050607@openwrt.org \
--to=juhosg@openwrt.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=stf_xl@wp.pl \
--cc=users@rt2x00.serialmonkey.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 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).