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 <[email protected]> --- hw/sensor/tmp421.c | 4 +--- include/hw/sensor/tmp421.h | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/hw/sensor/tmp421.c b/hw/sensor/tmp421.c index e391bb20e1..5c04960b29 100644 --- a/hw/sensor/tmp421.c +++ b/hw/sensor/tmp421.c @@ -41,6 +41,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 @@ -79,9 +80,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 -- 2.53.0-Meta
