virtio_pci_modern: type-safe io accessors
authorMichael S. Tsirkin <mst@redhat.com>
Wed, 1 Apr 2015 03:03:20 +0000 (13:33 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 1 Apr 2015 04:07:15 +0000 (14:37 +1030)
commitc5d4c2c9ce4f4b6980a71dec50f2db4c2e55778d
tree237c8573d47db80749a3353eee128f7ec1d57c2c
parent3eebd233fcb392286d385e764eb91e90d6218cdf
virtio_pci_modern: type-safe io accessors

The spec is very clear on this:

4.1.3.1 Driver Requirements: PCI Device Layout

The driver MUST access each field using the “natural” access method,
i.e. 32-bit accesses for 32-bit fields, 16-bit accesses for 16-bit
fields and 8-bit accesses for 8-bit fields.

Add type-safe wrappers to prevent access with incorrect width.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/virtio/virtio_pci_modern.c