# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.306 -> 1.307 # drivers/usb/pegasus.c 1.13 -> 1.14 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 02/04/02 petkan@mastika.lnxw.com 1.307 # USB pegasus driver # # semaphore cleanup and proper link detection # -------------------------------------------- # diff -Nru a/drivers/usb/pegasus.c b/drivers/usb/pegasus.c --- a/drivers/usb/pegasus.c Wed Apr 3 10:48:01 2002 +++ b/drivers/usb/pegasus.c Wed Apr 3 10:48:01 2002 @@ -484,14 +484,12 @@ __u8 data[4]; pegasus_t *pegasus = dev->priv; - - if ( read_mii_word(pegasus, pegasus->phy, MII_BMSR, &bmsr) ) - return 1; -#if 0 - if ( !(bmsr & 0x20) && !loopback ) + /* read twice 'cos this is a latch bit */ + read_mii_word(pegasus, pegasus->phy, MII_BMSR, &bmsr); + read_mii_word(pegasus, pegasus->phy, MII_BMSR, &bmsr); + if ( !(bmsr & 4) && !loopback ) warn( "%s: link NOT established (0x%x) - check the cable.", dev->name, bmsr ); -#endif if ( read_mii_word(pegasus, pegasus->phy, MII_LPA, &linkpart) ) return 2; if ( !(linkpart & 1) ) @@ -1021,11 +1019,11 @@ usb_free_urb (pegasus->rx_urb); usb_free_urb (pegasus->ctrl_urb); kfree( pegasus ); - pegasus = NULL; - goto exit; + return NULL; } init_MUTEX(&pegasus->sem); + down(&pegasus->sem); pegasus->usb = dev; pegasus->net = net; SET_MODULE_OWNER(net); @@ -1072,7 +1070,7 @@ } exit: - up(&gsem); + up(&pegasus->sem); return pegasus; }