summaryrefslogtreecommitdiffstats
path: root/drivers/usb/net/pegasus.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-24 20:05:20 +0200
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-24 20:05:20 +0200
commit89d8ab6993e1d9f3c482ee8c862c03c528f696aa (patch)
treed9adfe3c3d3e640bd5d7cacabef6c18f739fce22 /drivers/usb/net/pegasus.c
parentMerge branch 'for-linus' of git://one.firstfloor.org/home/andi/git/linux-2.6 (diff)
parentdrivers/net/hamradio/baycom_ser_fdx build fix (diff)
downloadlinux-89d8ab6993e1d9f3c482ee8c862c03c528f696aa.tar.xz
linux-89d8ab6993e1d9f3c482ee8c862c03c528f696aa.zip
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: drivers/net/hamradio/baycom_ser_fdx build fix usb-net/pegasus: fix pegasus carrier detection sis900: Allocate rx replacement buffer before rx operation [netdrvr] depca: handle platform_device_add() failure
Diffstat (limited to 'drivers/usb/net/pegasus.c')
-rw-r--r--drivers/usb/net/pegasus.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c
index d48c024cff59..6d12961cf9f9 100644
--- a/drivers/usb/net/pegasus.c
+++ b/drivers/usb/net/pegasus.c
@@ -316,6 +316,7 @@ static int update_eth_regs_async(pegasus_t * pegasus)
return ret;
}
+/* Returns 0 on success, error on failure */
static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd)
{
int i;
@@ -847,10 +848,16 @@ static void intr_callback(struct urb *urb)
* d[0].NO_CARRIER kicks in only with failed TX.
* ... so monitoring with MII may be safest.
*/
- if (d[0] & NO_CARRIER)
- netif_carrier_off(net);
- else
- netif_carrier_on(net);
+ if (pegasus->features & TRUST_LINK_STATUS) {
+ if (d[5] & LINK_STATUS)
+ netif_carrier_on(net);
+ else
+ netif_carrier_off(net);
+ } else {
+ /* Never set carrier _on_ based on ! NO_CARRIER */
+ if (d[0] & NO_CARRIER)
+ netif_carrier_off(net);
+ }
/* bytes 3-4 == rx_lostpkt, reg 2E/2F */
pegasus->stats.rx_missed_errors += ((d[3] & 0x7f) << 8) | d[4];
@@ -950,7 +957,7 @@ static void set_carrier(struct net_device *net)
pegasus_t *pegasus = netdev_priv(net);
u16 tmp;
- if (!read_mii_word(pegasus, pegasus->phy, MII_BMSR, &tmp))
+ if (read_mii_word(pegasus, pegasus->phy, MII_BMSR, &tmp))
return;
if (tmp & BMSR_LSTATUS)