mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
Bluetooth: Get rid of cmd_timeout and use the reset callback
The hdev->reset is never used now and the hdev->cmd_timeout actually does reset. This patch changes the call path from hdev->cmd_timeout -> vendor_cmd_timeout -> btusb_reset -> hdev->reset , to hdev->reset -> vendor_reset -> btusb_reset Which makes it clear when we export the hdev->reset to a wider usage e.g. allowing reset from sysfs. This patch doesn't introduce any behavior change. Signed-off-by: Hsin-chen Chuang <chharry@chromium.org> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
7c39342175
commit
f07d478090
5 changed files with 16 additions and 17 deletions
|
@ -1249,7 +1249,7 @@ static int btmtksdio_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void btmtksdio_cmd_timeout(struct hci_dev *hdev)
|
||||
static void btmtksdio_reset(struct hci_dev *hdev)
|
||||
{
|
||||
struct btmtksdio_dev *bdev = hci_get_drvdata(hdev);
|
||||
u32 status;
|
||||
|
@ -1360,7 +1360,7 @@ static int btmtksdio_probe(struct sdio_func *func,
|
|||
|
||||
hdev->open = btmtksdio_open;
|
||||
hdev->close = btmtksdio_close;
|
||||
hdev->cmd_timeout = btmtksdio_cmd_timeout;
|
||||
hdev->reset = btmtksdio_reset;
|
||||
hdev->flush = btmtksdio_flush;
|
||||
hdev->setup = btmtksdio_setup;
|
||||
hdev->shutdown = btmtksdio_shutdown;
|
||||
|
|
|
@ -916,7 +916,7 @@ static void btusb_reset(struct hci_dev *hdev)
|
|||
usb_queue_reset_device(data->intf);
|
||||
}
|
||||
|
||||
static void btusb_intel_cmd_timeout(struct hci_dev *hdev)
|
||||
static void btusb_intel_reset(struct hci_dev *hdev)
|
||||
{
|
||||
struct btusb_data *data = hci_get_drvdata(hdev);
|
||||
struct gpio_desc *reset_gpio = data->reset_gpio;
|
||||
|
@ -994,7 +994,7 @@ static inline void btusb_rtl_alloc_devcoredump(struct hci_dev *hdev,
|
|||
}
|
||||
}
|
||||
|
||||
static void btusb_rtl_cmd_timeout(struct hci_dev *hdev)
|
||||
static void btusb_rtl_reset(struct hci_dev *hdev)
|
||||
{
|
||||
struct btusb_data *data = hci_get_drvdata(hdev);
|
||||
struct gpio_desc *reset_gpio = data->reset_gpio;
|
||||
|
@ -1038,13 +1038,13 @@ static void btusb_rtl_hw_error(struct hci_dev *hdev, u8 code)
|
|||
btusb_rtl_alloc_devcoredump(hdev, &hdr, NULL, 0);
|
||||
}
|
||||
|
||||
static void btusb_qca_cmd_timeout(struct hci_dev *hdev)
|
||||
static void btusb_qca_reset(struct hci_dev *hdev)
|
||||
{
|
||||
struct btusb_data *data = hci_get_drvdata(hdev);
|
||||
struct gpio_desc *reset_gpio = data->reset_gpio;
|
||||
|
||||
if (test_bit(BTUSB_HW_SSR_ACTIVE, &data->flags)) {
|
||||
bt_dev_info(hdev, "Ramdump in progress, defer cmd_timeout");
|
||||
bt_dev_info(hdev, "Ramdump in progress, defer reset");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3868,7 +3868,7 @@ static int btusb_probe(struct usb_interface *intf,
|
|||
|
||||
/* Transport specific configuration */
|
||||
hdev->send = btusb_send_frame_intel;
|
||||
hdev->cmd_timeout = btusb_intel_cmd_timeout;
|
||||
hdev->reset = btusb_intel_reset;
|
||||
|
||||
if (id->driver_info & BTUSB_INTEL_NO_WBS_SUPPORT)
|
||||
btintel_set_flag(hdev, INTEL_ROM_LEGACY_NO_WBS_SUPPORT);
|
||||
|
@ -3888,7 +3888,7 @@ static int btusb_probe(struct usb_interface *intf,
|
|||
hdev->setup = btusb_mtk_setup;
|
||||
hdev->shutdown = btusb_mtk_shutdown;
|
||||
hdev->manufacturer = 70;
|
||||
hdev->cmd_timeout = btmtk_reset_sync;
|
||||
hdev->reset = btmtk_reset_sync;
|
||||
hdev->set_bdaddr = btmtk_set_bdaddr;
|
||||
hdev->send = btusb_send_frame_mtk;
|
||||
set_bit(HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN, &hdev->quirks);
|
||||
|
@ -3920,7 +3920,7 @@ static int btusb_probe(struct usb_interface *intf,
|
|||
data->setup_on_usb = btusb_setup_qca;
|
||||
hdev->shutdown = btusb_shutdown_qca;
|
||||
hdev->set_bdaddr = btusb_set_bdaddr_ath3012;
|
||||
hdev->cmd_timeout = btusb_qca_cmd_timeout;
|
||||
hdev->reset = btusb_qca_reset;
|
||||
set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
|
||||
btusb_check_needs_reset_resume(intf);
|
||||
}
|
||||
|
@ -3934,7 +3934,7 @@ static int btusb_probe(struct usb_interface *intf,
|
|||
data->setup_on_usb = btusb_setup_qca;
|
||||
hdev->shutdown = btusb_shutdown_qca;
|
||||
hdev->set_bdaddr = btusb_set_bdaddr_wcn6855;
|
||||
hdev->cmd_timeout = btusb_qca_cmd_timeout;
|
||||
hdev->reset = btusb_qca_reset;
|
||||
set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
|
||||
hci_set_msft_opcode(hdev, 0xFD70);
|
||||
}
|
||||
|
@ -3953,7 +3953,7 @@ static int btusb_probe(struct usb_interface *intf,
|
|||
btrtl_set_driver_name(hdev, btusb_driver.name);
|
||||
hdev->setup = btusb_setup_realtek;
|
||||
hdev->shutdown = btrtl_shutdown_realtek;
|
||||
hdev->cmd_timeout = btusb_rtl_cmd_timeout;
|
||||
hdev->reset = btusb_rtl_reset;
|
||||
hdev->hw_error = btusb_rtl_hw_error;
|
||||
|
||||
/* Realtek devices need to set remote wakeup on auto-suspend */
|
||||
|
|
|
@ -1650,7 +1650,7 @@ static void qca_hw_error(struct hci_dev *hdev, u8 code)
|
|||
clear_bit(QCA_HW_ERROR_EVENT, &qca->flags);
|
||||
}
|
||||
|
||||
static void qca_cmd_timeout(struct hci_dev *hdev)
|
||||
static void qca_reset(struct hci_dev *hdev)
|
||||
{
|
||||
struct hci_uart *hu = hci_get_drvdata(hdev);
|
||||
struct qca_data *qca = hu->priv;
|
||||
|
@ -1981,7 +1981,7 @@ retry:
|
|||
clear_bit(QCA_IBS_DISABLED, &qca->flags);
|
||||
qca_debugfs_init(hdev);
|
||||
hu->hdev->hw_error = qca_hw_error;
|
||||
hu->hdev->cmd_timeout = qca_cmd_timeout;
|
||||
hu->hdev->reset = qca_reset;
|
||||
if (hu->serdev) {
|
||||
if (device_can_wakeup(hu->serdev->ctrl->dev.parent))
|
||||
hu->hdev->wakeup = qca_wakeup;
|
||||
|
@ -2215,7 +2215,7 @@ static int qca_power_off(struct hci_dev *hdev)
|
|||
enum qca_btsoc_type soc_type = qca_soc_type(hu);
|
||||
|
||||
hu->hdev->hw_error = NULL;
|
||||
hu->hdev->cmd_timeout = NULL;
|
||||
hu->hdev->reset = NULL;
|
||||
|
||||
del_timer_sync(&qca->wake_retrans_timer);
|
||||
del_timer_sync(&qca->tx_idle_timer);
|
||||
|
|
|
@ -633,7 +633,6 @@ struct hci_dev {
|
|||
int (*post_init)(struct hci_dev *hdev);
|
||||
int (*set_diag)(struct hci_dev *hdev, bool enable);
|
||||
int (*set_bdaddr)(struct hci_dev *hdev, const bdaddr_t *bdaddr);
|
||||
void (*cmd_timeout)(struct hci_dev *hdev);
|
||||
void (*reset)(struct hci_dev *hdev);
|
||||
bool (*wakeup)(struct hci_dev *hdev);
|
||||
int (*set_quality_report)(struct hci_dev *hdev, bool enable);
|
||||
|
|
|
@ -1456,8 +1456,8 @@ static void hci_cmd_timeout(struct work_struct *work)
|
|||
bt_dev_err(hdev, "command tx timeout");
|
||||
}
|
||||
|
||||
if (hdev->cmd_timeout)
|
||||
hdev->cmd_timeout(hdev);
|
||||
if (hdev->reset)
|
||||
hdev->reset(hdev);
|
||||
|
||||
atomic_set(&hdev->cmd_cnt, 1);
|
||||
queue_work(hdev->workqueue, &hdev->cmd_work);
|
||||
|
|
Loading…
Add table
Reference in a new issue