public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/2] Bluetooth: coredump: Add hci_devcd_unregister() for cleanup
@ 2025-07-03 12:59 Neeraj Sanjay Kale
  2025-07-03 12:59 ` [PATCH v1 2/2] Bluetooth: btnxpuart: Call hci_devcd_unregister() in driver exit Neeraj Sanjay Kale
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Neeraj Sanjay Kale @ 2025-07-03 12:59 UTC (permalink / raw)
  To: marcel, luiz.dentz, johan.hedberg, davem, edumazet, kuba, pabeni,
	horms
  Cc: linux-bluetooth, linux-kernel, netdev, amitkumar.karwar,
	neeraj.sanjaykale, sherry.sun, manjeet.gupta

This adds hci_devcd_unregister() which can be called when driver is
removed, which will cleanup the devcoredump data and cancel delayed
dump_timeout work.

With BTNXPUART driver, it is observed that after FW dump, if driver is
removed and re-loaded, it creates hci1 interface instead of hci0
interface.

But after DEVCD_TIMEOUT (5 minutes) if driver is re-loaded, hci0 is
created. This is because after FW dump, hci0 is not unregistered
properly for DEVCD_TIMEOUT.

With this patch, BTNXPUART is able to create hci0 after every FW dump
and driver reload.

Signed-off-by: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
---
 include/net/bluetooth/coredump.h | 3 +++
 net/bluetooth/coredump.c         | 8 ++++++++
 2 files changed, 11 insertions(+)

diff --git a/include/net/bluetooth/coredump.h b/include/net/bluetooth/coredump.h
index 72f51b587a04..bc8856e4bfe7 100644
--- a/include/net/bluetooth/coredump.h
+++ b/include/net/bluetooth/coredump.h
@@ -66,6 +66,7 @@ void hci_devcd_timeout(struct work_struct *work);
 
 int hci_devcd_register(struct hci_dev *hdev, coredump_t coredump,
 		       dmp_hdr_t dmp_hdr, notify_change_t notify_change);
+void hci_devcd_unregister(struct hci_dev *hdev);
 int hci_devcd_init(struct hci_dev *hdev, u32 dump_size);
 int hci_devcd_append(struct hci_dev *hdev, struct sk_buff *skb);
 int hci_devcd_append_pattern(struct hci_dev *hdev, u8 pattern, u32 len);
@@ -85,6 +86,8 @@ static inline int hci_devcd_register(struct hci_dev *hdev, coredump_t coredump,
 	return -EOPNOTSUPP;
 }
 
+static inline void hci_devcd_unregister(struct hci_dev *hdev) {}
+
 static inline int hci_devcd_init(struct hci_dev *hdev, u32 dump_size)
 {
 	return -EOPNOTSUPP;
diff --git a/net/bluetooth/coredump.c b/net/bluetooth/coredump.c
index 819eacb38762..dd7bd40e3eba 100644
--- a/net/bluetooth/coredump.c
+++ b/net/bluetooth/coredump.c
@@ -442,6 +442,14 @@ int hci_devcd_register(struct hci_dev *hdev, coredump_t coredump,
 }
 EXPORT_SYMBOL(hci_devcd_register);
 
+void hci_devcd_unregister(struct hci_dev *hdev)
+{
+	cancel_delayed_work(&hdev->dump.dump_timeout);
+	skb_queue_purge(&hdev->dump.dump_q);
+	dev_coredump_put(&hdev->dev);
+}
+EXPORT_SYMBOL_GPL(hci_devcd_unregister);
+
 static inline bool hci_devcd_enabled(struct hci_dev *hdev)
 {
 	return hdev->dump.supported;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-08-04  9:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-03 12:59 [PATCH v1 1/2] Bluetooth: coredump: Add hci_devcd_unregister() for cleanup Neeraj Sanjay Kale
2025-07-03 12:59 ` [PATCH v1 2/2] Bluetooth: btnxpuart: Call hci_devcd_unregister() in driver exit Neeraj Sanjay Kale
2025-07-03 13:42 ` [PATCH v1 1/2] Bluetooth: coredump: Add hci_devcd_unregister() for cleanup Luiz Augusto von Dentz
2025-07-04  7:23   ` Neeraj Sanjay Kale
2025-08-04  9:50     ` Neeraj Sanjay Kale
2025-07-03 14:08 ` [v1,1/2] " bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox