Commit 8d4a4d72 authored by hayeswang's avatar hayeswang Committed by David S. Miller

r8152: adjust usb_autopm_xxx

Add usb_autopm_xxx for rtl8152_get_settings() ,and remove
usb_autopm_xxx from read_mii_word() and write_mii_word().
Signed-off-by: default avatarHayes Wang <hayeswang@realtek.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 405f8a0e
...@@ -942,15 +942,8 @@ static int read_mii_word(struct net_device *netdev, int phy_id, int reg) ...@@ -942,15 +942,8 @@ static int read_mii_word(struct net_device *netdev, int phy_id, int reg)
if (phy_id != R8152_PHY_ID) if (phy_id != R8152_PHY_ID)
return -EINVAL; return -EINVAL;
ret = usb_autopm_get_interface(tp->intf);
if (ret < 0)
goto out;
ret = r8152_mdio_read(tp, reg); ret = r8152_mdio_read(tp, reg);
usb_autopm_put_interface(tp->intf);
out:
return ret; return ret;
} }
...@@ -965,12 +958,7 @@ void write_mii_word(struct net_device *netdev, int phy_id, int reg, int val) ...@@ -965,12 +958,7 @@ void write_mii_word(struct net_device *netdev, int phy_id, int reg, int val)
if (phy_id != R8152_PHY_ID) if (phy_id != R8152_PHY_ID)
return; return;
if (usb_autopm_get_interface(tp->intf) < 0)
return;
r8152_mdio_write(tp, reg, val); r8152_mdio_write(tp, reg, val);
usb_autopm_put_interface(tp->intf);
} }
static int static int
...@@ -3290,11 +3278,21 @@ static ...@@ -3290,11 +3278,21 @@ static
int rtl8152_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd) int rtl8152_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd)
{ {
struct r8152 *tp = netdev_priv(netdev); struct r8152 *tp = netdev_priv(netdev);
int ret;
if (!tp->mii.mdio_read) if (!tp->mii.mdio_read)
return -EOPNOTSUPP; return -EOPNOTSUPP;
return mii_ethtool_gset(&tp->mii, cmd); ret = usb_autopm_get_interface(tp->intf);
if (ret < 0)
goto out;
ret = mii_ethtool_gset(&tp->mii, cmd);
usb_autopm_put_interface(tp->intf);
out:
return ret;
} }
static int rtl8152_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) static int rtl8152_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment