From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5FB41C433F5 for ; Thu, 7 Apr 2022 09:55:06 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E332683BBA; Thu, 7 Apr 2022 11:55:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="mBBdpr+Y"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 64EDA83BBA; Thu, 7 Apr 2022 11:55:00 +0200 (CEST) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 60CD981B5C for ; Thu, 7 Apr 2022 11:54:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=miquel.raynal@bootlin.com Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 3C21924000A; Thu, 7 Apr 2022 09:54:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1649325297; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2zsVjPjnH+XYoGJ/744OoQO9/1ZUFYNw7SCKIQ136JQ=; b=mBBdpr+YJ8GwJKZTFSo1GAc8aA11w/Z2BjTDvcK5Mz4U8xg7TTlWYV5rcgw57OBvT7jw4D IWAY6/YacogmTtc87K2U6nISEi9D7DCKiJQSUdqh0RtH7KRRvejrgsmt1l2Kv0FUpxwuU7 WJAJT2tV0vTN9Lz1KbxkSiY0QFXjpKgtOkxIPTkmkfoDGcCEPYkFOEVsDoobJ1v4YkooKV qAMfwC6LeVKK6p03O5SshgeenQCjr2j69l1dw9FsolKwpS+9oNWe1byHPi4SImsrW3UuH9 JJe5aRBeO71nV4qipXyGhJFgO83UrrevPO80ZH+WNGL20f8ELPA3UQrOShqqnQ== Date: Thu, 7 Apr 2022 11:54:55 +0200 From: Miquel Raynal To: Pali =?UTF-8?B?Um9ow6Fy?= Cc: Joao Marcos Costa , Thomas Petazzoni , u-boot@lists.denx.de Subject: Re: [PATCH] squashfs: Fix compilation on big endian systems Message-ID: <20220407115455.265f0cf3@xps13> In-Reply-To: <20220407094159.ntw7vt5mcmdtmfp6@pali> References: <20220406213153.30437-1-pali@kernel.org> <20220407095421.7a3a2508@xps13> <20220407094159.ntw7vt5mcmdtmfp6@pali> Organization: Bootlin X-Mailer: Claws Mail 3.17.7 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Hi Pali, pali@kernel.org wrote on Thu, 7 Apr 2022 11:41:59 +0200: > On Thursday 07 April 2022 09:54:21 Miquel Raynal wrote: > > Hi Pali, > >=20 > > pali@kernel.org wrote on Wed, 6 Apr 2022 23:31:53 +0200: > >=20 > > Would you mind explaining a little bit how this change fixes it? It > > does not look straightforward to me. =20 >=20 > Yes! I though that it is straightforward this change... > byteorder/little_endian.h defines cpu_to_le* macros for Little Endian > systems and byteorder/big_endian.h for Big Endian systems. >=20 > File asm/byteorder.h is then ARCH-specific and implements macros for the > current architecture (by including the correct header file). >=20 > So currently if you try to compile squashfs for big endian systems you > get compile error: >=20 > In file included from ./arch/powerpc/include/asm/byteorder.h:82, > from include/linux/unaligned/access_ok.h:4, > from ./arch/powerpc/include/asm/unaligned.h:9, > from fs/squashfs/sqfs_filesystem.h:11, > from fs/squashfs/sqfs_dir.c:16: > include/linux/byteorder/big_endian.h:34: warning: "__cpu_to_le32" redef= ined > #define __cpu_to_le32(x) ((__force __le32)__swab32((x))) >=20 > In file included from fs/squashfs/sqfs_dir.c:10: > include/linux/byteorder/little_endian.h:34: note: this is the location = of the previous definition > #define __cpu_to_le32(x) ((__force __le32)(__u32)(x)) >=20 > Or: >=20 > In file included from fs/squashfs/sqfs.c:14: > include/linux/byteorder/little_endian.h:89:21: error: redefinition of = =E2=80=98__be16_to_cpup=E2=80=99 > static inline __u16 __be16_to_cpup(const __be16 *p) > ^~~~~~~~~~~~~~ > In file included from ./arch/powerpc/include/asm/byteorder.h:82, > from include/linux/unaligned/access_ok.h:4, > from ./arch/powerpc/include/asm/unaligned.h:9, > from fs/squashfs/sqfs.c:10: > include/linux/byteorder/big_endian.h:89:21: note: previous definition o= f =E2=80=98__be16_to_cpup=E2=80=99 was here > static inline __u16 __be16_to_cpup(const __be16 *p) > ^~~~~~~~~~~~~~ >=20 > As some header files include correct asm/byteorder.h file and this > squashfs includes additional little_endian.h. Great, thanks for the thorough explanation. Based on what you said, wouldn't it be cleaner to just get rid of the little_endian.h include rather than also use the ARCH specific byteorder.h header? >=20 > > > Signed-off-by: Pali Roh=C3=A1r > > > --- > > > fs/squashfs/sqfs.c | 3 +-- > > > fs/squashfs/sqfs_dir.c | 3 +-- > > > 2 files changed, 2 insertions(+), 4 deletions(-) > > >=20 > > > diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c > > > index 5d9c52af80ba..41cb811c1b32 100644 > > > --- a/fs/squashfs/sqfs.c > > > +++ b/fs/squashfs/sqfs.c > > > @@ -11,8 +11,7 @@ > > > #include > > > #include > > > #include > > > -#include > > > -#include > > > +#include > > > #include > > > #include > > > #include > > > diff --git a/fs/squashfs/sqfs_dir.c b/fs/squashfs/sqfs_dir.c > > > index a265b98fe685..ed83c90682ff 100644 > > > --- a/fs/squashfs/sqfs_dir.c > > > +++ b/fs/squashfs/sqfs_dir.c > > > @@ -7,8 +7,7 @@ > > > =20 > > > #include > > > #include > > > -#include > > > -#include > > > +#include > > > #include > > > #include > > > #include =20 > >=20 > > Cheers, > > Miqu=C3=A8l =20 Thanks, Miqu=C3=A8l