Skip to content

Commit 351f33d

Browse files
steveglendavem330
authored andcommitted
smsc75xx: don't enable remote wakeup directly
As pointed out by Bjorn Mork, the generic "usb" driver sets this for us so no need to directly set it in this driver. Signed-off-by: Steve Glendinning <[email protected]> Cc: Bjorn Mork <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b4cdea9 commit 351f33d

File tree

1 file changed

+8
-35
lines changed

1 file changed

+8
-35
lines changed

drivers/net/usb/smsc75xx.c

Lines changed: 8 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
#define SUSPEND_SUSPEND1 (0x02)
6262
#define SUSPEND_SUSPEND2 (0x04)
6363
#define SUSPEND_SUSPEND3 (0x08)
64-
#define SUSPEND_REMOTEWAKE (0x10)
6564
#define SUSPEND_ALLMODES (SUSPEND_SUSPEND0 | SUSPEND_SUSPEND1 | \
6665
SUSPEND_SUSPEND2 | SUSPEND_SUSPEND3)
6766

@@ -172,26 +171,6 @@ static int __must_check smsc75xx_write_reg(struct usbnet *dev, u32 index,
172171
return __smsc75xx_write_reg(dev, index, data, 0);
173172
}
174173

175-
static int smsc75xx_set_feature(struct usbnet *dev, u32 feature)
176-
{
177-
if (WARN_ON_ONCE(!dev))
178-
return -EINVAL;
179-
180-
return usbnet_write_cmd_nopm(dev, USB_REQ_SET_FEATURE,
181-
USB_DIR_OUT | USB_RECIP_DEVICE,
182-
feature, 0, NULL, 0);
183-
}
184-
185-
static int smsc75xx_clear_feature(struct usbnet *dev, u32 feature)
186-
{
187-
if (WARN_ON_ONCE(!dev))
188-
return -EINVAL;
189-
190-
return usbnet_write_cmd_nopm(dev, USB_REQ_CLEAR_FEATURE,
191-
USB_DIR_OUT | USB_RECIP_DEVICE,
192-
feature, 0, NULL, 0);
193-
}
194-
195174
/* Loop until the read is completed with timeout
196175
* called with phy_mutex held */
197176
static __must_check int __smsc75xx_phy_wait_not_busy(struct usbnet *dev,
@@ -674,8 +653,13 @@ static int smsc75xx_ethtool_set_wol(struct net_device *net,
674653
{
675654
struct usbnet *dev = netdev_priv(net);
676655
struct smsc75xx_priv *pdata = (struct smsc75xx_priv *)(dev->data[0]);
656+
int ret;
677657

678658
pdata->wolopts = wolinfo->wolopts & SUPPORTED_WAKE;
659+
660+
ret = device_set_wakeup_enable(&dev->udev->dev, pdata->wolopts);
661+
check_warn_return(ret, "device_set_wakeup_enable error %d\n", ret);
662+
679663
return 0;
680664
}
681665

@@ -1263,9 +1247,7 @@ static int smsc75xx_enter_suspend0(struct usbnet *dev)
12631247
ret = smsc75xx_write_reg_nopm(dev, PMT_CTL, val);
12641248
check_warn_return(ret, "Error writing PMT_CTL\n");
12651249

1266-
smsc75xx_set_feature(dev, USB_DEVICE_REMOTE_WAKEUP);
1267-
1268-
pdata->suspend_flags |= SUSPEND_SUSPEND0 | SUSPEND_REMOTEWAKE;
1250+
pdata->suspend_flags |= SUSPEND_SUSPEND0;
12691251

12701252
return 0;
12711253
}
@@ -1292,9 +1274,7 @@ static int smsc75xx_enter_suspend1(struct usbnet *dev)
12921274
ret = smsc75xx_write_reg_nopm(dev, PMT_CTL, val);
12931275
check_warn_return(ret, "Error writing PMT_CTL\n");
12941276

1295-
smsc75xx_set_feature(dev, USB_DEVICE_REMOTE_WAKEUP);
1296-
1297-
pdata->suspend_flags |= SUSPEND_SUSPEND1 | SUSPEND_REMOTEWAKE;
1277+
pdata->suspend_flags |= SUSPEND_SUSPEND1;
12981278

12991279
return 0;
13001280
}
@@ -1349,9 +1329,7 @@ static int smsc75xx_enter_suspend3(struct usbnet *dev)
13491329
ret = smsc75xx_write_reg_nopm(dev, PMT_CTL, val);
13501330
check_warn_return(ret, "Error writing PMT_CTL\n");
13511331

1352-
smsc75xx_set_feature(dev, USB_DEVICE_REMOTE_WAKEUP);
1353-
1354-
pdata->suspend_flags |= SUSPEND_SUSPEND3 | SUSPEND_REMOTEWAKE;
1332+
pdata->suspend_flags |= SUSPEND_SUSPEND3;
13551333

13561334
return 0;
13571335
}
@@ -1651,11 +1629,6 @@ static int smsc75xx_resume(struct usb_interface *intf)
16511629
/* do this first to ensure it's cleared even in error case */
16521630
pdata->suspend_flags = 0;
16531631

1654-
if (suspend_flags & SUSPEND_REMOTEWAKE) {
1655-
ret = smsc75xx_clear_feature(dev, USB_DEVICE_REMOTE_WAKEUP);
1656-
check_warn_return(ret, "Error disabling remote wakeup\n");
1657-
}
1658-
16591632
if (suspend_flags & SUSPEND_ALLMODES) {
16601633
/* Disable wakeup sources */
16611634
ret = smsc75xx_read_reg_nopm(dev, WUCSR, &val);

0 commit comments

Comments
 (0)