b43-dev.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "Rafał Miłecki" <zajec5@gmail.com>
To: linux-wireless@vger.kernel.org,
	"John W. Linville" <linville@tuxdriver.com>
Cc: b43-dev@lists.infradead.org, "Rafał Miłecki" <zajec5@gmail.com>
Subject: [RFC][PATCH] b43: rfkill: use HI enabled bit for all devices
Date: Wed, 17 Nov 2010 20:56:48 +0100	[thread overview]
Message-ID: <1290023808-26672-1-git-send-email-zajec5@gmail.com> (raw)

Devices which use LO enabled bit are covered by b43legacy

Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
---
Is this alright to use inline for this? Is my WARN_ON OK?
---
 drivers/net/wireless/b43/main.c   |    2 ++
 drivers/net/wireless/b43/rfkill.c |   21 +++------------------
 drivers/net/wireless/b43/rfkill.h |    4 ++--
 3 files changed, 7 insertions(+), 20 deletions(-)

diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index fa48803..9b71bb1 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -4527,6 +4527,8 @@ static int b43_op_start(struct ieee80211_hw *hw)
 		}
 	}
 
+	/* we don't expect older devices which need other RFKILL check */
+	B43_WARN_ON(dev->dev->id.revision < 3);
 	/* XXX: only do if device doesn't support rfkill irq */
 	wiphy_rfkill_start_polling(hw->wiphy);
 
diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c
index 78016ae..012ed2f 100644
--- a/drivers/net/wireless/b43/rfkill.c
+++ b/drivers/net/wireless/b43/rfkill.c
@@ -26,25 +26,10 @@
 
 
 /* Returns TRUE, if the radio is enabled in hardware. */
-bool b43_is_hw_radio_enabled(struct b43_wldev *dev)
+inline bool b43_is_hw_radio_enabled(struct b43_wldev *dev)
 {
-	if (dev->phy.rev >= 3 || dev->phy.type == B43_PHYTYPE_LP) {
-		if (!(b43_read32(dev, B43_MMIO_RADIO_HWENABLED_HI)
-		      & B43_MMIO_RADIO_HWENABLED_HI_MASK))
-			return 1;
-	} else {
-		/* To prevent CPU fault on PPC, do not read a register
-		 * unless the interface is started; however, on resume
-		 * for hibernation, this routine is entered early. When
-		 * that happens, unconditionally return TRUE.
-		 */
-		if (b43_status(dev) < B43_STAT_STARTED)
-			return 1;
-		if (b43_read16(dev, B43_MMIO_RADIO_HWENABLED_LO)
-		    & B43_MMIO_RADIO_HWENABLED_LO_MASK)
-			return 1;
-	}
-	return 0;
+	return !(b43_read32(dev, B43_MMIO_RADIO_HWENABLED_HI)
+		& B43_MMIO_RADIO_HWENABLED_HI_MASK);
 }
 
 /* The poll callback for the hardware button. */
diff --git a/drivers/net/wireless/b43/rfkill.h b/drivers/net/wireless/b43/rfkill.h
index f046c3c..7aa8a5a 100644
--- a/drivers/net/wireless/b43/rfkill.h
+++ b/drivers/net/wireless/b43/rfkill.h
@@ -4,8 +4,8 @@
 struct ieee80211_hw;
 struct b43_wldev;
 
-void b43_rfkill_poll(struct ieee80211_hw *hw);
+inline bool b43_is_hw_radio_enabled(struct b43_wldev *dev);
 
-bool b43_is_hw_radio_enabled(struct b43_wldev *dev);
+void b43_rfkill_poll(struct ieee80211_hw *hw);
 
 #endif /* B43_RFKILL_H_ */
-- 
1.6.0.4

             reply	other threads:[~2010-11-17 19:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-17 19:56 Rafał Miłecki [this message]
2010-11-17 20:17 ` [RFC][PATCH] b43: rfkill: use HI enabled bit for all devices Michael Büsch
2010-11-17 20:23   ` Rafał Miłecki
2010-11-17 20:29     ` Michael Büsch
2010-11-17 21:02       ` Rafał Miłecki

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=1290023808-26672-1-git-send-email-zajec5@gmail.com \
    --to=zajec5@gmail.com \
    --cc=b43-dev@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.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).