Skip to contentSkip to conversation

cmd: crosec: Move cros_ec_decode_region helper to cmd/cros_ec.c

PATCH New Moritz Fischer 2 participants 3 messages Nov 3, 2016 – Dec 3, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 cmd: crosec: Move cros_ec_decode_region helper to cmd/cros_ec.c

The cros_ec_decode_region() function is only used in combination with the crosec cmds. Move the function to the correct place.

Cc Simon Glass <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc u-boot at lists.denx.de

---

Changes from v1:

* make cros_ec_decode_region static
* move over the comments
* fixed commit message s/crosec/cros_ec/g

---
 cmd/cros_ec.c          | 23 +++++++++++++++++++++++
 drivers/misc/cros_ec.c | 16 ----------------
 include/cros_ec.h      |  9 ---------
 3 files changed, 23 insertions(+), 25 deletions(-)
cmd/cros_ec.c +23 -0
index abf11f0..9d42f87 100644
@@ -20,6 +20,29 @@ static const char * const ec_current_image_name[] = {"unknown", "RO", "RW"};
 DECLARE_GLOBAL_DATA_PTR;
 
 /**
+ * Decode a flash region parameter
+ *
+ * @param argc Number of params remaining
+ * @param argv List of remaining parameters
+ * @return flash region (EC_FLASH_REGION_...) or -1 on error
+ */
+static int cros_ec_decode_region(int argc, char * const argv[])
+{
+	if (argc > 0) {
+		if (0 == strcmp(*argv, "rw"))
+			return EC_FLASH_REGION_RW;
+		else if (0 == strcmp(*argv, "ro"))
+			return EC_FLASH_REGION_RO;
+
+		debug("%s: Invalid region '%s'\n", __func__, *argv);
+	} else {
+		debug("%s: Missing region parameter\n", __func__);
+	}
+
+	return -1;
+}
+
+/**
  * Perform a flash read or write command
  *
  * @param dev		CROS-EC device to read/write
drivers/misc/cros_ec.c +0 -16
index 8073730..759bb46 100644
@@ -1024,22 +1024,6 @@ int cros_ec_register(struct udevice *dev)
 	return 0;
 }
 
-int cros_ec_decode_region(int argc, char * const argv[])
-{
-	if (argc > 0) {
-		if (0 == strcmp(*argv, "rw"))
-			return EC_FLASH_REGION_RW;
-		else if (0 == strcmp(*argv, "ro"))
-			return EC_FLASH_REGION_RO;
-
-		debug("%s: Invalid region '%s'\n", __func__, *argv);
-	} else {
-		debug("%s: Missing region parameter\n", __func__);
-	}
-
-	return -1;
-}
-
 int cros_ec_decode_ec_flash(const void *blob, int node,
 			    struct fdt_cros_ec *config)
 {
include/cros_ec.h +0 -9
index ec7517c..0271f2b 100644
@@ -250,15 +250,6 @@ void cros_ec_dump_data(const char *name, int cmd, const uint8_t *data, int len);
  */
 int cros_ec_calc_checksum(const uint8_t *data, int size);
 
-/**
- * Decode a flash region parameter
- *
- * @param argc	Number of params remaining
- * @param argv	List of remaining parameters
- * @return flash region (EC_FLASH_REGION_...) or -1 on error
- */
-int cros_ec_decode_region(int argc, char * const argv[]);
-
 int cros_ec_flash_erase(struct cros_ec_dev *dev, uint32_t offset,
 		uint32_t size);
 
Signature · 1 line
2.10.0
#1 lore raw

PATCH v2 1/1 cmd: crosec: Move cros_ec_decode_region helper to cmd/cros_ec.c

Quoted 15 lines · Moritz Fischer

The cros_ec_decode_region() function is only used in combination with the crosec cmds. Move the function to the correct place.

Cc Simon Glass <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc u-boot at lists.denx.de

---

Changes from v1:

* make cros_ec_decode_region static
* move over the comments
* fixed commit message s/crosec/cros_ec/g

Quoted 5 lines
---
 cmd/cros_ec.c          | 23 +++++++++++++++++++++++
 drivers/misc/cros_ec.c | 16 ----------------
 include/cros_ec.h      |  9 ---------
 3 files changed, 23 insertions(+), 25 deletions(-)
#2 lore raw

PATCH v2 1/1 cmd: crosec: Move cros_ec_decode_region helper to cmd/cros_ec.c

Quoted 16 lines · Simon Glass
Quoted 15 lines · Moritz Fischer

The cros_ec_decode_region() function is only used in combination with the crosec cmds. Move the function to the correct place.

Cc Simon Glass <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc u-boot at lists.denx.de

---

Changes from v1:

* make cros_ec_decode_region static
* move over the comments
* fixed commit message s/crosec/cros_ec/g

Quoted 7 lines
Quoted 5 lines
---
 cmd/cros_ec.c          | 23 +++++++++++++++++++++++
 drivers/misc/cros_ec.c | 16 ----------------
 include/cros_ec.h      |  9 ---------
 3 files changed, 23 insertions(+), 25 deletions(-)

Applied to u-boot-dm, thanks!