Commit 57f2667c authored by Tejun Heo's avatar Tejun Heo Committed by Linus Torvalds
Browse files

misc/tifm_core: convert to idr_alloc()



Convert to the much saner new idr interface.

Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Alex Dubov <oakad@yahoo.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 3ab4ee8f
Loading
Loading
Loading
Loading
+6 −5
Original line number Original line Diff line number Diff line
@@ -196,13 +196,14 @@ int tifm_add_adapter(struct tifm_adapter *fm)
{
{
	int rc;
	int rc;


	if (!idr_pre_get(&tifm_adapter_idr, GFP_KERNEL))
	idr_preload(GFP_KERNEL);
		return -ENOMEM;

	spin_lock(&tifm_adapter_lock);
	spin_lock(&tifm_adapter_lock);
	rc = idr_get_new(&tifm_adapter_idr, fm, &fm->id);
	rc = idr_alloc(&tifm_adapter_idr, fm, 0, 0, GFP_NOWAIT);
	if (rc >= 0)
		fm->id = rc;
	spin_unlock(&tifm_adapter_lock);
	spin_unlock(&tifm_adapter_lock);
	if (rc)
	idr_preload_end();
	if (rc < 0)
		return rc;
		return rc;


	dev_set_name(&fm->dev, "tifm%u", fm->id);
	dev_set_name(&fm->dev, "tifm%u", fm->id);