Commit 2c1bd78dc8e2 ("dpll: use pin owner's dpll ref for pin-level attribute reporting") and commit 84e85c325e5e ("dpll: use pin owner's dpll ref for pin-level attribute setting") made the pin-level paths look for the reference of a DPLL of the pin's owner, because a pin could also be registered with DPLLs of other owners. Every DPLL a pin is registered with now has the owner of the pin. Use the first reference of a registered DPLL and drop dpll_pin_own_dpll_ref_first(). Signed-off-by: Ivan Vecera --- drivers/dpll/dpll_core.c | 27 --------------------------- drivers/dpll/dpll_core.h | 1 - drivers/dpll/dpll_netlink.c | 20 +++++++++----------- 3 files changed, 9 insertions(+), 39 deletions(-) diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c index af61c4882c2b6f..a58cd22164f0be 100644 --- a/drivers/dpll/dpll_core.c +++ b/drivers/dpll/dpll_core.c @@ -1229,33 +1229,6 @@ void *dpll_pin_on_pin_priv(struct dpll_pin *parent, return reg->priv; } -/** - * dpll_pin_own_dpll_ref_first - find the first owner dpll ref of a pin - * @pin: pointer to a dpll pin - * - * Search pin's dpll_refs for a ref whose dpll matches the pin's - * (module, clock_id) tuple, i.e. the dpll registered by the driver - * that created the pin. This ensures pin-level attributes are - * reported and modified using the owner's ops even when the pin is - * also registered with dplls from other drivers. - * - * Return: pointer to the owner's dpll_pin_ref, or NULL if no - * owner ref is found. - */ -struct dpll_pin_ref *dpll_pin_own_dpll_ref_first(struct dpll_pin *pin) -{ - struct dpll_pin_ref *ref; - unsigned long i; - - xa_for_each(&pin->dpll_refs, i, ref) { - if (ref->dpll->module == pin->module && - ref->dpll->clock_id == pin->clock_id) - return ref; - } - - return NULL; -} - const struct dpll_pin_ops *dpll_pin_ops(struct dpll_pin_ref *ref) { struct dpll_pin_registration *reg; diff --git a/drivers/dpll/dpll_core.h b/drivers/dpll/dpll_core.h index 6e10aadd2123d9..add518fef295d8 100644 --- a/drivers/dpll/dpll_core.h +++ b/drivers/dpll/dpll_core.h @@ -103,7 +103,6 @@ void *dpll_pin_on_pin_priv(struct dpll_pin *parent, struct dpll_pin *pin); const struct dpll_device_ops *dpll_device_ops(struct dpll_device *dpll); struct dpll_device *dpll_device_get_by_id(int id); -struct dpll_pin_ref *dpll_pin_own_dpll_ref_first(struct dpll_pin *pin); const struct dpll_pin_ops *dpll_pin_ops(struct dpll_pin_ref *ref); struct dpll_pin_ref *dpll_xa_ref_dpll_first(struct xarray *xa_refs); bool dpll_pins_linked(const struct dpll_pin *a, const struct dpll_pin *b); diff --git a/drivers/dpll/dpll_netlink.c b/drivers/dpll/dpll_netlink.c index 6a46130fc687eb..ac341e3eba61ac 100644 --- a/drivers/dpll/dpll_netlink.c +++ b/drivers/dpll/dpll_netlink.c @@ -745,9 +745,7 @@ dpll_cmd_pin_get_one(struct sk_buff *msg, struct dpll_pin *pin, struct dpll_pin_ref *ref; int ret; - ref = dpll_pin_own_dpll_ref_first(pin); - if (!ref || !dpll_device_registered(ref->dpll)) - ref = dpll_pin_first_registered_ref(pin); + ref = dpll_pin_first_registered_ref(pin); if (!ref) return -ENODEV; @@ -1134,8 +1132,8 @@ dpll_pin_freq_set(struct dpll_pin *pin, struct nlattr *a, return -EINVAL; } - ref = dpll_pin_own_dpll_ref_first(pin); - if (!ref || !dpll_device_registered(ref->dpll)) { + ref = dpll_pin_first_registered_ref(pin); + if (!ref) { NL_SET_ERR_MSG(extack, "pin owner dpll not found"); return -ENODEV; } @@ -1180,8 +1178,8 @@ dpll_pin_esync_set(struct dpll_pin *pin, struct nlattr *a, bool supported = false; int ret, i; - ref = dpll_pin_own_dpll_ref_first(pin); - if (!ref || !dpll_device_registered(ref->dpll)) { + ref = dpll_pin_first_registered_ref(pin); + if (!ref) { NL_SET_ERR_MSG(extack, "pin owner dpll not found"); return -ENODEV; } @@ -1245,8 +1243,8 @@ dpll_pin_ref_sync_state_set(struct dpll_pin *pin, NL_SET_ERR_MSG(extack, "reference sync pin not available"); return -EINVAL; } - ref = dpll_pin_own_dpll_ref_first(pin); - if (!ref || !dpll_device_registered(ref->dpll)) { + ref = dpll_pin_first_registered_ref(pin); + if (!ref) { NL_SET_ERR_MSG(extack, "pin owner dpll not found"); return -ENODEV; } @@ -1458,8 +1456,8 @@ dpll_pin_phase_adj_set(struct dpll_pin *pin, struct nlattr *phase_adj_attr, return -EINVAL; } - ref = dpll_pin_own_dpll_ref_first(pin); - if (!ref || !dpll_device_registered(ref->dpll)) { + ref = dpll_pin_first_registered_ref(pin); + if (!ref) { NL_SET_ERR_MSG(extack, "pin owner dpll not found"); return -ENODEV; } -- 2.56.1