neels has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/31629 )


Change subject: cosmetic: assignment_fsm.c: naming tweaks
......................................................................

cosmetic: assignment_fsm.c: naming tweaks

Reading the code, I was confused: check_requires_voice_stream() sounds
like it returns a bool. Instead, it figures out chan modes and returns
success or error. Clarify.

Change-Id: Ib8230254dd8e0ea3cd9f65a5a2944989c56f8679
---
M src/osmo-bsc/assignment_fsm.c
1 file changed, 18 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/29/31629/1

diff --git a/src/osmo-bsc/assignment_fsm.c b/src/osmo-bsc/assignment_fsm.c
index b9a7930..7d1dc58 100644
--- a/src/osmo-bsc/assignment_fsm.c
+++ b/src/osmo-bsc/assignment_fsm.c
@@ -369,7 +369,7 @@
        OSMO_ASSERT(osmo_fsm_register(&assignment_fsm) == 0);
 }

-static int check_requires_voice(bool *requires_voice, enum gsm48_chan_mode 
chan_mode)
+static int check_one_chan_mode_for_voice(bool *requires_voice, enum 
gsm48_chan_mode chan_mode)
 {
        *requires_voice = false;

@@ -392,7 +392,7 @@
 /* Check if the incoming assignment request requires a voice stream or not,
  * we will look at the preferred and the alternate channel mode and also make
  * sure that both are consistent. */
-static int check_requires_voice_stream(struct gsm_subscriber_connection *conn)
+static int check_chan_modes_for_voice(struct gsm_subscriber_connection *conn)
 {
        bool requires_voice_pref = false, requires_voice_alt;
        struct assignment_request *req = &conn->assignment.req;
@@ -405,7 +405,7 @@
         * a mismatch is not permitted */

        for (i = 0; i < req->n_ch_mode_rate; i++) {
-               rc = check_requires_voice(&requires_voice_alt, 
req->ch_mode_rate_list[i].chan_mode);
+               rc = check_one_chan_mode_for_voice(&requires_voice_alt, 
req->ch_mode_rate_list[i].chan_mode);
                if (rc < 0) {
                        
assignment_fail(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_NOT_SUPP,
                                        "Channel mode not supported (prev level 
%d): %s", i,
@@ -529,8 +529,8 @@
        assignment_count(CTR_ASSIGNMENT_ATTEMPTED);

        /* Check if we need a voice stream. If yes, set the appropriate struct
-        * members in conn */
-       if (check_requires_voice_stream(conn) < 0)
+        * members in conn. On error, just return (assignment_fail() has 
already been invoked). */
+       if (check_chan_modes_for_voice(conn) < 0)
                return;

        if (!req->target_lchan && reuse_existing_lchan(conn)) {

--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31629
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ib8230254dd8e0ea3cd9f65a5a2944989c56f8679
Gerrit-Change-Number: 31629
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofm...@sysmocom.de>
Gerrit-MessageType: newchange

Reply via email to