Message ID | 1477706250-7104-1-git-send-email-moritz.fischer@ettus.com |
---|---|
State | Superseded |
Delegated to: | Simon Glass |
Headers | show |
Hi Moritz, On 28 October 2016 at 19:57, Moritz Fischer <moritz.fischer@ettus.com> wrote: > The cros_ec_decode_region() function is only used in combination > with the crosec cmds. Move the function to the correct place. > > Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com> > Cc: Simon Glass <sjg@chromium.org> > Cc: Masahiro Yamada <yamada.masahiro@socionext.com> > Cc: u-boot@lists.denx.de > --- > cmd/cros_ec.c | 16 ++++++++++++++++ > drivers/misc/cros_ec.c | 16 ---------------- > include/cros_ec.h | 9 --------- > 3 files changed, 16 insertions(+), 25 deletions(-) > > diff --git a/cmd/cros_ec.c b/cmd/cros_ec.c > index abf11f0..3a45149 100644 > --- a/cmd/cros_ec.c > +++ b/cmd/cros_ec.c > @@ -19,6 +19,22 @@ static const char * const ec_current_image_name[] = {"unknown", "RO", "RW"}; > > DECLARE_GLOBAL_DATA_PTR; > > +int cros_ec_decode_region(int argc, char * const argv[]) Can this be static? Also can you please bring in the comment from the header file? > +{ > + 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 > * > diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c > index 9159498..cf851ff 100644 > --- a/drivers/misc/cros_ec.c > +++ b/drivers/misc/cros_ec.c > @@ -1070,22 +1070,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) > { > diff --git a/include/cros_ec.h b/include/cros_ec.h > index f280c1d..26b4680 100644 > --- a/include/cros_ec.h > +++ b/include/cros_ec.h > @@ -252,15 +252,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); > > -- > 2.7.4 > Regards, Simon
diff --git a/cmd/cros_ec.c b/cmd/cros_ec.c index abf11f0..3a45149 100644 --- a/cmd/cros_ec.c +++ b/cmd/cros_ec.c @@ -19,6 +19,22 @@ static const char * const ec_current_image_name[] = {"unknown", "RO", "RW"}; DECLARE_GLOBAL_DATA_PTR; +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 * diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c index 9159498..cf851ff 100644 --- a/drivers/misc/cros_ec.c +++ b/drivers/misc/cros_ec.c @@ -1070,22 +1070,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) { diff --git a/include/cros_ec.h b/include/cros_ec.h index f280c1d..26b4680 100644 --- a/include/cros_ec.h +++ b/include/cros_ec.h @@ -252,15 +252,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);
The cros_ec_decode_region() function is only used in combination with the crosec cmds. Move the function to the correct place. Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com> Cc: Simon Glass <sjg@chromium.org> Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Cc: u-boot@lists.denx.de --- cmd/cros_ec.c | 16 ++++++++++++++++ drivers/misc/cros_ec.c | 16 ---------------- include/cros_ec.h | 9 --------- 3 files changed, 16 insertions(+), 25 deletions(-)