Re: [PATCH] of/lib: Export fdt routines to modules

From: David Daney
Date: Wed Oct 16 2013 - 19:54:32 EST


On 10/16/2013 04:27 PM, Michael Bohan wrote:
Ever since the following commit, libfdt has been available for
usage in the kernel:

commit ab25383983fb8d7786696f5371e75e79c3e9a405
Author: David Daney <david.daney@xxxxxxxxxx>
Date: Thu Jul 5 18:12:38 2012 +0200

of/lib: Allow scripts/dtc/libfdt to be used from kernel code

Export these functions to modules so that they may be used
from device drivers.

Change-Id: I7f540b7cf860c4be414e32ce183be5268b2ae6af
Signed-off-by: Michael Bohan <mbohan@xxxxxxxxxxxxxx>
---
lib/fdt.c | 6 ++++++
lib/fdt_ro.c | 28 ++++++++++++++++++++++++++++
lib/fdt_rw.c | 13 +++++++++++++
lib/fdt_sw.c | 9 +++++++++
lib/fdt_wip.c | 6 ++++++
5 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/lib/fdt.c b/lib/fdt.c
index 97f2006..a3fe87b 100644
--- a/lib/fdt.c
+++ b/lib/fdt.c
@@ -1,2 +1,8 @@
#include <linux/libfdt_env.h>
+#include <linux/module.h>
#include "../scripts/dtc/libfdt/fdt.c"
+
+EXPORT_SYMBOL_GPL(fdt_next_tag);

The code was all written by David Gibson, and is dual GPL/BSD licensed. So I am not sure you should be using the GPL flavor of the export directive.


But more than this. I don't understand why a driver would be parsing the FDT in the first place. If there is a device tree, why hasn't it been unflattened, and thus used via the normal device tree functions.

David Daney
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/