diff options
author | Tejun Heo <tj@kernel.org> | 2013-02-27 20:04:37 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-27 22:10:18 -0500 |
commit | 05e2cefab4acb5ae9b54266935eeec32cc5269ea (patch) | |
tree | cdc76b603dbaea3da58dc7c2967dfd59f67c0fa0 /drivers/power/ds2782_battery.c | |
parent | 2fa532c5d5af8959d1b0ea369324f6d44183dba4 (diff) |
power: convert to idr_alloc()
Convert to the much saner new idr interface.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Anton Vorontsov <cbou@mail.ru>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/power/ds2782_battery.c')
-rw-r--r-- | drivers/power/ds2782_battery.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/power/ds2782_battery.c b/drivers/power/ds2782_battery.c index e7301b3ed623..c09e7726c96c 100644 --- a/drivers/power/ds2782_battery.c +++ b/drivers/power/ds2782_battery.c | |||
@@ -395,17 +395,12 @@ static int ds278x_battery_probe(struct i2c_client *client, | |||
395 | } | 395 | } |
396 | 396 | ||
397 | /* Get an ID for this battery */ | 397 | /* Get an ID for this battery */ |
398 | ret = idr_pre_get(&battery_id, GFP_KERNEL); | ||
399 | if (ret == 0) { | ||
400 | ret = -ENOMEM; | ||
401 | goto fail_id; | ||
402 | } | ||
403 | |||
404 | mutex_lock(&battery_lock); | 398 | mutex_lock(&battery_lock); |
405 | ret = idr_get_new(&battery_id, client, &num); | 399 | ret = idr_alloc(&battery_id, client, 0, 0, GFP_KERNEL); |
406 | mutex_unlock(&battery_lock); | 400 | mutex_unlock(&battery_lock); |
407 | if (ret < 0) | 401 | if (ret < 0) |
408 | goto fail_id; | 402 | goto fail_id; |
403 | num = ret; | ||
409 | 404 | ||
410 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 405 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
411 | if (!info) { | 406 | if (!info) { |