From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752510AbbGWIbG (ORCPT ); Thu, 23 Jul 2015 04:31:06 -0400 Received: from cantor2.suse.de ([195.135.220.15]:48249 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752209AbbGWIbB (ORCPT ); Thu, 23 Jul 2015 04:31:01 -0400 Message-ID: <1437640258.4377.6.camel@suse.com> Subject: Re: [PATCH net 2/3] r8152: fix remote wakeup From: Oliver Neukum To: Hayes Wang Cc: netdev@vger.kernel.org, nic_swsd@realtek.com, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Date: Thu, 23 Jul 2015 10:30:58 +0200 In-Reply-To: <1394712342-15778-150-Taiwan-albertk@realtek.com> References: <1394712342-15778-148-Taiwan-albertk@realtek.com> <1394712342-15778-150-Taiwan-albertk@realtek.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.11 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2015-07-23 at 15:09 +0800, Hayes Wang wrote: > Set needs_remote_wakeup only when the device supports it. > > Signed-off-by: Hayes Wang > --- > drivers/net/usb/r8152.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c > index e3a0110..eff1f25 100644 > --- a/drivers/net/usb/r8152.c > +++ b/drivers/net/usb/r8152.c > @@ -4059,7 +4059,8 @@ static int rtl8152_probe(struct usb_interface *intf, > break; > } > > - intf->needs_remote_wakeup = 1; > + if (udev->actconfig->desc.bmAttributes & USB_CONFIG_ATT_WAKEUP) > + intf->needs_remote_wakeup = 1; Hi, this is most likely wrong. Usbcore does check for a device's ability to do remote wakeup and will block a runtime suspend if it detects that a remote wakeup would be required but the device cannot deliver. (static int autosuspend_check()) So by removing the flag in the probe() method means that devices will suspend during operations without remote wakeup requested. Thus an incoming packet cannot wake them up. If you remove setting the flag on probe() you need to set it at open() [and reset on close()], as devices which cannot do remote wakeup must only be suspended when they are down. Regards Oliver