Bluetooth: Add led_off callback to manually turn off the LED before closing device
Subsystems (2)
RFC 1/2 Bluetooth: Add led_off callback to manually turn off the LED before closing device
From: Tedd Ho-Jeong An <[email protected]>
This callback allows a vendor to send the vendor specific command, for example turn off the LED, before cloing the hci interface.
Signed-off-by Tedd Ho-Jeong An <[email protected]>
--- include/net/bluetooth/hci_core.h | 1 + net/bluetooth/hci_core.c | 4 ++++ 2 files changed, 5 insertions(+)
include/net/bluetooth/hci_core.h +1 -0
@@ -377,6 +377,7 @@ struct hci_dev {void (*notify)(struct hci_dev *hdev,unsigned int evt);void (*hw_error)(struct hci_dev *hdev,u8 code);int (*set_bdaddr)(struct hci_dev *hdev,const bdaddr_t *bdaddr); +int (*led_off)(struct hci_dev *hdev); };#define HCI_PHY_HANDLE (handle) (handle & 0xff)
net/bluetooth/hci_core.c +4 -0
@@ -1591,6 +1591,10 @@ static int hci_dev_do_close(struct hci_dev *hdev) {BT_DBG ("%s %p" , hdev->name, hdev); +/* allows vendors to send the command before close the device */ +if (!test_bit (HCI_UNREGISTER , &hdev->dev_flags) && hdev->led_off) + hdev->led_off (hdev); +cancel_delayed_work (&hdev->power_off);hci_req_cancel (hdev,ENODEV );
Signature · 1 line
1.9.1
Marcel Holtmann
maintainerHi Tedd,
Quoted 14 lines
This callback allows a vendor to send the vendor specific command, for example turn off the LED, before cloing the hci interface.
Signed-off-by Tedd Ho-Jeong An <[email protected]>---
include/net/bluetooth/hci_core.h| 1 +net/bluetooth/hci_core.c| 4 ++++2 files changed, 5 insertions(+)include/net/bluetooth/hci_core.h +0
-0
include/net/bluetooth/hci_core.h struct hci_dev { · line 381
Quoted 5 lines
include/net/bluetooth/hci_core.h +1
-0@@ -377,6 +377,7 @@ struct hci_dev {void (*notify)(struct hci_dev *hdev,unsigned int evt);void (*hw_error)(struct hci_dev *hdev,u8 code);int (*set_bdaddr)(struct hci_dev *hdev,const bdaddr_t *bdaddr); +int (*led_off)(struct hci_dev *hdev); };
so I actually wonder if this is not better called shutdown() and we ensure that it is always called before close() callback. The name led_off() seems to be pretty specific.
Regards
Marcel