qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC 3/8] uhci: do not use old_portio-style callbacks


From: Gerd Hoffmann
Subject: Re: [Qemu-devel] [RFC 3/8] uhci: do not use old_portio-style callbacks
Date: Thu, 03 Jan 2013 15:09:38 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.11) Gecko/20121116 Thunderbird/10.0.11

On 12/23/12 16:32, Hervé Poussineau wrote:
> -static const MemoryRegionPortio uhci_portio[] = {
> -    { 0, 32, 2, .write = uhci_ioport_writew, },
> -    { 0, 32, 2, .read = uhci_ioport_readw, },
> -    { 0, 32, 4, .write = uhci_ioport_writel, },
> -    { 0, 32, 4, .read = uhci_ioport_readl, },
> -    { 0, 32, 1, .write = uhci_ioport_writeb, },
> -    { 0, 32, 1, .read = uhci_ioport_readb, },
> -    PORTIO_END_OF_LIST()
> -};
> +static uint64_t uhci_ioport_read(void *opaque, hwaddr addr, unsigned int 
> size)
> +{
> +    switch (size) {
> +    case 1:
> +        return uhci_ioport_readb(opaque, (uint32_t)addr);
> +    case 2:
> +        return uhci_ioport_readw(opaque, (uint32_t)addr);
> +    case 4:
> +        return uhci_ioport_readl(opaque, (uint32_t)addr);
> +    default:
> +        return ~0UL;
> +    }
> +}

Aaaargh.  Please don't.  Offloading the size handling to the memory api
is better.  See attached patch.

cheers,
  Gerd

Attachment: 0001-uhci-stop-using-portio-lists.patch
Description: Text document


reply via email to

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