[PATCH 10/14] hw/i2c/smbus: Extract QOM ICH9 definitions to 'smbus_ich9.h'

Philippe Mathieu-Daudé posted 14 patches 8 months, 4 weeks ago
There is a newer version of this series
[PATCH 10/14] hw/i2c/smbus: Extract QOM ICH9 definitions to 'smbus_ich9.h'
Posted by Philippe Mathieu-Daudé 8 months, 4 weeks ago
Expose TYPE_ICH9_SMB_DEVICE to the new "hw/i2c/smbus_ich9.h"
header.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 MAINTAINERS                 |  1 +
 include/hw/i2c/smbus_ich9.h | 25 +++++++++++++++++++++++++
 hw/i2c/smbus_ich9.c         | 15 ++-------------
 3 files changed, 28 insertions(+), 13 deletions(-)
 create mode 100644 include/hw/i2c/smbus_ich9.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 937ebb5c96..b896d953af 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2611,6 +2611,7 @@ F: hw/ide/ich.c
 F: hw/isa/lpc_ich9.c
 F: hw/southbridge/ich9.c
 F: include/hw/acpi/ich9*.h
+F: include/hw/i2c/smbus_ich9.h
 F: include/hw/ide/ahci-pci.h
 F: include/hw/pci-bridge/ich_dmi_pci.h
 F: include/hw/southbridge/ich9.h
diff --git a/include/hw/i2c/smbus_ich9.h b/include/hw/i2c/smbus_ich9.h
new file mode 100644
index 0000000000..d716cbca33
--- /dev/null
+++ b/include/hw/i2c/smbus_ich9.h
@@ -0,0 +1,25 @@
+/*
+ * QEMU ICH9 SMBus emulation
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#ifndef HW_I2C_SMBUS_ICH9_H
+#define HW_I2C_SMBUS_ICH9_H
+
+#include "qom/object.h"
+#include "hw/pci/pci_device.h"
+#include "hw/i2c/pm_smbus.h"
+
+#define TYPE_ICH9_SMB_DEVICE "ICH9-SMB"
+
+OBJECT_DECLARE_SIMPLE_TYPE(ICH9SMBState, ICH9_SMB_DEVICE)
+
+struct ICH9SMBState {
+    PCIDevice dev;
+
+    bool irq_enabled;
+
+    PMSMBus smb;
+};
+
+#endif
diff --git a/hw/i2c/smbus_ich9.c b/hw/i2c/smbus_ich9.c
index 208f263ac5..3980bca4c5 100644
--- a/hw/i2c/smbus_ich9.c
+++ b/hw/i2c/smbus_ich9.c
@@ -1,5 +1,5 @@
 /*
- * ACPI implementation
+ * QEMU ICH9 SMBus emulation
  *
  * Copyright (c) 2006 Fabrice Bellard
  * Copyright (c) 2009 Isaku Yamahata <yamahata at valinux co jp>
@@ -22,8 +22,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu/range.h"
-#include "hw/i2c/pm_smbus.h"
-#include "hw/pci/pci.h"
+#include "hw/i2c/smbus_ich9.h"
 #include "migration/vmstate.h"
 #include "qemu/module.h"
 
@@ -31,16 +30,6 @@
 #include "qom/object.h"
 #include "hw/acpi/acpi_aml_interface.h"
 
-OBJECT_DECLARE_SIMPLE_TYPE(ICH9SMBState, ICH9_SMB_DEVICE)
-
-struct ICH9SMBState {
-    PCIDevice dev;
-
-    bool irq_enabled;
-
-    PMSMBus smb;
-};
-
 static bool ich9_vmstate_need_smbus(void *opaque, int version_id)
 {
     return pm_smbus_vmstate_needed();
-- 
2.41.0