From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ralf Baechle Subject: Re: [PATCH 11/15] MIPS: paravirt: Add pci controller for virtio Date: Wed, 21 May 2014 15:34:07 +0200 Message-ID: <20140521133407.GS10287@linux-mips.org> References: <1400597236-11352-1-git-send-email-andreas.herrmann@caviumnetworks.com> <1400597236-11352-12-git-send-email-andreas.herrmann@caviumnetworks.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-mips@linux-mips.org, David Daney , James Hogan , kvm@vger.kernel.org, David Daney To: Andreas Herrmann Return-path: Received: from eddie.linux-mips.org ([78.24.191.182]:60952 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751911AbaEUNfz (ORCPT ); Wed, 21 May 2014 09:35:55 -0400 Received: from localhost.localdomain ([127.0.0.1]:51560 "EHLO linux-mips.org" rhost-flags-OK-OK-OK-FAIL) by eddie.linux-mips.org with ESMTP id S6854777AbaEUNfmwtijd (ORCPT ); Wed, 21 May 2014 15:35:42 +0200 Content-Disposition: inline In-Reply-To: <1400597236-11352-12-git-send-email-andreas.herrmann@caviumnetworks.com> Sender: kvm-owner@vger.kernel.org List-ID: 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 like: #include ... 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