From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YzQ8l-0007Z7-Fk for qemu-devel@nongnu.org; Mon, 01 Jun 2015 09:52:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YzQ8i-0003k6-8z for qemu-devel@nongnu.org; Mon, 01 Jun 2015 09:52:31 -0400 Received: from e06smtp17.uk.ibm.com ([195.75.94.113]:40773) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YzQ8h-0003jt-Vh for qemu-devel@nongnu.org; Mon, 01 Jun 2015 09:52:28 -0400 Received: from /spool/local by e06smtp17.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 1 Jun 2015 14:52:25 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 79BE51B08070 for ; Mon, 1 Jun 2015 14:53:16 +0100 (BST) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t51DqMkv24707114 for ; Mon, 1 Jun 2015 13:52:22 GMT Received: from d06av01.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t51DqLN0006007 for ; Mon, 1 Jun 2015 07:52:21 -0600 From: Michael Mueller Date: Mon, 1 Jun 2015 15:51:56 +0200 Message-Id: <1433166716-36861-1-git-send-email-mimu@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH] virtio-input: const_le16 and const_le32 not build time constant List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Michael Mueller As the implementation of const_le16 and const_le32 is not build time constant on big endian systems this need to be fixed. CC hw/input/virtio-input-hid.o hw/input/virtio-input-hid.c:340:13: error: initializer element is not constant hw/input/virtio-input-hid.c:340:13: error: (near initialization for ‘virtio_keyboard_config[1].u.ids.bustype’) ... Signed-off-by: Michael Mueller --- include/hw/virtio/virtio-input.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/hw/virtio/virtio-input.h b/include/hw/virtio/virtio-input.h index a265519..bcee355 100644 --- a/include/hw/virtio/virtio-input.h +++ b/include/hw/virtio/virtio-input.h @@ -14,8 +14,14 @@ typedef struct virtio_input_config virtio_input_config; typedef struct virtio_input_event virtio_input_event; #if defined(HOST_WORDS_BIGENDIAN) -# define const_le32(_x) bswap32(_x) -# define const_le16(_x) bswap32(_x) +# define const_le32(_x) \ + (((_x & 0x000000ffU) << 24) | \ + ((_x & 0x0000ff00U) << 8) | \ + ((_x & 0x00ff0000U) >> 8) | \ + ((_x & 0xff000000U) >> 24)) +# define const_le16(_x) \ + (((_x & 0x00ff) << 8) | \ + ((_x & 0xff00) >> 8)) #else # define const_le32(_x) (_x) # define const_le16(_x) (_x) -- 1.8.3.1