Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Bluetooth: hci_qca: Fix BT not getting powered-off on rmmod

The BT core skips calling the hci_dev's shutdown method when the HCI
is unregistered. This means that qca_power_off() was not getting called
leaving BT powered on.

This causes regulators / pwrseq providers to not get disabled which also
causes problem when re-loading the module because regulators and pwrseq
providers have an enablecount which now has never dropped to 0, causing
the BT to not get properly reset between rmmod and re-load which causes
initialization failure on the re-load.

Fix this by calling qca_power_off() from qca_close() when BT has not
already been powered off through a qca_hci_shutdown() call.

hci_ldisc.c will call qca_close() after freeing the hdev, so this
means that qca_power_off() can now no longer deref hu->hdev, change
the logging in qca_power_off() to no longer use hu->hdev.

Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

authored by

Hans de Goede and committed by
Luiz Augusto von Dentz
9ff5ff0b 7e2e1e58

+5 -1
+5 -1
drivers/bluetooth/hci_qca.c
··· 722 722 723 723 BT_DBG("hu %p qca close", hu); 724 724 725 + /* BT core skips qca_hci_shutdown() which calls qca_power_off() on rmmod */ 726 + if (!test_bit(QCA_BT_OFF, &qca->flags)) 727 + qca_power_off(hu); 728 + 725 729 serial_clock_vote(HCI_IBS_VOTE_STATS_UPDATE, hu); 726 730 727 731 skb_queue_purge(&qca->tx_wait_q); ··· 2264 2260 qca_regulator_disable(qcadev); 2265 2261 if (qcadev->sw_ctrl) { 2266 2262 sw_ctrl_state = gpiod_get_value_cansleep(qcadev->sw_ctrl); 2267 - bt_dev_dbg(hu->hdev, "SW_CTRL is %d", sw_ctrl_state); 2263 + BT_DBG("SW_CTRL is %d", sw_ctrl_state); 2268 2264 } 2269 2265 break; 2270 2266