With drivers that have prefix names that are quite long (like
'versatile_') it is useful to have a wider column for the driver's
name when dumping the device driver tree.
Also update the tests to take into account the wider output format.
Signed-off-by: Liviu Dudau <liviu.dudau@foss.arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
int i, is_last;
struct udevice *child;
int i, is_last;
struct udevice *child;
- /* print the first 11 characters to not break the tree-format. */
- printf(" %-10.10s %d [ %c ] %-10.10s ", dev->uclass->uc_drv->name,
+ /* print the first 20 characters to not break the tree-format. */
+ printf(" %-10.10s %d [ %c ] %-20.20s ", dev->uclass->uc_drv->name,
dev_get_uclass_index(dev, NULL),
dev->flags & DM_FLAG_ACTIVATED ? '+' : ' ', dev->driver->name);
dev_get_uclass_index(dev, NULL),
dev->flags & DM_FLAG_ACTIVATED ? '+' : ' ', dev->driver->name);
root = dm_root();
if (root) {
root = dm_root();
if (root) {
- printf(" Class index Probed Driver Name\n");
- printf("-----------------------------------------\n");
+ printf(" Class index Probed Driver Name\n");
+ printf("-----------------------------------------------------------\n");
show_devices(root, -1, 0);
}
}
show_devices(root, -1, 0);
}
}
else:
leaf = leaf + '`'
leaf = leaf + '-- ' + name
else:
leaf = leaf + '`'
leaf = leaf + '-- ' + name
- line = ' *{:10.10} [0-9]* \[ [ +] \] {:10.10} {}$'.format(uclass, drv,leaf)
+ line = ' *{:10.10} [0-9]* \[ [ +] \] {:20.20} {}$'.format(uclass, drv, leaf)
prog = re.compile(line)
for l in lines:
if prog.match(l):
prog = re.compile(line)
for l in lines:
if prog.match(l):
response = u_boot_console.run_command("bind /bind-test generic_simple_bus")
assert response == ''
tree = u_boot_console.run_command("dm tree")
response = u_boot_console.run_command("bind /bind-test generic_simple_bus")
assert response == ''
tree = u_boot_console.run_command("dm tree")
- assert in_tree(tree, "bind-test", "simple_bus", "generic_simple", 0, True)
+ assert in_tree(tree, "bind-test", "simple_bus", "generic_simple_bus", 0, True)
assert in_tree(tree, "bind-test-child1", "phy", "phy_sandbox", 1, False)
assert in_tree(tree, "bind-test-child1", "phy", "phy_sandbox", 1, False)
- assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple", 1, True)
+ assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, True)
#Unbind child #1. No error expected and all devices should be there except for bind-test-child1
response = u_boot_console.run_command("unbind /bind-test/bind-test-child1")
assert response == ''
tree = u_boot_console.run_command("dm tree")
#Unbind child #1. No error expected and all devices should be there except for bind-test-child1
response = u_boot_console.run_command("unbind /bind-test/bind-test-child1")
assert response == ''
tree = u_boot_console.run_command("dm tree")
- assert in_tree(tree, "bind-test", "simple_bus", "generic_simple", 0, True)
+ assert in_tree(tree, "bind-test", "simple_bus", "generic_simple_bus", 0, True)
assert "bind-test-child1" not in tree
assert "bind-test-child1" not in tree
- assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple", 1, True)
+ assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, True)
#bind child #1. No error expected and all devices should be there
response = u_boot_console.run_command("bind /bind-test/bind-test-child1 phy_sandbox")
assert response == ''
tree = u_boot_console.run_command("dm tree")
#bind child #1. No error expected and all devices should be there
response = u_boot_console.run_command("bind /bind-test/bind-test-child1 phy_sandbox")
assert response == ''
tree = u_boot_console.run_command("dm tree")
- assert in_tree(tree, "bind-test", "simple_bus", "generic_simple", 0, True)
+ assert in_tree(tree, "bind-test", "simple_bus", "generic_simple_bus", 0, True)
assert in_tree(tree, "bind-test-child1", "phy", "phy_sandbox", 1, True)
assert in_tree(tree, "bind-test-child1", "phy", "phy_sandbox", 1, True)
- assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple", 1, False)
+ assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, False)
#Unbind child #2. No error expected and all devices should be there except for bind-test-child2
response = u_boot_console.run_command("unbind /bind-test/bind-test-child2")
assert response == ''
tree = u_boot_console.run_command("dm tree")
#Unbind child #2. No error expected and all devices should be there except for bind-test-child2
response = u_boot_console.run_command("unbind /bind-test/bind-test-child2")
assert response == ''
tree = u_boot_console.run_command("dm tree")
- assert in_tree(tree, "bind-test", "simple_bus", "generic_simple", 0, True)
+ assert in_tree(tree, "bind-test", "simple_bus", "generic_simple_bus", 0, True)
assert in_tree(tree, "bind-test-child1", "phy", "phy_sandbox", 1, True)
assert "bind-test-child2" not in tree
assert in_tree(tree, "bind-test-child1", "phy", "phy_sandbox", 1, True)
assert "bind-test-child2" not in tree
response = u_boot_console.run_command("bind /bind-test/bind-test-child2 generic_simple_bus")
assert response == ''
tree = u_boot_console.run_command("dm tree")
response = u_boot_console.run_command("bind /bind-test/bind-test-child2 generic_simple_bus")
assert response == ''
tree = u_boot_console.run_command("dm tree")
- assert in_tree(tree, "bind-test", "simple_bus", "generic_simple", 0, True)
+ assert in_tree(tree, "bind-test", "simple_bus", "generic_simple_bus", 0, True)
assert in_tree(tree, "bind-test-child1", "phy", "phy_sandbox", 1, False)
assert in_tree(tree, "bind-test-child1", "phy", "phy_sandbox", 1, False)
- assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple", 1, True)
+ assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, True)
#Unbind parent. No error expected. All devices should be removed and unbound
response = u_boot_console.run_command("unbind /bind-test")
#Unbind parent. No error expected. All devices should be removed and unbound
response = u_boot_console.run_command("unbind /bind-test")
response = u_boot_console.run_command("bind /bind-test generic_simple_bus")
assert response == ''
tree = u_boot_console.run_command("dm tree")
response = u_boot_console.run_command("bind /bind-test generic_simple_bus")
assert response == ''
tree = u_boot_console.run_command("dm tree")
- assert in_tree(tree, "bind-test", "simple_bus", "generic_simple", 0, True)
+ assert in_tree(tree, "bind-test", "simple_bus", "generic_simple_bus", 0, True)
assert in_tree(tree, "bind-test-child1", "phy", "phy_sandbox", 1, False)
assert in_tree(tree, "bind-test-child1", "phy", "phy_sandbox", 1, False)
- assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple", 1, True)
+ assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, True)
response = u_boot_console.run_command("unbind /bind-test")
assert response == ''
response = u_boot_console.run_command("unbind /bind-test")
assert response == ''
response = u_boot_console.run_command("unbind simple_bus {}".format(child_of_child2_index))
assert response == ''
tree = u_boot_console.run_command("dm tree")
response = u_boot_console.run_command("unbind simple_bus {}".format(child_of_child2_index))
assert response == ''
tree = u_boot_console.run_command("dm tree")
- assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple", 1, True)
+ assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, True)
assert not in_tree(tree, "generic_simple_bus", "simple_bus", "generic_simple_bus", 2, True)
child_of_child2_line = get_next_line(tree, "bind-test-child2")
assert child_of_child2_line == ""
assert not in_tree(tree, "generic_simple_bus", "simple_bus", "generic_simple_bus", 2, True)
child_of_child2_line = get_next_line(tree, "bind-test-child2")
assert child_of_child2_line == ""
assert response == ''
tree = u_boot_console.run_command("dm tree")
assert response == ''
tree = u_boot_console.run_command("dm tree")
- assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple", 1, True)
+ assert in_tree(tree, "bind-test-child2", "simple_bus", "generic_simple_bus", 1, True)
child_of_child2_line = get_next_line(tree, "bind-test-child2")
assert child_of_child2_line == ""
child_of_child2_line = get_next_line(tree, "bind-test-child2")
assert child_of_child2_line == ""