From patchwork Mon Jun 1 13:51:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Mueller X-Patchwork-Id: 479047 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 25065140F99 for ; Mon, 1 Jun 2015 23:52:49 +1000 (AEST) Received: from localhost ([::1]:52620 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YzQ91-0007rR-E0 for incoming@patchwork.ozlabs.org; Mon, 01 Jun 2015 09:52:47 -0400 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 d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp17.uk.ibm.com (192.168.101.147) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 1 Jun 2015 14:52:23 +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 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t51DqLXL005999; Mon, 1 Jun 2015 07:52:21 -0600 From: Michael Mueller To: qemu-devel@nongnu.org Date: Mon, 1 Jun 2015 15:51:56 +0200 Message-Id: <1433166716-36861-1-git-send-email-mimu@linux.vnet.ibm.com> X-Mailer: git-send-email 2.3.8 MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15060113-0029-0000-0000-000004E0C8FC X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.75.94.113 Cc: Gerd Hoffmann , Michael Mueller Subject: [Qemu-devel] [PATCH] virtio-input: const_le16 and const_le32 not build time constant X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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)