Message ID | CAKh2mn7VsNYMO-qYyyqR==A2sXjkZo6QXj_kOuem4o1Vu-LLmw@mail.gmail.com |
---|---|
State | Superseded, archived |
Delegated to: | David Miller |
Headers | show |
Steve Glendinning <steve@shawell.net> writes: >> Looking at the different ethernet drivers, the normal way do do this >> seems to be something like this in their .set_wol implementation: >> >> device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); >> >> >> where "adapter" is a netdev_priv private struct, "pdev" is a pci device >> and "wol" is an u32. I don't see any problem doing the same for USB >> network devices implementing ethtool "set_wol". > > Ahh, good spot. I've implemented this (patch below for reference) and > it still doesn't work: > > > $ cat /sys/bus/usb/devices/2-1.2/power/wakeup > disabled > > $ sudo ethtool -s eth2 wol p > > [ 1607.237767] smsc75xx 2-1.2:1.0 eth2: set_wol before > device_can_wakeup=1 device_may_wakeup=0 > [ 1607.237772] smsc75xx 2-1.2:1.0 eth2: set_wol after > device_can_wakeup=1 device_may_wakeup=1 > > $ cat /sys/bus/usb/devices/2-1.2/power/wakeup > disabled > > > Huh?! My debugging printk statements tell me I've succesfully set it, > but then the sysfs entry is disabled when I read it. Is something > else setting this back? > > My testing patch for reference (note this is against my tree with a > few to-be submitted patches so won't apply cleanly!): [..] > @@ -674,8 +653,19 @@ static int smsc75xx_ethtool_set_wol(struct net_device *net, > { > struct usbnet *dev = netdev_priv(net); > struct smsc75xx_priv *pdata = (struct smsc75xx_priv *)(dev->data[0]); > + int ret; > + > + netdev_info(dev->net, "set_wol before device_can_wakeup=%d > device_may_wakeup=%d\n", > + device_can_wakeup(&net->dev), device_may_wakeup(&net->dev)); > > pdata->wolopts = wolinfo->wolopts & SUPPORTED_WAKE; > + > + ret = device_set_wakeup_enable(&net->dev, pdata->wolopts); You are touching the network device here. That should have been the USB device. Try something like ret = device_set_wakeup_enable(&dev->udev->dev, pdata->wolopts); instead. Bjørn -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
>> + >> + ret = device_set_wakeup_enable(&net->dev, pdata->wolopts); > > You are touching the network device here. That should have been the USB > device. Try something like > > ret = device_set_wakeup_enable(&dev->udev->dev, pdata->wolopts); Perfect, this works exactly as expected now. Patch included in resubmitted patchset, thanks Bjorn! -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c index d8fa649..4c17849 100644 --- a/drivers/net/usb/smsc75xx.c +++ b/drivers/net/usb/smsc75xx.c @@ -61,7 +61,6 @@ #define SUSPEND_SUSPEND1 (0x02) #define SUSPEND_SUSPEND2 (0x04) #define SUSPEND_SUSPEND3 (0x08) -#define SUSPEND_REMOTEWAKE (0x10) #define SUSPEND_ALLMODES (SUSPEND_SUSPEND0 | SUSPEND_SUSPEND1 | \ SUSPEND_SUSPEND2 | SUSPEND_SUSPEND3) @@ -172,26 +171,6 @@ static int __must_check smsc75xx_write_reg(struct usbnet *dev, u32 index, return __smsc75xx_write_reg(dev, index, data, 0); } -static int smsc75xx_set_feature(struct usbnet *dev, u32 feature) -{ - if (WARN_ON_ONCE(!dev)) - return -EINVAL; - - return usbnet_write_cmd_nopm(dev, USB_REQ_SET_FEATURE, - USB_DIR_OUT | USB_RECIP_DEVICE, - feature, 0, NULL, 0); -} - -static int smsc75xx_clear_feature(struct usbnet *dev, u32 feature) -{ - if (WARN_ON_ONCE(!dev)) - return -EINVAL; - - return usbnet_write_cmd_nopm(dev, USB_REQ_CLEAR_FEATURE, - USB_DIR_OUT | USB_RECIP_DEVICE, - feature, 0, NULL, 0); -} - /* Loop until the read is completed with timeout * called with phy_mutex held */