From: Krzysztof Kozlowski <krzk@kernel.org>
To: "André Draszik" <andre.draszik@linaro.org>,
"Liam Girdwood" <lgirdwood@gmail.com>,
"Mark Brown" <broonie@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Michael Walle" <mwalle@kernel.org>
Cc: Peter Griffin <peter.griffin@linaro.org>,
Tudor Ambarus <tudor.ambarus@linaro.org>,
Will McVicker <willmcvicker@google.com>,
kernel-team@android.com, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH 2/2] regulator: max20339: add Maxim MAX20339 regulator driver
Date: Tue, 17 Sep 2024 10:15:04 +0200 [thread overview]
Message-ID: <a2193800-69ea-4909-ba8b-05b85915ae6a@kernel.org> (raw)
In-Reply-To: <290668fb4f86a4d2caa779e517c736c93c3fc429.camel@linaro.org>
On 17/09/2024 10:03, André Draszik wrote:
>>> +}
>>> +
>>> +static int max20339_lsw_dt_parse(struct device_node *np,
>>> + const struct regulator_desc *desc,
>>> + struct regulator_config *cfg)
>>> +{
>>> + struct max20339_regulator *data = cfg->driver_data;
>>> +
>>> + /* we turn missing properties into a fatal issue during probe() */
>>
>> Your binding does not look in sync with above.
>
> Do you mean it doesn't enforce existence of this property? (It does and
> binding check appropriately complains if it's missing). Otherwise, can
> you please point me to the problem you're seeing?
Indeed, it's in the subnode. It's fine.
>
> From the binding:
>
> +properties:
> + [...]
> + regulators:
> + type: object
> + [...]
> + patternProperties:
> + "^lsw[12]$":
> + [...]
> + properties:
> + [...]
> + shunt-resistor-micro-ohms:
> + [...]
> + required:
> + - shunt-resistor-micro-ohms
> +
> + unevaluatedProperties: false
> +
> + required:
> + - lsw1
> + - lsw2
> +
> + additionalProperties: false
> +
> +[...]
> +
> +required:
> + [...]
> + - regulators
>
> Anything wrong or missing in the above?
>
>>> [...]
>>> + }, \
>>> + .ovp_mask = _ovp_mask, \
>>> + .status_reg = _status_reg, \
>>> +}
>>> +
>>> +
>>
>> Here and in few other places - just one blank line.
>
> OK.
>
>>> +static struct max20339_regulator max20339_regulators[MAX20339_N_REGULATORS] = {
>>
>> This can be const and then use container_of instead of rdev_get_drvdata().
>>
>> See:
>> https://lore.kernel.org/all/20240909-regulator-const-v1-17-8934704a5787@linaro.org/
>
> Thanks!
>
>> [...]
>>> +
>>> + irq_flags = IRQF_ONESHOT | IRQF_SHARED;
>>
>> Why shared?
>
> Just to be nice in case somebody puts it on a shared line. Not actually
> required in my case.
>
>>> + irq_flags |= irqd_get_trigger_type(irq_get_irq_data(client->irq));
>>> +
>>> + ret = devm_request_threaded_irq(&client->dev, client->irq,
>>
>> Shared interrupts should not be devm. It leads to tricky cases during
>> removal. If you investigated the code and you are 100% sure there is no
>> issue, please write a short comment in the code confirming that. Or just
>> don't use devm.
>
> I wasn't aware of this, thanks. I'll drop the shared and somebody can
> revisit it in the future if required. BTW, a naive grep returned +400
> drivers that use shared together with devm.
Yeah, I was once thinking to check them, because there is an easy hint
problems are possible: if driver has remove() callback which does
anything with resources. However even if driver code looks unsafe, it
requires quite some time to figure out if the issue is real - need to
find other driver who will trigger the interrupt afterwards.
You can BTW test it with CONFIG_DEBUG_SHIRQ + bind/unbind.
Maybe we need some more explicit documentation around devm() or IRQF_SHARED.
Best regards,
Krzysztof
next prev parent reply other threads:[~2024-09-17 8:15 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-16 16:48 [PATCH 0/2] " André Draszik
2024-09-16 16:48 ` [PATCH 1/2] dt-bindings: regulator: add max20339 binding André Draszik
2024-09-16 19:53 ` Peter Griffin
2024-09-17 5:15 ` André Draszik
2024-09-16 19:56 ` Krzysztof Kozlowski
2024-09-17 6:17 ` André Draszik
2024-09-16 16:48 ` [PATCH 2/2] regulator: max20339: add Maxim MAX20339 regulator driver André Draszik
2024-09-16 20:06 ` Krzysztof Kozlowski
2024-09-17 8:03 ` André Draszik
2024-09-17 8:15 ` Krzysztof Kozlowski [this message]
2024-09-17 8:16 ` Krzysztof Kozlowski
2024-09-17 8:59 ` Mark Brown
2024-09-17 16:55 ` Krzysztof Kozlowski
2024-09-17 9:19 ` Mark Brown
2024-09-17 11:41 ` André Draszik
2024-09-18 8:49 ` Mark Brown
2024-09-20 7:23 ` kernel test robot
2024-09-20 16:28 ` kernel test robot
2024-09-16 17:01 ` [PATCH 0/2] " André Draszik
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=a2193800-69ea-4909-ba8b-05b85915ae6a@kernel.org \
--to=krzk@kernel.org \
--cc=andre.draszik@linaro.org \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=kernel-team@android.com \
--cc=krzk+dt@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mwalle@kernel.org \
--cc=peter.griffin@linaro.org \
--cc=robh@kernel.org \
--cc=tudor.ambarus@linaro.org \
--cc=willmcvicker@google.com \
/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
all inboxes | Powered by JetHome®