mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 15:14:43 +00:00
dm: replace dm_dbg() with pr_debug()
As we discussed before in ML, dm_dbg() causes undefined reference error if #define DEBUG is added to users, but not drivers/core/util.c We do not need this macro because we can use pr_debug() instead, and it is pretty easy to enable it for the DM core by using ccflags-y. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
This commit is contained in:
parent
6990e91f09
commit
ceb9190969
7 changed files with 19 additions and 29 deletions
|
@ -45,6 +45,12 @@ config DM_WARN
|
||||||
This will cause dm_warn() to be compiled out - it will do nothing
|
This will cause dm_warn() to be compiled out - it will do nothing
|
||||||
when called.
|
when called.
|
||||||
|
|
||||||
|
config DM_DEBUG
|
||||||
|
bool "Enable debug messages in driver model core"
|
||||||
|
depends on DM
|
||||||
|
help
|
||||||
|
Say Y here if you want to compile in debug messages in DM core.
|
||||||
|
|
||||||
config DM_DEVICE_REMOVE
|
config DM_DEVICE_REMOVE
|
||||||
bool "Support device removal"
|
bool "Support device removal"
|
||||||
depends on DM
|
depends on DM
|
||||||
|
|
|
@ -16,3 +16,5 @@ ifndef CONFIG_DM_DEV_READ_INLINE
|
||||||
obj-$(CONFIG_OF_CONTROL) += read.o
|
obj-$(CONFIG_OF_CONTROL) += read.o
|
||||||
endif
|
endif
|
||||||
obj-$(CONFIG_OF_CONTROL) += of_extra.o ofnode.o read_extra.o
|
obj-$(CONFIG_OF_CONTROL) += of_extra.o ofnode.o read_extra.o
|
||||||
|
|
||||||
|
ccflags-$(CONFIG_DM_DEBUG) += -DDEBUG
|
||||||
|
|
|
@ -161,7 +161,7 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parent)
|
if (parent)
|
||||||
dm_dbg("Bound device %s to %s\n", dev->name, parent->name);
|
pr_debug("Bound device %s to %s\n", dev->name, parent->name);
|
||||||
if (devp)
|
if (devp)
|
||||||
*devp = dev;
|
*devp = dev;
|
||||||
|
|
||||||
|
|
|
@ -139,12 +139,13 @@ int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp)
|
||||||
if (devp)
|
if (devp)
|
||||||
*devp = NULL;
|
*devp = NULL;
|
||||||
name = ofnode_get_name(node);
|
name = ofnode_get_name(node);
|
||||||
dm_dbg("bind node %s\n", name);
|
pr_debug("bind node %s\n", name);
|
||||||
|
|
||||||
compat_list = ofnode_get_property(node, "compatible", &compat_length);
|
compat_list = ofnode_get_property(node, "compatible", &compat_length);
|
||||||
if (!compat_list) {
|
if (!compat_list) {
|
||||||
if (compat_length == -FDT_ERR_NOTFOUND) {
|
if (compat_length == -FDT_ERR_NOTFOUND) {
|
||||||
dm_dbg("Device '%s' has no compatible string\n", name);
|
pr_debug("Device '%s' has no compatible string\n",
|
||||||
|
name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,8 +160,8 @@ int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp)
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < compat_length; i += strlen(compat) + 1) {
|
for (i = 0; i < compat_length; i += strlen(compat) + 1) {
|
||||||
compat = compat_list + i;
|
compat = compat_list + i;
|
||||||
dm_dbg(" - attempt to match compatible string '%s'\n",
|
pr_debug(" - attempt to match compatible string '%s'\n",
|
||||||
compat);
|
compat);
|
||||||
|
|
||||||
for (entry = driver; entry != driver + n_ents; entry++) {
|
for (entry = driver; entry != driver + n_ents; entry++) {
|
||||||
ret = driver_check_compatible(entry->of_match, &id,
|
ret = driver_check_compatible(entry->of_match, &id,
|
||||||
|
@ -171,11 +172,11 @@ int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp)
|
||||||
if (entry == driver + n_ents)
|
if (entry == driver + n_ents)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
dm_dbg(" - found match at '%s'\n", entry->name);
|
pr_debug(" - found match at '%s'\n", entry->name);
|
||||||
ret = device_bind_with_driver_data(parent, entry, name,
|
ret = device_bind_with_driver_data(parent, entry, name,
|
||||||
id->data, node, &dev);
|
id->data, node, &dev);
|
||||||
if (ret == -ENODEV) {
|
if (ret == -ENODEV) {
|
||||||
dm_dbg("Driver '%s' refuses to bind\n", entry->name);
|
pr_debug("Driver '%s' refuses to bind\n", entry->name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -191,7 +192,7 @@ int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found && !result && ret != -ENODEV)
|
if (!found && !result && ret != -ENODEV)
|
||||||
dm_dbg("No match for node '%s'\n", name);
|
pr_debug("No match for node '%s'\n", name);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -227,7 +227,7 @@ static int dm_scan_fdt_live(struct udevice *parent,
|
||||||
!of_find_property(np, "u-boot,dm-pre-reloc", NULL))
|
!of_find_property(np, "u-boot,dm-pre-reloc", NULL))
|
||||||
continue;
|
continue;
|
||||||
if (!of_device_is_available(np)) {
|
if (!of_device_is_available(np)) {
|
||||||
dm_dbg(" - ignoring disabled device\n");
|
pr_debug(" - ignoring disabled device\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
err = lists_bind_fdt(parent, np_to_ofnode(np), NULL);
|
err = lists_bind_fdt(parent, np_to_ofnode(np), NULL);
|
||||||
|
@ -270,7 +270,7 @@ static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
|
||||||
!dm_fdt_pre_reloc(blob, offset))
|
!dm_fdt_pre_reloc(blob, offset))
|
||||||
continue;
|
continue;
|
||||||
if (!fdtdec_get_is_enabled(blob, offset)) {
|
if (!fdtdec_get_is_enabled(blob, offset)) {
|
||||||
dm_dbg(" - ignoring disabled device\n");
|
pr_debug(" - ignoring disabled device\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
err = lists_bind_fdt(parent, offset_to_ofnode(offset), NULL);
|
err = lists_bind_fdt(parent, offset_to_ofnode(offset), NULL);
|
||||||
|
|
|
@ -20,17 +20,6 @@ void dm_warn(const char *fmt, ...)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
void dm_dbg(const char *fmt, ...)
|
|
||||||
{
|
|
||||||
va_list args;
|
|
||||||
|
|
||||||
va_start(args, fmt);
|
|
||||||
vprintf(fmt, args);
|
|
||||||
va_end(args);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int list_count_items(struct list_head *head)
|
int list_count_items(struct list_head *head)
|
||||||
{
|
{
|
||||||
struct list_head *node;
|
struct list_head *node;
|
||||||
|
|
|
@ -15,14 +15,6 @@ static inline void dm_warn(const char *fmt, ...)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
void dm_dbg(const char *fmt, ...);
|
|
||||||
#else
|
|
||||||
static inline void dm_dbg(const char *fmt, ...)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct list_head;
|
struct list_head;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue