dexter has submitted this change. (
https://gerrit.osmocom.org/c/libosmo-abis/+/32400 )
Change subject: e1_input: add new driver callback function: line_create
......................................................................
e1_input: add new driver callback function: line_create
When a line is created using e1inp_line_create, then the line data
structures are initialized and the line is registered in the line list.
struct e1inp_line also contains driver specific sub structs that,
depending on the driver, might also need some initialization. At the
moment is no way. Let's add a line_create callback that, when
populated by the driver, is executed on line creation.
Related: OS#5983
Change-Id: I404fa23e9b8a952be84e9716889c0dbbbc665d22
---
M TODO-RELEASE
M include/osmocom/abis/e1_input.h
M src/e1_input.c
3 files changed, 31 insertions(+), 1 deletion(-)
Approvals:
Jenkins Builder: Verified
dexter: Looks good to me, approved
diff --git a/TODO-RELEASE b/TODO-RELEASE
index 5f2f654..99d9735 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -9,3 +9,4 @@
#library what description / commit summary line
libosmo-abis struct e1inp_driver Field added at the end (ABI break)
libosmocodec >1.8.0 osmo_{fr,efr}_sid_classify() new functions
+libosmo-abis struct e1inp_driver Field added (line_create callback) at the end (ABI
break)
diff --git a/include/osmocom/abis/e1_input.h b/include/osmocom/abis/e1_input.h
index a66f8eb..b40382e 100644
--- a/include/osmocom/abis/e1_input.h
+++ b/include/osmocom/abis/e1_input.h
@@ -190,6 +190,9 @@
/* Set Sa bits to transmit in TS0 (MSB to LSB): Sa8 Sa7 Sa5 Sa4 Sa64 Sa63 Sa62 Sa61/Sa6
*/
int (*set_sa_bits)(struct e1inp_line *line, uint8_t sa_bits);
+
+ /* Optional callback to perform driver specific initialization when the line is created.
*/
+ int (*line_create)(struct e1inp_line *line);
};
struct e1inp_line_ops {
diff --git a/src/e1_input.c b/src/e1_input.c
index e3ac67e..6fca307 100644
--- a/src/e1_input.c
+++ b/src/e1_input.c
@@ -639,8 +639,16 @@
line->use_count.talloc_object = line;
line->use_count.use_cb = e1inp_line_use_cb;
- e1inp_line_get2(line, "ctor");
+ if (driver->line_create) {
+ if (driver->line_create(line) < 0) {
+ LOGPIL(line, DLINP, LOGL_ERROR, "Cannot initialize line driver\n");
+ talloc_free(line);
+ return NULL;
+ }
+ }
+
+ e1inp_line_get2(line, "ctor");
llist_add_tail(&line->list, &e1inp_line_list);
return line;
--
To view, visit
https://gerrit.osmocom.org/c/libosmo-abis/+/32400
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I404fa23e9b8a952be84e9716889c0dbbbc665d22
Gerrit-Change-Number: 32400
Gerrit-PatchSet: 5
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: msuraev <msuraev(a)sysmocom.de>
Gerrit-MessageType: merged