All of lore.kernel.org
 help / color / mirror / Atom feed
From: tien.fong.chee at intel.com <tien.fong.chee@intel.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v10 2/4] cmd: ubifs: Move ubifs_initialized checking into cmd_ubifs_umount()
Date: Mon,  5 Mar 2018 17:43:36 +0800	[thread overview]
Message-ID: <1520243018-105509-3-git-send-email-tien.fong.chee@intel.com> (raw)
In-Reply-To: <1520243018-105509-1-git-send-email-tien.fong.chee@intel.com>

From: Tien Fong Chee <tien.fong.chee@intel.com>

cmd_ubifs_umount() function would be called directly instead of involving
whole command machinery in generic firmware loader, so checking on
ubifs_initialized status need to be done in cmd_ubifs_umount() without
breaking original functionality design.

Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com>
Reviewed-by: Marek Vasut <marex@denx.de>
---
 cmd/ubifs.c         | 18 +++++++++---------
 include/ubi_uboot.h |  1 +
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/cmd/ubifs.c b/cmd/ubifs.c
index 5e9d357..0d059ca 100644
--- a/cmd/ubifs.c
+++ b/cmd/ubifs.c
@@ -51,11 +51,18 @@ int ubifs_is_mounted(void)
 	return ubifs_mounted;
 }
 
-void cmd_ubifs_umount(void)
+int cmd_ubifs_umount(void)
 {
+	if (ubifs_initialized == 0) {
+		printf("No UBIFS volume mounted!\n");
+		return -1;
+	}
+
 	uboot_ubifs_umount();
 	ubifs_mounted = 0;
 	ubifs_initialized = 0;
+
+	return 0;
 }
 
 static int do_ubifs_umount(cmd_tbl_t *cmdtp, int flag, int argc,
@@ -64,14 +71,7 @@ static int do_ubifs_umount(cmd_tbl_t *cmdtp, int flag, int argc,
 	if (argc != 1)
 		return CMD_RET_USAGE;
 
-	if (ubifs_initialized == 0) {
-		printf("No UBIFS volume mounted!\n");
-		return -1;
-	}
-
-	cmd_ubifs_umount();
-
-	return 0;
+	return cmd_ubifs_umount();
 }
 
 static int do_ubifs_ls(cmd_tbl_t *cmdtp, int flag, int argc,
diff --git a/include/ubi_uboot.h b/include/ubi_uboot.h
index 80acbcb..827dbfc 100644
--- a/include/ubi_uboot.h
+++ b/include/ubi_uboot.h
@@ -75,5 +75,6 @@ extern int ubi_volume_write(char *volume, void *buf, size_t size);
 extern int ubi_volume_read(char *volume, char *buf, size_t size);
 
 extern struct ubi_device *ubi_devices[];
+int cmd_ubifs_umount(void);
 
 #endif
-- 
2.2.0

  parent reply	other threads:[~2018-03-05  9:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-05  9:43 [U-Boot] [PATCH v10 0/4] Generic firmware loader tien.fong.chee at intel.com
2018-03-05  9:43 ` [U-Boot] [PATCH v10 1/4] spl: Remove static declaration on spl_mmc_find_device function tien.fong.chee at intel.com
2018-03-05  9:43 ` tien.fong.chee at intel.com [this message]
2018-03-05 14:34   ` [U-Boot] [PATCH v10 2/4] cmd: ubifs: Move ubifs_initialized checking into cmd_ubifs_umount() Tom Rini
2018-03-05  9:43 ` [U-Boot] [PATCH v10 3/4] cmd: ubifs: Factor out some checking codes into cmd_ubifs_mount() tien.fong.chee at intel.com
2018-03-05 14:34   ` Tom Rini
2018-03-05  9:43 ` [U-Boot] [PATCH v10 4/4] common: Generic firmware loader for file system tien.fong.chee at intel.com
2018-03-06 17:51   ` Simon Glass
2018-03-08  5:03     ` Chee, Tien Fong
2018-03-08 21:04       ` Simon Glass
2018-03-15  7:18         ` Chee, Tien Fong
2018-03-15 12:21           ` Tom Rini
2018-03-08 23:02       ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1520243018-105509-3-git-send-email-tien.fong.chee@intel.com \
    --to=tien.fong.chee@intel.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.