diff options
author | hayeswang <hayeswang@realtek.com> | 2014-10-02 05:03:12 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-10-03 18:40:28 -0400 |
commit | ea6a7112d8525f7b5b6fdd59b255845ed6331beb (patch) | |
tree | ec0019eb49ea05a2df376cefc2e569aea62653f1 /drivers/net | |
parent | 3cc81d85ee01e5a0b7ea2f4190e2ed1165f53c31 (diff) |
r8152: autoresume before setting MAC address
Resume the device before setting the MAC address.
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/usb/r8152.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 604ef210a4de..5ee75827bd36 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c | |||
@@ -1007,9 +1007,14 @@ static int rtl8152_set_mac_address(struct net_device *netdev, void *p) | |||
1007 | { | 1007 | { |
1008 | struct r8152 *tp = netdev_priv(netdev); | 1008 | struct r8152 *tp = netdev_priv(netdev); |
1009 | struct sockaddr *addr = p; | 1009 | struct sockaddr *addr = p; |
1010 | int ret = -EADDRNOTAVAIL; | ||
1010 | 1011 | ||
1011 | if (!is_valid_ether_addr(addr->sa_data)) | 1012 | if (!is_valid_ether_addr(addr->sa_data)) |
1012 | return -EADDRNOTAVAIL; | 1013 | goto out1; |
1014 | |||
1015 | ret = usb_autopm_get_interface(tp->intf); | ||
1016 | if (ret < 0) | ||
1017 | goto out1; | ||
1013 | 1018 | ||
1014 | memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); | 1019 | memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); |
1015 | 1020 | ||
@@ -1017,7 +1022,9 @@ static int rtl8152_set_mac_address(struct net_device *netdev, void *p) | |||
1017 | pla_ocp_write(tp, PLA_IDR, BYTE_EN_SIX_BYTES, 8, addr->sa_data); | 1022 | pla_ocp_write(tp, PLA_IDR, BYTE_EN_SIX_BYTES, 8, addr->sa_data); |
1018 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CRWECR, CRWECR_NORAML); | 1023 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CRWECR, CRWECR_NORAML); |
1019 | 1024 | ||
1020 | return 0; | 1025 | usb_autopm_put_interface(tp->intf); |
1026 | out1: | ||
1027 | return ret; | ||
1021 | } | 1028 | } |
1022 | 1029 | ||
1023 | static void read_bulk_callback(struct urb *urb) | 1030 | static void read_bulk_callback(struct urb *urb) |