On 02/24/2012 02:47 PM, Anthony Liguori wrote:
>>
> 
> I agree with you in principle, but in practice, there is not obvious way
> to serialize gpio_in/gpio_out via Visitors.  Finding some way to do it
> as an integer is clearly wrong IMHO.

"%s/gpio_in[%d]" % (object_get_canonical_path(...), opaque->n) is what I
was thinking about.

> I think a simple Pin object with the following interfaces:
> 
> /**
>  * Connect a pin to a qemu_irq such that whenever the pin is
>  * raised, qemu_irq_raise() is called too on irq.
>  */
> void pin_connect_qemu_irq(Pin *obj, qemu_irq irq);
> 
> /**
>  * Returns a qemu_irq such that whenever qemu_irq_raise() is
>  * called, pin_set_level(obj, true) is called.
>  */
> qemu_irq pin_get_qemu_irq(Pin *obj);
> 
> Let's you incrementally refactor objects to use Pins while maintaining the 
> existing qemu_irq infrastructure.

Sure, a simple bridge is a fine alternative.  What I'm not sure about is
making Pins stateful, because that means you have to serialize them.

Paolo

Reply via email to