diff mbox series

[U-Boot,v3,13/31] blk: Make blk_next_free_devnum() public

Message ID 1539595287-31378-14-git-send-email-bmeng.cn@gmail.com
State Accepted
Delegated to: Simon Glass
Headers show
Series virtio: Introduce VirtIO driver support | expand

Commit Message

Bin Meng Oct. 15, 2018, 9:21 a.m. UTC
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>
---

Changes in v3: None
Changes in v2: None

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

Comments

Simon Glass Oct. 24, 2018, 5:31 p.m. UTC | #1
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>
---

Changes in v3: None
Changes in v2: None

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

Applied to u-boot-dm/next, thanks!
diff mbox series

Patch

diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c
index 3f00ff8..76ee3db 100644
--- a/drivers/block/blk-uclass.c
+++ b/drivers/block/blk-uclass.c
@@ -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;
 
diff --git a/include/blk.h b/include/blk.h
index c243179..5e94f0e 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)