Patchwork [v2,02/18] hw/onenand: Remove unnecessary argument from onenand_command()

login
register
mail settings
Submitter Peter Maydell
Date Aug. 28, 2011, 4:56 p.m.
Message ID <1314550628-26869-4-git-send-email-peter.maydell@linaro.org>
Download mbox | patch
Permalink /patch/111920/
State New
Headers show

Comments

Peter Maydell - Aug. 28, 2011, 4:56 p.m.
From: Juha Riihimäki <juha.riihimaki@nokia.com>

Refactor onenand_command() -- since it is essentially a method of
the device object, it doesn't make sense to pass in something as
an argument which is one of the object's own member fields.

Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
[Riku Voipio: Fixes and restructuring patchset]
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
[Peter Maydell: More fixes and cleanups for upstream submission]
Signed-off-by:  Peter Maydell <peter.maydell@linaro.org>
---
 hw/onenand.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

Patch

diff --git a/hw/onenand.c b/hw/onenand.c
index 00276a0..1706842 100644
--- a/hw/onenand.c
+++ b/hw/onenand.c
@@ -326,7 +326,7 @@  fail:
     return 1;
 }
 
-static void onenand_command(OneNANDState *s, int cmd)
+static void onenand_command(OneNANDState *s)
 {
     int b;
     int sec;
@@ -346,7 +346,7 @@  static void onenand_command(OneNANDState *s, int cmd)
             s->data[(s->bufaddr >> 2) & 1][1] : s->boot[1];	\
     buf += (s->bufaddr & 3) << 4;
 
-    switch (cmd) {
+    switch (s->command) {
     case 0x00:	/* Load single/multiple sector data unit into buffer */
         SETADDR(ONEN_BUF_BLOCK, ONEN_BUF_PAGE)
 
@@ -527,7 +527,7 @@  static void onenand_command(OneNANDState *s, int cmd)
         s->status |= ONEN_ERR_CMD;
         s->intstatus |= ONEN_INT;
         fprintf(stderr, "%s: unknown OneNAND command %x\n",
-                        __FUNCTION__, cmd);
+                        __func__, s->command);
     }
 
     onenand_intr_update(s);
@@ -659,7 +659,7 @@  static void onenand_write(void *opaque, target_phys_addr_t addr,
         if (s->intstatus & (1 << 15))
             break;
         s->command = value;
-        onenand_command(s, s->command);
+        onenand_command(s);
         break;
     case 0xf221:	/* System Configuration 1 */
         s->config[0] = value;