From: chas williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
To: Tejun Heo <tj@kernel.org>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
rusty@rustcorp.com.au, bfields@fieldses.org,
skinsbursky@parallels.com, ebiederm@xmission.com,
jmorris@namei.org, axboe@kernel.dk, netdev@vger.kernel.org
Subject: Re: [PATCH 09/62] atm/nicstar: convert to idr_alloc()
Date: Mon, 4 Feb 2013 09:04:10 -0500 [thread overview]
Message-ID: <20130204090410.2942f8cc@thirdoffive.cmf.nrl.navy.mil> (raw)
In-Reply-To: <1359854463-2538-10-git-send-email-tj@kernel.org>
I don't quite understand your comment. idr_pre_get() returns 0 in the
case of failure.
On Sat, 2 Feb 2013 17:20:10 -0800
Tejun Heo <tj@kernel.org> wrote:
> Convert to the much saner new idr interface. The existing code looks
> buggy to me - ID 0 is treated as no-ID but allocation specifies 0 as
> lower limit and there's no error handling after parial success. This
> conversion keeps the bugs unchanged.
>
> Only compile tested.
>
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Chas Williams <chas@cmf.nrl.navy.mil>
> Cc: netdev@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.
>
> drivers/atm/nicstar.c | 27 ++++++++++++---------------
> 1 file changed, 12 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c
> index 628787e..7fd6834 100644
> --- a/drivers/atm/nicstar.c
> +++ b/drivers/atm/nicstar.c
> @@ -1026,24 +1026,21 @@ static void push_rxbufs(ns_dev * card, struct sk_buff *skb)
> card->lbfqc += 2;
> }
>
> - do {
> - if (!idr_pre_get(&card->idr, GFP_ATOMIC)) {
> - printk(KERN_ERR
> - "nicstar%d: no free memory for idr\n",
> - card->index);
> + if (!id1) {
> + id1 = idr_alloc(&card->idr, handle1, 0, 0, GFP_ATOMIC);
> + if (id1 < 0) {
> + err = id1;
> goto out;
> }
> + }
>
> - if (!id1)
> - err = idr_get_new_above(&card->idr, handle1, 0, &id1);
> -
> - if (!id2 && err == 0)
> - err = idr_get_new_above(&card->idr, handle2, 0, &id2);
> -
> - } while (err == -EAGAIN);
> -
> - if (err)
> - goto out;
> + if (!id2) {
> + id2 = idr_alloc(&card->idr, handle2, 0, 0, GFP_ATOMIC);
> + if (id2 < 0) {
> + err = id2;
> + goto out;
> + }
> + }
>
> spin_lock_irqsave(&card->res_lock, flags);
> while (CMD_BUSY(card)) ;
next prev parent reply other threads:[~2013-02-04 14:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1359854463-2538-1-git-send-email-tj@kernel.org>
2013-02-03 1:20 ` [PATCH 09/62] atm/nicstar: convert to idr_alloc() Tejun Heo
2013-02-04 14:04 ` chas williams - CONTRACTOR [this message]
2013-02-04 17:06 ` Tejun Heo
2013-02-04 18:06 ` chas williams - CONTRACTOR
2013-02-04 18:37 ` [PATCH v3 " Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130204090410.2942f8cc@thirdoffive.cmf.nrl.navy.mil \
--to=chas@cmf.nrl.navy.mil \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=bfields@fieldses.org \
--cc=ebiederm@xmission.com \
--cc=jmorris@namei.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=skinsbursky@parallels.com \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).