qemu-devel
[Top][All Lists]
Advanced

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

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


From: Jan Kiszka
Subject: [Qemu-devel] Re: [PATCH 4/4] i8254: convert to qdev
Date: Sun, 06 Mar 2011 17:08:09 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

On 2011-03-06 17:06, Blue Swirl wrote:
> On Sun, Mar 6, 2011 at 5:39 PM, Jan Kiszka <address@hidden> wrote:
>> On 2011-03-06 16:35, Blue Swirl wrote:
>>> On Sun, Mar 6, 2011 at 5:10 PM, Jan Kiszka <address@hidden> wrote:
>>>> On 2011-02-13 22:10, Blue Swirl wrote:
>>>>> Convert to qdev. Don't expose PITState.
>>>>>
>>>>
>>>> ...
>>>>
>>>>> diff --git a/hw/pc.h b/hw/pc.h
>>>>> index 60f8c42..feb8a7a 100644
>>>>> --- a/hw/pc.h
>>>>> +++ b/hw/pc.h
>>>>> @@ -82,14 +82,23 @@ void isa_irq_handler(void *opaque, int n, int level);
>>>>>
>>>>>  #define PIT_FREQ 1193182
>>>>>
>>>>> -typedef struct PITState PITState;
>>>>> +static inline ISADevice *pit_init(int base, int irq)
>>>>> +{
>>>>> +    ISADevice *dev;
>>>>> +
>>>>> +    dev = isa_create("isa-pit");
>>>>> +    qdev_prop_set_uint32(&dev->qdev, "iobase", base);
>>>>> +    qdev_prop_set_uint32(&dev->qdev, "irq", irq);
>>>>> +    qdev_init_nofail(&dev->qdev);
>>>>> +
>>>>> +    return dev;
>>>>> +}
>>>>
>>>> This should be moved to i8254.c. We cannot compile the PIT out, and the
>>>> above contains no board information. So I see no reason for this inlining.
>>>
>>> I see no reason for moving this back. In fact, if this was only used
>>> by PC, it could be moved to pc.c.
>>
>> To my understanding, it's a factory helper for the PIT, avoiding
>> boilerplate code at the creator site. And if we get >1 users, this
>> cleanup would definitely pay off.
> 
> It should be possible to leave PIT out, with small changes to pcspk
> (which obviously has a hard dependency to PIT) and HPET. Then this
> makes even more sense.

A PC without a PIT makes _no_ sense.

Jan

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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