summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlrich Ölmann <u.oelmann@pengutronix.de>2018-12-18 14:57:34 +0100
committerRoland Hieber <rhi@pengutronix.de>2019-01-07 12:26:49 +0100
commit52ffce4648f33dc81e4954400ef1c9fa88aa7192 (patch)
tree590eb38d14f3bfacbb82b4a5315ab29861d740aa
parent0f53e32304133799bd50d43586d93ec88900e2ff (diff)
downloaddt-utils-52ffce4648f33dc81e4954400ef1c9fa88aa7192.tar.gz
dt-utils-52ffce4648f33dc81e4954400ef1c9fa88aa7192.tar.xz
state: make parameter functions more consistent
This replaces a dummy version dev_add_param_int() by a dummy version of dev_add_param_uint32() to make the compiler happy and ports the following barebox commit: | commit c5d95eb4c72a2639c10d01a801df00b4c34db315 | Author: Sascha Hauer <s.hauer@pengutronix.de> | Date: Fri Apr 7 11:57:08 2017 +0200 | | param: make parameter functions more consistent | | This patch creates a consitent set of device parameter functions. | | With this we have: dev_add_param_<type><access> | | "type" is one of: int32, uint32, int64, uint64, string, mac, ipv4, enum, | bitmask | The improvement here is that we now can exactly specify the width of the | int type parameters and also correctly distinguish between signed and | unsigned variables which means that a variable no longer ends up with | INT_MAX when it's assigned -1. | | "access" can be empty for regular read/write parameter, "_ro" for readonly | parameters which get their value from a variable pointer in the | background or "_fixed" for parameters which are set to a fixed value | (without a pointer in the background). | | Some more exotic types are not (yet) implemented, like | dev_add_param_ip_ro. | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de> Signed-off-by: Roland Hieber <rhi@pengutronix.de>
-rw-r--r--src/barebox-state/state_variables.c4
-rw-r--r--src/dt/common.h16
2 files changed, 10 insertions, 10 deletions
diff --git a/src/barebox-state/state_variables.c b/src/barebox-state/state_variables.c
index cd42c2a..0a4d23d 100644
--- a/src/barebox-state/state_variables.c
+++ b/src/barebox-state/state_variables.c
@@ -108,7 +108,7 @@ static struct state_variable *state_uint8_create(struct state *state,
su32 = xzalloc(sizeof(*su32));
- param = dev_add_param_int(&state->dev, name, state_uint8_set,
+ param = dev_add_param_uint32(&state->dev, name, state_uint8_set,
NULL, &su32->value, "%u", &su32->var);
if (IS_ERR(param)) {
free(su32);
@@ -136,7 +136,7 @@ static struct state_variable *state_uint32_create(struct state *state,
su32 = xzalloc(sizeof(*su32));
- param = dev_add_param_int(&state->dev, name, state_set_dirty,
+ param = dev_add_param_uint32(&state->dev, name, state_set_dirty,
NULL, &su32->value, "%u", &su32->var);
if (IS_ERR(param)) {
free(su32);
diff --git a/src/dt/common.h b/src/dt/common.h
index 1425c53..6633be6 100644
--- a/src/dt/common.h
+++ b/src/dt/common.h
@@ -357,14 +357,6 @@ struct device_d {
struct device_node *device_node;
};
-static inline struct param_d *dev_add_param_int(struct device_d *dev, const char *name,
- int (*set)(struct param_d *p, void *priv),
- int (*get)(struct param_d *p, void *priv),
- int *value, const char *format, void *priv)
-{
- return NULL;
-}
-
static inline struct param_d *dev_add_param_enum(struct device_d *dev, const char *name,
int (*set)(struct param_d *p, void *priv),
int (*get)(struct param_d *p, void *priv),
@@ -398,6 +390,14 @@ static inline struct param_d *dev_add_param_string(struct device_d *dev, const c
return NULL;
}
+static inline struct param_d *dev_add_param_uint32(struct device_d *dev, const char *name,
+ int (*set)(struct param_d *p, void *priv),
+ int (*get)(struct param_d *p, void *priv),
+ int *value, const char *format, void *priv)
+{
+ return NULL;
+}
+
struct driver_d;
static inline int register_driver(struct driver_d *d)