linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xhci: State explicitly when the controller is inaccessible
@ 2021-05-18 11:16 Kai-Heng Feng
  2021-05-18 12:21 ` Mathias Nyman
  0 siblings, 1 reply; 3+ messages in thread
From: Kai-Heng Feng @ 2021-05-18 11:16 UTC (permalink / raw)
  To: mathias.nyman
  Cc: Kai-Heng Feng, Greg Kroah-Hartman, open list:USB XHCI DRIVER, open list

Sometimes the dmesg says "Controller not ready at resume" because CNR is
flagged. But what actually happens is that the whole USBSTS becomes
inaccessible, and the reason could be disabled PCI I/O space or faulty
firmware/hardware.

So state the reason explicitly to make the message more clear.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/usb/host/xhci.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index ca9385d22f68..0e6fbe1f4fcc 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1117,8 +1117,9 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
 		retval = xhci_handshake(&xhci->op_regs->status,
 					STS_CNR, 0, 10 * 1000 * 1000);
 		if (retval) {
-			xhci_warn(xhci, "Controller not ready at resume %d\n",
-				  retval);
+			xhci_warn(xhci, "Controller is %s at resume %d\n",
+				  retval == -ENODEV ? "inaccessible" :
+				  "not ready", retval);
 			spin_unlock_irq(&xhci->lock);
 			return retval;
 		}
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] xhci: State explicitly when the controller is inaccessible
  2021-05-18 11:16 [PATCH] xhci: State explicitly when the controller is inaccessible Kai-Heng Feng
@ 2021-05-18 12:21 ` Mathias Nyman
  2021-05-18 12:35   ` Kai-Heng Feng
  0 siblings, 1 reply; 3+ messages in thread
From: Mathias Nyman @ 2021-05-18 12:21 UTC (permalink / raw)
  To: Kai-Heng Feng, mathias.nyman
  Cc: Greg Kroah-Hartman, open list:USB XHCI DRIVER, open list

On 18.5.2021 14.16, Kai-Heng Feng wrote:
> Sometimes the dmesg says "Controller not ready at resume" because CNR is
> flagged. But what actually happens is that the whole USBSTS becomes
> inaccessible, and the reason could be disabled PCI I/O space or faulty
> firmware/hardware.
> 
> So state the reason explicitly to make the message more clear.
> 
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> ---
>  drivers/usb/host/xhci.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index ca9385d22f68..0e6fbe1f4fcc 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -1117,8 +1117,9 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
>  		retval = xhci_handshake(&xhci->op_regs->status,
>  					STS_CNR, 0, 10 * 1000 * 1000);
>  		if (retval) {
> -			xhci_warn(xhci, "Controller not ready at resume %d\n",
> -				  retval);
> +			xhci_warn(xhci, "Controller is %s at resume %d\n",
> +				  retval == -ENODEV ? "inaccessible" :
> +				  "not ready", retval);

Old way did print out retval, and was greppable.
Not sure this is an improvement

-Mathias

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] xhci: State explicitly when the controller is inaccessible
  2021-05-18 12:21 ` Mathias Nyman
@ 2021-05-18 12:35   ` Kai-Heng Feng
  0 siblings, 0 replies; 3+ messages in thread
From: Kai-Heng Feng @ 2021-05-18 12:35 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: Mathias Nyman, Greg Kroah-Hartman, open list:USB XHCI DRIVER, open list

On Tue, May 18, 2021 at 8:19 PM Mathias Nyman
<mathias.nyman@linux.intel.com> wrote:
>
> On 18.5.2021 14.16, Kai-Heng Feng wrote:
> > Sometimes the dmesg says "Controller not ready at resume" because CNR is
> > flagged. But what actually happens is that the whole USBSTS becomes
> > inaccessible, and the reason could be disabled PCI I/O space or faulty
> > firmware/hardware.
> >
> > So state the reason explicitly to make the message more clear.
> >
> > Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> > ---
> >  drivers/usb/host/xhci.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> > index ca9385d22f68..0e6fbe1f4fcc 100644
> > --- a/drivers/usb/host/xhci.c
> > +++ b/drivers/usb/host/xhci.c
> > @@ -1117,8 +1117,9 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
> >               retval = xhci_handshake(&xhci->op_regs->status,
> >                                       STS_CNR, 0, 10 * 1000 * 1000);
> >               if (retval) {
> > -                     xhci_warn(xhci, "Controller not ready at resume %d\n",
> > -                               retval);
> > +                     xhci_warn(xhci, "Controller is %s at resume %d\n",
> > +                               retval == -ENODEV ? "inaccessible" :
> > +                               "not ready", retval);
>
> Old way did print out retval, and was greppable.
> Not sure this is an improvement

That's true. Maybe it's just me, but I can't directly mapped the value
to -ENODEV at first glance.
But in essence this is just a cosmetic change.

Kai-Heng

>
> -Mathias

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-18 12:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18 11:16 [PATCH] xhci: State explicitly when the controller is inaccessible Kai-Heng Feng
2021-05-18 12:21 ` Mathias Nyman
2021-05-18 12:35   ` Kai-Heng Feng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).