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 X-Spam-Level: X-Spam-Status: No, score=-6.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2095DC432C3 for ; Mon, 25 Nov 2019 01:36:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EBCA32071A for ; Mon, 25 Nov 2019 01:36:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nifty.com header.i=@nifty.com header.b="R1fYDaTv" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727216AbfKYBgK (ORCPT ); Sun, 24 Nov 2019 20:36:10 -0500 Received: from conssluserg-05.nifty.com ([210.131.2.90]:36521 "EHLO conssluserg-05.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727072AbfKYBgK (ORCPT ); Sun, 24 Nov 2019 20:36:10 -0500 Received: from mail-vs1-f50.google.com (mail-vs1-f50.google.com [209.85.217.50]) (authenticated) by conssluserg-05.nifty.com with ESMTP id xAP1Zudx011089; Mon, 25 Nov 2019 10:35:57 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-05.nifty.com xAP1Zudx011089 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1574645757; bh=4zS9ONB1lX0XUDCYAcZW6UgeXuejST5UVyfhFO/g8d8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=R1fYDaTvWZSIXPD0BXg/G6ZmTOZMjjFenSgrGicPFQT+3Y3g/m/ZrhOyG2ZLObk9H jSDKaIdbzPFBTfl1xJZMsZJ81783Qg75CmGSqzoPciMOvaYC3saanAxYYIjtyXFHC5 XpMkLxiVblDfIwKlBHkAczgogRU8wVT/JOwppExseIgxtiiL6HSRfwU+JnROtKzXCB 0majHYE5wni9B61LcBG+CKkDMhKnKSmaJuTncJPy2oI75R0i2izRD9kV1YGyZXqnXf k9MTvxkdR0dxuhxT8t1KHwfECJzy7sfW/CyqMeI3qoUrxjTmPVy291lkq65GHgy3ml OF0e3gT7gcnCw== X-Nifty-SrcIP: [209.85.217.50] Received: by mail-vs1-f50.google.com with SMTP id m5so4261547vsj.3; Sun, 24 Nov 2019 17:35:57 -0800 (PST) X-Gm-Message-State: APjAAAXpe2LBex4zkGOTVlJWX6iHVBBIuVi08a/uJ1luAHRoIHv/MW5J +1YG//cQa0FhCG/x9fwv8Z0BDfWP+C17OjPg++s= X-Google-Smtp-Source: APXvYqzsFOr3V5Ucu7w0+x7MvZdRFWrrwm3B2vqt1VuyZEdFouFkB+5X8be1VVTCyuUplwtsLKcFkuk0UX620+G6KNg= X-Received: by 2002:a05:6102:726:: with SMTP id u6mr17181884vsg.179.1574645756005; Sun, 24 Nov 2019 17:35:56 -0800 (PST) MIME-Version: 1.0 References: <20191113071202.11287-1-yamada.masahiro@socionext.com> In-Reply-To: <20191113071202.11287-1-yamada.masahiro@socionext.com> From: Masahiro Yamada Date: Mon, 25 Nov 2019 10:35:19 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3] libfdt: define INT32_MAX and UINT32_MAX in libfdt_env.h To: DTML , Rob Herring , Frank Rowand Cc: Michael Ellerman , Russell King , Linux Kernel Mailing List , Paul Mackerras , Benjamin Herrenschmidt , linuxppc-dev , linux-arm-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 13, 2019 at 4:13 PM Masahiro Yamada wrote: > > The DTC v1.5.1 added references to (U)INT32_MAX. > > This is no problem for user-space programs since defines > (U)INT32_MAX along with (u)int32_t. > > For the kernel space, libfdt_env.h needs to be adjusted before we > pull in the changes. > > In the kernel, we usually use s/u32 instead of (u)int32_t for the > fixed-width types. > > Accordingly, we already have S/U32_MAX for their max values. > So, we should not add (U)INT32_MAX to any more. > > Instead, add them to the in-kernel libfdt_env.h to compile the > latest libfdt. > > Signed-off-by: Masahiro Yamada > --- Please let me ping this in case this is useful for future resync. > > My initial plan was to change this in a series of 3 patches > since it is clean, and reduces the code. > > [1/3] https://lore.kernel.org/patchwork/patch/1147095/ > [2/3] https://lore.kernel.org/patchwork/patch/1147096/ > [3/3] https://lore.kernel.org/patchwork/patch/1147097/ > > 1/3 is stuck in the license bikeshed. > > For 2/3, I have not been able to get Ack from Russell. > > So, I chose a straight-forward fixup. > > > Changes in v3: > - Resend as a single patch > > arch/arm/boot/compressed/libfdt_env.h | 4 +++- > arch/powerpc/boot/libfdt_env.h | 2 ++ > include/linux/libfdt_env.h | 3 +++ > 3 files changed, 8 insertions(+), 1 deletion(-) > > diff --git a/arch/arm/boot/compressed/libfdt_env.h b/arch/arm/boot/compressed/libfdt_env.h > index b36c0289a308..6a0f1f524466 100644 > --- a/arch/arm/boot/compressed/libfdt_env.h > +++ b/arch/arm/boot/compressed/libfdt_env.h > @@ -2,11 +2,13 @@ > #ifndef _ARM_LIBFDT_ENV_H > #define _ARM_LIBFDT_ENV_H > > +#include > #include > #include > #include > > -#define INT_MAX ((int)(~0U>>1)) > +#define INT32_MAX S32_MAX > +#define UINT32_MAX U32_MAX > > typedef __be16 fdt16_t; > typedef __be32 fdt32_t; > diff --git a/arch/powerpc/boot/libfdt_env.h b/arch/powerpc/boot/libfdt_env.h > index 2abc8e83b95e..9757d4f6331e 100644 > --- a/arch/powerpc/boot/libfdt_env.h > +++ b/arch/powerpc/boot/libfdt_env.h > @@ -6,6 +6,8 @@ > #include > > #define INT_MAX ((int)(~0U>>1)) > +#define UINT32_MAX ((u32)~0U) > +#define INT32_MAX ((s32)(UINT32_MAX >> 1)) > > #include "of.h" > > diff --git a/include/linux/libfdt_env.h b/include/linux/libfdt_env.h > index edb0f0c30904..1adf54aad2df 100644 > --- a/include/linux/libfdt_env.h > +++ b/include/linux/libfdt_env.h > @@ -7,6 +7,9 @@ > > #include > > +#define INT32_MAX S32_MAX > +#define UINT32_MAX U32_MAX > + > typedef __be16 fdt16_t; > typedef __be32 fdt32_t; > typedef __be64 fdt64_t; > -- > 2.17.1 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel -- Best Regards Masahiro Yamada