From patchwork Fri Nov 1 06:14:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 178244 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp36838ill; Thu, 31 Oct 2019 23:15:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFsnyqgKE5Tyvw3Ey7mPX40VBYu2rwEieJpQAxdJujbH2sUAMkIYKbRLuGEyNBUYQnxmrl X-Received: by 2002:a17:906:2f83:: with SMTP id w3mr8126454eji.57.1572588951792; Thu, 31 Oct 2019 23:15:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572588951; cv=none; d=google.com; s=arc-20160816; b=VDIgAgiDFcJ3vT/iCKQO7O8KD5Y6oWY0Ki0axEvgIxAR7qIfwPrT/w+nyiNzusw5Vq wjyeb5dqUX76PaH+xjV2RLjUZido9AuFrYetZD70ArQJR6Q+tYWmFfyMHtx4YrT5lPZm rBpcPx5z+3DANL2gTKTiMwT2SQZuLhXashin8hgc/iAHSlL7m91aMdDElVuqfjrFlBvU m9k9DPkSoi+794+hMh4q6Gjedoqip7zz977tTX07FWXkp4KPRM6vFBFRiL71OXGjW/Sk oRpYgHjbLAIaCZx1JKhHN6T/pAPBSkFjwUuEXkX0Bw8WiugBaIRtOLo8Y1xe0s6mGHoH x0rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=i3mAUJKjHAwllmd7KANZFUaKrxZfgZZBSwsGJnV7Xbc=; b=OzJT7UagsRzkxgEppySeDO3KyXEElnAEN5wUSlQ8koxFndW4Plu92pd0qIWF4SQ4Bg 9L4DQgOqXkmeHXIWhP4dKokYEG8it/QCx/w2FKQDK4F4ziUHso2YejRiwUvryIH4Pu4Y LH/Ni0c9YQlC8+JTH9WXnkRhwDW2IAKsAJ5mCljcKwlR/GSaASMUI/hg2JTu3qB25S+Y w39AuhbKNTqKqGuha6EUg67DaLfpbmzgut5v5Vh2dp5HhMp6GHBcUSXPQ44eAXqfsxUW MQmsgf8t8mCoH9Z6EUNhnuK4bzcPGp8s512Q6FRShS8wJAq9z4e8tw0KPrjZkmmzVe1b 9wOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=KPc3vgN8; 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 k7si5752319edb.265.2019.10.31.23.15.51; Thu, 31 Oct 2019 23:15:51 -0700 (PDT) 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=KPc3vgN8; 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 S1728724AbfKAGPr (ORCPT + 26 others); Fri, 1 Nov 2019 02:15:47 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:45244 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725280AbfKAGPr (ORCPT ); Fri, 1 Nov 2019 02:15:47 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id xA16ELBd016348; Fri, 1 Nov 2019 15:14:23 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com xA16ELBd016348 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1572588863; bh=i3mAUJKjHAwllmd7KANZFUaKrxZfgZZBSwsGJnV7Xbc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KPc3vgN83gq/1DFpYm2jc42MVPmVXAyW/Lg2mxWgvu1ZAu0bN1KYxqRvmNONYWFk3 gaUQbkdfqWaDEZ2BcXD9Si4l6mpnff26BF+UBdrTZLRrMCTujMwF3QcBsWjbcgkcOF 2XbnAVCrdwv3ty0YJtZg3c+4DVaAZKk3gkjpX0FwnK4VsdT89nJli9OWVsMEH9B2G4 hss+ENiiJCQFP5NOVFqIIOBCByvo34NugeyFLi+nkDC66Xc3GjYRkp6KQ2rDBUrSMD JlBahWfNsllQ39/AajGZsAZRYAix+l2RjQ37GhjRbqpYTT/40NjdAoGwDVMHt+Y2WS XMwjT6UgHMK7w== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: devicetree@vger.kernel.org, Rob Herring , Frank Rowand Cc: linux-arm-kernel@lists.infradead.org, David Gibson , linuxppc-dev@lists.ozlabs.org, Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH 1/3] libfdt: add SPDX-License-Identifier to libfdt wrappers Date: Fri, 1 Nov 2019 15:14:09 +0900 Message-Id: <20191101061411.16988-2-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191101061411.16988-1-yamada.masahiro@socionext.com> References: <20191101061411.16988-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org These are kernel source code even though they are just two-line wrappers. Files without explicit license information fall back to GPL-2.0-only, which is the project default. Signed-off-by: Masahiro Yamada --- lib/fdt.c | 1 + lib/fdt_empty_tree.c | 1 + lib/fdt_ro.c | 1 + lib/fdt_rw.c | 1 + lib/fdt_strerror.c | 1 + lib/fdt_sw.c | 1 + lib/fdt_wip.c | 1 + 7 files changed, 7 insertions(+) -- 2.17.1 diff --git a/lib/fdt.c b/lib/fdt.c index 97f20069fc37..041f8922a23c 100644 --- a/lib/fdt.c +++ b/lib/fdt.c @@ -1,2 +1,3 @@ +// SPDX-License-Identifier: GPL-2.0-only #include #include "../scripts/dtc/libfdt/fdt.c" diff --git a/lib/fdt_empty_tree.c b/lib/fdt_empty_tree.c index 5d30c58150ad..452221227bf3 100644 --- a/lib/fdt_empty_tree.c +++ b/lib/fdt_empty_tree.c @@ -1,2 +1,3 @@ +// SPDX-License-Identifier: GPL-2.0-only #include #include "../scripts/dtc/libfdt/fdt_empty_tree.c" diff --git a/lib/fdt_ro.c b/lib/fdt_ro.c index f73c04ea7be4..9f696d19f060 100644 --- a/lib/fdt_ro.c +++ b/lib/fdt_ro.c @@ -1,2 +1,3 @@ +// SPDX-License-Identifier: GPL-2.0-only #include #include "../scripts/dtc/libfdt/fdt_ro.c" diff --git a/lib/fdt_rw.c b/lib/fdt_rw.c index 0c1f0f4a4b13..2a61e9c6dd44 100644 --- a/lib/fdt_rw.c +++ b/lib/fdt_rw.c @@ -1,2 +1,3 @@ +// SPDX-License-Identifier: GPL-2.0-only #include #include "../scripts/dtc/libfdt/fdt_rw.c" diff --git a/lib/fdt_strerror.c b/lib/fdt_strerror.c index 8713e3ff4707..4554e5fdac12 100644 --- a/lib/fdt_strerror.c +++ b/lib/fdt_strerror.c @@ -1,2 +1,3 @@ +// SPDX-License-Identifier: GPL-2.0-only #include #include "../scripts/dtc/libfdt/fdt_strerror.c" diff --git a/lib/fdt_sw.c b/lib/fdt_sw.c index 9ac7e50c76ce..d3345ca399cf 100644 --- a/lib/fdt_sw.c +++ b/lib/fdt_sw.c @@ -1,2 +1,3 @@ +// SPDX-License-Identifier: GPL-2.0-only #include #include "../scripts/dtc/libfdt/fdt_sw.c" diff --git a/lib/fdt_wip.c b/lib/fdt_wip.c index 45b3fc3d3ba1..9674d4c3b115 100644 --- a/lib/fdt_wip.c +++ b/lib/fdt_wip.c @@ -1,2 +1,3 @@ +// SPDX-License-Identifier: GPL-2.0-only #include #include "../scripts/dtc/libfdt/fdt_wip.c" From patchwork Fri Nov 1 06:14:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 178245 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp37218ill; Thu, 31 Oct 2019 23:16:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqxafBIDb5ttPCxHmM+iOKk02AqXqNkSdqzdFpCs4nXd4nOhP2AdFPVCegCHpHZPUpKU+MEg X-Received: by 2002:a50:d55b:: with SMTP id f27mr10843064edj.302.1572588980643; Thu, 31 Oct 2019 23:16:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572588980; cv=none; d=google.com; s=arc-20160816; b=HO0ONQkZ6EOXQTm2lWLjzag4U5YR3e2gZw0fg7pmYq+6MRqsW5qFSeEdGrqpf0aynO HSz11SF6BM4ygrgGc+IiIwH+Y4XtSBsuulhxi1HX+t6SLudw3/4QPpN/0i0GX97RsKJR 0QNnw9iWKCl2vBFQoDg2YVTo7W6UXIAAVVO3vqZWk3jP6vzJ71BIvFPv1X5XSZqAg4Uy TNZtsiBOPY2nLpD+1l2pWyiiuEx3fPauLeE6vwMv2jCVibxN1P0y597vredo1k32bsYf MJtB7fRdcy9M+7gmErjDC4CfnHV0Hfa6mxjoDuxh1v0ZhNvZI+t+DuUnmGGOZhfiJjBH HLCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=sejarmf1kWjQCUK13JqJxgF3yj4ZhJEUnONZYHI22+8=; b=fs1EwZWR7M0MKwQaeXiqDDnWWRY1uS90pvnpwLTEl5Q5Ham+UiPS9+ds+2Bnx3AkWx 1xipt7G4XTVQO8Lgc1SmfxOefDJLj0RvkAm6XTRpmVAyjd+dEl3NZdyrWPCNGi0ntr4u KtYCXN780BTCak4gV6W6D2yctFDKeayIxbDmdeli+sB5T4d6C7yqnqu0dNggaPSOup77 4EBi7dgE5BVXtaLsjQlZPY0Gx6sgs2p9IzzOoixPAJ8e0OV0Dt+4OFKV7u552PHB7rWW 47Dbz5cHCRptcEoSzHpsEbWfjIFT+xXcTUSgOQV75RFfMS57qxMPK6fImsVpuklSqKxa MFjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=2YWbwrr4; 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 x28si6042866edd.427.2019.10.31.23.16.18; Thu, 31 Oct 2019 23:16:20 -0700 (PDT) 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=2YWbwrr4; 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 S1729634AbfKAGQO (ORCPT + 26 others); Fri, 1 Nov 2019 02:16:14 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:46018 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725280AbfKAGQO (ORCPT ); Fri, 1 Nov 2019 02:16:14 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id xA16ELBe016348; Fri, 1 Nov 2019 15:14:25 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com xA16ELBe016348 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1572588866; bh=sejarmf1kWjQCUK13JqJxgF3yj4ZhJEUnONZYHI22+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2YWbwrr4bSJ3T0pDPCSvJ5c3vXmKpyu2qmDdF2AhITLbtdnlC3EK7LfI6A7qE+c9w xUZdRx9h3KLmoEADzIi4tldQFoey7z8u8rxlYyfluT8J74g2r5tGemPMupzMHcTa4w Aj6KS/lDfRz8QGtVa3SAiPy+LHyO8DU6dDRQjWAzaRLR+bvnMvkzunkG2G1k5CCRwS lRXu7mN4R2W5SLOVe+bN0LQATb+FbTvyVgD8dFMvksH1KzxPHW7oMU90TCMvS03yrH eoIJpASdGZ7XU6GQRG6PvT4tyKSmUH+F8ogjI8E8PrB2VXjjCaVZUy0oOfr5FztlmG Z4h3le7QzDceQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: devicetree@vger.kernel.org, Rob Herring , Frank Rowand Cc: linux-arm-kernel@lists.infradead.org, David Gibson , linuxppc-dev@lists.ozlabs.org, Masahiro Yamada , Russell King , linux-kernel@vger.kernel.org Subject: [PATCH 2/3] ARM: decompressor: simplify libfdt builds Date: Fri, 1 Nov 2019 15:14:10 +0900 Message-Id: <20191101061411.16988-3-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191101061411.16988-1-yamada.masahiro@socionext.com> References: <20191101061411.16988-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Copying source files during the build time may not end up with as clean code as you expect. lib/fdt*.c simply wrap scripts/dtc/libfdt/fdt*.c, and it works nicely. Let's follow that approach for the arm decompressor, too. Add four wrappers, arch/arm/boot/compressed/fdt*.c and remove the Makefile messes. Another nice thing is we no longer need to maintain the separate libfdt_env.h since we can include , and the -- 2.17.1 diff stat also looks nice. Signed-off-by: Masahiro Yamada --- arch/arm/boot/compressed/.gitignore | 9 ------- arch/arm/boot/compressed/Makefile | 33 +++++++------------------ arch/arm/boot/compressed/atags_to_fdt.c | 1 + arch/arm/boot/compressed/fdt.c | 2 ++ arch/arm/boot/compressed/fdt_ro.c | 2 ++ arch/arm/boot/compressed/fdt_rw.c | 2 ++ arch/arm/boot/compressed/fdt_wip.c | 2 ++ arch/arm/boot/compressed/libfdt_env.h | 22 ----------------- 8 files changed, 18 insertions(+), 55 deletions(-) create mode 100644 arch/arm/boot/compressed/fdt.c create mode 100644 arch/arm/boot/compressed/fdt_ro.c create mode 100644 arch/arm/boot/compressed/fdt_rw.c create mode 100644 arch/arm/boot/compressed/fdt_wip.c delete mode 100644 arch/arm/boot/compressed/libfdt_env.h diff --git a/arch/arm/boot/compressed/.gitignore b/arch/arm/boot/compressed/.gitignore index 86b2f5d28240..2fdb4885846b 100644 --- a/arch/arm/boot/compressed/.gitignore +++ b/arch/arm/boot/compressed/.gitignore @@ -6,12 +6,3 @@ hyp-stub.S piggy_data vmlinux vmlinux.lds - -# borrowed libfdt files -fdt.c -fdt.h -fdt_ro.c -fdt_rw.c -fdt_wip.c -libfdt.h -libfdt_internal.h diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile index 9219389bbe61..a0d645c66980 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile @@ -76,29 +76,23 @@ compress-$(CONFIG_KERNEL_LZMA) = lzma compress-$(CONFIG_KERNEL_XZ) = xzkern compress-$(CONFIG_KERNEL_LZ4) = lz4 -# Borrowed libfdt files for the ATAG compatibility mode - -libfdt := fdt_rw.c fdt_ro.c fdt_wip.c fdt.c -libfdt_hdrs := fdt.h libfdt.h libfdt_internal.h - -libfdt_objs := $(addsuffix .o, $(basename $(libfdt))) - -$(addprefix $(obj)/,$(libfdt) $(libfdt_hdrs)): $(obj)/%: $(srctree)/scripts/dtc/libfdt/% - $(call cmd,shipped) +ifeq ($(CONFIG_ARM_ATAG_DTB_COMPAT),y) +libfdt_objs = fdt_rw.o fdt_ro.o fdt_wip.o fdt.o atags_to_fdt.o -$(addprefix $(obj)/,$(libfdt_objs) atags_to_fdt.o): \ - $(addprefix $(obj)/,$(libfdt_hdrs)) +OBJS += $(libfdt_objs) -ifeq ($(CONFIG_ARM_ATAG_DTB_COMPAT),y) -OBJS += $(libfdt_objs) atags_to_fdt.o +# -fstack-protector-strong triggers protection checks in this code, +# but it is being used too early to link to meaningful stack_chk logic. +nossp_flags := $(call cc-option, -fno-stack-protector) +$(foreach o, $(libfdt_objs), \ + $(eval CFLAGS_$(o) := -I $(srctree)/scripts/dtc/libfdt) $(nossp_flags)) endif targets := vmlinux vmlinux.lds piggy_data piggy.o \ lib1funcs.o ashldi3.o bswapsdi2.o \ head.o $(OBJS) -clean-files += piggy_data lib1funcs.S ashldi3.S bswapsdi2.S \ - $(libfdt) $(libfdt_hdrs) hyp-stub.S +clean-files += piggy_data lib1funcs.S ashldi3.S bswapsdi2.S hyp-stub.S KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING KBUILD_CFLAGS += $(DISABLE_ARM_SSP_PER_TASK_PLUGIN) @@ -108,15 +102,6 @@ ORIG_CFLAGS := $(KBUILD_CFLAGS) KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS)) endif -# -fstack-protector-strong triggers protection checks in this code, -# but it is being used too early to link to meaningful stack_chk logic. -nossp_flags := $(call cc-option, -fno-stack-protector) -CFLAGS_atags_to_fdt.o := $(nossp_flags) -CFLAGS_fdt.o := $(nossp_flags) -CFLAGS_fdt_ro.o := $(nossp_flags) -CFLAGS_fdt_rw.o := $(nossp_flags) -CFLAGS_fdt_wip.o := $(nossp_flags) - ccflags-y := -fpic $(call cc-option,-mno-single-pic-base,) -fno-builtin -I$(obj) asflags-y := -DZIMAGE diff --git a/arch/arm/boot/compressed/atags_to_fdt.c b/arch/arm/boot/compressed/atags_to_fdt.c index 330cd3c2eae5..53a60ba066a1 100644 --- a/arch/arm/boot/compressed/atags_to_fdt.c +++ b/arch/arm/boot/compressed/atags_to_fdt.c @@ -1,4 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 +#include #include #include diff --git a/arch/arm/boot/compressed/fdt.c b/arch/arm/boot/compressed/fdt.c new file mode 100644 index 000000000000..f8ea7a201ab1 --- /dev/null +++ b/arch/arm/boot/compressed/fdt.c @@ -0,0 +1,2 @@ +// SPDX-License-Identifier: GPL-2.0-only +#include "../../../../lib/fdt.c" diff --git a/arch/arm/boot/compressed/fdt_ro.c b/arch/arm/boot/compressed/fdt_ro.c new file mode 100644 index 000000000000..93970a4ad5ae --- /dev/null +++ b/arch/arm/boot/compressed/fdt_ro.c @@ -0,0 +1,2 @@ +// SPDX-License-Identifier: GPL-2.0-only +#include "../../../../lib/fdt_ro.c" diff --git a/arch/arm/boot/compressed/fdt_rw.c b/arch/arm/boot/compressed/fdt_rw.c new file mode 100644 index 000000000000..f7c6b8b7e01c --- /dev/null +++ b/arch/arm/boot/compressed/fdt_rw.c @@ -0,0 +1,2 @@ +// SPDX-License-Identifier: GPL-2.0-only +#include "../../../../lib/fdt_rw.c" diff --git a/arch/arm/boot/compressed/fdt_wip.c b/arch/arm/boot/compressed/fdt_wip.c new file mode 100644 index 000000000000..048d2c7a088d --- /dev/null +++ b/arch/arm/boot/compressed/fdt_wip.c @@ -0,0 +1,2 @@ +// SPDX-License-Identifier: GPL-2.0-only +#include "../../../../lib/fdt_wip.c" diff --git a/arch/arm/boot/compressed/libfdt_env.h b/arch/arm/boot/compressed/libfdt_env.h deleted file mode 100644 index b36c0289a308..000000000000 --- a/arch/arm/boot/compressed/libfdt_env.h +++ /dev/null @@ -1,22 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ARM_LIBFDT_ENV_H -#define _ARM_LIBFDT_ENV_H - -#include -#include -#include - -#define INT_MAX ((int)(~0U>>1)) - -typedef __be16 fdt16_t; -typedef __be32 fdt32_t; -typedef __be64 fdt64_t; - -#define fdt16_to_cpu(x) be16_to_cpu(x) -#define cpu_to_fdt16(x) cpu_to_be16(x) -#define fdt32_to_cpu(x) be32_to_cpu(x) -#define cpu_to_fdt32(x) cpu_to_be32(x) -#define fdt64_to_cpu(x) be64_to_cpu(x) -#define cpu_to_fdt64(x) cpu_to_be64(x) - -#endif From patchwork Fri Nov 1 06:14:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 178246 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp37224ill; Thu, 31 Oct 2019 23:16:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqzA2+U3BuTU3lkl+vRu3wVYgGY5hhMQ7i7dSlZ4kid90dotUhyu8U+E+PxgqKqVVd1AtHXD X-Received: by 2002:aa7:d4d8:: with SMTP id t24mr729531edr.40.1572588981075; Thu, 31 Oct 2019 23:16:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572588981; cv=none; d=google.com; s=arc-20160816; b=X0NrbpGpicKn38NVu4AZvJ5WuKCZPDYCmsCfnFbAVybF7R31BZq8mTj1DNA6KmKj74 gbRDtE/h1ARqfaOaBQakCERPzHHm7axO4QfHH9CQLXC6M3w0S6Xmziu0V1Gdprk7A7tS tGpM35OCpZxCKyQ8+NXhxjAkzcyiJQDex1+Tr0O4F49+AYSTLH3cm1CkK2JnatUTFvMZ PZCRY1zQjvoeDFWUsZJJi9+OmKp+ANg9EmDGBc91znrlTBITK0In/E3N25lfIWcCgxUI hddzZXXybJibrSx2GH1vUqO06Ort2HryxE40jcUWJUDAyMm8zU6ltTZRMJAW57H3fxUn A4yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=EbWxLFiY8h504jFBt4i5+hTSLW7vcJ0MI7MXhe5UQ4A=; b=L9MbavG8gwPmhRgCP+8SLnU9vJ8u0kqGzZqWNkO32Cei0OXcv4Pt/LLkYxp086SAoD pes7Hhtx7ggCEKRV5DIx6vuZA7aPWIfWYLdWKIf+2xnBt7HRpUcWuPSbCn2Pe8sNW3YV AR+EH4kzSUIf+kVd47Mo4KidKK+oMRHZZjEBm8kBeFZuGKmLAF7jGp8fFUuEXVGdoVmj OBbJv1HhrtBWChZ9pTP/oqry/cLDE2Ap+n13qb3RqRfH94ZaF4JhK/71/L7z1VV062H4 eEjXqjVDT5i4eo0VctVAmqlOLbNMi9axKUym+RZTuFix+uGzA1vGTvb81ddj1pO9Byzb o/Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=vMfrOzEq; 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 x28si6042866edd.427.2019.10.31.23.16.20; Thu, 31 Oct 2019 23:16:21 -0700 (PDT) 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=vMfrOzEq; 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 S1729716AbfKAGQS (ORCPT + 26 others); Fri, 1 Nov 2019 02:16:18 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:46078 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728895AbfKAGQP (ORCPT ); Fri, 1 Nov 2019 02:16:15 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id xA16ELBf016348; Fri, 1 Nov 2019 15:14:26 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com xA16ELBf016348 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1572588867; bh=EbWxLFiY8h504jFBt4i5+hTSLW7vcJ0MI7MXhe5UQ4A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vMfrOzEqcV2/ffzg63CsgD7KAK9Gc0e7hcDmgQ5MXqttKHTYPbVhJUrLSB9juAYul wLYUcgfYY9xp/QA/isOxstI60AFkA7nkGfwgpkyWCxb+RNjh4NtViZ3ZnVA+FsP2zZ L9jNI7XCSZD9bd/Ek/CRT1iwSb7U3g77mbixfMq0Ed+bMCGVnijS76NCTdCzg3YIG0 vV+neEM0QKtdfOAOOUCuPZ7fXARQVLN4w5dVIGJHHNVB2nrfIlA5cmTURunQ/FfsPA MU8oOsILf/rtcXXFSPg7fpTmc+VqTztF8Ms7vjSiXjN5X0OxSchINuevpDufACdFd2 e9kOSSAmqnYOw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: devicetree@vger.kernel.org, Rob Herring , Frank Rowand Cc: linux-arm-kernel@lists.infradead.org, David Gibson , linuxppc-dev@lists.ozlabs.org, Masahiro Yamada , Benjamin Herrenschmidt , Michael Ellerman , Paul Mackerras , linux-kernel@vger.kernel.org Subject: [PATCH 3/3] libfdt: define INT32_MAX and UINT32_MAX in libfdt_env.h Date: Fri, 1 Nov 2019 15:14:11 +0900 Message-Id: <20191101061411.16988-4-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191101061411.16988-1-yamada.masahiro@socionext.com> References: <20191101061411.16988-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The libfdt in the upstream DTC project added references to (U)INT32_MAX by the following commits: Commit 812b1956a076 ("libfdt: Tweak data handling to satisfy Coverity") Commit 7fcf8208b8a9 ("libfdt: add fdt_append_addrrange()") The kernel needs to adjust libfdt_env.h before pulling in the changes. As for the user-space programs, defines (U)INT32_MAX along with (u)int32_t. In the kernel, on the other hand, we usually use s32 / u32 instead of (u)int32_t for the fixed-width types. Accordingly, we already have S32_MAX / U32_MAX for their max values. So, we won't add (U)INT32_MAX to any more. Instead, add them to the in-kernel libfdt_env.h to compile fdt.c and fdt_addresses.c Signed-off-by: Masahiro Yamada --- arch/powerpc/boot/libfdt_env.h | 2 ++ include/linux/libfdt_env.h | 3 +++ 2 files changed, 5 insertions(+) -- 2.17.1 diff --git a/arch/powerpc/boot/libfdt_env.h b/arch/powerpc/boot/libfdt_env.h index 2abc8e83b95e..a4a386114ef5 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 INT32_MAX ((u32)~0U) +#define UINT32_MAX ((s32)(INT_MAX >> 1)) #include "of.h" diff --git a/include/linux/libfdt_env.h b/include/linux/libfdt_env.h index edb0f0c30904..0bd83bdb2482 100644 --- a/include/linux/libfdt_env.h +++ b/include/linux/libfdt_env.h @@ -11,6 +11,9 @@ typedef __be16 fdt16_t; typedef __be32 fdt32_t; typedef __be64 fdt64_t; +#define INT32_MAX S32_MAX +#define UINT32_MAX U32_MAX + #define fdt32_to_cpu(x) be32_to_cpu(x) #define cpu_to_fdt32(x) cpu_to_be32(x) #define fdt64_to_cpu(x) be64_to_cpu(x)