All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Improve logging on missing uclass
@ 2026-08-24  8:44 Julien Stephan
  2026-08-24  8:44 ` [PATCH v2 1/3] dm: add dm_err() and a driver model log verbosity choice Julien Stephan
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Julien Stephan @ 2026-08-24  8:44 UTC (permalink / raw)
  To: u-boot
  Cc: GSS_MTK_Uboot_upstream, Simon Glass, Tom Rini, Julien Stephan,
	Markus Schneider-Pargmann (TI), dlechner

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>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-09-03 22:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-24  8:44 [PATCH v2 0/3] Improve logging on missing uclass Julien Stephan
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

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.