All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Stephan <jstephan@baylibre.com>
To: u-boot@lists.u-boot-project.org
Cc: GSS_MTK_Uboot_upstream <GSS_MTK_Uboot_upstream@mediatek.com>,
	 Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>,
	 Julien Stephan <jstephan@baylibre.com>,
	 "Markus Schneider-Pargmann (TI)" <msp@baylibre.com>,
	dlechner@baylibre.com
Subject: [PATCH v2 0/3] Improve logging on missing uclass
Date: Mon, 24 Aug 2026 10:44:15 +0200	[thread overview]
Message-ID: <20260824-improve-logging-on-missing-uclass-v2-0-4bee2cdff72b@baylibre.com> (raw)

While writing a MISC driver, I forgot to enable CONFIG_MISC. The only thing
I got at boot was the following obscure error, with no hint about the root
cause:

  initcall_run_r(): initcall initr_dm() failed
  ### ERROR ### Please RESET the board ###

Commit 3346c87625b8 ("dm: Improve handling of a missing uclass") already
tried to improve this case by returning a strange error code and adding a
debug message. But since neither the debug message nor the return code are
displayed by default, it was not very helpful in practice.

This series improves the situation in a few ways:
 - a new dm_err() helper logs driver model errors at ERROR level, and the
   boolean DM_WARN option becomes a per-stage log verbosity choice
   (DM_NONE / DM_ERR / DM_WARN) with errors emitted by default. Note that
   a disabled level is not removed entirely but degraded to DEBUG level,
   which is compiled out by default, so even DM_NONE can still emit these
   messages as debug output when debug logging is enabled;
 - the missing-uclass message now uses dm_err(), so it shows up by default,
   with a shorter string to limit the code-size overhead;
 - the initcall failure now prints the actual error code (and its string
   when ERRNO_STR is enabled), for both INITCALL() and INITCALL_EVT().

The existing DM_DEBUG option is left as-is for now: it works differently
(it adds -DDEBUG to drivers/core/ via the Makefile and is not phase-aware).
Unifying it into the new choice, along with converting the DM core debug()
statements to log() as suggested in the "To Do" section of
doc/develop/logging.rst, could be a follow-up series.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
---
Changes in v2:
- dm: replace the boolean DM_WARN option with a per-stage log verbosity
  choice (DM_NONE / DM_ERR / DM_WARN) and add a dm_err() helper, rather
  than logging the missing-uclass message with a hardcoded log() call
  (suggested by Simon)
- dm: de-duplicate the util.h helpers to only select the log level
  (suggested by Simon)
- dm: split the change into the generic mechanism and its user in uclass.c
- dm: shorten the missing-uclass message to limit the SPL/TPL size overhead
- initcall: use the %dE format so no dangling ": " is printed when
  ERRNO_STR is disabled, and give INITCALL_EVT() the same treatment
- Link to v1: https://patch.msgid.link/20260806-improve-logging-on-missing-uclass-v1-0-d477f0054f48@baylibre.com

To: u-boot@lists.u-boot-project.org
Cc: GSS_MTK_Uboot_upstream <GSS_MTK_Uboot_upstream@mediatek.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: "Markus Schneider-Pargmann (TI)" <msp@baylibre.com>
Cc: Julien Stephan <jstephan@baylibre.com>

---
Julien Stephan (3):
      dm: add dm_err() and a driver model log verbosity choice
      dm: uclass: use dm_err() for a missing uclass
      initcall: initcall_evt: display error code on error

 drivers/core/Kconfig  | 75 ++++++++++++++++++++++++++++++++++++++++++---------
 drivers/core/uclass.c |  3 +--
 include/dm/util.h     | 19 +++++++++++--
 include/initcall.h    | 14 +++++-----
 4 files changed, 88 insertions(+), 23 deletions(-)
---
base-commit: f562ed02aa7ae4dc2775d90d2e6c40bab82e2715
change-id: 20260806-improve-logging-on-missing-uclass-a76c46acfa13

Best regards,
--  
Julien Stephan <jstephan@baylibre.com>


             reply	other threads:[~2026-08-24  8:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-24  8:44 Julien Stephan [this message]
2026-08-24  8:44 ` [PATCH v2 1/3] dm: add dm_err() and a driver model log verbosity choice Julien Stephan
2026-08-24  8:44 ` [PATCH v2 2/3] dm: uclass: use dm_err() for a missing uclass Julien Stephan
2026-08-24  8:44 ` [PATCH v2 3/3] initcall: initcall_evt: display error code on error Julien Stephan
2026-09-03 22:56 ` [PATCH v2 0/3] Improve logging on missing uclass Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260824-improve-logging-on-missing-uclass-v2-0-4bee2cdff72b@baylibre.com \
    --to=jstephan@baylibre.com \
    --cc=GSS_MTK_Uboot_upstream@mediatek.com \
    --cc=dlechner@baylibre.com \
    --cc=msp@baylibre.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.u-boot-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.