Use the libfdt.h include as the interface definition
PATCH 1/1 Use the libfdt.h include as the interface definition
libfdt.h is the libfdt interface definition. It includes fdt.h and libfdt_env.h, so there is no reason to include those in the general code.
---
No code changes, just cleaning up the #include situation WRT libfdt.h, fdt.h, and libfdt_env.h (the later two being redundant).
I looked at moving the fdt64_t, fdt32_t, fdt16_t definitions from libfdt_env.h to fdt.h. I'm not sure this is a Good Thing[tm], but will send a separate patch for consideration and discussion.
dtc.h | 3 +-- fdtdump.c | 3 +-- libfdt/fdt.c | 3 --- libfdt/fdt_empty_tree.c | 3 --- libfdt/fdt_ro.c | 3 --- libfdt/fdt_rw.c | 3 --- libfdt/fdt_strerror.c | 3 --- libfdt/fdt_sw.c | 3 --- libfdt/fdt_wip.c | 3 --- libfdt/libfdt_internal.h | 1 - 10 files changed, 2 insertions(+), 26 deletions(-)
dtc.h +1 -2
@@ -32,8 +32,7 @@#include <errno.h> #include <unistd.h> -#include <libfdt_env.h> -#include <fdt.h> +#include <libfdt.h> #include "util.h"
fdtdump.c +1 -2
@@ -8,8 +8,7 @@#include <string.h> #include <ctype.h> -#include <libfdt_env.h> -#include <fdt.h> +#include <libfdt.h> #include "util.h"
libfdt/fdt.c +0 -3
@@ -48,11 +48,8 @@* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "libfdt_env.h" -#include <fdt.h> #include <libfdt.h> -#include "libfdt_internal.h" int fdt_check_header (const void *fdt)
libfdt/fdt_empty_tree.c +0 -3
@@ -48,11 +48,8 @@* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "libfdt_env.h" -#include <fdt.h> #include <libfdt.h> -#include "libfdt_internal.h" int fdt_create_empty_tree (void *buf,int bufsize)
libfdt/fdt_ro.c +0 -3
@@ -48,11 +48,8 @@* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "libfdt_env.h" -#include <fdt.h> #include <libfdt.h> -#include "libfdt_internal.h" static int _fdt_nodename_eq(const void *fdt, int offset,
libfdt/fdt_rw.c +0 -3
@@ -48,11 +48,8 @@* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "libfdt_env.h" -#include <fdt.h> #include <libfdt.h> -#include "libfdt_internal.h" static int _fdt_blocks_misordered(const void *fdt,
libfdt/fdt_strerror.c +0 -3
@@ -48,11 +48,8 @@* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "libfdt_env.h" -#include <fdt.h> #include <libfdt.h> -#include "libfdt_internal.h" struct fdt_errtabent {
libfdt/fdt_sw.c +0 -3
@@ -48,11 +48,8 @@* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "libfdt_env.h" -#include <fdt.h> #include <libfdt.h> -#include "libfdt_internal.h" static int _fdt_sw_check_header (void *fdt)
libfdt/fdt_wip.c +0 -3
@@ -48,11 +48,8 @@* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "libfdt_env.h" -#include <fdt.h> #include <libfdt.h> -#include "libfdt_internal.h" int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
libfdt/libfdt_internal.h +0 -1
@@ -50,7 +50,6 @@* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <fdt.h> #define FDT_ALIGN (x, a) (((x) + (a) - 1) & ~((a) - 1))#define FDT_TAGALIGN (x) (FDT_ALIGN((x), FDT_TAGSIZE))
Signature · 1 line
1.7.9.5
A message that is not in the archive (sent off-list or not yet received): 5105E3EA.2070306-He//[email protected]
Quoted 30 lines · Gerald Van Baren
libfdt.his the libfdt interface definition. It includesfdt.handlibfdt_env.h, so there is no reason to include those in the general code.Signed-off-by Gerald Van Baren <vanbaren-He//[email protected]>---
No code changes, just cleaning up the #include situation WRT
libfdt.h,fdt.h, andlibfdt_env.h(the later two being redundant).I looked at moving the
fdt64_t,fdt32_t,fdt16_tdefinitions fromlibfdt_env.htofdt.h. I'm not sure this is a Good Thing[tm], but will send a separate patch for consideration and discussion.dtc.h | 3 +-- fdtdump.c | 3 +-- libfdt/fdt.c | 3 --- libfdt/fdt_empty_tree.c | 3 --- libfdt/fdt_ro.c | 3 --- libfdt/fdt_rw.c | 3 --- libfdt/fdt_strerror.c | 3 --- libfdt/fdt_sw.c | 3 --- libfdt/fdt_wip.c | 3 --- libfdt/libfdt_internal.h | 1 - 10 files changed, 2 insertions(+), 26 deletions(-)dtc.h +0
-0
dtc.h line 35
Quoted 6 lines
dtc.h +1
-2@@ -32,8 +32,7 @@#include <errno.h> #include <unistd.h> -#include <libfdt_env.h> -#include <fdt.h> +#include <libfdt.h>
For dtc.h, this is wrong - dtc uses the structures in fdt.h, but (deliberately) nothing in libfdt.h.
For the other cases, I'm a bit undecided. As you say, the individual includes are redundant. In some cases the explicit inclusions kind of document that the C code has direct dependencies on the stuff in libfdt_env.h and fdt.h as well as the indirect dependencies from the libfdt.h API. I'm not really sold either way.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
_______________________________________________
devicetree-discuss mailing list devicetree-discuss-uLR06cmDAlY/[email protected]
https://lists.ozlabs.org/listinfo/devicetree-discuss