diff options
author | Harald Welte <laforge@gnumonks.org> | 2016-01-20 21:54:21 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2016-02-15 14:27:16 +0100 |
commit | 38933afdd95f9e809c2e3a15ff860d22b22f27c4 (patch) | |
tree | a90f70e2bf43158a5527b0965b6ad5dc724cb18d /src/osmo-bts-sysmo/sysmobts_vty.c | |
parent | 6a0f0f9e21e46055dd8481036c75f49d89863639 (diff) |
introduce + use new generic vty_get_phy_instance()
this function is intended to be used by VTY commands that need to
resolve a given PHY interface.
Diffstat (limited to 'src/osmo-bts-sysmo/sysmobts_vty.c')
-rw-r--r-- | src/osmo-bts-sysmo/sysmobts_vty.c | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/src/osmo-bts-sysmo/sysmobts_vty.c b/src/osmo-bts-sysmo/sysmobts_vty.c index 19122dc8..ced8f8e0 100644 --- a/src/osmo-bts-sysmo/sysmobts_vty.c +++ b/src/osmo-bts-sysmo/sysmobts_vty.c @@ -288,22 +288,14 @@ DEFUN(show_dsp_trace_f, show_dsp_trace_f_cmd, DEFUN(dsp_trace_f, dsp_trace_f_cmd, "HIDDEN", TRX_STR) { int phy_nr = atoi(argv[0]); - struct phy_link *plink = phy_link_by_num(phy_nr); struct phy_instance *pinst; struct femtol1_hdl *fl1h; unsigned int flag ; - if (!plink) { - vty_out(vty, "Cannot find PHY link number %u%s", - phy_nr, VTY_NEWLINE); - return CMD_WARNING; - } - pinst = phy_instance_by_num(plink, 0); - if (!pinst) { - vty_out(vty, "Cannot find PHY instance number 0%s", - VTY_NEWLINE); + pinst = vty_get_phy_instance(vty, phy_nr, 0); + if (!pinst) return CMD_WARNING; - } + fl1h = pinst->u.sysmobts.hdl; flag = get_string_value(femtobts_tracef_names, argv[1]); l1if_set_trace_flags(fl1h, fl1h->dsp_trace_f | flag); @@ -314,22 +306,14 @@ DEFUN(dsp_trace_f, dsp_trace_f_cmd, "HIDDEN", TRX_STR) DEFUN(no_dsp_trace_f, no_dsp_trace_f_cmd, "HIDDEN", NO_STR TRX_STR) { int phy_nr = atoi(argv[0]); - struct phy_link *plink = phy_link_by_num(phy_nr); struct phy_instance *pinst; struct femtol1_hdl *fl1h; unsigned int flag ; - if (!plink) { - vty_out(vty, "Cannot find PHY link number %u%s", - phy_nr, VTY_NEWLINE); - return CMD_WARNING; - } - pinst = phy_instance_by_num(plink, 0); - if (!pinst) { - vty_out(vty, "Cannot find PHY instance number 0%s", - VTY_NEWLINE); + pinst = vty_get_phy_instance(vty, phy_nr, 0); + if (!pinst) return CMD_WARNING; - } + fl1h = pinst->u.sysmobts.hdl; flag = get_string_value(femtobts_tracef_names, argv[1]); l1if_set_trace_flags(fl1h, fl1h->dsp_trace_f & ~flag); |