Re: [PATCH] bus: mhi: host: pci_generic: Resume the device before executing mhi_pci_remove()
From: Loic Poulain
Date: Mon Mar 02 2026 - 09:50:31 EST
On Mon, Mar 2, 2026 at 2:41 PM Manivannan Sadhasivam
<manivannan.sadhasivam@xxxxxxxxxxxxxxxx> 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: <stable@xxxxxxxxxxxxxxx> # 5.13
> Cc: Loic Poulain <loic.poulain@xxxxxxxxxxxxxxxx>
> Fixes: d3800c1dce24 ("bus: mhi: pci_generic: Add support for runtime PM")
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxxxxxxxx>
Reviewed-by: Loic Poulain <loic.poulain@xxxxxxxxxxxxxxxx>
> ---
> 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
>