From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=42488 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PwGrS-0004I0-4n for qemu-devel@nongnu.org; Sun, 06 Mar 2011 11:31:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PwGrO-0002lw-B0 for qemu-devel@nongnu.org; Sun, 06 Mar 2011 11:31:14 -0500 Received: from mail-gy0-f173.google.com ([209.85.160.173]:39572) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PwGrO-0002lR-8h for qemu-devel@nongnu.org; Sun, 06 Mar 2011 11:31:10 -0500 Received: by gyd8 with SMTP id 8so1719839gyd.4 for ; Sun, 06 Mar 2011 08:31:08 -0800 (PST) Message-ID: <4D73B6CA.8070000@codemonkey.ws> Date: Sun, 06 Mar 2011 10:31:06 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 4/4] i8254: convert to qdev References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: qemu-devel On 02/13/2011 03:10 PM, Blue Swirl wrote: > Convert to qdev. Don't expose PITState. > > Signed-off-by: Blue Swirl > --- > 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