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:
Simon Glass
2016-02-29 15:25:52 -07:00
parent bcce53d048
commit 2a981dc2c6
16 changed files with 94 additions and 87 deletions

View File

@@ -63,7 +63,7 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
/* the first sector (sector 0x10) must be a primary volume desc */
blkaddr=PVD_OFFSET;
if (dev_desc->block_read(dev_desc, PVD_OFFSET, 1, (ulong *)tmpbuf) != 1)
if (blk_dread(dev_desc, PVD_OFFSET, 1, (ulong *)tmpbuf) != 1)
return -1;
if(ppr->desctype!=0x01) {
if(verb)
@@ -85,7 +85,7 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
PRINTF(" Lastsect:%08lx\n",lastsect);
for(i=blkaddr;i<lastsect;i++) {
PRINTF("Reading block %d\n", i);
if (dev_desc->block_read(dev_desc, i, 1, (ulong *)tmpbuf) != 1)
if (blk_dread(dev_desc, i, 1, (ulong *)tmpbuf) != 1)
return -1;
if(ppr->desctype==0x00)
break; /* boot entry found */
@@ -105,7 +105,7 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
}
bootaddr=le32_to_int(pbr->pointer);
PRINTF(" Boot Entry at: %08lX\n",bootaddr);
if (dev_desc->block_read(dev_desc, bootaddr, 1, (ulong *)tmpbuf) != 1) {
if (blk_dread(dev_desc, bootaddr, 1, (ulong *)tmpbuf) != 1) {
if(verb)
printf ("** Can't read Boot Entry at %lX on %d:%d **\n",
bootaddr, dev_desc->devnum, part_num);