Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754283AbaLDQBi (ORCPT ); Thu, 4 Dec 2014 11:01:38 -0500 Received: from mail-oi0-f47.google.com ([209.85.218.47]:55625 "EHLO mail-oi0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753397AbaLDQBg (ORCPT ); Thu, 4 Dec 2014 11:01:36 -0500 From: Dan Streetman To: Jonathan Corbet , Jiri Kosina Cc: Dan Streetman , Greg Kroah-Hartman , Peter Foley , Seth Jennings , Randy Dunlap , Ashutosh Dixit , Caz Yokoyama , Dasaratharaman Chandramouli , Sudeep Dutt , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] Documentation/mic/mpssd: fix compile error on BE platforms Date: Thu, 4 Dec 2014 11:01:15 -0500 Message-Id: <1417708875-32189-1-git-send-email-ddstreet@ieee.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Change any use of htole* macro in static context to instead manually check for endianness and use __bswap_constant_* macro instead. The current glibc definitions of the htole* macros don't allow their use in a static context; on big endian systems the build fails with: HOSTCC Documentation/mic/mpssd/mpssd.o In file included from /usr/include/bits/byteswap.h:34:0, from /usr/include/endian.h:60, from /usr/include/bits/waitstatus.h:64, from /usr/include/stdlib.h:42, from .../Documentation/mic/mpssd/mpssd.c:23: .../Documentation/mic/mpssd/mpssd.c:93:10: error: braced-group within expression allowed only inside a function .num = htole16(MIC_VRING_ENTRIES), ...and... .../Documentation/mic/mpssd/mpssd.c:119:3: error: initializer element is not constant .host_features = htole32( I also opened a glibc bug: https://sourceware.org/bugzilla/show_bug.cgi?id=17679 But this patch is still needed to prevent build failures with the current glibc htole* macro definitions. Signed-off-by: Dan Streetman --- Documentation/mic/mpssd/mpssd.c | 54 ++++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/Documentation/mic/mpssd/mpssd.c b/Documentation/mic/mpssd/mpssd.c index 3c5c379..b6cfbf0 100644 --- a/Documentation/mic/mpssd/mpssd.c +++ b/Documentation/mic/mpssd/mpssd.c @@ -77,6 +77,33 @@ static struct mic_info mic_list; #define VIRTIO_NET_HDR_F_DATA_VALID 2 /* Csum is valid */ #endif +#define VIRTNET_HOST_FEATURES \ + (1 << VIRTIO_NET_F_CSUM | \ + 1 << VIRTIO_NET_F_GSO | \ + 1 << VIRTIO_NET_F_GUEST_TSO4 | \ + 1 << VIRTIO_NET_F_GUEST_TSO6 | \ + 1 << VIRTIO_NET_F_GUEST_ECN | \ + 1 << VIRTIO_NET_F_GUEST_UFO) + +/* Currently, glibc htole* macros don't allow use in static context, + * so we check and use __bswap_constant_* instead + */ +#if __BYTE_ORDER == __LITTLE_ENDIAN +# define MIC_VRING_ENTRIES_LE MIC_VRING_ENTRIES +# define VIRTNET_HOST_FEATURES_LE VIRTNET_HOST_FEATURES +# define VIRTBLK_HOST_FEATURES_LE (1<