From patchwork Wed Feb 6 19:40:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 2106871 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 20DAF3FDF1 for ; Wed, 6 Feb 2013 19:51:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758325Ab3BFTvb (ORCPT ); Wed, 6 Feb 2013 14:51:31 -0500 Received: from mail-oa0-f51.google.com ([209.85.219.51]:44625 "EHLO mail-oa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758309Ab3BFTv0 (ORCPT ); Wed, 6 Feb 2013 14:51:26 -0500 Received: by mail-oa0-f51.google.com with SMTP id h2so1958289oag.10 for ; Wed, 06 Feb 2013 11:51:25 -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=poLfITuqYYpQq6pIhQaoMPgado/SF4Sp78pwyJ3+npQ=; b=y4Xra8g1bncJM/8dBRteQrpeRxjBCgB5wC7thMM7hy9iOuzTTsA14vLoYx5DP4VeJ2 aHa9+jmYkrnKjWvBEbGsFHZU/n5ZpboYVZDXZdY/EWr/4JthTIoFzhFaFy21SG9suEzM PdpiPexwyJkt50tbrSdGn+XV/YEYQDyqCMv3SQaZhhqLKzA+sPooWXmZzp7E66Y6w87d 82HJGFHL5eCqFoZtDlf4BDzsZlYYuvsfmk+0fWwCKJXnJTyE7uVeoRkw+H5xsVyjD+o2 H15jAerAof7Kbpdy06ryws08Z51orleemIVpCFWmzmqoGqNKVwbCIe0ijFdm4rQ1+Hag mVwg== X-Received: by 10.182.98.109 with SMTP id eh13mr22609356obb.50.1360180285547; Wed, 06 Feb 2013 11:51:25 -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 l5sm39989590pax.10.2013.02.06.11.51.24 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 06 Feb 2013 11:51:24 -0800 (PST) From: Tejun Heo To: akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, Tejun Heo , linux-wireless@vger.kernel.org Subject: [PATCH 75/77] mac80211: convert to idr_alloc() Date: Wed, 6 Feb 2013 11:40:47 -0800 Message-Id: <1360179649-22465-76-git-send-email-tj@kernel.org> X-Mailer: git-send-email 1.8.1 In-Reply-To: <1360179649-22465-1-git-send-email-tj@kernel.org> References: <1360179649-22465-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 Acked-by: Johannes Berg Cc: linux-wireless@vger.kernel.org --- 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 2bdd454..632f2a7 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c @@ -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); diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index a2cb6a3..5a62468 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -1999,24 +1999,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)) {