Skip to content

Commit

Permalink
r8152: autoresume before setting MAC address
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
hayeswang authored and David S. Miller committed Oct 3, 2014
1 parent 3cc81d8 commit ea6a711
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions drivers/net/usb/r8152.c
Original file line number Diff line number Diff line change
Expand Up @@ -1007,17 +1007,24 @@ static int rtl8152_set_mac_address(struct net_device *netdev, void *p)
{
struct r8152 *tp = netdev_priv(netdev);
struct sockaddr *addr = p;
int ret = -EADDRNOTAVAIL;

if (!is_valid_ether_addr(addr->sa_data))
return -EADDRNOTAVAIL;
goto out1;

ret = usb_autopm_get_interface(tp->intf);
if (ret < 0)
goto out1;

memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);

ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CRWECR, CRWECR_CONFIG);
pla_ocp_write(tp, PLA_IDR, BYTE_EN_SIX_BYTES, 8, addr->sa_data);
ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CRWECR, CRWECR_NORAML);

return 0;
usb_autopm_put_interface(tp->intf);
out1:
return ret;
}

static void read_bulk_callback(struct urb *urb)
Expand Down

0 comments on commit ea6a711

Please sign in to comment.