diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2011-11-08 05:25:52 -0500 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-11-08 10:01:53 -0500 |
commit | 889d07ee57e950790cbec81df7b4f9d8691ee0b4 (patch) | |
tree | 6092594b4133dd209570dd49a2b97ceccf7b7586 /net/bluetooth | |
parent | 3243553fdc108a0ef49b9e25bdea9c87b341413e (diff) |
Bluetooth: Remove redundant code from mgmt_block & mgmt_unblock
There's no need to deal with mgmt_pending_cmd when blocking and
unblocking devices since these actions are synchronous.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/mgmt.c | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 6f9e3cd0d1fd..e33b12e09270 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -1671,7 +1671,6 @@ static int block_device(struct sock *sk, u16 index, unsigned char *data, | |||
1671 | u16 len) | 1671 | u16 len) |
1672 | { | 1672 | { |
1673 | struct hci_dev *hdev; | 1673 | struct hci_dev *hdev; |
1674 | struct pending_cmd *cmd; | ||
1675 | struct mgmt_cp_block_device *cp = (void *) data; | 1674 | struct mgmt_cp_block_device *cp = (void *) data; |
1676 | int err; | 1675 | int err; |
1677 | 1676 | ||
@@ -1688,23 +1687,13 @@ static int block_device(struct sock *sk, u16 index, unsigned char *data, | |||
1688 | 1687 | ||
1689 | hci_dev_lock_bh(hdev); | 1688 | hci_dev_lock_bh(hdev); |
1690 | 1689 | ||
1691 | cmd = mgmt_pending_add(sk, MGMT_OP_BLOCK_DEVICE, index, NULL, 0); | ||
1692 | if (!cmd) { | ||
1693 | err = -ENOMEM; | ||
1694 | goto failed; | ||
1695 | } | ||
1696 | |||
1697 | err = hci_blacklist_add(hdev, &cp->bdaddr); | 1690 | err = hci_blacklist_add(hdev, &cp->bdaddr); |
1698 | |||
1699 | if (err < 0) | 1691 | if (err < 0) |
1700 | err = cmd_status(sk, index, MGMT_OP_BLOCK_DEVICE, -err); | 1692 | err = cmd_status(sk, index, MGMT_OP_BLOCK_DEVICE, -err); |
1701 | else | 1693 | else |
1702 | err = cmd_complete(sk, index, MGMT_OP_BLOCK_DEVICE, | 1694 | err = cmd_complete(sk, index, MGMT_OP_BLOCK_DEVICE, |
1703 | NULL, 0); | 1695 | NULL, 0); |
1704 | 1696 | ||
1705 | mgmt_pending_remove(cmd); | ||
1706 | |||
1707 | failed: | ||
1708 | hci_dev_unlock_bh(hdev); | 1697 | hci_dev_unlock_bh(hdev); |
1709 | hci_dev_put(hdev); | 1698 | hci_dev_put(hdev); |
1710 | 1699 | ||
@@ -1715,7 +1704,6 @@ static int unblock_device(struct sock *sk, u16 index, unsigned char *data, | |||
1715 | u16 len) | 1704 | u16 len) |
1716 | { | 1705 | { |
1717 | struct hci_dev *hdev; | 1706 | struct hci_dev *hdev; |
1718 | struct pending_cmd *cmd; | ||
1719 | struct mgmt_cp_unblock_device *cp = (void *) data; | 1707 | struct mgmt_cp_unblock_device *cp = (void *) data; |
1720 | int err; | 1708 | int err; |
1721 | 1709 | ||
@@ -1732,12 +1720,6 @@ static int unblock_device(struct sock *sk, u16 index, unsigned char *data, | |||
1732 | 1720 | ||
1733 | hci_dev_lock_bh(hdev); | 1721 | hci_dev_lock_bh(hdev); |
1734 | 1722 | ||
1735 | cmd = mgmt_pending_add(sk, MGMT_OP_UNBLOCK_DEVICE, index, NULL, 0); | ||
1736 | if (!cmd) { | ||
1737 | err = -ENOMEM; | ||
1738 | goto failed; | ||
1739 | } | ||
1740 | |||
1741 | err = hci_blacklist_del(hdev, &cp->bdaddr); | 1723 | err = hci_blacklist_del(hdev, &cp->bdaddr); |
1742 | 1724 | ||
1743 | if (err < 0) | 1725 | if (err < 0) |
@@ -1746,9 +1728,6 @@ static int unblock_device(struct sock *sk, u16 index, unsigned char *data, | |||
1746 | err = cmd_complete(sk, index, MGMT_OP_UNBLOCK_DEVICE, | 1728 | err = cmd_complete(sk, index, MGMT_OP_UNBLOCK_DEVICE, |
1747 | NULL, 0); | 1729 | NULL, 0); |
1748 | 1730 | ||
1749 | mgmt_pending_remove(cmd); | ||
1750 | |||
1751 | failed: | ||
1752 | hci_dev_unlock_bh(hdev); | 1731 | hci_dev_unlock_bh(hdev); |
1753 | hci_dev_put(hdev); | 1732 | hci_dev_put(hdev); |
1754 | 1733 | ||