From 195fe9b84c76a8234b9dd3ae7547c5c8f019103f Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Fri, 28 Sep 2018 05:28:36 +0700 Subject: trxcon/scheduler: pass talloc ctx directly to sched_prim_init() Enforcing pointer to a 'trx_instance' structure is not flexible, because it is used as parent talloc context only. Change-Id: I5ab2ef5cea76f955bf72ef54541b3b75cdc2d23f --- src/host/trxcon/sched_prim.c | 9 ++++----- src/host/trxcon/sched_trx.h | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/host/trxcon/sched_prim.c b/src/host/trxcon/sched_prim.c index e71109b1..e03f93ff 100644 --- a/src/host/trxcon/sched_prim.c +++ b/src/host/trxcon/sched_prim.c @@ -42,16 +42,15 @@ * Initializes a new primitive by allocating memory * and filling some meta-information (e.g. lchan type). * - * @param trx TRX instance to be used as initial talloc context + * @param ctx parent talloc context * @param prim external prim pointer (will point to the allocated prim) * @param pl_len prim payload length * @param chan_nr RSL channel description (used to set a proper chan) * @param link_id RSL link description (used to set a proper chan) * @return zero in case of success, otherwise a error number */ -int sched_prim_init(struct trx_instance *trx, - struct trx_ts_prim **prim, size_t pl_len, - uint8_t chan_nr, uint8_t link_id) +int sched_prim_init(void *ctx, struct trx_ts_prim **prim, + size_t pl_len, uint8_t chan_nr, uint8_t link_id) { enum trx_lchan_type lchan_type; struct trx_ts_prim *new_prim; @@ -70,7 +69,7 @@ int sched_prim_init(struct trx_instance *trx, len += pl_len; /* Requested payload size */ /* Allocate a new primitive */ - new_prim = talloc_zero_size(trx, len); + new_prim = talloc_zero_size(ctx, len); if (new_prim == NULL) { LOGP(DSCH, LOGL_ERROR, "Failed to allocate memory\n"); return -ENOMEM; diff --git a/src/host/trxcon/sched_trx.h b/src/host/trxcon/sched_trx.h index ff288f20..818c95a0 100644 --- a/src/host/trxcon/sched_trx.h +++ b/src/host/trxcon/sched_trx.h @@ -273,7 +273,7 @@ struct trx_lchan_state *sched_trx_find_lchan(struct trx_ts *ts, enum trx_lchan_type chan); /* Primitive management functions */ -int sched_prim_init(struct trx_instance *trx, struct trx_ts_prim **prim, +int sched_prim_init(void *ctx, struct trx_ts_prim **prim, size_t pl_len, uint8_t chan_nr, uint8_t link_id); int sched_prim_push(struct trx_instance *trx, struct trx_ts_prim *prim, uint8_t chan_nr); -- cgit v1.2.3