[MERGED] libosmo-netif[master]: src: use osmo_timer_setup()

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Jun 22 06:37:27 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: src: use osmo_timer_setup()
......................................................................


src: use osmo_timer_setup()

Use new function available in libosmocore to set up timers. Compile
tested only.

Change-Id: Id3dd32102c7362f3b280d2c058c2decebccb357a
---
M src/osmux.c
M src/rs232.c
M src/stream.c
3 files changed, 6 insertions(+), 10 deletions(-)

Approvals:
  Max: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmux.c b/src/osmux.c
index 91054f1..23a6440 100644
--- a/src/osmux.c
+++ b/src/osmux.c
@@ -721,8 +721,7 @@
 
 	INIT_LLIST_HEAD(&batch->circuit_list);
 	batch->remaining_bytes = h->batch_size;
-	batch->timer.cb = osmux_batch_timer_expired;
-	batch->timer.data = h;
+	osmo_timer_setup(&batch->timer, osmux_batch_timer_expired, h);
 
 	h->internal_data = (void *)batch;
 
@@ -803,8 +802,7 @@
 	h->msg = msg;
 	h->tx_cb = tx_cb;
 	h->data = data;
-	h->timer.cb = osmux_tx_cb;
-	h->timer.data = h;
+	osmo_timer_setup(&h->timer, osmux_tx_cb, h);
 
 #ifdef DEBUG_TIMING
 	osmo_gettimeofday(&h->start, NULL);
diff --git a/src/rs232.c b/src/rs232.c
index c05a693..49520d8 100644
--- a/src/rs232.c
+++ b/src/rs232.c
@@ -234,10 +234,9 @@
 		return rc;
 	}
 
-	if (r->cfg.delay_us) {
-		r->tx_timer.cb = rs232_tx_timer_cb;
-		r->tx_timer.data = r;
-	}
+	if (r->cfg.delay_us)
+		osmo_timer_setup(&r->tx_timer, rs232_tx_timer_cb, r);
+
 	return 0;
 }
 
diff --git a/src/stream.c b/src/stream.c
index b96293e..a80d842 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -281,8 +281,7 @@
 	cli->ofd.cb = osmo_stream_cli_fd_cb;
 	cli->ofd.data = cli;
 	cli->state = STREAM_CLI_STATE_CONNECTING;
-	cli->timer.cb = cli_timer_cb;
-	cli->timer.data = cli;
+	osmo_timer_setup(&cli->timer, cli_timer_cb, cli);
 	cli->reconnect_timeout = 5;	/* default is 5 seconds. */
 	INIT_LLIST_HEAD(&cli->tx_queue);
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id3dd32102c7362f3b280d2c058c2decebccb357a
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Owner: Pablo Neira Ayuso <pablo at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list