From: "Théo Lebrun" <theo.lebrun@bootlin.com>
To: "Christophe JAILLET" <christophe.jaillet@wanadoo.fr>,
"Michael Turquette" <mturquette@baylibre.com>,
"Stephen Boyd" <sboyd@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>
Cc: devicetree@vger.kernel.org, linux-clk@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Vladimir Kondratiev" <vladimir.kondratiev@mobileye.com>,
"Grégory Clement" <gregory.clement@bootlin.com>,
"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
"Tawfik Bayouk" <tawfik.bayouk@mobileye.com>
Subject: Re: [PATCH v4 4/4] clk: eyeq: add driver
Date: Mon, 07 Oct 2024 15:56:14 +0200 [thread overview]
Message-ID: <D4PMJHMDRCCJ.HPOLK6JF49DO@bootlin.com> (raw)
In-Reply-To: <8334a319-96e4-4249-9659-132c8698c895@wanadoo.fr>
On Fri Oct 4, 2024 at 11:20 PM CEST, Christophe JAILLET wrote:
> Le 04/10/2024 à 18:55, Théo Lebrun a écrit :
> > On Fri Oct 4, 2024 at 6:34 PM CEST, Christophe JAILLET wrote:
> >> Le 04/10/2024 à 17:45, Théo Lebrun a écrit :
> >>> +static void eqc_probe_init_plls(struct device *dev, struct eqc_priv *priv)
> >>> +{
> >>> + const struct eqc_match_data *data = priv->data;
> >>> + unsigned long mult, div, acc;
> >>> + const struct eqc_pll *pll;
> >>> + struct clk_hw *hw;
> >>> + unsigned int i;
> >>> + u32 r0, r1;
> >>> + u64 val;
> >>> + int ret;
> >>> +
> >>> + for (i = 0; i < data->pll_count; i++) {
> >>> + pll = &data->plls[i];
> >>> +
> >>> + val = readq(priv->base + pll->reg64);
> >>> + r0 = val;
> >>> + r1 = val >> 32;
> >>> +
> >>> + ret = eqc_pll_parse_registers(r0, r1, &mult, &div, &acc);
> >>> + if (ret) {
> >>> + dev_warn(dev, "failed parsing state of %s\n", pll->name);
> >>> + priv->cells->hws[pll->index] = ERR_PTR(ret);
> >>> + continue;
> >>> + }
> >>> +
> >>> + hw = clk_hw_register_fixed_factor_with_accuracy_fwname(dev,
> >>> + dev->of_node, pll->name, "ref", 0, mult, div, acc);
> >>
> >> Should this be freed somewhere or is it auto-magically freed by a
> >> put_something()?
> >> Maybe devm_action_or_reset()?
> >
> > This driver does not support being removed. It provides essential PLLs
> > and the system has not chance of working without them.
> >
> > Almost all instances will be instantiated at of_clk_init() stage by the
> > way (ie before platform bus infrastructure init). Devres isn't a
> > solution in those cases.
>
> eqc_probe_init_plls() and eqc_probe_init_divs() are called from
> eqc_probe(), which has several devm_ function calls.
>
> Would it make sense to remove these devm_ ?
>
>
> devm_platform_ioremap_resource(),
> devm_kzalloc(),
> devm_of_clk_add_hw_provider(),
> eqc_auxdev_create() which calls devm_add_action_or_reset().
>
> I sent this patch because of these calls.
>
> Either I miss something, either maybe things can be simplified.
You are right, mixing devres and non-devres handled resources was a
mistake. Things have been simplified in revision v5 [0]. It sets
suppress_bind_attrs to true and switches to 100% non-devres calls.
[0]: https://lore.kernel.org/lkml/20241007-mbly-clk-v5-0-e9d8994269cb@bootlin.com/
Thanks,
--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
prev parent reply other threads:[~2024-10-07 13:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-04 15:45 [PATCH v4 0/4] Add Mobileye EyeQ clock support Théo Lebrun
2024-10-04 15:45 ` [PATCH v4 1/4] Revert "dt-bindings: clock: mobileye,eyeq5-clk: add bindings" Théo Lebrun
2024-10-04 15:45 ` [PATCH v4 2/4] dt-bindings: clock: add Mobileye EyeQ6L/EyeQ6H clock indexes Théo Lebrun
2024-10-04 15:45 ` [PATCH v4 3/4] clk: divider: Introduce CLK_DIVIDER_EVEN_INTEGERS flag Théo Lebrun
2024-10-04 15:45 ` [PATCH v4 4/4] clk: eyeq: add driver Théo Lebrun
2024-10-04 16:34 ` Christophe JAILLET
2024-10-04 16:55 ` Théo Lebrun
2024-10-04 21:20 ` Christophe JAILLET
2024-10-07 13:56 ` Théo Lebrun [this message]
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=D4PMJHMDRCCJ.HPOLK6JF49DO@bootlin.com \
--to=theo.lebrun@bootlin.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gregory.clement@bootlin.com \
--cc=krzk+dt@kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=robh@kernel.org \
--cc=sboyd@kernel.org \
--cc=tawfik.bayouk@mobileye.com \
--cc=thomas.petazzoni@bootlin.com \
--cc=vladimir.kondratiev@mobileye.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;
as well as URLs for NNTP newsgroup(s).