[Pdbg] [PATCH 3/8] libpdbg: Move hw_unit related code to a separate file
Amitay Isaacs
amitay at ozlabs.org
Thu Jun 13 13:24:11 AEST 2019
Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
Makefile.am | 1 +
libpdbg/hwunit.c | 36 ++++++++++++++++++++++++++++++++++++
libpdbg/target.c | 16 ----------------
3 files changed, 37 insertions(+), 16 deletions(-)
create mode 100644 libpdbg/hwunit.c
diff --git a/Makefile.am b/Makefile.am
index 707df6b..4e7f34a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -159,6 +159,7 @@ libpdbg_la_SOURCES = \
libpdbg/fake.c \
libpdbg/host.c \
libpdbg/htm.c \
+ libpdbg/hwunit.c \
libpdbg/hwunit.h \
libpdbg/i2c.c \
libpdbg/kernel.c \
diff --git a/libpdbg/hwunit.c b/libpdbg/hwunit.c
new file mode 100644
index 0000000..db03d63
--- /dev/null
+++ b/libpdbg/hwunit.c
@@ -0,0 +1,36 @@
+/* Copyright 2019 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <string.h>
+
+#include "hwunit.h"
+
+extern struct hw_unit_info *__start_hw_units;
+extern struct hw_init_info *__stop_hw_units;
+struct hw_unit_info *find_compatible_target(const char *compat)
+{
+ struct hw_unit_info **p;
+ struct pdbg_target *target;
+
+ for (p = &__start_hw_units; p < (struct hw_unit_info **) &__stop_hw_units; p++) {
+ target = (*p)->hw_unit;
+ if (!strcmp(target->compatible, compat))
+ return *p;
+ }
+
+ return NULL;
+}
+
diff --git a/libpdbg/target.c b/libpdbg/target.c
index 2ae50cb..cbe972d 100644
--- a/libpdbg/target.c
+++ b/libpdbg/target.c
@@ -286,22 +286,6 @@ struct pdbg_target_class *get_target_class(const char *name)
return target_class;
}
-extern struct hw_unit_info *__start_hw_units;
-extern struct hw_init_info *__stop_hw_units;
-struct hw_unit_info *find_compatible_target(const char *compat)
-{
- struct hw_unit_info **p;
- struct pdbg_target *target;
-
- for (p = &__start_hw_units; p < (struct hw_unit_info **) &__stop_hw_units; p++) {
- target = (*p)->hw_unit;
- if (!strcmp(target->compatible, compat))
- return *p;
- }
-
- return NULL;
-}
-
/* We walk the tree root down disabling targets which might/should
* exist but don't */
enum pdbg_target_status pdbg_target_probe(struct pdbg_target *target)
--
2.21.0
More information about the Pdbg
mailing list