* [U-Boot] [PATCH v2 1/2] dm: core: Drop use of strlcpy()
@ 2017-08-02 18:12 Simon Glass
2017-08-02 18:12 ` [U-Boot] [PATCH v2 2/2] dm: core: Show driver name with 'dm tree' Simon Glass
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Simon Glass @ 2017-08-02 18:12 UTC (permalink / raw)
To: u-boot
We can use printf() to limit the string width. Adjust the code to do this
instead of using strlcpy() which is a bit clumbsy.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2:
- Add new patch to drop use of strlcpy()
drivers/core/dump.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/core/dump.c b/drivers/core/dump.c
index c3e109e7ed..1bb64098f4 100644
--- a/drivers/core/dump.c
+++ b/drivers/core/dump.c
@@ -14,11 +14,9 @@ static void show_devices(struct udevice *dev, int depth, int last_flag)
{
int i, is_last;
struct udevice *child;
- char class_name[12];
/* print the first 11 characters to not break the tree-format. */
- strlcpy(class_name, dev->uclass->uc_drv->name, sizeof(class_name));
- printf(" %-11s [ %c ] ", class_name,
+ printf(" %-10.10s [ %c ] ", dev->uclass->uc_drv->name,
dev->flags & DM_FLAG_ACTIVATED ? '+' : ' ');
for (i = depth; i >= 0; i--) {
@@ -50,7 +48,7 @@ void dm_dump_all(void)
root = dm_root();
if (root) {
- printf(" Class Probed Name\n");
+ printf(" Class Probed Name\n");
printf("----------------------------------------\n");
show_devices(root, -1, 0);
}
--
2.14.0.rc1.383.gd1ce394fe2-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH v2 2/2] dm: core: Show driver name with 'dm tree'
2017-08-02 18:12 [U-Boot] [PATCH v2 1/2] dm: core: Drop use of strlcpy() Simon Glass
@ 2017-08-02 18:12 ` Simon Glass
2017-08-02 22:54 ` [U-Boot] [PATCH v2 1/2] dm: core: Drop use of strlcpy() Bin Meng
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Simon Glass @ 2017-08-02 18:12 UTC (permalink / raw)
To: u-boot
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 at 0,0
video [ + ] bd82x6x_vi | |-- gma at 2,0
vidconsole0 [ + ] vidconsole | | `-- gma at 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>
---
Changes in v2:
- Drop one space between 'Probed' and 'Driver'
drivers/core/dump.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/core/dump.c b/drivers/core/dump.c
index 1bb64098f4..6c6b944453 100644
--- a/drivers/core/dump.c
+++ b/drivers/core/dump.c
@@ -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);
}
--
2.14.0.rc1.383.gd1ce394fe2-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH v2 1/2] dm: core: Drop use of strlcpy()
2017-08-02 18:12 [U-Boot] [PATCH v2 1/2] dm: core: Drop use of strlcpy() Simon Glass
2017-08-02 18:12 ` [U-Boot] [PATCH v2 2/2] dm: core: Show driver name with 'dm tree' Simon Glass
@ 2017-08-02 22:54 ` Bin Meng
2017-09-12 10:54 ` [U-Boot] [PATCH v2 2/2] dm: core: Show driver name with 'dm tree' sjg at google.com
2017-09-12 10:54 ` [U-Boot] [PATCH v2 1/2] dm: core: Drop use of strlcpy() sjg at google.com
3 siblings, 0 replies; 5+ messages in thread
From: Bin Meng @ 2017-08-02 22:54 UTC (permalink / raw)
To: u-boot
On Thu, Aug 3, 2017 at 2:12 AM, Simon Glass <sjg@chromium.org> wrote:
> We can use printf() to limit the string width. Adjust the code to do this
> instead of using strlcpy() which is a bit clumbsy.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2:
> - Add new patch to drop use of strlcpy()
>
> drivers/core/dump.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH v2 2/2] dm: core: Show driver name with 'dm tree'
2017-08-02 18:12 [U-Boot] [PATCH v2 1/2] dm: core: Drop use of strlcpy() Simon Glass
2017-08-02 18:12 ` [U-Boot] [PATCH v2 2/2] dm: core: Show driver name with 'dm tree' Simon Glass
2017-08-02 22:54 ` [U-Boot] [PATCH v2 1/2] dm: core: Drop use of strlcpy() Bin Meng
@ 2017-09-12 10:54 ` sjg at google.com
2017-09-12 10:54 ` [U-Boot] [PATCH v2 1/2] dm: core: Drop use of strlcpy() sjg at google.com
3 siblings, 0 replies; 5+ messages in thread
From: sjg at google.com @ 2017-09-12 10:54 UTC (permalink / raw)
To: u-boot
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 at 0,0
video [ + ] bd82x6x_vi | |-- gma at 2,0
vidconsole0 [ + ] vidconsole | | `-- gma at 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>
---
Changes in v2:
- Drop one space between 'Probed' and 'Driver'
drivers/core/dump.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Applied to u-boot-dm, thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH v2 1/2] dm: core: Drop use of strlcpy()
2017-08-02 18:12 [U-Boot] [PATCH v2 1/2] dm: core: Drop use of strlcpy() Simon Glass
` (2 preceding siblings ...)
2017-09-12 10:54 ` [U-Boot] [PATCH v2 2/2] dm: core: Show driver name with 'dm tree' sjg at google.com
@ 2017-09-12 10:54 ` sjg at google.com
3 siblings, 0 replies; 5+ messages in thread
From: sjg at google.com @ 2017-09-12 10:54 UTC (permalink / raw)
To: u-boot
On Thu, Aug 3, 2017 at 2:12 AM, Simon Glass <sjg@chromium.org> wrote:
> We can use printf() to limit the string width. Adjust the code to do this
> instead of using strlcpy() which is a bit clumbsy.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2:
> - Add new patch to drop use of strlcpy()
>
> drivers/core/dump.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Applied to u-boot-dm, thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-09-12 10:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-02 18:12 [U-Boot] [PATCH v2 1/2] dm: core: Drop use of strlcpy() Simon Glass
2017-08-02 18:12 ` [U-Boot] [PATCH v2 2/2] dm: core: Show driver name with 'dm tree' Simon Glass
2017-08-02 22:54 ` [U-Boot] [PATCH v2 1/2] dm: core: Drop use of strlcpy() Bin Meng
2017-09-12 10:54 ` [U-Boot] [PATCH v2 2/2] dm: core: Show driver name with 'dm tree' sjg at google.com
2017-09-12 10:54 ` [U-Boot] [PATCH v2 1/2] dm: core: Drop use of strlcpy() sjg at google.com
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.