Commit df348d8245922adbb03a3a979429c5e70342973c

Authored by Stephen Warren
Committed by Pantelis Antoniou
1 parent d235628434

cmd_mmc: use new mmc_select_hwpart() function

The implementation of mmc_select_hwpart() was cribbed from do_mmcops().
Update do_mmcops() to call mmc_select_hwpart() to avoid duplication.

<panto> Manual patch update due to patch order.

Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

Showing 1 changed file with 6 additions and 15 deletions Side-by-side Diff

... ... @@ -403,7 +403,7 @@
403 403 static int do_mmc_dev(cmd_tbl_t *cmdtp, int flag,
404 404 int argc, char * const argv[])
405 405 {
406   - int dev, part = -1;
  406 + int dev, part = -1, ret;
407 407 struct mmc *mmc;
408 408  
409 409 if (argc == 1) {
... ... @@ -427,20 +427,11 @@
427 427 return CMD_RET_FAILURE;
428 428  
429 429 if (part != -1) {
430   - int ret;
431   - if (mmc->part_config == MMCPART_NOAVAILABLE) {
432   - printf("Card doesn't support part_switch\n");
433   - return CMD_RET_FAILURE;
434   - }
435   -
436   - if (part != mmc->part_num) {
437   - ret = mmc_switch_part(dev, part);
438   - if (!ret)
439   - mmc->part_num = part;
440   -
441   - printf("switch to partitions #%d, %s\n",
442   - part, (!ret) ? "OK" : "ERROR");
443   - }
  430 + ret = mmc_select_hwpart(dev, part);
  431 + printf("switch to partitions #%d, %s\n",
  432 + part, (!ret) ? "OK" : "ERROR");
  433 + if (ret)
  434 + return 1;
444 435 }
445 436 curr_device = dev;
446 437 if (mmc->part_config == MMCPART_NOAVAILABLE)