From 257ad252e70a7b65f11f7f006416a76e4498f3d2 Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Thu, 23 Aug 2012 11:37:05 +0300 Subject: libubi: kill ubi_attach_mtd The 'ubi_attach_mtd()' is not used and it is redundant now. 'ubi_attach()' function may be used instead. Signed-off-by: Artem Bityutskiy --- ubi-utils/libubi.c | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) (limited to 'ubi-utils/libubi.c') diff --git a/ubi-utils/libubi.c b/ubi-utils/libubi.c index dec72c7..14719f1 100644 --- a/ubi-utils/libubi.c +++ b/ubi-utils/libubi.c @@ -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 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) -- cgit v1.2.3