[PATCH v3 06/15] mmc: Use logging instead of printf()
Simon Glass
sjg at chromium.org
Tue Aug 13 14:17:03 CEST 2024
Hi Quentin,
On Mon, 12 Aug 2024 at 03:35, Quentin Schulz <quentin.schulz at cherry.de> wrote:
>
> Hi Simon,
>
> On 8/11/24 2:29 PM, Simon Glass wrote:
> > The code makes quite a few uses of __func__ which puts the function
> > name into the resulting SPL image. Use the log subsystem instead, to
> > reduce size.
> >
> > The CONFIG_LOGF_FUNC option can be used to enable the function name.
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
> >
> > Changes in v3:
> > - Keep hex prefix on values which currently have it
> > - Fix up the second parts of the 'mmc%d busy' log_warning()
> > - Restore the original error message for configuring DLL
> >
> > Changes in v2:
> > - Various updates to log messages
> > - Drop an unnecessary cast
> >
> > drivers/mmc/sdhci.c | 52 +++++++++++++++++++--------------------------
> > 1 file changed, 22 insertions(+), 30 deletions(-)
> >
> > diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
> > index 560b7e889c7..4833b5158c7 100644
> > --- a/drivers/mmc/sdhci.c
> > +++ b/drivers/mmc/sdhci.c
> > @@ -32,8 +32,7 @@ static void sdhci_reset(struct sdhci_host *host, u8 mask)
> > sdhci_writeb(host, mask, SDHCI_SOFTWARE_RESET);
> > while (sdhci_readb(host, SDHCI_SOFTWARE_RESET) & mask) {
> > if (timeout == 0) {
> > - printf("%s: Reset 0x%x never completed.\n",
> > - __func__, (int)mask);
> > + log_warning("Reset %#x never completed\n", mask);
>
> TIL about %#x thanks :)
>
> > return;
> > }
> > timeout--;
> > @@ -139,8 +138,7 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data)
> > do {
> > stat = sdhci_readl(host, SDHCI_INT_STATUS);
> > if (stat & SDHCI_INT_ERROR) {
> > - pr_debug("%s: Error detected in status(0x%X)!\n",
> > - __func__, stat);
> > + log_debug("Error detected in status(%#x)!\n", stat);
>
> It used to be uppercase and is now lowercase, though %#X would probably
> do the job too (albeit it would apparently write 0X prefix instead of 0x).
Right, but we should use lower-case hex in U-Boot.
>
> Otherwise looks good to me,
>
> Reviewed-by: Quentin Schulz <quentin.schulz at cherry.de>
>
> Thanks!
> Quentin
Regards,
Simon
More information about the U-Boot
mailing list