diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2018-08-22 13:11:19 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2018-08-22 13:11:25 +0200 |
commit | 56ae85fd524d5c9e8b61ccb19e81b16fbc726bb0 (patch) | |
tree | c5a214e5c41d5bf20dffc840bc976e9f9a428147 | |
parent | a60f5e13b6d21b15d98316855c2834552bfe4606 (diff) |
ipaccess: Use osmo_fd_setup to set up callbacks
We have a public API in libosmocore, so let's use it istead of manually
filling each struct field.
Change-Id: I09479c3d5b0b9bd69a56c080b8c533a32824cc66
-rw-r--r-- | src/input/ipaccess.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c index 3d2fa44..6f41c97 100644 --- a/src/input/ipaccess.c +++ b/src/input/ipaccess.c @@ -189,11 +189,9 @@ static int ipaccess_rcvmsg(struct e1inp_line *line, struct msgb *msg, newbfd = &ts->driver.ipaccess.fd; /* get rid of our old temporary bfd */ - newbfd->fd = bfd->fd; - newbfd->when |= bfd->when; /* preserve 'newbfd->when' flags potentially set by sign_link_up() */ - newbfd->cb = bfd->cb; - newbfd->data = bfd->data; - newbfd->priv_nr = E1INP_SIGN_RSL + unit_data.trx_id; + /* preserve 'newbfd->when' flags potentially set by sign_link_up() */ + osmo_fd_setup(newbfd, bfd->fd, bfd->when, bfd->cb, + bfd->data, E1INP_SIGN_RSL + unit_data.trx_id); osmo_fd_unregister(bfd); bfd->fd = -1; ret = osmo_fd_register(newbfd); @@ -479,11 +477,7 @@ static int ipaccess_bsc_oml_cb(struct ipa_server_link *link, int fd) e1i_ts = &line->ts[idx]; bfd = &e1i_ts->driver.ipaccess.fd; - bfd->fd = fd; - bfd->data = line; - bfd->priv_nr = E1INP_SIGN_OML; - bfd->cb = ipaccess_fd_cb; - bfd->when = BSC_FD_READ; + osmo_fd_setup(bfd, fd, BSC_FD_READ, ipaccess_fd_cb, line, E1INP_SIGN_OML); ret = osmo_fd_register(bfd); if (ret < 0) { LOGP(DLINP, LOGL_ERROR, "could not register FD\n"); @@ -535,11 +529,7 @@ static int ipaccess_bsc_rsl_cb(struct ipa_server_link *link, int fd) e1i_ts = &line->ts[E1INP_SIGN_RSL-1]; bfd = &e1i_ts->driver.ipaccess.fd; - bfd->fd = fd; - bfd->data = line; - bfd->priv_nr = E1INP_SIGN_RSL; - bfd->cb = ipaccess_fd_cb; - bfd->when = BSC_FD_READ; + osmo_fd_setup(bfd, fd, BSC_FD_READ, ipaccess_fd_cb, line, E1INP_SIGN_RSL); ret = osmo_fd_register(bfd); if (ret < 0) { LOGP(DLINP, LOGL_ERROR, "could not register FD\n"); |