diff options
| author | Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> | 2026-01-16 21:23:04 +0300 |
|---|---|---|
| committer | Bjorn Helgaas <bhelgaas@google.com> | 2026-01-16 22:23:37 +0300 |
| commit | 2045c352812e5a2eec0aa9d2b1e5d2fe1127b919 (patch) | |
| tree | 228c0985eec0563e47beda0b808e9024a55402cb | |
| parent | 0afc90ced0955d1ad2b65379e6771e4fb19ce769 (diff) | |
| download | linux-2045c352812e5a2eec0aa9d2b1e5d2fe1127b919.tar.xz | |
PCI/pwrctrl: pwrseq: Factor out power on/off code to helpers
In order to allow the pwrctrl core to control the power on/off logic of the
pwrctrl pwrseq driver, move the power on/off code to
pci_pwrctrl_pwrseq_power_{off/on} helper functions.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com
>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Link: https://patch.msgid.link/20260115-pci-pwrctrl-rework-v5-8-9d26da3ce903@oss.qualcomm.com
| -rw-r--r-- | drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c b/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c index e33beda149cf..9b698c5426c5 100644 --- a/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c +++ b/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c @@ -52,11 +52,27 @@ static const struct pwrseq_pwrctrl_pdata pwrseq_pwrctrl_qcom_wcn_pdata = { .validate_device = pwrseq_pwrctrl_qcm_wcn_validate_device, }; +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); +} + +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); +} + static void devm_pwrseq_pwrctrl_power_off(void *data) { - struct pwrseq_desc *pwrseq = data; + struct pwrseq_pwrctrl *pwrseq = data; - pwrseq_power_off(pwrseq); + pwrseq_pwrctrl_power_off(&pwrseq->pwrctrl); } static int pwrseq_pwrctrl_probe(struct platform_device *pdev) @@ -85,13 +101,13 @@ 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 = pwrseq_power_on(pwrseq->pwrseq); + ret = pwrseq_pwrctrl_power_on(&pwrseq->pwrctrl); if (ret) return dev_err_probe(dev, ret, "Failed to power-on the device\n"); ret = devm_add_action_or_reset(dev, devm_pwrseq_pwrctrl_power_off, - pwrseq->pwrseq); + pwrseq); if (ret) return ret; |
