qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 6/6] hw/sd.c: convert to QOM object


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 6/6] hw/sd.c: convert to QOM object
Date: Mon, 2 Apr 2012 17:48:19 +0100

On 2 April 2012 15:28, Igor Mitsyanko <address@hidden> wrote:
> +    s->card = SD_CARD(object_new(TYPE_SD_CARD));
>     dinfo = drive_get_next(IF_SD);
> -    s->card = sd_init(dinfo ? dinfo->bdrv : NULL, 0);
> +    SD_GET_CLASS(s->card)->init(s->card, dinfo ? dinfo->bdrv : NULL, false);

Ideally rather than having a class specific init function we
should make the 'is_spi' and 'bdrv' be object properties, and
then you do something like (syntax probably wrong but):
  s->card = SD_CARD(object_new(TYPE_SD_CARD));
  if (dinfo) {
     object_property_set_bdrv(s->card, dinfo->bdrv, "bdrv", errp);
  }
  realize(s->card);

(where the default for bdrv is NULL and the default for is_spi is false
so we don't need to set that).

This needs realize support for QOM objects, though.

-- PMM



reply via email to

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