diff options
author | Simon Glass <sjg@chromium.org> | 2017-04-23 20:02:05 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2017-06-01 07:03:04 -0600 |
commit | 6139281a6473334351c8776643478c0b0e208342 (patch) | |
tree | 501de9018b4716ecc19bfcff404b4ea10f65e0ee /drivers/block | |
parent | e7017a3c7d2f9ff845516675205c99df4ad6eacc (diff) | |
download | u-boot-6139281a6473334351c8776643478c0b0e208342.tar.gz |
dm: blk: Allow finding block devices without probing
Sometimes it is useful to be able to find a block device without also
probing it. Add a function for this as well as the associated test.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/blk-uclass.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c index af3c35f6d0..8b6b28d890 100644 --- a/drivers/block/blk-uclass.c +++ b/drivers/block/blk-uclass.c @@ -363,7 +363,7 @@ int blk_next_device(struct udevice **devp) } while (1); } -int blk_get_device(int if_type, int devnum, struct udevice **devp) +int blk_find_device(int if_type, int devnum, struct udevice **devp) { struct uclass *uc; struct udevice *dev; @@ -379,13 +379,24 @@ int blk_get_device(int if_type, int devnum, struct udevice **devp) if_type, devnum, dev->name, desc->if_type, desc->devnum); if (desc->if_type == if_type && desc->devnum == devnum) { *devp = dev; - return device_probe(dev); + return 0; } } return -ENODEV; } +int blk_get_device(int if_type, int devnum, struct udevice **devp) +{ + int ret; + + ret = blk_find_device(if_type, devnum, devp); + if (ret) + return ret; + + return device_probe(*devp); +} + unsigned long blk_dread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt, void *buffer) { |