dm: block: Adjust device calls to go through helpers function
To ease conversion to driver model, add helper functions which deal with calling each block device method. With driver model we can reimplement these functions with the same arguments. Use inline functions to avoid increasing code size on some boards. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Stephen Warren <swarren@nvidia.com>
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <blk.h>
|
||||
#include <config.h>
|
||||
#include <exports.h>
|
||||
#include <fat.h>
|
||||
@@ -48,11 +49,10 @@ static int disk_read(__u32 block, __u32 nr_blocks, void *buf)
|
||||
{
|
||||
ulong ret;
|
||||
|
||||
if (!cur_dev || !cur_dev->block_read)
|
||||
if (!cur_dev)
|
||||
return -1;
|
||||
|
||||
ret = cur_dev->block_read(cur_dev, cur_part_info.start + block,
|
||||
nr_blocks, buf);
|
||||
ret = blk_dread(cur_dev, cur_part_info.start + block, nr_blocks, buf);
|
||||
|
||||
if (nr_blocks && ret == 0)
|
||||
return -1;
|
||||
|
||||
@@ -32,7 +32,7 @@ static int disk_write(__u32 block, __u32 nr_blocks, void *buf)
|
||||
{
|
||||
ulong ret;
|
||||
|
||||
if (!cur_dev || !cur_dev->block_write)
|
||||
if (!cur_dev)
|
||||
return -1;
|
||||
|
||||
if (cur_part_info.start + block + nr_blocks >
|
||||
@@ -41,8 +41,7 @@ static int disk_write(__u32 block, __u32 nr_blocks, void *buf)
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = cur_dev->block_write(cur_dev, cur_part_info.start + block,
|
||||
nr_blocks, buf);
|
||||
ret = blk_dwrite(cur_dev, cur_part_info.start + block, nr_blocks, buf);
|
||||
if (nr_blocks && ret == 0)
|
||||
return -1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user