diff mbox series

[10/16] hw/sensor: tmp421: publish the variant type names

Message ID 20261105-sensor-tmp421-v1-10-c46853f5e1f0@free.fr
State New
Headers show
Series hw/sensor: TMP421 improvements | expand

Commit Message

Emmanuel Blot Nov. 5, 2026, 9:25 a.m. UTC
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(-)
diff mbox series

Patch

diff --git a/hw/sensor/tmp421.c b/hw/sensor/tmp421.c
index 1966301d7a..1d3d526d4a 100644
--- a/hw/sensor/tmp421.c
+++ b/hw/sensor/tmp421.c
@@ -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)
 
 
diff --git a/include/hw/sensor/tmp421.h b/include/hw/sensor/tmp421.h
new file mode 100644
index 0000000000..fbfdd87b7a
--- /dev/null
+++ b/include/hw/sensor/tmp421.h
@@ -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