Fix mess with struct tbf types passed to LOGPTBF macro

It is quite common in all osmo-pcu code to have to convert between
parent class "tbf" and children "dl_tbf"/"ul_tbf", or other way around.
This commit adds new helper static inline functions to cast between
those while doing type checks.
This is used by new LOGPTBFDL and LOGPTBFUL macros to now expect the
proper subclass and cast securely inside the macro itself, hence sparing
all code calling those macros to have to cast explicitly the pointer to
the parent "tbf" class.

Change-Id: I7e4489ad4b93c9c8442213947e53c10b61fdc5e9
diff --git a/src/gprs_ms.c b/src/gprs_ms.c
index f552d93..df1c9be 100644
--- a/src/gprs_ms.c
+++ b/src/gprs_ms.c
@@ -96,7 +96,7 @@
 	if (tbf_state((const struct gprs_rlcmac_tbf *)dl_tbf) != TBF_ST_FLOW)
 		return;
 
-	LOGPTBFDL((const struct gprs_rlcmac_tbf *)dl_tbf, LOGL_DEBUG, "LLC receive timeout, requesting DL ACK\n");
+	LOGPTBFDL(dl_tbf, LOGL_DEBUG, "LLC receive timeout, requesting DL ACK\n");
 
 	tbf_dl_request_dl_ack(dl_tbf);
 }
@@ -1042,7 +1042,7 @@
 
 	dl_tbf = ms_dl_tbf(ms);
 	if (dl_tbf && tbf_state((const struct gprs_rlcmac_tbf *)dl_tbf) == TBF_ST_WAIT_RELEASE) {
-		LOGPTBFDL((const struct gprs_rlcmac_tbf *)dl_tbf, LOGL_DEBUG, "in WAIT RELEASE state (T3193), so reuse TBF\n");
+		LOGPTBFDL(dl_tbf, LOGL_DEBUG, "in WAIT RELEASE state (T3193), so reuse TBF\n");
 		tbf_establish_dl_tbf_on_pacch((struct gprs_rlcmac_tbf *)dl_tbf);
 	}