From: Anthony Liguori <anthony@codemonkey.ws>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 4/4] i8254: convert to qdev
Date: Sun, 06 Mar 2011 10:31:06 -0600 [thread overview]
Message-ID: <4D73B6CA.8070000@codemonkey.ws> (raw)
In-Reply-To: <AANLkTinReKqGNOHY9OWEn17JYA5ezm5dbtvZB2Ca2rs+@mail.gmail.com>
On 02/13/2011 03:10 PM, Blue Swirl wrote:
> Convert to qdev. Don't expose PITState.
>
> Signed-off-by: Blue Swirl<blauwirbel@gmail.com>
> ---
> hw/i8254.c | 61 +++++++++++++++++++++++++++++++++++++--------------
> hw/mips_fulong2e.c | 4 +-
> hw/mips_jazz.c | 4 +-
> hw/mips_malta.c | 4 +-
> hw/mips_r4k.c | 4 +-
> hw/pc.c | 5 +--
> hw/pc.h | 25 ++++++++++++++------
> hw/pcspk.c | 4 +-
> hw/ppc_prep.c | 4 +-
> 9 files changed, 75 insertions(+), 40 deletions(-)
>
> diff --git a/hw/i8254.c b/hw/i8254.c
> index 06b225c..680caab 100644
> --- a/hw/i8254.c
> +++ b/hw/i8254.c
> @@ -53,9 +53,12 @@ typedef struct PITChannelState {
> qemu_irq irq;
> } PITChannelState;
>
> -struct PITState {
> +typedef struct PITState {
> + ISADevice dev;
>
The PIT is not an ISA device. Modelling it as such is worse than
leaving it unmodelled.
> -PITState *pit_init(int base, qemu_irq irq);
> -void pit_set_gate(PITState *pit, int channel, int val);
> -int pit_get_gate(PITState *pit, int channel);
> -int pit_get_initial_count(PITState *pit, int channel);
> -int pit_get_mode(PITState *pit, int channel);
> -int pit_get_out(PITState *pit, int channel, int64_t current_time);
> +void pit_set_gate(ISADevice *dev, int channel, int val);
> +int pit_get_gate(ISADevice *dev, int channel);
> +int pit_get_initial_count(ISADevice *dev, int channel);
> +int pit_get_mode(ISADevice *dev, int channel);
> +int pit_get_out(ISADevice *dev, int channel, int64_t current_time);
>
Making these functions take an ISADevice hurts type safety. They should
take a PITState.
Regards,
Anthony Liguori
next prev parent reply other threads:[~2011-03-06 16:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-13 21:10 [Qemu-devel] [PATCH 4/4] i8254: convert to qdev Blue Swirl
2011-03-06 15:10 ` [Qemu-devel] " Jan Kiszka
2011-03-06 15:35 ` Blue Swirl
2011-03-06 15:39 ` Jan Kiszka
2011-03-06 16:06 ` Blue Swirl
2011-03-06 16:08 ` Jan Kiszka
2011-03-06 16:31 ` Anthony Liguori [this message]
2011-03-06 16:47 ` [Qemu-devel] " Blue Swirl
2011-03-06 17:35 ` Blue Swirl
2011-03-06 17:47 ` Anthony Liguori
2011-03-06 18:06 ` [Qemu-devel] " Jan Kiszka
2011-03-06 20:45 ` Anthony Liguori
2011-03-06 21:15 ` Blue Swirl
2011-03-06 21:18 ` Jan Kiszka
2011-03-07 0:32 ` Anthony Liguori
2011-03-07 7:58 ` Jan Kiszka
2011-03-07 14:57 ` Anthony Liguori
2011-03-07 15:46 ` 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=4D73B6CA.8070000@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=blauwirbel@gmail.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).