diff options
author | Simon Glass <sjg@chromium.org> | 2016-02-29 15:25:52 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2016-03-14 15:34:50 -0600 |
commit | 2a981dc2c62c500110aad297fa70503aec36e689 (patch) | |
tree | a2098718e857b136986ee0401a40037b16e51a3a /fs/ext4/dev.c | |
parent | bcce53d048de7f41078d25e39aa2f26d752d3658 (diff) | |
download | u-boot-2a981dc2c62c500110aad297fa70503aec36e689.tar.gz |
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>
Diffstat (limited to 'fs/ext4/dev.c')
-rw-r--r-- | fs/ext4/dev.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/fs/ext4/dev.c b/fs/ext4/dev.c index 3eef66f847..ee84d3fbe1 100644 --- a/fs/ext4/dev.c +++ b/fs/ext4/dev.c @@ -24,6 +24,7 @@ */ #include <common.h> +#include <blk.h> #include <config.h> #include <memalign.h> #include <ext4fs.h> @@ -76,9 +77,8 @@ int ext4fs_devread(lbaint_t sector, int byte_offset, int byte_len, char *buf) if (byte_offset != 0) { int readlen; /* read first part which isn't aligned with start of sector */ - if (ext4fs_blk_desc->block_read(ext4fs_blk_desc, - part_info->start + sector, - 1, (void *)sec_buf) != 1) { + if (blk_dread(ext4fs_blk_desc, part_info->start + sector, 1, + (void *)sec_buf) != 1) { printf(" ** ext2fs_devread() read error **\n"); return 0; } @@ -100,17 +100,15 @@ int ext4fs_devread(lbaint_t sector, int byte_offset, int byte_len, char *buf) ALLOC_CACHE_ALIGN_BUFFER(u8, p, ext4fs_blk_desc->blksz); block_len = ext4fs_blk_desc->blksz; - ext4fs_blk_desc->block_read(ext4fs_blk_desc, - part_info->start + sector, - 1, (void *)p); + blk_dread(ext4fs_blk_desc, part_info->start + sector, 1, + (void *)p); memcpy(buf, p, byte_len); return 1; } - if (ext4fs_blk_desc->block_read(ext4fs_blk_desc, - part_info->start + sector, - block_len >> log2blksz, (void *)buf) - != block_len >> log2blksz) { + if (blk_dread(ext4fs_blk_desc, part_info->start + sector, + block_len >> log2blksz, (void *)buf) != + block_len >> log2blksz) { printf(" ** %s read error - block\n", __func__); return 0; } @@ -121,9 +119,8 @@ int ext4fs_devread(lbaint_t sector, int byte_offset, int byte_len, char *buf) if (byte_len != 0) { /* read rest of data which are not in whole sector */ - if (ext4fs_blk_desc->block_read(ext4fs_blk_desc, - part_info->start + sector, - 1, (void *)sec_buf) != 1) { + if (blk_dread(ext4fs_blk_desc, part_info->start + sector, 1, + (void *)sec_buf) != 1) { printf("* %s read error - last part\n", __func__); return 0; } |