qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 2/3] Clean up upcast from PCIDevice to I6300State
Date: Fri, 21 Aug 2009 10:31:33 +0200	[thread overview]
Message-ID: <1250843494-28326-3-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1250843494-28326-1-git-send-email-armbru@redhat.com>


Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/wdt_i6300esb.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/hw/wdt_i6300esb.c b/hw/wdt_i6300esb.c
index 5e9fd7c..2227303 100644
--- a/hw/wdt_i6300esb.c
+++ b/hw/wdt_i6300esb.c
@@ -25,7 +25,6 @@
 #include "qemu-timer.h"
 #include "watchdog.h"
 #include "hw.h"
-#include "isa.h"
 #include "pc.h"
 #include "pci.h"
 
@@ -71,7 +70,7 @@
 
 /* Device state. */
 struct I6300State {
-    PCIDevice dev;              /* PCI device state, must be first field. */
+    PCIDevice dev;
 
     int reboot_enabled;         /* "Reboot" on timer expiry.  The real action
                                  * performed depends on the -watchdog-action
@@ -199,7 +198,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 = (I6300State *) dev;
+    I6300State *d = container_of(dev, I6300State, dev);
     int old;
 
     i6300esb_debug("addr = %x, data = %x, len = %d\n", addr, data, len);
@@ -227,7 +226,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 = (I6300State *) dev;
+    I6300State *d = container_of(dev, I6300State, dev);
     uint32_t data;
 
     i6300esb_debug ("addr = %x, len = %d\n", addr, len);
@@ -361,7 +360,7 @@ static void i6300esb_map(PCIDevice *dev, int region_num,
         i6300esb_mem_writew,
         i6300esb_mem_writel,
     };
-    I6300State *d = (I6300State *) dev;
+    I6300State *d = container_of(dev, I6300State, dev);
     int io_mem;
 
     i6300esb_debug("addr = %x, size = %x, type = %d\n", addr, size, type);
-- 
1.6.0.6

  parent reply	other threads:[~2009-08-21  8:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-21  8:31 [Qemu-devel] [PATCH 0/3] qdev: clean up & convert watchdogs Markus Armbruster
2009-08-21  8:31 ` [Qemu-devel] [PATCH 1/3] Move watchdog, watchdog_action, give them internal linkage Markus Armbruster
2009-08-21  8:31 ` Markus Armbruster [this message]
     [not found]   ` <m3ws4xt7up.fsf@neno.mitica>
2009-08-24  8:49     ` [Qemu-devel] container_of() vs DO_UPCAST() (was: [PATCH 2/3] Clean up upcast from PCIDevice to I6300State) Markus Armbruster
2009-08-24 11:55       ` Paul Brook
2009-08-24 11:59   ` [Qemu-devel] [PATCH 2/3] Clean up upcast from PCIDevice to I6300State Paul Brook
2009-08-24 13:44     ` Markus Armbruster
2009-08-24 15:07       ` Gerd Hoffmann
2009-08-21  8:31 ` [Qemu-devel] [PATCH 3/3] qdev: convert watchdogs Markus Armbruster
2009-08-21 13:07   ` Gerd Hoffmann
2009-08-24  9:05     ` Immutable qdev properties (was: [Qemu-devel] [PATCH 3/3] qdev: convert watchdogs) Markus Armbruster
2009-08-24 12:25       ` [Qemu-devel] Re: Immutable qdev properties Gerd Hoffmann
2009-08-24 13:04         ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1250843494-28326-3-git-send-email-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).