param: Add support for long long read only dev param
Signed-off-by: Herve Codina <Herve.CODINA@celad.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
aca00bb719
commit
f2e86a2964
|
@ -49,6 +49,9 @@ struct param_d *dev_add_param_enum(struct device_d *dev, const char *name,
|
||||||
struct param_d *dev_add_param_int_ro(struct device_d *dev, const char *name,
|
struct param_d *dev_add_param_int_ro(struct device_d *dev, const char *name,
|
||||||
int value, const char *format);
|
int value, const char *format);
|
||||||
|
|
||||||
|
struct param_d *dev_add_param_llint_ro(struct device_d *dev, const char *name,
|
||||||
|
long long value, const char *format);
|
||||||
|
|
||||||
struct param_d *dev_add_param_ip(struct device_d *dev, const char *name,
|
struct param_d *dev_add_param_ip(struct device_d *dev, const char *name,
|
||||||
int (*set)(struct param_d *p, void *priv),
|
int (*set)(struct param_d *p, void *priv),
|
||||||
int (*get)(struct param_d *p, void *priv),
|
int (*get)(struct param_d *p, void *priv),
|
||||||
|
@ -123,6 +126,12 @@ static inline struct param_d *dev_add_param_int_ro(struct device_d *dev, const c
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline struct param_d *dev_add_param_llint_ro(struct device_d *dev, const char *name,
|
||||||
|
long long value, const char *format)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static inline struct param_d *dev_add_param_ip(struct device_d *dev, const char *name,
|
static inline struct param_d *dev_add_param_ip(struct device_d *dev, const char *name,
|
||||||
int (*set)(struct param_d *p, void *priv),
|
int (*set)(struct param_d *p, void *priv),
|
||||||
int (*get)(struct param_d *p, void *priv),
|
int (*get)(struct param_d *p, void *priv),
|
||||||
|
|
|
@ -468,6 +468,32 @@ struct param_d *dev_add_param_int_ro(struct device_d *dev, const char *name,
|
||||||
return &piro->param;
|
return &piro->param;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* dev_add_param_llint_ro - add a read only long long parameter to a device
|
||||||
|
* @param dev The device
|
||||||
|
* @param name The name of the parameter
|
||||||
|
* @param value The value of the parameter
|
||||||
|
* @param format the printf format used to print the value
|
||||||
|
*/
|
||||||
|
struct param_d *dev_add_param_llint_ro(struct device_d *dev, const char *name,
|
||||||
|
long long value, const char *format)
|
||||||
|
{
|
||||||
|
struct param_int *piro;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
piro = xzalloc(sizeof(*piro));
|
||||||
|
|
||||||
|
ret = __dev_add_param(&piro->param, dev, name, NULL, NULL, 0);
|
||||||
|
if (ret) {
|
||||||
|
free(piro);
|
||||||
|
return ERR_PTR(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
piro->param.value = asprintf(format, value);
|
||||||
|
|
||||||
|
return &piro->param;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_NET
|
#ifdef CONFIG_NET
|
||||||
struct param_ip {
|
struct param_ip {
|
||||||
struct param_d param;
|
struct param_d param;
|
||||||
|
|
Loading…
Reference in New Issue