Bluetooth: RFCOMM: Pass session instead of dlc in make_uih_msg()
rfcomm_make_uih_msg() only needs session to get the role while creating msg. This is mainly done since some commands like Test and RPN may come even before dlc is created. Change-Id: Ifd5a2ceaf17c20db3f00604cd2b4f1759155123e Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
This commit is contained in:
parent
ba2adb70b2
commit
61f34fd966
1 changed files with 7 additions and 5 deletions
|
@ -336,7 +336,7 @@ static int rfcomm_send_sabm(struct bt_rfcomm_session *session, uint8_t dlci)
|
|||
return bt_l2cap_chan_send(&session->br_chan.chan, buf);
|
||||
}
|
||||
|
||||
static struct net_buf *rfcomm_make_uih_msg(struct bt_rfcomm_dlc *dlc,
|
||||
static struct net_buf *rfcomm_make_uih_msg(struct bt_rfcomm_session *session,
|
||||
uint8_t cr, uint8_t type,
|
||||
uint8_t len)
|
||||
{
|
||||
|
@ -348,7 +348,7 @@ static struct net_buf *rfcomm_make_uih_msg(struct bt_rfcomm_dlc *dlc,
|
|||
buf = bt_l2cap_create_pdu(&rfcomm_session_pool, K_FOREVER);
|
||||
|
||||
hdr = net_buf_add(buf, sizeof(*hdr));
|
||||
hdr_cr = BT_RFCOMM_UIH_CR(dlc->session->role);
|
||||
hdr_cr = BT_RFCOMM_UIH_CR(session->role);
|
||||
hdr->address = BT_RFCOMM_SET_ADDR(0, hdr_cr);
|
||||
hdr->control = BT_RFCOMM_SET_CTRL(BT_RFCOMM_UIH, BT_RFCOMM_PF_UIH);
|
||||
hdr->length = BT_RFCOMM_SET_LEN_8(sizeof(*msg_hdr) + len);
|
||||
|
@ -567,7 +567,8 @@ static int rfcomm_send_msc(struct bt_rfcomm_dlc *dlc, uint8_t cr)
|
|||
struct net_buf *buf;
|
||||
uint8_t fcs;
|
||||
|
||||
buf = rfcomm_make_uih_msg(dlc, cr, BT_RFCOMM_MSC, sizeof(*msc));
|
||||
buf = rfcomm_make_uih_msg(dlc->session, cr, BT_RFCOMM_MSC,
|
||||
sizeof(*msc));
|
||||
|
||||
msc = net_buf_add(buf, sizeof(*msc));
|
||||
/* cr bit should be always 1 in MSC */
|
||||
|
@ -587,7 +588,8 @@ static int rfcomm_send_rls(struct bt_rfcomm_dlc *dlc, uint8_t cr,
|
|||
struct net_buf *buf;
|
||||
uint8_t fcs;
|
||||
|
||||
buf = rfcomm_make_uih_msg(dlc, cr, BT_RFCOMM_RLS, sizeof(*rls));
|
||||
buf = rfcomm_make_uih_msg(dlc->session, cr, BT_RFCOMM_RLS,
|
||||
sizeof(*rls));
|
||||
|
||||
rls = net_buf_add(buf, sizeof(*rls));
|
||||
/* cr bit should be always 1 in RLS */
|
||||
|
@ -746,7 +748,7 @@ static int rfcomm_send_pn(struct bt_rfcomm_dlc *dlc, uint8_t cr)
|
|||
struct net_buf *buf;
|
||||
uint8_t fcs;
|
||||
|
||||
buf = rfcomm_make_uih_msg(dlc, cr, BT_RFCOMM_PN, sizeof(*pn));
|
||||
buf = rfcomm_make_uih_msg(dlc->session, cr, BT_RFCOMM_PN, sizeof(*pn));
|
||||
|
||||
BT_DBG("mtu %x", dlc->mtu);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue