dm: blk: Add a way to obtain a block device from its parent

Many devices support a child block device (e.g. MMC, USB). Add a
convenient way to get this device given the parent device.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
Simon Glass
2017-05-27 11:37:17 -06:00
committed by Jaehoon Chung
parent fc69d47262
commit 9f103b9cb5
3 changed files with 51 additions and 0 deletions

View File

@ -616,4 +616,11 @@ ulong blk_write_devnum(enum if_type if_type, int devnum, lbaint_t start,
*/
int blk_select_hwpart_devnum(enum if_type if_type, int devnum, int hwpart);
/**
* blk_get_from_parent() - obtain a block device by looking up its parent
*
* All devices with
*/
int blk_get_from_parent(struct udevice *parent, struct udevice **devp);
#endif