blk_next_free_devnum() can be helpful in some cases. Make it
a public API.

Signed-off-by: Bin Meng <bmeng...@gmail.com>
---

 drivers/block/blk-uclass.c |  2 +-
 include/blk.h              | 11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c
index acd2c69..c14da1f 100644
--- a/drivers/block/blk-uclass.c
+++ b/drivers/block/blk-uclass.c
@@ -494,7 +494,7 @@ int blk_find_max_devnum(enum if_type if_type)
        return max_devnum;
 }
 
-static int blk_next_free_devnum(enum if_type if_type)
+int blk_next_free_devnum(enum if_type if_type)
 {
        int ret;
 
diff --git a/include/blk.h b/include/blk.h
index 32104ff..9787a20 100644
--- a/include/blk.h
+++ b/include/blk.h
@@ -379,6 +379,17 @@ int blk_unbind_all(int if_type);
 int blk_find_max_devnum(enum if_type if_type);
 
 /**
+ * blk_next_free_devnum() - get the next device number for an interface type
+ *
+ * Finds the next number that is safe to use for a newly allocated device for
+ * an interface type @if_type.
+ *
+ * @if_type:   Interface type to scan
+ * @return next device number safe to use, or -ve on error
+ */
+int blk_next_free_devnum(enum if_type if_type);
+
+/**
  * blk_select_hwpart() - select a hardware partition
  *
  * Select a hardware partition if the device supports it (typically MMC does)
-- 
2.7.4

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to