* [PATCH v2] power: sequencing: rename pwrseq_power_on/off() to pwrseq_enable/disable()
@ 2026-07-31 8:28 Bartosz Golaszewski
2026-07-31 8:37 ` sashiko-bot
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Bartosz Golaszewski @ 2026-07-31 8:28 UTC (permalink / raw)
To: Bartosz Golaszewski, Jonathan Corbet, Shuah Khan, Marcel Holtmann,
Luiz Augusto von Dentz, Alessio Belle, Luigi Santivetti,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Jeff Johnson, Manivannan Sadhasivam, Bjorn Helgaas,
Chen-Yu Tsai, Loic Poulain
Cc: linux-pm, linux-doc, linux-kernel, linux-arm-msm, linux-bluetooth,
imagination, dri-devel, linux-wireless, ath10k, linux-pci,
Jeff Johnson, Bartosz Golaszewski
The way power sequencing works means that a call to pwrseq_power_on()
does not necessarily result in the pwrseq target being powered-on at
that time: it may have already been powered on before. Similarly: a call
to pwrseq_power_off() does not have to result in an actual powering off
of resources: there may still be other users that requested a power-on
before.
We will also introduce the concept of "non-controllable" pwrseq targets
soon which further increases the disconnect between the naming
convention and the actual semantics.
What consumers of pwrseq descriptors actually do is: they *vote* for a
powering on of a given target or retract that vote. These operations
could be called get/put in line with runtime PM but this could become
confusing since we already provide pwrseq_get/put() for a different
purpose. pwrseq_vote_on/off() also have been rejected as unusual in
the tree.
Change the name of the two functions to pwrseq_enable/disable() which
better reflects their purpose and semantics and also mirrors other
enable-counted resources like regulators and clocks. No functional change
intended.
If at any point users need to know *when* the exact power event happens,
we can provide that information in the form of a notifier.
Acked-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
I've floated the idea to rename the two pwrseq functions from "power
on/off" to "vote on/off". I've sent a patch but the overwhelming
consensus seem to be that enable/disable naming is preferred.
I'm doing it in a single commit that should go through the pwrseq tree
with Acks from subsystem maintainers.
[1] https://lore.kernel.org/all/CAMRc=Mefxn81d0VUwmQgwFtffkL1=Er_1VQZCbC1Sa-Qph4t1w@mail.gmail.com/
---
Changes in v2:
- Change the naming convention to enable/disable
- Link to v1: https://patch.msgid.link/20260727-pwrseq-vote-rename-v1-1-a2029aeeac65@oss.qualcomm.com
---
Documentation/driver-api/pwrseq.rst | 4 ++--
drivers/bluetooth/hci_qca.c | 4 ++--
drivers/gpu/drm/imagination/pvr_power.c | 4 ++--
drivers/net/wireless/ath/ath10k/snoc.c | 6 +++---
drivers/pci/pwrctrl/generic.c | 4 ++--
drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c | 4 ++--
drivers/power/sequencing/core.c | 16 ++++++++--------
include/linux/pwrseq/consumer.h | 8 ++++----
8 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/Documentation/driver-api/pwrseq.rst b/Documentation/driver-api/pwrseq.rst
index ad18b2326b689a41471216f3889480b11768ca82..0c315ab1138b02540fae60b39928c580027c0f7c 100644
--- a/Documentation/driver-api/pwrseq.rst
+++ b/Documentation/driver-api/pwrseq.rst
@@ -50,9 +50,9 @@ Consumer interface
The consumer API is aimed to be as simple as possible. The driver interested in
getting a descriptor from the power sequencer should call pwrseq_get() and
specify the name of the target it wants to reach in the sequence after calling
-pwrseq_power_up(). The descriptor can be released by calling pwrseq_put() and
+pwrseq_enable(). The descriptor can be released by calling pwrseq_put() and
the consumer can request the powering down of its target with
-pwrseq_power_off(). Note that there is no guarantee that pwrseq_power_off()
+pwrseq_disble(). Note that there is no guarantee that pwrseq_disble()
will have any effect as there may be multiple users of the underlying resources
who may keep them active.
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 345f602e9ce233a0934a73a85d1e7c17c4f3210d..e713fc06b73402ae3d57794ed0870df8394a796a 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -2259,7 +2259,7 @@ static void qca_power_off(struct hci_uart *hu)
}
if (power && power->pwrseq) {
- pwrseq_power_off(power->pwrseq);
+ pwrseq_disble(power->pwrseq);
set_bit(QCA_BT_OFF, &qca->flags);
return;
}
@@ -2319,7 +2319,7 @@ static int qca_regulator_enable(struct qca_serdev *qcadev)
int ret;
if (power->pwrseq)
- return pwrseq_power_on(power->pwrseq);
+ return pwrseq_enable(power->pwrseq);
/* Already enabled */
if (power->vregs_on)
diff --git a/drivers/gpu/drm/imagination/pvr_power.c b/drivers/gpu/drm/imagination/pvr_power.c
index a71d5b35601e7b996428312028a4c0542a5b1350..031fad8adf4f4843e852000d3d6ba45d0e4b0aeb 100644
--- a/drivers/gpu/drm/imagination/pvr_power.c
+++ b/drivers/gpu/drm/imagination/pvr_power.c
@@ -352,12 +352,12 @@ static int pvr_power_init_pwrseq(struct pvr_device *pvr_dev)
static int pvr_power_on_sequence_pwrseq(struct pvr_device *pvr_dev)
{
- return pwrseq_power_on(pvr_dev->pwrseq);
+ return pwrseq_enable(pvr_dev->pwrseq);
}
static int pvr_power_off_sequence_pwrseq(struct pvr_device *pvr_dev)
{
- return pwrseq_power_off(pvr_dev->pwrseq);
+ return pwrseq_disble(pvr_dev->pwrseq);
}
const struct pvr_power_sequence_ops pvr_power_sequence_ops_pwrseq = {
diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c
index 3106502275781d32d17a45a661362206144df6b3..d7e23971fe1da99f6b5f7559d62d04e2044d8950 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -1025,7 +1025,7 @@ static int ath10k_hw_power_on(struct ath10k *ar)
ath10k_dbg(ar, ATH10K_DBG_SNOC, "soc power on\n");
- ret = pwrseq_power_on(ar_snoc->pwrseq);
+ ret = pwrseq_enable(ar_snoc->pwrseq);
if (ret)
return ret;
@@ -1042,7 +1042,7 @@ static int ath10k_hw_power_on(struct ath10k *ar)
vreg_off:
regulator_bulk_disable(ar_snoc->num_vregs, ar_snoc->vregs);
pwrseq_off:
- pwrseq_power_off(ar_snoc->pwrseq);
+ pwrseq_disble(ar_snoc->pwrseq);
return ret;
}
@@ -1060,7 +1060,7 @@ static int ath10k_hw_power_off(struct ath10k *ar)
ret_vreg = regulator_bulk_disable(ar_snoc->num_vregs, ar_snoc->vregs);
if (ar_snoc->pwrseq)
- ret_seq = pwrseq_power_off(ar_snoc->pwrseq);
+ ret_seq = pwrseq_disble(ar_snoc->pwrseq);
return ret_vreg ? : ret_seq;
}
diff --git a/drivers/pci/pwrctrl/generic.c b/drivers/pci/pwrctrl/generic.c
index a7e599d841e6289db161b19a93ba5a61d9e0ab1c..d366883355173eac1a2631b73e5e041666ac23ad 100644
--- a/drivers/pci/pwrctrl/generic.c
+++ b/drivers/pci/pwrctrl/generic.c
@@ -29,7 +29,7 @@ static int slot_pwrctrl_power_on(struct pci_pwrctrl *pwrctrl)
int ret;
if (slot->pwrseq) {
- pwrseq_power_on(slot->pwrseq);
+ pwrseq_enable(slot->pwrseq);
return 0;
}
@@ -48,7 +48,7 @@ static int slot_pwrctrl_power_off(struct pci_pwrctrl *pwrctrl)
struct slot_pwrctrl, pwrctrl);
if (slot->pwrseq) {
- pwrseq_power_off(slot->pwrseq);
+ pwrseq_disble(slot->pwrseq);
return 0;
}
diff --git a/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c b/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c
index a308bf4b5fc01d23b75db4cd396201c3ba3fe695..2a6f46f6e2012dd985b657c97c85879ba13b5133 100644
--- a/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c
+++ b/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c
@@ -56,7 +56,7 @@ static int pwrseq_pwrctrl_power_on(struct pci_pwrctrl *pwrctrl)
struct pwrseq_pwrctrl *pwrseq = container_of(pwrctrl,
struct pwrseq_pwrctrl, pwrctrl);
- return pwrseq_power_on(pwrseq->pwrseq);
+ return pwrseq_enable(pwrseq->pwrseq);
}
static int pwrseq_pwrctrl_power_off(struct pci_pwrctrl *pwrctrl)
@@ -64,7 +64,7 @@ static int pwrseq_pwrctrl_power_off(struct pci_pwrctrl *pwrctrl)
struct pwrseq_pwrctrl *pwrseq = container_of(pwrctrl,
struct pwrseq_pwrctrl, pwrctrl);
- return pwrseq_power_off(pwrseq->pwrseq);
+ return pwrseq_disble(pwrseq->pwrseq);
}
static int pwrseq_pwrctrl_probe(struct platform_device *pdev)
diff --git a/drivers/power/sequencing/core.c b/drivers/power/sequencing/core.c
index 02f42da915985339d3de507fc36dd158b0035a99..34d5c0af6f37bdbfa9d656d95795d38cc7e38762 100644
--- a/drivers/power/sequencing/core.c
+++ b/drivers/power/sequencing/core.c
@@ -708,7 +708,7 @@ void pwrseq_put(struct pwrseq_desc *desc)
pwrseq = desc->pwrseq;
if (desc->powered_on)
- pwrseq_power_off(desc);
+ pwrseq_disble(desc);
kfree(desc);
module_put(pwrseq->owner);
@@ -874,7 +874,7 @@ static int pwrseq_unit_disable(struct pwrseq_device *pwrseq,
}
/**
- * pwrseq_power_on() - Issue a power-on request on behalf of the consumer
+ * pwrseq_enable() - Issue a power-on request on behalf of the consumer
* device.
* @desc: Descriptor referencing the power sequencer.
*
@@ -887,7 +887,7 @@ static int pwrseq_unit_disable(struct pwrseq_device *pwrseq,
* Returns:
* 0 on success, negative error number on failure.
*/
-int pwrseq_power_on(struct pwrseq_desc *desc)
+int pwrseq_enable(struct pwrseq_desc *desc)
{
struct pwrseq_device *pwrseq;
struct pwrseq_target *target;
@@ -925,14 +925,14 @@ int pwrseq_power_on(struct pwrseq_desc *desc)
return ret;
}
-EXPORT_SYMBOL_GPL(pwrseq_power_on);
+EXPORT_SYMBOL_GPL(pwrseq_enable);
/**
- * pwrseq_power_off() - Issue a power-off request on behalf of the consumer
+ * pwrseq_disble() - Issue a power-off request on behalf of the consumer
* device.
* @desc: Descriptor referencing the power sequencer.
*
- * This undoes the effects of pwrseq_power_on(). It issues a power-off request
+ * This undoes the effects of pwrseq_enable(). It issues a power-off request
* on behalf of the consumer and when the last remaining user does so, the
* power-down sequence will be started. If one is in progress, the function
* will block until it's complete and then return.
@@ -940,7 +940,7 @@ EXPORT_SYMBOL_GPL(pwrseq_power_on);
* Returns:
* 0 on success, negative error number on failure.
*/
-int pwrseq_power_off(struct pwrseq_desc *desc)
+int pwrseq_disble(struct pwrseq_desc *desc)
{
struct pwrseq_device *pwrseq;
struct pwrseq_unit *unit;
@@ -966,7 +966,7 @@ int pwrseq_power_off(struct pwrseq_desc *desc)
return ret;
}
-EXPORT_SYMBOL_GPL(pwrseq_power_off);
+EXPORT_SYMBOL_GPL(pwrseq_disble);
/**
* pwrseq_to_device() - Get the pwrseq device pointer from a descriptor.
diff --git a/include/linux/pwrseq/consumer.h b/include/linux/pwrseq/consumer.h
index 3c907c9e1885dc2958043a9a733fbe20bdf95f6e..5e94b0b9c38b036fc40e3e2c8c6e1020d0d0bb6e 100644
--- a/include/linux/pwrseq/consumer.h
+++ b/include/linux/pwrseq/consumer.h
@@ -20,8 +20,8 @@ void pwrseq_put(struct pwrseq_desc *desc);
struct pwrseq_desc * __must_check
devm_pwrseq_get(struct device *dev, const char *target);
-int pwrseq_power_on(struct pwrseq_desc *desc);
-int pwrseq_power_off(struct pwrseq_desc *desc);
+int pwrseq_enable(struct pwrseq_desc *desc);
+int pwrseq_disble(struct pwrseq_desc *desc);
struct device *pwrseq_to_device(struct pwrseq_desc *desc);
@@ -43,12 +43,12 @@ devm_pwrseq_get(struct device *dev, const char *target)
return ERR_PTR(-ENOSYS);
}
-static inline int pwrseq_power_on(struct pwrseq_desc *desc)
+static inline int pwrseq_enable(struct pwrseq_desc *desc)
{
return -ENOSYS;
}
-static inline int pwrseq_power_off(struct pwrseq_desc *desc)
+static inline int pwrseq_disble(struct pwrseq_desc *desc)
{
return -ENOSYS;
}
---
base-commit: 95d6a9ccef99117115e41e9adb271243bd5e985b
change-id: 20260727-pwrseq-vote-rename-b7cd21032668
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] power: sequencing: rename pwrseq_power_on/off() to pwrseq_enable/disable()
2026-07-31 8:28 [PATCH v2] power: sequencing: rename pwrseq_power_on/off() to pwrseq_enable/disable() Bartosz Golaszewski
@ 2026-07-31 8:37 ` sashiko-bot
2026-07-31 8:43 ` Loic Poulain
2026-07-31 10:16 ` [v2] " bluez.test.bot
2 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-07-31 8:37 UTC (permalink / raw)
To: Bartosz Golaszewski; +Cc: dri-devel, linux-pci
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
New issues:
- [Low] The function `pwrseq_power_off()` was incorrectly renamed to `pwrseq_disble()` instead of `pwrseq_disable()`.
Pre-existing issues:
- [High] Unchecked failure in the rollback path of `pwrseq_enable()` leads to a leaked power sequence enable count and an inconsistent descriptor state.
- [High] TOCTOU race on `desc->powered_on` in `pwrseq_enable()` and `pwrseq_disble()` leads to leaked power sequencer votes or unbalanced enable counts.
--
--- Patch [1]: [PATCH v2] power: sequencing: rename pwrseq_power_on/off() to pwrseq_enable/disable() ---
commit adf6e02fc844795e2717b0bb913d426b91714a03
Author: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Subject: power: sequencing: rename pwrseq_power_on/off() to pwrseq_enable/disable()
This commit renames pwrseq_power_on() and pwrseq_power_off() to
pwrseq_enable() and pwrseq_disable(). The new names better reflect the
semantics of voting for power states rather than direct power control.
Link: https://lore.kernel.org/all/CAMRc=Mefxn81d0VUwmQgwFtffkL1=Er_1VQZCbC1Sa-Qph4t1w@mail.gmail.com/
Link: https://patch.msgid.link/20260727-pwrseq-vote-rename-v1-1-a2029aeeac65@oss.qualcomm.com
> diff --git a/Documentation/driver-api/pwrseq.rst b/Documentation/driver-api/pwrseq.rst
> index ad18b2326b689..0c315ab1138b0 100644
> --- a/Documentation/driver-api/pwrseq.rst
> +++ b/Documentation/driver-api/pwrseq.rst
> @@ -50,9 +50,9 @@ Consumer interface
> The consumer API is aimed to be as simple as possible. The driver interested in
> getting a descriptor from the power sequencer should call pwrseq_get() and
> specify the name of the target it wants to reach in the sequence after calling
> -pwrseq_power_up(). The descriptor can be released by calling pwrseq_put() and
> +pwrseq_enable(). The descriptor can be released by calling pwrseq_put() and
> the consumer can request the powering down of its target with
> -pwrseq_power_off(). Note that there is no guarantee that pwrseq_power_off()
> +pwrseq_disble(). Note that there is no guarantee that pwrseq_disble()
[Severity: Low]
Is this function name a typo? Should it be pwrseq_disable() instead of
pwrseq_disble()?
[ ... ]
> diff --git a/drivers/power/sequencing/core.c b/drivers/power/sequencing/core.c
> index 02f42da915985..34d5c0af6f37b 100644
> --- a/drivers/power/sequencing/core.c
> +++ b/drivers/power/sequencing/core.c
[ ... ]
> @@ -887,7 +887,7 @@ static int pwrseq_unit_disable(struct pwrseq_device *pwrseq,
> * Returns:
> * 0 on success, negative error number on failure.
> */
> -int pwrseq_power_on(struct pwrseq_desc *desc)
> +int pwrseq_enable(struct pwrseq_desc *desc)
> {
[Severity: High]
This is a pre-existing issue, but does this function leak the power sequencer
enable count if the rollback fails?
Looking at pwrseq_enable(), if target->post_enable() fails, it attempts to
roll back by calling pwrseq_unit_disable():
if (target->post_enable) {
ret = target->post_enable(pwrseq);
if (ret) {
scoped_guard(mutex, &pwrseq->state_lock) {
pwrseq_unit_disable(pwrseq, unit);
desc->powered_on = false;
}
}
}
If pwrseq_unit_disable() returns an error (for example, due to a hardware
failure), the unit's enable_count won't be decremented, but desc->powered_on
is unconditionally set to false.
Later, when the consumer calls pwrseq_put() or pwrseq_disable(), it will skip
calling pwrseq_unit_disable() because desc->powered_on is false, permanently
leaving the hardware enabled. Should the code check the return value of
pwrseq_unit_disable() before clearing desc->powered_on?
[Severity: High]
This is a pre-existing issue, but is there a TOCTOU race condition when
checking desc->powered_on?
In pwrseq_enable(), the desc->powered_on flag is checked outside the state
lock, but modified inside it:
if (!desc || desc->powered_on)
return 0;
...
scoped_guard(mutex, &pwrseq->state_lock) {
ret = pwrseq_unit_enable(pwrseq, unit);
if (!ret)
desc->powered_on = true;
}
If multiple threads call pwrseq_enable() concurrently on the same descriptor,
both could see desc->powered_on as false. They would then serialize on the
state_lock and both increment the unit's enable_count. A subsequent call to
pwrseq_disable() would only decrement it once, leaking the second vote.
> struct pwrseq_device *pwrseq;
> struct pwrseq_target *target;
[ ... ]
> @@ -940,7 +940,7 @@ EXPORT_SYMBOL_GPL(pwrseq_power_on);
> * Returns:
> * 0 on success, negative error number on failure.
> */
> -int pwrseq_power_off(struct pwrseq_desc *desc)
> +int pwrseq_disble(struct pwrseq_desc *desc)
> {
[Severity: High]
This is a pre-existing issue, but does pwrseq_disble() have the same TOCTOU
race on desc->powered_on as pwrseq_enable()?
if (!desc || !desc->powered_on)
return 0;
...
guard(mutex)(&pwrseq->state_lock);
ret = pwrseq_unit_disable(pwrseq, unit);
if (!ret)
desc->powered_on = false;
Concurrent calls could result in both seeing desc->powered_on as true,
leading to unbalanced decrements of the enable_count.
> struct pwrseq_device *pwrseq;
> struct pwrseq_unit *unit;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260731-pwrseq-vote-rename-v2-1-480357946e00@oss.qualcomm.com?part=1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] power: sequencing: rename pwrseq_power_on/off() to pwrseq_enable/disable()
2026-07-31 8:28 [PATCH v2] power: sequencing: rename pwrseq_power_on/off() to pwrseq_enable/disable() Bartosz Golaszewski
2026-07-31 8:37 ` sashiko-bot
@ 2026-07-31 8:43 ` Loic Poulain
2026-07-31 13:04 ` Bartosz Golaszewski
2026-07-31 10:16 ` [v2] " bluez.test.bot
2 siblings, 1 reply; 6+ messages in thread
From: Loic Poulain @ 2026-07-31 8:43 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Bartosz Golaszewski, Jonathan Corbet, Shuah Khan, Marcel Holtmann,
Luiz Augusto von Dentz, Alessio Belle, Luigi Santivetti,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Jeff Johnson, Manivannan Sadhasivam, Bjorn Helgaas,
Chen-Yu Tsai, linux-pm, linux-doc, linux-kernel, linux-arm-msm,
linux-bluetooth, imagination, dri-devel, linux-wireless, ath10k,
linux-pci, Jeff Johnson
On Fri, Jul 31, 2026 at 10:29 AM Bartosz Golaszewski
<bartosz.golaszewski@oss.qualcomm.com> wrote:
>
> The way power sequencing works means that a call to pwrseq_power_on()
> does not necessarily result in the pwrseq target being powered-on at
> that time: it may have already been powered on before. Similarly: a call
> to pwrseq_power_off() does not have to result in an actual powering off
> of resources: there may still be other users that requested a power-on
> before.
>
> We will also introduce the concept of "non-controllable" pwrseq targets
> soon which further increases the disconnect between the naming
> convention and the actual semantics.
>
> What consumers of pwrseq descriptors actually do is: they *vote* for a
> powering on of a given target or retract that vote. These operations
> could be called get/put in line with runtime PM but this could become
> confusing since we already provide pwrseq_get/put() for a different
> purpose. pwrseq_vote_on/off() also have been rejected as unusual in
> the tree.
>
> Change the name of the two functions to pwrseq_enable/disable() which
> better reflects their purpose and semantics and also mirrors other
> enable-counted resources like regulators and clocks. No functional change
> intended.
>
> If at any point users need to know *when* the exact power event happens,
> we can provide that information in the form of a notifier.
>
> Acked-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> ---
> I've floated the idea to rename the two pwrseq functions from "power
> on/off" to "vote on/off". I've sent a patch but the overwhelming
> consensus seem to be that enable/disable naming is preferred.
>
> I'm doing it in a single commit that should go through the pwrseq tree
> with Acks from subsystem maintainers.
>
> [1] https://lore.kernel.org/all/CAMRc=Mefxn81d0VUwmQgwFtffkL1=Er_1VQZCbC1Sa-Qph4t1w@mail.gmail.com/
> ---
> Changes in v2:
> - Change the naming convention to enable/disable
> - Link to v1: https://patch.msgid.link/20260727-pwrseq-vote-rename-v1-1-a2029aeeac65@oss.qualcomm.com
> ---
> Documentation/driver-api/pwrseq.rst | 4 ++--
> drivers/bluetooth/hci_qca.c | 4 ++--
> drivers/gpu/drm/imagination/pvr_power.c | 4 ++--
> drivers/net/wireless/ath/ath10k/snoc.c | 6 +++---
> drivers/pci/pwrctrl/generic.c | 4 ++--
> drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c | 4 ++--
> drivers/power/sequencing/core.c | 16 ++++++++--------
> include/linux/pwrseq/consumer.h | 8 ++++----
> 8 files changed, 25 insertions(+), 25 deletions(-)
>
> diff --git a/Documentation/driver-api/pwrseq.rst b/Documentation/driver-api/pwrseq.rst
> index ad18b2326b689a41471216f3889480b11768ca82..0c315ab1138b02540fae60b39928c580027c0f7c 100644
> --- a/Documentation/driver-api/pwrseq.rst
> +++ b/Documentation/driver-api/pwrseq.rst
> @@ -50,9 +50,9 @@ Consumer interface
> The consumer API is aimed to be as simple as possible. The driver interested in
> getting a descriptor from the power sequencer should call pwrseq_get() and
> specify the name of the target it wants to reach in the sequence after calling
> -pwrseq_power_up(). The descriptor can be released by calling pwrseq_put() and
> +pwrseq_enable(). The descriptor can be released by calling pwrseq_put() and
> the consumer can request the powering down of its target with
> -pwrseq_power_off(). Note that there is no guarantee that pwrseq_power_off()
> +pwrseq_disble(). Note that there is no guarantee that pwrseq_disble()
> will have any effect as there may be multiple users of the underlying resources
> who may keep them active.
>
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index 345f602e9ce233a0934a73a85d1e7c17c4f3210d..e713fc06b73402ae3d57794ed0870df8394a796a 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -2259,7 +2259,7 @@ static void qca_power_off(struct hci_uart *hu)
> }
>
> if (power && power->pwrseq) {
> - pwrseq_power_off(power->pwrseq);
> + pwrseq_disble(power->pwrseq);
Nit: s/pwrseq_disble/pwrseq_disable ?
> set_bit(QCA_BT_OFF, &qca->flags);
> return;
> }
> @@ -2319,7 +2319,7 @@ static int qca_regulator_enable(struct qca_serdev *qcadev)
> int ret;
>
> if (power->pwrseq)
> - return pwrseq_power_on(power->pwrseq);
> + return pwrseq_enable(power->pwrseq);
>
> /* Already enabled */
> if (power->vregs_on)
> diff --git a/drivers/gpu/drm/imagination/pvr_power.c b/drivers/gpu/drm/imagination/pvr_power.c
> index a71d5b35601e7b996428312028a4c0542a5b1350..031fad8adf4f4843e852000d3d6ba45d0e4b0aeb 100644
> --- a/drivers/gpu/drm/imagination/pvr_power.c
> +++ b/drivers/gpu/drm/imagination/pvr_power.c
> @@ -352,12 +352,12 @@ static int pvr_power_init_pwrseq(struct pvr_device *pvr_dev)
>
> static int pvr_power_on_sequence_pwrseq(struct pvr_device *pvr_dev)
> {
> - return pwrseq_power_on(pvr_dev->pwrseq);
> + return pwrseq_enable(pvr_dev->pwrseq);
> }
>
> static int pvr_power_off_sequence_pwrseq(struct pvr_device *pvr_dev)
> {
> - return pwrseq_power_off(pvr_dev->pwrseq);
> + return pwrseq_disble(pvr_dev->pwrseq);
> }
>
> const struct pvr_power_sequence_ops pvr_power_sequence_ops_pwrseq = {
> diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c
> index 3106502275781d32d17a45a661362206144df6b3..d7e23971fe1da99f6b5f7559d62d04e2044d8950 100644
> --- a/drivers/net/wireless/ath/ath10k/snoc.c
> +++ b/drivers/net/wireless/ath/ath10k/snoc.c
> @@ -1025,7 +1025,7 @@ static int ath10k_hw_power_on(struct ath10k *ar)
>
> ath10k_dbg(ar, ATH10K_DBG_SNOC, "soc power on\n");
>
> - ret = pwrseq_power_on(ar_snoc->pwrseq);
> + ret = pwrseq_enable(ar_snoc->pwrseq);
> if (ret)
> return ret;
>
> @@ -1042,7 +1042,7 @@ static int ath10k_hw_power_on(struct ath10k *ar)
> vreg_off:
> regulator_bulk_disable(ar_snoc->num_vregs, ar_snoc->vregs);
> pwrseq_off:
> - pwrseq_power_off(ar_snoc->pwrseq);
> + pwrseq_disble(ar_snoc->pwrseq);
>
> return ret;
> }
> @@ -1060,7 +1060,7 @@ static int ath10k_hw_power_off(struct ath10k *ar)
> ret_vreg = regulator_bulk_disable(ar_snoc->num_vregs, ar_snoc->vregs);
>
> if (ar_snoc->pwrseq)
> - ret_seq = pwrseq_power_off(ar_snoc->pwrseq);
> + ret_seq = pwrseq_disble(ar_snoc->pwrseq);
>
> return ret_vreg ? : ret_seq;
> }
> diff --git a/drivers/pci/pwrctrl/generic.c b/drivers/pci/pwrctrl/generic.c
> index a7e599d841e6289db161b19a93ba5a61d9e0ab1c..d366883355173eac1a2631b73e5e041666ac23ad 100644
> --- a/drivers/pci/pwrctrl/generic.c
> +++ b/drivers/pci/pwrctrl/generic.c
> @@ -29,7 +29,7 @@ static int slot_pwrctrl_power_on(struct pci_pwrctrl *pwrctrl)
> int ret;
>
> if (slot->pwrseq) {
> - pwrseq_power_on(slot->pwrseq);
> + pwrseq_enable(slot->pwrseq);
> return 0;
> }
>
> @@ -48,7 +48,7 @@ static int slot_pwrctrl_power_off(struct pci_pwrctrl *pwrctrl)
> struct slot_pwrctrl, pwrctrl);
>
> if (slot->pwrseq) {
> - pwrseq_power_off(slot->pwrseq);
> + pwrseq_disble(slot->pwrseq);
> return 0;
> }
>
> diff --git a/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c b/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c
> index a308bf4b5fc01d23b75db4cd396201c3ba3fe695..2a6f46f6e2012dd985b657c97c85879ba13b5133 100644
> --- a/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c
> +++ b/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c
> @@ -56,7 +56,7 @@ static int pwrseq_pwrctrl_power_on(struct pci_pwrctrl *pwrctrl)
> struct pwrseq_pwrctrl *pwrseq = container_of(pwrctrl,
> struct pwrseq_pwrctrl, pwrctrl);
>
> - return pwrseq_power_on(pwrseq->pwrseq);
> + return pwrseq_enable(pwrseq->pwrseq);
> }
>
> static int pwrseq_pwrctrl_power_off(struct pci_pwrctrl *pwrctrl)
> @@ -64,7 +64,7 @@ static int pwrseq_pwrctrl_power_off(struct pci_pwrctrl *pwrctrl)
> struct pwrseq_pwrctrl *pwrseq = container_of(pwrctrl,
> struct pwrseq_pwrctrl, pwrctrl);
>
> - return pwrseq_power_off(pwrseq->pwrseq);
> + return pwrseq_disble(pwrseq->pwrseq);
> }
>
> static int pwrseq_pwrctrl_probe(struct platform_device *pdev)
> diff --git a/drivers/power/sequencing/core.c b/drivers/power/sequencing/core.c
> index 02f42da915985339d3de507fc36dd158b0035a99..34d5c0af6f37bdbfa9d656d95795d38cc7e38762 100644
> --- a/drivers/power/sequencing/core.c
> +++ b/drivers/power/sequencing/core.c
> @@ -708,7 +708,7 @@ void pwrseq_put(struct pwrseq_desc *desc)
> pwrseq = desc->pwrseq;
>
> if (desc->powered_on)
> - pwrseq_power_off(desc);
> + pwrseq_disble(desc);
>
> kfree(desc);
> module_put(pwrseq->owner);
> @@ -874,7 +874,7 @@ static int pwrseq_unit_disable(struct pwrseq_device *pwrseq,
> }
>
> /**
> - * pwrseq_power_on() - Issue a power-on request on behalf of the consumer
> + * pwrseq_enable() - Issue a power-on request on behalf of the consumer
> * device.
> * @desc: Descriptor referencing the power sequencer.
> *
> @@ -887,7 +887,7 @@ static int pwrseq_unit_disable(struct pwrseq_device *pwrseq,
> * Returns:
> * 0 on success, negative error number on failure.
> */
> -int pwrseq_power_on(struct pwrseq_desc *desc)
> +int pwrseq_enable(struct pwrseq_desc *desc)
> {
> struct pwrseq_device *pwrseq;
> struct pwrseq_target *target;
> @@ -925,14 +925,14 @@ int pwrseq_power_on(struct pwrseq_desc *desc)
>
> return ret;
> }
> -EXPORT_SYMBOL_GPL(pwrseq_power_on);
> +EXPORT_SYMBOL_GPL(pwrseq_enable);
>
> /**
> - * pwrseq_power_off() - Issue a power-off request on behalf of the consumer
> + * pwrseq_disble() - Issue a power-off request on behalf of the consumer
> * device.
> * @desc: Descriptor referencing the power sequencer.
> *
> - * This undoes the effects of pwrseq_power_on(). It issues a power-off request
> + * This undoes the effects of pwrseq_enable(). It issues a power-off request
> * on behalf of the consumer and when the last remaining user does so, the
> * power-down sequence will be started. If one is in progress, the function
> * will block until it's complete and then return.
> @@ -940,7 +940,7 @@ EXPORT_SYMBOL_GPL(pwrseq_power_on);
> * Returns:
> * 0 on success, negative error number on failure.
> */
> -int pwrseq_power_off(struct pwrseq_desc *desc)
> +int pwrseq_disble(struct pwrseq_desc *desc)
> {
> struct pwrseq_device *pwrseq;
> struct pwrseq_unit *unit;
> @@ -966,7 +966,7 @@ int pwrseq_power_off(struct pwrseq_desc *desc)
>
> return ret;
> }
> -EXPORT_SYMBOL_GPL(pwrseq_power_off);
> +EXPORT_SYMBOL_GPL(pwrseq_disble);
>
> /**
> * pwrseq_to_device() - Get the pwrseq device pointer from a descriptor.
> diff --git a/include/linux/pwrseq/consumer.h b/include/linux/pwrseq/consumer.h
> index 3c907c9e1885dc2958043a9a733fbe20bdf95f6e..5e94b0b9c38b036fc40e3e2c8c6e1020d0d0bb6e 100644
> --- a/include/linux/pwrseq/consumer.h
> +++ b/include/linux/pwrseq/consumer.h
> @@ -20,8 +20,8 @@ void pwrseq_put(struct pwrseq_desc *desc);
> struct pwrseq_desc * __must_check
> devm_pwrseq_get(struct device *dev, const char *target);
>
> -int pwrseq_power_on(struct pwrseq_desc *desc);
> -int pwrseq_power_off(struct pwrseq_desc *desc);
> +int pwrseq_enable(struct pwrseq_desc *desc);
> +int pwrseq_disble(struct pwrseq_desc *desc);
>
> struct device *pwrseq_to_device(struct pwrseq_desc *desc);
>
> @@ -43,12 +43,12 @@ devm_pwrseq_get(struct device *dev, const char *target)
> return ERR_PTR(-ENOSYS);
> }
>
> -static inline int pwrseq_power_on(struct pwrseq_desc *desc)
> +static inline int pwrseq_enable(struct pwrseq_desc *desc)
> {
> return -ENOSYS;
> }
>
> -static inline int pwrseq_power_off(struct pwrseq_desc *desc)
> +static inline int pwrseq_disble(struct pwrseq_desc *desc)
> {
> return -ENOSYS;
> }
>
> ---
> base-commit: 95d6a9ccef99117115e41e9adb271243bd5e985b
> change-id: 20260727-pwrseq-vote-rename-b7cd21032668
>
> Best regards,
> --
> Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [v2] power: sequencing: rename pwrseq_power_on/off() to pwrseq_enable/disable()
2026-07-31 8:28 [PATCH v2] power: sequencing: rename pwrseq_power_on/off() to pwrseq_enable/disable() Bartosz Golaszewski
2026-07-31 8:37 ` sashiko-bot
2026-07-31 8:43 ` Loic Poulain
@ 2026-07-31 10:16 ` bluez.test.bot
2 siblings, 0 replies; 6+ messages in thread
From: bluez.test.bot @ 2026-07-31 10:16 UTC (permalink / raw)
To: linux-bluetooth, bartosz.golaszewski
[-- Attachment #1: Type: text/plain, Size: 681 bytes --]
This is an automated email and please do not reply to this email.
Dear Submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.
----- Output -----
error: patch failed: drivers/power/sequencing/core.c:966
error: drivers/power/sequencing/core.c: patch does not apply
error: patch failed: include/linux/pwrseq/consumer.h:20
error: include/linux/pwrseq/consumer.h: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Please resolve the issue and submit the patches again.
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] power: sequencing: rename pwrseq_power_on/off() to pwrseq_enable/disable()
2026-07-31 8:43 ` Loic Poulain
@ 2026-07-31 13:04 ` Bartosz Golaszewski
2026-07-31 13:27 ` Bartosz Golaszewski
0 siblings, 1 reply; 6+ messages in thread
From: Bartosz Golaszewski @ 2026-07-31 13:04 UTC (permalink / raw)
To: Loic Poulain
Cc: Bartosz Golaszewski, Jonathan Corbet, Shuah Khan, Marcel Holtmann,
Luiz Augusto von Dentz, Alessio Belle, Luigi Santivetti,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Jeff Johnson, Manivannan Sadhasivam, Bjorn Helgaas,
Chen-Yu Tsai, linux-pm, linux-doc, linux-kernel, linux-arm-msm,
linux-bluetooth, imagination, dri-devel, linux-wireless, ath10k,
linux-pci, Jeff Johnson, Bartosz Golaszewski
On Fri, 31 Jul 2026 10:43:19 +0200, Loic Poulain
<loic.poulain@oss.qualcomm.com> said:
> On Fri, Jul 31, 2026 at 10:29 AM Bartosz Golaszewski
> <bartosz.golaszewski@oss.qualcomm.com> wrote:
>>
>> The way power sequencing works means that a call to pwrseq_power_on()
>> does not necessarily result in the pwrseq target being powered-on at
>> that time: it may have already been powered on before. Similarly: a call
>> to pwrseq_power_off() does not have to result in an actual powering off
>> of resources: there may still be other users that requested a power-on
>> before.
>>
>> We will also introduce the concept of "non-controllable" pwrseq targets
>> soon which further increases the disconnect between the naming
>> convention and the actual semantics.
>>
>> What consumers of pwrseq descriptors actually do is: they *vote* for a
>> powering on of a given target or retract that vote. These operations
>> could be called get/put in line with runtime PM but this could become
>> confusing since we already provide pwrseq_get/put() for a different
>> purpose. pwrseq_vote_on/off() also have been rejected as unusual in
>> the tree.
>>
>> Change the name of the two functions to pwrseq_enable/disable() which
>> better reflects their purpose and semantics and also mirrors other
>> enable-counted resources like regulators and clocks. No functional change
>> intended.
>>
>> If at any point users need to know *when* the exact power event happens,
>> we can provide that information in the form of a notifier.
>>
>> Acked-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
>> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
>> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
>> ---
>> I've floated the idea to rename the two pwrseq functions from "power
>> on/off" to "vote on/off". I've sent a patch but the overwhelming
>> consensus seem to be that enable/disable naming is preferred.
>>
>> I'm doing it in a single commit that should go through the pwrseq tree
>> with Acks from subsystem maintainers.
>>
>> [1] https://lore.kernel.org/all/CAMRc=Mefxn81d0VUwmQgwFtffkL1=Er_1VQZCbC1Sa-Qph4t1w@mail.gmail.com/
>> ---
>> Changes in v2:
>> - Change the naming convention to enable/disable
>> - Link to v1: https://patch.msgid.link/20260727-pwrseq-vote-rename-v1-1-a2029aeeac65@oss.qualcomm.com
>> ---
>> Documentation/driver-api/pwrseq.rst | 4 ++--
>> drivers/bluetooth/hci_qca.c | 4 ++--
>> drivers/gpu/drm/imagination/pvr_power.c | 4 ++--
>> drivers/net/wireless/ath/ath10k/snoc.c | 6 +++---
>> drivers/pci/pwrctrl/generic.c | 4 ++--
>> drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c | 4 ++--
>> drivers/power/sequencing/core.c | 16 ++++++++--------
>> include/linux/pwrseq/consumer.h | 8 ++++----
>> 8 files changed, 25 insertions(+), 25 deletions(-)
>>
>> diff --git a/Documentation/driver-api/pwrseq.rst b/Documentation/driver-api/pwrseq.rst
>> index ad18b2326b689a41471216f3889480b11768ca82..0c315ab1138b02540fae60b39928c580027c0f7c 100644
>> --- a/Documentation/driver-api/pwrseq.rst
>> +++ b/Documentation/driver-api/pwrseq.rst
>> @@ -50,9 +50,9 @@ Consumer interface
>> The consumer API is aimed to be as simple as possible. The driver interested in
>> getting a descriptor from the power sequencer should call pwrseq_get() and
>> specify the name of the target it wants to reach in the sequence after calling
>> -pwrseq_power_up(). The descriptor can be released by calling pwrseq_put() and
>> +pwrseq_enable(). The descriptor can be released by calling pwrseq_put() and
>> the consumer can request the powering down of its target with
>> -pwrseq_power_off(). Note that there is no guarantee that pwrseq_power_off()
>> +pwrseq_disble(). Note that there is no guarantee that pwrseq_disble()
>> will have any effect as there may be multiple users of the underlying resources
>> who may keep them active.
>>
>> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
>> index 345f602e9ce233a0934a73a85d1e7c17c4f3210d..e713fc06b73402ae3d57794ed0870df8394a796a 100644
>> --- a/drivers/bluetooth/hci_qca.c
>> +++ b/drivers/bluetooth/hci_qca.c
>> @@ -2259,7 +2259,7 @@ static void qca_power_off(struct hci_uart *hu)
>> }
>>
>> if (power && power->pwrseq) {
>> - pwrseq_power_off(power->pwrseq);
>> + pwrseq_disble(power->pwrseq);
>
> Nit: s/pwrseq_disble/pwrseq_disable ?
>
Ah dang it, how did I miss it, I test-built it. :/
Thanks for catching it.
Bart
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] power: sequencing: rename pwrseq_power_on/off() to pwrseq_enable/disable()
2026-07-31 13:04 ` Bartosz Golaszewski
@ 2026-07-31 13:27 ` Bartosz Golaszewski
0 siblings, 0 replies; 6+ messages in thread
From: Bartosz Golaszewski @ 2026-07-31 13:27 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Jonathan Corbet, Shuah Khan, Marcel Holtmann,
Luiz Augusto von Dentz, Alessio Belle, Luigi Santivetti,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Jeff Johnson, Manivannan Sadhasivam, Bjorn Helgaas,
Chen-Yu Tsai, linux-pm, linux-doc, linux-kernel, linux-arm-msm,
linux-bluetooth, imagination, dri-devel, linux-wireless, ath10k,
linux-pci, Jeff Johnson, Bartosz Golaszewski, Loic Poulain
On Fri, 31 Jul 2026 15:04:30 +0200, Bartosz Golaszewski <brgl@kernel.org> said:
>>
>> Nit: s/pwrseq_disble/pwrseq_disable ?
>>
>
> Ah dang it, how did I miss it, I test-built it. :/
>
> Thanks for catching it.
>
Ah right, makes sense, it builds fine, it's just my sed script was wrong and
renamed it like this everywhere.
Bart
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-07-31 13:28 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-31 8:28 [PATCH v2] power: sequencing: rename pwrseq_power_on/off() to pwrseq_enable/disable() Bartosz Golaszewski
2026-07-31 8:37 ` sashiko-bot
2026-07-31 8:43 ` Loic Poulain
2026-07-31 13:04 ` Bartosz Golaszewski
2026-07-31 13:27 ` Bartosz Golaszewski
2026-07-31 10:16 ` [v2] " bluez.test.bot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.