]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mmc: Use logging instead of pr_err()
authorSimon Glass <sjg@chromium.org>
Thu, 22 Aug 2024 13:54:55 +0000 (07:54 -0600)
committerTom Rini <trini@konsulko.com>
Fri, 23 Aug 2024 21:58:41 +0000 (15:58 -0600)
Use the log subsystem instead of dev, to avoid including function names
in the code.

The CONFIG_LOGF_FUNC option can be used to enable the function name.

Update 'enhanced size' to use hex since this is the U-Boot default and
more natural for the large numbers involved.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
drivers/mmc/mmc.c

index cf8277cbed863ef3882f7abf10aa6bd66662074f..9644aa7aa4334ddc6a5d8904bd5233345eb65160 100644 (file)
@@ -294,7 +294,7 @@ int mmc_poll_for_busy(struct mmc *mmc, int timeout_ms)
 
                if (status & MMC_STATUS_MASK) {
 #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
-                       pr_err("Status Error: 0x%08x\n", status);
+                       log_err("Status Error: %#08x\n", status);
 #endif
                        return -ECOMM;
                }
@@ -307,7 +307,7 @@ int mmc_poll_for_busy(struct mmc *mmc, int timeout_ms)
 
        if (timeout_ms <= 0) {
 #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
-               pr_err("Timeout waiting card ready\n");
+               log_err("Timeout waiting card ready\n");
 #endif
                return -ETIMEDOUT;
        }
@@ -449,7 +449,7 @@ static int mmc_read_blocks(struct mmc *mmc, void *dst, lbaint_t start,
        if (blkcnt > 1) {
                if (mmc_send_stop_transmission(mmc, false)) {
 #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
-                       pr_err("mmc fail to send stop cmd\n");
+                       log_err("mmc fail to send stop cmd\n");
 #endif
                        return 0;
                }
@@ -500,8 +500,8 @@ ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
 
        if ((start + blkcnt) > block_dev->lba) {
 #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
-               pr_err("MMC: block number 0x" LBAF " exceeds max(0x" LBAF ")\n",
-                      start + blkcnt, block_dev->lba);
+               log_err("MMC: block number 0x" LBAF " exceeds max(0x" LBAF ")\n",
+                       start + blkcnt, block_dev->lba);
 #endif
                return 0;
        }
@@ -996,7 +996,7 @@ static int mmc_get_capabilities(struct mmc *mmc)
                return 0;
 
        if (!ext_csd) {
-               pr_err("No ext_csd found!\n"); /* this should enver happen */
+               log_err("No ext_csd found!\n"); /* this should never happen */
                return -ENOTSUPP;
        }
 
@@ -1108,17 +1108,17 @@ int mmc_hwpart_config(struct mmc *mmc,
                return -EINVAL;
 
        if (IS_SD(mmc) || (mmc->version < MMC_VERSION_4_41)) {
-               pr_err("eMMC >= 4.4 required for enhanced user data area\n");
+               log_err("eMMC >= 4.4 required for enhanced user data area\n");
                return -EMEDIUMTYPE;
        }
 
        if (!(mmc->part_support & PART_SUPPORT)) {
-               pr_err("Card does not support partitioning\n");
+               log_err("Card does not support partitioning\n");
                return -EMEDIUMTYPE;
        }
 
        if (!mmc->hc_wp_grp_size) {
-               pr_err("Card does not define HC WP group size\n");
+               log_err("Card does not define HC WP group size\n");
                return -EMEDIUMTYPE;
        }
 
@@ -1126,8 +1126,7 @@ int mmc_hwpart_config(struct mmc *mmc,
        if (conf->user.enh_size) {
                if (conf->user.enh_size % mmc->hc_wp_grp_size ||
                    conf->user.enh_start % mmc->hc_wp_grp_size) {
-                       pr_err("User data enhanced area not HC WP group "
-                              "size aligned\n");
+                       log_err("User data enhanced area not HC WP group size aligned\n");
                        return -EINVAL;
                }
                part_attrs |= EXT_CSD_ENH_USR;
@@ -1145,8 +1144,8 @@ int mmc_hwpart_config(struct mmc *mmc,
 
        for (pidx = 0; pidx < 4; pidx++) {
                if (conf->gp_part[pidx].size % mmc->hc_wp_grp_size) {
-                       pr_err("GP%i partition not HC WP group size "
-                              "aligned\n", pidx+1);
+                       log_err("GP%i partition not HC WP group-size aligned\n",
+                               pidx + 1);
                        return -EINVAL;
                }
                gp_size_mult[pidx] = conf->gp_part[pidx].size / mmc->hc_wp_grp_size;
@@ -1157,7 +1156,7 @@ int mmc_hwpart_config(struct mmc *mmc,
        }
 
        if (part_attrs && ! (mmc->part_support & ENHNCD_SUPPORT)) {
-               pr_err("Card does not support enhanced attribute\n");
+               log_err("Card does not support enhanced attribute\n");
                return -EMEDIUMTYPE;
        }
 
@@ -1170,8 +1169,8 @@ int mmc_hwpart_config(struct mmc *mmc,
                (ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT+1] << 8) +
                ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT];
        if (tot_enh_size_mult > max_enh_size_mult) {
-               pr_err("Total enhanced size exceeds maximum (%u > %u)\n",
-                      tot_enh_size_mult, max_enh_size_mult);
+               log_err("Total enhanced size exceeds maximum (%#x > %#x)\n",
+                       tot_enh_size_mult, max_enh_size_mult);
                return -EMEDIUMTYPE;
        }
 
@@ -1204,7 +1203,7 @@ int mmc_hwpart_config(struct mmc *mmc,
 
        if (ext_csd[EXT_CSD_PARTITION_SETTING] &
            EXT_CSD_PARTITION_SETTING_COMPLETED) {
-               pr_err("Card already partitioned\n");
+               log_err("Card already partitioned\n");
                return -EPERM;
        }
 
@@ -1875,7 +1874,7 @@ error:
                }
        }
 
-       pr_err("unable to select a mode\n");
+       log_err("unable to select a mode\n");
        return -ENOTSUPP;
 }
 
@@ -2253,7 +2252,7 @@ error:
                }
        }
 
-       pr_err("unable to select a mode : %d\n", err);
+       log_err("unable to select a mode: %d\n", err);
 
        return -ENOTSUPP;
 }
@@ -2921,7 +2920,8 @@ retry:
                if (err) {
 #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
                        if (!quiet)
-                               pr_err("Card did not respond to voltage select! : %d\n", err);
+                               log_err("Card did not respond to voltage select! : %d\n",
+                                       err);
 #endif
                        return -EOPNOTSUPP;
                }
@@ -2954,7 +2954,7 @@ int mmc_start_init(struct mmc *mmc)
                                                   | MMC_CAP(MMC_LEGACY) |
                                                   MMC_MODE_1BIT);
                        } else {
-                               pr_err("bus_mode requested is not supported\n");
+                               log_err("bus_mode requested is not supported\n");
                                return -EINVAL;
                        }
                }
@@ -2974,7 +2974,7 @@ int mmc_start_init(struct mmc *mmc)
        if (no_card) {
                mmc->has_init = 0;
 #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
-               pr_err("MMC: no card present\n");
+               log_err("MMC: no card present\n");
 #endif
                return -ENOMEDIUM;
        }
@@ -3103,7 +3103,7 @@ static int mmc_probe(struct bd_info *bis)
        uclass_foreach_dev(dev, uc) {
                ret = device_probe(dev);
                if (ret)
-                       pr_err("%s - probe failed: %d\n", dev->name, ret);
+                       log_err("%s - probe failed: %d\n", dev->name, ret);
        }
 
        return 0;