static void l2cap_tx(struct l2cap_chan *chan, struct l2cap_ctrl *control,
                     struct sk_buff_head *skbs, u8 event);
 
-static inline __u8 bdaddr_type(struct hci_conn *hcon, __u8 type)
+static inline u8 bdaddr_type(u8 link_type, u8 bdaddr_type)
 {
-       if (hcon->type == LE_LINK) {
-               if (type == ADDR_LE_DEV_PUBLIC)
+       if (link_type == LE_LINK) {
+               if (bdaddr_type == ADDR_LE_DEV_PUBLIC)
                        return BDADDR_LE_PUBLIC;
                else
                        return BDADDR_LE_RANDOM;
        return BDADDR_BREDR;
 }
 
+static inline u8 bdaddr_src_type(struct hci_conn *hcon)
+{
+       return bdaddr_type(hcon->type, hcon->src_type);
+}
+
+static inline u8 bdaddr_dst_type(struct hci_conn *hcon)
+{
+       return bdaddr_type(hcon->type, hcon->dst_type);
+}
+
 /* ---- L2CAP channels ---- */
 
 static struct l2cap_chan *__l2cap_get_chan_by_dcid(struct l2cap_conn *conn,
        list_for_each_entry(chan, &conn->chan_l, list) {
                l2cap_chan_lock(chan);
                bacpy(&chan->dst, &hcon->dst);
-               chan->dst_type = bdaddr_type(hcon, hcon->dst_type);
+               chan->dst_type = bdaddr_dst_type(hcon);
                l2cap_chan_unlock(chan);
        }
 
 
        bacpy(&chan->src, &conn->hcon->src);
        bacpy(&chan->dst, &conn->hcon->dst);
-       chan->src_type = bdaddr_type(conn->hcon, conn->hcon->src_type);
-       chan->dst_type = bdaddr_type(conn->hcon, conn->hcon->dst_type);
+       chan->src_type = bdaddr_src_type(conn->hcon);
+       chan->dst_type = bdaddr_dst_type(conn->hcon);
        chan->psm  = psm;
        chan->dcid = scid;
        chan->local_amp_id = amp_id;
 
        bacpy(&chan->src, &conn->hcon->src);
        bacpy(&chan->dst, &conn->hcon->dst);
-       chan->src_type = bdaddr_type(conn->hcon, conn->hcon->src_type);
-       chan->dst_type = bdaddr_type(conn->hcon, conn->hcon->dst_type);
+       chan->src_type = bdaddr_src_type(conn->hcon);
+       chan->dst_type = bdaddr_dst_type(conn->hcon);
        chan->psm  = psm;
        chan->dcid = scid;
        chan->omtu = mtu;
         */
        if (hcon->type == LE_LINK &&
            hci_bdaddr_list_lookup(&hcon->hdev->blacklist, &hcon->dst,
-                                  bdaddr_type(hcon, hcon->dst_type))) {
+                                  bdaddr_dst_type(hcon))) {
                kfree_skb(skb);
                return;
        }
 
        /* Update source addr of the socket */
        bacpy(&chan->src, &hcon->src);
-       chan->src_type = bdaddr_type(hcon, hcon->src_type);
+       chan->src_type = bdaddr_src_type(hcon);
 
        __l2cap_chan_add(conn, chan);
 
        if (!conn)
                return;
 
-       dst_type = bdaddr_type(hcon, hcon->dst_type);
+       dst_type = bdaddr_dst_type(hcon);
 
        /* If device is blocked, do not create channels for it */
        if (hci_bdaddr_list_lookup(&hdev->blacklist, &hcon->dst, dst_type))
                if (chan) {
                        bacpy(&chan->src, &hcon->src);
                        bacpy(&chan->dst, &hcon->dst);
-                       chan->src_type = bdaddr_type(hcon, hcon->src_type);
+                       chan->src_type = bdaddr_src_type(hcon);
                        chan->dst_type = dst_type;
 
                        __l2cap_chan_add(conn, chan);