Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7a00ff44 authored by Johan Hedberg's avatar Johan Hedberg Committed by Marcel Holtmann
Browse files

Bluetooth: Add mgmt_send_event() helper to send to any HCI channel



Currently the mgmt_event() function is only capable of sending to
HCI_CHANNEL_CONTROL. To void having to change all users of it, add a new
mgmt_send_event() function that takes a channel parameter, and make the
old mgmt_event() a wrapper that passes MGMT_CHANNEL_CONTROL to it.

Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 3b0602cd
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -219,7 +219,8 @@ static u8 mgmt_status(u8 hci_status)
	return MGMT_STATUS_FAILED;
}

static int mgmt_event(u16 event, struct hci_dev *hdev, void *data, u16 data_len,
static int mgmt_send_event(u16 event, struct hci_dev *hdev,
			   unsigned short channel, void *data, u16 data_len,
			   struct sock *skip_sk)
{
	struct sk_buff *skb;
@@ -243,12 +244,19 @@ static int mgmt_event(u16 event, struct hci_dev *hdev, void *data, u16 data_len,
	/* Time stamp */
	__net_timestamp(skb);

	hci_send_to_channel(HCI_CHANNEL_CONTROL, skb, skip_sk);
	hci_send_to_channel(channel, skb, skip_sk);
	kfree_skb(skb);

	return 0;
}

static int mgmt_event(u16 event, struct hci_dev *hdev, void *data, u16 len,
		      struct sock *skip_sk)
{
	return mgmt_send_event(event, hdev, HCI_CHANNEL_CONTROL, data, len,
			       skip_sk);
}

static int mgmt_cmd_status(struct sock *sk, u16 index, u16 cmd, u8 status)
{
	struct sk_buff *skb;