summaryrefslogtreecommitdiff
path: root/drivers/dfu
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2020-12-22 11:32:20 +0100
committerMarek Vasut <marex@denx.de>2021-01-31 14:08:56 +0100
commitf21358ad6cb5d39fff432fa0af0c4fd24288b2b7 (patch)
treef704a6adf705e6b5606cc1c9a5e56aaa5b9c73c7 /drivers/dfu
parentc954ff5fbffbb164f1a34127eae78e7fd86180d0 (diff)
downloadu-boot-f21358ad6cb5d39fff432fa0af0c4fd24288b2b7.tar.gz
dfu: mmc: use the default MMC device if entity specifies it as -1
Use the default MMC device set in the command line if entity specifies it as -1. This allows to use the same dfu_alt_info string for different MMC devices (like embedded eMMC and external SD card if data layout is the same on both devices). Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Diffstat (limited to 'drivers/dfu')
-rw-r--r--drivers/dfu/dfu_mmc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index 691d01c7eb..784d0ec76b 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -316,7 +316,7 @@ void dfu_free_entity_mmc(struct dfu_entity *dfu)
int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr, char *s)
{
const char *entity_type;
- size_t second_arg;
+ ssize_t second_arg;
size_t third_arg;
struct mmc *mmc;
@@ -339,7 +339,7 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr, char *s)
* Base 0 means we'll accept (prefixed with 0x or 0) base 16, 8,
* with default 10.
*/
- second_arg = simple_strtoul(argv[1], NULL, 0);
+ second_arg = simple_strtol(argv[1], NULL, 0);
third_arg = simple_strtoul(argv[2], NULL, 0);
mmc = find_mmc_device(dfu->data.mmc.dev_num);
@@ -406,7 +406,8 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr, char *s)
/* if it's NOT a raw write */
if (strcmp(entity_type, "raw")) {
- dfu->data.mmc.dev = second_arg;
+ dfu->data.mmc.dev = (second_arg != -1) ? second_arg :
+ dfu->data.mmc.dev_num;
dfu->data.mmc.part = third_arg;
}