gprs_ns2: convert gprs_ns2_cause_str into an static inline

Be consistent with other implementation of get_value_string() in
libosomocore.

Change-Id: Ic79757df8683e0461c04f7ef9279e4fe645eb821
diff --git a/include/osmocom/gprs/gprs_ns2.h b/include/osmocom/gprs/gprs_ns2.h
index 975ddcb..ffc2ad8 100644
--- a/include/osmocom/gprs/gprs_ns2.h
+++ b/include/osmocom/gprs/gprs_ns2.h
@@ -7,6 +7,7 @@
 #include <netinet/in.h>
 
 #include <osmocom/core/prim.h>
+#include <osmocom/gprs/protocol/gsm_08_16.h>
 
 struct osmo_sockaddr;
 struct osmo_sockaddr_str;
@@ -74,6 +75,12 @@
 	NS_ENDPOINT_CONFIRM_CHANGE,
 };
 
+extern const struct value_string gprs_ns2_cause_strs[];
+
+/*! Obtain a human-readable string for NS primitives */
+static inline const char *gprs_ns2_cause_str(enum ns_cause val)
+{ return get_value_string(gprs_ns2_cause_strs, val); }
+
 struct osmo_gprs_ns2_prim {
 	struct osmo_prim_hdr oph;
 
@@ -185,7 +192,6 @@
 		struct gprs_ns2_nse *nse,
 		const struct osmo_sockaddr *sockaddr);
 void gprs_ns2_start_alive_all_nsvcs(struct gprs_ns2_nse *nse);
-const char *gprs_ns2_cause_str(int cause);
 const char *gprs_ns2_ll_str(struct gprs_ns2_vc *nsvc);
 char *gprs_ns2_ll_str_buf(char *buf, size_t buf_len, struct gprs_ns2_vc *nsvc);
 char *gprs_ns2_ll_str_c(const void *ctx, struct gprs_ns2_vc *nsvc);
diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index 6401d77..ffa3135 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -138,7 +138,7 @@
 
 
 /* Section 10.3.2, Table 13 */
-static const struct value_string ns2_cause_str[] = {
+const struct value_string gprs_ns2_cause_strs[] = {
 	{ NS_CAUSE_TRANSIT_FAIL,	"Transit network failure" },
 	{ NS_CAUSE_OM_INTERVENTION, 	"O&M intervention" },
 	{ NS_CAUSE_EQUIP_FAIL,		"Equipment failure" },
@@ -160,13 +160,6 @@
 	{ 0, NULL }
 };
 
-/*! Obtain a human-readable string for NS cause value */
-const char *gprs_ns2_cause_str(int cause)
-{
-	enum ns_cause _cause = cause;
-	return get_value_string(ns2_cause_str, _cause);
-}
-
 static const struct rate_ctr_desc nsvc_ctr_description[] = {
 	{ "packets:in", "Packets at NS Level  ( In)" },
 	{ "packets:out","Packets at NS Level  (Out)" },
diff --git a/src/gb/libosmogb.map b/src/gb/libosmogb.map
index 9c8e685..3755b4f 100644
--- a/src/gb/libosmogb.map
+++ b/src/gb/libosmogb.map
@@ -74,7 +74,7 @@
 
 gprs_ns2_aff_cause_prim_strs;
 gprs_ns2_bind_set_mode;
-gprs_ns2_cause_str;
+gprs_ns2_cause_strs;
 gprs_ns2_create_nse;
 gprs_ns2_dynamic_create_nse;
 gprs_ns2_find_vc_by_sockaddr;