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
24abc645
Commit
24abc645
authored
Oct 21, 2004
by
Alexander Viro
Committed by
Jeff Garzik
Oct 21, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] olympic_open() cleanup and fixes
Signed-off-by:
Al Viro
<
viro@parcelfarce.linux.theplanet.co.uk
>
parent
d59386e3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
46 deletions
+44
-46
drivers/net/tokenring/olympic.c
drivers/net/tokenring/olympic.c
+44
-46
No files found.
drivers/net/tokenring/olympic.c
View file @
24abc645
...
...
@@ -438,8 +438,8 @@ static int olympic_open(struct net_device *dev)
struct
olympic_private
*
olympic_priv
=
(
struct
olympic_private
*
)
dev
->
priv
;
u8
__iomem
*
olympic_mmio
=
olympic_priv
->
olympic_mmio
,
*
init_srb
;
unsigned
long
flags
,
t
;
char
open_error
[
255
]
;
int
i
,
open_finished
=
1
;
u8
resp
,
err
;
DECLARE_WAITQUEUE
(
wait
,
current
)
;
...
...
@@ -540,52 +540,48 @@ static int olympic_open(struct net_device *dev)
* timed out.
*/
if
(
readb
(
init_srb
+
2
)
==
OLYMPIC_CLEAR_RET_CODE
)
{
switch
(
resp
=
readb
(
init_srb
+
2
))
{
case
OLYMPIC_CLEAR_RET_CODE
:
printk
(
KERN_WARNING
"%s: Adapter Open time out or error.
\n
"
,
dev
->
name
)
;
return
-
EIO
;
}
if
(
readb
(
init_srb
+
2
)
!=
0
)
{
if
(
readb
(
init_srb
+
2
)
==
0x07
)
{
if
(
!
olympic_priv
->
olympic_ring_speed
&&
open_finished
)
{
/* Autosense , first time around */
printk
(
KERN_WARNING
"%s: Retrying at different ring speed
\n
"
,
dev
->
name
);
open_finished
=
0
;
}
else
{
goto
out
;
case
0
:
open_finished
=
1
;
break
;
case
0x07
:
if
(
!
olympic_priv
->
olympic_ring_speed
&&
open_finished
)
{
/* Autosense , first time around */
printk
(
KERN_WARNING
"%s: Retrying at different ring speed
\n
"
,
dev
->
name
);
open_finished
=
0
;
continue
;
}
strcpy
(
open_error
,
open_maj_error
[(
readb
(
init_srb
+
7
)
&
0xf0
)
>>
4
])
;
strcat
(
open_error
,
" - "
)
;
strcat
(
open_error
,
open_min_error
[(
readb
(
init_srb
+
7
)
&
0x0f
)])
;
err
=
readb
(
init_srb
+
7
);
if
(
!
olympic_priv
->
olympic_ring_speed
&&
((
readb
(
init_srb
+
7
)
&
0x0f
)
==
0x0d
))
{
printk
(
KERN_WARNING
"%s: Tried to autosense ring speed with no monitors present
\n
"
,
dev
->
name
);
printk
(
KERN_WARNING
"%s: Please try again with a specified ring speed
\n
"
,
dev
->
name
);
free_irq
(
dev
->
irq
,
dev
);
return
-
EIO
;
}
if
(
!
olympic_priv
->
olympic_ring_speed
&&
((
err
&
0x0f
)
==
0x0d
))
{
printk
(
KERN_WARNING
"%s: Tried to autosense ring speed with no monitors present
\n
"
,
dev
->
name
);
printk
(
KERN_WARNING
"%s: Please try again with a specified ring speed
\n
"
,
dev
->
name
);
}
else
{
printk
(
KERN_WARNING
"%s: %s - %s
\n
"
,
dev
->
name
,
open_maj_error
[(
err
&
0xf0
)
>>
4
],
open_min_error
[(
err
&
0x0f
)]);
}
goto
out
;
case
0x32
:
printk
(
KERN_WARNING
"%s: Invalid LAA: %02x:%02x:%02x:%02x:%02x:%02x
\n
"
,
dev
->
name
,
olympic_priv
->
olympic_laa
[
0
],
olympic_priv
->
olympic_laa
[
1
],
olympic_priv
->
olympic_laa
[
2
],
olympic_priv
->
olympic_laa
[
3
],
olympic_priv
->
olympic_laa
[
4
],
olympic_priv
->
olympic_laa
[
5
])
;
goto
out
;
printk
(
KERN_WARNING
"%s: %s
\n
"
,
dev
->
name
,
open_error
);
free_irq
(
dev
->
irq
,
dev
)
;
return
-
EIO
;
}
/* if autosense && open_finished */
}
else
if
(
init_srb
[
2
]
==
0x32
)
{
printk
(
KERN_WARNING
"%s: Invalid LAA: %02x:%02x:%02x:%02x:%02x:%02x
\n
"
,
dev
->
name
,
olympic_priv
->
olympic_laa
[
0
],
olympic_priv
->
olympic_laa
[
1
],
olympic_priv
->
olympic_laa
[
2
],
olympic_priv
->
olympic_laa
[
3
],
olympic_priv
->
olympic_laa
[
4
],
olympic_priv
->
olympic_laa
[
5
])
;
free_irq
(
dev
->
irq
,
dev
)
;
return
-
EIO
;
}
else
{
printk
(
KERN_WARNING
"%s: Bad OPEN response: %x
\n
"
,
dev
->
name
,
init_srb
[
2
]);
free_irq
(
dev
->
irq
,
dev
);
return
-
EIO
;
}
}
else
open_finished
=
1
;
default:
printk
(
KERN_WARNING
"%s: Bad OPEN response: %x
\n
"
,
dev
->
name
,
resp
);
goto
out
;
}
}
while
(
!
(
open_finished
))
;
/* Will only loop if ring speed mismatch re-open attempted && autosense is on */
if
(
readb
(
init_srb
+
18
)
&
(
1
<<
3
))
...
...
@@ -634,8 +630,7 @@ static int olympic_open(struct net_device *dev)
if
(
i
==
0
)
{
printk
(
KERN_WARNING
"%s: Not enough memory to allocate rx buffers. Adapter disabled
\n
"
,
dev
->
name
);
free_irq
(
dev
->
irq
,
dev
);
return
-
EIO
;
goto
out
;
}
olympic_priv
->
rx_ring_dma_addr
=
pci_map_single
(
olympic_priv
->
pdev
,
olympic_priv
->
olympic_rx_ring
,
...
...
@@ -737,7 +732,10 @@ static int olympic_open(struct net_device *dev)
netif_start_queue
(
dev
);
return
0
;
out:
free_irq
(
dev
->
irq
,
dev
);
return
-
EIO
;
}
/*
...
...
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