On 04/11/2012 02:26 PM, Peter Maydell wrote:
On 5 April 2012 16:48, Igor Mitsyanko<i.mitsya...@samsung.com>  wrote:
A straightforward conversion of SD card implementation to a proper QEMU object.

Signed-off-by: Igor Mitsyanko<i.mitsya...@samsung.com>
---
  hw/milkymist-memcard.c |   24 ++++++++++++++----------
  hw/omap_mmc.c          |   28 ++++++++++++++++------------
  hw/pl181.c             |   14 ++++++++------
  hw/pxa2xx_mmci.c       |   22 ++++++++++++++--------
  hw/sd.c                |   48 +++++++++++++++++++++++++++++++++++++-----------
  hw/sd.h                |   38 ++++++++++++++++++++++++++++++--------
  hw/ssi-sd.c            |   11 ++++++-----
  7 files changed, 125 insertions(+), 60 deletions(-)

diff --git a/hw/milkymist-memcard.c b/hw/milkymist-memcard.c
index 3515c3c..1d84d44 100644
--- a/hw/milkymist-memcard.c
+++ b/hw/milkymist-memcard.c
@@ -97,7 +97,7 @@ static void memcard_sd_command(MilkymistMemcardState *s)
     req.crc = s->command[5];

     s->response[0] = req.cmd;
-    s->response_len = sd_do_command(s->card,&req, s->response+1);
+    s->response_len = SD_DO_COMMAND(s->card,&req, s->response + 1);
Does our object model really demand this kind of conversion to all-caps?
Seems kind of ugly and churny :-(
I think it doesn't, it's just a response to Paolo's request to replace
SD_GET_CLASS(s->card)->do_command(s->card, &req, s->response + 1) with something
not so long.
Also, we can leave functions be for now, and convert them to class methods only when somebody actually needs
to override them. Its not encapsulation-righteous though, I don't like this.

--
Mitsyanko Igor
ASWG, Moscow R&D center, Samsung Electronics
email: i.mitsya...@samsung.com


Reply via email to