All of lore.kernel.org
 help / color / mirror / Atom feed
From: peter.crosthwaite@xilinx.com
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org,
	Peter Crosthwaite <peter.crosthwaite@xilinx.com>,
	afaerber@suse.de, edgar.iglesias@gmail.com
Subject: [Qemu-devel] [PATCH v1 4/5] block/nand: Convert Sysbus::init to Device::realize
Date: Tue, 18 Jun 2013 21:11:52 +1000	[thread overview]
Message-ID: <c58f8529510c849b9a6deab9194f685b695d98ac.1371553360.git.peter.crosthwaite@xilinx.com> (raw)
In-Reply-To: <cover.1371553360.git.peter.crosthwaite@xilinx.com>

From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

The prescribed transition from Sysbus::init function to a
Device::realize.

Cc: afaerber@suse.de

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---

 hw/block/nand.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/hw/block/nand.c b/hw/block/nand.c
index d2469f5..8dca3bc 100644
--- a/hw/block/nand.c
+++ b/hw/block/nand.c
@@ -367,7 +367,7 @@ static const VMStateDescription vmstate_nand = {
     }
 };
 
-static int nand_device_init(SysBusDevice *dev)
+static void nand_realize(DeviceState *dev, Error **errp)
 {
     int pagesize;
     NANDFlashState *s = NAND(dev);
@@ -393,16 +393,17 @@ static int nand_device_init(SysBusDevice *dev)
         nand_init_2048(s);
         break;
     default:
-        error_report("Unsupported NAND block size");
-        return -1;
+        error_setg(errp, "Unsupported NAND block size %#x\n",
+                   1 << s->page_shift);
+        return;
     }
 
     pagesize = 1 << s->oob_shift;
     s->mem_oob = 1;
     if (s->bdrv) {
         if (bdrv_is_read_only(s->bdrv)) {
-            error_report("Can't use a read-only drive");
-            return -1;
+            error_setg(errp, "Can't use a read-only drive");
+            return;
         }
         if (bdrv_getlength(s->bdrv) >=
                 (s->pages << s->page_shift) + (s->pages << s->oob_shift)) {
@@ -418,8 +419,6 @@ static int nand_device_init(SysBusDevice *dev)
     }
     /* Give s->ioaddr a sane value in case we save state before it is used. */
     s->ioaddr = s->io;
-
-    return 0;
 }
 
 static Property nand_properties[] = {
@@ -432,9 +431,8 @@ static Property nand_properties[] = {
 static void nand_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
-    SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
 
-    k->init = nand_device_init;
+    dc->realize = nand_realize;
     dc->reset = nand_reset;
     dc->vmsd = &vmstate_nand;
     dc->props = nand_properties;
-- 
1.8.3.rc1.44.gb387c77.dirty

  parent reply	other threads:[~2013-06-18 11:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-18 11:07 [Qemu-devel] [PATCH v1 0/5] Nand Cleanup peter.crosthwaite
2013-06-18 11:08 ` [Qemu-devel] [PATCH v1 1/5] block/nand: Factor out common code peter.crosthwaite
2013-06-19  8:09   ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2013-06-19  8:13     ` Peter Crosthwaite
2013-06-19  8:47       ` Michael Tokarev
2013-07-31 23:49     ` Peter Crosthwaite
2013-06-19  8:54   ` [Qemu-devel] " Peter Maydell
2013-06-18 11:08 ` [Qemu-devel] [PATCH v1 2/5] block/nand: Formatting sweep peter.crosthwaite
2013-06-19  7:53   ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2013-06-18 11:10 ` [Qemu-devel] [PATCH v1 3/5] block/nand: QOM casting sweep peter.crosthwaite
2013-06-19 10:52   ` Andreas Färber
2013-06-18 11:11 ` peter.crosthwaite [this message]
2013-06-19 10:56   ` [Qemu-devel] [PATCH v1 4/5] block/nand: Convert Sysbus::init to Device::realize Andreas Färber
2013-06-18 11:12 ` [Qemu-devel] [PATCH v1 5/5] nand: Don't inherit from Sysbus peter.crosthwaite
2013-06-19 11:06   ` Andreas Färber
2013-06-25 18:16 ` [Qemu-devel] [PATCH v1 0/5] Nand Cleanup Peter Maydell
2013-06-26  0:37   ` Peter Crosthwaite

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=c58f8529510c849b9a6deab9194f685b695d98ac.1371553360.git.peter.crosthwaite@xilinx.com \
    --to=peter.crosthwaite@xilinx.com \
    --cc=afaerber@suse.de \
    --cc=edgar.iglesias@gmail.com \
    --cc=peter.maydell@linaro.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.