Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ali Rouhi" <arouhi@sitime.com>
Cc: "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH net-next v17 08/13] dpll: sit9531x: add support to get and set priority on input pins
Date: Wed, 02 Dec 2026 23:52:59 +0000	[thread overview]
Message-ID: <sashiko-outbox-246774@kernel.org> (raw)
In-Reply-To: <20261201235202.97645-9-arouhi@sitime.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] dpll: sit9531x: stale operstate baseline in
  sit9531x_dpll_input_pin_prio_set()
--

commit 8dd5b67982e2e09fb4ad387969a6060c80776b17
Author: Oleg Zadorozhnyi <Oleg.Zadorozhnyi@devoxsoftware.com>

dpll: sit9531x: add support to get and set priority on input pins

This commit adds DPLL pin priority get and set support for input pins on
SiT9531x PLLs and tracks pin priority and operational state changes for
periodic poll notifications.

> diff --git a/drivers/dpll/sit9531x/dpll.c b/drivers/dpll/sit9531x/dpll.c
> index 5d16183aa1aeb..3a31d0707127a 100644
> --- a/drivers/dpll/sit9531x/dpll.c
> +++ b/drivers/dpll/sit9531x/dpll.c
[ ... ]
> @@ -403,6 +411,10 @@ sit9531x_dpll_input_pin_state_on_dpll_set(const struct dpll_pin *pin,
>  		break;
>  	}
>  
> +	/* The core notifies this request; the poll compares to this record */
> +	if (!rc)
> +		sit9531x_dpll_pin_baseline(dpin);
> +
>  	mutex_unlock(&sitdev->multiop_lock);
>  
>  	if (rc == -ENOSPC)
> @@ -414,11 +426,82 @@ sit9531x_dpll_input_pin_state_on_dpll_set(const struct dpll_pin *pin,
>  	return rc;
>  }
[ ... ]
> +static int
> +sit9531x_dpll_input_pin_prio_set(const struct dpll_pin *pin, void *pin_priv,
> +				 const struct dpll_device *dpll,
> +				 void *dpll_priv, u32 prio,
> +				 struct netlink_ext_ack *extack)
> +{
> +	struct sit9531x_dpll_pin *dpin = pin_priv;
> +	struct sit9531x_dpll *sitdpll = dpll_priv;
> +	struct sit9531x_dev *sitdev = sitdpll->dev;
> +	int rc;
> +
> +	if (dpin->dir != DPLL_PIN_DIRECTION_INPUT) {
> +		NL_SET_ERR_MSG(extack, "Priority applies only to input pins");
> +		return -EINVAL;
> +	}
> +
> +	if (prio > U8_MAX) {
> +		NL_SET_ERR_MSG(extack, "Priority out of range (0-255)");
> +		return -EINVAL;
> +	}
> +
> +	mutex_lock(&sitdev->multiop_lock);
> +	if (sit9531x_chan_state_get(sitdev, sitdpll->id)->manual_input) {
> +		mutex_unlock(&sitdev->multiop_lock);
> +		return sit9531x_dpll_manual_select_refuse(extack);
> +	}
> +	rc = sit9531x_input_prio_set(sitdev, sitdpll->id,
> +				     sit9531x_input_hw_src(dpin->id),
> +				     (u8)prio);
> +	if (!rc)
> +		dpin->prio = prio;
> +	mutex_unlock(&sitdev->multiop_lock);

[Severity: Medium]
Should sit9531x_dpll_input_pin_prio_set() call sit9531x_dpll_pin_baseline()
instead of only updating dpin->prio?

When changing the priority of a listed input pin rewrites the priority
table, sit9531x_prio_table_commit() forces holdover, latches the new table,
and refreshes the channel state via sit9531x_chan_state_fetch() before
returning, and dpll_pin_prio_set() immediately emits
__dpll_pin_change_ntf(pin) with the post-commit operstate.

Because dpin->operstate is left at its pre-commit value, if dpin was
DPLL_PIN_OPERSTATE_ACTIVE before the table rewrite and is temporarily
reported as DPLL_PIN_OPERSTATE_STANDBY in the immediate notification while
the PLL exits holdover and re-acquires lock, sit9531x_dpll_changes_check()
will later compare the restored DPLL_PIN_OPERSTATE_ACTIVE against the stale
dpin->operstate (still DPLL_PIN_OPERSTATE_ACTIVE) and miss sending the
notification that the pin became active again. Conversely, if the priority
change switches the PLL away from dpin so it becomes STANDBY, the next poll
tick will emit a duplicate notification.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261201235202.97645-1-arouhi@sitime.com?part=8

  reply	other threads:[~2026-12-02 23:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 23:52 [PATCH net-next v17 00/13] dpll: add SiTime SiT9531x DPLL clock driver Ali Rouhi
2026-12-01 23:52 ` [PATCH net-next v17 01/13] dpll: omit pin phase attributes the driver has no value for Ali Rouhi
2026-12-01 23:52 ` [PATCH net-next v17 02/13] dt-bindings: vendor-prefixes: add SiTime Corporation Ali Rouhi
2026-12-01 23:52 ` [PATCH net-next v17 04/13] dpll: add basic SiTime SiT9531x support Ali Rouhi
2026-12-01 23:52 ` [PATCH net-next v17 03/13] dt-bindings: dpll: add SiTime SiT95316 clock generator Ali Rouhi
2026-12-01 23:52 ` [PATCH net-next v17 05/13] dpll: sit9531x: read DPLL types and pin properties from system firmware Ali Rouhi
2026-12-01 23:52 ` [PATCH net-next v17 06/13] dpll: sit9531x: register DPLL devices and pins Ali Rouhi
2026-12-01 23:52 ` [PATCH net-next v17 08/13] dpll: sit9531x: add support to get and set priority on input pins Ali Rouhi
2026-12-02 23:52   ` sashiko-bot [this message]
2026-12-01 23:52 ` [PATCH net-next v17 07/13] dpll: sit9531x: implement input pin state on a DPLL Ali Rouhi
2026-12-02 23:52   ` sashiko-bot
2026-12-01 23:52 ` [PATCH net-next v17 09/13] dpll: sit9531x: add support to get and set frequency on pins Ali Rouhi
2026-12-01 23:52 ` [PATCH net-next v17 10/13] dpll: sit9531x: implement output pin state on a DPLL Ali Rouhi
2026-12-01 23:52 ` [PATCH net-next v17 11/13] dpll: sit9531x: add support to adjust output phase Ali Rouhi
2026-12-02 23:52   ` sashiko-bot
2026-12-01 23:52 ` [PATCH net-next v17 12/13] dpll: sit9531x: add support to get phase offset on the connected input Ali Rouhi
2026-12-01 23:52 ` [PATCH net-next v17 13/13] dpll: sit9531x: model the inter-PLL sync line as a pair of pins Ali Rouhi
2026-12-02 23:53   ` sashiko-bot

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=sashiko-outbox-246774@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=arouhi@sitime.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox