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] [thread-next>] [day] [month] [year] [list]
Message-ID: <2a09e743-7423-65b0-c70d-87ae8105182a@linaro.org>
Date:   Thu, 27 Jul 2023 09:07:21 +0200
From:   Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To:     Fenglin Wu <quic_fenglinw@...cinc.com>,
        linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
        krzysztof.kozlowski+dt@...aro.org, robh+dt@...nel.org,
        agross@...nel.org, andersson@...nel.org,
        dmitry.baryshkov@...aro.org,
        Konrad Dybcio <konrad.dybcio@...aro.org>,
        Dmitry Torokhov <dmitry.torokhov@...il.com>,
        linux-input@...r.kernel.org
Cc:     quic_collinsd@...cinc.com, quic_subbaram@...cinc.com,
        quic_kamalw@...cinc.com, jestar@....qualcomm.com
Subject: Re: [PATCH v3 1/3] input: pm8xxx-vib: refactor to easily support new
 SPMI vibrator

On 25/07/2023 08:16, Fenglin Wu wrote:
>>>   
>>> -static const struct pm8xxx_regs pm8058_regs = {
>>> -	.drv_addr = 0x4A,
>>> -	.drv_mask = 0xf8,
>>> -	.drv_shift = 3,
>>> -	.drv_en_manual_mask = 0xfc,
>>> +static struct reg_field ssbi_vib_regs[VIB_MAX_REG] = {
>>
>> Change from const to non-const is wrong. How do you support multiple
>> devices? No, this is way too fragile now.
>>
> 
> The register definition is no longer used as the match data, hw_type is 
> used.
> 
> The last suggestion was getting the register base address from the DT 
> and it has to be added into the offset of SPMI vibrator registers 
> (either in the previous hard-coded format or the later the reg_filed 
> data structure), so it's not appropriated to make it constant.
> 
> I don't understand this question: "How do you support multiple devices?" 
> For SSBI vibrator, since all the registers are fixed, and I would assume 
> that there is no chance to support multiple vibrator devices on the same 
> SSBI bus. If they are not on the same bus, the regmap device will be 
> different while the registers definition is the same, and we are still 
> able to support multiple devices, right?

No, you have static memory. One device probes and changes static memory
to reg+=base1. Second device probes and changes the same to reg+=base2.

> The similar story for SPMI vibrators and it can support multiple devices 
> if they are located on different SPMI bus, or even if they are on the 
> same SPMI bus but just having different SID or PID.

Sorry, such code cannot go in. These must stay const and you must write
driver without any static allocations or singleton-like patterns.


Best regards,
Krzysztof

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ