On Fri, 2 Dec 2016, Todd Brandt wrote: > Add debug support for experimenting with USB timing delay > values on the fly. This provides a debug interface through > /sys/kernel/usb where a user can tweak the values. The code > enforces the spec minimums so that a user can't set them > too low. > > Signed-off-by: Todd Brandt <todd.e.brandt@xxxxxxxxxxxxxxx> > --- > drivers/usb/core/hub.c | 100 +++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 100 insertions(+) > > diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c > index 43242e3..6dea6a7 100644 > --- a/drivers/usb/core/hub.c > +++ b/drivers/usb/core/hub.c > @@ -5265,8 +5265,98 @@ static struct usb_driver hub_driver = { > .supports_autosuspend = 1, > }; > > +static ssize_t tdrsmdn_show(struct kobject *kobj, > + struct kobj_attribute *attr, char *buf) > +{ > + return sprintf(buf, "%d\n", usb_timing.tdrsmdn); > +} > + > +static ssize_t tdrsmdn_store(struct kobject *kobj, > + struct kobj_attribute *attr, const char *buf, size_t count) > +{ > + int ret, val; > + > + ret = kstrtoint(buf, 10, &val); > + if (ret < 0) > + return ret; > + > + if (val < 20) > + usb_timing.tdrsmdn = 20; > + else > + usb_timing.tdrsmdn = val; How about: usb_timing.rdrsmdn = max(val, USB_TIMING_TDRSMDN_MIN); and similarly for the others? And how about making val unsigned? A negative timeout is pretty meaningless. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html