Skip to content

Commit

Permalink
mac80211: convert to idr_alloc()
Browse files Browse the repository at this point in the history
Convert to the much saner new idr interface.

Signed-off-by: Tejun Heo <[email protected]>
Acked-by: Johannes Berg <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
htejun authored and torvalds committed Feb 28, 2013
1 parent 19a101a commit 9475af6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
2 changes: 0 additions & 2 deletions net/mac80211/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -647,8 +647,6 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,

spin_lock_init(&local->ack_status_lock);
idr_init(&local->ack_status_frames);
/* preallocate at least one entry */
idr_pre_get(&local->ack_status_frames, GFP_KERNEL);

sta_info_init(local);

Expand Down
18 changes: 4 additions & 14 deletions net/mac80211/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2017,24 +2017,14 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
skb = skb_clone(skb, GFP_ATOMIC);
if (skb) {
unsigned long flags;
int id, r;
int id;

spin_lock_irqsave(&local->ack_status_lock, flags);
r = idr_get_new_above(&local->ack_status_frames,
orig_skb, 1, &id);
if (r == -EAGAIN) {
idr_pre_get(&local->ack_status_frames,
GFP_ATOMIC);
r = idr_get_new_above(&local->ack_status_frames,
orig_skb, 1, &id);
}
if (WARN_ON(!id) || id > 0xffff) {
idr_remove(&local->ack_status_frames, id);
r = -ERANGE;
}
id = idr_alloc(&local->ack_status_frames, orig_skb,
1, 0x10000, GFP_ATOMIC);
spin_unlock_irqrestore(&local->ack_status_lock, flags);

if (!r) {
if (id >= 0) {
info_id = id;
info_flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
} else if (skb_shared(skb)) {
Expand Down

0 comments on commit 9475af6

Please sign in to comment.