aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-sysmo/l1_if.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2013-01-22 15:45:14 +0100
committerHarald Welte <laforge@gnumonks.org>2013-03-24 09:05:04 +0100
commit9d91c60875548cb7e74b51a3d6bb0ec1b001a672 (patch)
tree8d21920cdb67305dfebffd516714cd79032aacaa /src/osmo-bts-sysmo/l1_if.c
parent470a6ced9a76812127ce538f124ae41564fd10de (diff)
sysmobts: Prepare to address the documented limitation of this code
Diffstat (limited to 'src/osmo-bts-sysmo/l1_if.c')
-rw-r--r--src/osmo-bts-sysmo/l1_if.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c
index 87ea0fca..6c478712 100644
--- a/src/osmo-bts-sysmo/l1_if.c
+++ b/src/osmo-bts-sysmo/l1_if.c
@@ -901,6 +901,17 @@ static int l1if_handle_ind(struct femtol1_hdl *fl1, struct msgb *msg)
return rc;
}
+static inline int is_prim_compat(GsmL1_Prim_t *l1p, struct wait_l1_conf *wlc)
+{
+ /* the limitation here is that we cannot have multiple callers
+ * sending the same primitive */
+ if (wlc->is_sys_prim != 0)
+ return 0;
+ if (l1p->id != wlc->conf_prim_id)
+ return 0;
+ return 1;
+}
+
int l1if_handle_l1prim(int wq, struct femtol1_hdl *fl1h, struct msgb *msg)
{
GsmL1_Prim_t *l1p = msgb_l1prim(msg);
@@ -918,9 +929,7 @@ int l1if_handle_l1prim(int wq, struct femtol1_hdl *fl1h, struct msgb *msg)
/* check if this is a resposne to a sync-waiting request */
llist_for_each_entry(wlc, &fl1h->wlc_list, list) {
- /* the limitation here is that we cannot have multiple callers
- * sending the same primitive */
- if (wlc->is_sys_prim == 0 && l1p->id == wlc->conf_prim_id) {
+ if (is_prim_compat(l1p, wlc)) {
llist_del(&wlc->list);
if (wlc->cb)
rc = wlc->cb(fl1h->priv, msg);