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

Belgin Stirbu belginstirbu at hotmail.com
Sun Nov 22 05:43:17 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 | 97 +++++++++++++++++++------
 samsung-ipc/devices/i9300/i9300.c       | 51 +++++++++----
 samsung-ipc/devices/n5100/n5100.c       | 50 +++++++++----
 samsung-ipc/devices/n7100/n7100.c       | 51 +++++++++----
 4 files changed, 185 insertions(+), 64 deletions(-)

diff --git a/samsung-ipc/devices/galaxys2/galaxys2.c b/samsung-ipc/devices/galaxys2/galaxys2.c
index cdfe20c..de12146 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, "Turning the modem off failed");
-		goto error;
+	    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, "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, "Turning the modem on failed");
-		goto error;
+	    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, "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);
@@ -186,15 +216,25 @@ int galaxys2_boot(struct ipc_client *client)
 	if (rc < 0)
 		ipc_client_log(client, "Waiting for host wake failed");
 
+
 	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");
-		goto error;
+	    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;
 	}
 
 	rc = xmm626_kernel_smdk4412_link_get_hostwake_wait(client,
@@ -207,13 +247,22 @@ 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, "Turning the modem on failed");
-		goto error;
+	    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, "Activating the modem link failed");
+	    goto error;
 	}
 
 	rc = xmm626_kernel_smdk4412_link_connected_wait(client, modem_link_fd);
diff --git a/samsung-ipc/devices/i9300/i9300.c b/samsung-ipc/devices/i9300/i9300.c
index 85709a8..e332a06 100644
--- a/samsung-ipc/devices/i9300/i9300.c
+++ b/samsung-ipc/devices/i9300/i9300.c
@@ -85,12 +85,17 @@ 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");
-		goto error;
+	    ipc_client_log(client, "Powering on the HCI bus failed");
+	    goto error;
 	}
+
 	ipc_client_log(client, "Turned the modem on");
 
 	rc = xmm626_kernel_smdk4412_link_connected_wait(client, modem_link_fd);
@@ -176,15 +181,25 @@ int i9300_boot(struct ipc_client *client)
 	if (rc < 0)
 		ipc_client_log(client, "Waiting for host wake failed");
 
+
 	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");
-		goto error;
+	    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;
 	}
 
 	rc = xmm626_kernel_smdk4412_link_get_hostwake_wait(client,
@@ -195,15 +210,25 @@ int i9300_boot(struct ipc_client *client)
 	}
 	ipc_client_log(client, "Waited for host wake");
 
+
 	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, "Turning the modem on failed");
-		goto error;
+	    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, "Activating the modem link failed");
+	    goto error;
 	}
 
 	rc = xmm626_kernel_smdk4412_link_connected_wait(client, modem_link_fd);
diff --git a/samsung-ipc/devices/n5100/n5100.c b/samsung-ipc/devices/n5100/n5100.c
index 0abe896..1464e22 100644
--- a/samsung-ipc/devices/n5100/n5100.c
+++ b/samsung-ipc/devices/n5100/n5100.c
@@ -86,12 +86,17 @@ 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");
-		goto error;
+	    ipc_client_log(client, "Powering on the HCI bus failed");
+	    goto error;
 	}
+
 	ipc_client_log(client, "Turned the modem on");
 
 	rc = xmm626_kernel_smdk4412_link_connected_wait(client, modem_link_fd);
@@ -179,13 +184,22 @@ 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");
-		goto error;
+	    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;
 	}
 
 	rc = xmm626_kernel_smdk4412_link_get_hostwake_wait(client,
@@ -196,15 +210,25 @@ int n5100_boot(struct ipc_client *client)
 	}
 	ipc_client_log(client, "Waited for host wake");
 
+
 	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, "Turning the modem on failed");
-		goto error;
+	    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, "Activating the modem link failed");
+	    goto error;
 	}
 
 	rc = xmm626_kernel_smdk4412_link_connected_wait(client, modem_link_fd);
diff --git a/samsung-ipc/devices/n7100/n7100.c b/samsung-ipc/devices/n7100/n7100.c
index d5091a2..46b298b 100644
--- a/samsung-ipc/devices/n7100/n7100.c
+++ b/samsung-ipc/devices/n7100/n7100.c
@@ -85,12 +85,17 @@ 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");
-		goto error;
+	    ipc_client_log(client, "Powering on the HCI bus failed");
+	    goto error;
 	}
+
 	ipc_client_log(client, "Turned the modem on");
 
 	rc = xmm626_kernel_smdk4412_link_connected_wait(client, modem_link_fd);
@@ -176,15 +181,24 @@ int n7100_boot(struct ipc_client *client)
 	if (rc < 0)
 		ipc_client_log(client, "Waiting for host wake failed");
 
-	rc = xmm626_kernel_smdk4412_link_control_enable(client, modem_link_fd,
+		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");
-		goto error;
+	    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;
 	}
 
 	rc = xmm626_kernel_smdk4412_link_get_hostwake_wait(client,
@@ -197,13 +211,22 @@ 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, "Turning the modem on failed");
-		goto error;
+	    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, "Activating the modem link failed");
+	    goto error;
 	}
 
 	rc = xmm626_kernel_smdk4412_link_connected_wait(client, modem_link_fd);
-- 
2.17.1



More information about the Replicant mailing list