qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 4/4] i8254: convert to qdev


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH 4/4] i8254: convert to qdev
Date: Sun, 06 Mar 2011 10:31:06 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.15) Gecko/20101027 Lightning/1.0b1 Thunderbird/3.0.10

On 02/13/2011 03:10 PM, Blue Swirl wrote:
Convert to qdev. Don't expose PITState.

Signed-off-by: Blue Swirl<address@hidden>
---
  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



reply via email to

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