Extract the frequency-setting logic from the dpll_pin_ops callback into a separate unlocked helper __zl3073x_dpll_output_pin_frequency_set() that can be called internally while the per-DPLL lock is already held. The original callback becomes a thin wrapper that acquires the lock and delegates. This prepares for the PTP clock support patch where ptp_enable() needs to set output pin frequency from an already-locked context. Reviewed-by: Petr Oros Tested-by: Chris du Quesnay Signed-off-by: Ivan Vecera --- drivers/dpll/zl3073x/dpll.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/drivers/dpll/zl3073x/dpll.c b/drivers/dpll/zl3073x/dpll.c index 0488ae6ac486c8..79433ba8bb4a4f 100644 --- a/drivers/dpll/zl3073x/dpll.c +++ b/drivers/dpll/zl3073x/dpll.c @@ -935,21 +935,17 @@ zl3073x_dpll_output_pin_frequency_get(const struct dpll_pin *dpll_pin, } static int -zl3073x_dpll_output_pin_frequency_set(const struct dpll_pin *dpll_pin, - void *pin_priv, - const struct dpll_device *dpll, - void *dpll_priv, u64 frequency, - struct netlink_ext_ack *extack) +__zl3073x_dpll_output_pin_frequency_set(struct zl3073x_dpll *zldpll, + struct zl3073x_dpll_pin *pin, + u64 frequency) { - struct zl3073x_dpll *zldpll = dpll_priv; struct zl3073x_dev *zldev = zldpll->dev; - struct zl3073x_dpll_pin *pin = pin_priv; const struct zl3073x_synth *synth; u32 new_div, synth_freq; struct zl3073x_out out; u8 out_id; - guard(mutex)(&zldpll->lock); + lockdep_assert_held(&zldpll->lock); out_id = zl3073x_output_pin_out_get(pin->id); out = *zl3073x_out_state_get(zldev, out_id); @@ -1010,6 +1006,21 @@ zl3073x_dpll_output_pin_frequency_set(const struct dpll_pin *dpll_pin, return zl3073x_out_state_set(zldev, out_id, &out); } +static int +zl3073x_dpll_output_pin_frequency_set(const struct dpll_pin *dpll_pin, + void *pin_priv, + const struct dpll_device *dpll, + void *dpll_priv, u64 frequency, + struct netlink_ext_ack *extack) +{ + struct zl3073x_dpll *zldpll = dpll_priv; + + guard(mutex)(&zldpll->lock); + + return __zl3073x_dpll_output_pin_frequency_set(zldpll, pin_priv, + frequency); +} + static int zl3073x_dpll_output_pin_phase_adjust_get(const struct dpll_pin *dpll_pin, void *pin_priv, -- 2.54.0