Netdev List
 help / color / mirror / Atom feed
* [PATCH net] dpll: send the device delete notification on the last unregistration
@ 2026-11-25 17:02 Ivan Vecera
  2026-11-25 17:07 ` netdev-bot+sinfo
  0 siblings, 1 reply; 3+ messages in thread
From: Ivan Vecera @ 2026-11-25 17:02 UTC (permalink / raw)
  To: netdev
  Cc: Vadim Fedorenko, Arkadiusz Kubalewski, Jiri Pirko,
	David S. Miller, Milena Olech, Michal Michalik, Saeed Mahameed,
	Tariq Toukan

A DPLL device can be registered more than once. mlx5 does this when
several functions of one NIC share a device. dpll_device_register()
sends the create notification only on the first registration, but
dpll_device_unregister() sends the delete notification on every
unregistration. Removing one function then tells userspace that the
device is gone while it is still registered and still listed by
device-get.

Send the delete notification only when the last registration goes
away. Send it before that registration is removed, so the message can
still be filled.

Fixes: 9d71b54b65b1 ("dpll: netlink: Add DPLL framework base functions")
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
---
 drivers/dpll/dpll_core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c
index 277692d12d3d1e..c32e59f3e25afa 100644
--- a/drivers/dpll/dpll_core.c
+++ b/drivers/dpll/dpll_core.c
@@ -534,12 +534,14 @@ void dpll_device_unregister(struct dpll_device *dpll,
 
 	mutex_lock(&dpll_lock);
 	ASSERT_DPLL_REGISTERED(dpll);
-	dpll_device_delete_ntf(dpll);
 	reg = dpll_device_registration_find(dpll, ops, priv);
 	if (WARN_ON(!reg)) {
 		mutex_unlock(&dpll_lock);
 		return;
 	}
+	/* The device goes away with its last registration */
+	if (list_is_singular(&dpll->registration_list))
+		dpll_device_delete_ntf(dpll);
 	list_del(&reg->list);
 	__dpll_device_put(dpll, &reg->tracker);
 	kfree(reg);

base-commit: 7ed616970b652ae76d99a01b468588e491021648
-- 
2.56.1


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

end of thread, other threads:[~2026-11-25 17:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25 17:02 [PATCH net] dpll: send the device delete notification on the last unregistration Ivan Vecera
2026-11-25 17:07 ` netdev-bot+sinfo
2026-11-25 17:32   ` Ivan Vecera

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