Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
dc00b7a3
Commit
dc00b7a3
authored
Mar 25, 2002
by
Petko Manolov
Committed by
Greg Kroah-Hartman
Mar 25, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
USB pegasus driver
semaphore cleanup and proper link detection
parent
34e02698
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
18 deletions
+12
-18
drivers/usb/pegasus.c
drivers/usb/pegasus.c
+12
-18
No files found.
drivers/usb/pegasus.c
View file @
dc00b7a3
...
@@ -71,7 +71,6 @@
...
@@ -71,7 +71,6 @@
static
int
loopback
=
0
;
static
int
loopback
=
0
;
static
int
mii_mode
=
0
;
static
int
mii_mode
=
0
;
static
int
multicast_filter_limit
=
32
;
static
int
multicast_filter_limit
=
32
;
static
DECLARE_MUTEX
(
gsem
);
static
struct
usb_eth_dev
usb_dev_id
[]
=
{
static
struct
usb_eth_dev
usb_dev_id
[]
=
{
#define PEGASUS_DEV(pn, vid, pid, flags) \
#define PEGASUS_DEV(pn, vid, pid, flags) \
...
@@ -488,10 +487,10 @@ static int enable_net_traffic( struct net_device *dev, struct usb_device *usb )
...
@@ -488,10 +487,10 @@ static int enable_net_traffic( struct net_device *dev, struct usb_device *usb )
pegasus_t
*
pegasus
=
dev
->
priv
;
pegasus_t
*
pegasus
=
dev
->
priv
;
if
(
read_mii_word
(
pegasus
,
pegasus
->
phy
,
MII_BMSR
,
&
bmsr
)
)
read_mii_word
(
pegasus
,
pegasus
->
phy
,
MII_BMSR
,
&
bmsr
);
return
1
;
read_mii_word
(
pegasus
,
pegasus
->
phy
,
MII_BMSR
,
&
bmsr
)
;
if
(
!
(
bmsr
&
0x20
)
&&
!
loopback
)
if
(
!
(
bmsr
&
4
)
&&
!
loopback
)
warn
(
"%s: link NOT established (
0x%
x) - check the cable."
,
warn
(
"%s: link NOT established (
%04
x) - check the cable."
,
dev
->
name
,
bmsr
);
dev
->
name
,
bmsr
);
if
(
read_mii_word
(
pegasus
,
pegasus
->
phy
,
MII_LPA
,
&
linkpart
)
)
if
(
read_mii_word
(
pegasus
,
pegasus
->
phy
,
MII_LPA
,
&
linkpart
)
)
return
2
;
return
2
;
...
@@ -970,10 +969,9 @@ static void * pegasus_probe( struct usb_device *dev, unsigned int ifnum,
...
@@ -970,10 +969,9 @@ static void * pegasus_probe( struct usb_device *dev, unsigned int ifnum,
err
(
"usb_set_configuration() failed"
);
err
(
"usb_set_configuration() failed"
);
return
NULL
;
return
NULL
;
}
}
down
(
&
gsem
);
if
(
!
(
pegasus
=
kmalloc
(
sizeof
(
struct
pegasus
),
GFP_KERNEL
)))
{
if
(
!
(
pegasus
=
kmalloc
(
sizeof
(
struct
pegasus
),
GFP_KERNEL
)))
{
err
(
"out of memory allocating device structure"
);
err
(
"out of memory allocating device structure"
);
goto
exit
;
return
NULL
;
}
}
usb_inc_dev_use
(
dev
);
usb_inc_dev_use
(
dev
);
...
@@ -984,23 +982,20 @@ static void * pegasus_probe( struct usb_device *dev, unsigned int ifnum,
...
@@ -984,23 +982,20 @@ static void * pegasus_probe( struct usb_device *dev, unsigned int ifnum,
pegasus
->
ctrl_urb
=
usb_alloc_urb
(
0
,
GFP_KERNEL
);
pegasus
->
ctrl_urb
=
usb_alloc_urb
(
0
,
GFP_KERNEL
);
if
(
!
pegasus
->
ctrl_urb
)
{
if
(
!
pegasus
->
ctrl_urb
)
{
kfree
(
pegasus
);
kfree
(
pegasus
);
pegasus
=
NULL
;
return
NULL
;
goto
exit
;
}
}
pegasus
->
rx_urb
=
usb_alloc_urb
(
0
,
GFP_KERNEL
);
pegasus
->
rx_urb
=
usb_alloc_urb
(
0
,
GFP_KERNEL
);
if
(
!
pegasus
->
rx_urb
)
{
if
(
!
pegasus
->
rx_urb
)
{
usb_free_urb
(
pegasus
->
ctrl_urb
);
usb_free_urb
(
pegasus
->
ctrl_urb
);
kfree
(
pegasus
);
kfree
(
pegasus
);
pegasus
=
NULL
;
return
NULL
;
goto
exit
;
}
}
pegasus
->
tx_urb
=
usb_alloc_urb
(
0
,
GFP_KERNEL
);
pegasus
->
tx_urb
=
usb_alloc_urb
(
0
,
GFP_KERNEL
);
if
(
!
pegasus
->
tx_urb
)
{
if
(
!
pegasus
->
tx_urb
)
{
usb_free_urb
(
pegasus
->
rx_urb
);
usb_free_urb
(
pegasus
->
rx_urb
);
usb_free_urb
(
pegasus
->
ctrl_urb
);
usb_free_urb
(
pegasus
->
ctrl_urb
);
kfree
(
pegasus
);
kfree
(
pegasus
);
pegasus
=
NULL
;
return
NULL
;
goto
exit
;
}
}
pegasus
->
intr_urb
=
usb_alloc_urb
(
0
,
GFP_KERNEL
);
pegasus
->
intr_urb
=
usb_alloc_urb
(
0
,
GFP_KERNEL
);
if
(
!
pegasus
->
intr_urb
)
{
if
(
!
pegasus
->
intr_urb
)
{
...
@@ -1008,8 +1003,7 @@ static void * pegasus_probe( struct usb_device *dev, unsigned int ifnum,
...
@@ -1008,8 +1003,7 @@ static void * pegasus_probe( struct usb_device *dev, unsigned int ifnum,
usb_free_urb
(
pegasus
->
rx_urb
);
usb_free_urb
(
pegasus
->
rx_urb
);
usb_free_urb
(
pegasus
->
ctrl_urb
);
usb_free_urb
(
pegasus
->
ctrl_urb
);
kfree
(
pegasus
);
kfree
(
pegasus
);
pegasus
=
NULL
;
return
NULL
;
goto
exit
;
}
}
net
=
init_etherdev
(
NULL
,
0
);
net
=
init_etherdev
(
NULL
,
0
);
...
@@ -1018,11 +1012,11 @@ static void * pegasus_probe( struct usb_device *dev, unsigned int ifnum,
...
@@ -1018,11 +1012,11 @@ static void * pegasus_probe( struct usb_device *dev, unsigned int ifnum,
usb_free_urb
(
pegasus
->
rx_urb
);
usb_free_urb
(
pegasus
->
rx_urb
);
usb_free_urb
(
pegasus
->
ctrl_urb
);
usb_free_urb
(
pegasus
->
ctrl_urb
);
kfree
(
pegasus
);
kfree
(
pegasus
);
pegasus
=
NULL
;
return
NULL
;
goto
exit
;
}
}
init_MUTEX
(
&
pegasus
->
sem
);
init_MUTEX
(
&
pegasus
->
sem
);
down
(
&
pegasus
->
sem
);
pegasus
->
usb
=
dev
;
pegasus
->
usb
=
dev
;
pegasus
->
net
=
net
;
pegasus
->
net
=
net
;
SET_MODULE_OWNER
(
net
);
SET_MODULE_OWNER
(
net
);
...
@@ -1068,7 +1062,7 @@ static void * pegasus_probe( struct usb_device *dev, unsigned int ifnum,
...
@@ -1068,7 +1062,7 @@ static void * pegasus_probe( struct usb_device *dev, unsigned int ifnum,
pegasus
->
phy
=
1
;
pegasus
->
phy
=
1
;
}
}
exit:
exit:
up
(
&
g
sem
);
up
(
&
pegasus
->
sem
);
return
pegasus
;
return
pegasus
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment