param: Add info function
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>
This commit is contained in:
parent
2827883911
commit
c5fa299862
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue