From: Julius Bairaktaris <julius@bairaktaris.de>
To: robimarko@gmail.com
Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
andersson@kernel.org, konradybcio@kernel.org,
abelvesa@kernel.org, ilia.lin@kernel.org, rafael@kernel.org,
viresh.kumar@linaro.org, ulfh@kernel.org, lgirdwood@gmail.com,
broonie@kernel.org, angelogioacchino.delregno@somainline.org,
devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
konrad.dybcio@linaro.org
Subject: Re: [PATCH 2/7] pmdomain: qcom: add CPRv4 power domain driver
Date: Sat, 5 Dec 2026 16:00:47 +0100 [thread overview]
Message-ID: <20261205140000.cpr4-unbind.julius@bairaktaris.de> (raw)
In-Reply-To: <20261201213534.343361-3-robimarko@gmail.com>
On Tue, Dec 01, 2026 at 10:34:15PM +0100, Robert Marko wrote:
> +unreg_genpd:
> + /* Clean up genpds */
> + for (i = desc->num_threads - 1; i >= 0; i--)
> + pm_genpd_remove(&drv->threads[i].pd);
i is an unsigned int in cpr_probe(), so this loop does not end: once i
wraps it indexes past drv->threads. Any error from cpr4_init_parameters(),
cpr_configure() or of_genpd_add_provider_onecell() lands here. An int, or
"while (i--)" from num_threads, fixes it.
> +static void cpr_remove(struct platform_device *pdev)
> +{
> + struct cpr_drv *drv = platform_get_drvdata(pdev);
> + int i;
> +
> + of_genpd_del_provider(pdev->dev.of_node);
> +
> + for (i = 0; i < drv->desc->num_threads; i++) {
> + cpr_ctl_disable(&drv->threads[i]);
> + cpr_irq_set(&drv->threads[i], 0);
> + pm_genpd_remove(&drv->threads[i].pd);
> + }
An unbind through /sys/bus/platform/drivers/qcom-cpr4/unbind, or rmmod,
runs this while qcom-cpufreq-nvmem has the CPUs attached. pm_genpd_remove()
returns -EBUSY because device_count is not zero, the error is dropped, and
devres frees drv->threads with the still registered domain in it, drv,
the MMIO mapping and the vdd regulator. The next frequency change runs
cpr_set_performance_state() on the freed domain.
> +static struct platform_driver cpr4_driver = {
> + .probe = cpr_probe,
> + .remove = cpr_remove,
> + .driver = {
> + .name = "qcom-cpr4",
> + .of_match_table = cpr4_match_table,
> + },
> +};
> +module_platform_driver(cpr4_driver)
remove() cannot refuse and the CPUs never detach, so drop cpr_remove()
and do what rpmpd and rpmhpd do: set .suppress_bind_attrs = true and
register with builtin_platform_driver(cpr4_driver), which has no module
exit. The platform_set_drvdata() in probe then has no reader.
The APCS device link added in probe is a managed link, so unbinding
qcom-apcs-ipc still unbinds this device. That driver's remove() also
unregisters the CPU clock device, so the fix for that path goes in the
mailbox driver.
next prev parent reply other threads:[~2026-12-05 15:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 21:34 [PATCH 0/7] Add APSS CPRv4 support for IPQ8074 Robert Marko
2026-12-01 21:34 ` [PATCH 1/7] dt-bindings: power: document Qualcomm CPRv4 Robert Marko
2026-12-01 21:34 ` [PATCH 2/7] pmdomain: qcom: add CPRv4 power domain driver Robert Marko
2026-12-05 15:00 ` Julius Bairaktaris [this message]
2026-12-01 21:34 ` [PATCH 3/7] pmdomain: qcom: cpr4: add IPQ8074 APSS support Robert Marko
2026-12-02 11:19 ` Krzysztof Kozlowski
2026-12-02 11:28 ` Robert Marko
2026-12-01 21:34 ` [PATCH 4/7] cpufreq: qcom: attach IPQ8074 CPUs to CPRv4 domain Robert Marko
2026-12-01 21:34 ` [PATCH 5/7] arm64: dts: qcom: ipq8074: describe APSS CPRv4 fuses Robert Marko
2026-12-01 21:34 ` [PATCH 6/7] arm64: dts: qcom: ipq8074: add APSS CPRv4 and OPPs Robert Marko
2026-12-01 21:34 ` [PATCH 7/7] arm64: dts: qcom: ipq8074-hk10: include PMP8074 PMIC Robert Marko
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=20261205140000.cpr4-unbind.julius@bairaktaris.de \
--to=julius@bairaktaris.de \
--cc=abelvesa@kernel.org \
--cc=andersson@kernel.org \
--cc=angelogioacchino.delregno@somainline.org \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=ilia.lin@kernel.org \
--cc=konrad.dybcio@linaro.org \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=robh@kernel.org \
--cc=robimarko@gmail.com \
--cc=ulfh@kernel.org \
--cc=viresh.kumar@linaro.org \
/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®