From patchwork Wed Nov 13 07:12:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 179252 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp9214928ilf; Tue, 12 Nov 2019 23:14:54 -0800 (PST) X-Google-Smtp-Source: APXvYqwRasqKUKgRh5H2bUYtfuk4EH0B13cXqz1H9nQJ02KPgimOdVawqCVwMLOFsmXjKi541TiI X-Received: by 2002:aa7:df8e:: with SMTP id b14mr1940974edy.59.1573629294380; Tue, 12 Nov 2019 23:14:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573629294; cv=none; d=google.com; s=arc-20160816; b=rZLsZvjq7CSOqGcLH3ugnfx1q1qgeY9Vjjqdi/gHE6CWc8nOX7OzASY5lMjj+BffZL ZE88LyHBL6xlbs9SX2gg+fcyID13N96EvEcqQqejsQxYNgHEUiPawNq8k1GKmXvzuxsK VOkBp3Uivcjyjf+9/amm4HpTKue3hCacBwsCLya90Mx8CjBajlbUgHzWKcewSfO3dirz AgsZ9cm2/37PGQbWdt1Ke4OEZhhnU6G4l7q9AHr+yBR14u/uwHOMmKPkprI9EytbiBhi 6yFBBPmA4a6ljpbaKhNiEhHls3zxcxw9g1UpElrFcRcMA1eMcgbhvZY26UNrQRgXZC6B JiXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=hUWxEOEKcTupHyB6KArKI0LSBUkIGOpAbtR0Bqznip4=; b=H4Zpf4EcM9tmFp9dJaK7+MH/PcalkC7uAiGELtCP4yccYHWcmCEPfeRo0AX4CYbWlL /kXg7O2Q2QsoQiwWBaUgRxDdzDO2sYOsexFU6F3ejZLG/n56Jrf0T6O7G/1AXVESJ7OT fFoYW1qQQ+CSJlF+2SgsL5WmACdTnujmGgGmSyX05gfcsPth9xe4gVIZqQVJ9aXZA9tl z61uJN8WTOZlHhAq6bQe0J7mCE8lN6CxzEyZyDmiVJGGIfiKNPtVsVIOMmmypvfqXBC/ WWxuHxWLgVmhL8I1zWE0zP15I4zCXe9Ke16av/+y903XxknVpEZroSr+2JPPulhChK2L wFsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=n2KG6wYP; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-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 e4si617586ejx.214.2019.11.12.23.14.54; Tue, 12 Nov 2019 23:14:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-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=n2KG6wYP; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726195AbfKMHOx (ORCPT + 8 others); Wed, 13 Nov 2019 02:14:53 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:17549 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726186AbfKMHOx (ORCPT ); Wed, 13 Nov 2019 02:14:53 -0500 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id xAD7COMU032236; Wed, 13 Nov 2019 16:12:24 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com xAD7COMU032236 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1573629145; bh=hUWxEOEKcTupHyB6KArKI0LSBUkIGOpAbtR0Bqznip4=; h=From:To:Cc:Subject:Date:From; b=n2KG6wYPBHKlFa4U7nisZquYRQPFHb3BSAreElf0QkXQTiJENHMqnSbALDYfiHZqY pIsnwIQcs8jEL2DpRIQLTn07+Ve9hVm+cgSEtJdZwR8/4enC6h6CNWoIZgz5YvWxQ6 MeluFmVWF4kSewTnyOC8VbaFPXSp9RuJ5UVKVAGweuDdsyZmDWNRfYku+O7mK2MCe9 rtu4hX2yS6Koz7Yt0FdcQ/6dB/tND35pbuOTNgs559ZDeTG5PRnQb7xz//FdzWuwBz ZO65yUUdAB4G9TzB1DMhcCwqZufdrLG3efVvowwPSVZn3nyJlaX7QbLNeKxKq8U1Wr VJcHK69Dntk4A== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: devicetree@vger.kernel.org, Rob Herring , Frank Rowand Cc: Masahiro Yamada , Benjamin Herrenschmidt , Michael Ellerman , Paul Mackerras , Russell King , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH v3] libfdt: define INT32_MAX and UINT32_MAX in libfdt_env.h Date: Wed, 13 Nov 2019 16:12:02 +0900 Message-Id: <20191113071202.11287-1-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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 --- 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(-) -- 2.17.1 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;