mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-24 06:24:17 +00:00
dm: disk: Use legacy block driver info for block device access
Instead of calling xx_get_dev() functions for each interface type, use the new legacy block driver which can provide the device through its interface. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
d97dc8a0e6
commit
a6331fa83c
1 changed files with 3 additions and 4 deletions
|
@ -72,7 +72,6 @@ static struct part_driver *part_driver_lookup_type(int part_type)
|
||||||
static struct blk_desc *get_dev_hwpart(const char *ifname, int dev, int hwpart)
|
static struct blk_desc *get_dev_hwpart(const char *ifname, int dev, int hwpart)
|
||||||
{
|
{
|
||||||
const struct block_drvr *drvr = block_drvr;
|
const struct block_drvr *drvr = block_drvr;
|
||||||
struct blk_desc* (*reloc_get_dev)(int dev);
|
|
||||||
int (*select_hwpart)(int dev_num, int hwpart);
|
int (*select_hwpart)(int dev_num, int hwpart);
|
||||||
char *name;
|
char *name;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -86,16 +85,16 @@ static struct blk_desc *get_dev_hwpart(const char *ifname, int dev, int hwpart)
|
||||||
#endif
|
#endif
|
||||||
while (drvr->name) {
|
while (drvr->name) {
|
||||||
name = drvr->name;
|
name = drvr->name;
|
||||||
reloc_get_dev = drvr->get_dev;
|
|
||||||
select_hwpart = drvr->select_hwpart;
|
select_hwpart = drvr->select_hwpart;
|
||||||
#ifdef CONFIG_NEEDS_MANUAL_RELOC
|
#ifdef CONFIG_NEEDS_MANUAL_RELOC
|
||||||
name += gd->reloc_off;
|
name += gd->reloc_off;
|
||||||
reloc_get_dev += gd->reloc_off;
|
|
||||||
if (select_hwpart)
|
if (select_hwpart)
|
||||||
select_hwpart += gd->reloc_off;
|
select_hwpart += gd->reloc_off;
|
||||||
#endif
|
#endif
|
||||||
if (strncmp(ifname, name, strlen(name)) == 0) {
|
if (strncmp(ifname, name, strlen(name)) == 0) {
|
||||||
struct blk_desc *dev_desc = reloc_get_dev(dev);
|
struct blk_desc *dev_desc;
|
||||||
|
|
||||||
|
dev_desc = blk_get_devnum_by_typename(name, dev);
|
||||||
if (!dev_desc)
|
if (!dev_desc)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (hwpart == 0 && !select_hwpart)
|
if (hwpart == 0 && !select_hwpart)
|
||||||
|
|
Loading…
Add table
Reference in a new issue