diff mbox

[U-Boot,V2,08/12] board: mpl: Move common headers to board-common directory

Message ID 1447393422-4169-9-git-send-email-nm@ti.com
State Rejected
Delegated to: Tom Rini
Headers show

Commit Message

Nishanth Menon Nov. 13, 2015, 5:43 a.m. UTC
Header files can be located in a generic location without
needing to reference them with ../common/

Generated with the following script

 #!/bin/bash
vendor=board/mpl
common=$vendor/common

cfiles=`git grep "../common" $vendor|grep "#include"|cut -d '"' -f2|sort -u|grep c$`
headers=`git grep "../common" $vendor|grep "#include"|cut -d '"' -f2|sort -u|grep h$`

mkdir -p $common/include/board-common
set -x
for header in $headers
do
	echo "processing $header in $common"
	hbase=`basename $header`
	git mv $common/$hbase $common/include/board-common
	sed -i -e "s/\"..\/common\/$hbase\"/<board-common\/$hbase>/g" $vendor/*/*.[chS]
	sed -i -e "s/\"$hbase\"/<board-common\/$hbase>/g" $vendor/common/*.[chS]
done

Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: "David Müller" <d.mueller@elsoft.ch>
Cc: Denis Peter <d.peter@mpl.ch>

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 board/mpl/common/common_util.c                            | 2 +-
 board/mpl/common/{ => include/board-common}/common_util.h | 0
 board/mpl/common/{ => include/board-common}/isa.h         | 0
 board/mpl/common/isa.c                                    | 2 +-
 board/mpl/common/kbd.c                                    | 2 +-
 board/mpl/common/pci.c                                    | 2 +-
 board/mpl/mip405/cmd_mip405.c                             | 2 +-
 board/mpl/mip405/mip405.c                                 | 2 +-
 board/mpl/pip405/cmd_pip405.c                             | 2 +-
 board/mpl/pip405/pip405.c                                 | 4 ++--
 board/mpl/vcma9/cmd_vcma9.c                               | 2 +-
 board/mpl/vcma9/vcma9.c                                   | 2 +-
 12 files changed, 11 insertions(+), 11 deletions(-)
 rename board/mpl/common/{ => include/board-common}/common_util.h (100%)
 rename board/mpl/common/{ => include/board-common}/isa.h (100%)

Comments

David Müller (ELSOFT AG) Nov. 13, 2015, 8:19 a.m. UTC | #1
Hello

Nishanth Menon wrote:
> Header files can be located in a generic location without needing to
> reference them with ../common/
> 
> board/mpl/common/{ => include/board-common}/common_util.h (100%) 
> rename board/mpl/common/{ => include/board-common}/isa.h (100%)

Correct me if I'm missing something here but I don't see the actual gain
of doing this. "board/mpl/common" contains MPL specific things which
should be kept as locally to the MPL boards directory as possible.

For example how is a potential other "isa.h" file from another vendor
and/or board handled? By using a <VENDOR><BOARD> prefix/suffix?

Dave
Tom Rini Nov. 13, 2015, 2:02 p.m. UTC | #2
On Fri, Nov 13, 2015 at 09:19:32AM +0100, David Müller (ELSOFT AG) wrote:
> Hello
> 
> Nishanth Menon wrote:
> > Header files can be located in a generic location without needing to
> > reference them with ../common/
> > 
> > board/mpl/common/{ => include/board-common}/common_util.h (100%) 
> > rename board/mpl/common/{ => include/board-common}/isa.h (100%)
> 
> Correct me if I'm missing something here but I don't see the actual gain
> of doing this. "board/mpl/common" contains MPL specific things which
> should be kept as locally to the MPL boards directory as possible.

The gain here is to make it easy and consistent in how we access and
store things which are common to a vendor, but say spread over SoCs (and
even architectures).  We have a few ad-hoc methods today and Nishanth is
consolidating things after another thread we just had.

> For example how is a potential other "isa.h" file from another vendor
> and/or board handled? By using a <VENDOR><BOARD> prefix/suffix?

If we run into two vendors having the same header file, and it being
needed in common code (rather than vendor-common code) then we've put
information in the wrong place.
diff mbox

Patch

diff --git a/board/mpl/common/common_util.c b/board/mpl/common/common_util.c
index 6b96bd526e80..5626ecdf8b48 100644
--- a/board/mpl/common/common_util.c
+++ b/board/mpl/common/common_util.c
@@ -8,7 +8,7 @@ 
 #include <common.h>
 #include <command.h>
 #include <video_fb.h>
-#include "common_util.h"
+#include <board-common/common_util.h>
 #include <asm/processor.h>
 #include <asm/byteorder.h>
 #include <i2c.h>
diff --git a/board/mpl/common/common_util.h b/board/mpl/common/include/board-common/common_util.h
similarity index 100%
rename from board/mpl/common/common_util.h
rename to board/mpl/common/include/board-common/common_util.h
diff --git a/board/mpl/common/isa.h b/board/mpl/common/include/board-common/isa.h
similarity index 100%
rename from board/mpl/common/isa.h
rename to board/mpl/common/include/board-common/isa.h
diff --git a/board/mpl/common/isa.c b/board/mpl/common/isa.c
index 54ec66bd45b0..83628bba5d58 100644
--- a/board/mpl/common/isa.c
+++ b/board/mpl/common/isa.c
@@ -10,7 +10,7 @@ 
 #include <common.h>
 #include <asm/processor.h>
 #include <stdio_dev.h>
-#include "isa.h"
+#include <board-common/isa.h>
 #include "piix4_pci.h"
 #include "kbd.h"
 #include "video.h"
diff --git a/board/mpl/common/kbd.c b/board/mpl/common/kbd.c
index 1da72c53989c..cdcee1907dca 100644
--- a/board/mpl/common/kbd.c
+++ b/board/mpl/common/kbd.c
@@ -10,7 +10,7 @@ 
 #include <common.h>
 #include <asm/processor.h>
 #include <stdio_dev.h>
-#include "isa.h"
+#include <board-common/isa.h>
 #include "kbd.h"
 
 
diff --git a/board/mpl/common/pci.c b/board/mpl/common/pci.c
index cd969cb5182d..ff1822d1cc6f 100644
--- a/board/mpl/common/pci.c
+++ b/board/mpl/common/pci.c
@@ -10,7 +10,7 @@ 
 
 #include <common.h>
 #include <pci.h>
-#include "isa.h"
+#include <board-common/isa.h>
 
 #ifdef CONFIG_405GP
 #ifdef CONFIG_PCI
diff --git a/board/mpl/mip405/cmd_mip405.c b/board/mpl/mip405/cmd_mip405.c
index ca6f0affe48f..d71e6dbd3fbc 100644
--- a/board/mpl/mip405/cmd_mip405.c
+++ b/board/mpl/mip405/cmd_mip405.c
@@ -10,7 +10,7 @@ 
 #include <common.h>
 #include <command.h>
 #include "mip405.h"
-#include "../common/common_util.h"
+#include <board-common/common_util.h>
 
 
 extern void print_mip405_info(void);
diff --git a/board/mpl/mip405/mip405.c b/board/mpl/mip405/mip405.c
index 4a0d6966a6fa..e762f57ea1a1 100644
--- a/board/mpl/mip405/mip405.c
+++ b/board/mpl/mip405/mip405.c
@@ -51,7 +51,7 @@ 
 #include <asm/ppc4xx.h>
 #include <asm/ppc4xx-i2c.h>
 #include <miiphy.h>
-#include "../common/common_util.h"
+#include <board-common/common_util.h>
 #include <stdio_dev.h>
 #include <i2c.h>
 #include <rtc.h>
diff --git a/board/mpl/pip405/cmd_pip405.c b/board/mpl/pip405/cmd_pip405.c
index 43b182e57ebb..5a6e49ef07dd 100644
--- a/board/mpl/pip405/cmd_pip405.c
+++ b/board/mpl/pip405/cmd_pip405.c
@@ -10,7 +10,7 @@ 
 #include <common.h>
 #include <command.h>
 #include "pip405.h"
-#include "../common/common_util.h"
+#include <board-common/common_util.h>
 
 
 extern void print_pip405_info(void);
diff --git a/board/mpl/pip405/pip405.c b/board/mpl/pip405/pip405.c
index 7c7690ff555b..e46e8be9d9dd 100644
--- a/board/mpl/pip405/pip405.c
+++ b/board/mpl/pip405/pip405.c
@@ -12,8 +12,8 @@ 
 #include <asm/processor.h>
 #include <i2c.h>
 #include <stdio_dev.h>
-#include "../common/isa.h"
-#include "../common/common_util.h"
+#include <board-common/isa.h>
+#include <board-common/common_util.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/mpl/vcma9/cmd_vcma9.c b/board/mpl/vcma9/cmd_vcma9.c
index c2d62e4aaf4b..c70ae90e0b06 100644
--- a/board/mpl/vcma9/cmd_vcma9.c
+++ b/board/mpl/vcma9/cmd_vcma9.c
@@ -12,7 +12,7 @@ 
 #include <command.h>
 #include <net.h>
 #include "vcma9.h"
-#include "../common/common_util.h"
+#include <board-common/common_util.h>
 
 #if defined(CONFIG_CS8900)
 #include <../drivers/net/cs8900.h>
diff --git a/board/mpl/vcma9/vcma9.c b/board/mpl/vcma9/vcma9.c
index 43a3d47d2b03..2ddba0539837 100644
--- a/board/mpl/vcma9/vcma9.c
+++ b/board/mpl/vcma9/vcma9.c
@@ -16,7 +16,7 @@ 
 #include <asm/arch/s3c24x0_cpu.h>
 
 #include "vcma9.h"
-#include "../common/common_util.h"
+#include <board-common/common_util.h>
 
 DECLARE_GLOBAL_DATA_PTR;