aboutsummaryrefslogtreecommitdiff
path: root/hw/watchdog
diff options
context:
space:
mode:
Diffstat (limited to 'hw/watchdog')
-rw-r--r--hw/watchdog/wdt_i6300esb.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c
index 4ebdbb8586..cfa2b1be13 100644
--- a/hw/watchdog/wdt_i6300esb.c
+++ b/hw/watchdog/wdt_i6300esb.c
@@ -103,6 +103,10 @@ struct I6300State {
typedef struct I6300State I6300State;
+#define TYPE_WATCHDOG_I6300ESB_DEVICE "i6300esb"
+#define WATCHDOG_I6300ESB_DEVICE(obj) \
+ OBJECT_CHECK(I6300State, (obj), TYPE_WATCHDOG_I6300ESB_DEVICE)
+
/* This function is called when the watchdog has either been enabled
* (hence it starts counting down) or has been keep-alived.
*/
@@ -150,7 +154,7 @@ static void i6300esb_disable_timer(I6300State *d)
static void i6300esb_reset(DeviceState *dev)
{
PCIDevice *pdev = PCI_DEVICE(dev);
- I6300State *d = DO_UPCAST(I6300State, dev, pdev);
+ I6300State *d = WATCHDOG_I6300ESB_DEVICE(pdev);
i6300esb_debug("I6300State = %p\n", d);
@@ -213,7 +217,7 @@ static void i6300esb_timer_expired(void *vp)
static void i6300esb_config_write(PCIDevice *dev, uint32_t addr,
uint32_t data, int len)
{
- I6300State *d = DO_UPCAST(I6300State, dev, dev);
+ I6300State *d = WATCHDOG_I6300ESB_DEVICE(dev);
int old;
i6300esb_debug("addr = %x, data = %x, len = %d\n", addr, data, len);
@@ -241,7 +245,7 @@ static void i6300esb_config_write(PCIDevice *dev, uint32_t addr,
static uint32_t i6300esb_config_read(PCIDevice *dev, uint32_t addr, int len)
{
- I6300State *d = DO_UPCAST(I6300State, dev, dev);
+ I6300State *d = WATCHDOG_I6300ESB_DEVICE(dev);
uint32_t data;
i6300esb_debug ("addr = %x, len = %d\n", addr, len);
@@ -416,7 +420,7 @@ static const VMStateDescription vmstate_i6300esb = {
static void i6300esb_realize(PCIDevice *dev, Error **errp)
{
- I6300State *d = DO_UPCAST(I6300State, dev, dev);
+ I6300State *d = WATCHDOG_I6300ESB_DEVICE(dev);
i6300esb_debug("I6300State = %p\n", d);
@@ -451,7 +455,7 @@ static void i6300esb_class_init(ObjectClass *klass, void *data)
}
static const TypeInfo i6300esb_info = {
- .name = "i6300esb",
+ .name = TYPE_WATCHDOG_I6300ESB_DEVICE,
.parent = TYPE_PCI_DEVICE,
.instance_size = sizeof(I6300State),
.class_init = i6300esb_class_init,