qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: Jan Kiszka <jan.kiszka@web.de>
Cc: Blue Swirl <blauwirbel@gmail.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>, kvm <kvm@vger.kernel.org>,
	Avi Kivity <avi@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3 6/7] pcspk: Convert to qdev
Date: Tue, 31 Jan 2012 17:23:03 -0600	[thread overview]
Message-ID: <4F2877D7.4020807@us.ibm.com> (raw)
In-Reply-To: <4F286FA7.7030606@web.de>

On 01/31/2012 04:48 PM, Jan Kiszka wrote:
> On 2012-01-31 23:40, Anthony Liguori wrote:
>> Why is what's in the tree not usable?
>>
>> Just don't do pcspk_init as a static inline (which is not that nice to
>> do anyway) and you don't need to worry about the availability of an
>> accessor.
>
> The current pattern requested by some reviewers used to be the one I
> applied here. I dislike it as well when the device can't be seriously
> configured out. But I can switch over, no problem.
>
>>
>> And BTW, there is strict type checking now, which makes it already an
>> improvement over property pointers.
>
> OK, for my slow understanding: I use qdev_property_add_link in the
> device init function to create the property, letting it point to a state
> field. But what should I call from the outside to actually set its
> value?

You have a few options:

1) you can add a generic set_child function to qdev... but don't do this, I'll 
fix it right in my future series

2) You can take advantage of the fact that the only thing that ever sets this is 
pcspk_init, move pcspk_init to pcspk.c, and then since you have access to the 
state structure, directly assign it there.

3) Introduce a pcspk_set_pit() function that just does the same thing as (2).

4) Introduce (1) and then have a pcspk_set_pit() that just calls (1).  This is 
what I think we should do moving forward and I plan to do this in my future 
refactorings.

That all said, I think this isn't going to work for you until my next series is 
merged.  Right now, the link properties have strict type checking.  You really 
need a link<PITCommon> in order to be able to accept either a KVMPIT or a normal 
PIT.  My series on the list relaxes the type checking to use implements instead 
of a strict equality check.

So maybe the best thing to do is drop the ptr type entirely, make pcspk_init() 
be in pcspk.c and touch the private state, and then I'll refactor it later to 
use a link<> property.

> And what C type does this value have?

PITState *.

Regards,

Anthony Liguroi

  A DeviceState * or a char *
> (path)?
>
> Jan

  reply	other threads:[~2012-01-31 23:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-31 17:41 [Qemu-devel] [PATCH v3 0/7] pit, hpet, pcspk: fixes & preparation for KVM Jan Kiszka
2012-01-31 17:41 ` [Qemu-devel] [PATCH v3 1/7] i8254: Do not raise IRQ level on reset Jan Kiszka
2012-01-31 17:41 ` [Qemu-devel] [PATCH v3 2/7] hpet: Save/restore cached RTC IRQ level Jan Kiszka
2012-01-31 21:02   ` Anthony Liguori
2012-01-31 22:05     ` Jan Kiszka
2012-01-31 22:38       ` Anthony Liguori
2012-01-31 22:39         ` Jan Kiszka
2012-01-31 17:41 ` [Qemu-devel] [PATCH v3 3/7] i8254: Factor out interface header Jan Kiszka
2012-01-31 17:41 ` [Qemu-devel] [PATCH v3 4/7] i8254: Pass alternative IRQ output object on initialization Jan Kiszka
2012-01-31 17:41 ` [Qemu-devel] [PATCH v3 5/7] i8254: Rework & fix interaction with HPET in legacy mode Jan Kiszka
2012-01-31 17:41 ` [Qemu-devel] [PATCH v3 6/7] pcspk: Convert to qdev Jan Kiszka
2012-01-31 20:49   ` Anthony Liguori
2012-01-31 22:00     ` Jan Kiszka
2012-01-31 22:40       ` Anthony Liguori
2012-01-31 22:48         ` Jan Kiszka
2012-01-31 23:23           ` Anthony Liguori [this message]
2012-02-01  7:29     ` Paolo Bonzini
2012-02-01  9:18       ` Jan Kiszka
2012-01-31 17:41 ` [Qemu-devel] [PATCH v3 7/7] i8254: Factor out pit_get_channel_info Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F2877D7.4020807@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=jan.kiszka@web.de \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).