Re: [PATCH 11/15] MIPS: paravirt: Add pci controller for virtio

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

 



On Tue, May 20, 2014 at 04:47:12PM +0200, Andreas Herrmann wrote:

> +
> +union pci_config_address {
> +	struct {
> +#ifdef __LITTLE_ENDIAN
> +		unsigned	register_number	: 8;		/* 7  .. 0  */
> +		unsigned	devfn_number	: 8;		/* 15 .. 8  */
> +		unsigned	bus_number	: 8;		/* 23 .. 16 */
> +		unsigned	reserved	: 7;		/* 30 .. 24 */
> +		unsigned	enable_bit	: 1;		/* 31       */
> +#else
> +		unsigned	enable_bit	: 1;		/* 31       */
> +		unsigned	reserved	: 7;		/* 30 .. 24 */
> +		unsigned	bus_number	: 8;		/* 23 .. 16 */
> +		unsigned	devfn_number	: 8;		/* 15 .. 8  */
> +		unsigned	register_number	: 8;		/* 7  .. 0  */
> +#endif

For this kind of endianess dependency there is a more elegant way of
defining things in linux-next's <uapi/asm/bitfield.h> like:

#include <uapi/asm/bitfield.h>
...

struct {
	__BITFIELD_FIELD(unsigned	enable_bit	: 1,		/* 31       */
	__BITFIELD_FIELD(unsigned	reserved	: 7,		/* 30 .. 24 */
	__BITFIELD_FIELD(unsigned	bus_number	: 8,		/* 23 .. 16 */
	__BITFIELD_FIELD(unsigned	devfn_number	: 8,		/* 15 .. 8  */
	__BITFIELD_FIELD(unsigned	register_number	: 8,		/* 7  .. 0  */
	)))));
};

No ifdef, no duplication!

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux