dpll: send the device delete notification on the last unregistration

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>
Reviewed-by: Petr Oros <poros@redhat.com>
Link: https://patch.msgid.link/20261125170234.294969-1-ivecera@redhat.com
Signed-off-by: Willem de Bruijn <willemb@google.com>
1 file changed