Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 334031
b: refs/heads/master
c: dabdaf0
h: refs/heads/master
i:
  334029: 181e982
  334027: 937b30f
  334023: dbee52f
  334015: 5d93992
v: v3
  • Loading branch information
Ondrej Zary authored and David S. Miller committed Oct 12, 2012
1 parent 348495b commit 21bc151
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 93ac0ef016a1b223d23fbb5e0397cab75a8f7d34
refs/heads/master: dabdaf0caa3af520dbc1df87b2fb4e77224037bd
30 changes: 21 additions & 9 deletions trunk/drivers/net/usb/mcs7830.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ enum {
struct mcs7830_data {
u8 multi_filter[8];
u8 config;
u8 link_counter;
};

static const char driver_name[] = "MOSCHIP usb-ethernet driver";
Expand Down Expand Up @@ -632,20 +633,31 @@ static int mcs7830_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
static void mcs7830_status(struct usbnet *dev, struct urb *urb)
{
u8 *buf = urb->transfer_buffer;
bool link;
bool link, link_changed;
struct mcs7830_data *data = mcs7830_get_data(dev);

if (urb->actual_length < 16)
return;

link = !(buf[1] & 0x20);
if (netif_carrier_ok(dev->net) != link) {
if (link) {
netif_carrier_on(dev->net);
usbnet_defer_kevent(dev, EVENT_LINK_RESET);
} else
netif_carrier_off(dev->net);
netdev_dbg(dev->net, "Link Status is: %d\n", link);
}
link_changed = netif_carrier_ok(dev->net) != link;
if (link_changed) {
data->link_counter++;
/*
track link state 20 times to guard against erroneous
link state changes reported sometimes by the chip
*/
if (data->link_counter > 20) {
data->link_counter = 0;
if (link) {
netif_carrier_on(dev->net);
usbnet_defer_kevent(dev, EVENT_LINK_RESET);
} else
netif_carrier_off(dev->net);
netdev_dbg(dev->net, "Link Status is: %d\n", link);
}
} else
data->link_counter = 0;
}

static const struct driver_info moschip_info = {
Expand Down

0 comments on commit 21bc151

Please sign in to comment.