From: Andrew Morton <akpm@linux-foundation.org>
To: Ohad Ben-Cohen <ohad@wizery.com>
Cc: linux-kernel@vger.kernel.org, "Jean Delvare (PC drivers,
core)" <khali@linux-fr.org>,
"Ben Dooks (embedded platforms)" <ben-linux@fluff.org>,
Roland Dreier <rolandd@cisco.com>,
Sean Hefty <sean.hefty@intel.com>,
Hal Rosenstock <hal.rosenstock@gmail.com>,
Steve Wise <swise@chelsio.com>, Neil Brown <neilb@suse.de>,
Paul Mackerras <paulus@samba.org>,
linux-i2c@vger.kernel.org, linux-rdma@vger.kernel.org,
dm-devel@redhat.com, linux-raid@vger.kernel.org,
linux-ppp@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: idr_get_new_exact ?
Date: Mon, 20 Sep 2010 12:31:40 -0700 [thread overview]
Message-ID: <20100920123140.f524de79.akpm@linux-foundation.org> (raw)
In-Reply-To: <AANLkTi=ZLupVyFR0e2v-TLpeNWdw1bVMZUAhgyxLJ7OV@mail.gmail.com>
On Mon, 20 Sep 2010 16:11:31 +0200
Ohad Ben-Cohen <ohad@wizery.com> wrote:
> Occasionally, drivers care about the value that idr associates with
> their pointers.
>
> Today we have idr_get_new_above() which allocates a new idr entry
> above or equal to a given starting id, but sometimes drivers need to
> force an exact value.
>
> To overcome this small API gap, drivers are wrapping idr_get_new_above
> and then either BUG_ON() or just call idr_remove() and returns -EBUSY
> when idr allocates them an id which is different than their requested
> value.
>
> There are only a handful of users who need this (see below. especially
> note the i2c comment :), but it might be nice to have such an API (a
> bit less of code, and a bit less error prone).
>
> Would something like the below be desirable/acceptable ?
It seems OK to me - it's an improvement over what we have now.
> (untested. and i just picked the simplest and straight-forward way to
> implement this; obviously it's not optimal since there's no reason to
> even allocate an id if we know it's not the id we're looking for. but
> it's enough to get the idea, it's not a hot path, and it's what
> drivers are doing today)
Sure, we can speed it up later if that appears to be necessary.
next prev parent reply other threads:[~2010-09-20 19:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-20 14:11 Ohad Ben-Cohen
2010-09-20 19:31 ` Andrew Morton [this message]
2010-09-20 20:07 ` Steve Wise
2010-09-20 20:35 ` Roland Dreier
2010-09-20 21:26 ` Tejun Heo
2010-09-20 21:38 ` [dm-devel] " Alasdair G Kergon
2010-09-23 11:42 ` Paul Mundt
2010-09-23 11:46 ` 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=20100920123140.f524de79.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=ben-linux@fluff.org \
--cc=dm-devel@redhat.com \
--cc=hal.rosenstock@gmail.com \
--cc=khali@linux-fr.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-ppp@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=neilb@suse.de \
--cc=netdev@vger.kernel.org \
--cc=ohad@wizery.com \
--cc=paulus@samba.org \
--cc=rolandd@cisco.com \
--cc=sean.hefty@intel.com \
--cc=swise@chelsio.com \
/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
Powered by JetHome