[MERGED] osmo-bsc[master]: HO prep: pass gsm_network to gsm_bts_alloc() already

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Wed Nov 29 17:37:20 UTC 2017


Neels Hofmeyr has submitted this change and it was merged.

Change subject: HO prep: pass gsm_network to gsm_bts_alloc() already
......................................................................


HO prep: pass gsm_network to gsm_bts_alloc() already

Prepare for a future change that accesses bts->network during gsm_bts_alloc().

Currently, gsm_bts_alloc() takes a ctx parameter, and gsm_bts_alloc_register()
then gets the gsm_network pointer and sets bts->network to it. All callers
anyway pass gsm_network as ctx to gsm_bts_alloc(), and anything else would not
make sense anyway. So enforce passing exactly gsm_network to gsm_bts_alloc()
and already set the bts->network pointer from there.

Prepares-for: I00870a5828703cf397776668d3301c0c3a4e033a
Change-Id: Ie590c14aa08df4c4f345596b23e5226c5577057a
---
M include/osmocom/bsc/gsm_data_shared.h
M src/libcommon/gsm_data.c
M src/libcommon/gsm_data_shared.c
3 files changed, 5 insertions(+), 4 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/bsc/gsm_data_shared.h b/include/osmocom/bsc/gsm_data_shared.h
index 45d67f6..d7514ca 100644
--- a/include/osmocom/bsc/gsm_data_shared.h
+++ b/include/osmocom/bsc/gsm_data_shared.h
@@ -810,7 +810,7 @@
 };
 
 
-struct gsm_bts *gsm_bts_alloc(void *talloc_ctx, uint8_t bts_num);
+struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, uint8_t bts_num);
 struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num);
 
 struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts);
diff --git a/src/libcommon/gsm_data.c b/src/libcommon/gsm_data.c
index ef72881..6a78e3a 100644
--- a/src/libcommon/gsm_data.c
+++ b/src/libcommon/gsm_data.c
@@ -261,7 +261,6 @@
 
 	net->num_bts++;
 
-	bts->network = net;
 	bts->type = type;
 	bts->model = model;
 	bts->bsic = bsic;
diff --git a/src/libcommon/gsm_data_shared.c b/src/libcommon/gsm_data_shared.c
index 8480892..e4ae339 100644
--- a/src/libcommon/gsm_data_shared.c
+++ b/src/libcommon/gsm_data_shared.c
@@ -309,9 +309,9 @@
 	.initial_mcs = 6,
 };
 
-struct gsm_bts *gsm_bts_alloc(void *ctx, uint8_t bts_num)
+struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, uint8_t bts_num)
 {
-	struct gsm_bts *bts = talloc_zero(ctx, struct gsm_bts);
+	struct gsm_bts *bts = talloc_zero(net, struct gsm_bts);
 	int i;
 
 	if (!bts)
@@ -320,6 +320,8 @@
 	bts->nr = bts_num;
 	bts->num_trx = 0;
 	INIT_LLIST_HEAD(&bts->trx_list);
+	bts->network = net;
+
 	bts->ms_max_power = 15;	/* dBm */
 
 	gsm_mo_init(&bts->mo, bts, NM_OC_BTS,

-- 
To view, visit https://gerrit.osmocom.org/5049
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie590c14aa08df4c4f345596b23e5226c5577057a
Gerrit-PatchSet: 4
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list