[Bluetooth] Some cleanups for HCI event handling
Some minor cosmetic cleanups to the HCI event handling to make the code easier to read and understand. Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
parent
e4e8e37c42
commit
f383f2750a
|
@ -198,11 +198,13 @@ static void hci_cc_write_local_name(struct hci_dev *hdev, struct sk_buff *skb)
|
||||||
|
|
||||||
BT_DBG("%s status 0x%x", hdev->name, status);
|
BT_DBG("%s status 0x%x", hdev->name, status);
|
||||||
|
|
||||||
|
if (status)
|
||||||
|
return;
|
||||||
|
|
||||||
sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_LOCAL_NAME);
|
sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_LOCAL_NAME);
|
||||||
if (!sent)
|
if (!sent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!status)
|
|
||||||
memcpy(hdev->dev_name, sent, 248);
|
memcpy(hdev->dev_name, sent, 248);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,11 +315,13 @@ static void hci_cc_write_class_of_dev(struct hci_dev *hdev, struct sk_buff *skb)
|
||||||
|
|
||||||
BT_DBG("%s status 0x%x", hdev->name, status);
|
BT_DBG("%s status 0x%x", hdev->name, status);
|
||||||
|
|
||||||
|
if (status)
|
||||||
|
return;
|
||||||
|
|
||||||
sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_CLASS_OF_DEV);
|
sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_CLASS_OF_DEV);
|
||||||
if (!sent)
|
if (!sent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!status)
|
|
||||||
memcpy(hdev->dev_class, sent, 3);
|
memcpy(hdev->dev_class, sent, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,18 +354,23 @@ static void hci_cc_read_voice_setting(struct hci_dev *hdev, struct sk_buff *skb)
|
||||||
static void hci_cc_write_voice_setting(struct hci_dev *hdev, struct sk_buff *skb)
|
static void hci_cc_write_voice_setting(struct hci_dev *hdev, struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
__u8 status = *((__u8 *) skb->data);
|
__u8 status = *((__u8 *) skb->data);
|
||||||
|
__u16 setting;
|
||||||
void *sent;
|
void *sent;
|
||||||
|
|
||||||
BT_DBG("%s status 0x%x", hdev->name, status);
|
BT_DBG("%s status 0x%x", hdev->name, status);
|
||||||
|
|
||||||
|
if (status)
|
||||||
|
return;
|
||||||
|
|
||||||
sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_VOICE_SETTING);
|
sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_VOICE_SETTING);
|
||||||
if (!sent)
|
if (!sent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!status) {
|
setting = get_unaligned_le16(sent);
|
||||||
__u16 setting = get_unaligned_le16(sent);
|
|
||||||
|
if (hdev->voice_setting == setting)
|
||||||
|
return;
|
||||||
|
|
||||||
if (hdev->voice_setting != setting) {
|
|
||||||
hdev->voice_setting = setting;
|
hdev->voice_setting = setting;
|
||||||
|
|
||||||
BT_DBG("%s voice setting 0x%04x", hdev->name, setting);
|
BT_DBG("%s voice setting 0x%04x", hdev->name, setting);
|
||||||
|
@ -372,8 +381,6 @@ static void hci_cc_write_voice_setting(struct hci_dev *hdev, struct sk_buff *skb
|
||||||
tasklet_enable(&hdev->tx_task);
|
tasklet_enable(&hdev->tx_task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void hci_cc_host_buffer_size(struct hci_dev *hdev, struct sk_buff *skb)
|
static void hci_cc_host_buffer_size(struct hci_dev *hdev, struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue