Message ID | 20181107053943.4307-11-alistair@popple.id.au |
---|---|
State | Superseded |
Headers | show |
Series | Cleanup old code | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | master/apply_patch Successfully applied |
snowpatch_ozlabs/build-multiarch | success | Test build-multiarch on branch master |
Reviewed-by: Amitay Isaacs <amitay@ozlabs.org> On Wed, 2018-11-07 at 16:39 +1100, Alistair Popple wrote: > Some of the functions dealing with target properties have somewhat > inconsistent naming. This patch renames them and adds #defines for > backwards compatibility for external projects. These will be removed > once older projects have moved over to the new names. > > Signed-off-by: Alistair Popple <alistair@popple.id.au> > --- > libpdbg/device.c | 6 +++--- > libpdbg/libpdbg.c | 4 ++-- > libpdbg/libpdbg.h | 13 ++++++++++--- > libpdbg/xbus.c | 2 +- > src/main.c | 2 +- > 5 files changed, 17 insertions(+), 10 deletions(-) > > diff --git a/libpdbg/device.c b/libpdbg/device.c > index af2973b..226cf12 100644 > --- a/libpdbg/device.c > +++ b/libpdbg/device.c > @@ -375,7 +375,7 @@ static void dt_resize_property(struct dt_property > **prop, size_t len) > (*prop)->list.prev->next = &(*prop)->list; > } > > -void pdbg_set_target_property(struct pdbg_target *target, const char > *name, const void *val, size_t size) > +void pdbg_target_set_property(struct pdbg_target *target, const char > *name, const void *val, size_t size) > { > struct dt_property *p; > > @@ -391,7 +391,7 @@ void pdbg_set_target_property(struct pdbg_target > *target, const char *name, cons > } > } > > -void *pdbg_get_target_property(struct pdbg_target *target, const > char *name, size_t *size) > +void *pdbg_target_property(struct pdbg_target *target, const char > *name, size_t *size) > { > struct dt_property *p; > > @@ -634,7 +634,7 @@ static void dt_expand(const void *fdt) > abort(); > } > > -u64 dt_get_number(const void *pdata, unsigned int cells) > +static u64 dt_get_number(const void *pdata, unsigned int cells) > { > const u32 *p = pdata; > u64 ret = 0; > diff --git a/libpdbg/libpdbg.c b/libpdbg/libpdbg.c > index 8af216c..f638fd2 100644 > --- a/libpdbg/libpdbg.c > +++ b/libpdbg/libpdbg.c > @@ -135,12 +135,12 @@ const char *pdbg_target_dn_name(struct > pdbg_target *target) > return target->dn_name; > } > > -int pdbg_get_target_u32_property(struct pdbg_target *target, const > char *name, uint32_t *val) > +int pdbg_target_u32_property(struct pdbg_target *target, const char > *name, uint32_t *val) > { > uint32_t *p; > size_t size; > > - p = pdbg_get_target_property(target, name, &size); > + p = pdbg_target_property(target, name, &size); > if (!p) > return -1; > > diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h > index 959c2ef..8d8f0a3 100644 > --- a/libpdbg/libpdbg.h > +++ b/libpdbg/libpdbg.h > @@ -68,13 +68,20 @@ struct pdbg_target *pdbg_target_parent(const char > *klass, struct pdbg_target *ta > struct pdbg_target *pdbg_target_require_parent(const char *klass, > struct pdbg_target *target); > > /* Set the given property. Will automatically add one if one doesn't > exist */ > -void pdbg_set_target_property(struct pdbg_target *target, const char > *name, const void *val, size_t size); > +void pdbg_target_set_property(struct pdbg_target *target, const char > *name, const void *val, size_t size); > > /* Get the given property and return the size */ > -void *pdbg_get_target_property(struct pdbg_target *target, const > char *name, size_t *size); > -int pdbg_get_target_u32_property(struct pdbg_target *target, const > char *name, uint32_t *val); > +void *pdbg_target_property(struct pdbg_target *target, const char > *name, size_t *size); > +int pdbg_target_u32_property(struct pdbg_target *target, const char > *name, uint32_t *val); > uint64_t pdbg_get_address(struct pdbg_target *target, uint64_t > *size); > > +/* Old deprecated for names for the above. Do not use for new > projects > + * as these will be removed at some future point. */ > +#define pdbg_set_target_property(target, name, val, size) \ > + pdbg_target_set_property(target, name, val, size) > +#define pdbg_get_target_property(target, name, size) \ > + pdbg_target_property(target, name, size) > + > /* Misc. */ > void pdbg_targets_init(void *fdt); > void pdbg_target_probe_all(struct pdbg_target *parent); > diff --git a/libpdbg/xbus.c b/libpdbg/xbus.c > index 69489bb..661b9a3 100644 > --- a/libpdbg/xbus.c > +++ b/libpdbg/xbus.c > @@ -41,7 +41,7 @@ static int xbus_probe(struct pdbg_target *target) > { > struct xbus *xbus = target_to_xbus(target); > > - if (pdbg_get_target_u32_property(&xbus->target, "ring-id", > &xbus->ring_id)) { > + if (pdbg_target_u32_property(&xbus->target, "ring-id", &xbus- > >ring_id)) { > printf("Unknown ring-id on %s@%d\n", > pdbg_target_name(&xbus->target), > pdbg_target_index(&xbus->target)); > return -1; > diff --git a/src/main.c b/src/main.c > index 8ee0e38..40fa48b 100644 > --- a/src/main.c > +++ b/src/main.c > @@ -677,7 +677,7 @@ static int target_selection(void) > int proc_index = pdbg_target_index(pib); > > if (backend == I2C && device_node) > - pdbg_set_target_property(pib, "bus", > device_node, strlen(device_node) + 1); > + pdbg_target_set_property(pib, "bus", > device_node, strlen(device_node) + 1); > > if (processorsel[proc_index]) { > target_select(pib); > -- > 2.11.0 > Amitay.
diff --git a/libpdbg/device.c b/libpdbg/device.c index af2973b..226cf12 100644 --- a/libpdbg/device.c +++ b/libpdbg/device.c @@ -375,7 +375,7 @@ static void dt_resize_property(struct dt_property **prop, size_t len) (*prop)->list.prev->next = &(*prop)->list; } -void pdbg_set_target_property(struct pdbg_target *target, const char *name, const void *val, size_t size) +void pdbg_target_set_property(struct pdbg_target *target, const char *name, const void *val, size_t size) { struct dt_property *p; @@ -391,7 +391,7 @@ void pdbg_set_target_property(struct pdbg_target *target, const char *name, cons } } -void *pdbg_get_target_property(struct pdbg_target *target, const char *name, size_t *size) +void *pdbg_target_property(struct pdbg_target *target, const char *name, size_t *size) { struct dt_property *p; @@ -634,7 +634,7 @@ static void dt_expand(const void *fdt) abort(); } -u64 dt_get_number(const void *pdata, unsigned int cells) +static u64 dt_get_number(const void *pdata, unsigned int cells) { const u32 *p = pdata; u64 ret = 0; diff --git a/libpdbg/libpdbg.c b/libpdbg/libpdbg.c index 8af216c..f638fd2 100644 --- a/libpdbg/libpdbg.c +++ b/libpdbg/libpdbg.c @@ -135,12 +135,12 @@ const char *pdbg_target_dn_name(struct pdbg_target *target) return target->dn_name; } -int pdbg_get_target_u32_property(struct pdbg_target *target, const char *name, uint32_t *val) +int pdbg_target_u32_property(struct pdbg_target *target, const char *name, uint32_t *val) { uint32_t *p; size_t size; - p = pdbg_get_target_property(target, name, &size); + p = pdbg_target_property(target, name, &size); if (!p) return -1; diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h index 959c2ef..8d8f0a3 100644 --- a/libpdbg/libpdbg.h +++ b/libpdbg/libpdbg.h @@ -68,13 +68,20 @@ struct pdbg_target *pdbg_target_parent(const char *klass, struct pdbg_target *ta struct pdbg_target *pdbg_target_require_parent(const char *klass, struct pdbg_target *target); /* Set the given property. Will automatically add one if one doesn't exist */ -void pdbg_set_target_property(struct pdbg_target *target, const char *name, const void *val, size_t size); +void pdbg_target_set_property(struct pdbg_target *target, const char *name, const void *val, size_t size); /* Get the given property and return the size */ -void *pdbg_get_target_property(struct pdbg_target *target, const char *name, size_t *size); -int pdbg_get_target_u32_property(struct pdbg_target *target, const char *name, uint32_t *val); +void *pdbg_target_property(struct pdbg_target *target, const char *name, size_t *size); +int pdbg_target_u32_property(struct pdbg_target *target, const char *name, uint32_t *val); uint64_t pdbg_get_address(struct pdbg_target *target, uint64_t *size); +/* Old deprecated for names for the above. Do not use for new projects + * as these will be removed at some future point. */ +#define pdbg_set_target_property(target, name, val, size) \ + pdbg_target_set_property(target, name, val, size) +#define pdbg_get_target_property(target, name, size) \ + pdbg_target_property(target, name, size) + /* Misc. */ void pdbg_targets_init(void *fdt); void pdbg_target_probe_all(struct pdbg_target *parent); diff --git a/libpdbg/xbus.c b/libpdbg/xbus.c index 69489bb..661b9a3 100644 --- a/libpdbg/xbus.c +++ b/libpdbg/xbus.c @@ -41,7 +41,7 @@ static int xbus_probe(struct pdbg_target *target) { struct xbus *xbus = target_to_xbus(target); - if (pdbg_get_target_u32_property(&xbus->target, "ring-id", &xbus->ring_id)) { + if (pdbg_target_u32_property(&xbus->target, "ring-id", &xbus->ring_id)) { printf("Unknown ring-id on %s@%d\n", pdbg_target_name(&xbus->target), pdbg_target_index(&xbus->target)); return -1; diff --git a/src/main.c b/src/main.c index 8ee0e38..40fa48b 100644 --- a/src/main.c +++ b/src/main.c @@ -677,7 +677,7 @@ static int target_selection(void) int proc_index = pdbg_target_index(pib); if (backend == I2C && device_node) - pdbg_set_target_property(pib, "bus", device_node, strlen(device_node) + 1); + pdbg_target_set_property(pib, "bus", device_node, strlen(device_node) + 1); if (processorsel[proc_index]) { target_select(pib);
Some of the functions dealing with target properties have somewhat inconsistent naming. This patch renames them and adds #defines for backwards compatibility for external projects. These will be removed once older projects have moved over to the new names. Signed-off-by: Alistair Popple <alistair@popple.id.au> --- libpdbg/device.c | 6 +++--- libpdbg/libpdbg.c | 4 ++-- libpdbg/libpdbg.h | 13 ++++++++++--- libpdbg/xbus.c | 2 +- src/main.c | 2 +- 5 files changed, 17 insertions(+), 10 deletions(-)