* Please pull from "upstream" branch of rt2x00
@ 2007-04-10 22:39 Ivo van Doorn
0 siblings, 0 replies; 2+ messages in thread
From: Ivo van Doorn @ 2007-04-10 22:39 UTC (permalink / raw)
To: John W. Linville; +Cc: linux-wireless
Hi John,
It took some time, but thanks to your and Jiri's help on IRC
rt2x00 finally has a rt2x00 tree. :)
Please pull from http://git.serialmonkey.com/rt2x00.git/ upstream
to get some important fixes. This will get PCI and USB devices back
into a somewhat more usefull state.
Ivo
---
The following changes since commit f4e2dd4a8b9ff1d14c3fffc36d578d12f8cb8da3:
John W. Linville (1):
wext-old: fixup copyright info
are found in the git repository at:
http://git.serialmonkey.com/rt2x00.git/ upstream
Ivo van Doorn (8):
Don't use magical values for the length with rt2x00_vendor_request,
Make rt2x00 debugfs support depend on mac80211 support.
rt2x00: rt2x00_register_multiwrite should use correct length
Merge branch 'master' of git://git.kernel.org/.../linville/wireless-dev
rt2x00: Use correct length in descriptor
rt2x00: new USB ID for rt73usb
rt2x00: Correctly enable the radio
Merge with http://git.serialmonkey.com/rt2x00.git
drivers/net/wireless/mac80211/rt2x00/Kconfig | 2 +-
drivers/net/wireless/mac80211/rt2x00/rt2400pci.c | 17 ++++++++--
drivers/net/wireless/mac80211/rt2x00/rt2500pci.c | 17 ++++++++--
drivers/net/wireless/mac80211/rt2x00/rt2500usb.c | 21 +++++++++----
drivers/net/wireless/mac80211/rt2x00/rt2x00.h | 2 +-
drivers/net/wireless/mac80211/rt2x00/rt61pci.c | 32 +++++++++----------
drivers/net/wireless/mac80211/rt2x00/rt73usb.c | 36 +++++++++++-----------
7 files changed, 76 insertions(+), 51 deletions(-)
diff --git a/drivers/net/wireless/mac80211/rt2x00/Kconfig b/drivers/net/wireless/mac80211/rt2x00/Kconfig
index 0528431..31541ed 100644
--- a/drivers/net/wireless/mac80211/rt2x00/Kconfig
+++ b/drivers/net/wireless/mac80211/rt2x00/Kconfig
@@ -73,7 +73,7 @@ config RT73USB
config RT2X00_DEBUGFS
tristate "Ralink debugfs support"
- depends on RT2X00 && RT2X00_LIB && DEBUG_FS
+ depends on RT2X00 && RT2X00_LIB && MAC80211_DEBUGFS
---help---
Enable creation of debugfs files for the rt2x00 drivers.
These debugfs files support both reading and writing of the
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt2400pci.c b/drivers/net/wireless/mac80211/rt2x00/rt2400pci.c
index f8a9867..4b1afb9 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/mac80211/rt2x00/rt2400pci.c
@@ -272,11 +272,16 @@ static inline void rt2400pci_close_debugfs(struct rt2x00_dev *rt2x00dev){}
*/
static void rt2400pci_config_bssid(struct rt2x00_dev *rt2x00dev, u8 *bssid)
{
+ u32 reg[2];
+
+ memset(®, 0, sizeof(reg));
+ memcpy(®, bssid, ETH_ALEN);
+
/*
* The BSSID is passed to us as an array of bytes,
* that array is little endian, so no need for byte ordering.
*/
- rt2x00_register_multiwrite(rt2x00dev, CSR5, bssid, ETH_ALEN);
+ rt2x00_register_multiwrite(rt2x00dev, CSR5, ®, sizeof(reg));
}
static void rt2400pci_config_promisc(struct rt2x00_dev *rt2x00dev, int promisc)
@@ -627,11 +632,16 @@ static void rt2400pci_config_phymode(struct rt2x00_dev *rt2x00dev,
static void rt2400pci_config_mac_addr(struct rt2x00_dev *rt2x00dev, u8 *addr)
{
+ u32 reg[2];
+
+ memset(®, 0, sizeof(reg));
+ memcpy(®, addr, ETH_ALEN);
+
/*
* The MAC address is passed to us as an array of bytes,
* that array is little endian, so no need for byte ordering.
*/
- rt2x00_register_multiwrite(rt2x00dev, CSR3, addr, ETH_ALEN);
+ rt2x00_register_multiwrite(rt2x00dev, CSR3, ®, sizeof(reg));
}
/*
@@ -1228,8 +1238,7 @@ static int rt2400pci_enable_radio(struct rt2x00_dev *rt2x00dev)
* Don't enable the radio twice.
* or if the hardware button has been disabled.
*/
- if (GET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO) ||
- !GET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO_HW))
+ if (GET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO))
return 0;
/*
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt2500pci.c b/drivers/net/wireless/mac80211/rt2x00/rt2500pci.c
index bddbbf9..b052220 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/mac80211/rt2x00/rt2500pci.c
@@ -272,11 +272,16 @@ static inline void rt2500pci_close_debugfs(struct rt2x00_dev *rt2x00dev){}
*/
static void rt2500pci_config_bssid(struct rt2x00_dev *rt2x00dev, u8 *bssid)
{
+ u32 reg[2];
+
+ memset(®, 0, sizeof(reg));
+ memcpy(®, bssid, ETH_ALEN);
+
/*
* The BSSID is passed to us as an array of bytes,
* that array is little endian, so no need for byte ordering.
*/
- rt2x00_register_multiwrite(rt2x00dev, CSR5, bssid, ETH_ALEN);
+ rt2x00_register_multiwrite(rt2x00dev, CSR5, ®, sizeof(reg));
}
static void rt2500pci_config_promisc(struct rt2x00_dev *rt2x00dev, int promisc)
@@ -702,11 +707,16 @@ static void rt2500pci_config_phymode(struct rt2x00_dev *rt2x00dev,
static void rt2500pci_config_mac_addr(struct rt2x00_dev *rt2x00dev, u8 *addr)
{
+ u32 reg[2];
+
+ memset(®, 0, sizeof(reg));
+ memcpy(®, addr, ETH_ALEN);
+
/*
* The MAC address is passed to us as an array of bytes,
* that array is little endian, so no need for byte ordering.
*/
- rt2x00_register_multiwrite(rt2x00dev, CSR3, addr, ETH_ALEN);
+ rt2x00_register_multiwrite(rt2x00dev, CSR3, ®, sizeof(reg));
}
/*
@@ -1354,8 +1364,7 @@ static int rt2500pci_enable_radio(struct rt2x00_dev *rt2x00dev)
* Don't enable the radio twice,
* or if the hardware button has been disabled.
*/
- if (GET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO) ||
- !GET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO_HW))
+ if (GET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO))
return 0;
/*
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt2500usb.c b/drivers/net/wireless/mac80211/rt2x00/rt2500usb.c
index 187076d..e023711 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/mac80211/rt2x00/rt2500usb.c
@@ -89,7 +89,7 @@ static inline void rt2x00_register_read(
__le16 reg;
rt2x00_vendor_request(
rt2x00dev, USB_MULTI_READ, USB_VENDOR_REQUEST_IN,
- offset, 0x00, ®, 2, REGISTER_TIMEOUT);
+ offset, 0x00, ®, sizeof(u16), REGISTER_TIMEOUT);
*value = le16_to_cpu(reg);
}
@@ -110,7 +110,7 @@ static inline void rt2x00_register_write(
__le16 reg = cpu_to_le16(value);
rt2x00_vendor_request(
rt2x00dev, USB_MULTI_WRITE, USB_VENDOR_REQUEST_OUT,
- offset, 0x00, ®, 2, REGISTER_TIMEOUT);
+ offset, 0x00, ®, sizeof(u16), REGISTER_TIMEOUT);
}
static inline void rt2x00_register_multiwrite(
@@ -314,11 +314,16 @@ static inline void rt2500usb_close_debugfs(struct rt2x00_dev *rt2x00dev){}
*/
static void rt2500usb_config_bssid(struct rt2x00_dev *rt2x00dev, u8 *bssid)
{
+ u16 reg[3];
+
+ memset(®, 0, sizeof(reg));
+ memcpy(®, bssid, ETH_ALEN);
+
/*
* The BSSID is passed to us as an array of bytes,
* that array is little endian, so no need for byte ordering.
*/
- rt2x00_register_multiwrite(rt2x00dev, MAC_CSR5, bssid, ETH_ALEN);
+ rt2x00_register_multiwrite(rt2x00dev, MAC_CSR5, ®, sizeof(reg));
}
static void rt2500usb_config_promisc(struct rt2x00_dev *rt2x00dev, int promisc)
@@ -710,11 +715,16 @@ static void rt2500usb_config_phymode(struct rt2x00_dev *rt2x00dev,
static void rt2500usb_config_mac_addr(struct rt2x00_dev *rt2x00dev, u8 *addr)
{
+ u16 reg[3];
+
+ memset(®, 0, sizeof(reg));
+ memcpy(®, addr, ETH_ALEN);
+
/*
* The MAC address is passed to us as an array of bytes,
* that array is little endian, so no need for byte ordering.
*/
- rt2x00_register_multiwrite(rt2x00dev, MAC_CSR2, addr, ETH_ALEN);
+ rt2x00_register_multiwrite(rt2x00dev, MAC_CSR2, ®, sizeof(reg));
}
/*
@@ -1555,8 +1565,7 @@ static int rt2500usb_write_tx_data(struct rt2x00_dev *rt2x00dev,
skb_push(skb, rt2x00dev->hw->extra_tx_headroom);
txd = (struct data_desc*)skb->data;
- rt2500usb_write_tx_desc(rt2x00dev, txd, ieee80211hdr,
- skb->len, control);
+ rt2500usb_write_tx_desc(rt2x00dev, txd, ieee80211hdr, length, control);
memcpy(&entry->tx_status.control, control, sizeof(*control));
entry->skb = skb;
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt2x00.h b/drivers/net/wireless/mac80211/rt2x00/rt2x00.h
index cea6bb1..38fae66 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/mac80211/rt2x00/rt2x00.h
@@ -777,7 +777,7 @@ struct rt2x00_dev {
*/
unsigned int flags;
#define DEVICE_ENABLED_RADIO 0x00000001
-#define DEVICE_ENABLED_RADIO_HW 0x00000002
+
#define DEVICE_INITIALIZED 0x00000004
#define DEVICE_INITIALIZED_HW 0x00000008
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt61pci.c b/drivers/net/wireless/mac80211/rt2x00/rt61pci.c
index 9cee93f..d2ee3f5 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/mac80211/rt2x00/rt61pci.c
@@ -303,18 +303,18 @@ static inline void rt61pci_close_debugfs(struct rt2x00_dev *rt2x00dev){}
*/
static void rt61pci_config_bssid(struct rt2x00_dev *rt2x00dev, u8 *bssid)
{
- u32 reg;
+ u32 reg[2];
+
+ memset(®, 0, sizeof(reg));
+ memcpy(®, bssid, ETH_ALEN);
+
+ rt2x00_set_field32(®[1], MAC_CSR5_BSS_ID_MASK, 3);
/*
* The BSSID is passed to us as an array of bytes,
* that array is little endian, so no need for byte ordering.
- * We only need to set the BSS ID MASK at the correct offset.
*/
- rt2x00_register_multiwrite(rt2x00dev, MAC_CSR4, bssid, ETH_ALEN);
-
- rt2x00_register_read(rt2x00dev, MAC_CSR5, ®);
- rt2x00_set_field32(®, MAC_CSR5_BSS_ID_MASK, 3);
- rt2x00_register_write(rt2x00dev, MAC_CSR5, reg);
+ rt2x00_register_multiwrite(rt2x00dev, MAC_CSR4, ®, sizeof(reg));
}
static void rt61pci_config_promisc(struct rt2x00_dev *rt2x00dev, int promisc)
@@ -919,19 +919,18 @@ static void rt61pci_config_phymode(struct rt2x00_dev *rt2x00dev,
static void rt61pci_config_mac_addr(struct rt2x00_dev *rt2x00dev, u8 *addr)
{
- u32 reg;
+ u32 reg[2];
+
+ memset(®, 0, sizeof(reg));
+ memcpy(®, addr, ETH_ALEN);
+
+ rt2x00_set_field32(®[1], MAC_CSR3_UNICAST_TO_ME_MASK, 0xff);
/*
* The MAC address is passed to us as an array of bytes,
* that array is little endian, so no need for byte ordering.
- * We only need to set the MAC_CSR3_UNICAST_TO_ME_MASK
- * at the correct offset.
*/
- rt2x00_register_multiwrite(rt2x00dev, MAC_CSR2, addr, ETH_ALEN);
-
- rt2x00_register_read(rt2x00dev, MAC_CSR3, ®);
- rt2x00_set_field32(®, MAC_CSR3_UNICAST_TO_ME_MASK, 0xff);
- rt2x00_register_write(rt2x00dev, MAC_CSR3, reg);
+ rt2x00_register_multiwrite(rt2x00dev, MAC_CSR2, ®, sizeof(reg));
}
/*
@@ -1635,8 +1634,7 @@ static int rt61pci_enable_radio(struct rt2x00_dev *rt2x00dev)
* Don't enable the radio twice.
* or if the hardware button has been disabled.
*/
- if (GET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO) ||
- !GET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO_HW))
+ if (GET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO))
return 0;
/*
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt73usb.c b/drivers/net/wireless/mac80211/rt2x00/rt73usb.c
index 9c9fbce..837ceb1 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/mac80211/rt2x00/rt73usb.c
@@ -91,7 +91,7 @@ static inline void rt2x00_register_read(
__le32 reg;
rt2x00_vendor_request(
rt2x00dev, USB_MULTI_READ, USB_VENDOR_REQUEST_IN,
- offset, 0x00, ®, 4, REGISTER_TIMEOUT);
+ offset, 0x00, ®, sizeof(u32), REGISTER_TIMEOUT);
*value = le32_to_cpu(reg);
}
@@ -112,7 +112,7 @@ static inline void rt2x00_register_write(
__le32 reg = cpu_to_le32(value);
rt2x00_vendor_request(
rt2x00dev, USB_MULTI_WRITE, USB_VENDOR_REQUEST_OUT,
- offset, 0x00, ®, 4, REGISTER_TIMEOUT);
+ offset, 0x00, ®, sizeof(u32), REGISTER_TIMEOUT);
}
static inline void rt2x00_register_multiwrite(
@@ -310,18 +310,18 @@ static inline void rt73usb_close_debugfs(struct rt2x00_dev *rt2x00dev){}
*/
static void rt73usb_config_bssid(struct rt2x00_dev *rt2x00dev, u8 *bssid)
{
- u32 reg;
+ u32 reg[2];
+
+ memset(®, 0, sizeof(reg));
+ memcpy(®, bssid, ETH_ALEN);
+
+ rt2x00_set_field32(®[1], MAC_CSR5_BSS_ID_MASK, 3);
/*
* The BSSID is passed to us as an array of bytes,
* that array is little endian, so no need for byte ordering.
- * We only need to set the BSS ID MASK at the correct offset.
*/
- rt2x00_register_multiwrite(rt2x00dev, MAC_CSR4, bssid, ETH_ALEN);
-
- rt2x00_register_read(rt2x00dev, MAC_CSR5, ®);
- rt2x00_set_field32(®, MAC_CSR5_BSS_ID_MASK, 3);
- rt2x00_register_write(rt2x00dev, MAC_CSR5, reg);
+ rt2x00_register_multiwrite(rt2x00dev, MAC_CSR4, ®, sizeof(reg));
}
static void rt73usb_config_promisc(struct rt2x00_dev *rt2x00dev, int promisc)
@@ -814,19 +814,18 @@ static void rt73usb_config_phymode(struct rt2x00_dev *rt2x00dev,
static void rt73usb_config_mac_addr(struct rt2x00_dev *rt2x00dev, u8 *addr)
{
- u32 reg;
+ u32 reg[2];
+
+ memset(®, 0, sizeof(reg));
+ memcpy(®, addr, ETH_ALEN);
+
+ rt2x00_set_field32(®[1], MAC_CSR3_UNICAST_TO_ME_MASK, 0xff);
/*
* The MAC address is passed to us as an array of bytes,
* that array is little endian, so no need for byte ordering.
- * We only need to set the MAC_CSR3_UNICAST_TO_ME_MASK
- * at the correct offset.
*/
- rt2x00_register_multiwrite(rt2x00dev, MAC_CSR2, addr, ETH_ALEN);
-
- rt2x00_register_read(rt2x00dev, MAC_CSR3, ®);
- rt2x00_set_field32(®, MAC_CSR3_UNICAST_TO_ME_MASK, 0xff);
- rt2x00_register_write(rt2x00dev, MAC_CSR3, reg);
+ rt2x00_register_multiwrite(rt2x00dev, MAC_CSR2, ®, sizeof(reg));
}
/*
@@ -1714,7 +1713,7 @@ static int rt73usb_write_tx_data(struct rt2x00_dev *rt2x00dev,
skb_push(skb, rt2x00dev->hw->extra_tx_headroom);
txd = (struct data_desc*)skb->data;
- rt73usb_write_tx_desc(rt2x00dev, txd, ieee80211hdr, skb->len, control);
+ rt73usb_write_tx_desc(rt2x00dev, txd, ieee80211hdr, length, control);
memcpy(&entry->tx_status.control, control, sizeof(*control));
entry->skb = skb;
@@ -2938,6 +2937,7 @@ static struct usb_device_id rt73usb_device_table[] = {
{ USB_DEVICE(0x1690, 0x0722) },
/* ASUS */
{ USB_DEVICE(0x0b05, 0x1723) },
+ { USB_DEVICE(0x0b05, 0x1724) },
/* Belkin */
{ USB_DEVICE(0x050d, 0x7050) },
{ USB_DEVICE(0x050d, 0x705a) },
^ permalink raw reply related [flat|nested] 2+ messages in thread* Please pull from "upstream" branch of rt2x00
@ 2007-04-12 18:05 Ivo van Doorn
0 siblings, 0 replies; 2+ messages in thread
From: Ivo van Doorn @ 2007-04-12 18:05 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless
Hi John,
This is quite fast after the previous pull request,
but this fixes several important bugs where the most
important 2 are the debugsfs fixes.
After these fedora bugs should be fixed.
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=233345
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=233434
Ivo
---
The following changes since commit fd349fec02854ab413d9aa47c732f892a13f83b6:
John W. Linville (1):
Merge branch 'zd1211rw-week15' of git://git.kernel.org/.../mwu/mac80211-drivers
are found in the git repository at:
http://git.serialmonkey.com/rt2x00.git/ upstream
Ivo van Doorn (8):
rt2x00: Add new rt73 USB ID
rt2x00: Add new "invisible" config options for PCI and USB
rt2x00: Don't unregister unregistered interfaces
rt2x00: Create generic rt2x00lib_{enable,disable}_radio() function
rt2x00: rt2x00debug should be compiled into rt2x00lib
Merge branch 'wireless-dev'
rt2x00: Fix debugfs register length handling
rt2x00: Fix crash during rmmod with debugfs enabled
drivers/net/wireless/mac80211/rt2x00/Kconfig | 15 +++++-
drivers/net/wireless/mac80211/rt2x00/Makefile | 5 +-
drivers/net/wireless/mac80211/rt2x00/rt2400pci.c | 59 ++++---------------
drivers/net/wireless/mac80211/rt2x00/rt2400pci.h | 6 --
drivers/net/wireless/mac80211/rt2x00/rt2500pci.c | 59 ++++---------------
drivers/net/wireless/mac80211/rt2x00/rt2500pci.h | 6 --
drivers/net/wireless/mac80211/rt2x00/rt2500usb.c | 58 ++++---------------
drivers/net/wireless/mac80211/rt2x00/rt2500usb.h | 6 --
drivers/net/wireless/mac80211/rt2x00/rt2x00.h | 5 +-
drivers/net/wireless/mac80211/rt2x00/rt2x00debug.c | 46 +++------------
drivers/net/wireless/mac80211/rt2x00/rt2x00debug.h | 5 +-
drivers/net/wireless/mac80211/rt2x00/rt2x00dev.c | 51 +++++++++++++++++
drivers/net/wireless/mac80211/rt2x00/rt2x00lib.h | 6 ++
drivers/net/wireless/mac80211/rt2x00/rt2x00mac.c | 12 ++--
drivers/net/wireless/mac80211/rt2x00/rt61pci.c | 55 ++++--------------
drivers/net/wireless/mac80211/rt2x00/rt61pci.h | 6 --
drivers/net/wireless/mac80211/rt2x00/rt73usb.c | 59 +++++---------------
drivers/net/wireless/mac80211/rt2x00/rt73usb.h | 6 --
18 files changed, 163 insertions(+), 302 deletions(-)
diff --git a/drivers/net/wireless/mac80211/rt2x00/Kconfig b/drivers/net/wireless/mac80211/rt2x00/Kconfig
index 31541ed..af67572 100644
--- a/drivers/net/wireless/mac80211/rt2x00/Kconfig
+++ b/drivers/net/wireless/mac80211/rt2x00/Kconfig
@@ -15,6 +15,14 @@ config RT2X00_LIB
tristate
depends on RT2X00
+config RT2X00_LIB_PCI
+ tristate
+ depends on RT2X00
+
+config RT2X00_LIB_USB
+ tristate
+ depends on RT2X00
+
config RT2X00_LIB_FIRMWARE
boolean
depends on RT2X00
@@ -23,6 +31,7 @@ config RT2400PCI
tristate "Ralink rt2400 pci/pcmcia support"
depends on RT2X00 && PCI
select RT2X00_LIB
+ select RT2X00_LIB_PCI
select EEPROM_93CX6
---help---
This is an experimental driver for the Ralink rt2400 wireless chip.
@@ -33,6 +42,7 @@ config RT2500PCI
tristate "Ralink rt2500 pci/pcmcia support"
depends on RT2X00 && PCI
select RT2X00_LIB
+ select RT2X00_LIB_PCI
select EEPROM_93CX6
---help---
This is an experimental driver for the Ralink rt2500 wireless chip.
@@ -43,6 +53,7 @@ config RT61PCI
tristate "Ralink rt61 pci/pcmcia support"
depends on RT2X00 && FW_LOADER && PCI
select RT2X00_LIB
+ select RT2X00_LIB_PCI
select RT2X00_LIB_FIRMWARE
select CRC_ITU_T
select EEPROM_93CX6
@@ -55,6 +66,7 @@ config RT2500USB
tristate "Ralink rt2500 usb support"
depends on RT2X00 && USB
select RT2X00_LIB
+ select RT2X00_LIB_USB
---help---
This is an experimental driver for the Ralink rt2500 wireless chip.
@@ -64,6 +76,7 @@ config RT73USB
tristate "Ralink rt73 usb support"
depends on RT2X00 && FW_LOADER && USB
select RT2X00_LIB
+ select RT2X00_LIB_USB
select RT2X00_LIB_FIRMWARE
select CRC_ITU_T
---help---
@@ -72,7 +85,7 @@ config RT73USB
When compiled as a module, this driver will be called "rt73usb.ko".
config RT2X00_DEBUGFS
- tristate "Ralink debugfs support"
+ bool "Ralink debugfs support"
depends on RT2X00 && RT2X00_LIB && MAC80211_DEBUGFS
---help---
Enable creation of debugfs files for the rt2x00 drivers.
diff --git a/drivers/net/wireless/mac80211/rt2x00/Makefile b/drivers/net/wireless/mac80211/rt2x00/Makefile
index 52f8b1e..f3a2cb1 100644
--- a/drivers/net/wireless/mac80211/rt2x00/Makefile
+++ b/drivers/net/wireless/mac80211/rt2x00/Makefile
@@ -1,9 +1,12 @@
rt2x00lib-objs := rt2x00dev.o rt2x00mac.o
+ifeq ($(CONFIG_RT2X00_DEBUGFS),y)
+ rt2x00lib-objs += rt2x00debug.o
+endif
+
obj-$(CONFIG_RT2X00_LIB) += rt2x00lib.o
obj-$(CONFIG_RT2400PCI) += rt2400pci.o
obj-$(CONFIG_RT2500PCI) += rt2500pci.o
obj-$(CONFIG_RT61PCI) += rt61pci.o
obj-$(CONFIG_RT2500USB) += rt2500usb.o
obj-$(CONFIG_RT73USB) += rt73usb.o
-obj-$(CONFIG_RT2X00_DEBUGFS) += rt2x00debug.o
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt2400pci.c b/drivers/net/wireless/mac80211/rt2x00/rt2400pci.c
index 4b1afb9..9bf40cd 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/mac80211/rt2x00/rt2400pci.c
@@ -186,7 +186,7 @@ rf_write:
rt2x00_register_write(rt2x00dev, RFCSR, reg);
}
-#if defined(CONFIG_RT2X00_DEBUGFS) || defined(CONFIG_RT2X00_DEBUGFS_MODULE)
+#ifdef CONFIG_RT2X00_DEBUGFS
#include "rt2x00debug.h"
#define CSR_OFFSET(__word) ( CSR_REG_BASE + ((__word) * sizeof(u32)) )
@@ -235,32 +235,33 @@ static struct rt2x00debug rt2400pci_rt2x00debug = {
.read = rt2400pci_read_csr,
.write = rt2400pci_write_csr,
.word_size = sizeof(u32),
- .length = CSR_REG_SIZE,
+ .word_count = CSR_REG_SIZE / sizeof(u32),
},
.reg_eeprom = {
.read = rt2400pci_read_eeprom,
.write = rt2400pci_write_eeprom,
.word_size = sizeof(u16),
- .length = EEPROM_SIZE,
+ .word_count = EEPROM_SIZE / sizeof(u16),
},
.reg_bbp = {
.read = rt2400pci_read_bbp,
.write = rt2400pci_write_bbp,
.word_size = sizeof(u8),
- .length = BBP_SIZE,
+ .word_count = BBP_SIZE / sizeof(u8),
},
};
static void rt2400pci_open_debugfs(struct rt2x00_dev *rt2x00dev)
{
- if (!rt2x00debug_register(&rt2400pci_rt2x00debug,
- rt2x00dev->hw->wiphy, rt2x00dev))
+ rt2x00dev->debugfs_intf = rt2x00debug_register(
+ &rt2400pci_rt2x00debug, rt2x00dev->hw->wiphy, rt2x00dev);
+ if (!rt2x00dev->debugfs_intf)
ERROR("Failed to register debug handler.\n");
}
static void rt2400pci_close_debugfs(struct rt2x00_dev *rt2x00dev)
{
- rt2x00debug_deregister(&rt2x00dev->debugfs_data);
+ rt2x00debug_deregister(rt2x00dev->debugfs_intf);
}
#else /* CONFIG_RT2X00_DEBUGFS */
static inline void rt2400pci_open_debugfs(struct rt2x00_dev *rt2x00dev){}
@@ -1235,36 +1236,21 @@ static int rt2400pci_enable_radio(struct rt2x00_dev *rt2x00dev)
u32 reg;
/*
- * Don't enable the radio twice.
- * or if the hardware button has been disabled.
- */
- if (GET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO))
- return 0;
-
- /*
* Initialize all registers.
*/
if (rt2400pci_init_rings(rt2x00dev) ||
rt2400pci_init_registers(rt2x00dev) ||
rt2400pci_init_bbp(rt2x00dev)) {
ERROR("Register initialization failed.\n");
- goto exit_fail;
+ return -EIO;
}
/*
- * Determine channel change time.
- */
- if (rt2x00lib_detect_channel_time(rt2x00dev))
- goto exit_fail;
-
- /*
* Clear interrupts.
*/
rt2x00_register_read(rt2x00dev, CSR7, ®);
rt2x00_register_write(rt2x00dev, CSR7, reg);
- SET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO);
-
/*
* Enable interrupts.
*/
@@ -1277,40 +1263,22 @@ static int rt2400pci_enable_radio(struct rt2x00_dev *rt2x00dev)
rt2x00_register_write(rt2x00dev, CSR8, reg);
/*
- * Enable RX.
- */
- rt2400pci_toggle_rx(rt2x00dev, 1);
-
- /*
* Enable LED
*/
rt2400pci_enable_led(rt2x00dev);
- ieee80211_start_queues(rt2x00dev->hw);
-
return 0;
-
-exit_fail:
- rt2400pci_uninitialize(rt2x00dev);
- return -EIO;
}
static void rt2400pci_disable_radio(struct rt2x00_dev *rt2x00dev)
{
u32 reg;
- if (!GET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO))
- return;
-
- ieee80211_stop_queues(rt2x00dev->hw);
-
/*
* Disable LED
*/
rt2400pci_disable_led(rt2x00dev);
- CLEAR_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO);
-
rt2x00_register_write(rt2x00dev, PWRCSR0, 0);
/*
@@ -1325,8 +1293,6 @@ static void rt2400pci_disable_radio(struct rt2x00_dev *rt2x00dev)
rt2x00_set_field32(®, TXCSR0_ABORT, 1);
rt2x00_register_write(rt2x00dev, TXCSR0, reg);
- rt2400pci_toggle_rx(rt2x00dev, 0);
-
/*
* Disable interrupts.
*/
@@ -2450,12 +2416,13 @@ static void rt2400pci_remove(struct pci_dev *pci_dev)
/*
* Uninitialize the 80211 stack data.
*/
- ieee80211_unregister_hw(hw);
+ if (GET_FLAG(rt2x00dev, DEVICE_INITIALIZED_HW))
+ ieee80211_unregister_hw(hw);
/*
* Uninitialize and free the rt2400pci driver data.
*/
- rt2400pci_disable_radio(rt2x00dev);
+ rt2x00lib_disable_radio(rt2x00dev);
rt2400pci_uninitialize(rt2x00dev);
rt2400pci_free_dev(rt2x00dev);
@@ -2484,7 +2451,7 @@ static int rt2400pci_suspend(struct pci_dev *pci_dev, pm_message_t state)
/*
* Disable the radio.
*/
- rt2400pci_disable_radio(rt2x00dev);
+ rt2x00lib_disable_radio(rt2x00dev);
/*
* Set device mode to sleep for power management.
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt2400pci.h b/drivers/net/wireless/mac80211/rt2x00/rt2400pci.h
index 585c5aa..333b240 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt2400pci.h
+++ b/drivers/net/wireless/mac80211/rt2x00/rt2400pci.h
@@ -916,12 +916,6 @@ static void rt2400pci_activity_led(struct rt2x00_dev *rt2x00dev,
char activity);
/*
- * Radio control functions.
- */
-static int rt2400pci_enable_radio(struct rt2x00_dev *rt2x00dev);
-static void rt2400pci_disable_radio(struct rt2x00_dev *rt2x00dev);
-
-/*
* Interrupt functions.
*/
static void rt2400pci_rxdone(struct work_struct *work);
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt2500pci.c b/drivers/net/wireless/mac80211/rt2x00/rt2500pci.c
index b052220..033c765 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/mac80211/rt2x00/rt2500pci.c
@@ -186,7 +186,7 @@ rf_write:
rt2x00_register_write(rt2x00dev, RFCSR, reg);
}
-#if defined(CONFIG_RT2X00_DEBUGFS) || defined(CONFIG_RT2X00_DEBUGFS_MODULE)
+#ifdef CONFIG_RT2X00_DEBUGFS
#include "rt2x00debug.h"
#define CSR_OFFSET(__word) ( CSR_REG_BASE + ((__word) * sizeof(u32)) )
@@ -235,32 +235,33 @@ static struct rt2x00debug rt2500pci_rt2x00debug = {
.read = rt2500pci_read_csr,
.write = rt2500pci_write_csr,
.word_size = sizeof(u32),
- .length = CSR_REG_SIZE,
+ .word_count = CSR_REG_SIZE / sizeof(u32),
},
.reg_eeprom = {
.read = rt2500pci_read_eeprom,
.write = rt2500pci_write_eeprom,
.word_size = sizeof(u16),
- .length = EEPROM_SIZE,
+ .word_count = EEPROM_SIZE / sizeof(u16),
},
.reg_bbp = {
.read = rt2500pci_read_bbp,
.write = rt2500pci_write_bbp,
.word_size = sizeof(u8),
- .length = BBP_SIZE,
+ .word_count = BBP_SIZE / sizeof(u8),
},
};
static void rt2500pci_open_debugfs(struct rt2x00_dev *rt2x00dev)
{
- if (!rt2x00debug_register(&rt2500pci_rt2x00debug,
- rt2x00dev->hw->wiphy, rt2x00dev))
+ rt2x00dev->debugfs_intf = rt2x00debug_register(
+ &rt2500pci_rt2x00debug, rt2x00dev->hw->wiphy, rt2x00dev);
+ if (!rt2x00dev->debugfs_intf)
ERROR("Failed to register debug handler.\n");
}
static void rt2500pci_close_debugfs(struct rt2x00_dev *rt2x00dev)
{
- rt2x00debug_deregister(&rt2x00dev->debugfs_data);
+ rt2x00debug_deregister(rt2x00dev->debugfs_intf);
}
#else /* CONFIG_RT2X00_DEBUGFS */
static inline void rt2500pci_open_debugfs(struct rt2x00_dev *rt2x00dev){}
@@ -1361,36 +1362,21 @@ static int rt2500pci_enable_radio(struct rt2x00_dev *rt2x00dev)
u32 reg;
/*
- * Don't enable the radio twice,
- * or if the hardware button has been disabled.
- */
- if (GET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO))
- return 0;
-
- /*
* Initialize all registers.
*/
if (rt2500pci_init_rings(rt2x00dev) ||
rt2500pci_init_registers(rt2x00dev) ||
rt2500pci_init_bbp(rt2x00dev)) {
ERROR("Register initialization failed.\n");
- goto exit_fail;
+ return -EIO;
}
/*
- * Determine channel change time.
- */
- if (rt2x00lib_detect_channel_time(rt2x00dev))
- goto exit_fail;
-
- /*
* Clear interrupts.
*/
rt2x00_register_read(rt2x00dev, CSR7, ®);
rt2x00_register_write(rt2x00dev, CSR7, reg);
- SET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO);
-
/*
* Enable interrupts.
*/
@@ -1403,40 +1389,22 @@ static int rt2500pci_enable_radio(struct rt2x00_dev *rt2x00dev)
rt2x00_register_write(rt2x00dev, CSR8, reg);
/*
- * Enable RX.
- */
- rt2500pci_toggle_rx(rt2x00dev, 1);
-
- /*
* Enable LED
*/
rt2500pci_enable_led(rt2x00dev);
- ieee80211_start_queues(rt2x00dev->hw);
-
return 0;
-
-exit_fail:
- rt2500pci_uninitialize(rt2x00dev);
- return -EIO;
}
static void rt2500pci_disable_radio(struct rt2x00_dev *rt2x00dev)
{
u32 reg;
- if (!GET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO))
- return;
-
- ieee80211_stop_queues(rt2x00dev->hw);
-
/*
* Disable LED
*/
rt2500pci_disable_led(rt2x00dev);
- CLEAR_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO);
-
rt2x00_register_write(rt2x00dev, PWRCSR0, 0);
/*
@@ -1451,8 +1419,6 @@ static void rt2500pci_disable_radio(struct rt2x00_dev *rt2x00dev)
rt2x00_set_field32(®, TXCSR0_ABORT, 1);
rt2x00_register_write(rt2x00dev, TXCSR0, reg);
- rt2500pci_toggle_rx(rt2x00dev, 0);
-
/*
* Disable interrupts.
*/
@@ -2747,12 +2713,13 @@ static void rt2500pci_remove(struct pci_dev *pci_dev)
/*
* Uninitialize the 80211 stack data.
*/
- ieee80211_unregister_hw(hw);
+ if (GET_FLAG(rt2x00dev, DEVICE_INITIALIZED_HW))
+ ieee80211_unregister_hw(hw);
/*
* Uninitialize and free the rt2500pci driver data.
*/
- rt2500pci_disable_radio(rt2x00dev);
+ rt2x00lib_disable_radio(rt2x00dev);
rt2500pci_uninitialize(rt2x00dev);
rt2500pci_free_dev(rt2x00dev);
@@ -2781,7 +2748,7 @@ static int rt2500pci_suspend(struct pci_dev *pci_dev, pm_message_t state)
/*
* Disable the radio.
*/
- rt2500pci_disable_radio(rt2x00dev);
+ rt2x00lib_disable_radio(rt2x00dev);
/*
* Set device mode to sleep for power management.
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt2500pci.h b/drivers/net/wireless/mac80211/rt2x00/rt2500pci.h
index fd7cd1a..5c32b48 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt2500pci.h
+++ b/drivers/net/wireless/mac80211/rt2x00/rt2500pci.h
@@ -1183,12 +1183,6 @@ static void rt2500pci_activity_led(struct rt2x00_dev *rt2x00dev,
char activity);
/*
- * Radio control functions.
- */
-static int rt2500pci_enable_radio(struct rt2x00_dev *rt2x00dev);
-static void rt2500pci_disable_radio(struct rt2x00_dev *rt2x00dev);
-
-/*
* Interrupt functions.
*/
static void rt2500pci_rxdone(struct work_struct *work);
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt2500usb.c b/drivers/net/wireless/mac80211/rt2x00/rt2500usb.c
index e023711..a67568a 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/mac80211/rt2x00/rt2500usb.c
@@ -228,7 +228,7 @@ rf_write:
rt2x00_register_write(rt2x00dev, PHY_CSR10, reg);
}
-#if defined(CONFIG_RT2X00_DEBUGFS) || defined(CONFIG_RT2X00_DEBUGFS_MODULE)
+#ifdef CONFIG_RT2X00_DEBUGFS
#include "rt2x00debug.h"
#define CSR_OFFSET(__word) ( CSR_REG_BASE + ((__word) * sizeof(u16)) )
@@ -277,32 +277,33 @@ static struct rt2x00debug rt2500usb_rt2x00debug = {
.read = rt2500usb_read_csr,
.write = rt2500usb_write_csr,
.word_size = sizeof(u16),
- .length = CSR_REG_SIZE,
+ .word_count = CSR_REG_SIZE / sizeof(u16),
},
.reg_eeprom = {
.read = rt2500usb_read_eeprom,
.write = rt2500usb_write_eeprom,
.word_size = sizeof(u16),
- .length = EEPROM_SIZE,
+ .word_count = EEPROM_SIZE / sizeof(u16),
},
.reg_bbp = {
.read = rt2500usb_read_bbp,
.write = rt2500usb_write_bbp,
.word_size = sizeof(u8),
- .length = BBP_SIZE,
+ .word_count = BBP_SIZE / sizeof(u8),
},
};
static void rt2500usb_open_debugfs(struct rt2x00_dev *rt2x00dev)
{
- if (!rt2x00debug_register(&rt2500usb_rt2x00debug,
- rt2x00dev->hw->wiphy, rt2x00dev))
+ rt2x00dev->debugfs_intf = rt2x00debug_register(
+ &rt2500usb_rt2x00debug, rt2x00dev->hw->wiphy, rt2x00dev);
+ if (!rt2x00dev->debugfs_intf)
ERROR("Failed to register debug handler.\n");
}
static void rt2500usb_close_debugfs(struct rt2x00_dev *rt2x00dev)
{
- rt2x00debug_deregister(&rt2x00dev->debugfs_data);
+ rt2x00debug_deregister(rt2x00dev->debugfs_intf);
}
#else /* CONFIG_RT2X00_DEBUGFS */
static inline void rt2500usb_open_debugfs(struct rt2x00_dev *rt2x00dev){}
@@ -1281,34 +1282,15 @@ static int rt2500usb_enable_radio(struct rt2x00_dev *rt2x00dev)
unsigned int i;
/*
- * Don't enable the radio twice.
- */
- if (GET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO))
- return 0;
-
- /*
* Initialize all registers.
*/
if (rt2500usb_init_rings(rt2x00dev) ||
rt2500usb_init_registers(rt2x00dev) ||
rt2500usb_init_bbp(rt2x00dev)) {
ERROR("Register initialization failed.\n");
- goto exit_fail;
+ return -EIO;
}
- /*
- * Determine channel change time.
- */
- if (rt2x00lib_detect_channel_time(rt2x00dev))
- goto exit_fail;
-
- SET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO);
-
- /*
- * Enable RX.
- */
- rt2500usb_toggle_rx(rt2x00dev, 1);
-
ring = &rt2x00dev->ring[RING_RX];
for (i = 0; i < ring->stats.limit; i++) {
SET_FLAG(&ring->entry[i], ENTRY_OWNER_NIC);
@@ -1320,13 +1302,7 @@ static int rt2500usb_enable_radio(struct rt2x00_dev *rt2x00dev)
*/
rt2500usb_enable_led(rt2x00dev);
- ieee80211_start_queues(rt2x00dev->hw);
-
return 0;
-
-exit_fail:
- rt2500usb_uninitialize(rt2x00dev);
- return -EIO;
}
static void rt2500usb_disable_radio(struct rt2x00_dev *rt2x00dev)
@@ -1334,18 +1310,11 @@ static void rt2500usb_disable_radio(struct rt2x00_dev *rt2x00dev)
struct data_ring *ring;
unsigned int i;
- if (!GET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO))
- return;
-
- ieee80211_stop_queues(rt2x00dev->hw);
-
/*
* Disable LED
*/
rt2500usb_disable_led(rt2x00dev);
- CLEAR_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO);
-
rt2x00_register_write(rt2x00dev, MAC_CSR13, 0x2121);
rt2x00_register_write(rt2x00dev, MAC_CSR14, 0x2121);
@@ -1357,8 +1326,6 @@ static void rt2500usb_disable_radio(struct rt2x00_dev *rt2x00dev)
/*
* Cancel RX and TX.
*/
- rt2500usb_toggle_rx(rt2x00dev, 0);
-
rt2x00_vendor_request(rt2x00dev, USB_RX_CONTROL,
USB_VENDOR_REQUEST_OUT, 0x00, 0x00, NULL, 0, REGISTER_TIMEOUT);
@@ -2545,12 +2512,13 @@ static void rt2500usb_disconnect(struct usb_interface *usb_intf)
/*
* Uninitialize the 80211 stack data.
*/
- ieee80211_unregister_hw(hw);
+ if (GET_FLAG(rt2x00dev, DEVICE_INITIALIZED_HW))
+ ieee80211_unregister_hw(hw);
/*
* Uninitialize and free the rt2500usb driver data.
*/
- rt2500usb_disable_radio(rt2x00dev);
+ rt2x00lib_disable_radio(rt2x00dev);
rt2500usb_uninitialize(rt2x00dev);
rt2500usb_free_dev(rt2x00dev);
@@ -2579,7 +2547,7 @@ static int rt2500usb_suspend(struct usb_interface *usb_intf,
/*
* Disable the radio.
*/
- rt2500usb_disable_radio(rt2x00dev);
+ rt2x00lib_disable_radio(rt2x00dev);
/*
* Set device mode to sleep for power management.
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt2500usb.h b/drivers/net/wireless/mac80211/rt2x00/rt2500usb.h
index 287160c..c3e2d6b 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt2500usb.h
+++ b/drivers/net/wireless/mac80211/rt2x00/rt2500usb.h
@@ -731,12 +731,6 @@ static void rt2500usb_enable_led(struct rt2x00_dev *rt2x00dev);
static void rt2500usb_disable_led(struct rt2x00_dev *rt2x00dev);
/*
- * Radio control functions.
- */
-static int rt2500usb_enable_radio(struct rt2x00_dev *rt2x00dev);
-static void rt2500usb_disable_radio(struct rt2x00_dev *rt2x00dev);
-
-/*
* Interrupt functions.
*/
static void rt2500usb_interrupt_beacondone(struct urb *urb);
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt2x00.h b/drivers/net/wireless/mac80211/rt2x00/rt2x00.h
index 38fae66..a0bb0ab 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/mac80211/rt2x00/rt2x00.h
@@ -809,9 +809,10 @@ struct rt2x00_dev {
void __iomem *csr_addr;
/*
- * If enabled, the structure for the debugfs files.
+ * If enabled, the debugfs interface that should be
+ * used for deregistration of debugfs.
*/
- void *debugfs_data;
+ struct rt2x00debug_intf *debugfs_intf;
/*
* Queue for deferred work.
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt2x00debug.c b/drivers/net/wireless/mac80211/rt2x00/rt2x00debug.c
index 290fa12..9b8138d 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt2x00debug.c
+++ b/drivers/net/wireless/mac80211/rt2x00/rt2x00debug.c
@@ -19,16 +19,12 @@
*/
/*
- Module: rt2x00debug
- Abstract: rt2x00debug specific routines.
+ Module: rt2x00lib
+ Abstract: rt2x00 debugfs specific routines.
Supported chipsets: RT2460, RT2560, RT2570,
rt2561, rt2561s, rt2661 & rt2573.
*/
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/version.h>
-#include <linux/init.h>
#include <linux/debugfs.h>
#include <asm/uaccess.h>
@@ -187,7 +183,7 @@ exit:
struct rt2x00debug *debug = intf->debug; \
struct rt2x00debug_reg *reg = &debug->reg_##__name; \
\
- if (intf->offset_##__name > reg->length) \
+ if (intf->offset_##__name > reg->word_count) \
return -EINVAL; \
\
return rt2x00debug_file_read(intf->rt2x00dev, buf, \
@@ -206,7 +202,7 @@ RT2X00DEBUGFS_OPS_READ(bbp);
struct rt2x00debug *debug = intf->debug; \
struct rt2x00debug_reg *reg = &debug->reg_##__name; \
\
- if (intf->offset_##__name > reg->length) \
+ if (intf->offset_##__name > reg->word_count) \
return -EINVAL; \
\
return rt2x00debug_file_write(intf->rt2x00dev, buf, \
@@ -260,9 +256,9 @@ static struct dentry *rt2x00debug_create_file_chipset(const char *name,
return NULL;
blob->data = data;
- data += sprintf(data, "csr length: %d\n", debug->reg_csr.length);
- data += sprintf(data, "eeprom length: %d\n", debug->reg_eeprom.length);
- data += sprintf(data, "bbp length: %d\n", debug->reg_bbp.length);
+ data += sprintf(data, "csr length: %d\n", debug->reg_csr.word_count);
+ data += sprintf(data, "eeprom length: %d\n", debug->reg_eeprom.word_count);
+ data += sprintf(data, "bbp length: %d\n", debug->reg_bbp.word_count);
blob->size = strlen(blob->data);
return debugfs_create_blob(name, S_IRUGO, intf->driver_folder, blob);
@@ -331,17 +327,15 @@ void *rt2x00debug_register(struct rt2x00debug *debug, struct wiphy *wiphy,
return intf;
exit:
- rt2x00debug_deregister(debug);
+ rt2x00debug_deregister(intf);
return NULL;
}
EXPORT_SYMBOL_GPL(rt2x00debug_register);
-void rt2x00debug_deregister(void *debugfs_data)
+void rt2x00debug_deregister(struct rt2x00debug_intf *intf)
{
- struct rt2x00debug_intf *intf = debugfs_data;
-
- if (!intf)
+ if (unlikely(!intf))
return;
debugfs_remove(intf->bbp_val_entry);
@@ -358,23 +352,3 @@ void rt2x00debug_deregister(void *debugfs_data)
kfree(intf);
}
EXPORT_SYMBOL_GPL(rt2x00debug_deregister);
-
-/*
- * rt2x00debug module information.
- */
-MODULE_AUTHOR("http://rt2x00.serialmonkey.com");
-MODULE_DESCRIPTION("Debugfs support for rt2x00 drivers.");
-MODULE_LICENSE("GPL");
-
-static int __init rt2x00debug_init(void)
-{
- return 0;
-}
-
-static void __exit rt2x00debug_exit(void)
-{
-
-}
-
-module_init(rt2x00debug_init);
-module_exit(rt2x00debug_exit);
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt2x00debug.h b/drivers/net/wireless/mac80211/rt2x00/rt2x00debug.h
index ef8401d..6c98718 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt2x00debug.h
+++ b/drivers/net/wireless/mac80211/rt2x00/rt2x00debug.h
@@ -31,6 +31,7 @@
#include <net/wireless.h>
struct rt2x00_dev;
+struct rt2x00debug_intf;
typedef void (debug_access_t)(struct rt2x00_dev *rt2x00dev,
const unsigned long word, void *data);
@@ -40,7 +41,7 @@ struct rt2x00debug_reg {
debug_access_t *write;
unsigned int word_size;
- unsigned int length;
+ unsigned int word_count;
};
struct rt2x00debug {
@@ -65,6 +66,6 @@ struct rt2x00debug {
void *rt2x00debug_register(struct rt2x00debug *debug, struct wiphy *wiphy,
struct rt2x00_dev *rt2x00dev);
-void rt2x00debug_deregister(void *debugfs_data);
+void rt2x00debug_deregister(struct rt2x00debug_intf *intf);
#endif /* RT2X00DEBUG_H */
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt2x00dev.c b/drivers/net/wireless/mac80211/rt2x00/rt2x00dev.c
index 39a3be2..8854bb2 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/mac80211/rt2x00/rt2x00dev.c
@@ -40,6 +40,57 @@
#include "rt2x00.h"
#include "rt2x00lib.h"
+/*
+ * Radio control handlers.
+ */
+int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev)
+{
+ int status;
+
+ /*
+ * Don't enable the radio twice.
+ * or if the hardware button has been disabled.
+ */
+ if (GET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO))
+ return 0;
+
+ status = rt2x00dev->lib_ops->enable_radio(rt2x00dev);
+ if (status)
+ return status;
+
+ /*
+ * Determine channel change time.
+ */
+ if (rt2x00lib_detect_channel_time(rt2x00dev)) {
+ rt2x00dev->lib_ops->disable_radio(rt2x00dev);
+ return -EIO;
+ }
+
+ SET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO);
+
+ rt2x00dev->lib_ops->toggle_rx(rt2x00dev, 1);
+
+ ieee80211_start_queues(rt2x00dev->hw);
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(rt2x00lib_enable_radio);
+
+void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev)
+{
+ if (!GET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO))
+ return;
+
+ ieee80211_stop_queues(rt2x00dev->hw);
+
+ rt2x00dev->lib_ops->toggle_rx(rt2x00dev, 0);
+
+ CLEAR_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO);
+
+ rt2x00dev->lib_ops->disable_radio(rt2x00dev);
+}
+EXPORT_SYMBOL_GPL(rt2x00lib_disable_radio);
+
#ifdef CONFIG_RT2X00_LIB_FIRMWARE
struct fw_entry {
u32 chip;
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt2x00lib.h b/drivers/net/wireless/mac80211/rt2x00/rt2x00lib.h
index 63fbef6..0a04255 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt2x00lib.h
+++ b/drivers/net/wireless/mac80211/rt2x00/rt2x00lib.h
@@ -31,6 +31,12 @@
#include <linux/firmware.h>
/*
+ * Radio control handlers.
+ */
+int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev);
+void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev);
+
+/*
* Firmware handlers.
*/
#ifdef CONFIG_RT2X00_LIB_FIRMWARE
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt2x00mac.c b/drivers/net/wireless/mac80211/rt2x00/rt2x00mac.c
index eaf267a..569996d 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/mac80211/rt2x00/rt2x00mac.c
@@ -118,8 +118,8 @@ int rt2x00lib_reset(struct ieee80211_hw *hw)
{
struct rt2x00_dev *rt2x00dev = hw->priv;
- rt2x00dev->lib_ops->disable_radio(rt2x00dev);
- return rt2x00dev->lib_ops->enable_radio(rt2x00dev);
+ rt2x00lib_disable_radio(rt2x00dev);
+ return rt2x00lib_enable_radio(rt2x00dev);
}
EXPORT_SYMBOL_GPL(rt2x00lib_reset);
@@ -172,7 +172,7 @@ int rt2x00lib_add_interface(struct ieee80211_hw *hw,
/*
* Enable radio.
*/
- status = rt2x00dev->lib_ops->enable_radio(rt2x00dev);
+ status = rt2x00lib_enable_radio(rt2x00dev);
if (status)
return status;
}
@@ -238,7 +238,7 @@ void rt2x00lib_remove_interface(struct ieee80211_hw *hw,
*/
if (!GET_FLAG(rt2x00dev, INTERFACE_INITIALIZED_MONITOR) &&
!GET_FLAG(rt2x00dev, INTERFACE_INITIALIZED))
- rt2x00dev->lib_ops->disable_radio(rt2x00dev);
+ rt2x00lib_disable_radio(rt2x00dev);
/*
* Check if we still have 1 non-monitor or a monitor
@@ -275,7 +275,7 @@ int rt2x00lib_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
*/
if (GET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO)) {
if (!conf->radio_enabled)
- rt2x00dev->lib_ops->disable_radio(rt2x00dev);
+ rt2x00lib_disable_radio(rt2x00dev);
else {
rt2x00dev->lib_ops->toggle_rx(rt2x00dev, 0);
}
@@ -297,7 +297,7 @@ int rt2x00lib_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
if (GET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO)) {
rt2x00dev->lib_ops->toggle_rx(rt2x00dev, 1);
} else if (conf->radio_enabled)
- return rt2x00dev->lib_ops->enable_radio(rt2x00dev);
+ return rt2x00lib_enable_radio(rt2x00dev);
return 0;
}
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt61pci.c b/drivers/net/wireless/mac80211/rt2x00/rt61pci.c
index d2ee3f5..ed11d26 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/mac80211/rt2x00/rt61pci.c
@@ -217,7 +217,7 @@ static void rt2x00_mcu_request(const struct rt2x00_dev *rt2x00dev,
rt2x00_register_write(rt2x00dev, HOST_CMD_CSR, reg);
}
-#if defined(CONFIG_RT2X00_DEBUGFS) || defined(CONFIG_RT2X00_DEBUGFS_MODULE)
+#ifdef CONFIG_RT2X00_DEBUGFS
#include "rt2x00debug.h"
#define CSR_OFFSET(__word) ( CSR_REG_BASE + ((__word) * sizeof(u32)) )
@@ -266,32 +266,33 @@ static struct rt2x00debug rt61pci_rt2x00debug = {
.read = rt61pci_read_csr,
.write = rt61pci_write_csr,
.word_size = sizeof(u32),
- .length = CSR_REG_SIZE,
+ .word_count = CSR_REG_SIZE / sizeof(u32),
},
.reg_eeprom = {
.read = rt61pci_read_eeprom,
.write = rt61pci_write_eeprom,
.word_size = sizeof(u16),
- .length = EEPROM_SIZE,
+ .word_count = EEPROM_SIZE / sizeof(u16),
},
.reg_bbp = {
.read = rt61pci_read_bbp,
.write = rt61pci_write_bbp,
.word_size = sizeof(u8),
- .length = BBP_SIZE,
+ .word_count = BBP_SIZE / sizeof(u8),
},
};
static void rt61pci_open_debugfs(struct rt2x00_dev *rt2x00dev)
{
- if (!rt2x00debug_register(&rt61pci_rt2x00debug,
- rt2x00dev->hw->wiphy, rt2x00dev))
+ rt2x00dev->debugfs_intf = rt2x00debug_register(
+ &rt61pci_rt2x00debug, rt2x00dev->hw->wiphy, rt2x00dev);
+ if (!rt2x00dev->debugfs_intf)
ERROR("Failed to register debug handler.\n");
}
static void rt61pci_close_debugfs(struct rt2x00_dev *rt2x00dev)
{
- rt2x00debug_deregister(&rt2x00dev->debugfs_data);
+ rt2x00debug_deregister(rt2x00dev->debugfs_intf);
}
#else /* CONFIG_RT2X00_DEBUGFS */
static inline void rt61pci_open_debugfs(struct rt2x00_dev *rt2x00dev){}
@@ -1631,29 +1632,16 @@ static int rt61pci_enable_radio(struct rt2x00_dev *rt2x00dev)
u32 reg;
/*
- * Don't enable the radio twice.
- * or if the hardware button has been disabled.
- */
- if (GET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO))
- return 0;
-
- /*
* Initialize all registers.
*/
if (rt61pci_init_rings(rt2x00dev) ||
rt61pci_init_registers(rt2x00dev) ||
rt61pci_init_bbp(rt2x00dev)) {
ERROR("Register initialization failed.\n");
- goto exit_fail;
+ return -EIO;
}
/*
- * Determine channel change time.
- */
- if (rt2x00lib_detect_channel_time(rt2x00dev))
- goto exit_fail;
-
- /*
* Clear interrupts.
*/
rt2x00_register_read(rt2x00dev, INT_SOURCE_CSR, ®);
@@ -1662,8 +1650,6 @@ static int rt61pci_enable_radio(struct rt2x00_dev *rt2x00dev)
rt2x00_register_read(rt2x00dev, MCU_INT_SOURCE_CSR, ®);
rt2x00_register_write(rt2x00dev, MCU_INT_SOURCE_CSR, reg);
- SET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO);
-
/*
* Enable interrupts.
*/
@@ -1678,38 +1664,24 @@ static int rt61pci_enable_radio(struct rt2x00_dev *rt2x00dev)
* Enable RX.
*/
rt2x00_register_write(rt2x00dev, RX_CNTL_CSR, 0x00000001);
- rt61pci_toggle_rx(rt2x00dev, 1);
/*
* Enable LED
*/
rt61pci_enable_led(rt2x00dev);
- ieee80211_start_queues(rt2x00dev->hw);
-
return 0;
-
-exit_fail:
- rt61pci_uninitialize(rt2x00dev);
- return -EIO;
}
static void rt61pci_disable_radio(struct rt2x00_dev *rt2x00dev)
{
u32 reg;
- if (!GET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO))
- return;
-
- ieee80211_stop_queues(rt2x00dev->hw);
-
/*
* Disable LED
*/
rt61pci_disable_led(rt2x00dev);
- CLEAR_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO);
-
rt2x00_register_write(rt2x00dev, MAC_CSR10, 0x00001818);
/*
@@ -1728,8 +1700,6 @@ static void rt61pci_disable_radio(struct rt2x00_dev *rt2x00dev)
rt2x00_set_field32(®, TX_CNTL_CSR_ABORT_TX_MGMT, 1);
rt2x00_register_write(rt2x00dev, TX_CNTL_CSR, reg);
- rt61pci_toggle_rx(rt2x00dev, 0);
-
/*
* Disable interrupts.
*/
@@ -3211,12 +3181,13 @@ static void rt61pci_remove(struct pci_dev *pci_dev)
/*
* Uninitialize the 80211 stack data.
*/
- ieee80211_unregister_hw(hw);
+ if (GET_FLAG(rt2x00dev, DEVICE_INITIALIZED_HW))
+ ieee80211_unregister_hw(hw);
/*
* Uninitialize and free the rt61pci driver data.
*/
- rt61pci_disable_radio(rt2x00dev);
+ rt2x00lib_disable_radio(rt2x00dev);
rt61pci_uninitialize(rt2x00dev);
rt61pci_free_dev(rt2x00dev);
@@ -3245,7 +3216,7 @@ static int rt61pci_suspend(struct pci_dev *pci_dev, pm_message_t state)
/*
* Disable the radio.
*/
- rt61pci_disable_radio(rt2x00dev);
+ rt2x00lib_disable_radio(rt2x00dev);
/*
* Set device mode to sleep for power management.
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt61pci.h b/drivers/net/wireless/mac80211/rt2x00/rt61pci.h
index 4c97ba8..44de73f 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt61pci.h
+++ b/drivers/net/wireless/mac80211/rt2x00/rt61pci.h
@@ -1346,12 +1346,6 @@ static void rt61pci_disable_led(struct rt2x00_dev *rt2x00dev);
static void rt61pci_activity_led(struct rt2x00_dev *rt2x00dev, char rssi);
/*
- * Radio control functions.
- */
-static int rt61pci_enable_radio(struct rt2x00_dev *rt2x00dev);
-static void rt61pci_disable_radio(struct rt2x00_dev *rt2x00dev);
-
-/*
* Interrupt functions.
*/
static void rt61pci_rxdone(struct work_struct *work);
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt73usb.c b/drivers/net/wireless/mac80211/rt2x00/rt73usb.c
index 837ceb1..dde1065 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/mac80211/rt2x00/rt73usb.c
@@ -224,7 +224,7 @@ rf_write:
rt2x00_register_write(rt2x00dev, PHY_CSR4, reg);
}
-#if defined(CONFIG_RT2X00_DEBUGFS) || defined(CONFIG_RT2X00_DEBUGFS_MODULE)
+#ifdef CONFIG_RT2X00_DEBUGFS
#include "rt2x00debug.h"
#define CSR_OFFSET(__word) ( CSR_REG_BASE + ((__word) * sizeof(u32)) )
@@ -273,32 +273,33 @@ static struct rt2x00debug rt73usb_rt2x00debug = {
.read = rt73usb_read_csr,
.write = rt73usb_write_csr,
.word_size = sizeof(u32),
- .length = CSR_REG_SIZE,
+ .word_count = CSR_REG_SIZE / sizeof(u32),
},
.reg_eeprom = {
.read = rt73usb_read_eeprom,
.write = rt73usb_write_eeprom,
.word_size = sizeof(u16),
- .length = EEPROM_SIZE,
+ .word_count = EEPROM_SIZE / sizeof(u16),
},
.reg_bbp = {
.read = rt73usb_read_bbp,
.write = rt73usb_write_bbp,
.word_size = sizeof(u8),
- .length = BBP_SIZE,
+ .word_count = BBP_SIZE / sizeof(u8),
},
};
static void rt73usb_open_debugfs(struct rt2x00_dev *rt2x00dev)
{
- if (!rt2x00debug_register(&rt73usb_rt2x00debug,
- rt2x00dev->hw->wiphy, rt2x00dev))
+ rt2x00dev->debugfs_intf = rt2x00debug_register(
+ &rt73usb_rt2x00debug, rt2x00dev->hw->wiphy, rt2x00dev);
+ if (!rt2x00dev->debugfs_intf)
ERROR("Failed to register debug handler.\n");
}
static void rt73usb_close_debugfs(struct rt2x00_dev *rt2x00dev)
{
- rt2x00debug_deregister(&rt2x00dev->debugfs_data);
+ rt2x00debug_deregister(rt2x00dev->debugfs_intf);
}
#else /* CONFIG_RT2X00_DEBUGFS */
static inline void rt73usb_open_debugfs(struct rt2x00_dev *rt2x00dev){}
@@ -1410,34 +1411,15 @@ static int rt73usb_enable_radio(struct rt2x00_dev *rt2x00dev)
unsigned int i;
/*
- * Don't enable the radio twice.
- */
- if (GET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO))
- return 0;
-
- /*
* Initialize all registers.
*/
if (rt73usb_init_rings(rt2x00dev) ||
rt73usb_init_registers(rt2x00dev) ||
rt73usb_init_bbp(rt2x00dev)) {
ERROR("Register initialization failed.\n");
- goto exit_fail;
+ return -EIO;
}
- /*
- * Determine channel change time.
- */
- if (rt2x00lib_detect_channel_time(rt2x00dev))
- goto exit_fail;
-
- SET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO);
-
- /*
- * Enable RX.
- */
- rt73usb_toggle_rx(rt2x00dev, 1);
-
ring = &rt2x00dev->ring[RING_RX];
for (i = 0; i < ring->stats.limit; i++) {
SET_FLAG(&ring->entry[i], ENTRY_OWNER_NIC);
@@ -1449,13 +1431,7 @@ static int rt73usb_enable_radio(struct rt2x00_dev *rt2x00dev)
*/
rt73usb_enable_led(rt2x00dev);
- ieee80211_start_queues(rt2x00dev->hw);
-
return 0;
-
-exit_fail:
- rt73usb_uninitialize(rt2x00dev);
- return -EIO;
}
static void rt73usb_disable_radio(struct rt2x00_dev *rt2x00dev)
@@ -1463,18 +1439,11 @@ static void rt73usb_disable_radio(struct rt2x00_dev *rt2x00dev)
struct data_ring *ring;
unsigned int i;
- if (!GET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO))
- return;
-
- ieee80211_stop_queues(rt2x00dev->hw);
-
/*
* Disable LED
*/
rt73usb_disable_led(rt2x00dev);
- CLEAR_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO);
-
rt2x00_register_write(rt2x00dev, MAC_CSR10, 0x00001818);
/*
@@ -1485,8 +1454,6 @@ static void rt73usb_disable_radio(struct rt2x00_dev *rt2x00dev)
/*
* Cancel RX and TX.
*/
- rt73usb_toggle_rx(rt2x00dev, 0);
-
rt2x00_vendor_request(rt2x00dev, USB_RX_CONTROL,
USB_VENDOR_REQUEST_OUT, 0x00, 0x00, NULL, 0, REGISTER_TIMEOUT);
@@ -2835,12 +2802,13 @@ static void rt73usb_disconnect(struct usb_interface *usb_intf)
/*
* Uninitialize the 80211 stack data.
*/
- ieee80211_unregister_hw(hw);
+ if (GET_FLAG(rt2x00dev, DEVICE_INITIALIZED_HW))
+ ieee80211_unregister_hw(hw);
/*
* Uninitialize and free the rt73usb driver data.
*/
- rt73usb_disable_radio(rt2x00dev);
+ rt2x00lib_disable_radio(rt2x00dev);
rt73usb_uninitialize(rt2x00dev);
rt73usb_free_dev(rt2x00dev);
@@ -2868,7 +2836,7 @@ static int rt73usb_suspend(struct usb_interface *usb_intf, pm_message_t state)
/*
* Disable the radio.
*/
- rt73usb_disable_radio(rt2x00dev);
+ rt2x00lib_disable_radio(rt2x00dev);
/*
* Set device mode to sleep for power management.
@@ -2982,6 +2950,7 @@ static struct usb_device_id rt73usb_device_table[] = {
{ USB_DEVICE(0x0769, 0x31f3) },
/* Planex */
{ USB_DEVICE(0x2019, 0xab01) },
+ { USB_DEVICE(0x2019, 0xab50) },
{ 0, }
};
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt73usb.h b/drivers/net/wireless/mac80211/rt2x00/rt73usb.h
index 7394185..8f9abb0 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt73usb.h
+++ b/drivers/net/wireless/mac80211/rt2x00/rt73usb.h
@@ -930,12 +930,6 @@ static void rt73usb_disable_led(struct rt2x00_dev *rt2x00dev);
static void rt73usb_activity_led(struct rt2x00_dev *rt2x00dev, char rssi);
/*
- * Radio control functions.
- */
-static int rt73usb_enable_radio(struct rt2x00_dev *rt2x00dev);
-static void rt73usb_disable_radio(struct rt2x00_dev *rt2x00dev);
-
-/*
* Interrupt functions.
*/
static void rt73usb_interrupt_beacondone(struct urb *urb);
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-04-12 18:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-10 22:39 Please pull from "upstream" branch of rt2x00 Ivo van Doorn
-- strict thread matches above, loose matches on Subject: below --
2007-04-12 18:05 Ivo van Doorn
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).