Change in osmo-bts[master]: power_control: vty: re-use cfg_bts_ul_power_target()

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

fixeria gerrit-no-reply at lists.osmocom.org
Thu Jan 7 00:38:56 UTC 2021


fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/21991 )

Change subject: power_control: vty: re-use cfg_bts_ul_power_target()
......................................................................

power_control: vty: re-use cfg_bts_ul_power_target()

This reduces code duplication by defining an alias.

Change-Id: I37f51d426fcf008c9d9e933827de70ab7b072a94
Related: SYS#4918
---
M src/common/vty.c
1 file changed, 14 insertions(+), 17 deletions(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/common/vty.c b/src/common/vty.c
index ff7ec12..52478b8 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -632,29 +632,26 @@
 	   CMD_ATTR_IMMEDIATE)
 {
 	struct gsm_bts *bts = vty->index;
+	int rxlev_dbm = atoi(argv[0]);
+	int hyst = 0;
 
-	bts->ul_power_ctrl.target_dbm = atoi(argv[0]);
-	bts->ul_power_ctrl.hysteresis_db = 0;
+	if (argc > 1) /* optional argument */
+		hyst = atoi(argv[1]);
+
+	bts->ul_power_ctrl.target_dbm = rxlev_dbm;
+	bts->ul_power_ctrl.hysteresis_db = hyst;
 
 	return CMD_SUCCESS;
 }
 
 /* FIXME: libosmovty is unable to handle 'foo <-110-0> [bar <1-25>]' */
-DEFUN_ATTR(cfg_bts_ul_power_target_hysteresis,
-	   cfg_bts_ul_power_target_hysteresis_cmd,
-	   UL_POWER_TARGET_CMD " hysteresis <1-25>",
-	   UL_POWER_TARGET_CMD_DESC
-	   "Target Rx Level hysteresis\n"
-	   "Tolerable deviation in dBm\n",
-	   CMD_ATTR_IMMEDIATE)
-{
-	struct gsm_bts *bts = vty->index;
-
-	bts->ul_power_ctrl.target_dbm = atoi(argv[0]);
-	bts->ul_power_ctrl.hysteresis_db = atoi(argv[1]);
-
-	return CMD_SUCCESS;
-}
+DEFUN_CMD_ELEMENT(cfg_bts_ul_power_target,
+		  cfg_bts_ul_power_target_hysteresis_cmd,
+		  UL_POWER_TARGET_CMD " hysteresis <1-25>",
+		  UL_POWER_TARGET_CMD_DESC
+		  "Target Rx Level hysteresis\n"
+		  "Tolerable deviation in dBm\n",
+		  CMD_ATTR_IMMEDIATE, 0);
 
 DEFUN_ATTR(cfg_no_bts_ul_power_filter,
 	   cfg_bts_no_ul_power_filter_cmd,

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/21991
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I37f51d426fcf008c9d9e933827de70ab7b072a94
Gerrit-Change-Number: 21991
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210107/29aa5ffd/attachment.htm>


More information about the gerrit-log mailing list