[Replicant] [libsamsung-ipc] [PATCH 4/4] samsung-ipc: make #include relative to samsung-ipc/

Denis 'GNUtoo' Carikli GNUtoo at cyberdimension.org
Wed Jul 15 17:12:40 UTC 2020


This has several advantages:
- It makes the header context more obvious: #include "xmm626.h" could
  mislead people into thinking that the xmm626.h header is in the same
  directory than the file using that directive, while it is instead in
  another location. This in turn could make people suppose that there
  is a "xmm626.h" header specific to the galaxys2 driver.
  Instead the #include "modems/xmm616/xmm616.h" directive is much more
  clear.
- We can have two headers with the same filename.

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at cyberdimension.org>
---
 Android.mk                                         | 3 ---
 samsung-ipc/Makefile.am                            | 3 ---
 samsung-ipc/devices/aries/aries.c                  | 8 ++++----
 samsung-ipc/devices/aries/aries.h                  | 2 +-
 samsung-ipc/devices/crespo/crespo.c                | 6 +++---
 samsung-ipc/devices/galaxys2/galaxys2.c            | 8 ++++----
 samsung-ipc/devices/i9300/i9300.c                  | 8 ++++----
 samsung-ipc/devices/ipc_devices.c                  | 3 +--
 samsung-ipc/devices/maguro/maguro.c                | 8 ++++----
 samsung-ipc/devices/n5100/n5100.c                  | 8 ++++----
 samsung-ipc/devices/n7100/n7100.c                  | 8 ++++----
 samsung-ipc/devices/piranha/piranha.c              | 8 ++++----
 samsung-ipc/ipc.c                                  | 2 +-
 samsung-ipc/modems/xmm616/xmm616.c                 | 2 +-
 samsung-ipc/modems/xmm626/xmm626.c                 | 2 +-
 samsung-ipc/modems/xmm626/xmm626_hsic.c            | 4 ++--
 samsung-ipc/modems/xmm626/xmm626_kernel_smdk4412.c | 8 ++++----
 samsung-ipc/modems/xmm626/xmm626_mipi.c            | 4 ++--
 samsung-ipc/modems/xmm626/xmm626_modem_prj.h       | 2 +-
 19 files changed, 45 insertions(+), 52 deletions(-)

diff --git a/Android.mk b/Android.mk
index 7fffb61..a433f58 100644
--- a/Android.mk
+++ b/Android.mk
@@ -103,9 +103,6 @@ local_export_c_include_dirs := \
 libsamsung_ipc_local_c_includes := \
 	$(LOCAL_PATH)/include \
 	$(LOCAL_PATH)/samsung-ipc \
-	$(LOCAL_PATH)/samsung-ipc/devices/ \
-	$(LOCAL_PATH)/samsung-ipc/modems/xmm616/ \
-	$(LOCAL_PATH)/samsung-ipc/modems/xmm626/ \
 	external/openssl/include
 
 libsamsung_local_cflags := \
diff --git a/samsung-ipc/Makefile.am b/samsung-ipc/Makefile.am
index 1b18760..f71e396 100644
--- a/samsung-ipc/Makefile.am
+++ b/samsung-ipc/Makefile.am
@@ -3,9 +3,6 @@ NULL =
 AM_CFLAGS = \
 	-I$(top_srcdir)/include \
 	-I$(top_srcdir)/samsung-ipc \
-	-I$(top_srcdir)/samsung-ipc/devices \
-	-I$(top_srcdir)/samsung-ipc/modems/xmm616 \
-	-I$(top_srcdir)/samsung-ipc/modems/xmm626 \
 	$(OPENSSL_CFLAGS) \
 	$(NULL)
 
diff --git a/samsung-ipc/devices/aries/aries.c b/samsung-ipc/devices/aries/aries.c
index 409d2f8..93d5d31 100644
--- a/samsung-ipc/devices/aries/aries.c
+++ b/samsung-ipc/devices/aries/aries.c
@@ -34,11 +34,11 @@
 
 #include <samsung-ipc.h>
 
-#include "aries.h"
 #include "ipc.h"
-#include "onedram.h"
-#include "phonet.h"
-#include "xmm616.h"
+#include "devices/aries/aries.h"
+#include "devices/aries/onedram.h"
+#include "devices/aries/phonet.h"
+#include "modems/xmm616/xmm616.h"
 
 int aries_boot(struct ipc_client *client)
 {
diff --git a/samsung-ipc/devices/aries/aries.h b/samsung-ipc/devices/aries/aries.h
index fbab065..e2f7417 100644
--- a/samsung-ipc/devices/aries/aries.h
+++ b/samsung-ipc/devices/aries/aries.h
@@ -18,7 +18,7 @@
  * along with libsamsung-ipc.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "phonet.h"
+#include "devices/aries/phonet.h"
 
 #ifndef __ARIES_H__
 #define __ARIES_H__
diff --git a/samsung-ipc/devices/crespo/crespo.c b/samsung-ipc/devices/crespo/crespo.c
index 80b8f4a..ebb6075 100644
--- a/samsung-ipc/devices/crespo/crespo.c
+++ b/samsung-ipc/devices/crespo/crespo.c
@@ -31,10 +31,10 @@
 
 #include <samsung-ipc.h>
 
-#include "crespo.h"
-#include "crespo_modem_ctl.h"
 #include "ipc.h"
-#include "xmm616.h"
+#include "devices/crespo/crespo.h"
+#include "devices/crespo/crespo_modem_ctl.h"
+#include "modems/xmm616/xmm616.h"
 
 int crespo_boot(struct ipc_client *client)
 {
diff --git a/samsung-ipc/devices/galaxys2/galaxys2.c b/samsung-ipc/devices/galaxys2/galaxys2.c
index d137950..cdfe20c 100644
--- a/samsung-ipc/devices/galaxys2/galaxys2.c
+++ b/samsung-ipc/devices/galaxys2/galaxys2.c
@@ -25,11 +25,11 @@
 
 #include <samsung-ipc.h>
 
-#include "galaxys2.h"
 #include "ipc.h"
-#include "xmm626.h"
-#include "xmm626_hsic.h"
-#include "xmm626_kernel_smdk4412.h"
+#include "devices/galaxys2/galaxys2.h"
+#include "modems/xmm626/xmm626.h"
+#include "modems/xmm626/xmm626_hsic.h"
+#include "modems/xmm626/xmm626_kernel_smdk4412.h"
 
 int galaxys2_boot(struct ipc_client *client)
 {
diff --git a/samsung-ipc/devices/i9300/i9300.c b/samsung-ipc/devices/i9300/i9300.c
index f7da6f8..85709a8 100644
--- a/samsung-ipc/devices/i9300/i9300.c
+++ b/samsung-ipc/devices/i9300/i9300.c
@@ -25,11 +25,11 @@
 
 #include <samsung-ipc.h>
 
-#include "i9300.h"
 #include "ipc.h"
-#include "xmm626.h"
-#include "xmm626_hsic.h"
-#include "xmm626_kernel_smdk4412.h"
+#include "devices/i9300/i9300.h"
+#include "modems/xmm626/xmm626.h"
+#include "modems/xmm626/xmm626_hsic.h"
+#include "modems/xmm626/xmm626_kernel_smdk4412.h"
 
 int i9300_boot(struct ipc_client *client)
 {
diff --git a/samsung-ipc/devices/ipc_devices.c b/samsung-ipc/devices/ipc_devices.c
index 73f2914..fc767e0 100644
--- a/samsung-ipc/devices/ipc_devices.c
+++ b/samsung-ipc/devices/ipc_devices.c
@@ -20,8 +20,7 @@
 #include <stdlib.h>
 
 #include <samsung-ipc.h>
-
-#include "ipc_devices.h"
+#include "devices/ipc_devices.h"
 
 struct ipc_device_desc ipc_devices[] = {
 	{
diff --git a/samsung-ipc/devices/maguro/maguro.c b/samsung-ipc/devices/maguro/maguro.c
index a4416ba..a2db5fc 100644
--- a/samsung-ipc/devices/maguro/maguro.c
+++ b/samsung-ipc/devices/maguro/maguro.c
@@ -27,10 +27,10 @@
 #include <samsung-ipc.h>
 
 #include "ipc.h"
-#include "maguro.h"
-#include "xmm626.h"
-#include "xmm626_mipi.h"
-#include "xmm626_kernel_smdk4412.h"
+#include "devices/maguro/maguro.h"
+#include "modems/xmm626/xmm626.h"
+#include "modems/xmm626/xmm626_kernel_smdk4412.h"
+#include "modems/xmm626/xmm626_mipi.h"
 
 int maguro_boot(struct ipc_client *client)
 {
diff --git a/samsung-ipc/devices/n5100/n5100.c b/samsung-ipc/devices/n5100/n5100.c
index 8cc8fb5..0abe896 100644
--- a/samsung-ipc/devices/n5100/n5100.c
+++ b/samsung-ipc/devices/n5100/n5100.c
@@ -27,10 +27,10 @@
 #include <samsung-ipc.h>
 
 #include "ipc.h"
-#include "n5100.h"
-#include "xmm626.h"
-#include "xmm626_hsic.h"
-#include "xmm626_kernel_smdk4412.h"
+#include "devices/n5100/n5100.h"
+#include "modems/xmm626/xmm626.h"
+#include "modems/xmm626/xmm626_hsic.h"
+#include "modems/xmm626/xmm626_kernel_smdk4412.h"
 
 int n5100_boot(struct ipc_client *client)
 {
diff --git a/samsung-ipc/devices/n7100/n7100.c b/samsung-ipc/devices/n7100/n7100.c
index d6ce946..d5091a2 100644
--- a/samsung-ipc/devices/n7100/n7100.c
+++ b/samsung-ipc/devices/n7100/n7100.c
@@ -26,10 +26,10 @@
 #include <samsung-ipc.h>
 
 #include "ipc.h"
-#include "n7100.h"
-#include "xmm626.h"
-#include "xmm626_hsic.h"
-#include "xmm626_kernel_smdk4412.h"
+#include "devices/n7100/n7100.h"
+#include "modems/xmm626/xmm626.h"
+#include "modems/xmm626/xmm626_hsic.h"
+#include "modems/xmm626/xmm626_kernel_smdk4412.h"
 
 int n7100_boot(struct ipc_client *client)
 {
diff --git a/samsung-ipc/devices/piranha/piranha.c b/samsung-ipc/devices/piranha/piranha.c
index fe93f0f..839b3ce 100644
--- a/samsung-ipc/devices/piranha/piranha.c
+++ b/samsung-ipc/devices/piranha/piranha.c
@@ -26,10 +26,10 @@
 #include <samsung-ipc.h>
 
 #include "ipc.h"
-#include "piranha.h"
-#include "xmm626.h"
-#include "xmm626_mipi.h"
-#include "xmm626_kernel_smdk4412.h"
+#include "devices/piranha/piranha.h"
+#include "modems/xmm626/xmm626.h"
+#include "modems/xmm626/xmm626_kernel_smdk4412.h"
+#include "modems/xmm626/xmm626_mipi.h"
 
 int piranha_boot(struct ipc_client *client)
 {
diff --git a/samsung-ipc/ipc.c b/samsung-ipc/ipc.c
index a815f58..c116fbb 100644
--- a/samsung-ipc/ipc.c
+++ b/samsung-ipc/ipc.c
@@ -39,7 +39,7 @@
 #include <samsung-ipc.h>
 
 #include "ipc.h"
-#include "ipc_devices.h"
+#include "devices/ipc_devices.h"
 
 int ipc_device_detect(void)
 {
diff --git a/samsung-ipc/modems/xmm616/xmm616.c b/samsung-ipc/modems/xmm616/xmm616.c
index e7fc487..1605f18 100644
--- a/samsung-ipc/modems/xmm616/xmm616.c
+++ b/samsung-ipc/modems/xmm616/xmm616.c
@@ -27,7 +27,7 @@
 
 #include <samsung-ipc.h>
 
-#include "xmm616.h"
+#include "modems/xmm616/xmm616.h"
 
 int xmm616_psi_send(struct ipc_client *client, int serial_fd,
 		    const void *psi_data, unsigned short psi_size)
diff --git a/samsung-ipc/modems/xmm626/xmm626.c b/samsung-ipc/modems/xmm626/xmm626.c
index dd25d4a..7d1c4b9 100644
--- a/samsung-ipc/modems/xmm626/xmm626.c
+++ b/samsung-ipc/modems/xmm626/xmm626.c
@@ -21,7 +21,7 @@
 #include <stdlib.h>
 #include <sys/ioctl.h>
 
-#include "xmm626.h"
+#include "modems/xmm626/xmm626.h"
 
 unsigned char xmm626_crc_calculate(const void *data, size_t size)
 {
diff --git a/samsung-ipc/modems/xmm626/xmm626_hsic.c b/samsung-ipc/modems/xmm626/xmm626_hsic.c
index 9b78885..6e7126c 100644
--- a/samsung-ipc/modems/xmm626/xmm626_hsic.c
+++ b/samsung-ipc/modems/xmm626/xmm626_hsic.c
@@ -29,8 +29,8 @@
 
 #include <samsung-ipc.h>
 
-#include "xmm626.h"
-#include "xmm626_hsic.h"
+#include "modems/xmm626/xmm626.h"
+#include "modems/xmm626/xmm626_hsic.h"
 
 int xmm626_hsic_ack_read(int device_fd, unsigned short ack)
 {
diff --git a/samsung-ipc/modems/xmm626/xmm626_kernel_smdk4412.c b/samsung-ipc/modems/xmm626/xmm626_kernel_smdk4412.c
index 3820706..c6b1578 100644
--- a/samsung-ipc/modems/xmm626/xmm626_kernel_smdk4412.c
+++ b/samsung-ipc/modems/xmm626/xmm626_kernel_smdk4412.c
@@ -30,10 +30,10 @@
 #include <samsung-ipc.h>
 
 #include "ipc.h"
-#include "xmm626.h"
-#include "xmm626_kernel_smdk4412.h"
-#include "xmm626_modem_link_device_hsic.h"
-#include "xmm626_modem_prj.h"
+#include "modems/xmm626/xmm626.h"
+#include "modems/xmm626/xmm626_kernel_smdk4412.h"
+#include "modems/xmm626/xmm626_modem_link_device_hsic.h"
+#include "modems/xmm626/xmm626_modem_prj.h"
 
 int xmm626_kernel_smdk4412_power(
 	__attribute__((unused)) struct ipc_client *client, int device_fd,
diff --git a/samsung-ipc/modems/xmm626/xmm626_mipi.c b/samsung-ipc/modems/xmm626/xmm626_mipi.c
index d98cd9b..375ded0 100644
--- a/samsung-ipc/modems/xmm626/xmm626_mipi.c
+++ b/samsung-ipc/modems/xmm626/xmm626_mipi.c
@@ -29,8 +29,8 @@
 
 #include <samsung-ipc.h>
 
-#include "xmm626.h"
-#include "xmm626_mipi.h"
+#include "modems/xmm626/xmm626.h"
+#include "modems/xmm626/xmm626_mipi.h"
 
 int xmm626_mipi_crc_calculate(const void *data, size_t size)
 {
diff --git a/samsung-ipc/modems/xmm626/xmm626_modem_prj.h b/samsung-ipc/modems/xmm626/xmm626_modem_prj.h
index d50954a..9014c5b 100644
--- a/samsung-ipc/modems/xmm626/xmm626_modem_prj.h
+++ b/samsung-ipc/modems/xmm626/xmm626_modem_prj.h
@@ -17,7 +17,7 @@
 #include <stdint.h>
 #include <linux/types.h>
 
-#include "xmm626_modem_if.h"
+#include "modems/xmm626/xmm626_modem_if.h"
 
 #define u8 uint8_t
 #define u16 uint16_t
-- 
2.27.0



More information about the Replicant mailing list