mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-20 20:04:46 +00:00
sandbox: blk: Switch to use platdata_auto_alloc_size for the driver data
Currently the sandbox block driver uses priv_auto_alloc_size for the driver data, however that's only available after the device probe phase. In order to make it accessible in an earlier phase, switch to use platdata_auto_alloc_size instead. This patch is the prerequisite for the follow up patch of DM BLK driver changes to work with Sandbox. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
fa583f86c9
commit
8f994c860d
1 changed files with 8 additions and 7 deletions
|
@ -33,7 +33,7 @@ static unsigned long host_block_read(struct udevice *dev,
|
||||||
unsigned long start, lbaint_t blkcnt,
|
unsigned long start, lbaint_t blkcnt,
|
||||||
void *buffer)
|
void *buffer)
|
||||||
{
|
{
|
||||||
struct host_block_dev *host_dev = dev_get_priv(dev);
|
struct host_block_dev *host_dev = dev_get_platdata(dev);
|
||||||
struct blk_desc *block_dev = dev_get_uclass_platdata(dev);
|
struct blk_desc *block_dev = dev_get_uclass_platdata(dev);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -64,7 +64,7 @@ static unsigned long host_block_write(struct udevice *dev,
|
||||||
unsigned long start, lbaint_t blkcnt,
|
unsigned long start, lbaint_t blkcnt,
|
||||||
const void *buffer)
|
const void *buffer)
|
||||||
{
|
{
|
||||||
struct host_block_dev *host_dev = dev_get_priv(dev);
|
struct host_block_dev *host_dev = dev_get_platdata(dev);
|
||||||
struct blk_desc *block_dev = dev_get_uclass_platdata(dev);
|
struct blk_desc *block_dev = dev_get_uclass_platdata(dev);
|
||||||
#else
|
#else
|
||||||
static unsigned long host_block_write(struct blk_desc *block_dev,
|
static unsigned long host_block_write(struct blk_desc *block_dev,
|
||||||
|
@ -131,16 +131,17 @@ int host_dev_bind(int devnum, char *filename)
|
||||||
os_lseek(fd, 0, OS_SEEK_END) / 512, &dev);
|
os_lseek(fd, 0, OS_SEEK_END) / 512, &dev);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_file;
|
goto err_file;
|
||||||
|
|
||||||
|
host_dev = dev_get_platdata(dev);
|
||||||
|
host_dev->fd = fd;
|
||||||
|
host_dev->filename = fname;
|
||||||
|
|
||||||
ret = device_probe(dev);
|
ret = device_probe(dev);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
device_unbind(dev);
|
device_unbind(dev);
|
||||||
goto err_file;
|
goto err_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
host_dev = dev_get_priv(dev);
|
|
||||||
host_dev->fd = fd;
|
|
||||||
host_dev->filename = fname;
|
|
||||||
|
|
||||||
return blk_prepare_device(dev);
|
return blk_prepare_device(dev);
|
||||||
err_file:
|
err_file:
|
||||||
os_close(fd);
|
os_close(fd);
|
||||||
|
@ -226,7 +227,7 @@ U_BOOT_DRIVER(sandbox_host_blk) = {
|
||||||
.name = "sandbox_host_blk",
|
.name = "sandbox_host_blk",
|
||||||
.id = UCLASS_BLK,
|
.id = UCLASS_BLK,
|
||||||
.ops = &sandbox_host_blk_ops,
|
.ops = &sandbox_host_blk_ops,
|
||||||
.priv_auto_alloc_size = sizeof(struct host_block_dev),
|
.platdata_auto_alloc_size = sizeof(struct host_block_dev),
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
U_BOOT_LEGACY_BLK(sandbox_host) = {
|
U_BOOT_LEGACY_BLK(sandbox_host) = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue