Linux USB
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: Basavaraj Natikar <Basavaraj.Natikar@amd.com>,
	mathias.nyman@intel.com, gregkh@linuxfoundation.org,
	linux-usb@vger.kernel.org
Cc: johan@kernel.org
Subject: Re: [PATCH v3] xhci: Use pm_runtime_get to prevent RPM on unsupported systems
Date: Thu, 24 Oct 2024 08:38:37 -0500	[thread overview]
Message-ID: <5718b41e-09f7-42d3-a6fd-68bccac50e42@amd.com> (raw)
In-Reply-To: <20241024133718.723846-1-Basavaraj.Natikar@amd.com>

On 10/24/2024 08:37, Basavaraj Natikar wrote:
> Use pm_runtime_put in the remove function and pm_runtime_get to disable
> RPM on platforms that don't support runtime D3, as re-enabling it through
> sysfs auto power control may cause the controller to malfunction. This
> can lead to issues such as hotplug devices not being detected due to
> failed interrupt generation.
> 
> Fixes: a5d6264b638e ("xhci: Enable RPM on controllers that support low-power states")
> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>

Cc: stable@vger.kernel.org
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>

> ---
> v2->v3:
>   * Respinned v3 with an updated changelog.
> v1->v2:
>   * Used pm_runtime_get and updated the subject line accordingly.
> ---
>   drivers/usb/host/xhci-pci.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
> index 7e538194a0a4..cb07cee9ed0c 100644
> --- a/drivers/usb/host/xhci-pci.c
> +++ b/drivers/usb/host/xhci-pci.c
> @@ -640,7 +640,7 @@ int xhci_pci_common_probe(struct pci_dev *dev, const struct pci_device_id *id)
>   	pm_runtime_put_noidle(&dev->dev);
>   
>   	if (pci_choose_state(dev, PMSG_SUSPEND) == PCI_D0)
> -		pm_runtime_forbid(&dev->dev);
> +		pm_runtime_get(&dev->dev);
>   	else if (xhci->quirks & XHCI_DEFAULT_PM_RUNTIME_ALLOW)
>   		pm_runtime_allow(&dev->dev);
>   
> @@ -683,7 +683,9 @@ void xhci_pci_remove(struct pci_dev *dev)
>   
>   	xhci->xhc_state |= XHCI_STATE_REMOVING;
>   
> -	if (xhci->quirks & XHCI_DEFAULT_PM_RUNTIME_ALLOW)
> +	if (pci_choose_state(dev, PMSG_SUSPEND) == PCI_D0)
> +		pm_runtime_put(&dev->dev);
> +	else if (xhci->quirks & XHCI_DEFAULT_PM_RUNTIME_ALLOW)
>   		pm_runtime_forbid(&dev->dev);
>   
>   	if (xhci->shared_hcd) {


  reply	other threads:[~2024-10-24 13:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-24 13:37 [PATCH v3] xhci: Use pm_runtime_get to prevent RPM on unsupported systems Basavaraj Natikar
2024-10-24 13:38 ` Mario Limonciello [this message]
2024-10-30 11:57   ` Mathias Nyman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5718b41e-09f7-42d3-a6fd-68bccac50e42@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=Basavaraj.Natikar@amd.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=johan@kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox