Pau Espin Pedrol has uploaded this change for review. ( 
https://gerrit.osmocom.org/9531


Change subject: lc15: Fix several u32 vs HANDLE compile warnings
......................................................................

lc15: Fix several u32 vs HANDLE compile warnings

Change-Id: I4193ad5fdb70ea01acb7c33656ea7bfd3fe62916
---
M src/osmo-bts-litecell15/l1_if.c
M src/osmo-bts-litecell15/l1_if.h
M src/osmo-bts-litecell15/oml.c
3 files changed, 23 insertions(+), 20 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/31/9531/1

diff --git a/src/osmo-bts-litecell15/l1_if.c b/src/osmo-bts-litecell15/l1_if.c
index e6cdfd4..c20d3a5 100644
--- a/src/osmo-bts-litecell15/l1_if.c
+++ b/src/osmo-bts-litecell15/l1_if.c
@@ -946,7 +946,7 @@


        DEBUGPGT(DL1P, &g_time, "Rx PH-DATA.ind %s (hL2 %08x): %s\n",
-               get_value_string(lc15bts_l1sapi_names, data_ind->sapi), 
(uint32_t)data_ind->hLayer2,
+               get_value_string(lc15bts_l1sapi_names, data_ind->sapi), 
(uint32_t)(intptr_t)data_ind->hLayer2,
                osmo_hexdump(data_ind->msgUnitParam.u8Buffer, 
data_ind->msgUnitParam.u8Size));
        dump_meas_res(LOGL_DEBUG, &data_ind->measParam);

@@ -1027,7 +1027,7 @@
                .acc_delay_256bits = ra_ind->measParam.i16BurstTiming * 64,
        };

-       lchan = l1if_hLayer_to_lchan(trx, (uint32_t)ra_ind->hLayer2);
+       lchan = l1if_hLayer_to_lchan(trx, ra_ind->hLayer2);
        if (!lchan || lchan->ts->pchan == GSM_PCHAN_CCCH ||
            lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4 ||
            lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4_CBCH)
diff --git a/src/osmo-bts-litecell15/l1_if.h b/src/osmo-bts-litecell15/l1_if.h
index aac2607..07fbb42 100644
--- a/src/osmo-bts-litecell15/l1_if.h
+++ b/src/osmo-bts-litecell15/l1_if.h
@@ -86,8 +86,8 @@
 struct msgb *l1p_msgb_alloc(void);
 struct msgb *sysp_msgb_alloc(void);

-uint32_t l1if_lchan_to_hLayer(struct gsm_lchan *lchan);
-struct gsm_lchan *l1if_hLayer_to_lchan(struct gsm_bts_trx *trx, uint32_t 
hLayer);
+HANDLE l1if_lchan_to_hLayer(struct gsm_lchan *lchan);
+struct gsm_lchan *l1if_hLayer_to_lchan(struct gsm_bts_trx *trx, HANDLE hLayer);

 /* tch.c */
 int l1if_tch_encode(struct gsm_lchan *lchan, uint8_t *data, uint8_t *len,
diff --git a/src/osmo-bts-litecell15/oml.c b/src/osmo-bts-litecell15/oml.c
index da6c60e..56f6dd3 100644
--- a/src/osmo-bts-litecell15/oml.c
+++ b/src/osmo-bts-litecell15/oml.c
@@ -23,6 +23,8 @@

 #include <stdint.h>
 #include <errno.h>
+#include <unistd.h>
+#include <inttypes.h>

 #include <osmocom/core/talloc.h>
 #include <osmocom/core/utils.h>
@@ -106,7 +108,7 @@
        prim->id = id;

        osmo_static_assert(sizeof(HANDLE) >= 4, l1p_handle_is_at_least_32bit);
-       hLayer3 = (void*)hLayer3_uint32;
+       hLayer3 = (void*)(intptr_t)hLayer3_uint32;

        switch (id) {
        case GsmL1_PrimId_MphInitReq:
@@ -425,7 +427,7 @@
 {
        struct lc15l1_hdl *fl1h = trx_lc15l1_hdl(trx);

-       return fl1h->hLayer1;
+       return (uint32_t)(intptr_t)fl1h->hLayer1;
 }

 static int trx_close_compl_cb(struct gsm_bts_trx *trx, struct msgb *l1_msg,
@@ -793,10 +795,10 @@
        GsmL1_MphActivateCnf_t *ic = &l1p->u.mphActivateCnf;

        /* get the lchan from the information we supplied */
-       lchan = l1if_hLayer_to_lchan(trx, (uint32_t)ic->hLayer3);
+       lchan = l1if_hLayer_to_lchan(trx, ic->hLayer3);
        if (!lchan) {
                LOGP(DL1C, LOGL_ERROR,
-                       "Failed to find lchan for hLayer3=0x%x\n", 
(uint32_t)ic->hLayer3);
+                       "Failed to find lchan for hLayer3=0x%"PRIx32"\n", 
(uint32_t)(intptr_t)ic->hLayer3);
                goto err;
        }

@@ -847,21 +849,22 @@
        return 0;
 }

-uint32_t l1if_lchan_to_hLayer(struct gsm_lchan *lchan)
+HANDLE l1if_lchan_to_hLayer(struct gsm_lchan *lchan)
 {
-       return 0xBB
+       return (HANDLE)(intptr_t)(0xBB
                | (lchan->nr << 8)
                | (lchan->ts->nr << 16)
-               | (lchan->ts->trx->nr << 24);
+               | (lchan->ts->trx->nr << 24));
 }

 /* obtain a ptr to the lapdm_channel for a given hLayer */
 struct gsm_lchan *
-l1if_hLayer_to_lchan(struct gsm_bts_trx *trx, uint32_t hLayer2)
+l1if_hLayer_to_lchan(struct gsm_bts_trx *trx, HANDLE hLayer2)
 {
-       uint8_t magic = hLayer2 & 0xff;
-       uint8_t ts_nr = (hLayer2 >> 16) & 0xff;
-       uint8_t lchan_nr = (hLayer2 >> 8)& 0xff;
+       uint32_t hLayer2_u32 = (uint32_t)(intptr_t)hLayer2;
+       uint8_t magic = hLayer2_u32 & 0xff;
+       uint8_t ts_nr = (hLayer2_u32 >> 16) & 0xff;
+       uint8_t lchan_nr = (hLayer2_u32 >> 8)& 0xff;
        struct gsm_bts_trx_ts *ts;

        if (magic != 0xBB)
@@ -1062,7 +1065,7 @@
        }

        LOGP(DL1C, LOGL_INFO, "%s MPH-ACTIVATE.req (hL2=0x%08x, %s ",
-               gsm_lchan_name(lchan), (uint32_t)act_req->hLayer2,
+               gsm_lchan_name(lchan), (uint32_t)(intptr_t)act_req->hLayer2,
                get_value_string(lc15bts_l1sapi_names, act_req->sapi));
        LOGPC(DL1C, LOGL_INFO, "%s)\n",
                get_value_string(lc15bts_dir_names, act_req->dir));
@@ -1235,10 +1238,10 @@
        GsmL1_MphConfigCnf_t *cc = &l1p->u.mphConfigCnf;

        /* get the lchan from the information we supplied */
-       lchan = l1if_hLayer_to_lchan(trx, (uint32_t)cc->hLayer3);
+       lchan = l1if_hLayer_to_lchan(trx, cc->hLayer3);
        if (!lchan) {
                LOGP(DL1C, LOGL_ERROR,
-                       "Failed to find lchan for hLayer3=0x%x\n", 
(uint32_t)cc->hLayer3);
+                       "Failed to find lchan for hLayer3=0x%"PRIx32"\n", 
(uint32_t)(intptr_t)cc->hLayer3);
                goto err;
        }

@@ -1470,10 +1473,10 @@
        GsmL1_Prim_t *l1p = msgb_l1prim(l1_msg);
        GsmL1_MphDeactivateCnf_t *ic = &l1p->u.mphDeactivateCnf;

-       lchan = l1if_hLayer_to_lchan(trx, (uint32_t)ic->hLayer3);
+       lchan = l1if_hLayer_to_lchan(trx, ic->hLayer3);
        if (!lchan) {
                LOGP(DL1C, LOGL_ERROR,
-                       "Failed to find lchan for hLayer3=0x%x\n", 
(uint32_t)ic->hLayer3);
+                       "Failed to find lchan for hLayer3=0x%"PRIx32"\n", 
(uint32_t)(intptr_t)ic->hLayer3);
                goto err;
        }


--
To view, visit https://gerrit.osmocom.org/9531
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4193ad5fdb70ea01acb7c33656ea7bfd3fe62916
Gerrit-Change-Number: 9531
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pes...@sysmocom.de>

Reply via email to