On Wed, 23 Jan 2013, Lan Tianyu wrote: > usb2.0 and usb3.0 devices have different ways to enalbe/disable > remote wakeup. This patch is to put both their operations into > the seperate functions. Otherwise, usb_control_msg() has some > long arguments and are usually nested some indentations. So > encapsulating it into seperate functions would be convienient > to use and more readable. > > Signed-off-by: Lan Tianyu <tianyu.lan@xxxxxxxxx> > --- > drivers/usb/core/hub.c | 115 +++++++++++++++++++++++++----------------------- > 1 file changed, 61 insertions(+), 54 deletions(-) > > diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c > index 29791a6..d04985b 100644 > --- a/drivers/usb/core/hub.c > +++ b/drivers/usb/core/hub.c > @@ -2794,6 +2794,63 @@ static int usb_disable_function_remotewakeup(struct usb_device *udev) > USB_CTRL_SET_TIMEOUT); > } > > +static int usb_disable_remote_wakeup(struct usb_device *udev) > +{ > + int status = 0; > + u16 devstatus; > + > + if (udev->speed != USB_SPEED_SUPER) { > + status = usb_get_status(udev, USB_RECIP_DEVICE, 0, &devstatus); > + le16_to_cpus(&devstatus); > + if (!status && devstatus & (1 << USB_DEVICE_REMOTE_WAKEUP)) > + status = usb_control_msg(udev, > + usb_sndctrlpipe(udev, 0), > + USB_REQ_CLEAR_FEATURE, > + USB_RECIP_DEVICE, > + USB_DEVICE_REMOTE_WAKEUP, 0, > + NULL, 0, > + USB_CTRL_SET_TIMEOUT); > + } else { > + status = usb_get_status(udev, USB_RECIP_INTERFACE, 0, > + &devstatus); > + le16_to_cpus(&devstatus); > + if (!status && devstatus & > + (USB_INTRF_STAT_FUNC_RW_CAP | USB_INTRF_STAT_FUNC_RW)) > + status = usb_disable_function_remotewakeup(udev); Don't call that function here. Just put the code here and run it directly. Then you can get rid of the old function. After all, it's just a call to usb_control_msg, like in the non-USB-3 case above. 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