]> www.infradead.org Git - mtd-utils.git/commitdiff
libubi: kill ubi_attach_mtd
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Thu, 23 Aug 2012 08:37:05 +0000 (11:37 +0300)
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Thu, 23 Aug 2012 08:37:05 +0000 (11:37 +0300)
The 'ubi_attach_mtd()' is not used and it is redundant now. 'ubi_attach()'
function may be used instead.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
ubi-utils/include/libubi.h
ubi-utils/libubi.c

index bbaa78c6fd94752eb5c1734ed539f5f4969ed6db..62fb5dd27f8f3b27896c9f26fd162fa971a619d3 100644 (file)
@@ -210,28 +210,14 @@ int ubi_get_info(libubi_t desc, struct ubi_info *info);
 int mtd_num2ubi_dev(libubi_t desc, int mtd_num, int *dev_num);
 
 /**
- * ubi_attach_mtd - attach MTD device to UBI.
- * @desc: UBI library descriptor
- * @node: name of the UBI control character device node
- * @req: MTD attach request.
- *
- * This function creates a new UBI device by attaching an MTD device as
- * described by @req. Returns %0 in case of success and %-1 in case of failure.
- * The newly created UBI device number is returned in @req->dev_num.
- */
-int ubi_attach_mtd(libubi_t desc, const char *node,
-                  struct ubi_attach_request *req);
-
-/**
- * ubi_attach - attach an MTD device by its node path.
+ * ubi_attach - attach an MTD device by its node path or bt MTD device number
  * @desc: UBI library descriptor
  * @node: name of the UBI control character device node
  * @req: MTD attach request
  *
  * This function creates new UBI device by attaching an MTD device described by
  * @req. If @req->mtd_dev_node is given it should contain path to the MTD
- * device node. Otherwise functionality is similar than in function
- * 'ubi_attach_mtd()' where @req->mtd_num is used.
+ * device node. Otherwise @req->mtd_num will be used.
  *
  * Returns %0 in case of success and %-1 in case of failure (errno is set).
  * The newly created UBI device number is returned in @req->dev_num.
index dec72c76b7220616fbe7aeba7f24b85b3aa38fea..14719f1e962529d758b2a7ce501fe953897b770e 100644 (file)
@@ -707,26 +707,6 @@ static int do_attach(const char *node, const struct ubi_attach_req *r)
        return ret;
 }
 
-int ubi_attach_mtd(libubi_t desc, const char *node,
-                  struct ubi_attach_request *req)
-{
-       struct ubi_attach_req r;
-       int ret;
-
-       (void)desc;
-
-       memset(&r, 0, sizeof(struct ubi_attach_req));
-       r.ubi_num = req->dev_num;
-       r.mtd_num = req->mtd_num;
-       r.vid_hdr_offset = req->vid_hdr_offset;
-
-       ret = do_attach(node, &r);
-       if (ret == 0)
-               req->dev_num = r.ubi_num;
-
-       return ret;
-}
-
 #ifndef MTD_CHAR_MAJOR
 /*
  * This is taken from kernel <linux/mtd/mtd.h> and is unlikely to change anytime
@@ -770,6 +750,11 @@ static int mtd_node_to_num(const char *mtd_dev_node)
 
 int ubi_attach(libubi_t desc, const char *node, struct ubi_attach_request *req)
 {
+       struct ubi_attach_req r;
+       int ret;
+
+       (void)desc;
+
        if (req->mtd_dev_node) {
                /*
                 * User has passed path to device node. Lets find out MTD
@@ -779,7 +764,17 @@ int ubi_attach(libubi_t desc, const char *node, struct ubi_attach_request *req)
                if (req->mtd_num == -1)
                        return -1;
        }
-       return ubi_attach_mtd(desc, node, req);
+
+       memset(&r, 0, sizeof(struct ubi_attach_req));
+       r.ubi_num = req->dev_num;
+       r.mtd_num = req->mtd_num;
+       r.vid_hdr_offset = req->vid_hdr_offset;
+
+       ret = do_attach(node, &r);
+       if (ret == 0)
+               req->dev_num = r.ubi_num;
+
+       return ret;
 }
 
 int ubi_detach_mtd(libubi_t desc, const char *node, int mtd_num)