summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2018-09-28 05:28:36 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2018-09-28 05:31:26 +0700
commit195fe9b84c76a8234b9dd3ae7547c5c8f019103f (patch)
treec48f9cb7fa5dac576f4ab32a5dbcc7128a4f9c45 /src
parentbde71c180a3af5b61d7ea59cf494e385c864a2f1 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/host/trxcon/sched_prim.c9
-rw-r--r--src/host/trxcon/sched_trx.h2
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);