[Replicant] [PATCH v3] libsamsung-ipc: improve board drivers print (issue #2150)

Belgin Stirbu belginstirbu at hotmail.com
Mon Nov 23 04:22:07 UTC 2020


These are the functions and their corresponding error
messages:

xmm626_kernel_smdk4412_power
	-> "Powering on/off the modem failed"

xmm626_kernel_smdk4412_hci_power
	-> "Powering on/off the HCI bus failed"

xmm626_kernel_smdk4412_link_control_enable
	-> "Enabling/Disabling the modem link failed"

xmm626_kernel_smdk4412_link_control_active
	-> "Activating/Deactivating the modem link failed"

Signed-off-by: Belgin Stirbu <belginstirbu at hotmail.com>
---
 samsung-ipc/devices/galaxys2/galaxys2.c | 88 +++++++++++++++++++------
 samsung-ipc/devices/i9300/i9300.c       | 42 +++++++++---
 samsung-ipc/devices/n5100/n5100.c       | 42 +++++++++---
 samsung-ipc/devices/n7100/n7100.c       | 42 +++++++++---
 4 files changed, 164 insertions(+), 50 deletions(-)

diff --git a/samsung-ipc/devices/galaxys2/galaxys2.c b/samsung-ipc/devices/galaxys2/galaxys2.c
index cdfe20c..954417f 100644
--- a/samsung-ipc/devices/galaxys2/galaxys2.c
+++ b/samsung-ipc/devices/galaxys2/galaxys2.c
@@ -78,29 +78,59 @@ int galaxys2_boot(struct ipc_client *client)
 	ipc_client_log(client, "Opened modem link device");
 
 	rc = xmm626_kernel_smdk4412_power(client, modem_boot_fd, 0);
-	rc |= xmm626_kernel_smdk4412_link_control_enable(client, modem_link_fd,
-							 0);
-	rc |= xmm626_kernel_smdk4412_hci_power(client, 0);
-	rc |= xmm626_kernel_smdk4412_link_control_active(client, modem_link_fd,
-							 0);
+	if (rc < 0) {
+		ipc_client_log(client, "Powering off the modem failed");
+		goto error;
+	}
+
+	rc = xmm626_kernel_smdk4412_link_control_enable(client, modem_link_fd,
+							0);
+	if (rc < 0) {
+		ipc_client_log(client, "Disabling the modem link failed");
+		goto error;
+	}
 
+	rc = xmm626_kernel_smdk4412_hci_power(client, 0);
 	if (rc < 0) {
-		ipc_client_log(client, "Turning the modem off failed");
+		ipc_client_log(client, "Powering off the HCI bus failed");
 		goto error;
 	}
+
+	rc = xmm626_kernel_smdk4412_link_control_active(client, modem_link_fd,
+							0);
+	if (rc < 0) {
+		ipc_client_log(client, "Deactivating the modem link failed");
+		goto error;
+	}
+
 	ipc_client_log(client, "Turned the modem off");
 
 	rc = xmm626_kernel_smdk4412_power(client, modem_boot_fd, 1);
-	rc |= xmm626_kernel_smdk4412_link_control_enable(client, modem_link_fd,
-							 1);
-	rc |= xmm626_kernel_smdk4412_hci_power(client, 1);
-	rc |= xmm626_kernel_smdk4412_link_control_active(client, modem_link_fd,
-							 1);
+	if (rc < 0) {
+		ipc_client_log(client, "Powering on the modem failed");
+		goto error;
+	}
+
+	rc = xmm626_kernel_smdk4412_link_control_enable(client, modem_link_fd,
+							1);
+	if (rc < 0) {
+		ipc_client_log(client, "Enabling the modem link failed");
+		goto error;
+	}
+
+	rc = xmm626_kernel_smdk4412_hci_power(client, 1);
+	if (rc < 0) {
+		ipc_client_log(client, "Powering on the HCI bus failed");
+		goto error;
+	}
 
+	rc = xmm626_kernel_smdk4412_link_control_active(client, modem_link_fd,
+							1);
 	if (rc < 0) {
-		ipc_client_log(client, "Turning the modem on failed");
+		ipc_client_log(client, "Activating the modem link failed");
 		goto error;
 	}
+
 	ipc_client_log(client, "Turned the modem on");
 
 	rc = xmm626_kernel_smdk4412_link_connected_wait(client, modem_link_fd);
@@ -188,12 +218,21 @@ int galaxys2_boot(struct ipc_client *client)
 
 	rc = xmm626_kernel_smdk4412_link_control_enable(client, modem_link_fd,
 							0);
-	rc |= xmm626_kernel_smdk4412_hci_power(client, 0);
-	rc |= xmm626_kernel_smdk4412_link_control_active(client, modem_link_fd,
-							 0);
+	if (rc < 0) {
+		ipc_client_log(client, "Disabling the modem link failed");
+		goto error;
+	}
 
+	rc = xmm626_kernel_smdk4412_hci_power(client, 0);
 	if (rc < 0) {
-		ipc_client_log(client, "Turning the modem off failed");
+		ipc_client_log(client, "Powering off the HCI bus failed");
+		goto error;
+	}
+
+	rc = xmm626_kernel_smdk4412_link_control_active(client, modem_link_fd,
+							0);
+	if (rc < 0) {
+		ipc_client_log(client, "Deactivating the modem link failed");
 		goto error;
 	}
 
@@ -207,12 +246,21 @@ int galaxys2_boot(struct ipc_client *client)
 
 	rc = xmm626_kernel_smdk4412_link_control_enable(client, modem_link_fd,
 							1);
-	rc |= xmm626_kernel_smdk4412_hci_power(client, 1);
-	rc |= xmm626_kernel_smdk4412_link_control_active(client, modem_link_fd,
-							 1);
+	if (rc < 0) {
+		ipc_client_log(client, "Enabling the modem link failed");
+		goto error;
+	}
 
+	rc = xmm626_kernel_smdk4412_hci_power(client, 1);
+	if (rc < 0) {
+		ipc_client_log(client, "Powering on the HCI bus failed");
+		goto error;
+	}
+
+	rc = xmm626_kernel_smdk4412_link_control_active(client, modem_link_fd,
+							1);
 	if (rc < 0) {
-		ipc_client_log(client, "Turning the modem on failed");
+		ipc_client_log(client, "Activating the modem link failed");
 		goto error;
 	}
 
diff --git a/samsung-ipc/devices/i9300/i9300.c b/samsung-ipc/devices/i9300/i9300.c
index 85709a8..a2c2b92 100644
--- a/samsung-ipc/devices/i9300/i9300.c
+++ b/samsung-ipc/devices/i9300/i9300.c
@@ -85,10 +85,14 @@ int i9300_boot(struct ipc_client *client)
 	ipc_client_log(client, "Turned the modem off");
 
 	rc = xmm626_kernel_smdk4412_power(client, modem_boot_fd, 1);
-	rc |= xmm626_kernel_smdk4412_hci_power(client, 1);
+	if (rc < 0) {
+		ipc_client_log(client, "Powering on the modem failed");
+		goto error;
+	}
 
+	rc = xmm626_kernel_smdk4412_hci_power(client, 1);
 	if (rc < 0) {
-		ipc_client_log(client, "Turning the modem on failed");
+		ipc_client_log(client, "Powering on the HCI bus failed");
 		goto error;
 	}
 	ipc_client_log(client, "Turned the modem on");
@@ -178,12 +182,21 @@ int i9300_boot(struct ipc_client *client)
 
 	rc = xmm626_kernel_smdk4412_link_control_enable(client, modem_link_fd,
 							0);
-	rc |= xmm626_kernel_smdk4412_hci_power(client, 0);
-	rc |= xmm626_kernel_smdk4412_link_control_active(client, modem_link_fd,
-							 0);
+	if (rc < 0) {
+		ipc_client_log(client, "Disabling the modem link failed");
+		goto error;
+	}
 
+	rc = xmm626_kernel_smdk4412_hci_power(client, 0);
 	if (rc < 0) {
-		ipc_client_log(client, "Turning the modem off failed");
+		ipc_client_log(client, "Powering off the HCI bus failed");
+		goto error;
+	}
+
+	rc = xmm626_kernel_smdk4412_link_control_active(client, modem_link_fd,
+							0);
+	if (rc < 0) {
+		ipc_client_log(client, "Deactivating the modem link failed");
 		goto error;
 	}
 
@@ -197,12 +210,21 @@ int i9300_boot(struct ipc_client *client)
 
 	rc = xmm626_kernel_smdk4412_link_control_enable(client, modem_link_fd,
 							1);
-	rc |= xmm626_kernel_smdk4412_hci_power(client, 1);
-	rc |= xmm626_kernel_smdk4412_link_control_active(client, modem_link_fd,
-							 1);
+	if (rc < 0) {
+		ipc_client_log(client, "Enabling the modem link failed");
+		goto error;
+	}
 
+	rc = xmm626_kernel_smdk4412_hci_power(client, 1);
+	if (rc < 0) {
+		ipc_client_log(client, "Powering on the HCI bus failed");
+		goto error;
+	}
+
+	rc = xmm626_kernel_smdk4412_link_control_active(client, modem_link_fd,
+							1);
 	if (rc < 0) {
-		ipc_client_log(client, "Turning the modem on failed");
+		ipc_client_log(client, "Activating the modem link failed");
 		goto error;
 	}
 
diff --git a/samsung-ipc/devices/n5100/n5100.c b/samsung-ipc/devices/n5100/n5100.c
index 0abe896..f7055bf 100644
--- a/samsung-ipc/devices/n5100/n5100.c
+++ b/samsung-ipc/devices/n5100/n5100.c
@@ -86,10 +86,14 @@ int n5100_boot(struct ipc_client *client)
 	ipc_client_log(client, "Turned the modem off");
 
 	rc = xmm626_kernel_smdk4412_power(client, modem_boot_fd, 1);
-	rc |= xmm626_kernel_smdk4412_hci_power(client, 1);
+	if (rc < 0) {
+		ipc_client_log(client, "Powering on the modem failed");
+		goto error;
+	}
 
+	rc = xmm626_kernel_smdk4412_hci_power(client, 1);
 	if (rc < 0) {
-		ipc_client_log(client, "Turning the modem on failed");
+		ipc_client_log(client, "Powering on the HCI bus failed");
 		goto error;
 	}
 	ipc_client_log(client, "Turned the modem on");
@@ -179,12 +183,21 @@ int n5100_boot(struct ipc_client *client)
 
 	rc = xmm626_kernel_smdk4412_link_control_enable(client, modem_link_fd,
 							0);
-	rc |= xmm626_kernel_smdk4412_hci_power(client, 0);
-	rc |= xmm626_kernel_smdk4412_link_control_active(client, modem_link_fd,
-							 0);
+	if (rc < 0) {
+		ipc_client_log(client, "Disabling the modem link failed");
+		goto error;
+	}
 
+	rc = xmm626_kernel_smdk4412_hci_power(client, 0);
 	if (rc < 0) {
-		ipc_client_log(client, "Turning the modem off failed");
+		ipc_client_log(client, "Powering off the HCI bus failed");
+		goto error;
+	}
+
+	rc = xmm626_kernel_smdk4412_link_control_active(client, modem_link_fd,
+							0);
+	if (rc < 0) {
+		ipc_client_log(client, "Deactivating the modem link failed");
 		goto error;
 	}
 
@@ -198,12 +211,21 @@ int n5100_boot(struct ipc_client *client)
 
 	rc = xmm626_kernel_smdk4412_link_control_enable(client, modem_link_fd,
 							1);
-	rc |= xmm626_kernel_smdk4412_hci_power(client, 1);
-	rc |= xmm626_kernel_smdk4412_link_control_active(client, modem_link_fd,
-							 1);
+	if (rc < 0) {
+		ipc_client_log(client, "Enabling the modem link failed");
+		goto error;
+	}
 
+	rc = xmm626_kernel_smdk4412_hci_power(client, 1);
+	if (rc < 0) {
+		ipc_client_log(client, "Powering on the HCI bus failed");
+		goto error;
+	}
+
+	rc = xmm626_kernel_smdk4412_link_control_active(client, modem_link_fd,
+							1);
 	if (rc < 0) {
-		ipc_client_log(client, "Turning the modem on failed");
+		ipc_client_log(client, "Activating the modem link failed");
 		goto error;
 	}
 
diff --git a/samsung-ipc/devices/n7100/n7100.c b/samsung-ipc/devices/n7100/n7100.c
index d5091a2..6312c18 100644
--- a/samsung-ipc/devices/n7100/n7100.c
+++ b/samsung-ipc/devices/n7100/n7100.c
@@ -85,10 +85,14 @@ int n7100_boot(struct ipc_client *client)
 	ipc_client_log(client, "Turned the modem off");
 
 	rc = xmm626_kernel_smdk4412_power(client, modem_boot_fd, 1);
-	rc |= xmm626_kernel_smdk4412_hci_power(client, 1);
+	if (rc < 0) {
+		ipc_client_log(client, "Powering on the modem failed");
+		goto error;
+	}
 
+	rc = xmm626_kernel_smdk4412_hci_power(client, 1);
 	if (rc < 0) {
-		ipc_client_log(client, "Turning the modem on failed");
+		ipc_client_log(client, "Powering on the HCI bus failed");
 		goto error;
 	}
 	ipc_client_log(client, "Turned the modem on");
@@ -178,12 +182,21 @@ int n7100_boot(struct ipc_client *client)
 
 	rc = xmm626_kernel_smdk4412_link_control_enable(client, modem_link_fd,
 							0);
-	rc |= xmm626_kernel_smdk4412_hci_power(client, 0);
-	rc |= xmm626_kernel_smdk4412_link_control_active(client, modem_link_fd,
-							 0);
+	if (rc < 0) {
+		ipc_client_log(client, "Disabling the modem link failed");
+		goto error;
+	}
 
+	rc = xmm626_kernel_smdk4412_hci_power(client, 0);
 	if (rc < 0) {
-		ipc_client_log(client, "Turning the modem off failed");
+		ipc_client_log(client, "Powering off the HCI bus failed");
+		goto error;
+	}
+
+	rc = xmm626_kernel_smdk4412_link_control_active(client, modem_link_fd,
+							0);
+	if (rc < 0) {
+		ipc_client_log(client, "Deactivating the modem link failed");
 		goto error;
 	}
 
@@ -197,12 +210,21 @@ int n7100_boot(struct ipc_client *client)
 
 	rc = xmm626_kernel_smdk4412_link_control_enable(client, modem_link_fd,
 							1);
-	rc |= xmm626_kernel_smdk4412_hci_power(client, 1);
-	rc |= xmm626_kernel_smdk4412_link_control_active(client, modem_link_fd,
-							 1);
+	if (rc < 0) {
+		ipc_client_log(client, "Enabling the modem link failed");
+		goto error;
+	}
 
+	rc = xmm626_kernel_smdk4412_hci_power(client, 1);
+	if (rc < 0) {
+		ipc_client_log(client, "Powering on the HCI bus failed");
+		goto error;
+	}
+
+	rc = xmm626_kernel_smdk4412_link_control_active(client, modem_link_fd,
+							1);
 	if (rc < 0) {
-		ipc_client_log(client, "Turning the modem on failed");
+		ipc_client_log(client, "Activating the modem link failed");
 		goto error;
 	}
 
-- 
2.17.1



More information about the Replicant mailing list