devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: robh+dt@kernel.org, frowand.list@gmail.com
Cc: devicetree@vger.kernel.org, AKASHI Takahiro <takahiro.akashi@linaro.org>
Subject: [PATCH] lib: add missing files from libfdt
Date: Wed, 26 Sep 2018 14:58:03 +0900	[thread overview]
Message-ID: <20180926055803.19071-1-takahiro.akashi@linaro.org> (raw)

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 <takahiro.akashi@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Frank Rowand <frowand.list@gmail.com>
---
 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

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 <linux/libfdt_env.h>
+#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 <linux/kernel.h>
+#include <linux/libfdt_env.h>
+
+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"
-- 
2.18.0

             reply	other threads:[~2018-09-26  5:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-26  5:58 AKASHI Takahiro [this message]
2018-09-28 12:49 ` [PATCH] lib: add missing files from libfdt Rob Herring
2018-10-02  6:12   ` AKASHI, Takahiro
2018-10-02 14:03     ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180926055803.19071-1-takahiro.akashi@linaro.org \
    --to=takahiro.akashi@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).