Commit 0dec2030 authored by Tom Rini's avatar Tom Rini
Browse files

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
parents 3823315c e679f39f
......@@ -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) {
......
......@@ -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;
......
......@@ -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);
......
......@@ -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, ...)
{
......
......@@ -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;
}
......
......@@ -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)
......
......@@ -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)
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment