[Replicant] [libsamsung-ipc] [PATCH 03/11] modems: xmm626: unify xmm626_{hsic/mipi}_nv_data_send

Denis 'GNUtoo' Carikli GNUtoo at cyberdimension.org
Sun Oct 11 22:22:14 UTC 2020


These two functions are now identical so it makes no sense to keep them
both.

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at cyberdimension.org>
---
 samsung-ipc/devices/galaxys2/galaxys2.c       |  2 +-
 samsung-ipc/devices/i9300/i9300.c             |  2 +-
 samsung-ipc/devices/maguro/maguro.c           |  2 +-
 samsung-ipc/devices/n5100/n5100.c             |  2 +-
 samsung-ipc/devices/n7100/n7100.c             |  2 +-
 samsung-ipc/devices/piranha/piranha.c         |  2 +-
 samsung-ipc/modems/xmm626/xmm626_hsic.c       | 38 ------------------
 samsung-ipc/modems/xmm626/xmm626_hsic.h       |  1 -
 .../modems/xmm626/xmm626_kernel_smdk4412.c    | 40 +++++++++++++++++++
 .../modems/xmm626/xmm626_kernel_smdk4412.h    |  3 ++
 samsung-ipc/modems/xmm626/xmm626_mipi.c       | 38 ------------------
 samsung-ipc/modems/xmm626/xmm626_mipi.h       |  1 -
 12 files changed, 49 insertions(+), 84 deletions(-)

diff --git a/samsung-ipc/devices/galaxys2/galaxys2.c b/samsung-ipc/devices/galaxys2/galaxys2.c
index cdfe20c..c13c572 100644
--- a/samsung-ipc/devices/galaxys2/galaxys2.c
+++ b/samsung-ipc/devices/galaxys2/galaxys2.c
@@ -158,7 +158,7 @@ int galaxys2_boot(struct ipc_client *client)
 	}
 	ipc_client_log(client, "Sent XMM626 HSIC firmware");
 
-	rc = xmm626_hsic_nv_data_send(client, modem_boot_fd);
+	rc = xmm626_kernel_smdk4412_nv_data_send(client, modem_boot_fd);
 	if (rc < 0) {
 		ipc_client_log(client, "Sending XMM626 HSIC nv_data failed");
 		goto error;
diff --git a/samsung-ipc/devices/i9300/i9300.c b/samsung-ipc/devices/i9300/i9300.c
index 85709a8..42b0be1 100644
--- a/samsung-ipc/devices/i9300/i9300.c
+++ b/samsung-ipc/devices/i9300/i9300.c
@@ -148,7 +148,7 @@ int i9300_boot(struct ipc_client *client)
 	}
 	ipc_client_log(client, "Sent XMM626 HSIC firmware");
 
-	rc = xmm626_hsic_nv_data_send(client, modem_boot_fd);
+	rc = xmm626_kernel_smdk4412_nv_data_send(client, modem_boot_fd);
 	if (rc < 0) {
 		ipc_client_log(client, "Sending XMM626 HSIC nv_data failed");
 		goto error;
diff --git a/samsung-ipc/devices/maguro/maguro.c b/samsung-ipc/devices/maguro/maguro.c
index a2db5fc..7d1ea1e 100644
--- a/samsung-ipc/devices/maguro/maguro.c
+++ b/samsung-ipc/devices/maguro/maguro.c
@@ -143,7 +143,7 @@ int maguro_boot(struct ipc_client *client)
 	}
 	ipc_client_log(client, "Sent XMM626 MIPI firmware");
 
-	rc = xmm626_mipi_nv_data_send(client, modem_boot_fd);
+	rc = xmm626_kernel_smdk4412_nv_data_send(client, modem_boot_fd);
 	if (rc < 0) {
 		ipc_client_log(client, "Sending XMM626 MIPI nv_data failed");
 		goto error;
diff --git a/samsung-ipc/devices/n5100/n5100.c b/samsung-ipc/devices/n5100/n5100.c
index 0abe896..303d175 100644
--- a/samsung-ipc/devices/n5100/n5100.c
+++ b/samsung-ipc/devices/n5100/n5100.c
@@ -149,7 +149,7 @@ int n5100_boot(struct ipc_client *client)
 	}
 	ipc_client_log(client, "Sent XMM626 HSIC firmware");
 
-	rc = xmm626_hsic_nv_data_send(client, modem_boot_fd);
+	rc = xmm626_kernel_smdk4412_nv_data_send(client, modem_boot_fd);
 	if (rc < 0) {
 		ipc_client_log(client, "Sending XMM626 HSIC nv_data failed");
 		goto error;
diff --git a/samsung-ipc/devices/n7100/n7100.c b/samsung-ipc/devices/n7100/n7100.c
index d5091a2..ea3459a 100644
--- a/samsung-ipc/devices/n7100/n7100.c
+++ b/samsung-ipc/devices/n7100/n7100.c
@@ -148,7 +148,7 @@ int n7100_boot(struct ipc_client *client)
 	}
 	ipc_client_log(client, "Sent XMM626 HSIC firmware");
 
-	rc = xmm626_hsic_nv_data_send(client, modem_boot_fd);
+	rc = xmm626_kernel_smdk4412_nv_data_send(client, modem_boot_fd);
 	if (rc < 0) {
 		ipc_client_log(client, "Sending XMM626 HSIC nv_data failed");
 		goto error;
diff --git a/samsung-ipc/devices/piranha/piranha.c b/samsung-ipc/devices/piranha/piranha.c
index 839b3ce..6b954df 100644
--- a/samsung-ipc/devices/piranha/piranha.c
+++ b/samsung-ipc/devices/piranha/piranha.c
@@ -141,7 +141,7 @@ int piranha_boot(struct ipc_client *client)
 	}
 	ipc_client_log(client, "Sent XMM626 MIPI firmware");
 
-	rc = xmm626_mipi_nv_data_send(client, modem_boot_fd);
+	rc = xmm626_kernel_smdk4412_nv_data_send(client, modem_boot_fd);
 	if (rc < 0) {
 		ipc_client_log(client, "Sending XMM626 MIPI nv_data failed");
 		goto error;
diff --git a/samsung-ipc/modems/xmm626/xmm626_hsic.c b/samsung-ipc/modems/xmm626/xmm626_hsic.c
index a59d41a..5568584 100644
--- a/samsung-ipc/modems/xmm626/xmm626_hsic.c
+++ b/samsung-ipc/modems/xmm626/xmm626_hsic.c
@@ -559,44 +559,6 @@ int xmm626_hsic_firmware_send(struct ipc_client *client, int device_fd,
 	return 0;
 }
 
-int xmm626_hsic_nv_data_send(struct ipc_client *client, int device_fd)
-{
-	void *nv_data = NULL;
-	size_t nv_size;
-	int rc;
-
-	if (client == NULL || device_fd < 0)
-		return -1;
-
-	nv_size = ipc_client_nv_data_size(client);
-	if (nv_size == 0)
-		return -1;
-
-	nv_data = ipc_nv_data_load(client);
-	if (nv_data == NULL) {
-		ipc_client_log(client, "Loading nv_data failed");
-		goto error;
-	}
-	ipc_client_log(client, "Loaded nv_data");
-
-	rc = modem_data_send(client, device_fd, nv_data, nv_size,
-				    XMM626_NV_DATA_ADDRESS);
-	if (rc < 0)
-		goto error;
-
-	rc = 0;
-	goto complete;
-
-error:
-	rc = -1;
-
-complete:
-	if (nv_data != NULL)
-		free(nv_data);
-
-	return rc;
-}
-
 int xmm626_hsic_hw_reset_send(struct ipc_client *client, int device_fd)
 {
 	unsigned int hw_reset_data;
diff --git a/samsung-ipc/modems/xmm626/xmm626_hsic.h b/samsung-ipc/modems/xmm626/xmm626_hsic.h
index a55587c..6d58267 100644
--- a/samsung-ipc/modems/xmm626/xmm626_hsic.h
+++ b/samsung-ipc/modems/xmm626/xmm626_hsic.h
@@ -61,7 +61,6 @@ int xmm626_hsic_sec_start_send(struct ipc_client *client, int device_fd,
 int xmm626_hsic_sec_end_send(struct ipc_client *client, int device_fd);
 int xmm626_hsic_firmware_send(struct ipc_client *client, int device_fd,
 			      const void *firmware_data, size_t firmware_size);
-int xmm626_hsic_nv_data_send(struct ipc_client *client, int device_fd);
 int xmm626_hsic_hw_reset_send(struct ipc_client *client, int device_fd);
 
 extern struct ipc_client_modem_driver_ops xmm626_hsic_modem_driver_ops;
diff --git a/samsung-ipc/modems/xmm626/xmm626_kernel_smdk4412.c b/samsung-ipc/modems/xmm626/xmm626_kernel_smdk4412.c
index c6b1578..ee2e088 100644
--- a/samsung-ipc/modems/xmm626/xmm626_kernel_smdk4412.c
+++ b/samsung-ipc/modems/xmm626/xmm626_kernel_smdk4412.c
@@ -30,6 +30,7 @@
 #include <samsung-ipc.h>
 
 #include "ipc.h"
+#include "modems/modem.h"
 #include "modems/xmm626/xmm626.h"
 #include "modems/xmm626/xmm626_kernel_smdk4412.h"
 #include "modems/xmm626/xmm626_modem_link_device_hsic.h"
@@ -602,3 +603,42 @@ int xmm626_kernel_smdk4412_gprs_get_capabilities(
 
 	return 0;
 }
+
+int xmm626_kernel_smdk4412_nv_data_send(struct ipc_client *client,
+					int device_fd)
+{
+	void *nv_data = NULL;
+	size_t nv_size;
+	int rc;
+
+	if (client == NULL || device_fd < 0)
+		return -1;
+
+	nv_size = ipc_client_nv_data_size(client);
+	if (nv_size == 0)
+		return -1;
+
+	nv_data = ipc_nv_data_load(client);
+	if (nv_data == NULL) {
+		ipc_client_log(client, "Loading nv_data failed");
+		goto error;
+	}
+	ipc_client_log(client, "Loaded nv_data");
+
+	rc = modem_data_send(client, device_fd, nv_data, nv_size,
+			     XMM626_NV_DATA_ADDRESS);
+	if (rc < 0)
+		goto error;
+
+	rc = 0;
+	goto complete;
+
+error:
+	rc = -1;
+
+complete:
+	if (nv_data != NULL)
+		free(nv_data);
+
+	return rc;
+}
diff --git a/samsung-ipc/modems/xmm626/xmm626_kernel_smdk4412.h b/samsung-ipc/modems/xmm626/xmm626_kernel_smdk4412.h
index cea8d8e..a36d120 100644
--- a/samsung-ipc/modems/xmm626/xmm626_kernel_smdk4412.h
+++ b/samsung-ipc/modems/xmm626/xmm626_kernel_smdk4412.h
@@ -74,4 +74,7 @@ int xmm626_kernel_smdk4412_gprs_get_capabilities(
 	struct ipc_client *client,
 	struct ipc_client_gprs_capabilities *capabilities);
 
+int xmm626_kernel_smdk4412_nv_data_send(struct ipc_client *client,
+					int device_fd);
+
 #endif /* __XMM626_SEC_MODEM_H__ */
diff --git a/samsung-ipc/modems/xmm626/xmm626_mipi.c b/samsung-ipc/modems/xmm626/xmm626_mipi.c
index e143ac7..5b2cfdc 100644
--- a/samsung-ipc/modems/xmm626/xmm626_mipi.c
+++ b/samsung-ipc/modems/xmm626/xmm626_mipi.c
@@ -603,44 +603,6 @@ int xmm626_mipi_firmware_send(struct ipc_client *client, int device_fd,
 	return 0;
 }
 
-int xmm626_mipi_nv_data_send(struct ipc_client *client, int device_fd)
-{
-	void *nv_data = NULL;
-	size_t nv_size;
-	int rc;
-
-	if (client == NULL || device_fd < 0)
-		return -1;
-
-	nv_size = ipc_client_nv_data_size(client);
-	if (nv_size == 0)
-		return -1;
-
-	nv_data = ipc_nv_data_load(client);
-	if (nv_data == NULL) {
-		ipc_client_log(client, "Loading nv_data failed");
-		goto error;
-	}
-	ipc_client_log(client, "Loaded nv_data");
-
-	rc = modem_data_send(client, device_fd, nv_data, nv_size,
-			     XMM626_NV_DATA_ADDRESS);
-	if (rc < 0)
-		goto error;
-
-	rc = 0;
-	goto complete;
-
-error:
-	rc = -1;
-
-complete:
-	if (nv_data != NULL)
-		free(nv_data);
-
-	return rc;
-}
-
 int xmm626_mipi_mps_data_send(struct ipc_client *client, int device_fd,
 			      const void *mps_data, size_t mps_size)
 {
diff --git a/samsung-ipc/modems/xmm626/xmm626_mipi.h b/samsung-ipc/modems/xmm626/xmm626_mipi.h
index 9b54add..5fb71f1 100644
--- a/samsung-ipc/modems/xmm626/xmm626_mipi.h
+++ b/samsung-ipc/modems/xmm626/xmm626_mipi.h
@@ -63,7 +63,6 @@ int xmm626_mipi_sec_start_send(struct ipc_client *client, int device_fd,
 int xmm626_mipi_sec_end_send(struct ipc_client *client, int device_fd);
 int xmm626_mipi_firmware_send(struct ipc_client *client, int device_fd,
 			      const void *firmware_data, size_t firmware_size);
-int xmm626_mipi_nv_data_send(struct ipc_client *client, int device_fd);
 int xmm626_mipi_mps_data_send(struct ipc_client *client, int device_fd,
 			      const void *mps_data, size_t mps_size);
 int xmm626_mipi_hw_reset_send(struct ipc_client *client, int device_fd);
-- 
2.28.0



More information about the Replicant mailing list