]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
PCI/pwrctrl: Do not power off on pwrctrl device removal
authorChen-Yu Tsai <wenst@chromium.org>
Thu, 26 Feb 2026 09:22:33 +0000 (17:22 +0800)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 23 Mar 2026 20:25:32 +0000 (15:25 -0500)
With the move to explicit pwrctrl power on/off APIs, the caller, i.e., the
PCI controller driver, should manage the power state. The pwrctrl drivers
should not try to clean up or power off when they are removed, as this
might end up disabling an already disabled regulator, causing a big
warning.  This can be triggered if a PCI controller driver's .remove()
callback calls pci_pwrctrl_destroy_devices() after
pci_pwrctrl_power_off_devices().

Drop the devm cleanup parts that turn off regulators from the pwrctrl
drivers.

Fixes: b921aa3f8dec ("PCI/pwrctrl: Switch to pwrctrl create, power on/off, destroy APIs")
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
Link: https://patch.msgid.link/20260226092234.3859740-1-wenst@chromium.org
drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c
drivers/pci/pwrctrl/slot.c

index 0d0377283c3729e146e9988093d1fab2cf41fbbf..c7e4beec160aff637570b77111fe56b0a9ef5b5d 100644 (file)
@@ -68,13 +68,6 @@ static int pwrseq_pwrctrl_power_off(struct pci_pwrctrl *pwrctrl)
        return pwrseq_power_off(pwrseq->pwrseq);
 }
 
-static void devm_pwrseq_pwrctrl_power_off(void *data)
-{
-       struct pwrseq_pwrctrl *pwrseq = data;
-
-       pwrseq_pwrctrl_power_off(&pwrseq->pwrctrl);
-}
-
 static int pwrseq_pwrctrl_probe(struct platform_device *pdev)
 {
        const struct pwrseq_pwrctrl_pdata *pdata;
@@ -101,11 +94,6 @@ static int pwrseq_pwrctrl_probe(struct platform_device *pdev)
                return dev_err_probe(dev, PTR_ERR(pwrseq->pwrseq),
                                     "Failed to get the power sequencer\n");
 
-       ret = devm_add_action_or_reset(dev, devm_pwrseq_pwrctrl_power_off,
-                                      pwrseq);
-       if (ret)
-               return ret;
-
        pwrseq->pwrctrl.power_on = pwrseq_pwrctrl_power_on;
        pwrseq->pwrctrl.power_off = pwrseq_pwrctrl_power_off;
 
index 082af81efe254d7a505d0762c0abb04d046d0625..b87639253ae272c53586c1d1f12ddb7ca81cb3cf 100644 (file)
@@ -63,7 +63,6 @@ static void devm_slot_pwrctrl_release(void *data)
 {
        struct slot_pwrctrl *slot = data;
 
-       slot_pwrctrl_power_off(&slot->pwrctrl);
        regulator_bulk_free(slot->num_supplies, slot->supplies);
 }