rt2x00: Remove rt2x00lib_toggle_rx
As part of the queue refactoring, the rt2x00lib_toggle_rx can be removed and replaced with the call directly to the set_device_state callback function. We can remove the STATE_RADIO_RX_ON_LINK and STATE_RADIO_RX_OFF_LINK, as it was only used for special behavior inside rt2x00lib rather then the drivers. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Acked-by: Gertjan van Wingerde <gwingerde@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Родитель
8be4eed0ea
Коммит
ea175ee262
|
@ -885,8 +885,7 @@ static void rt2400pci_toggle_rx(struct rt2x00_dev *rt2x00dev,
|
|||
|
||||
rt2x00pci_register_read(rt2x00dev, RXCSR0, ®);
|
||||
rt2x00_set_field32(®, RXCSR0_DISABLE_RX,
|
||||
(state == STATE_RADIO_RX_OFF) ||
|
||||
(state == STATE_RADIO_RX_OFF_LINK));
|
||||
(state == STATE_RADIO_RX_OFF));
|
||||
rt2x00pci_register_write(rt2x00dev, RXCSR0, reg);
|
||||
}
|
||||
|
||||
|
@ -989,9 +988,7 @@ static int rt2400pci_set_device_state(struct rt2x00_dev *rt2x00dev,
|
|||
rt2400pci_disable_radio(rt2x00dev);
|
||||
break;
|
||||
case STATE_RADIO_RX_ON:
|
||||
case STATE_RADIO_RX_ON_LINK:
|
||||
case STATE_RADIO_RX_OFF:
|
||||
case STATE_RADIO_RX_OFF_LINK:
|
||||
rt2400pci_toggle_rx(rt2x00dev, state);
|
||||
break;
|
||||
case STATE_RADIO_IRQ_ON:
|
||||
|
|
|
@ -1040,8 +1040,7 @@ static void rt2500pci_toggle_rx(struct rt2x00_dev *rt2x00dev,
|
|||
|
||||
rt2x00pci_register_read(rt2x00dev, RXCSR0, ®);
|
||||
rt2x00_set_field32(®, RXCSR0_DISABLE_RX,
|
||||
(state == STATE_RADIO_RX_OFF) ||
|
||||
(state == STATE_RADIO_RX_OFF_LINK));
|
||||
(state == STATE_RADIO_RX_OFF));
|
||||
rt2x00pci_register_write(rt2x00dev, RXCSR0, reg);
|
||||
}
|
||||
|
||||
|
@ -1144,9 +1143,7 @@ static int rt2500pci_set_device_state(struct rt2x00_dev *rt2x00dev,
|
|||
rt2500pci_disable_radio(rt2x00dev);
|
||||
break;
|
||||
case STATE_RADIO_RX_ON:
|
||||
case STATE_RADIO_RX_ON_LINK:
|
||||
case STATE_RADIO_RX_OFF:
|
||||
case STATE_RADIO_RX_OFF_LINK:
|
||||
rt2500pci_toggle_rx(rt2x00dev, state);
|
||||
break;
|
||||
case STATE_RADIO_IRQ_ON:
|
||||
|
|
|
@ -938,8 +938,7 @@ static void rt2500usb_toggle_rx(struct rt2x00_dev *rt2x00dev,
|
|||
|
||||
rt2500usb_register_read(rt2x00dev, TXRX_CSR2, ®);
|
||||
rt2x00_set_field16(®, TXRX_CSR2_DISABLE_RX,
|
||||
(state == STATE_RADIO_RX_OFF) ||
|
||||
(state == STATE_RADIO_RX_OFF_LINK));
|
||||
(state == STATE_RADIO_RX_OFF));
|
||||
rt2500usb_register_write(rt2x00dev, TXRX_CSR2, reg);
|
||||
}
|
||||
|
||||
|
@ -1019,9 +1018,7 @@ static int rt2500usb_set_device_state(struct rt2x00_dev *rt2x00dev,
|
|||
rt2500usb_disable_radio(rt2x00dev);
|
||||
break;
|
||||
case STATE_RADIO_RX_ON:
|
||||
case STATE_RADIO_RX_ON_LINK:
|
||||
case STATE_RADIO_RX_OFF:
|
||||
case STATE_RADIO_RX_OFF_LINK:
|
||||
rt2500usb_toggle_rx(rt2x00dev, state);
|
||||
break;
|
||||
case STATE_RADIO_IRQ_ON:
|
||||
|
|
|
@ -328,8 +328,7 @@ static void rt2800pci_toggle_rx(struct rt2x00_dev *rt2x00dev,
|
|||
|
||||
rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, ®);
|
||||
rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX,
|
||||
(state == STATE_RADIO_RX_ON) ||
|
||||
(state == STATE_RADIO_RX_ON_LINK));
|
||||
(state == STATE_RADIO_RX_ON));
|
||||
rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
|
||||
}
|
||||
|
||||
|
@ -477,9 +476,7 @@ static int rt2800pci_set_device_state(struct rt2x00_dev *rt2x00dev,
|
|||
rt2800pci_set_state(rt2x00dev, STATE_SLEEP);
|
||||
break;
|
||||
case STATE_RADIO_RX_ON:
|
||||
case STATE_RADIO_RX_ON_LINK:
|
||||
case STATE_RADIO_RX_OFF:
|
||||
case STATE_RADIO_RX_OFF_LINK:
|
||||
rt2800pci_toggle_rx(rt2x00dev, state);
|
||||
break;
|
||||
case STATE_RADIO_IRQ_ON:
|
||||
|
|
|
@ -114,8 +114,7 @@ static void rt2800usb_toggle_rx(struct rt2x00_dev *rt2x00dev,
|
|||
|
||||
rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, ®);
|
||||
rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX,
|
||||
(state == STATE_RADIO_RX_ON) ||
|
||||
(state == STATE_RADIO_RX_ON_LINK));
|
||||
(state == STATE_RADIO_RX_ON));
|
||||
rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
|
||||
}
|
||||
|
||||
|
@ -216,9 +215,7 @@ static int rt2800usb_set_device_state(struct rt2x00_dev *rt2x00dev,
|
|||
rt2800usb_set_state(rt2x00dev, STATE_SLEEP);
|
||||
break;
|
||||
case STATE_RADIO_RX_ON:
|
||||
case STATE_RADIO_RX_ON_LINK:
|
||||
case STATE_RADIO_RX_OFF:
|
||||
case STATE_RADIO_RX_OFF_LINK:
|
||||
rt2800usb_toggle_rx(rt2x00dev, state);
|
||||
break;
|
||||
case STATE_RADIO_IRQ_ON:
|
||||
|
|
|
@ -146,7 +146,8 @@ void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev,
|
|||
* else the changes will be ignored by the device.
|
||||
*/
|
||||
if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
|
||||
rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_OFF_LINK);
|
||||
rt2x00dev->ops->lib->set_device_state(rt2x00dev,
|
||||
STATE_RADIO_RX_OFF);
|
||||
|
||||
/*
|
||||
* Write new antenna setup to device and reset the link tuner.
|
||||
|
@ -160,7 +161,8 @@ void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev,
|
|||
memcpy(active, &config, sizeof(config));
|
||||
|
||||
if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
|
||||
rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON_LINK);
|
||||
rt2x00dev->ops->lib->set_device_state(rt2x00dev,
|
||||
STATE_RADIO_RX_ON);
|
||||
}
|
||||
|
||||
void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
|
||||
|
|
|
@ -68,7 +68,8 @@ int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev)
|
|||
/*
|
||||
* Enable RX.
|
||||
*/
|
||||
rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON);
|
||||
rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_RADIO_RX_ON);
|
||||
rt2x00link_start_tuner(rt2x00dev);
|
||||
|
||||
/*
|
||||
* Start watchdog monitoring.
|
||||
|
@ -102,7 +103,8 @@ void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev)
|
|||
/*
|
||||
* Disable RX.
|
||||
*/
|
||||
rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_OFF);
|
||||
rt2x00link_stop_tuner(rt2x00dev);
|
||||
rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_RADIO_RX_OFF);
|
||||
|
||||
/*
|
||||
* Disable radio.
|
||||
|
@ -113,23 +115,6 @@ void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev)
|
|||
rt2x00leds_led_radio(rt2x00dev, false);
|
||||
}
|
||||
|
||||
void rt2x00lib_toggle_rx(struct rt2x00_dev *rt2x00dev, enum dev_state state)
|
||||
{
|
||||
/*
|
||||
* When we are disabling the RX, we should also stop the link tuner.
|
||||
*/
|
||||
if (state == STATE_RADIO_RX_OFF)
|
||||
rt2x00link_stop_tuner(rt2x00dev);
|
||||
|
||||
rt2x00dev->ops->lib->set_device_state(rt2x00dev, state);
|
||||
|
||||
/*
|
||||
* When we are enabling the RX, we should also start the link tuner.
|
||||
*/
|
||||
if (state == STATE_RADIO_RX_ON)
|
||||
rt2x00link_start_tuner(rt2x00dev);
|
||||
}
|
||||
|
||||
static void rt2x00lib_intf_scheduled_iter(void *data, u8 *mac,
|
||||
struct ieee80211_vif *vif)
|
||||
{
|
||||
|
|
|
@ -69,7 +69,6 @@ static inline int rt2x00_get_rate_mcs(const u16 mcs_value)
|
|||
*/
|
||||
int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev);
|
||||
void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev);
|
||||
void rt2x00lib_toggle_rx(struct rt2x00_dev *rt2x00dev, enum dev_state state);
|
||||
|
||||
/*
|
||||
* Initialization handlers.
|
||||
|
|
|
@ -352,7 +352,7 @@ int rt2x00mac_config(struct ieee80211_hw *hw, u32 changed)
|
|||
* if for any reason the link tuner must be reset, this will be
|
||||
* handled by rt2x00lib_config().
|
||||
*/
|
||||
rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_OFF_LINK);
|
||||
rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_RADIO_RX_OFF);
|
||||
|
||||
/*
|
||||
* When we've just turned on the radio, we want to reprogram
|
||||
|
@ -370,7 +370,7 @@ int rt2x00mac_config(struct ieee80211_hw *hw, u32 changed)
|
|||
rt2x00lib_config_antenna(rt2x00dev, rt2x00dev->default_ant);
|
||||
|
||||
/* Turn RX back on */
|
||||
rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON_LINK);
|
||||
rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_RADIO_RX_ON);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -85,8 +85,6 @@ enum dev_state {
|
|||
STATE_RADIO_OFF,
|
||||
STATE_RADIO_RX_ON,
|
||||
STATE_RADIO_RX_OFF,
|
||||
STATE_RADIO_RX_ON_LINK,
|
||||
STATE_RADIO_RX_OFF_LINK,
|
||||
STATE_RADIO_IRQ_ON,
|
||||
STATE_RADIO_IRQ_OFF,
|
||||
STATE_RADIO_IRQ_ON_ISR,
|
||||
|
|
|
@ -1623,8 +1623,7 @@ static void rt61pci_toggle_rx(struct rt2x00_dev *rt2x00dev,
|
|||
|
||||
rt2x00pci_register_read(rt2x00dev, TXRX_CSR0, ®);
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DISABLE_RX,
|
||||
(state == STATE_RADIO_RX_OFF) ||
|
||||
(state == STATE_RADIO_RX_OFF_LINK));
|
||||
(state == STATE_RADIO_RX_OFF));
|
||||
rt2x00pci_register_write(rt2x00dev, TXRX_CSR0, reg);
|
||||
}
|
||||
|
||||
|
@ -1745,9 +1744,7 @@ static int rt61pci_set_device_state(struct rt2x00_dev *rt2x00dev,
|
|||
rt61pci_disable_radio(rt2x00dev);
|
||||
break;
|
||||
case STATE_RADIO_RX_ON:
|
||||
case STATE_RADIO_RX_ON_LINK:
|
||||
case STATE_RADIO_RX_OFF:
|
||||
case STATE_RADIO_RX_OFF_LINK:
|
||||
rt61pci_toggle_rx(rt2x00dev, state);
|
||||
break;
|
||||
case STATE_RADIO_IRQ_ON:
|
||||
|
|
|
@ -1331,8 +1331,7 @@ static void rt73usb_toggle_rx(struct rt2x00_dev *rt2x00dev,
|
|||
|
||||
rt2x00usb_register_read(rt2x00dev, TXRX_CSR0, ®);
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DISABLE_RX,
|
||||
(state == STATE_RADIO_RX_OFF) ||
|
||||
(state == STATE_RADIO_RX_OFF_LINK));
|
||||
(state == STATE_RADIO_RX_OFF));
|
||||
rt2x00usb_register_write(rt2x00dev, TXRX_CSR0, reg);
|
||||
}
|
||||
|
||||
|
@ -1403,9 +1402,7 @@ static int rt73usb_set_device_state(struct rt2x00_dev *rt2x00dev,
|
|||
rt73usb_disable_radio(rt2x00dev);
|
||||
break;
|
||||
case STATE_RADIO_RX_ON:
|
||||
case STATE_RADIO_RX_ON_LINK:
|
||||
case STATE_RADIO_RX_OFF:
|
||||
case STATE_RADIO_RX_OFF_LINK:
|
||||
rt73usb_toggle_rx(rt2x00dev, state);
|
||||
break;
|
||||
case STATE_RADIO_IRQ_ON:
|
||||
|
|
Загрузка…
Ссылка в новой задаче