[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 057/197] add SMBusDevice to the type hiearchy
From: |
Anthony Liguori |
Subject: |
[Qemu-devel] [PATCH v3 057/197] add SMBusDevice to the type hiearchy |
Date: |
Mon, 12 Dec 2011 14:18:53 -0600 |
---
hw/smbus.c | 15 +++++++++++++++
hw/smbus.h | 13 +++++++++++++
2 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/hw/smbus.c b/hw/smbus.c
index 0cb3566..a75d404 100644
--- a/hw/smbus.c
+++ b/hw/smbus.c
@@ -316,3 +316,18 @@ void smbus_write_block(i2c_bus *bus, uint8_t addr, uint8_t
command, uint8_t *dat
i2c_send(bus, data[i]);
i2c_end_transfer(bus);
}
+
+static TypeInfo smbus_device_type_info = {
+ .name = TYPE_SMBUS_DEVICE,
+ .parent = TYPE_I2C_SLAVE,
+ .instance_size = sizeof(SMBusDevice),
+ .abstract = true,
+ .class_size = sizeof(SMBusDeviceClass),
+};
+
+static void smbus_device_register_devices(void)
+{
+ type_register_static(&smbus_device_type_info);
+}
+
+device_init(smbus_device_register_devices);
diff --git a/hw/smbus.h b/hw/smbus.h
index 2f2d49e..9dd055c 100644
--- a/hw/smbus.h
+++ b/hw/smbus.h
@@ -24,6 +24,19 @@
#include "i2c.h"
+#define TYPE_SMBUS_DEVICE "smbus-device"
+#define SMBUS_DEVICE(obj) \
+ OBJECT_CHECK(SMBUSDevice, (obj), TYPE_SMBUS_DEVICE)
+#define SMBUS_DEVICE_CLASS(klass) \
+ OBJECT_CLASS_CHECK(SMBUSDeviceClass, (klass), TYPE_SMBUS_DEVICE)
+#define SMBUS_DEVICE_GET_CLASS(obj) \
+ OBJECT_GET_CLASS(SMBUSDeviceClass, (obj), TYPE_SMBUS_DEVICE)
+
+typedef struct SMBusDeviceClass
+{
+ I2CSlaveClass parent_class;
+} SMBusDeviceClass;
+
struct SMBusDevice {
/* The SMBus protocol is implemented on top of I2C. */
I2CSlave i2c;
--
1.7.4.1
- [Qemu-devel] [PATCH v3 067/197] remove arrays of PCIDeviceInfo, (continued)
- [Qemu-devel] [PATCH v3 067/197] remove arrays of PCIDeviceInfo, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 050/197] accessors for scsideviceinfo, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 012/197] qdev: add explicitly named devices to the root complex, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 043/197] kill off ISADeviceInfo, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 013/197] dev: add an anonymous peripheral container, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 041/197] add class_init to deviceinfo, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 069/197] patch monkey, that funky monkey, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 030/197] qdev: move qdev->info to class, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 032/197] qdev: user a wrapper to access reset and promote reset to a class method, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 027/197] rename qobject -> object, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 057/197] add SMBusDevice to the type hiearchy,
Anthony Liguori <=
- [Qemu-devel] [PATCH v3 029/197] Start integration of qom w/qdev., Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 062/197] killall HDACodecDeviceInfo, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 028/197] more renames, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 053/197] kill off SCSIDeviceInfo, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 019/197] bug fix spotted by paolo, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 014/197] rtc: make piix3 set the rtc as a child (v2), Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 031/197] qdev: don't access name through info, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 063/197] make spapr a bit more patch monkey friendly, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 004/197] qom: introduce root device, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 044/197] usb: don't access dev->info directly, Anthony Liguori, 2011/12/12