Skip to content

Commit

Permalink
rt2x00: restore original beaconing state
Browse files Browse the repository at this point in the history
After changing local per interface beacon setting restore original
global beaconing state.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Stanislaw Gruszka authored and John W. Linville committed Apr 22, 2014
1 parent 44ad466 commit bc0df75
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
15 changes: 7 additions & 8 deletions drivers/net/wireless/rt2x00/rt2800lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1005,10 +1005,9 @@ void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc)
entry->skb->len + padding_len);

/*
* Enable beaconing again.
* Restore beaconing state.
*/
rt2x00_set_field32(&reg, BCN_TIME_CFG_BEACON_GEN, 1);
rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg);
rt2800_register_write(rt2x00dev, BCN_TIME_CFG, orig_reg);

/*
* Clean up beacon skb.
Expand Down Expand Up @@ -1039,13 +1038,14 @@ static inline void rt2800_clear_beacon_register(struct rt2x00_dev *rt2x00dev,
void rt2800_clear_beacon(struct queue_entry *entry)
{
struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
u32 reg;
u32 orig_reg, reg;

/*
* Disable beaconing while we are reloading the beacon data,
* otherwise we might be sending out invalid data.
*/
rt2800_register_read(rt2x00dev, BCN_TIME_CFG, &reg);
rt2800_register_read(rt2x00dev, BCN_TIME_CFG, &orig_reg);
reg = orig_reg;
rt2x00_set_field32(&reg, BCN_TIME_CFG_BEACON_GEN, 0);
rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg);

Expand All @@ -1055,10 +1055,9 @@ void rt2800_clear_beacon(struct queue_entry *entry)
rt2800_clear_beacon_register(rt2x00dev, entry->entry_idx);

/*
* Enabled beaconing again.
* Restore beaconing state.
*/
rt2x00_set_field32(&reg, BCN_TIME_CFG_BEACON_GEN, 1);
rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg);
rt2800_register_write(rt2x00dev, BCN_TIME_CFG, orig_reg);
}
EXPORT_SYMBOL_GPL(rt2800_clear_beacon);

Expand Down
10 changes: 5 additions & 5 deletions drivers/net/wireless/rt2x00/rt61pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -2031,13 +2031,14 @@ static void rt61pci_write_beacon(struct queue_entry *entry,
static void rt61pci_clear_beacon(struct queue_entry *entry)
{
struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
u32 reg;
u32 orig_reg, reg;

/*
* Disable beaconing while we are reloading the beacon data,
* otherwise we might be sending out invalid data.
*/
rt2x00mmio_register_read(rt2x00dev, TXRX_CSR9, &reg);
rt2x00mmio_register_read(rt2x00dev, TXRX_CSR9, &orig_reg);
reg = orig_reg;
rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_GEN, 0);
rt2x00mmio_register_write(rt2x00dev, TXRX_CSR9, reg);

Expand All @@ -2048,10 +2049,9 @@ static void rt61pci_clear_beacon(struct queue_entry *entry)
HW_BEACON_OFFSET(entry->entry_idx), 0);

/*
* Enable beaconing again.
* Restore global beaconing state.
*/
rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_GEN, 1);
rt2x00mmio_register_write(rt2x00dev, TXRX_CSR9, reg);
rt2x00mmio_register_write(rt2x00dev, TXRX_CSR9, orig_reg);
}

/*
Expand Down
10 changes: 5 additions & 5 deletions drivers/net/wireless/rt2x00/rt73usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1597,13 +1597,14 @@ static void rt73usb_clear_beacon(struct queue_entry *entry)
{
struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
unsigned int beacon_base;
u32 reg;
u32 orig_reg, reg;

/*
* Disable beaconing while we are reloading the beacon data,
* otherwise we might be sending out invalid data.
*/
rt2x00usb_register_read(rt2x00dev, TXRX_CSR9, &reg);
rt2x00usb_register_read(rt2x00dev, TXRX_CSR9, &orig_reg);
reg = orig_reg;
rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_GEN, 0);
rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg);

Expand All @@ -1614,10 +1615,9 @@ static void rt73usb_clear_beacon(struct queue_entry *entry)
rt2x00usb_register_write(rt2x00dev, beacon_base, 0);

/*
* Enable beaconing again.
* Restore beaconing state.
*/
rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_GEN, 1);
rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg);
rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, orig_reg);
}

static int rt73usb_get_tx_data_len(struct queue_entry *entry)
Expand Down

0 comments on commit bc0df75

Please sign in to comment.