Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1226355
| From | Lee Duncan <lduncan@suse.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 12/17] Update the TI Flash Media driver to use idr helper functions. |
| Date | 2015-09-16 20:00 +0200 |
| Message-ID | <q9p9X-3ca-115@gated-at.bofh.it> (permalink) |
| References | <q9p9T-3ca-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Signed-off-by: Lee Duncan <lduncan@suse.com>
---
drivers/misc/tifm_core.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/drivers/misc/tifm_core.c b/drivers/misc/tifm_core.c
index a511b2a713b3..46385f828a8f 100644
--- a/drivers/misc/tifm_core.c
+++ b/drivers/misc/tifm_core.c
@@ -198,22 +198,15 @@ int tifm_add_adapter(struct tifm_adapter *fm)
{
int rc;
- idr_preload(GFP_KERNEL);
- spin_lock(&tifm_adapter_lock);
- rc = idr_alloc(&tifm_adapter_idr, fm, 0, 0, GFP_NOWAIT);
- if (rc >= 0)
- fm->id = rc;
- spin_unlock(&tifm_adapter_lock);
- idr_preload_end();
+ rc = idr_get_index(&tifm_adapter_idr, &tifm_adapter_lock, fm);
if (rc < 0)
return rc;
+ fm->id = rc;
dev_set_name(&fm->dev, "tifm%u", fm->id);
rc = device_add(&fm->dev);
if (rc) {
- spin_lock(&tifm_adapter_lock);
- idr_remove(&tifm_adapter_idr, fm->id);
- spin_unlock(&tifm_adapter_lock);
+ idr_put_index(&tifm_adapter_idr, &tifm_adapter_lock, fm->id);
}
return rc;
@@ -230,9 +223,7 @@ void tifm_remove_adapter(struct tifm_adapter *fm)
device_unregister(&fm->sockets[cnt]->dev);
}
- spin_lock(&tifm_adapter_lock);
- idr_remove(&tifm_adapter_idr, fm->id);
- spin_unlock(&tifm_adapter_lock);
+ idr_put_index(&tifm_adapter_idr, &tifm_adapter_lock, fm->id);
device_del(&fm->dev);
}
EXPORT_SYMBOL(tifm_remove_adapter);
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/17] Create and use ida and idr helper routines [RESEND] Lee Duncan <lduncan@suse.com> - 2015-09-16 20:00 +0200 [PATCH 17/17] Update the ARM soc base driver to use ida helper functions. Lee Duncan <lduncan@suse.com> - 2015-09-16 20:00 +0200 [PATCH 10/17] Update the DCA DMA driver to use idr helper functions. Lee Duncan <lduncan@suse.com> - 2015-09-16 20:00 +0200 [PATCH 12/17] Update the TI Flash Media driver to use idr helper functions. Lee Duncan <lduncan@suse.com> - 2015-09-16 20:00 +0200 [PATCH 13/17] Update the SCSI disk driver to use ida helper functions. Lee Duncan <lduncan@suse.com> - 2015-09-16 20:00 +0200
csiph-web