Commit 26d46dff authored by Johan Hedberg's avatar Johan Hedberg Committed by Marcel Holtmann

Bluetooth: 6lowpan: Remove unnecessary chan_get() function

The chan_get() function just adds unnecessary indirection to calling
the chan_create() call. The only added value it gives is the chan->ops
assignment, but that can equally well be done in the calling code.
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
Acked-by: default avatarJukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 0cd088fc
...@@ -1051,28 +1051,17 @@ static inline __u8 bdaddr_type(__u8 type) ...@@ -1051,28 +1051,17 @@ static inline __u8 bdaddr_type(__u8 type)
return BDADDR_LE_RANDOM; return BDADDR_LE_RANDOM;
} }
static struct l2cap_chan *chan_get(void)
{
struct l2cap_chan *chan;
chan = chan_create();
if (!chan)
return NULL;
chan->ops = &bt_6lowpan_chan_ops;
return chan;
}
static int bt_6lowpan_connect(bdaddr_t *addr, u8 dst_type) static int bt_6lowpan_connect(bdaddr_t *addr, u8 dst_type)
{ {
struct l2cap_chan *chan; struct l2cap_chan *chan;
int err; int err;
chan = chan_get(); chan = chan_create();
if (!chan) if (!chan)
return -EINVAL; return -EINVAL;
chan->ops = &bt_6lowpan_chan_ops;
err = l2cap_chan_connect(chan, cpu_to_le16(L2CAP_PSM_IPSP), 0, err = l2cap_chan_connect(chan, cpu_to_le16(L2CAP_PSM_IPSP), 0,
addr, dst_type); addr, dst_type);
...@@ -1109,10 +1098,11 @@ static struct l2cap_chan *bt_6lowpan_listen(void) ...@@ -1109,10 +1098,11 @@ static struct l2cap_chan *bt_6lowpan_listen(void)
if (!enable_6lowpan) if (!enable_6lowpan)
return NULL; return NULL;
chan = chan_get(); chan = chan_create();
if (!chan) if (!chan)
return NULL; return NULL;
chan->ops = &bt_6lowpan_chan_ops;
chan->state = BT_LISTEN; chan->state = BT_LISTEN;
chan->src_type = BDADDR_LE_PUBLIC; chan->src_type = BDADDR_LE_PUBLIC;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment