From patchwork Sun Feb 3 01:21:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 2085431 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 78C1BDFB79 for ; Sun, 3 Feb 2013 01:25:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754344Ab3BCBYO (ORCPT ); Sat, 2 Feb 2013 20:24:14 -0500 Received: from mail-pb0-f41.google.com ([209.85.160.41]:50243 "EHLO mail-pb0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754147Ab3BCBXM (ORCPT ); Sat, 2 Feb 2013 20:23:12 -0500 Received: by mail-pb0-f41.google.com with SMTP id ro12so2684078pbb.28 for ; Sat, 02 Feb 2013 17:23:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=dkmmXnKgu/0azlGIzrDv1/Wo1ddxhvnzJmKBF63WMw4=; b=f1D0lXwN6vNEfzSx8caH6FGH3ksiRcaz0v8mjaIObgM9w40A/SBxtbqJe8AEokIMxN q2Vv/nnzs1QNpLJRkI1bjyp62htKKLl9ppxkOaNR5mBb050+vuuKy4Nlah6VGqUtyAEI CuM7jg7UhE5x2CFT9u3YhjibICLQo1O/Ui+EVVzziPA7qW4PECtPB459JDr5uOBjgYDx VQJkJ0ZfI5AqQd7J+GORdzD16QnomIFKRnz9AEmL+K0irfsH3MwendPqQT5Jvr2ZLm4P yTsuJ2w7c412NKpjD+X2VWb6wKGnznR14RzL5t+t+v21jz8NzNyH+n4J9V31JPuBJkRw 2RTg== X-Received: by 10.68.232.169 with SMTP id tp9mr44194323pbc.1.1359854592248; Sat, 02 Feb 2013 17:23:12 -0800 (PST) Received: from htj.dyndns.org (c-69-181-251-227.hsd1.ca.comcast.net. [69.181.251.227]) by mx.google.com with ESMTPS id hs2sm13149467pbc.22.2013.02.02.17.23.10 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 02 Feb 2013 17:23:11 -0800 (PST) From: Tejun Heo To: akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, rusty@rustcorp.com.au, bfields@fieldses.org, skinsbursky@parallels.com, ebiederm@xmission.com, jmorris@namei.org, axboe@kernel.dk, Tejun Heo , Johannes Berg , linux-wireless@vger.kernel.org Subject: [PATCH 59/62] mac80211: convert to idr_alloc() Date: Sat, 2 Feb 2013 17:21:00 -0800 Message-Id: <1359854463-2538-60-git-send-email-tj@kernel.org> X-Mailer: git-send-email 1.8.1 In-Reply-To: <1359854463-2538-1-git-send-email-tj@kernel.org> References: <1359854463-2538-1-git-send-email-tj@kernel.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Convert to the much saner new idr interface. Only compile tested. Signed-off-by: Tejun Heo Cc: Johannes Berg 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)) {