mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-09 03:21:51 +00:00
dm: blk: Allow blk_create_device() to allocate the device number
Allow a devnum parameter of -1 to indicate that the device number should be alocated automatically. The next highest available device number for that interface type is used. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
199a1201ab
commit
52138fd407
2 changed files with 43 additions and 1 deletions
|
@ -270,7 +270,8 @@ int blk_next_device(struct udevice **devp);
|
|||
* @drv_name: Driver name to use for the block device
|
||||
* @name: Name for the device
|
||||
* @if_type: Interface type (enum if_type_t)
|
||||
* @devnum: Device number, specific to the interface type
|
||||
* @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)
|
||||
|
@ -299,6 +300,18 @@ int blk_prepare_device(struct udevice *dev);
|
|||
*/
|
||||
int blk_unbind_all(int if_type);
|
||||
|
||||
/**
|
||||
* blk_find_max_devnum() - find the maximum device number for an interface type
|
||||
*
|
||||
* Finds the last allocated device number for an interface type @if_type. The
|
||||
* next number is safe to use for a newly allocated device.
|
||||
*
|
||||
* @if_type: Interface type to scan
|
||||
* @return maximum device number found, or -ENODEV if none, or other -ve on
|
||||
* error
|
||||
*/
|
||||
int blk_find_max_devnum(enum if_type if_type);
|
||||
|
||||
#else
|
||||
#include <errno.h>
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue