public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Vadim Fedorenko <vadim.fedorenko@linux•dev>
To: Ivan Vecera <ivecera@redhat•com>, netdev@vger•kernel.org
Cc: Petr Oros <poros@redhat•com>,
	Prathosh Satish <Prathosh.Satish@microchip•com>,
	Arkadiusz Kubalewski <arkadiusz.kubalewski@intel•com>,
	Jiri Pirko <jiri@resnulli•us>,
	Michal Schmidt <mschmidt@redhat•com>,
	linux-kernel@vger•kernel.org
Subject: Re: [PATCH net-next v2 1/6] dpll: zl3073x: Store raw register values instead of parsed state
Date: Wed, 12 Nov 2025 14:12:05 +0000	[thread overview]
Message-ID: <886723c3-ff9e-43cf-a1da-021f1ff088ab@linux.dev> (raw)
In-Reply-To: <20251111181243.4570-2-ivecera@redhat.com>

On 11/11/2025 18:12, Ivan Vecera wrote:
> The zl3073x_ref, zl3073x_out and zl3073x_synth structures
> previously stored state that was parsed from register reads. This
> included values like boolean 'enabled' flags, synthesizer selections,
> and pre-calculated frequencies.
> 
> This commit refactors the state management to store the raw register
> values directly in these structures. The various inline helper functions
> are updated to parse these raw values on-demand using FIELD_GET.
> 
> Reviewed-by: Petr Oros <poros@redhat•com>
> Tested-by: Prathosh Satish <Prathosh.Satish@microchip•com>
> Signed-off-by: Ivan Vecera <ivecera@redhat•com>
> ---
>   drivers/dpll/zl3073x/core.c | 81 ++++++++++++-------------------------
>   drivers/dpll/zl3073x/core.h | 61 ++++++++++++++++------------
>   2 files changed, 60 insertions(+), 82 deletions(-)
> 
> diff --git a/drivers/dpll/zl3073x/core.c b/drivers/dpll/zl3073x/core.c
> index e42e527813cf8..50c1fe59bc7f0 100644
> --- a/drivers/dpll/zl3073x/core.c
> +++ b/drivers/dpll/zl3073x/core.c
> @@ -598,25 +598,22 @@ int zl3073x_write_hwreg_seq(struct zl3073x_dev *zldev,
>    * @zldev: pointer to zl3073x_dev structure
>    * @index: input reference index to fetch state for
>    *
> - * Function fetches information for the given input reference that are
> - * invariant and stores them for later use.
> + * Function fetches state for the given input reference and stores it for
> + * later user.
>    *
>    * Return: 0 on success, <0 on error
>    */
>   static int
>   zl3073x_ref_state_fetch(struct zl3073x_dev *zldev, u8 index)
>   {
> -	struct zl3073x_ref *input = &zldev->ref[index];
> -	u8 ref_config;
> +	struct zl3073x_ref *ref = &zldev->ref[index];
>   	int rc;
>   
>   	/* If the input is differential then the configuration for N-pin
>   	 * reference is ignored and P-pin config is used for both.
>   	 */
> -	if (zl3073x_is_n_pin(index) &&
> -	    zl3073x_ref_is_diff(zldev, index - 1)) {
> -		input->enabled = zl3073x_ref_is_enabled(zldev, index - 1);
> -		input->diff = true;
> +	if (zl3073x_is_n_pin(index) && zl3073x_ref_is_diff(zldev, index - 1)) {
> +		memcpy(ref, &zldev->ref[index - 1], sizeof(*ref));

Oh, it's not obvious from the code that it's actually safe, unless
reviewer remembers that N-pins have only even indexes.
Have you thought of adding an abstraction for differential pair pins?

>   
>   		return 0;
>   	}

  reply	other threads:[~2025-11-12 14:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-11 18:12 [PATCH net-next v2 0/6] dpll: zl3073x: Refactor state management Ivan Vecera
2025-11-11 18:12 ` [PATCH net-next v2 1/6] dpll: zl3073x: Store raw register values instead of parsed state Ivan Vecera
2025-11-12 14:12   ` Vadim Fedorenko [this message]
2025-11-12 19:24     ` Ivan Vecera
2025-11-12 21:52       ` Vadim Fedorenko
2025-11-11 18:12 ` [PATCH net-next v2 2/6] dpll: zl3073x: Split ref, out, and synth logic from core Ivan Vecera
2025-11-11 18:12 ` [PATCH net-next v2 3/6] dpll: zl3073x: Cache reference monitor status Ivan Vecera
2025-11-11 18:12 ` [PATCH net-next v2 4/6] dpll: zl3073x: Cache all reference properties in zl3073x_ref Ivan Vecera
2025-11-11 18:12 ` [PATCH net-next v2 5/6] dpll: zl3073x: Cache all output properties in zl3073x_out Ivan Vecera
2025-11-11 18:12 ` [PATCH net-next v2 6/6] dpll: zl3073x: Remove unused dev wrappers Ivan Vecera

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=886723c3-ff9e-43cf-a1da-021f1ff088ab@linux.dev \
    --to=vadim.fedorenko@linux$(echo .)dev \
    --cc=Prathosh.Satish@microchip$(echo .)com \
    --cc=arkadiusz.kubalewski@intel$(echo .)com \
    --cc=ivecera@redhat$(echo .)com \
    --cc=jiri@resnulli$(echo .)us \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=mschmidt@redhat$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=poros@redhat$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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