From: "Rafał Miłecki" <zajec5@gmail.com>
To: linux-wireless@vger.kernel.org, b43-dev@lists.infradead.org
Cc: "Rafał Miłecki" <zajec5@gmail.com>
Subject: [RFC][PATCH] b43: store current channel using struct cfg80211_chan_def
Date: Thu, 22 May 2014 15:10:10 +0200 [thread overview]
Message-ID: <1400764210-30238-1-git-send-email-zajec5@gmail.com> (raw)
---
I'm looking for a nice way of storing info about current wireless channel.
The initial "channel" unsigned int isn't enough, we need to keep info about
hw_value, frequency (or frequencies), width, HT, power, extra flags (like _IR).
In other words I need info you can find in struct cfg80211_chan_def.
So my idea is to add pointer to such struct and then drop old parameters
(channel, channel_freq, channel_type, is_40mhz).
Is this OK? Could you review my changes, please?
---
drivers/net/wireless/b43/main.c | 7 +++++--
drivers/net/wireless/b43/phy_common.c | 8 ++++++++
drivers/net/wireless/b43/phy_common.h | 1 +
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 5d1a5c7..7a094d1 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -3840,8 +3840,11 @@ static int b43_op_config(struct ieee80211_hw *hw, u32 changed)
/* Switch to the requested channel.
* The firmware takes care of races with the TX handler. */
- if (conf->chandef.chan->hw_value != phy->channel)
- b43_switch_channel(dev, conf->chandef.chan->hw_value);
+ if (conf->chandef.chan->hw_value != phy->channel) {
+ /* TODO: Is this safe to keep this pointer and use it later? */
+ phy->chandef = &conf->chandef;
+ b43_switch_channel(dev, phy->chandef->chan->hw_value);
+ }
dev->wl->radiotap_enabled = !!(conf->flags & IEEE80211_CONF_MONITOR);
diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c
index fb0dddd..066f0ed 100644
--- a/drivers/net/wireless/b43/phy_common.c
+++ b/drivers/net/wireless/b43/phy_common.c
@@ -94,6 +94,14 @@ int b43_phy_init(struct b43_wldev *dev)
const struct b43_phy_operations *ops = phy->ops;
int err;
+ /* During PHY init we need to use some channel. During the first init
+ * this function is called *before* b43_op_config, so our pointer is
+ * NULL.
+ */
+ /* TODO: Is this safe? Seems to work fine. */
+ if (!phy->chandef)
+ phy->chandef = &dev->wl->hw->conf.chandef;
+
phy->channel = ops->get_default_chan(dev);
phy->ops->switch_analog(dev, true);
diff --git a/drivers/net/wireless/b43/phy_common.h b/drivers/net/wireless/b43/phy_common.h
index 47b5585..92ddaa0 100644
--- a/drivers/net/wireless/b43/phy_common.h
+++ b/drivers/net/wireless/b43/phy_common.h
@@ -264,6 +264,7 @@ struct b43_phy {
unsigned long next_txpwr_check_time;
/* Current channel */
+ struct cfg80211_chan_def *chandef;
unsigned int channel;
u16 channel_freq;
enum nl80211_channel_type channel_type;
--
1.8.4.5
reply other threads:[~2014-05-22 13:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1400764210-30238-1-git-send-email-zajec5@gmail.com \
--to=zajec5@gmail.com \
--cc=b43-dev@lists.infradead.org \
--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).