]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
dm: core: Show driver name with 'dm tree'
authorSimon Glass <sjg@chromium.org>
Wed, 2 Aug 2017 18:12:02 +0000 (12:12 -0600)
committerSimon Glass <sjg@chromium.org>
Tue, 12 Sep 2017 03:43:58 +0000 (21:43 -0600)
It is often useful to see which driver was actually selected for each
device. Add a new 'Driver' column to provide this information. Sample
output:

 Class       Probed   Driver     Name
----------------------------------------
 root        [ + ]    root_drive root_driver
 keyboard    [ + ]    i8042_kbd  |-- keyboard
 serial      [ + ]    ns16550_se |-- serial
 rtc         [   ]    rtc_mc1468 |-- rtc
 timer       [ + ]    tsc_timer  |-- tsc-timer
 syscon      [ + ]    ich6_pinct |-- pch_pinctrl
 pci         [ + ]    pci_x86    |-- pci
 northbridge [ + ]    bd82x6x_no |   |-- northbridge@0,0
 video       [ + ]    bd82x6x_vi |   |-- gma@2,0
 vidconsole0 [ + ]    vidconsole |   |   `-- gma@2,0.vidconsole0
...

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
drivers/core/dump.c

index 1bb64098f452c562f608ec9d9b4a4edb19814a2b..6c6b9444530b7f2e137d9f8c0a788c1cf0492bfc 100644 (file)
@@ -16,8 +16,8 @@ static void show_devices(struct udevice *dev, int depth, int last_flag)
        struct udevice *child;
 
        /* print the first 11 characters to not break the tree-format. */
-       printf(" %-10.10s [ %c ]    ", dev->uclass->uc_drv->name,
-              dev->flags & DM_FLAG_ACTIVATED ? '+' : ' ');
+       printf(" %-10.10s [ %c ]   %-10.10s  ", dev->uclass->uc_drv->name,
+              dev->flags & DM_FLAG_ACTIVATED ? '+' : ' ', dev->driver->name);
 
        for (i = depth; i >= 0; i--) {
                is_last = (last_flag >> i) & 1;
@@ -48,7 +48,7 @@ void dm_dump_all(void)
 
        root = dm_root();
        if (root) {
-               printf(" Class      Probed   Name\n");
+               printf(" Class      Probed  Driver      Name\n");
                printf("----------------------------------------\n");
                show_devices(root, -1, 0);
        }