From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/3] param: Add info function
Date: Thu, 23 May 2013 15:56:15 +0200 [thread overview]
Message-ID: <1369317377-17153-2-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1369317377-17153-1-git-send-email-s.hauer@pengutronix.de>
Some parameters may wish to provide some information about their
meaning or possible values. Provide an info callback for parameters.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/base/driver.c | 8 ++++++--
include/param.h | 1 +
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index edd49b3..30a4bc5 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -495,8 +495,12 @@ static int do_devinfo(int argc, char *argv[])
printf("%s\n", list_empty(&dev->parameters) ?
"no parameters available" : "Parameters:");
- list_for_each_entry(param, &dev->parameters, list)
- printf("%16s = %s\n", param->name, dev_get_param(dev, param->name));
+ list_for_each_entry(param, &dev->parameters, list) {
+ printf("%16s = %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);
diff --git a/include/param.h b/include/param.h
index 4af2d09..54dea56 100644
--- a/include/param.h
+++ b/include/param.h
@@ -12,6 +12,7 @@ typedef unsigned long IPaddr_t;
struct param_d {
const char* (*get)(struct device_d *, struct param_d *param);
int (*set)(struct device_d *, struct param_d *param, const char *val);
+ void (*info)(struct param_d *param);
unsigned int flags;
char *name;
char *value;
--
1.8.2.rc2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2013-05-23 13:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-23 13:56 [PATCH] MCI: support boot partitions Sascha Hauer
2013-05-23 13:56 ` Sascha Hauer [this message]
2013-05-23 13:56 ` [PATCH 2/3] param: Add helpers to provide an enum parameter Sascha Hauer
2013-05-23 13:56 ` [PATCH 3/3] mci: Add support for MMC boot partitions 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=1369317377-17153-2-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--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