Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH 59/62] mac80211: convert to idr_alloc()
       [not found] <1359854463-2538-1-git-send-email-tj@kernel.org>
@ 2013-02-03  1:21 ` Tejun Heo
  2013-02-04 17:40   ` Johannes Berg
  0 siblings, 1 reply; 3+ messages in thread
From: Tejun Heo @ 2013-02-03  1:21 UTC (permalink / raw)
  To: akpm
  Cc: linux-kernel, rusty, bfields, skinsbursky, ebiederm, jmorris,
	axboe, Tejun Heo, Johannes Berg, linux-wireless

Convert to the much saner new idr interface.

Only compile tested.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org
---
This patch depends on an earlier idr changes and I think it would be
best to route these together through -mm.  Please holler if there's
any objection.  Thanks.

 net/mac80211/main.c |  2 --
 net/mac80211/tx.c   | 18 ++++--------------
 2 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 1b087ff..7b5bbea 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -687,8 +687,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);
 
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index e9eadc4..73eb6c1 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1996,24 +1996,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)) {
-- 
1.8.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 59/62] mac80211: convert to idr_alloc()
  2013-02-03  1:21 ` [PATCH 59/62] mac80211: convert to idr_alloc() Tejun Heo
@ 2013-02-04 17:40   ` Johannes Berg
  2013-02-04 17:42     ` Tejun Heo
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2013-02-04 17:40 UTC (permalink / raw)
  To: Tejun Heo
  Cc: akpm, linux-kernel, rusty, bfields, skinsbursky, ebiederm,
	jmorris, axboe, linux-wireless

On Sat, 2013-02-02 at 17:21 -0800, Tejun Heo wrote:
> Convert to the much saner new idr interface.
> 
> Only compile tested.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Johannes Berg <johannes@sipsolutions.net>
> Cc: linux-wireless@vger.kernel.org
> ---
> This patch depends on an earlier idr changes and I think it would be
> best to route these together through -mm.  Please holler if there's
> any objection.  Thanks.

Looks fine to me, thanks.

johannes



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 59/62] mac80211: convert to idr_alloc()
  2013-02-04 17:40   ` Johannes Berg
@ 2013-02-04 17:42     ` Tejun Heo
  0 siblings, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2013-02-04 17:42 UTC (permalink / raw)
  To: Johannes Berg
  Cc: akpm, linux-kernel, rusty, bfields, skinsbursky, ebiederm,
	jmorris, axboe, linux-wireless

On Mon, Feb 04, 2013 at 06:40:24PM +0100, Johannes Berg wrote:
> On Sat, 2013-02-02 at 17:21 -0800, Tejun Heo wrote:
> > Convert to the much saner new idr interface.
> > 
> > Only compile tested.
> > 
> > Signed-off-by: Tejun Heo <tj@kernel.org>
> > Cc: Johannes Berg <johannes@sipsolutions.net>
> > Cc: linux-wireless@vger.kernel.org
> > ---
> > This patch depends on an earlier idr changes and I think it would be
> > best to route these together through -mm.  Please holler if there's
> > any objection.  Thanks.
> 
> Looks fine to me, thanks.

Will add Acked-by.  Thanks a lot!

-- 
tejun

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-02-04 17:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1359854463-2538-1-git-send-email-tj@kernel.org>
2013-02-03  1:21 ` [PATCH 59/62] mac80211: convert to idr_alloc() Tejun Heo
2013-02-04 17:40   ` Johannes Berg
2013-02-04 17:42     ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox