From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:46558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ui5Iu-00033A-Mi for qemu-devel@nongnu.org; Thu, 30 May 2013 12:02:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ui5Iq-00056Y-4x for qemu-devel@nongnu.org; Thu, 30 May 2013 12:02:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20531) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ui5Ip-00056H-UW for qemu-devel@nongnu.org; Thu, 30 May 2013 12:02:12 -0400 Message-ID: <51A777F3.70708@redhat.com> Date: Thu, 30 May 2013 18:01:55 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1369920427-18274-1-git-send-email-mst@redhat.com> <1369920427-18274-2-git-send-email-mst@redhat.com> <51A76ACF.9050800@redhat.com> <51A77836.6030806@redhat.com> In-Reply-To: <51A77836.6030806@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/3] pvpanic: use FWCfgState explicitly List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laszlo Ersek Cc: Hu Tao , qemu-devel@nongnu.org, "Michael S. Tsirkin" Il 30/05/2013 18:03, Laszlo Ersek ha scritto: > On 05/30/13 17:05, Laszlo Ersek wrote: >> On 05/30/13 15:27, Michael S. Tsirkin wrote: >>> Use the type-safe FWCfgState structure instead >>> of the unsafe void *. >>> >>> Signed-off-by: Michael S. Tsirkin >>> --- >>> hw/misc/pvpanic.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c >>> index 31e1b1d..1483f27 100644 >>> --- a/hw/misc/pvpanic.c >>> +++ b/hw/misc/pvpanic.c >>> @@ -90,7 +90,7 @@ static int pvpanic_isa_initfn(ISADevice *dev) >>> { >>> PVPanicState *s = ISA_PVPANIC_DEVICE(dev); >>> static bool port_configured; >>> - void *fw_cfg; >>> + FWCfgState *fw_cfg; >>> >>> memory_region_init_io(&s->io, &pvpanic_ops, s, "pvpanic", 1); >>> isa_register_ioport(dev, &s->io, s->ioport); >>> >> >> Doesn't this break your build? Lower down in the function there's >> >> fw_cfg = object_resolve_path("/machine/fw_cfg", NULL); >> >> and object_resolve_path() returns a pointer-to-Object, not >> pointer-to-FWCfgState. > > Paolo explained the guts, but don't we still need a downcast here? (No > idea how to do that nicely in the object model du jour -- maybe > OBJECT_CHECK() or similar?) Patch 2 addresses that. Paolo