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

Denis 'GNUtoo' Carikli GNUtoo at cyberdimension.org
Sun Oct 11 22:22:15 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       |  5 +++--
 samsung-ipc/devices/i9300/i9300.c             |  5 +++--
 samsung-ipc/devices/maguro/maguro.c           |  5 +++--
 samsung-ipc/devices/n5100/n5100.c             |  5 +++--
 samsung-ipc/devices/n7100/n7100.c             |  5 +++--
 samsung-ipc/devices/piranha/piranha.c         |  5 +++--
 samsung-ipc/modems/xmm626/xmm626_hsic.c       | 18 -----------------
 samsung-ipc/modems/xmm626/xmm626_hsic.h       |  2 --
 .../modems/xmm626/xmm626_kernel_smdk4412.c    | 20 +++++++++++++++++++
 .../modems/xmm626/xmm626_kernel_smdk4412.h    |  4 ++++
 samsung-ipc/modems/xmm626/xmm626_mipi.c       | 18 -----------------
 samsung-ipc/modems/xmm626/xmm626_mipi.h       |  2 --
 12 files changed, 42 insertions(+), 52 deletions(-)

diff --git a/samsung-ipc/devices/galaxys2/galaxys2.c b/samsung-ipc/devices/galaxys2/galaxys2.c
index c13c572..4b03772 100644
--- a/samsung-ipc/devices/galaxys2/galaxys2.c
+++ b/samsung-ipc/devices/galaxys2/galaxys2.c
@@ -150,8 +150,9 @@ int galaxys2_boot(struct ipc_client *client)
 
 	p = (unsigned char *) modem_image_data + GALAXYS2_FIRMWARE_OFFSET;
 
-	rc = xmm626_hsic_firmware_send(client, modem_boot_fd, (void *) p,
-				       GALAXYS2_FIRMWARE_SIZE);
+	rc = xmm626_kernel_smdk4412_firmware_send(client, modem_boot_fd,
+						  (void *) p,
+						  GALAXYS2_FIRMWARE_SIZE);
 	if (rc < 0) {
 		ipc_client_log(client, "Sending XMM626 HSIC firmware failed");
 		goto error;
diff --git a/samsung-ipc/devices/i9300/i9300.c b/samsung-ipc/devices/i9300/i9300.c
index 42b0be1..6b48cb3 100644
--- a/samsung-ipc/devices/i9300/i9300.c
+++ b/samsung-ipc/devices/i9300/i9300.c
@@ -140,8 +140,9 @@ int i9300_boot(struct ipc_client *client)
 
 	p = (unsigned char *) modem_image_data + I9300_FIRMWARE_OFFSET;
 
-	rc = xmm626_hsic_firmware_send(client, modem_boot_fd, (void *) p,
-				       I9300_FIRMWARE_SIZE);
+	rc = xmm626_kernel_smdk4412_firmware_send(client, modem_boot_fd,
+						  (void *) p,
+						  I9300_FIRMWARE_SIZE);
 	if (rc < 0) {
 		ipc_client_log(client, "Sending XMM626 HSIC firmware failed");
 		goto error;
diff --git a/samsung-ipc/devices/maguro/maguro.c b/samsung-ipc/devices/maguro/maguro.c
index 7d1ea1e..a484be2 100644
--- a/samsung-ipc/devices/maguro/maguro.c
+++ b/samsung-ipc/devices/maguro/maguro.c
@@ -135,8 +135,9 @@ int maguro_boot(struct ipc_client *client)
 
 	p = (unsigned char *) modem_image_data + MAGURO_FIRMWARE_OFFSET;
 
-	rc = xmm626_mipi_firmware_send(client, modem_boot_fd, (void *) p,
-				       MAGURO_FIRMWARE_SIZE);
+	rc = xmm626_kernel_smdk4412_firmware_send(client, modem_boot_fd,
+						  (void *) p,
+						  MAGURO_FIRMWARE_SIZE);
 	if (rc < 0) {
 		ipc_client_log(client, "Sending XMM626 MIPI firmware failed");
 		goto error;
diff --git a/samsung-ipc/devices/n5100/n5100.c b/samsung-ipc/devices/n5100/n5100.c
index 303d175..c7ad7bb 100644
--- a/samsung-ipc/devices/n5100/n5100.c
+++ b/samsung-ipc/devices/n5100/n5100.c
@@ -141,8 +141,9 @@ int n5100_boot(struct ipc_client *client)
 
 	p = (unsigned char *) modem_image_data + N5100_FIRMWARE_OFFSET;
 
-	rc = xmm626_hsic_firmware_send(client, modem_boot_fd, (void *) p,
-				       N5100_FIRMWARE_SIZE);
+	rc = xmm626_kernel_smdk4412_firmware_send(client, modem_boot_fd,
+						  (void *) p,
+						  N5100_FIRMWARE_SIZE);
 	if (rc < 0) {
 		ipc_client_log(client, "Sending XMM626 HSIC firmware failed");
 		goto error;
diff --git a/samsung-ipc/devices/n7100/n7100.c b/samsung-ipc/devices/n7100/n7100.c
index ea3459a..5da0590 100644
--- a/samsung-ipc/devices/n7100/n7100.c
+++ b/samsung-ipc/devices/n7100/n7100.c
@@ -140,8 +140,9 @@ int n7100_boot(struct ipc_client *client)
 
 	p = (unsigned char *) modem_image_data + N7100_FIRMWARE_OFFSET;
 
-	rc = xmm626_hsic_firmware_send(client, modem_boot_fd, (void *) p,
-				       N7100_FIRMWARE_SIZE);
+	rc = xmm626_kernel_smdk4412_firmware_send(client, modem_boot_fd,
+						  (void *) p,
+						  N7100_FIRMWARE_SIZE);
 	if (rc < 0) {
 		ipc_client_log(client, "Sending XMM626 HSIC firmware failed");
 		goto error;
diff --git a/samsung-ipc/devices/piranha/piranha.c b/samsung-ipc/devices/piranha/piranha.c
index 6b954df..74354df 100644
--- a/samsung-ipc/devices/piranha/piranha.c
+++ b/samsung-ipc/devices/piranha/piranha.c
@@ -133,8 +133,9 @@ int piranha_boot(struct ipc_client *client)
 
 	p = (unsigned char *) modem_image_data + PIRANHA_FIRMWARE_OFFSET;
 
-	rc = xmm626_mipi_firmware_send(client, modem_boot_fd, (void *) p,
-				       PIRANHA_FIRMWARE_SIZE);
+	rc = xmm626_kernel_smdk4412_firmware_send(client, modem_boot_fd,
+						  (void *) p,
+						  PIRANHA_FIRMWARE_SIZE);
 	if (rc < 0) {
 		ipc_client_log(client, "Sending XMM626 MIPI firmware failed");
 		goto error;
diff --git a/samsung-ipc/modems/xmm626/xmm626_hsic.c b/samsung-ipc/modems/xmm626/xmm626_hsic.c
index 5568584..06c1bf8 100644
--- a/samsung-ipc/modems/xmm626/xmm626_hsic.c
+++ b/samsung-ipc/modems/xmm626/xmm626_hsic.c
@@ -541,24 +541,6 @@ int xmm626_hsic_sec_end_send(struct ipc_client *client, int device_fd)
 	return 0;
 }
 
-int xmm626_hsic_firmware_send(struct ipc_client *client, int device_fd,
-			      const void *firmware_data, size_t firmware_size)
-{
-	int rc;
-
-	if (client == NULL || device_fd < 0 || firmware_data == NULL ||
-	    firmware_size == 0) {
-		return -1;
-	}
-
-	rc = modem_data_send(client, device_fd, firmware_data,
-				    firmware_size, XMM626_FIRMWARE_ADDRESS);
-	if (rc < 0)
-		return -1;
-
-	return 0;
-}
-
 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 6d58267..155bffb 100644
--- a/samsung-ipc/modems/xmm626/xmm626_hsic.h
+++ b/samsung-ipc/modems/xmm626/xmm626_hsic.h
@@ -59,8 +59,6 @@ int xmm626_hsic_port_config_send(struct ipc_client *client, int device_fd);
 int xmm626_hsic_sec_start_send(struct ipc_client *client, int device_fd,
 			       const void *sec_data, size_t sec_size);
 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_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 ee2e088..92fdc57 100644
--- a/samsung-ipc/modems/xmm626/xmm626_kernel_smdk4412.c
+++ b/samsung-ipc/modems/xmm626/xmm626_kernel_smdk4412.c
@@ -642,3 +642,23 @@ complete:
 
 	return rc;
 }
+
+int xmm626_kernel_smdk4412_firmware_send(struct ipc_client *client,
+					 int device_fd,
+					 const void *firmware_data,
+					 size_t firmware_size)
+{
+	int rc;
+
+	if (client == NULL || device_fd < 0 || firmware_data == NULL ||
+	    firmware_size == 0) {
+		return -1;
+	}
+
+	rc = modem_data_send(client, device_fd, firmware_data,
+				    firmware_size, XMM626_FIRMWARE_ADDRESS);
+	if (rc < 0)
+		return -1;
+
+	return 0;
+}
diff --git a/samsung-ipc/modems/xmm626/xmm626_kernel_smdk4412.h b/samsung-ipc/modems/xmm626/xmm626_kernel_smdk4412.h
index a36d120..1d45baf 100644
--- a/samsung-ipc/modems/xmm626/xmm626_kernel_smdk4412.h
+++ b/samsung-ipc/modems/xmm626/xmm626_kernel_smdk4412.h
@@ -76,5 +76,9 @@ int xmm626_kernel_smdk4412_gprs_get_capabilities(
 
 int xmm626_kernel_smdk4412_nv_data_send(struct ipc_client *client,
 					int device_fd);
+int xmm626_kernel_smdk4412_firmware_send(struct ipc_client *client,
+					 int device_fd,
+					 const void *firmware_data,
+					 size_t firmware_size);
 
 #endif /* __XMM626_SEC_MODEM_H__ */
diff --git a/samsung-ipc/modems/xmm626/xmm626_mipi.c b/samsung-ipc/modems/xmm626/xmm626_mipi.c
index 5b2cfdc..b39e712 100644
--- a/samsung-ipc/modems/xmm626/xmm626_mipi.c
+++ b/samsung-ipc/modems/xmm626/xmm626_mipi.c
@@ -585,24 +585,6 @@ int xmm626_mipi_sec_end_send(struct ipc_client *client, int device_fd)
 	return 0;
 }
 
-int xmm626_mipi_firmware_send(struct ipc_client *client, int device_fd,
-			      const void *firmware_data, size_t firmware_size)
-{
-	int rc;
-
-	if (client == NULL || device_fd < 0 || firmware_data == NULL ||
-	    firmware_size == 0) {
-		return -1;
-	}
-
-	rc = modem_data_send(client, device_fd, firmware_data,
-				    firmware_size, XMM626_FIRMWARE_ADDRESS);
-	if (rc < 0)
-		return -1;
-
-	return 0;
-}
-
 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 5fb71f1..7d5513d 100644
--- a/samsung-ipc/modems/xmm626/xmm626_mipi.h
+++ b/samsung-ipc/modems/xmm626/xmm626_mipi.h
@@ -61,8 +61,6 @@ int xmm626_mipi_port_config_send(struct ipc_client *client, int device_fd);
 int xmm626_mipi_sec_start_send(struct ipc_client *client, int device_fd,
 			       const void *sec_data, size_t sec_size);
 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_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