Skip to content

Commit

Permalink
Bluetooth: Replace send_monitor_event with queue_monitor_skb
Browse files Browse the repository at this point in the history
The send_monitor_event function is essentially the same as the newly
introduced queue_monitor_skb. So instead of having duplicated code,
replace send_monitor_event with queue_monitor_skb.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
  • Loading branch information
Marcel Holtmann authored and Johan Hedberg committed Jan 12, 2015
1 parent d7f72f6 commit 41e91e7
Showing 1 changed file with 1 addition and 29 deletions.
30 changes: 1 addition & 29 deletions net/bluetooth/hci_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,34 +294,6 @@ void hci_send_to_monitor(struct hci_dev *hdev, struct sk_buff *skb)
kfree_skb(skb_copy);
}

static void send_monitor_event(struct sk_buff *skb)
{
struct sock *sk;

BT_DBG("len %d", skb->len);

read_lock(&hci_sk_list.lock);

sk_for_each(sk, &hci_sk_list.head) {
struct sk_buff *nskb;

if (sk->sk_state != BT_BOUND)
continue;

if (hci_pi(sk)->channel != HCI_CHANNEL_MONITOR)
continue;

nskb = skb_clone(skb, GFP_ATOMIC);
if (!nskb)
continue;

if (sock_queue_rcv_skb(sk, nskb))
kfree_skb(nskb);
}

read_unlock(&hci_sk_list.lock);
}

static struct sk_buff *create_monitor_event(struct hci_dev *hdev, int event)
{
struct hci_mon_hdr *hdr;
Expand Down Expand Up @@ -425,7 +397,7 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event)

skb = create_monitor_event(hdev, event);
if (skb) {
send_monitor_event(skb);
queue_monitor_skb(skb);
kfree_skb(skb);
}
}
Expand Down

0 comments on commit 41e91e7

Please sign in to comment.