[SLOF] [PATCH v3 19/22] virtio: 1.0 helper to read 16/32/64 bit value

Nikunj A Dadhania nikunj at linux.vnet.ibm.com
Thu Jan 28 15:53:43 AEDT 2016


Thomas Huth <thuth at redhat.com> writes:

> On 22.01.2016 11:55, Nikunj A Dadhania wrote:
>> To avoid cluttering the driver code with modern/legacy code introduce
>> virtio_cpu_to_modern{16,32,64} and virtio_modern{16,32,64}_to_cpu
>> 
>> Signed-off-by: Nikunj A Dadhania <nikunj at linux.vnet.ibm.com>
>> Suggested-by: Thomas Huth <thuth at redhat.com>
>  
>> +extern uint16_t virtio_cpu_to_modern16(struct virtio_device *dev, uint16_t val);
>> +extern uint32_t virtio_cpu_to_modern32(struct virtio_device *dev, uint32_t val);
>> +extern uint64_t virtio_cpu_to_modern64(struct virtio_device *dev, uint64_t val);
>> +extern uint16_t virtio_modern16_to_cpu(struct virtio_device *dev, uint16_t val);
>> +extern uint32_t virtio_modern32_to_cpu(struct virtio_device *dev, uint32_t val);
>> +extern uint64_t virtio_modern64_to_cpu(struct virtio_device *dev, uint64_t val);
>
> Patch looks fine ... but I'd maybe move the functions into the virtio.h
> header file instead and declare them as "static inline",

I had tried that, there were some related to the virtio.h header getting
included in virtio.code file. That is the reason I had moved it here.

> since the functions are reasonable small and the compiler might then
> be able to optimize all those single checks for dev->is_modern.

Regards
Nikunj



More information about the SLOF mailing list