From: Jiri Slaby <jirislaby@gmail.com>
To: "Luis R. Rodriguez" <mcgrof@gmail.com>
Cc: Nick Kossifidis <mickflemm@gmail.com>,
John Linville <linville@tuxdriver.com>,
linux-wireless@vger.kernel.org
Subject: Re: [PATCH 5/5] ath5k: Fix and clean mode initialization, prefer G for AR5212
Date: Sat, 13 Oct 2007 23:51:10 +0200 [thread overview]
Message-ID: <47113DCE.5020609@gmail.com> (raw)
In-Reply-To: <20071013200829.GA8951@pogo>
On 10/13/2007 10:08 PM, Luis R. Rodriguez wrote:
> [PATCH 5/5] ath5k: Fix and clean mode initialization, prefer G for AR5212
[...]
> diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
> index 18ee995..db37ceb 100644
> --- a/drivers/net/wireless/ath5k/base.c
> +++ b/drivers/net/wireless/ath5k/base.c
> @@ -1896,7 +1896,7 @@ static void ath_dump_modes(struct ieee80211_hw_mode *modes)
> {
> unsigned int m, i;
>
> - for (m = 0; m < NUM_IEEE80211_MODES; m++) {
> + for (m = 0; m < NUM_DRIVER_MODES; m++) {
> printk(KERN_DEBUG "Mode %u: channels %d, rates %d\n", m,
> modes[m].num_channels, modes[m].num_rates);
> printk(KERN_DEBUG " channels:\n");
> @@ -1919,71 +1919,92 @@ static void ath_dump_modes(struct ieee80211_hw_mode *modes)
> static inline void ath_dump_modes(struct ieee80211_hw_mode *modes) {}
> #endif
>
> +static inline int ath5k_register_mode(struct ieee80211_hw *hw, u8 m)
> +{
> + struct ath_softc *sc = hw->priv;
> + struct ieee80211_hw_mode *modes = sc->modes;
> + int i, ret;
unsigned is usually used for positive iterators, it generates better code almost
for all platforms.
> +
> + for (i = 0; i < NUM_DRIVER_MODES; i++) {
> + if (modes[i].mode != m || !modes[i].num_channels)
> + continue;
> + ret = ieee80211_register_hwmode(hw, &modes[i]);
> + if (ret) {
> + printk(KERN_ERR "can't register hwmode %u\n", m);
> + return ret;
> + }
> + return 0;
> + }
Maybe we should oops here, since it is a bug to get that far. I think, you
should put BUG() here to not mess userspace with positive retvals.
> + return 1;
> +}
> +
> +/* Only tries to register modes our EEPROM says it can support */
> +#define REGISTER_MODE(m) do { \
> + if (test_bit(m, ah->ah_capabilities.cap_mode)) { \
> + ret = ath5k_register_mode(hw, m); \
> + if (ret) \
> + return ret; \
> + } \
I though you will put the test inside the new ath5k_register_mode function too
(and return 0 in the case when unsupported) and get rid of the macro. But ok,
not global macro we can tolerate return-ing from it :).
knowing to be a pain in the ass,
--
Jiri Slaby (jirislaby@gmail.com)
Faculty of Informatics, Masaryk University
next prev parent reply other threads:[~2007-10-13 21:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-12 15:00 [PATCH 0/5] ath5k: promiscuous bug, multicast, modes and docs Luis R. Rodriguez
2007-10-12 15:03 ` [PATCH 1/5] ath5k: Fix a bug which pushed us to enable promiscuous Luis R. Rodriguez
2007-10-12 15:04 ` [PATCH 2/5] Add proper support for multicast Luis R. Rodriguez
2007-10-12 15:05 ` [PATCH 3/5] Don't read AR5K_RAC_PISR on AR5210, document ath5k_int Luis R. Rodriguez
2007-10-12 15:07 ` [PATCH 4/5] Add extensive documenation for the atheros bssid_mask Luis R. Rodriguez
2007-10-12 15:07 ` [PATCH 5/5] ath5k: Fix and clean mode initialization, prefer G for AR5212 Luis R. Rodriguez
2007-10-12 21:33 ` Jiri Slaby
2007-10-12 22:37 ` Luis R. Rodriguez
2007-10-13 7:34 ` Jiri Slaby
2007-10-13 9:21 ` Nick Kossifidis
2007-10-13 9:30 ` Nick Kossifidis
2007-10-13 9:38 ` Jiri Slaby
2007-10-13 20:08 ` Luis R. Rodriguez
2007-10-13 21:51 ` Jiri Slaby [this message]
2007-10-16 15:07 ` [PATCH 4/5] Add extensive documenation for the atheros bssid_mask Randy Dunlap
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=47113DCE.5020609@gmail.com \
--to=jirislaby@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=mcgrof@gmail.com \
--cc=mickflemm@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 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).