blk: Make blk_next_free_devnum() public
authorBin Meng <bmeng.cn@gmail.com>
Mon, 15 Oct 2018 09:21:09 +0000 (02:21 -0700)
committerSimon Glass <sjg@chromium.org>
Wed, 14 Nov 2018 17:16:27 +0000 (09:16 -0800)
blk_next_free_devnum() can be helpful in some cases. Make it
a public API.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/block/blk-uclass.c
include/blk.h

index 3f00ff8ede0a2cbc8481c5caa9b700750f0813e5..76ee3db80c487ea334eeb6086b126df00aaed63f 100644 (file)
@@ -517,7 +517,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;
 
index c243179ebbe83b0f8f20f6f232e413fbb576c72d..5e94f0e096b86046f85829999d221b652c8bb616 100644 (file)
@@ -378,6 +378,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
  *