[Replicant] [libsamsung-ipc][PATCH 53/53] modems: xmm626: switch remaining files to Linux code style

Denis 'GNUtoo' Carikli GNUtoo at cyberdimension.org
Thu Jun 11 10:57:55 UTC 2020


This contains no functional changes.

"unsigned" was changed to "unsigned int" because
checkpatch.pl was printing the following warning:
    WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

According to the C18 standard[1], "unsigned" is the same as
"unsigned int": in the "6.7 Declarations" section we have:
    "- unsigned, or unsigned int" [...]
    Each of the comma-separated multisets designates the same type [...]

References:
-----------
[1]The standard doesn't seem to be available for free, but the draft
   can be downloaded from the following URL:
   https://web.archive.org/web/20181230041359if_/http://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at cyberdimension.org>
---
 samsung-ipc/modems/xmm626/xmm626.c           |  20 ++--
 samsung-ipc/modems/xmm626/xmm626.h           |  56 +++++-----
 samsung-ipc/modems/xmm626/xmm626_modem_if.h  |   6 +-
 samsung-ipc/modems/xmm626/xmm626_modem_prj.h | 103 ++++++++++---------
 4 files changed, 91 insertions(+), 94 deletions(-)

diff --git a/samsung-ipc/modems/xmm626/xmm626.c b/samsung-ipc/modems/xmm626/xmm626.c
index 0c6846d..dd25d4a 100644
--- a/samsung-ipc/modems/xmm626/xmm626.c
+++ b/samsung-ipc/modems/xmm626/xmm626.c
@@ -25,19 +25,17 @@
 
 unsigned char xmm626_crc_calculate(const void *data, size_t size)
 {
-    unsigned char crc;
-    unsigned char *p;
+	unsigned char crc;
+	unsigned char *p;
 
-    if (data == NULL || size == 0)
-        return 0;
+	if (data == NULL || size == 0)
+		return 0;
 
-    p = (unsigned char *) data;
+	p = (unsigned char *) data;
 
-    crc = 0;
-    while (size--)
-        crc ^= *p++;
+	crc = 0;
+	while (size--)
+		crc ^= *p++;
 
-    return crc;
+	return crc;
 }
-
-// vim:ts=4:sw=4:expandtab
diff --git a/samsung-ipc/modems/xmm626/xmm626.h b/samsung-ipc/modems/xmm626/xmm626.h
index 866b36c..d174bc7 100644
--- a/samsung-ipc/modems/xmm626/xmm626.h
+++ b/samsung-ipc/modems/xmm626/xmm626.h
@@ -20,35 +20,33 @@
 #ifndef __XMM626_H__
 #define __XMM626_H__
 
-#define XMM626_AT                               "ATAT"
-#define XMM626_PSI_PADDING                                      0xFF
-#define XMM626_PSI_MAGIC                                        0x30
-#define XMM626_SEC_END_MAGIC                                    0x0000
-#define XMM626_HW_RESET_MAGIC                                   0x111001
-#define XMM626_DATA_SIZE                                        0x1000
-#define XMM626_DATA_SIZE_LIMIT                                  0x80000
-
-#define XMM626_COMMAND_SET_PORT_CONFIG                          0x86
-#define XMM626_COMMAND_SEC_START                                0x204
-#define XMM626_COMMAND_SEC_END                                  0x205
-#define XMM626_COMMAND_HW_RESET                                 0x208
-#define XMM626_COMMAND_FLASH_SET_ADDRESS                        0x802
-#define XMM626_COMMAND_FLASH_WRITE_BLOCK                        0x804
-
-#define XMM626_FIRMWARE_ADDRESS                                 0x60300000
-#define XMM626_NV_DATA_ADDRESS                                  0x60E80000
-#define XMM626_MPS_DATA_ADDRESS                                 0x61080000
-
-#define XMM626_NV_DATA_PATH                     "/efs/nv_data.bin"
-#define XMM626_NV_DATA_MD5_PATH                 "/efs/nv_data.bin.md5"
-#define XMM626_NV_DATA_BACKUP_PATH              "/efs/.nv_data.bak"
-#define XMM626_NV_DATA_BACKUP_MD5_PATH          "/efs/.nv_data.bak.md5"
-#define XMM626_NV_DATA_SECRET                   "Samsung_Android_RIL"
-#define XMM626_NV_DATA_SIZE                                     0x200000
-#define XMM626_NV_DATA_CHUNK_SIZE                               0x1000
+#define XMM626_AT					"ATAT"
+#define XMM626_PSI_PADDING				0xFF
+#define XMM626_PSI_MAGIC				0x30
+#define XMM626_SEC_END_MAGIC				0x0000
+#define XMM626_HW_RESET_MAGIC				0x111001
+#define XMM626_DATA_SIZE				0x1000
+#define XMM626_DATA_SIZE_LIMIT				0x80000
+
+#define XMM626_COMMAND_SET_PORT_CONFIG			0x86
+#define XMM626_COMMAND_SEC_START			0x204
+#define XMM626_COMMAND_SEC_END				0x205
+#define XMM626_COMMAND_HW_RESET			0x208
+#define XMM626_COMMAND_FLASH_SET_ADDRESS		0x802
+#define XMM626_COMMAND_FLASH_WRITE_BLOCK		0x804
+
+#define XMM626_FIRMWARE_ADDRESS			0x60300000
+#define XMM626_NV_DATA_ADDRESS				0x60E80000
+#define XMM626_MPS_DATA_ADDRESS			0x61080000
+
+#define XMM626_NV_DATA_PATH				"/efs/nv_data.bin"
+#define XMM626_NV_DATA_MD5_PATH			"/efs/nv_data.bin.md5"
+#define XMM626_NV_DATA_BACKUP_PATH			"/efs/.nv_data.bak"
+#define XMM626_NV_DATA_BACKUP_MD5_PATH			"/efs/.nv_data.bak.md5"
+#define XMM626_NV_DATA_SECRET				"Samsung_Android_RIL"
+#define XMM626_NV_DATA_SIZE				0x200000
+#define XMM626_NV_DATA_CHUNK_SIZE			0x1000
 
 unsigned char xmm626_crc_calculate(const void *data, size_t size);
 
-#endif
-
-// vim:ts=4:sw=4:expandtab
+#endif /* __XMM626_H__ */
diff --git a/samsung-ipc/modems/xmm626/xmm626_modem_if.h b/samsung-ipc/modems/xmm626/xmm626_modem_if.h
index 150bd8a..3cbc687 100644
--- a/samsung-ipc/modems/xmm626/xmm626_modem_if.h
+++ b/samsung-ipc/modems/xmm626/xmm626_modem_if.h
@@ -36,7 +36,7 @@ enum dev_format {
 	IPC_RAMDUMP,
 	MAX_DEV_FORMAT,
 };
-#define MAX_IPC_DEV	(IPC_RFS + 1)
+#define MAX_IPC_DEV			(IPC_RFS + 1)
 
 enum modem_io {
 	IODEV_MISC,
@@ -54,7 +54,7 @@ enum modem_link {
 	LINKDEV_C2C,
 	LINKDEV_MAX,
 };
-#define LINKTYPE(modem_link) (1u << (modem_link))
+#define LINKTYPE(modem_link)		(1u << (modem_link))
 
 enum modem_network {
 	UMTS_NETWORK,
@@ -71,4 +71,4 @@ enum sipc_ver {
 	MAX_SIPC_VER,
 };
 
-#endif
+#endif /* __MODEM_IF_H__ */
diff --git a/samsung-ipc/modems/xmm626/xmm626_modem_prj.h b/samsung-ipc/modems/xmm626/xmm626_modem_prj.h
index 99f6087..97cdeb6 100644
--- a/samsung-ipc/modems/xmm626/xmm626_modem_prj.h
+++ b/samsung-ipc/modems/xmm626/xmm626_modem_prj.h
@@ -27,15 +27,16 @@
 
 #define MAX_CPINFO_SIZE		512
 
-#define MAX_LINK_DEVTYPE	3
+#define MAX_LINK_DEVTYPE		3
 
-#define MAX_FMT_DEVS	10
-#define MAX_RAW_DEVS	32
-#define MAX_RFS_DEVS	10
-#define MAX_NUM_IO_DEV	(MAX_FMT_DEVS + MAX_RAW_DEVS + MAX_RFS_DEVS)
+#define MAX_FMT_DEVS			10
+#define MAX_RAW_DEVS			32
+#define MAX_RFS_DEVS			10
+#define MAX_NUM_IO_DEV			(MAX_FMT_DEVS + MAX_RAW_DEVS + \
+					 MAX_RFS_DEVS)
 
 #define IOCTL_MODEM_ON			_IO('o', 0x19)
-#define IOCTL_MODEM_OFF			_IO('o', 0x20)
+#define IOCTL_MODEM_OFF		_IO('o', 0x20)
 #define IOCTL_MODEM_RESET		_IO('o', 0x21)
 #define IOCTL_MODEM_BOOT_ON		_IO('o', 0x22)
 #define IOCTL_MODEM_BOOT_OFF		_IO('o', 0x23)
@@ -48,56 +49,56 @@
 #define IOCTL_MODEM_DL_START		_IO('o', 0x28)
 #define IOCTL_MODEM_FW_UPDATE		_IO('o', 0x29)
 
-#define IOCTL_MODEM_NET_SUSPEND		_IO('o', 0x30)
+#define IOCTL_MODEM_NET_SUSPEND	_IO('o', 0x30)
 #define IOCTL_MODEM_NET_RESUME		_IO('o', 0x31)
 
 #define IOCTL_MODEM_DUMP_START		_IO('o', 0x32)
-#define IOCTL_MODEM_DUMP_UPDATE		_IO('o', 0x33)
+#define IOCTL_MODEM_DUMP_UPDATE	_IO('o', 0x33)
 #define IOCTL_MODEM_FORCE_CRASH_EXIT	_IO('o', 0x34)
 #define IOCTL_MODEM_CP_UPLOAD		_IO('o', 0x35)
 #define IOCTL_MODEM_DUMP_RESET		_IO('o', 0x36)
 
 #define IOCTL_DPRAM_SEND_BOOT		_IO('o', 0x40)
-#define IOCTL_DPRAM_INIT_STATUS		_IO('o', 0x43)
+#define IOCTL_DPRAM_INIT_STATUS	_IO('o', 0x43)
 
 /* ioctl command definitions. */
-#define IOCTL_DPRAM_PHONE_POWON		_IO('o', 0xd0)
+#define IOCTL_DPRAM_PHONE_POWON	_IO('o', 0xd0)
 #define IOCTL_DPRAM_PHONEIMG_LOAD	_IO('o', 0xd1)
-#define IOCTL_DPRAM_NVDATA_LOAD		_IO('o', 0xd2)
+#define IOCTL_DPRAM_NVDATA_LOAD	_IO('o', 0xd2)
 #define IOCTL_DPRAM_PHONE_BOOTSTART	_IO('o', 0xd3)
 
 #define IOCTL_DPRAM_PHONE_UPLOAD_STEP1	_IO('o', 0xde)
 #define IOCTL_DPRAM_PHONE_UPLOAD_STEP2	_IO('o', 0xdf)
 
 /* modem status */
-#define MODEM_OFF		0
-#define MODEM_CRASHED		1
-#define MODEM_RAMDUMP		2
-#define MODEM_POWER_ON		3
-#define MODEM_BOOTING_NORMAL	4
-#define MODEM_BOOTING_RAMDUMP	5
-#define MODEM_DUMPING		6
-#define MODEM_RUNNING		7
+#define MODEM_OFF			0
+#define MODEM_CRASHED			1
+#define MODEM_RAMDUMP			2
+#define MODEM_POWER_ON			3
+#define MODEM_BOOTING_NORMAL		4
+#define MODEM_BOOTING_RAMDUMP		5
+#define MODEM_DUMPING			6
+#define MODEM_RUNNING			7
 
-#define HDLC_HEADER_MAX_SIZE	6 /* fmt 3, raw 6, rfs 6 */
+#define HDLC_HEADER_MAX_SIZE		6 /* fmt 3, raw 6, rfs 6 */
 
-#define PSD_DATA_CHID_BEGIN	0x2A
-#define PSD_DATA_CHID_END	0x38
+#define PSD_DATA_CHID_BEGIN		0x2A
+#define PSD_DATA_CHID_END		0x38
 
-#define PS_DATA_CH_0	10
-#define PS_DATA_CH_LAST	24
+#define PS_DATA_CH_0			10
+#define PS_DATA_CH_LAST		24
 
-#define IP6VERSION		6
+#define IP6VERSION			6
 
 #define SOURCE_MAC_ADDR		{0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC}
 
 /* Debugging features */
-#define MAX_MIF_LOG_PATH_LEN	128
-#define MAX_MIF_LOG_FILE_SIZE	0x800000	/* 8 MB */
+#define MAX_MIF_LOG_PATH_LEN		128
+#define MAX_MIF_LOG_FILE_SIZE		0x800000	/* 8 MB */
 
-#define MAX_MIF_EVT_BUFF_SIZE	256
-#define MAX_MIF_TIME_LEN	32
-#define MAX_MIF_NAME_LEN	16
+#define MAX_MIF_EVT_BUFF_SIZE		256
+#define MAX_MIF_TIME_LEN		32
+#define MAX_MIF_NAME_LEN		16
 #define MAX_MIF_STR_LEN		127
 #define MAX_MIF_LOG_LEN		128
 
@@ -113,8 +114,8 @@ enum mif_event_id {
 };
 
 struct dpram_queue_status {
-	unsigned in;
-	unsigned out;
+	unsigned int in;
+	unsigned int out;
 };
 
 struct dpram_queue_status_pair {
@@ -123,11 +124,11 @@ struct dpram_queue_status_pair {
 };
 
 struct dpram_irq_buff {
-	unsigned magic;
-	unsigned access;
+	unsigned int magic;
+	unsigned int access;
 	struct dpram_queue_status_pair qsp[MAX_IPC_DEV];
-	unsigned int2ap;
-	unsigned int2cp;
+	unsigned int int2ap;
+	unsigned int int2cp;
 };
 
 struct mif_event_buff {
@@ -143,16 +144,16 @@ struct mif_event_buff {
 	char ld[MAX_MIF_NAME_LEN];
 	enum modem_link link_type;
 
-	unsigned rcvd;
-	unsigned len;
+	unsigned int rcvd;
+	unsigned int len;
 	union {
 		u8 data[MAX_MIF_LOG_LEN];
 		struct dpram_irq_buff dpram_irqb;
 	};
 };
 
-#define MIF_LOG_DIR	"/sdcard"
-#define MIF_LOG_LV_FILE	"/data/.mif_log_level"
+#define MIF_LOG_DIR			"/sdcard"
+#define MIF_LOG_LV_FILE		"/data/.mif_log_level"
 
 /* Does modem ctl structure will use state ? or status defined below ?*/
 enum modem_state {
@@ -184,21 +185,21 @@ enum link_mode {
 };
 
 struct sim_state {
-	bool online;	/* SIM is online? */
-	bool changed;	/* online is changed? */
+	bool online;			/* SIM is online? */
+	bool changed;			/* online is changed? */
 };
 
-#define HDLC_START		0x7F
-#define HDLC_END		0x7E
-#define SIZE_OF_HDLC_START	1
-#define SIZE_OF_HDLC_END	1
-#define MAX_LINK_PADDING_SIZE	3
+#define HDLC_START			0x7F
+#define HDLC_END			0x7E
+#define SIZE_OF_HDLC_START		1
+#define SIZE_OF_HDLC_END		1
+#define MAX_LINK_PADDING_SIZE		3
 
 struct header_data {
 	char hdr[HDLC_HEADER_MAX_SIZE];
-	unsigned len;
-	unsigned frag_len;
-	char start; /*hdlc start header 0x7F*/
+	unsigned int len;
+	unsigned int frag_len;
+	char start;			/*hdlc start header 0x7F*/
 };
 
 struct fmt_hdr {
@@ -227,4 +228,4 @@ struct sipc_fmt_hdr {
 	u8  cmd_type;
 } __attribute__((packed));
 
-#endif
+#endif /* __MODEM_PRJ_H__ */
-- 
2.27.0



More information about the Replicant mailing list