* question about usb_rebind_intf @ 2017-11-17 16:35 Jerry Snitselaar 2017-11-17 17:09 ` Greg Kroah-Hartman 0 siblings, 1 reply; 8+ messages in thread From: Jerry Snitselaar @ 2017-11-17 16:35 UTC (permalink / raw) To: Greg Kroah-Hartman, linux-usb, linux-kernel Should this skip warning that the rebind failed if device_attach is returning -EPROBE_DEFER? If I do something like 'rtcwake -m mem -s 30' on a laptop I have here I will see a couple "rebind failed: -517" messages as it comes back out of suspend. Since the device probe eventually happens once probes are not deferred wondering if this warning this be given in that case. diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 64262a9a8829..5d3408010112 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -1070,7 +1070,7 @@ static void usb_rebind_intf(struct usb_interface *intf) if (!intf->dev.power.is_prepared) { intf->needs_binding = 0; rc = device_attach(&intf->dev); - if (rc < 0) + if (rc < 0 && rc != -EPROBE_DEFER) dev_warn(&intf->dev, "rebind failed: %d\n", rc); } } ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: question about usb_rebind_intf 2017-11-17 16:35 question about usb_rebind_intf Jerry Snitselaar @ 2017-11-17 17:09 ` Greg Kroah-Hartman 2017-11-17 17:45 ` Mathias Nyman 0 siblings, 1 reply; 8+ messages in thread From: Greg Kroah-Hartman @ 2017-11-17 17:09 UTC (permalink / raw) To: linux-usb, linux-kernel On Fri, Nov 17, 2017 at 09:35:51AM -0700, Jerry Snitselaar wrote: > Should this skip warning that the rebind failed if device_attach > is returning -EPROBE_DEFER? If I do something like 'rtcwake -m mem -s 30' > on a laptop I have here I will see a couple "rebind failed: -517" messages > as it comes back out of suspend. Since the device probe eventually happens > once probes are not deferred wondering if this warning this be given in that > case. > > > diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c > index 64262a9a8829..5d3408010112 100644 > --- a/drivers/usb/core/driver.c > +++ b/drivers/usb/core/driver.c > @@ -1070,7 +1070,7 @@ static void usb_rebind_intf(struct usb_interface *intf) > if (!intf->dev.power.is_prepared) { > intf->needs_binding = 0; > rc = device_attach(&intf->dev); > - if (rc < 0) > + if (rc < 0 && rc != -EPROBE_DEFER) > dev_warn(&intf->dev, "rebind failed: %d\n", rc); > } > } What USB driver is returning -EPROBE_DEFER to cause this to be an issue? Shouldn't that really only be for "platform" drivers and the like? USB interface drivers should all be "self-contained" within reason. thanks, greg k-h ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: question about usb_rebind_intf 2017-11-17 17:09 ` Greg Kroah-Hartman @ 2017-11-17 17:45 ` Mathias Nyman 2017-11-17 18:21 ` Alan Stern 0 siblings, 1 reply; 8+ messages in thread From: Mathias Nyman @ 2017-11-17 17:45 UTC (permalink / raw) To: Greg Kroah-Hartman, linux-usb, linux-kernel; +Cc: Alan Stern On 17.11.2017 19:09, Greg Kroah-Hartman wrote: > On Fri, Nov 17, 2017 at 09:35:51AM -0700, Jerry Snitselaar wrote: >> Should this skip warning that the rebind failed if device_attach >> is returning -EPROBE_DEFER? If I do something like 'rtcwake -m mem -s 30' >> on a laptop I have here I will see a couple "rebind failed: -517" messages >> as it comes back out of suspend. Since the device probe eventually happens >> once probes are not deferred wondering if this warning this be given in that >> case. >> >> >> diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c >> index 64262a9a8829..5d3408010112 100644 >> --- a/drivers/usb/core/driver.c >> +++ b/drivers/usb/core/driver.c >> @@ -1070,7 +1070,7 @@ static void usb_rebind_intf(struct usb_interface *intf) >> if (!intf->dev.power.is_prepared) { >> intf->needs_binding = 0; >> rc = device_attach(&intf->dev); >> - if (rc < 0) >> + if (rc < 0 && rc != -EPROBE_DEFER) >> dev_warn(&intf->dev, "rebind failed: %d\n", rc); >> } >> } > > What USB driver is returning -EPROBE_DEFER to cause this to be an issue? > Shouldn't that really only be for "platform" drivers and the like? USB > interface drivers should all be "self-contained" within reason. > I see this as well with btusb driver in resume if port was reset. drivers/base/dd.c really_probe() returns -EPROBE_DEFER if it's called before device_unblock_probing() is called. drivers/base/power/main/dpm_complete() will unlock probing after it has finished resuming all devices and called all the pm_ops .complete callbacks. The usb_device_pm_ops .complete callback will try to rebind the interface driver if device was reset at resume, leading to them -EPROBE_DEFER. I guess we either need to rework a few things, or remove that warning. -Mathias ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: question about usb_rebind_intf 2017-11-17 17:45 ` Mathias Nyman @ 2017-11-17 18:21 ` Alan Stern 2017-11-18 10:28 ` Greg Kroah-Hartman 2017-11-20 10:39 ` question about usb_rebind_intf Oliver Neukum 0 siblings, 2 replies; 8+ messages in thread From: Alan Stern @ 2017-11-17 18:21 UTC (permalink / raw) To: Mathias Nyman; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel On Fri, 17 Nov 2017, Mathias Nyman wrote: > On 17.11.2017 19:09, Greg Kroah-Hartman wrote: > > On Fri, Nov 17, 2017 at 09:35:51AM -0700, Jerry Snitselaar wrote: > >> Should this skip warning that the rebind failed if device_attach > >> is returning -EPROBE_DEFER? If I do something like 'rtcwake -m mem -s 30' > >> on a laptop I have here I will see a couple "rebind failed: -517" messages > >> as it comes back out of suspend. Since the device probe eventually happens > >> once probes are not deferred wondering if this warning this be given in that > >> case. > >> > >> > >> diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c > >> index 64262a9a8829..5d3408010112 100644 > >> --- a/drivers/usb/core/driver.c > >> +++ b/drivers/usb/core/driver.c > >> @@ -1070,7 +1070,7 @@ static void usb_rebind_intf(struct usb_interface *intf) > >> if (!intf->dev.power.is_prepared) { > >> intf->needs_binding = 0; > >> rc = device_attach(&intf->dev); > >> - if (rc < 0) > >> + if (rc < 0 && rc != -EPROBE_DEFER) > >> dev_warn(&intf->dev, "rebind failed: %d\n", rc); > >> } > >> } > > > > What USB driver is returning -EPROBE_DEFER to cause this to be an issue? > > Shouldn't that really only be for "platform" drivers and the like? USB > > interface drivers should all be "self-contained" within reason. > > > > I see this as well with btusb driver in resume if port was reset. > > drivers/base/dd.c really_probe() returns -EPROBE_DEFER if it's called before > device_unblock_probing() is called. > > drivers/base/power/main/dpm_complete() will unlock probing after it has > finished resuming all devices and called all the pm_ops .complete callbacks. > > The usb_device_pm_ops .complete callback will try to rebind the interface driver > if device was reset at resume, leading to them -EPROBE_DEFER. > > I guess we either need to rework a few things, or remove that warning. I agree, and the patch seems like a good idea for now. The real fix would be to change the interface drivers by adding proper support for reset-resume. Otherwise there will always be a time window following resume during which the interface is non-functional. Alan Stern ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: question about usb_rebind_intf 2017-11-17 18:21 ` Alan Stern @ 2017-11-18 10:28 ` Greg Kroah-Hartman 2017-12-04 12:05 ` [PATCH] usb: Don't print a warning if interface driver rebind is deferred at resume Mathias Nyman 2017-11-20 10:39 ` question about usb_rebind_intf Oliver Neukum 1 sibling, 1 reply; 8+ messages in thread From: Greg Kroah-Hartman @ 2017-11-18 10:28 UTC (permalink / raw) To: Alan Stern; +Cc: Mathias Nyman, linux-usb, linux-kernel On Fri, Nov 17, 2017 at 01:21:28PM -0500, Alan Stern wrote: > On Fri, 17 Nov 2017, Mathias Nyman wrote: > > > On 17.11.2017 19:09, Greg Kroah-Hartman wrote: > > > On Fri, Nov 17, 2017 at 09:35:51AM -0700, Jerry Snitselaar wrote: > > >> Should this skip warning that the rebind failed if device_attach > > >> is returning -EPROBE_DEFER? If I do something like 'rtcwake -m mem -s 30' > > >> on a laptop I have here I will see a couple "rebind failed: -517" messages > > >> as it comes back out of suspend. Since the device probe eventually happens > > >> once probes are not deferred wondering if this warning this be given in that > > >> case. > > >> > > >> > > >> diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c > > >> index 64262a9a8829..5d3408010112 100644 > > >> --- a/drivers/usb/core/driver.c > > >> +++ b/drivers/usb/core/driver.c > > >> @@ -1070,7 +1070,7 @@ static void usb_rebind_intf(struct usb_interface *intf) > > >> if (!intf->dev.power.is_prepared) { > > >> intf->needs_binding = 0; > > >> rc = device_attach(&intf->dev); > > >> - if (rc < 0) > > >> + if (rc < 0 && rc != -EPROBE_DEFER) > > >> dev_warn(&intf->dev, "rebind failed: %d\n", rc); > > >> } > > >> } > > > > > > What USB driver is returning -EPROBE_DEFER to cause this to be an issue? > > > Shouldn't that really only be for "platform" drivers and the like? USB > > > interface drivers should all be "self-contained" within reason. > > > > > > > I see this as well with btusb driver in resume if port was reset. > > > > drivers/base/dd.c really_probe() returns -EPROBE_DEFER if it's called before > > device_unblock_probing() is called. > > > > drivers/base/power/main/dpm_complete() will unlock probing after it has > > finished resuming all devices and called all the pm_ops .complete callbacks. > > > > The usb_device_pm_ops .complete callback will try to rebind the interface driver > > if device was reset at resume, leading to them -EPROBE_DEFER. > > > > I guess we either need to rework a few things, or remove that warning. > > I agree, and the patch seems like a good idea for now. Ah, I forgot about the reset stuff. If someone sends this patch in a format that can be applied, that would be nice :) thanks, greg k-h ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] usb: Don't print a warning if interface driver rebind is deferred at resume 2017-11-18 10:28 ` Greg Kroah-Hartman @ 2017-12-04 12:05 ` Mathias Nyman 2017-12-04 18:45 ` Jerry Snitselaar 0 siblings, 1 reply; 8+ messages in thread From: Mathias Nyman @ 2017-12-04 12:05 UTC (permalink / raw) To: gregkh; +Cc: stern, jsnitsel, linux-usb, linux-kernel, Mathias Nyman Interface drivers like btusb that don't support reset-resume will be rebound at resume if port was reset. Rebind is done during the pm_ops .complete callback when probe returns EPROBE_DEFER as default. Remove the "rebind failed: -517" message. Device probe will eventually take place later. [one-liner by Jerry Snitselaar posted in a mailing list question -Mathias] Suggested-by: Jerry Snitselaar <jsnitsel@redhat.com> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> --- drivers/usb/core/driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 64262a9a..5d34080 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -1070,7 +1070,7 @@ static void usb_rebind_intf(struct usb_interface *intf) if (!intf->dev.power.is_prepared) { intf->needs_binding = 0; rc = device_attach(&intf->dev); - if (rc < 0) + if (rc < 0 && rc != -EPROBE_DEFER) dev_warn(&intf->dev, "rebind failed: %d\n", rc); } } -- 2.7.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] usb: Don't print a warning if interface driver rebind is deferred at resume 2017-12-04 12:05 ` [PATCH] usb: Don't print a warning if interface driver rebind is deferred at resume Mathias Nyman @ 2017-12-04 18:45 ` Jerry Snitselaar 0 siblings, 0 replies; 8+ messages in thread From: Jerry Snitselaar @ 2017-12-04 18:45 UTC (permalink / raw) To: Mathias Nyman; +Cc: gregkh, stern, linux-usb, linux-kernel On Mon Dec 04 17, Mathias Nyman wrote: >Interface drivers like btusb that don't support reset-resume will be >rebound at resume if port was reset. Rebind is done during the pm_ops >.complete callback when probe returns EPROBE_DEFER as default. > >Remove the "rebind failed: -517" message. >Device probe will eventually take place later. > >[one-liner by Jerry Snitselaar posted in a mailing list question -Mathias] >Suggested-by: Jerry Snitselaar <jsnitsel@redhat.com> >Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> >--- > drivers/usb/core/driver.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c >index 64262a9a..5d34080 100644 >--- a/drivers/usb/core/driver.c >+++ b/drivers/usb/core/driver.c >@@ -1070,7 +1070,7 @@ static void usb_rebind_intf(struct usb_interface *intf) > if (!intf->dev.power.is_prepared) { > intf->needs_binding = 0; > rc = device_attach(&intf->dev); >- if (rc < 0) >+ if (rc < 0 && rc != -EPROBE_DEFER) > dev_warn(&intf->dev, "rebind failed: %d\n", rc); > } > } >-- >2.7.4 > Thanks for sending this. It looks like my filters sent the ensuing conversation off into never-never land or I wasn't cc'd and just missed it in the mailing lists. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: question about usb_rebind_intf 2017-11-17 18:21 ` Alan Stern 2017-11-18 10:28 ` Greg Kroah-Hartman @ 2017-11-20 10:39 ` Oliver Neukum 1 sibling, 0 replies; 8+ messages in thread From: Oliver Neukum @ 2017-11-20 10:39 UTC (permalink / raw) To: Alan Stern, Mathias Nyman; +Cc: Greg Kroah-Hartman, linux-kernel, linux-usb Am Freitag, den 17.11.2017, 13:21 -0500 schrieb Alan Stern: > > The real fix would be to change the interface drivers by adding proper > support for reset-resume. Otherwise there will always be a time window > following resume during which the interface is non-functional. Very hard to do with btusb. The connection is messed up if we lose power. Regards Oliver ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-12-04 18:45 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-11-17 16:35 question about usb_rebind_intf Jerry Snitselaar 2017-11-17 17:09 ` Greg Kroah-Hartman 2017-11-17 17:45 ` Mathias Nyman 2017-11-17 18:21 ` Alan Stern 2017-11-18 10:28 ` Greg Kroah-Hartman 2017-12-04 12:05 ` [PATCH] usb: Don't print a warning if interface driver rebind is deferred at resume Mathias Nyman 2017-12-04 18:45 ` Jerry Snitselaar 2017-11-20 10:39 ` question about usb_rebind_intf Oliver Neukum
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).