[PATCH 04/10] sap-dummy: Small refactor to sap_connect_req

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This makes function easier to read and more similar to rest of code.
---
 sap/sap-dummy.c |   24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/sap/sap-dummy.c b/sap/sap-dummy.c
index 9a21779..238c5f3 100644
--- a/sap/sap-dummy.c
+++ b/sap/sap-dummy.c
@@ -60,26 +60,32 @@ void sap_connect_req(void *sap_device, uint16_t maxmsgsize)
 		sap_connect_rsp(sap_device, SAP_STATUS_CONNECTION_FAILED,
 								maxmsgsize);
 		return;
-	} else if (max_msg_size_supported > maxmsgsize) {
+	}
+
+	if (max_msg_size_supported > maxmsgsize) {
 		sap_connect_rsp(sap_device, SAP_STATUS_MAX_MSG_SIZE_TOO_SMALL,
 						max_msg_size_supported);
 		return;
-	} else if (max_msg_size_supported < maxmsgsize) {
+	}
+
+	if (max_msg_size_supported < maxmsgsize) {
 		sap_connect_rsp(sap_device,
 				SAP_STATUS_MAX_MSG_SIZE_NOT_SUPPORTED,
 				max_msg_size_supported);
 		return;
-	} else if (ongoing_call_status) {
+	}
+
+	if (ongoing_call_status) {
 		sap_connect_rsp(sap_device, SAP_STATUS_OK_ONGOING_CALL,
 						max_msg_size_supported);
 		return;
-	} else {
-		sim_card_conn_status = SIM_CONNECTED;
-		sap_data = sap_device;
-
-		sap_connect_rsp(sap_device, SAP_STATUS_OK, maxmsgsize);
-		sap_status_ind(sap_device, SAP_STATUS_CHANGE_CARD_RESET);
 	}
+
+	sim_card_conn_status = SIM_CONNECTED;
+	sap_data = sap_device;
+
+	sap_connect_rsp(sap_device, SAP_STATUS_OK, maxmsgsize);
+	sap_status_ind(sap_device, SAP_STATUS_CHANGE_CARD_RESET);
 }
 
 void sap_disconnect_req(void *sap_device, uint8_t linkloss)
-- 
on behalf of ST-Ericsson

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux