]> git.sur5r.net Git - u-boot/blobdiff - drivers/block/sandbox.c
dm: core: Add logging of some common errors
[u-boot] / drivers / block / sandbox.c
index 2b6a89333b5a66caeb848c37fe080ab9e1cf1a3a..0392437309e71f5dc0077bf90c5a8e7f8507a307 100644 (file)
@@ -1,7 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2013 Henrik Nordstrom <henrik@henriknordstrom.net>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -12,7 +11,7 @@
 #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;
@@ -98,7 +97,7 @@ int host_dev_bind(int devnum, char *filename)
        /* 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);
@@ -129,7 +128,7 @@ int host_dev_bind(int devnum, char *filename)
        }
        ret = blk_create_device(gd->dm_root, "sandbox_host_blk", str,
                                IF_TYPE_HOST, devnum, 512,
-                               os_lseek(fd, 0, OS_SEEK_END), &dev);
+                               os_lseek(fd, 0, OS_SEEK_END) / 512, &dev);
        if (ret)
                goto err_file;
        ret = device_probe(dev);
@@ -217,16 +216,6 @@ int host_get_dev_err(int devnum, struct blk_desc **blk_devp)
        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,