Use log subsystem for dm_warn()

Various minor bug fixes
 -----BEGIN PGP SIGNATURE-----
 
 iQFFBAABCgAvFiEEslwAIq+Gp8wWVbYnfxc6PpAIreYFAmEQkwoRHHNqZ0BjaHJv
 bWl1bS5vcmcACgkQfxc6PpAIreZoZwgAxyaO+In1SDc7OlB8/ab/exhgSKxf2oHg
 5FYmazygTde1oJNMyv6Xwzzj8AXLAiK5D9Drfom2jsI/gdRWSrMNIVkwR8oFhkO4
 +30DEVNrVVrTEDnT1XQJh398fIa2h0uDF2n8KNyhaeacGtLAvNP+LSUdLSoPVHzO
 Qc5uD9dDqRpPaVyU5DbzmZ+JS2YhvoWnd8g6zaJXKDexlHCxKr4dGNWlesVEym0q
 z9OR6EEO2dZy3HIcLBFfsNLgKWJUoIzQztKuA2l1uEkpmEzOh3bSiLHMv3fOFHG4
 aWPq4BTqVeCk4rkd9//krUi4UnN9gL0smKxdFYiWRQecy6jMG2WXjQ==
 =IDJp
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Tom Rini 2021-08-09 09:27:06 -04:00
commit 0dec2030cc
8 changed files with 36 additions and 16 deletions

View file

@ -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) {

View file

@ -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;

View file

@ -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);

View file

@ -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, ...)
{

View file

@ -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;
}

View file

@ -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)

View file

@ -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)

View file

@ -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)