Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2288285ybc; Sun, 24 Nov 2019 17:37:48 -0800 (PST) X-Google-Smtp-Source: APXvYqwP4kZSlCKfg/VzZJ4EsEQw6pmLKcceA9Sr/gn80E96btOluuzBpvWS02BK4G0kFnTa/oh8 X-Received: by 2002:a17:906:5c0d:: with SMTP id e13mr33319836ejq.82.1574645868861; Sun, 24 Nov 2019 17:37:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574645868; cv=none; d=google.com; s=arc-20160816; b=sneoeDAscJQzgObBcy9Przak7tKGAN7Mvebg7GKHZB3TollzzcPzF1qTW+5QDo1xom 27Tmj+IgxJbcR73dJqJNU7u92uGt5mSuAqJS5nyMg1iA3EOhbGiQ9fg2WZNDzhigwoKt wUKSVYIGwenZmBpxei/Bq7D+CSDO7W55b5CrLV2oq84NA5CqoaTSl/7ZTqXlReRESJEQ XgBN5fBLavnNpMPBvBX12sYVluXo1YxysraDEURVncitAf9wvsqLH22UPElF4AbkNHe+ 5sYlre3sOkL2D8C+2tra59sSIKL4mRQjCkFMG1ZpScx3xMOM94O2sBW3oH/8QJ41kwjO aYlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=4zS9ONB1lX0XUDCYAcZW6UgeXuejST5UVyfhFO/g8d8=; b=K2DHF5FbMkpPrWh/51nVToIb/K666JS7Mpe0bXzVyEOxF28xjXJddTEKcAP0Wev77h HOuRCDQiHP1iaqKw1XGF6GvBMMsPbD/lhOXHYWrT0ys0dRmXUhSCP7K3FtPBhN9RqYSM xKws61xcvevUqZmTIVR1V8oJ3UNzGnlBuSOdI8khbczXsHN9QRuD135Efnt59il2/Gcq M02tfkiviTRYBW4LtiSFqg8mL9SvGwphdwFyiuvhKndtqFTC7vmovmjfHqEWLRMdMbaz NBjIK4TXKMcRefiPcukab2ss0Ksf5+iRBH/Dfj8+/3GAU6WpBelCXSxnJz9GbLhkaGh/ Bwvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=R1fYDaTv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e25si4012859edr.117.2019.11.24.17.37.25; Sun, 24 Nov 2019 17:37:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=R1fYDaTv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727207AbfKYBgK (ORCPT + 99 others); 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-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