Skip to content

Commit e68035f

Browse files
htejuntorvalds
authored andcommitted
workqueue: convert to idr_alloc()
idr_get_new*() and friends are about to be deprecated. Convert to the new idr_alloc() interface. Signed-off-by: Tejun Heo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent ebd6c70 commit e68035f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

kernel/workqueue.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,11 +457,12 @@ static int worker_pool_assign_id(struct worker_pool *pool)
457457
int ret;
458458

459459
mutex_lock(&worker_pool_idr_mutex);
460-
idr_pre_get(&worker_pool_idr, GFP_KERNEL);
461-
ret = idr_get_new(&worker_pool_idr, pool, &pool->id);
460+
ret = idr_alloc(&worker_pool_idr, pool, 0, 0, GFP_KERNEL);
461+
if (ret >= 0)
462+
pool->id = ret;
462463
mutex_unlock(&worker_pool_idr_mutex);
463464

464-
return ret;
465+
return ret < 0 ? ret : 0;
465466
}
466467

467468
/*

0 commit comments

Comments
 (0)