forked from Minki/linux
[PATCH] rt2x00: Reorganize rt2x00dev->flags
The rt2x00dev->flags has become a chaos over time, this will reorganize the flags by renaming, deleting, adding and properly implement the flags. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
12dadb9009
commit
066cb637b1
@ -1374,7 +1374,7 @@ static int rt2400pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
|
|||||||
* Detect if this device has an hardware controlled radio.
|
* Detect if this device has an hardware controlled radio.
|
||||||
*/
|
*/
|
||||||
if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO))
|
if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO))
|
||||||
__set_bit(DEVICE_SUPPORT_HW_BUTTON, &rt2x00dev->flags);
|
__set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if the BBP tuning should be enabled.
|
* Check if the BBP tuning should be enabled.
|
||||||
@ -1469,7 +1469,7 @@ static int rt2400pci_probe_hw(struct rt2x00_dev *rt2x00dev)
|
|||||||
/*
|
/*
|
||||||
* This device requires the beacon ring
|
* This device requires the beacon ring
|
||||||
*/
|
*/
|
||||||
__set_bit(REQUIRE_BEACON_RING, &rt2x00dev->flags);
|
__set_bit(DRIVER_REQUIRE_BEACON_RING, &rt2x00dev->flags);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the rssi offset.
|
* Set the rssi offset.
|
||||||
|
@ -1545,7 +1545,7 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
|
|||||||
* Detect if this device has an hardware controlled radio.
|
* Detect if this device has an hardware controlled radio.
|
||||||
*/
|
*/
|
||||||
if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO))
|
if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO))
|
||||||
__set_bit(DEVICE_SUPPORT_HW_BUTTON, &rt2x00dev->flags);
|
__set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if the BBP tuning should be enabled.
|
* Check if the BBP tuning should be enabled.
|
||||||
@ -1801,7 +1801,7 @@ static int rt2500pci_probe_hw(struct rt2x00_dev *rt2x00dev)
|
|||||||
/*
|
/*
|
||||||
* This device requires the beacon ring
|
* This device requires the beacon ring
|
||||||
*/
|
*/
|
||||||
__set_bit(REQUIRE_BEACON_RING, &rt2x00dev->flags);
|
__set_bit(DRIVER_REQUIRE_BEACON_RING, &rt2x00dev->flags);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the rssi offset.
|
* Set the rssi offset.
|
||||||
|
@ -1573,7 +1573,7 @@ static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev)
|
|||||||
/*
|
/*
|
||||||
* This device requires the beacon ring
|
* This device requires the beacon ring
|
||||||
*/
|
*/
|
||||||
__set_bit(REQUIRE_BEACON_RING, &rt2x00dev->flags);
|
__set_bit(DRIVER_REQUIRE_BEACON_RING, &rt2x00dev->flags);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the rssi offset.
|
* Set the rssi offset.
|
||||||
|
@ -493,24 +493,21 @@ struct rt2x00_dev {
|
|||||||
* of the device capabilities are stored.
|
* of the device capabilities are stored.
|
||||||
*/
|
*/
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
#define DEVICE_ENABLED_RADIO 1
|
#define DEVICE_PRESENT 1
|
||||||
#define DEVICE_ENABLED_RADIO_HW 2
|
#define DEVICE_REGISTERED_HW 2
|
||||||
#define DEVICE_INITIALIZED 3
|
#define DEVICE_INITIALIZED 3
|
||||||
#define DEVICE_INITIALIZED_HW 4
|
#define DEVICE_STARTED 4
|
||||||
#define REQUIRE_FIRMWARE 5
|
#define DEVICE_ENABLED_RADIO 5
|
||||||
/* Hole: Add new Flag here */
|
#define DEVICE_ENABLED_RADIO_HW 6
|
||||||
#define INTERFACE_RESUME 8
|
#define DRIVER_REQUIRE_FIRMWARE 7
|
||||||
#define INTERFACE_ENABLED 9
|
#define DRIVER_REQUIRE_BEACON_RING 8
|
||||||
/* Hole: Add new Flag here */
|
#define CONFIG_SUPPORT_HW_BUTTON 9
|
||||||
#define REQUIRE_BEACON_RING 11
|
#define CONFIG_FRAME_TYPE 10
|
||||||
#define DEVICE_SUPPORT_HW_BUTTON 12
|
#define CONFIG_RF_SEQUENCE 11
|
||||||
#define CONFIG_FRAME_TYPE 13
|
#define CONFIG_EXTERNAL_LNA_A 12
|
||||||
#define CONFIG_RF_SEQUENCE 14
|
#define CONFIG_EXTERNAL_LNA_BG 13
|
||||||
/* Hole: Add new Flag here */
|
#define CONFIG_DOUBLE_ANTENNA 14
|
||||||
#define CONFIG_EXTERNAL_LNA_A 16
|
#define CONFIG_DISABLE_LINK_TUNING 15
|
||||||
#define CONFIG_EXTERNAL_LNA_BG 17
|
|
||||||
#define CONFIG_DOUBLE_ANTENNA 18
|
|
||||||
#define CONFIG_DISABLE_LINK_TUNING 19
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Chipset identification.
|
* Chipset identification.
|
||||||
|
@ -48,33 +48,20 @@ void rt2x00lib_config_bssid(struct rt2x00_dev *rt2x00dev, u8 *bssid)
|
|||||||
|
|
||||||
void rt2x00lib_config_type(struct rt2x00_dev *rt2x00dev, int type)
|
void rt2x00lib_config_type(struct rt2x00_dev *rt2x00dev, int type)
|
||||||
{
|
{
|
||||||
struct interface *intf = &rt2x00dev->interface;
|
if (type != INVALID_INTERFACE)
|
||||||
|
rt2x00dev->ops->lib->config_type(rt2x00dev, type);
|
||||||
if (!test_bit(INTERFACE_RESUME, &rt2x00dev->flags) &&
|
|
||||||
(!!test_bit(INTERFACE_ENABLED, &rt2x00dev->flags) ==
|
|
||||||
!!is_interface_present(intf)))
|
|
||||||
return;
|
|
||||||
|
|
||||||
rt2x00dev->ops->lib->config_type(rt2x00dev, type);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Update the configuration flags.
|
|
||||||
*/
|
|
||||||
if (is_interface_present(intf))
|
|
||||||
__set_bit(INTERFACE_ENABLED, &rt2x00dev->flags);
|
|
||||||
else
|
|
||||||
__clear_bit(INTERFACE_ENABLED, &rt2x00dev->flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, struct ieee80211_conf *conf)
|
void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
|
||||||
|
struct ieee80211_conf *conf, const int force_config)
|
||||||
{
|
{
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we are in RESUME state we should
|
* In some situations we want to force all configurations
|
||||||
* force all configuration options.
|
* to be reloaded (When resuming for instance).
|
||||||
*/
|
*/
|
||||||
if (test_bit(INTERFACE_RESUME, &rt2x00dev->flags)) {
|
if (force_config) {
|
||||||
flags = CONFIG_UPDATE_ALL;
|
flags = CONFIG_UPDATE_ALL;
|
||||||
goto config;
|
goto config;
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
struct data_ring *rt2x00lib_get_ring(struct rt2x00_dev *rt2x00dev,
|
struct data_ring *rt2x00lib_get_ring(struct rt2x00_dev *rt2x00dev,
|
||||||
const unsigned int queue)
|
const unsigned int queue)
|
||||||
{
|
{
|
||||||
int beacon = test_bit(REQUIRE_BEACON_RING, &rt2x00dev->flags);
|
int beacon = test_bit(DRIVER_REQUIRE_BEACON_RING, &rt2x00dev->flags);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if we are requesting a reqular TX ring,
|
* Check if we are requesting a reqular TX ring,
|
||||||
@ -102,7 +102,7 @@ int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev)
|
|||||||
* And check if the hardware button has been disabled.
|
* And check if the hardware button has been disabled.
|
||||||
*/
|
*/
|
||||||
if (test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) ||
|
if (test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) ||
|
||||||
(test_bit(DEVICE_SUPPORT_HW_BUTTON, &rt2x00dev->flags) &&
|
(test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags) &&
|
||||||
!test_bit(DEVICE_ENABLED_RADIO_HW, &rt2x00dev->flags)))
|
!test_bit(DEVICE_ENABLED_RADIO_HW, &rt2x00dev->flags)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -162,6 +162,9 @@ void rt2x00lib_toggle_rx(struct rt2x00_dev *rt2x00dev, int enable)
|
|||||||
{
|
{
|
||||||
enum dev_state state = enable ? STATE_RADIO_RX_ON : STATE_RADIO_RX_OFF;
|
enum dev_state state = enable ? STATE_RADIO_RX_ON : STATE_RADIO_RX_OFF;
|
||||||
|
|
||||||
|
if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
|
||||||
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When we are disabling the RX, we should also stop the link tuner.
|
* When we are disabling the RX, we should also stop the link tuner.
|
||||||
*/
|
*/
|
||||||
@ -721,7 +724,7 @@ exit:
|
|||||||
|
|
||||||
static void rt2x00lib_remove_hw(struct rt2x00_dev *rt2x00dev)
|
static void rt2x00lib_remove_hw(struct rt2x00_dev *rt2x00dev)
|
||||||
{
|
{
|
||||||
if (test_bit(DEVICE_INITIALIZED_HW, &rt2x00dev->flags))
|
if (test_bit(DEVICE_REGISTERED_HW, &rt2x00dev->flags))
|
||||||
ieee80211_unregister_hw(rt2x00dev->hw);
|
ieee80211_unregister_hw(rt2x00dev->hw);
|
||||||
|
|
||||||
if (likely(rt2x00dev->hwmodes)) {
|
if (likely(rt2x00dev->hwmodes)) {
|
||||||
@ -753,7 +756,7 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
__set_bit(DEVICE_INITIALIZED_HW, &rt2x00dev->flags);
|
__set_bit(DEVICE_REGISTERED_HW, &rt2x00dev->flags);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -810,7 +813,7 @@ static int rt2x00lib_alloc_ring_entries(struct rt2x00_dev *rt2x00dev)
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!test_bit(REQUIRE_BEACON_RING, &rt2x00dev->flags))
|
if (!test_bit(DRIVER_REQUIRE_BEACON_RING, &rt2x00dev->flags))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -919,7 +922,7 @@ static int rt2x00lib_alloc_rings(struct rt2x00_dev *rt2x00dev)
|
|||||||
* Atim: 1 (if required)
|
* Atim: 1 (if required)
|
||||||
*/
|
*/
|
||||||
rt2x00dev->data_rings = 1 + rt2x00dev->hw->queues +
|
rt2x00dev->data_rings = 1 + rt2x00dev->hw->queues +
|
||||||
(2 * test_bit(REQUIRE_BEACON_RING, &rt2x00dev->flags));
|
(2 * test_bit(DRIVER_REQUIRE_BEACON_RING, &rt2x00dev->flags));
|
||||||
|
|
||||||
ring = kzalloc(rt2x00dev->data_rings * sizeof(*ring), GFP_KERNEL);
|
ring = kzalloc(rt2x00dev->data_rings * sizeof(*ring), GFP_KERNEL);
|
||||||
if (!ring) {
|
if (!ring) {
|
||||||
@ -932,7 +935,7 @@ static int rt2x00lib_alloc_rings(struct rt2x00_dev *rt2x00dev)
|
|||||||
*/
|
*/
|
||||||
rt2x00dev->rx = ring;
|
rt2x00dev->rx = ring;
|
||||||
rt2x00dev->tx = &rt2x00dev->rx[1];
|
rt2x00dev->tx = &rt2x00dev->rx[1];
|
||||||
if (test_bit(REQUIRE_BEACON_RING, &rt2x00dev->flags))
|
if (test_bit(DRIVER_REQUIRE_BEACON_RING, &rt2x00dev->flags))
|
||||||
rt2x00dev->bcn = &rt2x00dev->tx[rt2x00dev->hw->queues];
|
rt2x00dev->bcn = &rt2x00dev->tx[rt2x00dev->hw->queues];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1011,6 +1014,8 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
|
|||||||
*/
|
*/
|
||||||
rt2x00debug_register(rt2x00dev);
|
rt2x00debug_register(rt2x00dev);
|
||||||
|
|
||||||
|
__set_bit(DEVICE_PRESENT, &rt2x00dev->flags);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
@ -1022,6 +1027,8 @@ EXPORT_SYMBOL_GPL(rt2x00lib_probe_dev);
|
|||||||
|
|
||||||
void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
|
void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
|
||||||
{
|
{
|
||||||
|
__clear_bit(DEVICE_PRESENT, &rt2x00dev->flags);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Disable radio.
|
* Disable radio.
|
||||||
*/
|
*/
|
||||||
@ -1068,6 +1075,13 @@ int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev, pm_message_t state)
|
|||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
NOTICE(rt2x00dev, "Going to sleep.\n");
|
NOTICE(rt2x00dev, "Going to sleep.\n");
|
||||||
|
__clear_bit(DEVICE_PRESENT, &rt2x00dev->flags);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Only continue if mac80211 has open interfaces.
|
||||||
|
*/
|
||||||
|
if (!test_bit(DEVICE_STARTED, &rt2x00dev->flags))
|
||||||
|
goto exit;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Disable radio and unitialize all items
|
* Disable radio and unitialize all items
|
||||||
@ -1077,6 +1091,7 @@ int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev, pm_message_t state)
|
|||||||
rt2x00lib_uninitialize(rt2x00dev);
|
rt2x00lib_uninitialize(rt2x00dev);
|
||||||
rt2x00debug_deregister(rt2x00dev);
|
rt2x00debug_deregister(rt2x00dev);
|
||||||
|
|
||||||
|
exit:
|
||||||
/*
|
/*
|
||||||
* Set device mode to sleep for power management.
|
* Set device mode to sleep for power management.
|
||||||
*/
|
*/
|
||||||
@ -1094,13 +1109,19 @@ int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev)
|
|||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
NOTICE(rt2x00dev, "Waking up.\n");
|
NOTICE(rt2x00dev, "Waking up.\n");
|
||||||
__set_bit(INTERFACE_RESUME, &rt2x00dev->flags);
|
__set_bit(DEVICE_PRESENT, &rt2x00dev->flags);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open the debugfs entry.
|
* Open the debugfs entry.
|
||||||
*/
|
*/
|
||||||
rt2x00debug_register(rt2x00dev);
|
rt2x00debug_register(rt2x00dev);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Only continue if mac80211 has open interfaces.
|
||||||
|
*/
|
||||||
|
if (!test_bit(DEVICE_STARTED, &rt2x00dev->flags))
|
||||||
|
return 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reinitialize device and all active interfaces.
|
* Reinitialize device and all active interfaces.
|
||||||
*/
|
*/
|
||||||
@ -1111,14 +1132,22 @@ int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev)
|
|||||||
/*
|
/*
|
||||||
* Reconfigure device.
|
* Reconfigure device.
|
||||||
*/
|
*/
|
||||||
retval = rt2x00mac_config(rt2x00dev->hw, &rt2x00dev->hw->conf);
|
rt2x00lib_config(rt2x00dev, &rt2x00dev->hw->conf, 1);
|
||||||
if (retval)
|
if (!rt2x00dev->hw->conf.radio_enabled)
|
||||||
goto exit;
|
rt2x00lib_disable_radio(rt2x00dev);
|
||||||
|
|
||||||
rt2x00lib_config_mac_addr(rt2x00dev, intf->mac);
|
rt2x00lib_config_mac_addr(rt2x00dev, intf->mac);
|
||||||
rt2x00lib_config_bssid(rt2x00dev, intf->bssid);
|
rt2x00lib_config_bssid(rt2x00dev, intf->bssid);
|
||||||
rt2x00lib_config_type(rt2x00dev, intf->type);
|
rt2x00lib_config_type(rt2x00dev, intf->type);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* It is possible that during that mac80211 has attempted
|
||||||
|
* to send frames while we were suspending or resuming.
|
||||||
|
* In that case we have disabled the TX queue and should
|
||||||
|
* now enable it again
|
||||||
|
*/
|
||||||
|
ieee80211_start_queues(rt2x00dev->hw);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When in Master or Ad-hoc mode,
|
* When in Master or Ad-hoc mode,
|
||||||
* restart Beacon transmitting by faking a beacondone event.
|
* restart Beacon transmitting by faking a beacondone event.
|
||||||
@ -1127,8 +1156,6 @@ int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev)
|
|||||||
intf->type == IEEE80211_IF_TYPE_IBSS)
|
intf->type == IEEE80211_IF_TYPE_IBSS)
|
||||||
rt2x00lib_beacondone(rt2x00dev);
|
rt2x00lib_beacondone(rt2x00dev);
|
||||||
|
|
||||||
__clear_bit(INTERFACE_RESUME, &rt2x00dev->flags);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
@ -1136,8 +1163,6 @@ exit:
|
|||||||
rt2x00lib_uninitialize(rt2x00dev);
|
rt2x00lib_uninitialize(rt2x00dev);
|
||||||
rt2x00debug_deregister(rt2x00dev);
|
rt2x00debug_deregister(rt2x00dev);
|
||||||
|
|
||||||
__clear_bit(INTERFACE_RESUME, &rt2x00dev->flags);
|
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(rt2x00lib_resume);
|
EXPORT_SYMBOL_GPL(rt2x00lib_resume);
|
||||||
|
@ -52,7 +52,8 @@ void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev);
|
|||||||
void rt2x00lib_config_mac_addr(struct rt2x00_dev *rt2x00dev, u8 *mac);
|
void rt2x00lib_config_mac_addr(struct rt2x00_dev *rt2x00dev, u8 *mac);
|
||||||
void rt2x00lib_config_bssid(struct rt2x00_dev *rt2x00dev, u8 *bssid);
|
void rt2x00lib_config_bssid(struct rt2x00_dev *rt2x00dev, u8 *bssid);
|
||||||
void rt2x00lib_config_type(struct rt2x00_dev *rt2x00dev, int type);
|
void rt2x00lib_config_type(struct rt2x00_dev *rt2x00dev, int type);
|
||||||
void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, struct ieee80211_conf *conf);
|
void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
|
||||||
|
struct ieee80211_conf *conf, const int force_config);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Firmware handlers.
|
* Firmware handlers.
|
||||||
|
@ -81,6 +81,17 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
|
|||||||
struct data_ring *ring;
|
struct data_ring *ring;
|
||||||
u16 frame_control;
|
u16 frame_control;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Mac80211 might be calling this function while we are trying
|
||||||
|
* to remove the device or perhaps suspending it.
|
||||||
|
* Note that we can only stop the TX queues inside the TX path
|
||||||
|
* due to possible race conditions in mac80211.
|
||||||
|
*/
|
||||||
|
if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags)) {
|
||||||
|
ieee80211_stop_queues(hw);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Determine which ring to put packet on.
|
* Determine which ring to put packet on.
|
||||||
*/
|
*/
|
||||||
@ -126,14 +137,15 @@ int rt2x00mac_start(struct ieee80211_hw *hw)
|
|||||||
struct rt2x00_dev *rt2x00dev = hw->priv;
|
struct rt2x00_dev *rt2x00dev = hw->priv;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
if (test_bit(DEVICE_INITIALIZED, &rt2x00dev->flags))
|
if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags) ||
|
||||||
|
test_bit(DEVICE_STARTED, &rt2x00dev->flags))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If this is the first interface which is added,
|
* If this is the first interface which is added,
|
||||||
* we should load the firmware now.
|
* we should load the firmware now.
|
||||||
*/
|
*/
|
||||||
if (test_bit(REQUIRE_FIRMWARE, &rt2x00dev->flags)) {
|
if (test_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags)) {
|
||||||
status = rt2x00lib_load_firmware(rt2x00dev);
|
status = rt2x00lib_load_firmware(rt2x00dev);
|
||||||
if (status)
|
if (status)
|
||||||
return status;
|
return status;
|
||||||
@ -155,6 +167,8 @@ int rt2x00mac_start(struct ieee80211_hw *hw)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__set_bit(DEVICE_STARTED, &rt2x00dev->flags);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(rt2x00mac_start);
|
EXPORT_SYMBOL_GPL(rt2x00mac_start);
|
||||||
@ -163,11 +177,16 @@ void rt2x00mac_stop(struct ieee80211_hw *hw)
|
|||||||
{
|
{
|
||||||
struct rt2x00_dev *rt2x00dev = hw->priv;
|
struct rt2x00_dev *rt2x00dev = hw->priv;
|
||||||
|
|
||||||
|
if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags))
|
||||||
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Perhaps we can add something smarter here,
|
* Perhaps we can add something smarter here,
|
||||||
* but for now just disabling the radio should do.
|
* but for now just disabling the radio should do.
|
||||||
*/
|
*/
|
||||||
rt2x00lib_disable_radio(rt2x00dev);
|
rt2x00lib_disable_radio(rt2x00dev);
|
||||||
|
|
||||||
|
__clear_bit(DEVICE_STARTED, &rt2x00dev->flags);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(rt2x00mac_stop);
|
EXPORT_SYMBOL_GPL(rt2x00mac_stop);
|
||||||
|
|
||||||
@ -178,9 +197,12 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw,
|
|||||||
struct interface *intf = &rt2x00dev->interface;
|
struct interface *intf = &rt2x00dev->interface;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We only support 1 non-monitor interface.
|
* Don't allow interfaces to be added while
|
||||||
|
* either the device has disappeared or when
|
||||||
|
* another interface is already present.
|
||||||
*/
|
*/
|
||||||
if (is_interface_present(intf))
|
if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags) ||
|
||||||
|
is_interface_present(intf))
|
||||||
return -ENOBUFS;
|
return -ENOBUFS;
|
||||||
|
|
||||||
intf->id = conf->if_id;
|
intf->id = conf->if_id;
|
||||||
@ -208,9 +230,12 @@ void rt2x00mac_remove_interface(struct ieee80211_hw *hw,
|
|||||||
struct interface *intf = &rt2x00dev->interface;
|
struct interface *intf = &rt2x00dev->interface;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We only support 1 non-monitor interface.
|
* Don't allow interfaces to be remove while
|
||||||
|
* either the device has disappeared or when
|
||||||
|
* no interface is present.
|
||||||
*/
|
*/
|
||||||
if (!is_interface_present(intf))
|
if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags) ||
|
||||||
|
!is_interface_present(intf))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
intf->id = 0;
|
intf->id = 0;
|
||||||
@ -233,12 +258,10 @@ int rt2x00mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
|
|||||||
struct rt2x00_dev *rt2x00dev = hw->priv;
|
struct rt2x00_dev *rt2x00dev = hw->priv;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the device is not initialized we shouldn't accept
|
* Mac80211 might be calling this function while we are trying
|
||||||
* any configuration changes. Mac80211 might be calling
|
* to remove the device or perhaps suspending it.
|
||||||
* this function while we are trying to remove the device
|
|
||||||
* or perhaps suspending it.
|
|
||||||
*/
|
*/
|
||||||
if (!test_bit(DEVICE_INITIALIZED, &rt2x00dev->flags))
|
if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -252,7 +275,7 @@ int rt2x00mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
|
|||||||
rt2x00lib_toggle_rx(rt2x00dev, 0);
|
rt2x00lib_toggle_rx(rt2x00dev, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
rt2x00lib_config(rt2x00dev, conf);
|
rt2x00lib_config(rt2x00dev, conf, 0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reenable RX only if the radio should be on.
|
* Reenable RX only if the radio should be on.
|
||||||
@ -274,12 +297,10 @@ int rt2x00mac_config_interface(struct ieee80211_hw *hw, int if_id,
|
|||||||
int status;
|
int status;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the device is not initialized we shouldn't accept
|
* Mac80211 might be calling this function while we are trying
|
||||||
* any configuration changes. Mac80211 might be calling
|
* to remove the device or perhaps suspending it.
|
||||||
* this function while we are trying to remove the device
|
|
||||||
* or perhaps suspending it.
|
|
||||||
*/
|
*/
|
||||||
if (!test_bit(DEVICE_INITIALIZED, &rt2x00dev->flags))
|
if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -45,9 +45,9 @@ static int rt2x00rfkill_toggle_radio(void *data, enum rfkill_state state)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Only continue if we have an active interface.
|
* Only continue if there are enabled interfaces.
|
||||||
*/
|
*/
|
||||||
if (!is_interface_present(&rt2x00dev->interface))
|
if (!test_bit(DEVICE_STARTED, &rt2x00dev->flags))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (state == RFKILL_STATE_ON) {
|
if (state == RFKILL_STATE_ON) {
|
||||||
@ -76,7 +76,7 @@ int rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev)
|
|||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
if (!test_bit(DEVICE_SUPPORT_HW_BUTTON, &rt2x00dev->flags))
|
if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
retval = rfkill_register(rt2x00dev->rfkill);
|
retval = rfkill_register(rt2x00dev->rfkill);
|
||||||
@ -97,7 +97,7 @@ int rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev)
|
|||||||
|
|
||||||
void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev)
|
void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev)
|
||||||
{
|
{
|
||||||
if (!test_bit(DEVICE_SUPPORT_HW_BUTTON, &rt2x00dev->flags))
|
if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
input_unregister_polled_device(rt2x00dev->poll_dev);
|
input_unregister_polled_device(rt2x00dev->poll_dev);
|
||||||
@ -108,7 +108,7 @@ int rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev)
|
|||||||
{
|
{
|
||||||
struct device *device = wiphy_dev(rt2x00dev->hw->wiphy);
|
struct device *device = wiphy_dev(rt2x00dev->hw->wiphy);
|
||||||
|
|
||||||
if (!test_bit(DEVICE_SUPPORT_HW_BUTTON, &rt2x00dev->flags))
|
if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
rt2x00dev->rfkill = rfkill_allocate(device, RFKILL_TYPE_WLAN);
|
rt2x00dev->rfkill = rfkill_allocate(device, RFKILL_TYPE_WLAN);
|
||||||
@ -138,7 +138,7 @@ int rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev)
|
|||||||
|
|
||||||
void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev)
|
void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev)
|
||||||
{
|
{
|
||||||
if (!test_bit(DEVICE_SUPPORT_HW_BUTTON, &rt2x00dev->flags))
|
if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
input_free_polled_device(rt2x00dev->poll_dev);
|
input_free_polled_device(rt2x00dev->poll_dev);
|
||||||
|
@ -2105,7 +2105,7 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
|
|||||||
* Detect if this device has an hardware controlled radio.
|
* Detect if this device has an hardware controlled radio.
|
||||||
*/
|
*/
|
||||||
if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO))
|
if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO))
|
||||||
__set_bit(DEVICE_SUPPORT_HW_BUTTON, &rt2x00dev->flags);
|
__set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read frequency offset and RF programming sequence.
|
* Read frequency offset and RF programming sequence.
|
||||||
@ -2360,7 +2360,7 @@ static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev)
|
|||||||
/*
|
/*
|
||||||
* This device requires firmware
|
* This device requires firmware
|
||||||
*/
|
*/
|
||||||
__set_bit(REQUIRE_FIRMWARE, &rt2x00dev->flags);
|
__set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the rssi offset.
|
* Set the rssi offset.
|
||||||
|
@ -1827,7 +1827,7 @@ static int rt73usb_probe_hw(struct rt2x00_dev *rt2x00dev)
|
|||||||
/*
|
/*
|
||||||
* This device requires firmware
|
* This device requires firmware
|
||||||
*/
|
*/
|
||||||
__set_bit(REQUIRE_FIRMWARE, &rt2x00dev->flags);
|
__set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the rssi offset.
|
* Set the rssi offset.
|
||||||
|
Loading…
Reference in New Issue
Block a user