[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 12/14] pvpanic: add API to access io port
From: |
Michael S. Tsirkin |
Subject: |
Re: [Qemu-devel] [PATCH v3 12/14] pvpanic: add API to access io port |
Date: |
Thu, 25 Jul 2013 13:58:13 +0300 |
On Thu, Jul 25, 2013 at 01:55:26PM +0300, Michael S. Tsirkin wrote:
> On Thu, Jul 25, 2013 at 12:29:52PM +0200, Gerd Hoffmann wrote:
> > On 07/24/13 18:02, Michael S. Tsirkin wrote:
> > > Add API to find pvpanic device and get its io port.
> > > Will be used to fill in guest info structure.
> >
> > > +uint16_t pvpanic_port(void)
> > > +{
> > > + Object *o = object_resolve_path_type("", TYPE_ISA_PVPANIC_DEVICE,
> > > NULL);
> > > + PVPanicState *s;
> > > + if (!o) {
> > > + return 0;
> > > + }
> >
> > return object_property_get_int(o, "ioport");
> > }
> >
> > Then you don't need PVPanicState access and can place the code into
> > acpi-build.c.
> >
> > cheers,
> > Gerd
>
> I can change the implementation but I don't think it's
> a good idea to copy property names around:
> it's too fragile, compiler won't warn us if we
> change the name or value semantics, or make
> a mistake in acpi-build.c
And even within pvpanic.c, this will make me copy-paste
the "ioport" string or create yet another macro.
s = ISA_PVPANIC_DEVICE(o);
return s->ioport;
seems nicer.
> Same applies to TYPE_ISA_PVPANIC_DEVICE: better
> to expose an API than expose the type externally.
> --
> MST
- [Qemu-devel] [PATCH v3 08/14] loader: allow adding ROMs in done callbacks, (continued)
- [Qemu-devel] [PATCH v3 08/14] loader: allow adding ROMs in done callbacks, Michael S. Tsirkin, 2013/07/24
- [Qemu-devel] [PATCH v3 09/14] i386: define pc guest info, Michael S. Tsirkin, 2013/07/24
- [Qemu-devel] [PATCH v3 10/14] ich9: APIs for pc guest info, Michael S. Tsirkin, 2013/07/24
- [Qemu-devel] [PATCH v3 04/14] acpi: pre-compiled ASL files, Michael S. Tsirkin, 2013/07/24
- [Qemu-devel] [PATCH v3 12/14] pvpanic: add API to access io port, Michael S. Tsirkin, 2013/07/24
- Re: [Qemu-devel] [PATCH v3 12/14] pvpanic: add API to access io port, Gerd Hoffmann, 2013/07/25
- Re: [Qemu-devel] [PATCH v3 12/14] pvpanic: add API to access io port, Michael S. Tsirkin, 2013/07/25
- Re: [Qemu-devel] [PATCH v3 12/14] pvpanic: add API to access io port,
Michael S. Tsirkin <=
- Re: [Qemu-devel] [PATCH v3 12/14] pvpanic: add API to access io port, Gerd Hoffmann, 2013/07/25
- Re: [Qemu-devel] [PATCH v3 12/14] pvpanic: add API to access io port, Michael S. Tsirkin, 2013/07/25
- Re: [Qemu-devel] [PATCH v3 12/14] pvpanic: add API to access io port, Gerd Hoffmann, 2013/07/25
- Re: [Qemu-devel] [PATCH v3 12/14] pvpanic: add API to access io port, Michael S. Tsirkin, 2013/07/25
- Re: [Qemu-devel] [PATCH v3 12/14] pvpanic: add API to access io port, Andreas Färber, 2013/07/27
[Qemu-devel] [PATCH v3 13/14] hpet: add API to find it, Michael S. Tsirkin, 2013/07/24
[Qemu-devel] [PATCH v3 11/14] piix: APIs for pc guest info, Michael S. Tsirkin, 2013/07/24