]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
dpll: export __dpll_device_change_ntf() for use under dpll_lock
authorIvan Vecera <ivecera@redhat.com>
Tue, 26 May 2026 07:45:23 +0000 (09:45 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 28 May 2026 12:05:29 +0000 (14:05 +0200)
Export __dpll_device_change_ntf() so that drivers can send device
change notifications from within device callbacks, which are already
called under dpll_lock. Using dpll_device_change_ntf() in that
context would deadlock.

Add lockdep_assert_held() to catch misuse without the lock held.

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Link: https://patch.msgid.link/20260526074525.1451008-2-ivecera@redhat.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/dpll/dpll_netlink.c
include/linux/dpll.h

index 0ff1658c2dc1baca3b6b26213a5b4fe08266fe23..75e3ae0c16d077301c807e097921e71e1826eceb 100644 (file)
@@ -829,12 +829,21 @@ int dpll_device_delete_ntf(struct dpll_device *dpll)
        return dpll_device_event_send(DPLL_CMD_DEVICE_DELETE_NTF, dpll);
 }
 
-static int
-__dpll_device_change_ntf(struct dpll_device *dpll)
+/**
+ * __dpll_device_change_ntf - notify that the dpll device has been changed
+ * @dpll: registered dpll pointer
+ *
+ * Context: caller must hold dpll_lock. Suitable for use inside device
+ *          callbacks which are already invoked under dpll_lock.
+ * Return: 0 if succeeds, error code otherwise.
+ */
+int __dpll_device_change_ntf(struct dpll_device *dpll)
 {
+       lockdep_assert_held(&dpll_lock);
        dpll_device_notify(dpll, DPLL_DEVICE_CHANGED);
        return dpll_device_event_send(DPLL_CMD_DEVICE_CHANGE_NTF, dpll);
 }
+EXPORT_SYMBOL_GPL(__dpll_device_change_ntf);
 
 /**
  * dpll_device_change_ntf - notify that the dpll device has been changed
index f8037f1ab20b60c1ba1f5edd8391df19f47ef933..2dbe8567eafca676746505c2a96e1e3431702d45 100644 (file)
@@ -284,6 +284,7 @@ void dpll_pin_on_pin_unregister(struct dpll_pin *parent, struct dpll_pin *pin,
 int dpll_pin_ref_sync_pair_add(struct dpll_pin *pin,
                               struct dpll_pin *ref_sync_pin);
 
+int __dpll_device_change_ntf(struct dpll_device *dpll);
 int dpll_device_change_ntf(struct dpll_device *dpll);
 
 int __dpll_pin_change_ntf(struct dpll_pin *pin);