[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <500e5abc-fb71-8468-a6b0-3ced2676b57c@linaro.org>
Date: Thu, 4 May 2023 18:34:32 +0200
From: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To: Mukesh Ojha <quic_mojha@...cinc.com>, agross@...nel.org,
andersson@...nel.org, konrad.dybcio@...aro.org, corbet@....net,
keescook@...omium.org, tony.luck@...el.com, gpiccoli@...lia.com,
catalin.marinas@....com, will@...nel.org,
krzysztof.kozlowski+dt@...aro.org, robh+dt@...nel.org,
linus.walleij@...aro.org, linux-gpio@...r.kernel.org,
srinivas.kandagatla@...aro.org
Cc: linux-arm-msm@...r.kernel.org, linux-remoteproc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-doc@...r.kernel.org
Subject: Re: [PATCH v3 04/18] soc: qcom: Add Qualcomm minidump kernel driver
On 04/05/2023 17:21, Krzysztof Kozlowski wrote:
>>>
>>>> + ret = qcom_minidump_init_apss_subsystem(md);
>>>> + if (ret) {
>>>> + dev_err(&pdev->dev, "apss minidump initialization failed: %d\n", ret);
>>>> + goto unlock;
>>>> + }
>>>> +
>>>> + __md = md;
>>>
>>> No. This is a platform device, so it can have multiple instances.
>>
>> It can have only one instance that is created from SMEM driver probe.
>
> Anyone can instantiate more of them.... how did you solve it?
To clarify - sprinkling more of singletons makes everything tightly
coupled, difficult to debug and non-portable. You cannot have two
instances, you have to control concurrent initialization by yourself in
each of such singletons.
I understand sometimes they are unavoidable, for example when this does
not map to hardware property. However here you have the parent - smem -
which can return you valid instance. Thus you avoid entire problem of
file-scope variables.
Best regards,
Krzysztof
Powered by blists - more mailing lists