From patchwork Wed Sep 26 05:58:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 147542 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp301054lji; Tue, 25 Sep 2018 22:57:18 -0700 (PDT) X-Google-Smtp-Source: ACcGV60ht6uEQ71r9j68XjNKftG3qJ0sAonvAtLad3JtPLP6Kw/6NGgiFdYeZIItlWxHfZnT+UbY X-Received: by 2002:a17:902:585:: with SMTP id f5-v6mr4401676plf.7.1537941438199; Tue, 25 Sep 2018 22:57:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537941438; cv=none; d=google.com; s=arc-20160816; b=J44aZqj2CYbxy0yuYHHpvh0DSFRY5D+YotMHoUAbeI/kCMExEbcJMCowUNina2R2ES yvFlt93Lni30LM41T34iY77BX+trfZOurlqjMzEn3e5TsgoSVuJWY6ItBoIJfrdeE/3Y AkYS+ci356o0vU0198PtBS9a3oIUlb15WSWgU2aeQAmFDJelIGhCj4iQZd6GviQz4Moi e798mUELvkYWlxNFYxyS7TmwaXFd0q3l7otKuUePMd/JNQyQe7ppPYZ2Cnqlnjo12Olg K0rjIXoPLmlFPhWdC/s4VCgI+8nOX8Avwc292WNNyTa6pswBpEotTqUdR5/Ov4oi4s41 Qrfg== 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; bh=wGKXswjPNPcFOj8fCmPjwF5pXoJpX2Y2TzBViur+fhY=; b=hqJURCH2eIH1QPA5+x3tLSsGN7em+Ib9L4zWcBAEcEP9dU90as5i+s80R3l6yw8jay nH6eg2uQzWlfCWHSklrBWXtWRVD72nT16+14MAS5TrtjyTs9/tNN6lRCTMerHEWqbm42 3UE4GIlYVvPjka8duWv8hesvKIpKZwFJ3G23YW7gOtglfgigHpQQVwAViBTEVAxdqggg Ft5vNO41vYrUz8CfJKHZ8by+W3S1Q7f2lEgcGo0OG7ZqgazHyBI85diPhDYrvybNkVrL I65DmtHZPapIta5g92uU6bgAt8HDu8Rnw+zdnYNF2jRE2QHB+PIbv7D0gDbBTWHKOHZR JGoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fpl+W7Es; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w18-v6si4304067plq.104.2018.09.25.22.57.17; Tue, 25 Sep 2018 22:57:18 -0700 (PDT) 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=@linaro.org header.s=google header.b=fpl+W7Es; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726319AbeIZMI3 (ORCPT + 6 others); Wed, 26 Sep 2018 08:08:29 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:38591 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726253AbeIZMI3 (ORCPT ); Wed, 26 Sep 2018 08:08:29 -0400 Received: by mail-pf1-f196.google.com with SMTP id x17-v6so12864014pfh.5 for ; Tue, 25 Sep 2018 22:57:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=wGKXswjPNPcFOj8fCmPjwF5pXoJpX2Y2TzBViur+fhY=; b=fpl+W7Esu4iM9P+kpJa+l/w3tWu14XWp2Tho1OwRHJBqWLkYnlP/M28phJnjfQCDn4 SDO0h2AxJZBZU1fOlinuWv9PIBjBcIw9a9uVPRjAfVrbKAT9f3diFOefXcXT3mTbdW6T Ovdj9t7YbXNX9b/zTWbRloeWxcXh74nsSBBis= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=wGKXswjPNPcFOj8fCmPjwF5pXoJpX2Y2TzBViur+fhY=; b=HLjSeWjL+a0MInsPe5AF5ZJFuXTqWs3V2+Lax4N6Tx/iQgxGmnKTpzVTfQxPVBoFQC 223WG6s093eQ0P6qhedcO9mqZdtQk0W9D+GHDjTj1aSX3r8rOug0AtKw+swmRowA+AcU 7pFqJ9Qc4CCk0WyQibWtF6VGm9ZxYnXQkw3fgaQlP/PkdJAWsFQrw3/i7iuMXWn5TijO zpmJ5fggVyFabakLOgIAbE1ulfZ7WgzExLn3S6QVAdkyDS4ihm15WF+Ju4jT/ZtSQ7dQ BARP3fiON3AQwoFkHe7XgqNxbX83OJHlsMFJLBN1LTIi/zfNd9vd3fd/Ahwcdy36Eh0k Tcyw== X-Gm-Message-State: ABuFfohWJpoK79CpfvrUdyyrUB/5LsYW6NNS1ZIrE8PeTTV42qGOABJG ORvmnBi+5nXn+daJjRfSFTNUXw== X-Received: by 2002:a63:fe49:: with SMTP id x9-v6mr4094422pgj.152.1537941435758; Tue, 25 Sep 2018 22:57:15 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id p19-v6sm7766337pgh.60.2018.09.25.22.57.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Sep 2018 22:57:15 -0700 (PDT) From: AKASHI Takahiro To: robh+dt@kernel.org, frowand.list@gmail.com Cc: devicetree@vger.kernel.org, AKASHI Takahiro Subject: [PATCH] lib: add missing files from libfdt Date: Wed, 26 Sep 2018 14:58:03 +0900 Message-Id: <20180926055803.19071-1-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.18.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org There are two files that are part of dtc/libfdt, but don't appear in lib. This patch fixes it. Please note that strtoul() used in fdt_overlay.c is now faked using kstrtoul() (not simple_strtoul() which is obsolute). Signed-off-by: AKASHI Takahiro Cc: Rob Herring Cc: Frank Rowand --- lib/Makefile | 2 +- lib/fdt_addresses.c | 3 +++ lib/fdt_overlay.c | 23 +++++++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 lib/fdt_addresses.c create mode 100644 lib/fdt_overlay.c -- 2.18.0 diff --git a/lib/Makefile b/lib/Makefile index ca3f7ebb900d..444c82413a3c 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -202,7 +202,7 @@ KASAN_SANITIZE_stackdepot.o := n KCOV_INSTRUMENT_stackdepot.o := n libfdt_files = fdt.o fdt_ro.o fdt_wip.o fdt_rw.o fdt_sw.o fdt_strerror.o \ - fdt_empty_tree.o + fdt_empty_tree.o fdt_addresses.o fdt_overlay.o $(foreach file, $(libfdt_files), \ $(eval CFLAGS_$(file) = -I$(src)/../scripts/dtc/libfdt)) lib-$(CONFIG_LIBFDT) += $(libfdt_files) diff --git a/lib/fdt_addresses.c b/lib/fdt_addresses.c new file mode 100644 index 000000000000..241780d09882 --- /dev/null +++ b/lib/fdt_addresses.c @@ -0,0 +1,3 @@ +// SPDX-License-Identifier: GPL-2.0 +#include +#include "../scripts/dtc/libfdt/fdt_addresses.c" diff --git a/lib/fdt_overlay.c b/lib/fdt_overlay.c new file mode 100644 index 000000000000..1def7268d313 --- /dev/null +++ b/lib/fdt_overlay.c @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0 +#include +#include + +static unsigned long strtoul(const char *nptr, char **endptr, int base) +{ + unsigned long res; + int ret; + + /* + * FIXME: no way to return a correct value of endptr. + * The values here would be still good for use in fdt_overlay + */ + *endptr = (char *)nptr; + ret = kstrtoul(nptr, base, &res); + if (ret < 0) + return ULONG_MAX; + + (*endptr)++; + return res; +} + +#include "../scripts/dtc/libfdt/fdt_overlay.c"