aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/l2cap_core.c
diff options
context:
space:
mode:
authorGustavo Padovan <gustavo.padovan@collabora.co.uk>2012-05-27 21:27:54 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2012-06-04 23:34:11 -0400
commit0797e01d877b9677d07b89e0776c061df8878f27 (patch)
treec29271d0eac5b7d754149bc91929a47df4d90544 /net/bluetooth/l2cap_core.c
parent54a59aa2b562872781d6a8fc89f300d360941691 (diff)
Bluetooth: Use chan->state instead of sk->sk_state
These vars are kept in sync so we can use chan->state here. Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/l2cap_core.c')
-rw-r--r--net/bluetooth/l2cap_core.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 5947eb1c1be..35e6d7dd329 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1442,21 +1442,17 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
1442 goto done; 1442 goto done;
1443 } 1443 }
1444 1444
1445 lock_sock(sk); 1445 switch (chan->state) {
1446
1447 switch (sk->sk_state) {
1448 case BT_CONNECT: 1446 case BT_CONNECT:
1449 case BT_CONNECT2: 1447 case BT_CONNECT2:
1450 case BT_CONFIG: 1448 case BT_CONFIG:
1451 /* Already connecting */ 1449 /* Already connecting */
1452 err = 0; 1450 err = 0;
1453 release_sock(sk);
1454 goto done; 1451 goto done;
1455 1452
1456 case BT_CONNECTED: 1453 case BT_CONNECTED:
1457 /* Already connected */ 1454 /* Already connected */
1458 err = -EISCONN; 1455 err = -EISCONN;
1459 release_sock(sk);
1460 goto done; 1456 goto done;
1461 1457
1462 case BT_OPEN: 1458 case BT_OPEN:
@@ -1466,13 +1462,12 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
1466 1462
1467 default: 1463 default:
1468 err = -EBADFD; 1464 err = -EBADFD;
1469 release_sock(sk);
1470 goto done; 1465 goto done;
1471 } 1466 }
1472 1467
1473 /* Set destination address and psm */ 1468 /* Set destination address and psm */
1469 lock_sock(sk);
1474 bacpy(&bt_sk(sk)->dst, dst); 1470 bacpy(&bt_sk(sk)->dst, dst);
1475
1476 release_sock(sk); 1471 release_sock(sk);
1477 1472
1478 chan->psm = psm; 1473 chan->psm = psm;