path: root/include
diff options
authorSimon Glass <>2016-05-01 11:36:29 -0600
committerSimon Glass <>2016-05-17 09:54:43 -0600
commit9107c973d32c72a6f7ac909fc4a6884a42e4e607 (patch)
tree29ebd7fae208b74ddaf86414847e3b1c70fbb2dd /include
parent52138fd4072b64448855eac4c2c9815b46f5b43c (diff)
dm: blk: Add a easier way to create a named block device
Add a function that automatically builds the device name given the parent and a supplied string. Most callers will want to do this, so putting this functionality in one place makes more sense. Signed-off-by: Simon Glass <>
Diffstat (limited to 'include')
1 files changed, 17 insertions, 0 deletions
diff --git a/include/blk.h b/include/blk.h
index 547c3b48dc..82b2c1a706 100644
--- a/include/blk.h
+++ b/include/blk.h
@@ -281,6 +281,23 @@ int blk_create_device(struct udevice *parent, const char *drv_name,
lbaint_t size, struct udevice **devp);
+ * blk_create_devicef() - Create a new named block device
+ *
+ * @parent: Parent of the new device
+ * @drv_name: Driver name to use for the block device
+ * @name: Name for the device (parent name is prepended)
+ * @if_type: Interface type (enum if_type_t)
+ * @devnum: Device number, specific to the interface type, or -1 to
+ * allocate the next available number
+ * @blksz: Block size of the device in bytes (typically 512)
+ * @size: Total size of the device in bytes
+ * @devp: the new device (which has not been probed)
+ */
+int blk_create_devicef(struct udevice *parent, const char *drv_name,
+ const char *name, int if_type, int devnum, int blksz,
+ lbaint_t size, struct udevice **devp);
* blk_prepare_device() - Prepare a block device for use
* This reads partition information from the device if supported.
OpenPOWER on IntegriCloud