Skip to contentSkip to conversation

Create and use ida and idr helper routines

PATCH In review Lee Duncan 5 participants 27 messages Sep 15, 2015 – Sep 18, 2015

Subsystems (15)
DRM drivers SCSI DRM misc Block layer +11 more subsystems
lore
Share & tools
lore

Lee Duncan

author
#0 lore raw

cover Create and use ida and idr helper routines

The idr index management library supplies two sets of routines for managing monotonically increasing index numbers. The "ida" set of routines manage allocating and freeing simple index numbers. The "idr" set of routines add the ability to save an arbitrary pointer with each index.

Both sets of routines are used throughout the kernel, and it was noted that many of them use the same or similar calling sequences, making a helper function a useful addition.

This set of patches adds some helper functions, defined as inline in <linux/idr.h>. In addition, any of the clients of these idr library functions that could benefit from using these helper functions where modified to use them.

In addition to cleaning up the code in the clients of these functions, the SCSI hosts module, which used to use a simple atomic integer for index management is converted to using the idr set of routines to manage its index values as well as to simplify and speed up host number to instance lookups.

I have functionally tested the SCSI host indexing change, and I have compile tested all of the other changes. The maintainers of each driver are cc-ed on the patch series, where available.

Note: I did not mark this patch series as "v2" since the scope of the patch set has grown considerably since my first submissions.

Summary: There is one patch that adds helper functions, 11 patches that use the new "idr" helper functions, and 5 that use the new "ida" helper functions.

Lee Duncan (17):
1. Add ida and idr helper routines.
2. Update scsi hosts to use idr for host number mgmt
3. Update the st driver to use idr helper functions.
4. Update the ch driver to use idr helper functions.
5. Update the md driver to use idr helper functions.
6. Update the infiniband uverbs driver to use idr helper functions.
7. Update the memstick driver to use idr helper functions.
8. Update the mmc driver to use idr helper functions.
9. Update the virtgpu driver to use idr helper functions.
10. Update the DCA DMA driver to use idr helper functions.
11. Update the rtsx multifunction driver to use idr helper functions.
12. Update the TI Flash Media driver to use idr helper functions.
13. Update the SCSI disk driver to use ida helper functions.
14. Update the rsxx flash adapter driver to use ida helper functions.
15. Update the NVMe SSD driver to use ida helper functions.
16. Update the Micron PCIe SSD driver to use ida helper functions.
17. Update the ARM soc base driver to use ida helper functions.

 drivers/base/soc.c                   |  17 ++----
 drivers/block/mtip32xx/mtip32xx.c    |  22 ++------
 drivers/block/nvme-core.c            |  14 +----
 drivers/block/rsxx/core.c            |  16 +-----
 drivers/dca/dca-sysfs.c              |  19 ++-----
 drivers/gpu/drm/virtio/virtgpu_vq.c  |  15 ++----
 drivers/infiniband/core/uverbs_cmd.c |  12 +----
 drivers/md/dm.c                      |  22 ++------
 drivers/memstick/core/memstick.c     |  19 ++-----
 drivers/mfd/rtsx_pcr.c               |  13 ++---
 drivers/misc/tifm_core.c             |  17 ++----
 drivers/mmc/core/host.c              |  14 ++---
 drivers/scsi/ch.c                    |  14 ++---
 drivers/scsi/hosts.c                 |  59 ++++++++++----------
 drivers/scsi/sd.c                    |  20 ++-----
 drivers/scsi/st.c                    |  15 ++----
 include/linux/idr.h                  | 102 +++++++++++++++++++++++++++++++++++
 17 files changed, 182 insertions(+), 228 deletions(-)
Signature · 1 line
2.1.4
author
#1 lore raw

PATCH 1/17 Add ida and idr helper routines.

Clients of the ida and idr index-management routines tend to use the same calling sequences much of the time, so this change adds helper functions for allocating and releasing indexes of either flavor, i.e. with or without pointer management.

Inline functions added for idr:
idr_get_index_in_range
idr_get_index (in range 0,0)
idr_put_index
And for ida:
ida_get_index
ida_put_index

---
 include/linux/idr.h | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 102 insertions(+)
include/linux/idr.h +102 -0
index 013fd9bc4cb6..341c4f2d9874 100644
@@ -16,6 +16,8 @@
 #include <linux/bitops.h>
 #include <linux/init.h>
 #include <linux/rcupdate.h>
+#include <linux/spinlock.h>
+#include <linux/gfp.h>
 
 /*
  * We want shallower trees and thus more bits covered at each layer.  8
@@ -183,4 +185,104 @@ static inline int ida_get_new(struct ida *ida, int *p_id)
 
 void __init idr_init_cache(void);
 
+/**
+ * ida_get_index - allocate a ida index value
+ * @ida		idr handle
+ * @lock	spinlock handle protecting this index
+ * @p_id	pointer to allocated index value
+ *
+ * A helper function for safely allocating an index value (id),
+ * returning a negative errno value on failure, else 0.
+ */
+static inline int ida_get_index(struct ida *ida, spinlock_t *lock, int *p_id)
+{
+	int error = -ENOMEM;
+
+	do {
+		if (!ida_pre_get(ida, GFP_KERNEL))
+			break;
+		spin_lock(lock);
+		error = ida_get_new(ida, p_id);
+		spin_unlock(lock);
+	} while (error == -EAGAIN);
+
+	return error;
+}
+
+/**
+ * ida_put_index - free an allocated ida index value
+ * @ida		idr handle
+ * @lock	spinlock handle protecting this index
+ * @id		the value of the allocated index
+ *
+ * A helper function that goes with @ida_get_index, which safely
+ * frees a previously-allocated index value.
+ */
+static inline void ida_put_index(struct ida *ida, spinlock_t *lock, int id)
+{
+	spin_lock(lock);
+	ida_remove(ida, id);
+	spin_unlock(lock);
+}
+
+/**
+ * idr_get_index_in_range - allocate a new index, with locking
+ *		            within a range
+ * @idr:	idr handle
+ * @lock:	spin lock handle protecting the index
+ * @ptr:	pointer to associate with allocated index
+ * @start:	starting index (see idr_alloc)
+ * @end:	ending index (0 -> use default max)
+ *
+ * This is a helper routine meant to make the common
+ * calling sequence to allocate an idr index easier.
+ * It uses a spin lock, and allocates a positive index
+ * in the range of [start,end), returning a negative
+ * errno on failure, else 0.
+ */
+static inline int idr_get_index_in_range(struct idr *idr, spinlock_t *lock,
+					 void *ptr, int start, int end)
+{
+	int ret;
+
+	idr_preload(GFP_KERNEL);
+	spin_lock(lock);
+	ret = idr_alloc(idr, ptr, start, end, GFP_NOWAIT);
+	spin_unlock(lock);
+	idr_preload_end();
+
+	return ret;
+}
+
+/**
+ * idr_get_index - allocate new index, with locking, using the
+ *		   default range (zero to max-1)
+ * @idr:	idr handle
+ * @lock:	spin lock handle protecting the index
+ * @ptr:	pointer to associate with allocated index
+ *
+ * Simple wrapper around idr_get_index_in_range() w/ @start and
+ * @end of 0, since this is a common case
+ */
+static inline int idr_get_index(struct idr *idr, spinlock_t *lock, void *ptr)
+{
+	return idr_get_index_in_range(idr, lock, ptr, 0, 0);
+}
+
+/**
+ * idr_put_index - free an allocated idr index value
+ * @idr		idr handle
+ * @lock	spinlock handle protecting this index
+ * @id		the value of the allocated index
+ *
+ * A helper function that goes with @idr_get_index, which safely
+ * frees a previously-allocated index value.
+ */
+static inline void idr_put_index(struct idr *idr, spinlock_t *lock, int id)
+{
+	spin_lock(lock);
+	idr_remove(idr, id);
+	spin_unlock(lock);
+}
+
 #endif /* __IDR_H__ */
Signature · 1 line
2.1.4
maintainer
#2 lore raw

Re: [PATCH 01/17] Add ida and idr helper routines.

Quoted 6 lines · Lee Duncan

Clients of the ida and idr index-management routines tend to use the same calling sequences much of the time, so this change adds helper functions for allocating and releasing indexes of either flavor, i.e. with or without pointer management.

Quoted 7 lines

Inline functions added for idr:
idr_get_index_in_range
idr_get_index (in range 0,0)
idr_put_index
And for ida:
ida_get_index
ida_put_index

Every consumer of this I've seen seems to have the pattern of allocating the ida and the protecting spinlock together. If that's the case, why not move the spinlock into struct ida so it doesn't have to be separately allocated and passed in to all the helpers?

Also, you need a cc of Tejun (added on this one) because he's the one who last did significant work in ida/idr.

James

#3 lore raw

Re: [PATCH 01/17] Add ida and idr helper routines.

In reply to Lee Duncan

Hello,

Quoted 13 lines · Lee Duncan
include/linux/idr.h +13 -0
+/**
+ * ida_get_index - allocate a ida index value
+ * @ida		idr handle
+ * @lock	spinlock handle protecting this index
+ * @p_id	pointer to allocated index value
+ *
+ * A helper function for safely allocating an index value (id),
+ * returning a negative errno value on failure, else 0.
+ */
+static inline int ida_get_index(struct ida *ida, spinlock_t *lock, int *p_id)
+{
+	int error = -ENOMEM;
+

include/linux/idr.h static inline int ida_get_new(struct ida *ida, int *p_id) · line 210

Quoted 10 lines
include/linux/idr.h +10 -0
+	do {
+		if (!ida_pre_get(ida, GFP_KERNEL))
+			break;
+		spin_lock(lock);
+		error = ida_get_new(ida, p_id);
+		spin_unlock(lock);
+	} while (error == -EAGAIN);
+
+	return error;
+}

Obviously ida allocation doesn't need to be synchronized against anything else. Why not just use ida_simple_get/remove()?

Thanks.

Signature · 1 line
tejun
maintainer
#4 lore raw

Re: [PATCH 01/17] Add ida and idr helper routines.

Quoted 21 lines · Tejun Heo

Hello,

Quoted 18 lines · Lee Duncan
include/linux/idr.h +18 -0
+/**
+ * ida_get_index - allocate a ida index value
+ * @ida		idr handle
+ * @lock	spinlock handle protecting this index
+ * @p_id	pointer to allocated index value
+ *
+ * A helper function for safely allocating an index value (id),
+ * returning a negative errno value on failure, else 0.
+ */
+static inline int ida_get_index(struct ida *ida, spinlock_t *lock, int *p_id)
+{
+	int error = -ENOMEM;
+
+	do {
+		if (!ida_pre_get(ida, GFP_KERNEL))
+			break;
+		spin_lock(lock);
+		error = ida_get_new(ida, p_id);
Quoted 8 lines

include/linux/idr.h static inline int ida_get_new(struct ida *ida, int *p_id) · line 210

Quoted 5 lines
include/linux/idr.h +5 -0
+		spin_unlock(lock);
+	} while (error == -EAGAIN);
+
+	return error;
+}

Obviously ida allocation doesn't need to be synchronized against anything else. Why not just use ida_simple_get/remove()?

For most of the SCSI stuff, yes. I'm less sure about the sd numbers. They go up very high and get hammered a lot during system bring up and hot plug. I think having their own lock rather than wrapping everything around simple_ida_lock makes more sense here just because the system is heavily contended on getting indexes at bring up.

To continue the thought, why not move simple_ida_lock into struct ida so we don't have to worry about the contention and can sue ida_simple_... everywhere?

James

#5 lore raw

Re: [PATCH 01/17] Add ida and idr helper routines.

Hello,

Quoted 9 lines · James Bottomley

For most of the SCSI stuff, yes. I'm less sure about the sd numbers. They go up very high and get hammered a lot during system bring up and hot plug. I think having their own lock rather than wrapping everything around simple_ida_lock makes more sense here just because the system is heavily contended on getting indexes at bring up.

To continue the thought, why not move simple_ida_lock into struct ida so we don't have to worry about the contention and can sue ida_simple_... everywhere?

We sure can do that if necessary but I'm rather doubtful that even with sd number hammering this is likely to be a problem. Let's convert the users to the simple interface and make the lock per-ida if we actually see contention on the lock.

Thanks.

Signature · 1 line
tejun
author
#6 lore raw

Re: [PATCH 01/17] Add ida and idr helper routines.

Quoted 13 lines · Tejun Heo

Hello,

Quoted 9 lines · James Bottomley

For most of the SCSI stuff, yes. I'm less sure about the sd numbers. They go up very high and get hammered a lot during system bring up and hot plug. I think having their own lock rather than wrapping everything around simple_ida_lock makes more sense here just because the system is heavily contended on getting indexes at bring up.

To continue the thought, why not move simple_ida_lock into struct ida so we don't have to worry about the contention and can sue ida_simple_... everywhere?

Quoted 7 lines

We sure can do that if necessary but I'm rather doubtful that even with sd number hammering this is likely to be a problem. Let's convert the users to the simple interface and make the lock per-ida if we actually see contention on the lock.

Thanks.

To be clear: you would like a patch series that converts the users of the ida_* routines in my patches to instead use the ida_simple_* routines, correct? And of course the ida_* helper routines I was adding in idr.h would not be needed.

If this is correct, I will supply a version 2 patch series that addresses this issue as well as the two patch-naming issues that were raised.

Signature · 1 line
Lee Duncan
#7 lore raw

Re: [PATCH 01/17] Add ida and idr helper routines.

Hello,

Quoted 4 lines · Lee Duncan

To be clear: you would like a patch series that converts the users of the ida_* routines in my patches to instead use the ida_simple_* routines, correct? And of course the ida_* helper routines I was adding in idr.h would not be needed.

Yeap.

Quoted 3 lines

If this is correct, I will supply a version 2 patch series that addresses this issue as well as the two patch-naming issues that were raised.

Sounds good to me. If the shared lock blows up, we can make that per-ida.

Thanks.

Signature · 1 line
tejun
author
#8 lore raw

PATCH 2/17 Update scsi hosts to use idr for host number mgmt

In reply to Lee Duncan

Each Scsi_Host instance gets a host number starting at 0, but this was implemented with an atomic integer, and rollover wasn't considered. Another problem with this design is that scsi host numbers used by iscsi are never reused, thereby making rollover more likely. This patch converts Scsi_Host instances to use idr to manage their instance numbers and to simplify instance number to pointer lookups.

This also means that host instance numbers will be reused, when available.

---
 drivers/scsi/hosts.c | 59 ++++++++++++++++++++++++----------------------------
 1 file changed, 27 insertions(+), 32 deletions(-)
drivers/scsi/hosts.c +27 -32
index 8bb173e01084..61201bc03b98 100644
@@ -33,7 +33,7 @@
 #include <linux/transport_class.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
-
+#include <linux/idr.h>
 #include <scsi/scsi_device.h>
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_transport.h>
@@ -42,8 +42,6 @@
 #include "scsi_logging.h"
 
 
-static atomic_t scsi_host_next_hn = ATOMIC_INIT(0);	/* host_no for next new host */
-
 
 static void scsi_host_cls_release(struct device *dev)
 {
@@ -304,6 +302,19 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
 }
 EXPORT_SYMBOL(scsi_add_host_with_dma);
 
+static DEFINE_SPINLOCK(host_index_lock);
+static DEFINE_IDR(host_index_idr);
+
+static inline int host_get_index(void *ptr)
+{
+	return idr_get_index(&host_index_idr, &host_index_lock, ptr);
+}
+
+static inline void host_put_index(int index)
+{
+	idr_put_index(&host_index_idr, &host_index_lock, index);
+}
+
 static void scsi_host_dev_release(struct device *dev)
 {
 	struct Scsi_Host *shost = dev_to_shost(dev);
@@ -337,6 +348,8 @@ static void scsi_host_dev_release(struct device *dev)
 
 	kfree(shost->shost_data);
 
+	host_put_index(shost->host_no);
+
 	if (parent)
 		put_device(parent);
 	kfree(shost);
@@ -370,6 +383,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
 {
 	struct Scsi_Host *shost;
 	gfp_t gfp_mask = GFP_KERNEL;
+	int index;
 
 	if (sht->unchecked_isa_dma && privsize)
 		gfp_mask |= __GFP_DMA;
@@ -388,11 +402,11 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
 	init_waitqueue_head(&shost->host_wait);
 	mutex_init(&shost->scan_mutex);
 
-	/*
-	 * subtract one because we increment first then return, but we need to
-	 * know what the next host number was before increment
-	 */
-	shost->host_no = atomic_inc_return(&scsi_host_next_hn) - 1;
+	index = host_get_index(shost);
+	if (index < 0)
+		goto fail_kfree;
+	shost->host_no = index;
+
 	shost->dma_channel = 0xff;
 
 	/* These three are default values which can be overridden */
@@ -477,7 +491,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
 		shost_printk(KERN_WARNING, shost,
 			"error handler thread failed to spawn, error = %ld\n",
 			PTR_ERR(shost->ehandler));
-		goto fail_kfree;
+		goto fail_idr_remove;
 	}
 
 	shost->tmf_work_q = alloc_workqueue("scsi_tmf_%d",
@@ -493,6 +507,8 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
 
  fail_kthread:
 	kthread_stop(shost->ehandler);
+ fail_idr_remove:
+	host_put_index(shost->host_no);
  fail_kfree:
 	kfree(shost);
 	return NULL;
@@ -522,38 +538,16 @@ void scsi_unregister(struct Scsi_Host *shost)
 }
 EXPORT_SYMBOL(scsi_unregister);
 
-static int __scsi_host_match(struct device *dev, const void *data)
-{
-	struct Scsi_Host *p;
-	const unsigned short *hostnum = data;
-
-	p = class_to_shost(dev);
-	return p->host_no == *hostnum;
-}
-
 /**
  * scsi_host_lookup - get a reference to a Scsi_Host by host no
  * @hostnum:	host number to locate
  *
  * Return value:
  *	A pointer to located Scsi_Host or NULL.
- *
- *	The caller must do a scsi_host_put() to drop the reference
- *	that scsi_host_get() took. The put_device() below dropped
- *	the reference from class_find_device().
  **/
 struct Scsi_Host *scsi_host_lookup(unsigned short hostnum)
 {
-	struct device *cdev;
-	struct Scsi_Host *shost = NULL;
-
-	cdev = class_find_device(&shost_class, NULL, &hostnum,
-				 __scsi_host_match);
-	if (cdev) {
-		shost = scsi_host_get(class_to_shost(cdev));
-		put_device(cdev);
-	}
-	return shost;
+	return idr_find(&host_index_idr, hostnum);
 }
 EXPORT_SYMBOL(scsi_host_lookup);
 
@@ -588,6 +582,7 @@ int scsi_init_hosts(void)
 void scsi_exit_hosts(void)
 {
 	class_unregister(&shost_class);
+	idr_destroy(&host_index_idr);
 }
 
 int scsi_is_host_device(const struct device *dev)
Signature · 1 line
2.1.4
author
#9 lore raw

PATCH 3/17 Update the st driver to use idr helper functions.

In reply to Lee Duncan
---
 drivers/scsi/st.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)
drivers/scsi/st.c +4 -11
index b37b9b00c4b4..51e1ce721d9f 100644
@@ -4265,11 +4265,8 @@ static int st_probe(struct device *dev)
 	    tpnt->blksize_changed = 0;
 	mutex_init(&tpnt->lock);
 
-	idr_preload(GFP_KERNEL);
-	spin_lock(&st_index_lock);
-	error = idr_alloc(&st_index_idr, tpnt, 0, ST_MAX_TAPES + 1, GFP_NOWAIT);
-	spin_unlock(&st_index_lock);
-	idr_preload_end();
+	error = idr_get_index_in_range(&st_index_idr, &st_index_lock, tpnt,
+				       0, ST_MAX_TAPES + 1);
 	if (error < 0) {
 		pr_warn("st: idr allocation failed: %d\n", error);
 		goto out_put_queue;
@@ -4303,9 +4300,7 @@ out_remove_devs:
 	remove_cdevs(tpnt);
 	kfree(tpnt->stats);
 out_idr_remove:
-	spin_lock(&st_index_lock);
-	idr_remove(&st_index_idr, tpnt->index);
-	spin_unlock(&st_index_lock);
+	idr_put_index(&st_index_idr, &st_index_lock, tpnt->index);
 out_put_queue:
 	blk_put_queue(disk->queue);
 out_put_disk:
@@ -4330,9 +4325,7 @@ static int st_remove(struct device *dev)
 	mutex_lock(&st_ref_mutex);
 	kref_put(&tpnt->kref, scsi_tape_release);
 	mutex_unlock(&st_ref_mutex);
-	spin_lock(&st_index_lock);
-	idr_remove(&st_index_idr, index);
-	spin_unlock(&st_index_lock);
+	idr_put_index(&st_index_idr, &st_index_lock, index);
 	return 0;
 }
 
Signature · 1 line
2.1.4
author
#10 lore raw

PATCH 4/17 Update the ch driver to use idr helper functions.

In reply to Lee Duncan

Note: when allocating an index, in the error case, where the just-allocated index has to be released, the required locking around the index removal was not present, so this conversion has the side effect of adding locking for that error condition. This should close a possible race condition that could have resulted in duplicate index allocation.

---
 drivers/scsi/ch.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/scsi/ch.c +4 -10
index dad959fcf6d8..2edf1f8883f9 100644
@@ -909,12 +909,8 @@ static int ch_probe(struct device *dev)
 	if (NULL == ch)
 		return -ENOMEM;
 
-	idr_preload(GFP_KERNEL);
-	spin_lock(&ch_index_lock);
-	ret = idr_alloc(&ch_index_idr, ch, 0, CH_MAX_DEVS + 1, GFP_NOWAIT);
-	spin_unlock(&ch_index_lock);
-	idr_preload_end();
-
+	ret = idr_get_index_in_range(&ch_index_idr, &ch_index_lock, ch,
+				     0, CH_MAX_DEVS + 1);
 	if (ret < 0) {
 		if (ret == -ENOSPC)
 			ret = -ENODEV;
@@ -945,7 +941,7 @@ static int ch_probe(struct device *dev)
 
 	return 0;
 remove_idr:
-	idr_remove(&ch_index_idr, ch->minor);
+	idr_put_index(&ch_index_idr, &ch_index_lock, ch->minor);
 free_ch:
 	kfree(ch);
 	return ret;
@@ -955,9 +951,7 @@ static int ch_remove(struct device *dev)
 {
 	scsi_changer *ch = dev_get_drvdata(dev);
 
-	spin_lock(&ch_index_lock);
-	idr_remove(&ch_index_idr, ch->minor);
-	spin_unlock(&ch_index_lock);
+	idr_put_index(&ch_index_idr, &ch_index_lock, ch->minor);
 
 	device_destroy(ch_sysfs_class, MKDEV(SCSI_CHANGER_MAJOR,ch->minor));
 	kfree(ch->dt);
Signature · 1 line
2.1.4
author
#11 lore raw

PATCH 5/17 Update the md driver to use idr helper functions.

In reply to Lee Duncan
---
 drivers/md/dm.c | 22 +++++-----------------
 1 file changed, 5 insertions(+), 17 deletions(-)
drivers/md/dm.c +5 -17
index f331d888e7f5..53d6895eb13d 100644
@@ -2202,9 +2202,7 @@ static int dm_any_congested(void *congested_data, int bdi_bits)
  *---------------------------------------------------------------*/
 static void free_minor(int minor)
 {
-	spin_lock(&_minor_lock);
-	idr_remove(&_minor_idr, minor);
-	spin_unlock(&_minor_lock);
+	idr_put_index(&_minor_idr, &_minor_lock, minor);
 }
 
 /*
@@ -2217,13 +2215,8 @@ static int specific_minor(int minor)
 	if (minor >= (1 << MINORBITS))
 		return -EINVAL;
 
-	idr_preload(GFP_KERNEL);
-	spin_lock(&_minor_lock);
-
-	r = idr_alloc(&_minor_idr, MINOR_ALLOCED, minor, minor + 1, GFP_NOWAIT);
-
-	spin_unlock(&_minor_lock);
-	idr_preload_end();
+	r = idr_get_index_in_range(&_minor_idr, &_minor_lock, MINOR_ALLOCED,
+				   minor, minor + 1);
 	if (r < 0)
 		return r == -ENOSPC ? -EBUSY : r;
 	return 0;
@@ -2233,13 +2226,8 @@ static int next_free_minor(int *minor)
 {
 	int r;
 
-	idr_preload(GFP_KERNEL);
-	spin_lock(&_minor_lock);
-
-	r = idr_alloc(&_minor_idr, MINOR_ALLOCED, 0, 1 << MINORBITS, GFP_NOWAIT);
-
-	spin_unlock(&_minor_lock);
-	idr_preload_end();
+	r = idr_get_index_in_range(&_minor_idr, &_minor_lock, MINOR_ALLOCED,
+				   0, 1 << MINORBITS);
 	if (r < 0)
 		return r;
 	*minor = r;
Signature · 1 line
2.1.4
#12 lore raw

Re: [PATCH 05/17] Update the md driver to use idr helper functions.

Subject should really be:
"dm: update to use idr helper functions"

author
#13 lore raw

Re: [PATCH 05/17] Update the md driver to use idr helper functions.

Quoted 2 lines · Mike Snitzer

Subject should really be:
"dm: update to use idr helper functions"

Yes, I grabbed the wrong part of the driver pathname.

Would it be better to resubmit just this patch, or to resubmit the series?

author
#14 lore raw

PATCH 6/17 Update the infiniband uverbs driver to use idr helper functions.

In reply to Lee Duncan
---
 drivers/infiniband/core/uverbs_cmd.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
drivers/infiniband/core/uverbs_cmd.c +2 -10
index bbb02ffe87df..1e5b2a66a501 100644
@@ -120,24 +120,16 @@ static int idr_add_uobj(struct idr *idr, struct ib_uobject *uobj)
 {
 	int ret;
 
-	idr_preload(GFP_KERNEL);
-	spin_lock(&ib_uverbs_idr_lock);
-
-	ret = idr_alloc(idr, uobj, 0, 0, GFP_NOWAIT);
+	ret = idr_get_index(idr, &ib_uverbs_idr_lock, uobj);
 	if (ret >= 0)
 		uobj->id = ret;
 
-	spin_unlock(&ib_uverbs_idr_lock);
-	idr_preload_end();
-
 	return ret < 0 ? ret : 0;
 }
 
 void idr_remove_uobj(struct idr *idr, struct ib_uobject *uobj)
 {
-	spin_lock(&ib_uverbs_idr_lock);
-	idr_remove(idr, uobj->id);
-	spin_unlock(&ib_uverbs_idr_lock);
+	idr_put_index(idr, &ib_uverbs_idr_lock, uobj->id);
 }
 
 static struct ib_uobject *__idr_get_uobj(struct idr *idr, int id,
Signature · 1 line
2.1.4
author
#15 lore raw

PATCH 7/17 Update the memstick driver to use idr helper functions.

In reply to Lee Duncan
---
 drivers/memstick/core/memstick.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)
drivers/memstick/core/memstick.c +4 -15
index a0547dbf9806..8f40a3d5108b 100644
@@ -512,25 +512,16 @@ int memstick_add_host(struct memstick_host *host)
 {
 	int rc;
 
-	idr_preload(GFP_KERNEL);
-	spin_lock(&memstick_host_lock);
-
-	rc = idr_alloc(&memstick_host_idr, host, 0, 0, GFP_NOWAIT);
-	if (rc >= 0)
-		host->id = rc;
-
-	spin_unlock(&memstick_host_lock);
-	idr_preload_end();
+	rc = idr_get_index(&memstick_host_idr, &memstick_host_lock, host);
 	if (rc < 0)
 		return rc;
+	host->id = rc;
 
 	dev_set_name(&host->dev, "memstick%u", host->id);
 
 	rc = device_add(&host->dev);
 	if (rc) {
-		spin_lock(&memstick_host_lock);
-		idr_remove(&memstick_host_idr, host->id);
-		spin_unlock(&memstick_host_lock);
+		idr_put_index(&memstick_host_idr, &memstick_host_lock, host->id);
 		return rc;
 	}
 
@@ -554,9 +545,7 @@ void memstick_remove_host(struct memstick_host *host)
 	host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_OFF);
 	mutex_unlock(&host->lock);
 
-	spin_lock(&memstick_host_lock);
-	idr_remove(&memstick_host_idr, host->id);
-	spin_unlock(&memstick_host_lock);
+	idr_put_index(&memstick_host_idr, &memstick_host_lock, host->id);
 	device_del(&host->dev);
 }
 EXPORT_SYMBOL(memstick_remove_host);
Signature · 1 line
2.1.4
author
#16 lore raw

PATCH 8/17 Update the mmc driver to use idr helper functions.

In reply to Lee Duncan
---
 drivers/mmc/core/host.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/mmc/core/host.c +4 -10
index 99a9c9011c50..5aa2330f074c 100644
@@ -40,9 +40,8 @@ static DEFINE_SPINLOCK(mmc_host_lock);
 static void mmc_host_classdev_release(struct device *dev)
 {
 	struct mmc_host *host = cls_dev_to_mmc_host(dev);
-	spin_lock(&mmc_host_lock);
-	idr_remove(&mmc_host_idr, host->index);
-	spin_unlock(&mmc_host_lock);
+
+	idr_put_index(&mmc_host_idr, &mmc_host_lock, host->index);
 	kfree(host);
 }
 
@@ -559,17 +558,12 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
 
 	/* scanning will be enabled when we're ready */
 	host->rescan_disable = 1;
-	idr_preload(GFP_KERNEL);
-	spin_lock(&mmc_host_lock);
-	err = idr_alloc(&mmc_host_idr, host, 0, 0, GFP_NOWAIT);
-	if (err >= 0)
-		host->index = err;
-	spin_unlock(&mmc_host_lock);
-	idr_preload_end();
+	err = idr_get_index(&mmc_host_idr, &mmc_host_lock, host);
 	if (err < 0) {
 		kfree(host);
 		return NULL;
 	}
+	host->index = err;
 
 	dev_set_name(&host->class_dev, "mmc%d", host->index);
 
Signature · 1 line
2.1.4
#17 lore raw

Re: [PATCH 08/17] Update the mmc driver to use idr helper functions.

Quoted 1 line · Lee Duncan

Please change the prefix of the commit message header to "mmc: core" and resend to linux-mmc.

Kind regards
Uffe

Quoted 43 lines
---
 drivers/mmc/core/host.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/mmc/core/host.c +4 -11
index 99a9c9011c50..5aa2330f074c 100644
@@ -40,9 +40,8 @@ static DEFINE_SPINLOCK(mmc_host_lock);
 static void mmc_host_classdev_release(struct device *dev)
 {
        struct mmc_host *host = cls_dev_to_mmc_host(dev);
-       spin_lock(&mmc_host_lock);
-       idr_remove(&mmc_host_idr, host->index);
-       spin_unlock(&mmc_host_lock);
+
+       idr_put_index(&mmc_host_idr, &mmc_host_lock, host->index);
        kfree(host);
 }
 
@@ -559,17 +558,12 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
 
        /* scanning will be enabled when we're ready */
        host->rescan_disable = 1;
-       idr_preload(GFP_KERNEL);
-       spin_lock(&mmc_host_lock);
-       err = idr_alloc(&mmc_host_idr, host, 0, 0, GFP_NOWAIT);
-       if (err >= 0)
-               host->index = err;
-       spin_unlock(&mmc_host_lock);
-       idr_preload_end();
+       err = idr_get_index(&mmc_host_idr, &mmc_host_lock, host);
        if (err < 0) {
                kfree(host);
                return NULL;
        }
+       host->index = err;
 
        dev_set_name(&host->class_dev, "mmc%d", host->index);
 
--

2.1.4

author
#18 lore raw

PATCH 9/17 Update the virtgpu driver to use idr helper functions.

In reply to Lee Duncan
---
 drivers/gpu/drm/virtio/virtgpu_vq.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)
drivers/gpu/drm/virtio/virtgpu_vq.c +4 -11
index 1698669f4185..380947dad306 100644
@@ -41,21 +41,14 @@
 void virtio_gpu_resource_id_get(struct virtio_gpu_device *vgdev,
 				uint32_t *resid)
 {
-	int handle;
-
-	idr_preload(GFP_KERNEL);
-	spin_lock(&vgdev->resource_idr_lock);
-	handle = idr_alloc(&vgdev->resource_idr, NULL, 1, 0, GFP_NOWAIT);
-	spin_unlock(&vgdev->resource_idr_lock);
-	idr_preload_end();
-	*resid = handle;
+	*resid = idr_get_index_in_range(&vgdev->resource_idr,
+					&vgdev->resource_idr_lock,
+					NULL, 1, 0);
 }
 
 void virtio_gpu_resource_id_put(struct virtio_gpu_device *vgdev, uint32_t id)
 {
-	spin_lock(&vgdev->resource_idr_lock);
-	idr_remove(&vgdev->resource_idr, id);
-	spin_unlock(&vgdev->resource_idr_lock);
+	idr_put_index(&vgdev->resource_idr, &vgdev->resource_idr_lock, id);
 }
 
 void virtio_gpu_ctrl_ack(struct virtqueue *vq)
Signature · 1 line
2.1.4
author
#19 lore raw

PATCH 10/17 Update the DCA DMA driver to use idr helper functions.

In reply to Lee Duncan
---
 drivers/dca/dca-sysfs.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)
drivers/dca/dca-sysfs.c +4 -15
index 126cf295b198..8930707df295 100644
@@ -55,23 +55,14 @@ int dca_sysfs_add_provider(struct dca_provider *dca, struct device *dev)
 	struct device *cd;
 	int ret;
 
-	idr_preload(GFP_KERNEL);
-	spin_lock(&dca_idr_lock);
-
-	ret = idr_alloc(&dca_idr, dca, 0, 0, GFP_NOWAIT);
-	if (ret >= 0)
-		dca->id = ret;
-
-	spin_unlock(&dca_idr_lock);
-	idr_preload_end();
+	ret = idr_get_index(&dca_idr, &dca_idr_lock, dca);
 	if (ret < 0)
 		return ret;
+	dca->id = ret;
 
 	cd = device_create(dca_class, dev, MKDEV(0, 0), NULL, "dca%d", dca->id);
 	if (IS_ERR(cd)) {
-		spin_lock(&dca_idr_lock);
-		idr_remove(&dca_idr, dca->id);
-		spin_unlock(&dca_idr_lock);
+		idr_put_index(&dca_idr, &dca_idr_lock, dca->id);
 		return PTR_ERR(cd);
 	}
 	dca->cd = cd;
@@ -82,9 +73,7 @@ void dca_sysfs_remove_provider(struct dca_provider *dca)
 {
 	device_unregister(dca->cd);
 	dca->cd = NULL;
-	spin_lock(&dca_idr_lock);
-	idr_remove(&dca_idr, dca->id);
-	spin_unlock(&dca_idr_lock);
+	idr_put_index(&dca_idr, &dca_idr_lock, dca->id);
 }
 
 int __init dca_sysfs_init(void)
Signature · 1 line
2.1.4
author
#20 lore raw

PATCH 11/17 Update the rtsx multifunction driver to use idr helper functions.

In reply to Lee Duncan
---
 drivers/mfd/rtsx_pcr.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/mfd/rtsx_pcr.c +3 -10
index a66540a49079..8ddefb8c5e64 100644
@@ -1191,15 +1191,10 @@ static int rtsx_pci_probe(struct pci_dev *pcidev,
 	}
 	handle->pcr = pcr;
 
-	idr_preload(GFP_KERNEL);
-	spin_lock(&rtsx_pci_lock);
-	ret = idr_alloc(&rtsx_pci_idr, pcr, 0, 0, GFP_NOWAIT);
-	if (ret >= 0)
-		pcr->id = ret;
-	spin_unlock(&rtsx_pci_lock);
-	idr_preload_end();
+	ret = idr_get_index(&rtsx_pci_idr, &rtsc_pci_lock, pcr);
 	if (ret < 0)
 		goto free_handle;
+	pcr->id = ret;
 
 	pcr->pci = pcidev;
 	dev_set_drvdata(&pcidev->dev, handle);
@@ -1311,9 +1306,7 @@ static void rtsx_pci_remove(struct pci_dev *pcidev)
 	pci_release_regions(pcidev);
 	pci_disable_device(pcidev);
 
-	spin_lock(&rtsx_pci_lock);
-	idr_remove(&rtsx_pci_idr, pcr->id);
-	spin_unlock(&rtsx_pci_lock);
+	idr_put_index(&rtsx_pci_idr, &rtsx_pci_lock, pcr->id);
 
 	kfree(pcr->slots);
 	kfree(pcr);
Signature · 1 line
2.1.4
author
#21 lore raw

PATCH 12/17 Update the TI Flash Media driver to use idr helper functions.

In reply to Lee Duncan
---
 drivers/misc/tifm_core.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)
drivers/misc/tifm_core.c +4 -13
index a511b2a713b3..46385f828a8f 100644
@@ -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);
Signature · 1 line
2.1.4
author
#22 lore raw

PATCH 13/17 Update the SCSI disk driver to use ida helper functions.

In reply to Lee Duncan
---
 drivers/scsi/sd.c | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)
drivers/scsi/sd.c +4 -16
index 3b2fcb4fada0..60b2ad918208 100644
@@ -2948,15 +2948,7 @@ static int sd_probe(struct device *dev)
 	if (!gd)
 		goto out_free;
 
-	do {
-		if (!ida_pre_get(&sd_index_ida, GFP_KERNEL))
-			goto out_put;
-
-		spin_lock(&sd_index_lock);
-		error = ida_get_new(&sd_index_ida, &index);
-		spin_unlock(&sd_index_lock);
-	} while (error == -EAGAIN);
-
+	error = ida_get_index(&sd_index_ida, &sd_index_lock, &index);
 	if (error) {
 		sdev_printk(KERN_WARNING, sdp, "sd_probe: memory exhausted.\n");
 		goto out_put;
@@ -3001,9 +2993,7 @@ static int sd_probe(struct device *dev)
 	return 0;
 
  out_free_index:
-	spin_lock(&sd_index_lock);
-	ida_remove(&sd_index_ida, index);
-	spin_unlock(&sd_index_lock);
+	ida_put_index(&sd_index_ida, &sd_index_lock, index);
  out_put:
 	put_disk(gd);
  out_free:
@@ -3063,10 +3053,8 @@ static void scsi_disk_release(struct device *dev)
 {
 	struct scsi_disk *sdkp = to_scsi_disk(dev);
 	struct gendisk *disk = sdkp->disk;
-	
-	spin_lock(&sd_index_lock);
-	ida_remove(&sd_index_ida, sdkp->index);
-	spin_unlock(&sd_index_lock);
+
+	ida_put_index(&sd_index_ida, &sd_index_lock, sdkp->index);
 
 	blk_integrity_unregister(disk);
 	disk->private_data = NULL;
Signature · 1 line
2.1.4
author
#23 lore raw

PATCH 14/17 Update the rsxx flash adapter driver to use ida helper functions.

In reply to Lee Duncan
---
 drivers/block/rsxx/core.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)
drivers/block/rsxx/core.c +2 -14
index d8b2488aaade..dd23a0e85040 100644
@@ -774,17 +774,7 @@ static int rsxx_pci_probe(struct pci_dev *dev,
 	card->dev = dev;
 	pci_set_drvdata(dev, card);
 
-	do {
-		if (!ida_pre_get(&rsxx_disk_ida, GFP_KERNEL)) {
-			st = -ENOMEM;
-			goto failed_ida_get;
-		}
-
-		spin_lock(&rsxx_ida_lock);
-		st = ida_get_new(&rsxx_disk_ida, &card->disk_id);
-		spin_unlock(&rsxx_ida_lock);
-	} while (st == -EAGAIN);
-
+	st = ida_get_index(&rsxx_disk_ida, &rsxx_ida_lock, &card->disk_id);
 	if (st)
 		goto failed_ida_get;
 
@@ -987,9 +977,7 @@ failed_request_regions:
 failed_dma_mask:
 	pci_disable_device(dev);
 failed_enable:
-	spin_lock(&rsxx_ida_lock);
-	ida_remove(&rsxx_disk_ida, card->disk_id);
-	spin_unlock(&rsxx_ida_lock);
+	ida_put_index(&rsxx_disk_ida, &rsxx_ida_lock, card->disk_id);
 failed_ida_get:
 	kfree(card);
 
Signature · 1 line
2.1.4
author
#24 lore raw

PATCH 15/17 Update the NVMe SSD driver to use ida helper functions.

In reply to Lee Duncan
---
 drivers/block/nvme-core.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/block/nvme-core.c +2 -12
index d1d6141920d3..ab13833d4fde 100644
@@ -2715,15 +2715,7 @@ static int nvme_set_instance(struct nvme_dev *dev)
 {
 	int instance, error;
 
-	do {
-		if (!ida_pre_get(&nvme_instance_ida, GFP_KERNEL))
-			return -ENODEV;
-
-		spin_lock(&dev_list_lock);
-		error = ida_get_new(&nvme_instance_ida, &instance);
-		spin_unlock(&dev_list_lock);
-	} while (error == -EAGAIN);
-
+	error = ida_get_index(&nvme_instance_ida, &dev_list_lock, &instance);
 	if (error)
 		return -ENODEV;
 
@@ -2733,9 +2725,7 @@ static int nvme_set_instance(struct nvme_dev *dev)
 
 static void nvme_release_instance(struct nvme_dev *dev)
 {
-	spin_lock(&dev_list_lock);
-	ida_remove(&nvme_instance_ida, dev->instance);
-	spin_unlock(&dev_list_lock);
+	ida_put_index(&nvme_instance_ida, &dev_list_lock, dev->instance);
 }
 
 static void nvme_free_namespaces(struct nvme_dev *dev)
Signature · 1 line
2.1.4
author
#25 lore raw

PATCH 16/17 Update the Micron PCIe SSD driver to use ida helper functions.

In reply to Lee Duncan
---
 drivers/block/mtip32xx/mtip32xx.c | 22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)
drivers/block/mtip32xx/mtip32xx.c +4 -18
index 4a2ef09e6704..ccff4119b554 100644
@@ -3821,15 +3821,7 @@ static int mtip_block_initialize(struct driver_data *dd)
 	}
 
 	/* Generate the disk name, implemented same as in sd.c */
-	do {
-		if (!ida_pre_get(&rssd_index_ida, GFP_KERNEL))
-			goto ida_get_error;
-
-		spin_lock(&rssd_index_lock);
-		rv = ida_get_new(&rssd_index_ida, &index);
-		spin_unlock(&rssd_index_lock);
-	} while (rv == -EAGAIN);
-
+	rv = ida_get_index(&rssd_index_ida, &rssd_index_lock, &index);
 	if (rv)
 		goto ida_get_error;
 
@@ -3981,9 +3973,7 @@ init_hw_cmds_error:
 block_queue_alloc_init_error:
 	mtip_hw_debugfs_exit(dd);
 disk_index_error:
-	spin_lock(&rssd_index_lock);
-	ida_remove(&rssd_index_ida, index);
-	spin_unlock(&rssd_index_lock);
+	ida_put_index(&rssd_index_ida, &rssd_index_lock, index);
 
 ida_get_error:
 	put_disk(dd->disk);
@@ -4051,9 +4041,7 @@ static int mtip_block_remove(struct driver_data *dd)
 	}
 	dd->disk  = NULL;
 
-	spin_lock(&rssd_index_lock);
-	ida_remove(&rssd_index_ida, dd->index);
-	spin_unlock(&rssd_index_lock);
+	ida_put_index(&rssd_index_ida, &rssd_index_lock, dd->index);
 
 	/* De-initialize the protocol layer. */
 	mtip_hw_exit(dd);
@@ -4092,9 +4080,7 @@ static int mtip_block_shutdown(struct driver_data *dd)
 		dd->queue = NULL;
 	}
 
-	spin_lock(&rssd_index_lock);
-	ida_remove(&rssd_index_ida, dd->index);
-	spin_unlock(&rssd_index_lock);
+	ida_put_index(&rssd_index_ida, &rssd_index_lock, dd->index);
 	return 0;
 }
 
Signature · 1 line
2.1.4
author
#26 lore raw

PATCH 17/17 Update the ARM soc base driver to use ida helper functions.

In reply to Lee Duncan
---
 drivers/base/soc.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)
drivers/base/soc.c +3 -14
index 39fca01c8fa1..cf70c3246123 100644
@@ -122,18 +122,7 @@ struct soc_device *soc_device_register(struct soc_device_attribute *soc_dev_attr
 	}
 
 	/* Fetch a unique (reclaimable) SOC ID. */
-	do {
-		if (!ida_pre_get(&soc_ida, GFP_KERNEL)) {
-			ret = -ENOMEM;
-			goto out2;
-		}
-
-		spin_lock(&soc_lock);
-		ret = ida_get_new(&soc_ida, &soc_dev->soc_dev_num);
-		spin_unlock(&soc_lock);
-
-	} while (ret == -EAGAIN);
-
+	ret = ida_get_index(&soc_ida, &soc_lock, &soc_dev->soc_dev_num);
 	if (ret)
 		goto out2;
 
@@ -151,7 +140,7 @@ struct soc_device *soc_device_register(struct soc_device_attribute *soc_dev_attr
 	return soc_dev;
 
 out3:
-	ida_remove(&soc_ida, soc_dev->soc_dev_num);
+	ida_put_index(&soc_ida, &soc_lock, soc_dev->soc_dev_num);
 out2:
 	kfree(soc_dev);
 out1:
@@ -161,7 +150,7 @@ out1:
 /* Ensure soc_dev->attr is freed prior to calling soc_device_unregister. */
 void soc_device_unregister(struct soc_device *soc_dev)
 {
-	ida_remove(&soc_ida, soc_dev->soc_dev_num);
+	ida_put_index(&soc_ida, &soc_lock, soc_dev->soc_dev_num);
 
 	device_unregister(&soc_dev->dev);
 }
Signature · 1 line
2.1.4