diff mbox series

xhci: Use pm_runtime_get to prevent RPM on unsupported systems

Message ID 20241024112117.723413-1-Basavaraj.Natikar@amd.com (mailing list archive)
State Superseded
Headers show
Series xhci: Use pm_runtime_get to prevent RPM on unsupported systems | expand

Commit Message

Basavaraj Natikar Oct. 24, 2024, 11:21 a.m. UTC
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>
---
 drivers/usb/host/xhci-pci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Johan Hovold Oct. 24, 2024, 1:06 p.m. UTC | #1
On Thu, Oct 24, 2024 at 04:51:17PM +0530, 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>
> ---

This is a new version of this patch:

	https://lore.kernel.org/all/20240925161520.2736895-1-Basavaraj.Natikar@amd.com/

so please resend a v3 with a changelog here.

Also remember to CC people reviewing your patches when resubmitting.

Johan
Basavaraj Natikar Oct. 24, 2024, 1:39 p.m. UTC | #2
On 10/24/2024 6:36 PM, Johan Hovold wrote:
> On Thu, Oct 24, 2024 at 04:51:17PM +0530, 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>
>> ---
> This is a new version of this patch:
>
> 	https://lore.kernel.org/all/20240925161520.2736895-1-Basavaraj.Natikar@amd.com/
>
> so please resend a v3 with a changelog here.
>
> Also remember to CC people reviewing your patches when resubmitting.

Sure Johan, I sent changes in v3.


Thanks,
--
Basavaraj

>
> Johan
diff mbox series

Patch

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) {