qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v1 1/5] block/nand: Factor out common code


From: peter . crosthwaite
Subject: [Qemu-devel] [PATCH v1 1/5] block/nand: Factor out common code
Date: Tue, 18 Jun 2013 21:08:02 +1000

From: Peter Crosthwaite <address@hidden>

Most of this computation of s->iolen is the same for both the if and
else paths here. Factor out the common parts outside the if.

Cc: address@hidden

Signed-off-by: Peter Crosthwaite <address@hidden>
---

 hw/block/nand.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/block/nand.c b/hw/block/nand.c
index 087ca14..6309f93 100644
--- a/hw/block/nand.c
+++ b/hw/block/nand.c
@@ -272,10 +272,10 @@ static void nand_command(NANDFlashState *s)
             break;
         offset = s->addr & ((1 << s->addr_shift) - 1);
         s->blk_load(s, s->addr, offset);
-        if (s->gnd)
-            s->iolen = (1 << s->page_shift) - offset;
-        else
-            s->iolen = (1 << s->page_shift) + (1 << s->oob_shift) - offset;
+        s->iolen = (1 << s->page_shift) - offset;
+        if (!s->gnd) {
+            s->iolen += 1 << s->oob_shift;
+        }
         break;
 
     case NAND_CMD_RESET:
-- 
1.8.3.rc1.44.gb387c77.dirty




reply via email to

[Prev in Thread] Current Thread [Next in Thread]