diff options
-rw-r--r-- | net/bluetooth/rfcomm/core.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index bce9c3d39324..64e20dde4837 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c | |||
@@ -81,6 +81,8 @@ static struct rfcomm_session *rfcomm_session_del(struct rfcomm_session *s); | |||
81 | #define __test_cr(b) (!!(b & 0x02)) | 81 | #define __test_cr(b) (!!(b & 0x02)) |
82 | #define __test_pf(b) (!!(b & 0x10)) | 82 | #define __test_pf(b) (!!(b & 0x10)) |
83 | 83 | ||
84 | #define __session_dir(s) ((s)->initiator ? 0x00 : 0x01) | ||
85 | |||
84 | #define __addr(cr, dlci) (((dlci & 0x3f) << 2) | (cr << 1) | 0x01) | 86 | #define __addr(cr, dlci) (((dlci & 0x3f) << 2) | (cr << 1) | 0x01) |
85 | #define __ctrl(type, pf) (((type & 0xef) | (pf << 4))) | 87 | #define __ctrl(type, pf) (((type & 0xef) | (pf << 4))) |
86 | #define __dlci(dir, chn) (((chn & 0x1f) << 1) | dir) | 88 | #define __dlci(dir, chn) (((chn & 0x1f) << 1) | dir) |
@@ -388,7 +390,7 @@ static int __rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst, | |||
388 | return err; | 390 | return err; |
389 | } | 391 | } |
390 | 392 | ||
391 | dlci = __dlci(!s->initiator, channel); | 393 | dlci = __dlci(__session_dir(s), channel); |
392 | 394 | ||
393 | /* Check if DLCI already exists */ | 395 | /* Check if DLCI already exists */ |
394 | if (rfcomm_dlc_get(s, dlci)) | 396 | if (rfcomm_dlc_get(s, dlci)) |
@@ -543,7 +545,7 @@ struct rfcomm_dlc *rfcomm_dlc_exists(bdaddr_t *src, bdaddr_t *dst, u8 channel) | |||
543 | rfcomm_lock(); | 545 | rfcomm_lock(); |
544 | s = rfcomm_session_get(src, dst); | 546 | s = rfcomm_session_get(src, dst); |
545 | if (s) { | 547 | if (s) { |
546 | dlci = __dlci(!s->initiator, channel); | 548 | dlci = __dlci(__session_dir(s), channel); |
547 | dlc = rfcomm_dlc_get(s, dlci); | 549 | dlc = rfcomm_dlc_get(s, dlci); |
548 | } | 550 | } |
549 | rfcomm_unlock(); | 551 | rfcomm_unlock(); |