Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 237035
b: refs/heads/master
c: 5127229
h: refs/heads/master
i:
  237033: f57d886
  237031: 6bf8a7b
v: v3
  • Loading branch information
Jussi Kivilinna authored and John W. Linville committed Feb 4, 2011
1 parent 9894b3c commit 209e9d8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9be232563666b7d1bd424780aef7ee2aa261ba04
refs/heads/master: 51272292926bc4fff61ba812d5816922b980655b
40 changes: 25 additions & 15 deletions trunk/drivers/net/wireless/zd1211rw/zd_mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -602,11 +602,18 @@ static void cs_set_control(struct zd_mac *mac, struct zd_ctrlset *cs,
static int zd_mac_config_beacon(struct ieee80211_hw *hw, struct sk_buff *beacon)
{
struct zd_mac *mac = zd_hw_mac(hw);
int r, ret;
int r, ret, num_cmds, req_pos = 0;
u32 tmp, j = 0;
/* 4 more bytes for tail CRC */
u32 full_len = beacon->len + 4;
unsigned long end_jiffies, message_jiffies;
struct zd_ioreq32 *ioreqs;

/* Alloc memory for full beacon write at once. */
num_cmds = 1 + zd_chip_is_zd1211b(&mac->chip) + full_len;
ioreqs = kmalloc(num_cmds * sizeof(struct zd_ioreq32), GFP_KERNEL);
if (!ioreqs)
return -ENOMEM;

mutex_lock(&mac->chip.mutex);

Expand Down Expand Up @@ -637,29 +644,31 @@ static int zd_mac_config_beacon(struct ieee80211_hw *hw, struct sk_buff *beacon)
msleep(20);
}

r = zd_iowrite32_locked(&mac->chip, full_len - 1, CR_BCN_FIFO);
if (r < 0)
goto release_sema;
ioreqs[req_pos].addr = CR_BCN_FIFO;
ioreqs[req_pos].value = full_len - 1;
req_pos++;
if (zd_chip_is_zd1211b(&mac->chip)) {
r = zd_iowrite32_locked(&mac->chip, full_len - 1,
CR_BCN_LENGTH);
if (r < 0)
goto release_sema;
ioreqs[req_pos].addr = CR_BCN_LENGTH;
ioreqs[req_pos].value = full_len - 1;
req_pos++;
}

for (j = 0 ; j < beacon->len; j++) {
r = zd_iowrite32_locked(&mac->chip, *((u8 *)(beacon->data + j)),
CR_BCN_FIFO);
if (r < 0)
goto release_sema;
ioreqs[req_pos].addr = CR_BCN_FIFO;
ioreqs[req_pos].value = *((u8 *)(beacon->data + j));
req_pos++;
}

for (j = 0; j < 4; j++) {
r = zd_iowrite32_locked(&mac->chip, 0x0, CR_BCN_FIFO);
if (r < 0)
goto release_sema;
ioreqs[req_pos].addr = CR_BCN_FIFO;
ioreqs[req_pos].value = 0x0;
req_pos++;
}

BUG_ON(req_pos != num_cmds);

r = zd_iowrite32a_locked(&mac->chip, ioreqs, num_cmds);

release_sema:
/*
* Try very hard to release device beacon semaphore, as otherwise
Expand Down Expand Up @@ -694,6 +703,7 @@ static int zd_mac_config_beacon(struct ieee80211_hw *hw, struct sk_buff *beacon)
CR_BCN_PLCP_CFG);
out:
mutex_unlock(&mac->chip.mutex);
kfree(ioreqs);
return r;
}

Expand Down

0 comments on commit 209e9d8

Please sign in to comment.