Skip to content

Commit f07d478

Browse files
Hsin-chen ChuangVudentz
authored andcommitted
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 <[email protected]> Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent 7c39342 commit f07d478

File tree

5 files changed

+16
-17
lines changed

5 files changed

+16
-17
lines changed

drivers/bluetooth/btmtksdio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,7 +1249,7 @@ static int btmtksdio_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
12491249
return 0;
12501250
}
12511251

1252-
static void btmtksdio_cmd_timeout(struct hci_dev *hdev)
1252+
static void btmtksdio_reset(struct hci_dev *hdev)
12531253
{
12541254
struct btmtksdio_dev *bdev = hci_get_drvdata(hdev);
12551255
u32 status;
@@ -1360,7 +1360,7 @@ static int btmtksdio_probe(struct sdio_func *func,
13601360

13611361
hdev->open = btmtksdio_open;
13621362
hdev->close = btmtksdio_close;
1363-
hdev->cmd_timeout = btmtksdio_cmd_timeout;
1363+
hdev->reset = btmtksdio_reset;
13641364
hdev->flush = btmtksdio_flush;
13651365
hdev->setup = btmtksdio_setup;
13661366
hdev->shutdown = btmtksdio_shutdown;

drivers/bluetooth/btusb.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ static void btusb_reset(struct hci_dev *hdev)
916916
usb_queue_reset_device(data->intf);
917917
}
918918

919-
static void btusb_intel_cmd_timeout(struct hci_dev *hdev)
919+
static void btusb_intel_reset(struct hci_dev *hdev)
920920
{
921921
struct btusb_data *data = hci_get_drvdata(hdev);
922922
struct gpio_desc *reset_gpio = data->reset_gpio;
@@ -994,7 +994,7 @@ static inline void btusb_rtl_alloc_devcoredump(struct hci_dev *hdev,
994994
}
995995
}
996996

997-
static void btusb_rtl_cmd_timeout(struct hci_dev *hdev)
997+
static void btusb_rtl_reset(struct hci_dev *hdev)
998998
{
999999
struct btusb_data *data = hci_get_drvdata(hdev);
10001000
struct gpio_desc *reset_gpio = data->reset_gpio;
@@ -1038,13 +1038,13 @@ static void btusb_rtl_hw_error(struct hci_dev *hdev, u8 code)
10381038
btusb_rtl_alloc_devcoredump(hdev, &hdr, NULL, 0);
10391039
}
10401040

1041-
static void btusb_qca_cmd_timeout(struct hci_dev *hdev)
1041+
static void btusb_qca_reset(struct hci_dev *hdev)
10421042
{
10431043
struct btusb_data *data = hci_get_drvdata(hdev);
10441044
struct gpio_desc *reset_gpio = data->reset_gpio;
10451045

10461046
if (test_bit(BTUSB_HW_SSR_ACTIVE, &data->flags)) {
1047-
bt_dev_info(hdev, "Ramdump in progress, defer cmd_timeout");
1047+
bt_dev_info(hdev, "Ramdump in progress, defer reset");
10481048
return;
10491049
}
10501050

@@ -3868,7 +3868,7 @@ static int btusb_probe(struct usb_interface *intf,
38683868

38693869
/* Transport specific configuration */
38703870
hdev->send = btusb_send_frame_intel;
3871-
hdev->cmd_timeout = btusb_intel_cmd_timeout;
3871+
hdev->reset = btusb_intel_reset;
38723872

38733873
if (id->driver_info & BTUSB_INTEL_NO_WBS_SUPPORT)
38743874
btintel_set_flag(hdev, INTEL_ROM_LEGACY_NO_WBS_SUPPORT);
@@ -3888,7 +3888,7 @@ static int btusb_probe(struct usb_interface *intf,
38883888
hdev->setup = btusb_mtk_setup;
38893889
hdev->shutdown = btusb_mtk_shutdown;
38903890
hdev->manufacturer = 70;
3891-
hdev->cmd_timeout = btmtk_reset_sync;
3891+
hdev->reset = btmtk_reset_sync;
38923892
hdev->set_bdaddr = btmtk_set_bdaddr;
38933893
hdev->send = btusb_send_frame_mtk;
38943894
set_bit(HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN, &hdev->quirks);
@@ -3920,7 +3920,7 @@ static int btusb_probe(struct usb_interface *intf,
39203920
data->setup_on_usb = btusb_setup_qca;
39213921
hdev->shutdown = btusb_shutdown_qca;
39223922
hdev->set_bdaddr = btusb_set_bdaddr_ath3012;
3923-
hdev->cmd_timeout = btusb_qca_cmd_timeout;
3923+
hdev->reset = btusb_qca_reset;
39243924
set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
39253925
btusb_check_needs_reset_resume(intf);
39263926
}
@@ -3934,7 +3934,7 @@ static int btusb_probe(struct usb_interface *intf,
39343934
data->setup_on_usb = btusb_setup_qca;
39353935
hdev->shutdown = btusb_shutdown_qca;
39363936
hdev->set_bdaddr = btusb_set_bdaddr_wcn6855;
3937-
hdev->cmd_timeout = btusb_qca_cmd_timeout;
3937+
hdev->reset = btusb_qca_reset;
39383938
set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
39393939
hci_set_msft_opcode(hdev, 0xFD70);
39403940
}
@@ -3953,7 +3953,7 @@ static int btusb_probe(struct usb_interface *intf,
39533953
btrtl_set_driver_name(hdev, btusb_driver.name);
39543954
hdev->setup = btusb_setup_realtek;
39553955
hdev->shutdown = btrtl_shutdown_realtek;
3956-
hdev->cmd_timeout = btusb_rtl_cmd_timeout;
3956+
hdev->reset = btusb_rtl_reset;
39573957
hdev->hw_error = btusb_rtl_hw_error;
39583958

39593959
/* Realtek devices need to set remote wakeup on auto-suspend */

drivers/bluetooth/hci_qca.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1650,7 +1650,7 @@ static void qca_hw_error(struct hci_dev *hdev, u8 code)
16501650
clear_bit(QCA_HW_ERROR_EVENT, &qca->flags);
16511651
}
16521652

1653-
static void qca_cmd_timeout(struct hci_dev *hdev)
1653+
static void qca_reset(struct hci_dev *hdev)
16541654
{
16551655
struct hci_uart *hu = hci_get_drvdata(hdev);
16561656
struct qca_data *qca = hu->priv;
@@ -1981,7 +1981,7 @@ static int qca_setup(struct hci_uart *hu)
19811981
clear_bit(QCA_IBS_DISABLED, &qca->flags);
19821982
qca_debugfs_init(hdev);
19831983
hu->hdev->hw_error = qca_hw_error;
1984-
hu->hdev->cmd_timeout = qca_cmd_timeout;
1984+
hu->hdev->reset = qca_reset;
19851985
if (hu->serdev) {
19861986
if (device_can_wakeup(hu->serdev->ctrl->dev.parent))
19871987
hu->hdev->wakeup = qca_wakeup;
@@ -2215,7 +2215,7 @@ static int qca_power_off(struct hci_dev *hdev)
22152215
enum qca_btsoc_type soc_type = qca_soc_type(hu);
22162216

22172217
hu->hdev->hw_error = NULL;
2218-
hu->hdev->cmd_timeout = NULL;
2218+
hu->hdev->reset = NULL;
22192219

22202220
del_timer_sync(&qca->wake_retrans_timer);
22212221
del_timer_sync(&qca->tx_idle_timer);

include/net/bluetooth/hci_core.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,6 @@ struct hci_dev {
633633
int (*post_init)(struct hci_dev *hdev);
634634
int (*set_diag)(struct hci_dev *hdev, bool enable);
635635
int (*set_bdaddr)(struct hci_dev *hdev, const bdaddr_t *bdaddr);
636-
void (*cmd_timeout)(struct hci_dev *hdev);
637636
void (*reset)(struct hci_dev *hdev);
638637
bool (*wakeup)(struct hci_dev *hdev);
639638
int (*set_quality_report)(struct hci_dev *hdev, bool enable);

net/bluetooth/hci_core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,8 +1456,8 @@ static void hci_cmd_timeout(struct work_struct *work)
14561456
bt_dev_err(hdev, "command tx timeout");
14571457
}
14581458

1459-
if (hdev->cmd_timeout)
1460-
hdev->cmd_timeout(hdev);
1459+
if (hdev->reset)
1460+
hdev->reset(hdev);
14611461

14621462
atomic_set(&hdev->cmd_cnt, 1);
14631463
queue_work(hdev->workqueue, &hdev->cmd_work);

0 commit comments

Comments
 (0)