summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-08-09 16:27:06 +0300
committerTom Rini <trini@konsulko.com>2021-08-09 16:27:06 +0300
commit0dec2030ccc686eae4616d1ce57d41eaed15685e (patch)
tree5e9a34e4d51c4587a2138a2de969361ad3ec1f2c
parent3823315cbedf930c52fe77452063ab6d62b157be (diff)
parente679f39f7fc3eb083b2f957d748f81bbdc28f28c (diff)
downloadu-boot-0dec2030ccc686eae4616d1ce57d41eaed15685e.tar.xz
Merge tag 'dm-pull-8aug21' of https://source.denx.de/u-boot/custodians/u-boot-dm
Use log subsystem for dm_warn() Various minor bug fixes
-rw-r--r--drivers/core/uclass.c3
-rw-r--r--drivers/core/util.c11
-rw-r--r--include/dm/uclass.h3
-rw-r--r--include/dm/util.h2
-rw-r--r--test/dm/core.c1
-rwxr-xr-xtools/dtoc/test_fdt.py2
-rw-r--r--tools/patman/func_test.py23
-rw-r--r--tools/patman/patchstream.py7
8 files changed, 36 insertions, 16 deletions
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index 117d35ac49..3146dfd032 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -146,6 +146,9 @@ int uclass_get(enum uclass_id id, struct uclass **ucp)
{
struct uclass *uc;
+ /* Immediately fail if driver model is not set up */
+ if (!gd->uclass_root)
+ return -EDEADLK;
*ucp = NULL;
uc = uclass_find(id);
if (!uc) {
diff --git a/drivers/core/util.c b/drivers/core/util.c
index 91e93b0cf1..5be4ee79de 100644
--- a/drivers/core/util.c
+++ b/drivers/core/util.c
@@ -11,17 +11,6 @@
#include <linux/libfdt.h>
#include <vsprintf.h>
-#if CONFIG_IS_ENABLED(DM_WARN)
-void dm_warn(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)
{
struct list_head *node;
diff --git a/include/dm/uclass.h b/include/dm/uclass.h
index 2778818b52..da0c1bfadb 100644
--- a/include/dm/uclass.h
+++ b/include/dm/uclass.h
@@ -159,7 +159,8 @@ void *uclass_get_priv(const struct uclass *uc);
*
* @key: ID to look up
* @ucp: Returns pointer to uclass (there is only one per ID)
- * @return 0 if OK, -ve on error
+ * @return 0 if OK, -EDEADLK if driver model is not yet inited, other -ve on
+ * other error
*/
int uclass_get(enum uclass_id key, struct uclass **ucp);
diff --git a/include/dm/util.h b/include/dm/util.h
index 138893c935..c634e470e7 100644
--- a/include/dm/util.h
+++ b/include/dm/util.h
@@ -7,7 +7,7 @@
#define __DM_UTIL_H
#if CONFIG_IS_ENABLED(DM_WARN)
-void dm_warn(const char *fmt, ...);
+#define dm_warn(fmt...) log(LOGC_DM, LOGL_WARNING, ##fmt)
#else
static inline void dm_warn(const char *fmt, ...)
{
diff --git a/test/dm/core.c b/test/dm/core.c
index 48e66b7333..c9a7606666 100644
--- a/test/dm/core.c
+++ b/test/dm/core.c
@@ -994,6 +994,7 @@ static int dm_test_uclass_before_ready(struct unit_test_state *uts)
memset(&gd->uclass_root, '\0', sizeof(gd->uclass_root));
ut_asserteq_ptr(NULL, uclass_find(UCLASS_TEST));
+ ut_asserteq(-EDEADLK, uclass_get(UCLASS_TEST, &uc));
return 0;
}
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index 1119e6b784..d104f3c774 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -425,7 +425,7 @@ class TestProp(unittest.TestCase):
# Widen an array of ints with an int (should do nothing)
prop = self.node.props['intarray']
- prop2 = node2.props['intarray']
+ prop2 = node2.props['intval']
self.assertEqual(Type.INT, prop.type)
self.assertEqual(3, len(prop.value))
prop.Widen(prop2)
diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py
index 9871bb580d..2493e527f5 100644
--- a/tools/patman/func_test.py
+++ b/tools/patman/func_test.py
@@ -136,7 +136,7 @@ class TestFunctional(unittest.TestCase):
Commit-changes: 2
- Changes only for this commit
- Cover-changes: 4
+' Cover-changes: 4
- Some notes for the cover letter
Cover-letter:
@@ -1293,3 +1293,24 @@ Reviewed-by: %s
self.assertEqual(terminal.PrintLine(
'4 new responses available in patchwork (use -d to write them to a new branch)',
None), next(lines))
+
+ def testInsertTags(self):
+ """Test inserting of review tags"""
+ msg = '''first line
+second line.'''
+ tags = [
+ 'Reviewed-by: Bin Meng <bmeng.cn@gmail.com>',
+ 'Tested-by: Bin Meng <bmeng.cn@gmail.com>'
+ ]
+ signoff = 'Signed-off-by: Simon Glass <sjg@chromium.com>'
+ tag_str = '\n'.join(tags)
+
+ new_msg = patchstream.insert_tags(msg, tags)
+ self.assertEqual(msg + '\n\n' + tag_str, new_msg)
+
+ new_msg = patchstream.insert_tags(msg + '\n', tags)
+ self.assertEqual(msg + '\n\n' + tag_str, new_msg)
+
+ msg += '\n\n' + signoff
+ new_msg = patchstream.insert_tags(msg, tags)
+ self.assertEqual(msg + '\n' + tag_str, new_msg)
diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py
index b960292427..2439fb18e4 100644
--- a/tools/patman/patchstream.py
+++ b/tools/patman/patchstream.py
@@ -662,6 +662,7 @@ def insert_tags(msg, tags_to_emit):
out = []
done = False
emit_tags = False
+ emit_blank = False
for line in msg.splitlines():
if not done:
signoff_match = RE_SIGNOFF.match(line)
@@ -672,9 +673,13 @@ def insert_tags(msg, tags_to_emit):
out += tags_to_emit
emit_tags = False
done = True
+ emit_blank = not (signoff_match or tag_match)
+ else:
+ emit_blank = line
out.append(line)
if not done:
- out.append('')
+ if emit_blank:
+ out.append('')
out += tags_to_emit
return '\n'.join(out)