lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e73e0e22-ff06-4e64-a2fd-c930ca1943c0@linux.dev>
Date: Wed, 12 Nov 2025 21:52:13 +0000
From: Vadim Fedorenko <vadim.fedorenko@...ux.dev>
To: Ivan Vecera <ivecera@...hat.com>, netdev@...r.kernel.org
Cc: Petr Oros <poros@...hat.com>,
 Prathosh Satish <Prathosh.Satish@...rochip.com>,
 Arkadiusz Kubalewski <arkadiusz.kubalewski@...el.com>,
 Jiri Pirko <jiri@...nulli.us>, Michal Schmidt <mschmidt@...hat.com>,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v2 1/6] dpll: zl3073x: Store raw register values
 instead of parsed state

On 12/11/2025 19:24, Ivan Vecera wrote:
> On 11/12/25 3:12 PM, Vadim Fedorenko wrote:
>> 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@...hat.com>
>>> Tested-by: Prathosh Satish <Prathosh.Satish@...rochip.com>
>>> Signed-off-by: Ivan Vecera <ivecera@...hat.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.
> 
> Would it be helpful to add here the comment describing that is safe and
> why?

Yes, comment would be great to have.

> 
>> Have you thought of adding an abstraction for differential pair pins?
> 
> No, zl3073x_ref represents mailbox for HW reference... Here, I’m just
> following the datasheet, which states: "If the P-pin is marked as
> differential then some content of the mailbox for N-pin is ignored and
> is inherited from the P-pin".
> For now, the content of zl3073x_ref is the inherited one, but this may
> change in the future.
> 
> The abstraction for differential pin pairs is actually handled in
> dpll.c, where only a single dpll_pin is registered for each such pair.
> 
> Ivan
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ