All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ivan Vecera <ivecera@redhat.com>
To: netdev@vger.kernel.org
Cc: Vadim Fedorenko <vadim.fedorenko@linux.dev>,
	Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>,
	Jiri Pirko <jiri@resnulli.us>,
	"David S. Miller" <davem@davemloft.net>,
	Milena Olech <milena.olech@intel.com>,
	Michal Michalik <michal.michalik@intel.com>,
	Saeed Mahameed <saeedm@nvidia.com>,
	Tariq Toukan <tariqt@nvidia.com>
Subject: [PATCH net] dpll: send the device delete notification on the last unregistration
Date: Wed, 25 Nov 2026 18:02:34 +0100	[thread overview]
Message-ID: <20261125170234.294969-1-ivecera@redhat.com> (raw)

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


             reply	other threads:[~2026-11-25 17:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 17:02 Ivan Vecera [this message]
2026-11-25 17:07 ` [PATCH net] dpll: send the device delete notification on the last unregistration netdev-bot+sinfo
2026-11-25 17:32   ` Ivan Vecera
2026-12-01  8:14 ` Petr Oros
2026-12-02  2:40 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261125170234.294969-1-ivecera@redhat.com \
    --to=ivecera@redhat.com \
    --cc=arkadiusz.kubalewski@intel.com \
    --cc=davem@davemloft.net \
    --cc=jiri@resnulli.us \
    --cc=michal.michalik@intel.com \
    --cc=milena.olech@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    --cc=vadim.fedorenko@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.