[5/5] libpdbg: Change get_target_class() to take a pdbg_target
diff mbox series

Message ID 20190820071906.25950-5-alistair@popple.id.au
State Accepted
Headers show
Series
  • [1/5] libpdbg: Rename adu class to mem
Related show

Checks

Context Check Description
snowpatch_ozlabs/apply_patch fail Failed to apply to any branch

Commit Message

Alistair Popple Aug. 20, 2019, 7:19 a.m. UTC
No behavioural change.

Signed-off-by: Alistair Popple <alistair@popple.id.au>
Reviewed-by: Amitay Isaacs <amitay@ozlabs.org>
---
 libpdbg/device.c | 2 +-
 libpdbg/target.c | 8 ++++----
 libpdbg/target.h | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

Patch
diff mbox series

diff --git a/libpdbg/device.c b/libpdbg/device.c
index c4cbc44..13d3314 100644
--- a/libpdbg/device.c
+++ b/libpdbg/device.c
@@ -109,7 +109,7 @@  static struct pdbg_target *pdbg_target_new(const void *fdt, int node_offset)
 	 * guaranteed to be the struct pdbg_target (see the comment
 	 * above DECLARE_HW_UNIT). */
 	memcpy(target, hw_info->hw_unit, size);
-	target_class = get_target_class(target->class);
+	target_class = get_target_class(target);
 	list_add_tail(&target_class->targets, &target->class_link);
 
 	return target;
diff --git a/libpdbg/target.c b/libpdbg/target.c
index 67191b5..5808d02 100644
--- a/libpdbg/target.c
+++ b/libpdbg/target.c
@@ -356,18 +356,18 @@  struct pdbg_target_class *require_target_class(const char *name)
 }
 
 /* Returns the existing class or allocates space for a new one */
-struct pdbg_target_class *get_target_class(const char *name)
+struct pdbg_target_class *get_target_class(struct pdbg_target *target)
 {
 	struct pdbg_target_class *target_class;
 
-	if ((target_class = find_target_class(name)))
+	if ((target_class = find_target_class(target->class)))
 		return target_class;
 
 	/* Need to allocate a new class */
-	PR_DEBUG("Allocating %s target class\n", name);
+	PR_DEBUG("Allocating %s target class\n", target->class);
 	target_class = calloc(1, sizeof(*target_class));
 	assert(target_class);
-	target_class->name = strdup(name);
+	target_class->name = strdup(target->class);
 	list_head_init(&target_class->targets);
 	list_add_tail(&target_classes, &target_class->class_head_link);
 	return target_class;
diff --git a/libpdbg/target.h b/libpdbg/target.h
index 9394447..2ecbf98 100644
--- a/libpdbg/target.h
+++ b/libpdbg/target.h
@@ -55,7 +55,7 @@  struct pdbg_target {
 struct pdbg_target *require_target_parent(struct pdbg_target *target);
 struct pdbg_target_class *find_target_class(const char *name);
 struct pdbg_target_class *require_target_class(const char *name);
-struct pdbg_target_class *get_target_class(const char *name);
+struct pdbg_target_class *get_target_class(struct pdbg_target *target);
 bool pdbg_target_is_class(struct pdbg_target *target, const char *class);
 
 extern struct list_head empty_list;