Commit cce61fc428700a782f2f76b0f32b6112eeb99dfb

Authored by Simon Glass
1 parent 8109863f53

dm: devres: Convert to use logging

At present when CONFIG_DEBUG_DEVRES is enabled, U-Boot prints log messages
to the console with every devres allocation/free event. This causes most
tests to fail since the console output is not as expected.

In particular this prevents us from adding a device to sandbox which uses
devres in its bind method.

Move devres over to use U-Boot's logging feature instead, and add a new
category for devres.

Signed-off-by: Simon Glass <sjg@chromium.org>

Showing 2 changed files with 5 additions and 2 deletions Side-by-side Diff

drivers/core/devres.c
... ... @@ -7,6 +7,8 @@
7 7 * Copyright (c) 2006 Tejun Heo <teheo@suse.de>
8 8 */
9 9  
  10 +#define LOG_CATEGORY LOGC_DEVRES
  11 +
10 12 #include <common.h>
11 13 #include <linux/compat.h>
12 14 #include <linux/kernel.h>
... ... @@ -46,8 +48,8 @@
46 48 static void devres_log(struct udevice *dev, struct devres *dr,
47 49 const char *op)
48 50 {
49   - printf("%s: DEVRES %3s %p %s (%lu bytes)\n",
50   - dev->name, op, dr, dr->name, (unsigned long)dr->size);
  51 + log_debug("%s: DEVRES %3s %p %s (%lu bytes)\n", dev->name, op, dr,
  52 + dr->name, (unsigned long)dr->size);
51 53 }
52 54 #else /* CONFIG_DEBUG_DEVRES */
53 55 #define set_node_dbginfo(dr, n, s) do {} while (0)
... ... @@ -49,6 +49,7 @@
49 49 LOGC_ALLOC, /* Memory allocation */
50 50 LOGC_SANDBOX, /* Related to the sandbox board */
51 51 LOGC_BLOBLIST, /* Bloblist */
  52 + LOGC_DEVRES, /* Device resources (devres_... functions) */
52 53  
53 54 LOGC_COUNT, /* Number of log categories */
54 55 LOGC_END, /* Sentinel value for a list of log categories */