Re: [PATCH] bus: mhi: host: pci_generic: Resume the device before executing mhi_pci_remove()

Loic Poulain <[email protected]> Mon, 2 Mar 2026 15:45:04 +0100
Newsgroups dev.linux.lists.mhi,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-kernel,org.kernel.vger.stable
Message-ID <CAFEp6-3iU6XEcwqkX4erAEPpgFubWMoihQy1DFyKmLtFOM_uvA@mail.gmail.com>
On Mon, Mar 2, 2026 at 2:41 PM Manivannan Sadhasivam
<[email protected]> wrote:
>
> mhi_pci_remove() carries out device specific operations that requires the
> device to be active. But pm_runtime_get_noresume() called at the end of the
> remove() will not guarantee that.
>
> So use pm_runtime_get_sync() and call it at the start of remove().
>
> Cc: <[email protected]> # 5.13
> Cc: Loic Poulain <[email protected]>
> Fixes: d3800c1dce24 ("bus: mhi: pci_generic: Add support for runtime PM")
> Signed-off-by: Manivannan Sadhasivam <[email protected]>

Reviewed-by: Loic Poulain <[email protected]>

> ---
>  drivers/bus/mhi/host/pci_generic.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_generic.c
> index 425362037830..fe3aefa15966 100644
> --- a/drivers/bus/mhi/host/pci_generic.c
> +++ b/drivers/bus/mhi/host/pci_generic.c
> @@ -1440,6 +1440,10 @@ static void mhi_pci_remove(struct pci_dev *pdev)
>         struct mhi_pci_device *mhi_pdev = pci_get_drvdata(pdev);
>         struct mhi_controller *mhi_cntrl = &mhi_pdev->mhi_cntrl;
>
> +       /* balancing probe put_noidle */
> +       if (pci_pme_capable(pdev, PCI_D3hot))
> +               pm_runtime_get_sync(&pdev->dev);
> +
>         pci_disable_sriov(pdev);
>
>         if (pdev->is_physfn)
> @@ -1451,10 +1455,6 @@ static void mhi_pci_remove(struct pci_dev *pdev)
>                 mhi_unprepare_after_power_down(mhi_cntrl);
>         }
>
> -       /* balancing probe put_noidle */
> -       if (pci_pme_capable(pdev, PCI_D3hot))
> -               pm_runtime_get_noresume(&pdev->dev);
> -
>         if (mhi_pdev->reset_on_remove)
>                 mhi_soc_reset(mhi_cntrl);
>
> --
> 2.51.0
>