summaryrefslogtreecommitdiffstats
path: root/drivers/dca/dca-sysfs.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-02-27 17:04:02 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-27 19:10:15 -0800
commit615f2e5c531bc57d5a190f321d697988e950ae4d (patch)
tree2073523a21a56ae4d6276e6e9e1526f4a056c996 /drivers/dca/dca-sysfs.c
parent56de210245487ef1f1416c8ec9e581ebdd0d32ec (diff)
downloadblackbird-op-linux-615f2e5c531bc57d5a190f321d697988e950ae4d.tar.gz
blackbird-op-linux-615f2e5c531bc57d5a190f321d697988e950ae4d.zip
dca: convert to idr_alloc()
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Paul Gortmaker <paul.gortmaker@windriver.com> Cc: Maciej Sosnowski <maciej.sosnowski@intel.com> Cc: Shannon Nelson <shannon.nelson@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/dca/dca-sysfs.c')
-rw-r--r--drivers/dca/dca-sysfs.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/dca/dca-sysfs.c b/drivers/dca/dca-sysfs.c
index 591b6597c00a..126cf295b198 100644
--- a/drivers/dca/dca-sysfs.c
+++ b/drivers/dca/dca-sysfs.c
@@ -53,22 +53,19 @@ void dca_sysfs_remove_req(struct dca_provider *dca, int slot)
int dca_sysfs_add_provider(struct dca_provider *dca, struct device *dev)
{
struct device *cd;
- int err = 0;
+ int ret;
-idr_try_again:
- if (!idr_pre_get(&dca_idr, GFP_KERNEL))
- return -ENOMEM;
+ idr_preload(GFP_KERNEL);
spin_lock(&dca_idr_lock);
- err = idr_get_new(&dca_idr, dca, &dca->id);
+
+ ret = idr_alloc(&dca_idr, dca, 0, 0, GFP_NOWAIT);
+ if (ret >= 0)
+ dca->id = ret;
+
spin_unlock(&dca_idr_lock);
- switch (err) {
- case 0:
- break;
- case -EAGAIN:
- goto idr_try_again;
- default:
- return err;
- }
+ idr_preload_end();
+ if (ret < 0)
+ return ret;
cd = device_create(dca_class, dev, MKDEV(0, 0), NULL, "dca%d", dca->id);
if (IS_ERR(cd)) {
OpenPOWER on IntegriCloud