@@ -42,6 +42,7 @@
#include "qapi/visitor.h"
#include "qemu/module.h"
#include "qom/object.h"
+#include "hw/sensor/tmp421.h"
/* Manufacturer / Device ID's */
#define TMP421_MANUFACTURER_ID 0x55
@@ -80,9 +81,6 @@ struct TMP421Class {
uint8_t config2_reset;
};
-#define TYPE_TMP421 "tmp421"
-#define TYPE_TMP422 "tmp422"
-#define TYPE_TMP423 "tmp423"
OBJECT_DECLARE_TYPE(TMP421State, TMP421Class, TMP421)
new file mode 100644
@@ -0,0 +1,19 @@
+/*
+ * Texas Instruments TMP421/TMP422/TMP423 temperature sensor
+ *
+ * Browse the data sheet:
+ *
+ * https://www.ti.com/lit/gpn/tmp421
+ *
+ * Copyright (c) 2016 IBM Corporation.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#ifndef HW_SENSOR_TMP421_H
+#define HW_SENSOR_TMP421_H
+
+#define TYPE_TMP421 "tmp421"
+#define TYPE_TMP422 "tmp422"
+#define TYPE_TMP423 "tmp423"
+
+#endif
Move TYPE_TMP421/TYPE_TMP422/TYPE_TMP423 from tmp421.c into a new include/hw/sensor/tmp421.h, so boards instantiating the device share one definition instead of repeating the type strings locally. Signed-off-by: Emmanuel Blot <emmanuel.blot@free.fr> --- hw/sensor/tmp421.c | 4 +--- include/hw/sensor/tmp421.h | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-)