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
nexedi
linux
Commits
8ad09275
Commit
8ad09275
authored
Nov 07, 2002
by
Paulo André
Committed by
Jeff Garzik
Nov 07, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert 3c505 net driver to use spinlocks instead of cli/sti
parent
cce878a4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
drivers/net/3c505.c
drivers/net/3c505.c
+14
-10
No files found.
drivers/net/3c505.c
View file @
8ad09275
...
@@ -274,9 +274,12 @@ static inline int get_status(unsigned int base_addr)
...
@@ -274,9 +274,12 @@ static inline int get_status(unsigned int base_addr)
static
inline
void
set_hsf
(
struct
net_device
*
dev
,
int
hsf
)
static
inline
void
set_hsf
(
struct
net_device
*
dev
,
int
hsf
)
{
{
cli
();
elp_device
*
adapter
=
dev
->
priv
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
adapter
->
lock
,
flags
);
outb_control
((
HCR_VAL
(
dev
)
&
~
HSF_PCB_MASK
)
|
hsf
,
dev
);
outb_control
((
HCR_VAL
(
dev
)
&
~
HSF_PCB_MASK
)
|
hsf
,
dev
);
s
ti
(
);
s
pin_unlock_irqrestore
(
&
adapter
->
lock
,
flags
);
}
}
static
int
start_receive
(
struct
net_device
*
,
pcb_struct
*
);
static
int
start_receive
(
struct
net_device
*
,
pcb_struct
*
);
...
@@ -325,8 +328,7 @@ static inline void check_3c505_dma(struct net_device *dev)
...
@@ -325,8 +328,7 @@ static inline void check_3c505_dma(struct net_device *dev)
if
(
adapter
->
dmaing
&&
time_after
(
jiffies
,
adapter
->
current_dma
.
start_time
+
10
))
{
if
(
adapter
->
dmaing
&&
time_after
(
jiffies
,
adapter
->
current_dma
.
start_time
+
10
))
{
unsigned
long
flags
,
f
;
unsigned
long
flags
,
f
;
printk
(
"%s: DMA %s timed out, %d bytes left
\n
"
,
dev
->
name
,
adapter
->
current_dma
.
direction
?
"download"
:
"upload"
,
get_dma_residue
(
dev
->
dma
));
printk
(
"%s: DMA %s timed out, %d bytes left
\n
"
,
dev
->
name
,
adapter
->
current_dma
.
direction
?
"download"
:
"upload"
,
get_dma_residue
(
dev
->
dma
));
save_flags
(
flags
);
spin_lock_irqsave
(
&
adapter
->
lock
,
flags
);
cli
();
adapter
->
dmaing
=
0
;
adapter
->
dmaing
=
0
;
adapter
->
busy
=
0
;
adapter
->
busy
=
0
;
...
@@ -337,7 +339,7 @@ static inline void check_3c505_dma(struct net_device *dev)
...
@@ -337,7 +339,7 @@ static inline void check_3c505_dma(struct net_device *dev)
if
(
adapter
->
rx_active
)
if
(
adapter
->
rx_active
)
adapter
->
rx_active
--
;
adapter
->
rx_active
--
;
outb_control
(
adapter
->
hcr_val
&
~
(
DMAE
|
TCEN
|
DIR
),
dev
);
outb_control
(
adapter
->
hcr_val
&
~
(
DMAE
|
TCEN
|
DIR
),
dev
);
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
adapter
->
lock
,
flags
);
}
}
}
}
...
@@ -405,6 +407,7 @@ static int send_pcb(struct net_device *dev, pcb_struct * pcb)
...
@@ -405,6 +407,7 @@ static int send_pcb(struct net_device *dev, pcb_struct * pcb)
int
i
;
int
i
;
int
timeout
;
int
timeout
;
elp_device
*
adapter
=
dev
->
priv
;
elp_device
*
adapter
=
dev
->
priv
;
unsigned
long
flags
;
check_3c505_dma
(
dev
);
check_3c505_dma
(
dev
);
...
@@ -428,7 +431,7 @@ static int send_pcb(struct net_device *dev, pcb_struct * pcb)
...
@@ -428,7 +431,7 @@ static int send_pcb(struct net_device *dev, pcb_struct * pcb)
if
(
send_pcb_slow
(
dev
->
base_addr
,
pcb
->
command
))
if
(
send_pcb_slow
(
dev
->
base_addr
,
pcb
->
command
))
goto
abort
;
goto
abort
;
cli
(
);
spin_lock_irqsave
(
&
adapter
->
lock
,
flags
);
if
(
send_pcb_fast
(
dev
->
base_addr
,
pcb
->
length
))
if
(
send_pcb_fast
(
dev
->
base_addr
,
pcb
->
length
))
goto
sti_abort
;
goto
sti_abort
;
...
@@ -442,7 +445,7 @@ static int send_pcb(struct net_device *dev, pcb_struct * pcb)
...
@@ -442,7 +445,7 @@ static int send_pcb(struct net_device *dev, pcb_struct * pcb)
outb_command
(
2
+
pcb
->
length
,
dev
->
base_addr
);
outb_command
(
2
+
pcb
->
length
,
dev
->
base_addr
);
/* now wait for the acknowledgement */
/* now wait for the acknowledgement */
s
ti
(
);
s
pin_unlock_irqrestore
(
&
adapter
->
lock
,
flags
);
for
(
timeout
=
jiffies
+
5
*
HZ
/
100
;
time_before
(
jiffies
,
timeout
);)
{
for
(
timeout
=
jiffies
+
5
*
HZ
/
100
;
time_before
(
jiffies
,
timeout
);)
{
switch
(
GET_ASF
(
dev
->
base_addr
))
{
switch
(
GET_ASF
(
dev
->
base_addr
))
{
...
@@ -463,7 +466,7 @@ static int send_pcb(struct net_device *dev, pcb_struct * pcb)
...
@@ -463,7 +466,7 @@ static int send_pcb(struct net_device *dev, pcb_struct * pcb)
printk
(
"%s: timeout waiting for PCB acknowledge (status %02x)
\n
"
,
dev
->
name
,
inb_status
(
dev
->
base_addr
));
printk
(
"%s: timeout waiting for PCB acknowledge (status %02x)
\n
"
,
dev
->
name
,
inb_status
(
dev
->
base_addr
));
sti_abort:
sti_abort:
s
ti
(
);
s
pin_unlock_irqrestore
(
&
adapter
->
lock
,
flags
);
abort:
abort:
adapter
->
send_pcb_semaphore
=
0
;
adapter
->
send_pcb_semaphore
=
0
;
return
FALSE
;
return
FALSE
;
...
@@ -489,6 +492,7 @@ static int receive_pcb(struct net_device *dev, pcb_struct * pcb)
...
@@ -489,6 +492,7 @@ static int receive_pcb(struct net_device *dev, pcb_struct * pcb)
int
total_length
;
int
total_length
;
int
stat
;
int
stat
;
int
timeout
;
int
timeout
;
unsigned
long
flags
;
elp_device
*
adapter
=
dev
->
priv
;
elp_device
*
adapter
=
dev
->
priv
;
...
@@ -519,7 +523,7 @@ static int receive_pcb(struct net_device *dev, pcb_struct * pcb)
...
@@ -519,7 +523,7 @@ static int receive_pcb(struct net_device *dev, pcb_struct * pcb)
return
FALSE
;
return
FALSE
;
}
}
/* read the data */
/* read the data */
cli
(
);
spin_lock_irqsave
(
&
adapter
->
lock
,
flags
);
i
=
0
;
i
=
0
;
do
{
do
{
j
=
0
;
j
=
0
;
...
@@ -528,7 +532,7 @@ static int receive_pcb(struct net_device *dev, pcb_struct * pcb)
...
@@ -528,7 +532,7 @@ static int receive_pcb(struct net_device *dev, pcb_struct * pcb)
if
(
i
>
MAX_PCB_DATA
)
if
(
i
>
MAX_PCB_DATA
)
INVALID_PCB_MSG
(
i
);
INVALID_PCB_MSG
(
i
);
}
while
((
stat
&
ASF_PCB_MASK
)
!=
ASF_PCB_END
&&
j
<
20000
);
}
while
((
stat
&
ASF_PCB_MASK
)
!=
ASF_PCB_END
&&
j
<
20000
);
s
ti
(
);
s
pin_unlock_irqrestore
(
&
adapter
->
lock
,
flags
);
if
(
j
>=
20000
)
{
if
(
j
>=
20000
)
{
TIMEOUT_MSG
(
__LINE__
);
TIMEOUT_MSG
(
__LINE__
);
return
FALSE
;
return
FALSE
;
...
...
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