From: Holger Schurig <holgerschurig@gmail.com>
To: barebox@lists.infradead.org
Subject: [PATCH 03/10] devinfo: make the output of "devinfo DEVICE" nicer
Date: Fri, 30 May 2014 11:07:29 +0200 [thread overview]
Message-ID: <1401440856-6145-4-git-send-email-holgerschurig@gmail.com> (raw)
In-Reply-To: <1401440856-6145-1-git-send-email-holgerschurig@gmail.com>
* some output sections started with "foo: bar", some with "foo = bar". Unify this.
* there was a fixed size to the "foo =" parameters, which wasn't fitting, this
was especially visible at "devinfo global"
* don't output "resources:", "driver:" and "bus:" lines if there are none
resources, drivers or busses involved.
* remove some empty lines
* harmonize differentiation between headlines (e.g. "resources:") and values
by indenting values slightly
* uppercase some texts
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
---
commands/devinfo.c | 38 +++++++++++++++++++++-----------------
drivers/video/fb.c | 7 ++-----
2 files changed, 23 insertions(+), 22 deletions(-)
diff --git a/commands/devinfo.c b/commands/devinfo.c
index 3fb309b..1a35e3f 100644
--- a/commands/devinfo.c
+++ b/commands/devinfo.c
@@ -52,16 +52,16 @@ static int do_devinfo_subtree(struct device_d *dev, int depth)
return 0;
}
+
static int do_devinfo(int argc, char *argv[])
{
struct device_d *dev;
struct param_d *param;
int i;
+ int first;
struct resource *res;
if (argc == 1) {
- printf("devices:\n");
-
for_each_device(dev) {
if (!dev->parent)
do_devinfo_subtree(dev, 0);
@@ -74,38 +74,42 @@ static int do_devinfo(int argc, char *argv[])
return -1;
}
- printf("resources:\n");
+ if (dev->num_resources)
+ printf("Resources:\n");
for (i = 0; i < dev->num_resources; i++) {
res = &dev->resource[i];
- printf("num : %d\n", i);
+ printf(" num: %d\n", i);
if (res->name)
- printf("name : %s\n", res->name);
- printf("start : " PRINTF_CONVERSION_RESOURCE "\nsize : "
- PRINTF_CONVERSION_RESOURCE "\n",
+ printf(" name: %s\n", res->name);
+ printf(" start: " PRINTF_CONVERSION_RESOURCE "\n"
+ " size: " PRINTF_CONVERSION_RESOURCE "\n",
res->start, resource_size(res));
}
- printf("driver: %s\n", dev->driver ?
- dev->driver->name : "none");
+ if (dev->driver)
+ printf("Driver: %s\n", dev->driver->name);
- printf("bus: %s\n\n", dev->bus ?
- dev->bus->name : "none");
+ if (dev->bus)
+ printf("Bus: %s\n", dev->bus->name);
if (dev->info)
dev->info(dev);
- printf("%s\n", list_empty(&dev->parameters) ?
- "no parameters available" : "Parameters:");
-
+ first = true;
list_for_each_entry(param, &dev->parameters, list) {
- printf("%16s = %s", param->name, dev_get_param(dev, param->name));
- if (param->info)
+ if (first) {
+ printf("Parameters:\n");
+ first = false;
+ }
+ printf(" %s: %s", param->name, dev_get_param(dev, param->name));
+ if (param->info) {
param->info(param);
+ }
printf("\n");
}
#ifdef CONFIG_OFDEVICE
if (dev->device_node) {
- printf("\ndevice node: %s\n", dev->device_node->full_name);
+ printf("Device node: %s\n", dev->device_node->full_name);
of_print_nodes(dev->device_node, 0);
}
#endif
diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index ecf6142..e30ab59 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -125,7 +125,7 @@ static struct file_operations fb_ops = {
static void fb_print_mode(struct fb_videomode *mode)
{
- printf("%-20s %dx%d@%d\n", mode->name,
+ printf(" %s: %dx%d@%d\n", mode->name,
mode->xres, mode->yres, mode->refresh);
}
@@ -141,12 +141,9 @@ static void fb_info(struct device_d *dev)
{
struct fb_info *info = dev->priv;
- printf("available modes:\n");
-
+ printf("Available modes:\n");
fb_print_modes(&info->modes);
fb_print_modes(&info->edid_modes);
-
- printf("\n");
}
int register_framebuffer(struct fb_info *info)
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2014-05-30 9:02 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-30 9:07 [PATCH 00/10] miscelleanous beautification patches Holger Schurig
2014-05-30 9:05 ` Holger Schurig
2014-05-30 9:07 ` [PATCH 01/10] drvlist: factor the driver list out of 'devinfo' Holger Schurig
2014-05-30 9:09 ` Holger Schurig
2014-05-30 9:07 ` [PATCH 02/10] devinfo: reduce indentation Holger Schurig
2014-05-30 9:08 ` Holger Schurig
2014-05-30 9:49 ` Antony Pavlov
2014-05-30 9:07 ` Holger Schurig [this message]
2014-05-30 9:07 ` [PATCH 03/10] devinfo: make the output of "devinfo DEVICE" nicer Holger Schurig
2014-06-02 8:19 ` Juergen Borleis
2014-06-02 9:23 ` Holger Schurig
2014-06-02 10:09 ` Juergen Borleis
2014-06-02 10:28 ` Holger Schurig
2014-05-30 9:07 ` [PATCH 04/10] parameters: only show possible enumerations if there are any Holger Schurig
2014-05-30 9:09 ` Holger Schurig
2014-05-30 9:07 ` [PATCH 05/10] net: show enetaddr in lowercase Holger Schurig
2014-05-30 9:07 ` [PATCH 06/10] meminfo: purely cosmetical changes Holger Schurig
2014-05-30 9:43 ` Antony Pavlov
2014-05-30 9:37 ` Holger Schurig
2014-05-30 9:07 ` [PATCH 07/10] misc: upper-case some abbreviations Holger Schurig
2014-05-30 9:07 ` [PATCH 08/10] bootm: beautify output Holger Schurig
2014-05-30 9:06 ` Holger Schurig
2014-05-30 9:07 ` [PATCH 09/10] beautify PHY driver names Holger Schurig
2014-05-30 9:17 ` Alexander Aring
2014-05-30 9:30 ` Holger Schurig
2014-05-30 10:03 ` Alexander Aring
2014-06-02 6:59 ` Sascha Hauer
2014-05-30 9:07 ` [PATCH 10/10] device drivers: harmonize underscore in " Holger Schurig
2014-06-02 7:16 ` Sascha Hauer
2014-06-02 7:21 ` [PATCH 00/10] miscelleanous beautification patches Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1401440856-6145-4-git-send-email-holgerschurig@gmail.com \
--to=holgerschurig@gmail.com \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox