mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-20 03:38:43 +00:00
API: Correct storage enumeration routine, other minor fixes in API storage area.
Signed-off-by: Rafal Czubak <rcz@semihalf.com> Acked-by: Rafal Jaworowski <raj@semihalf.com>
This commit is contained in:
parent
05c7fe0f04
commit
13ca6305f2
1 changed files with 11 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* (C) Copyright 2007 Semihalf
|
* (C) Copyright 2007-2008 Semihalf
|
||||||
*
|
*
|
||||||
* Written by: Rafal Jaworowski <raj@semihalf.com>
|
* Written by: Rafal Jaworowski <raj@semihalf.com>
|
||||||
*
|
*
|
||||||
|
@ -53,7 +53,7 @@ struct stor_spec {
|
||||||
int enum_started;
|
int enum_started;
|
||||||
int enum_ended;
|
int enum_ended;
|
||||||
int type; /* "external" type: DT_STOR_{IDE,USB,etc} */
|
int type; /* "external" type: DT_STOR_{IDE,USB,etc} */
|
||||||
char name[4];
|
char *name;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct stor_spec specs[ENUM_MAX] = { { 0, 0, 0, 0, "" }, };
|
static struct stor_spec specs[ENUM_MAX] = { { 0, 0, 0, 0, "" }, };
|
||||||
|
@ -108,6 +108,9 @@ static int dev_stor_get(int type, int first, int *more, struct device_info *di)
|
||||||
|
|
||||||
if (first) {
|
if (first) {
|
||||||
di->cookie = (void *)get_dev(specs[type].name, 0);
|
di->cookie = (void *)get_dev(specs[type].name, 0);
|
||||||
|
if (di->cookie == NULL)
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
found = 1;
|
found = 1;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -123,6 +126,9 @@ static int dev_stor_get(int type, int first, int *more, struct device_info *di)
|
||||||
}
|
}
|
||||||
|
|
||||||
di->cookie = (void *)get_dev(specs[type].name, i);
|
di->cookie = (void *)get_dev(specs[type].name, i);
|
||||||
|
if (di->cookie == NULL)
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
found = 1;
|
found = 1;
|
||||||
|
|
||||||
/* provide hint if there are more devices in
|
/* provide hint if there are more devices in
|
||||||
|
@ -360,7 +366,7 @@ lbasize_t dev_read_stor(void *cookie, void *buf, lbasize_t len, lbastart_t start
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ((dd->block_read) == NULL) {
|
if ((dd->block_read) == NULL) {
|
||||||
debugf("no block_read() for device 0x%08x\n");
|
debugf("no block_read() for device 0x%08x\n", cookie);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue