dm: core: migrate debug() messages to use dm_warn
Prior to that, seeing the debug() messages required to enable DM_DEBUG
which defines DEBUG (and then _DEBUG) which in turn makes failing
assert() calls reset U-Boot which isn't necessarily what is desired.
Instead, let's migrate to dm_warn which is using log_debug when unset or
log_warn when set.
While at it, reword the DM_DEBUG symbol in Kconfig to explain what it
now actually does.
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/drivers/core/regmap.c b/drivers/core/regmap.c
index 7ff7834..304d5b0 100644
--- a/drivers/core/regmap.c
+++ b/drivers/core/regmap.c
@@ -17,6 +17,7 @@
#include <asm/io.h>
#include <dm/of_addr.h>
#include <dm/devres.h>
+#include <dm/util.h>
#include <linux/ioport.h>
#include <linux/compat.h>
#include <linux/err.h>
@@ -139,8 +140,8 @@
ret = of_address_to_resource(ofnode_to_np(node),
index, &r);
if (ret) {
- debug("%s: Could not read resource of range %d (ret = %d)\n",
- ofnode_get_name(node), index, ret);
+ dm_warn("%s: Could not read resource of range %d (ret = %d)\n",
+ ofnode_get_name(node), index, ret);
return ret;
}
@@ -154,8 +155,8 @@
addr_len, size_len,
&sz, true);
if (range->start == FDT_ADDR_T_NONE) {
- debug("%s: Could not read start of range %d\n",
- ofnode_get_name(node), index);
+ dm_warn("%s: Could not read start of range %d\n",
+ ofnode_get_name(node), index);
return -EINVAL;
}
@@ -173,15 +174,15 @@
addr_len = ofnode_read_simple_addr_cells(ofnode_get_parent(node));
if (addr_len < 0) {
- debug("%s: Error while reading the addr length (ret = %d)\n",
- ofnode_get_name(node), addr_len);
+ dm_warn("%s: Error while reading the addr length (ret = %d)\n",
+ ofnode_get_name(node), addr_len);
return addr_len;
}
size_len = ofnode_read_simple_size_cells(ofnode_get_parent(node));
if (size_len < 0) {
- debug("%s: Error while reading the size length: (ret = %d)\n",
- ofnode_get_name(node), size_len);
+ dm_warn("%s: Error while reading the size length: (ret = %d)\n",
+ ofnode_get_name(node), size_len);
return size_len;
}
@@ -250,36 +251,36 @@
addr_len = ofnode_read_simple_addr_cells(ofnode_get_parent(node));
if (addr_len < 0) {
- debug("%s: Error while reading the addr length (ret = %d)\n",
- ofnode_get_name(node), addr_len);
+ dm_warn("%s: Error while reading the addr length (ret = %d)\n",
+ ofnode_get_name(node), addr_len);
return addr_len;
}
size_len = ofnode_read_simple_size_cells(ofnode_get_parent(node));
if (size_len < 0) {
- debug("%s: Error while reading the size length: (ret = %d)\n",
- ofnode_get_name(node), size_len);
+ dm_warn("%s: Error while reading the size length: (ret = %d)\n",
+ ofnode_get_name(node), size_len);
return size_len;
}
both_len = addr_len + size_len;
if (!both_len) {
- debug("%s: Both addr and size length are zero\n",
- ofnode_get_name(node));
+ dm_warn("%s: Both addr and size length are zero\n",
+ ofnode_get_name(node));
return -EINVAL;
}
len = ofnode_read_size(node, "reg");
if (len < 0) {
- debug("%s: Error while reading reg size (ret = %d)\n",
- ofnode_get_name(node), len);
+ dm_warn("%s: Error while reading reg size (ret = %d)\n",
+ ofnode_get_name(node), len);
return len;
}
len /= sizeof(fdt32_t);
count = len / both_len;
if (!count) {
- debug("%s: Not enough data in reg property\n",
- ofnode_get_name(node));
+ dm_warn("%s: Not enough data in reg property\n",
+ ofnode_get_name(node));
return -EINVAL;
}
@@ -424,8 +425,8 @@
void *ptr;
if (do_range_check() && range_num >= map->range_count) {
- debug("%s: range index %d larger than range count\n",
- __func__, range_num);
+ dm_warn("%s: range index %d larger than range count\n",
+ __func__, range_num);
return -ERANGE;
}
range = &map->ranges[range_num];
@@ -433,7 +434,7 @@
offset <<= map->reg_offset_shift;
if (do_range_check() &&
(offset + val_len > range->size || offset + val_len < offset)) {
- debug("%s: offset/size combination invalid\n", __func__);
+ dm_warn("%s: offset/size combination invalid\n", __func__);
return -ERANGE;
}
@@ -455,7 +456,7 @@
break;
#endif
default:
- debug("%s: regmap size %zu unknown\n", __func__, val_len);
+ dm_warn("%s: regmap size %zu unknown\n", __func__, val_len);
return -EINVAL;
}
@@ -564,15 +565,15 @@
void *ptr;
if (range_num >= map->range_count) {
- debug("%s: range index %d larger than range count\n",
- __func__, range_num);
+ dm_warn("%s: range index %d larger than range count\n",
+ __func__, range_num);
return -ERANGE;
}
range = &map->ranges[range_num];
offset <<= map->reg_offset_shift;
if (offset + val_len > range->size || offset + val_len < offset) {
- debug("%s: offset/size combination invalid\n", __func__);
+ dm_warn("%s: offset/size combination invalid\n", __func__);
return -ERANGE;
}
@@ -594,7 +595,7 @@
break;
#endif
default:
- debug("%s: regmap size %zu unknown\n", __func__, val_len);
+ dm_warn("%s: regmap size %zu unknown\n", __func__, val_len);
return -EINVAL;
}
@@ -630,8 +631,8 @@
u.v64 = val;
break;
default:
- debug("%s: regmap size %zu unknown\n", __func__,
- (size_t)map->width);
+ dm_warn("%s: regmap size %zu unknown\n", __func__,
+ (size_t)map->width);
return -EINVAL;
}