#include <os.h>
#include <malloc.h>
#include <sandboxblockdev.h>
-#include <asm/errno.h>
+#include <linux/errno.h>
#include <dm/device-internal.h>
DECLARE_GLOBAL_DATA_PTR;
/* Remove and unbind the old device, if any */
ret = blk_get_device(IF_TYPE_HOST, devnum, &dev);
if (ret == 0) {
- ret = device_remove(dev);
+ ret = device_remove(dev, DM_REMOVE_NORMAL);
if (ret)
return ret;
ret = device_unbind(dev);
return 0;
}
-struct blk_desc *host_get_dev(int dev)
-{
- struct blk_desc *blk_dev;
-
- if (host_get_dev_err(dev, &blk_dev))
- return NULL;
-
- return blk_dev;
-}
-
#ifdef CONFIG_BLK
static const struct blk_ops sandbox_host_blk_ops = {
.read = host_block_read,
.ops = &sandbox_host_blk_ops,
.priv_auto_alloc_size = sizeof(struct host_block_dev),
};
+#else
+U_BOOT_LEGACY_BLK(sandbox_host) = {
+ .if_typename = "host",
+ .if_type = IF_TYPE_HOST,
+ .max_devs = CONFIG_HOST_MAX_DEVICES,
+ .get_dev = host_get_dev_err,
+};
#endif