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
fe12455c
Commit
fe12455c
authored
Mar 02, 2005
by
Russell King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ARM] Use ecard_{request,release}_resources() for resource management
Signed-off-by:
Russell King
<
rmk@arm.linux.org.uk
>
parent
7af60616
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
36 deletions
+27
-36
drivers/net/arm/ether1.c
drivers/net/arm/ether1.c
+13
-18
drivers/net/arm/ether3.c
drivers/net/arm/ether3.c
+14
-18
No files found.
drivers/net/arm/ether1.c
View file @
fe12455c
...
@@ -997,15 +997,18 @@ static int __devinit
...
@@ -997,15 +997,18 @@ static int __devinit
ether1_probe
(
struct
expansion_card
*
ec
,
const
struct
ecard_id
*
id
)
ether1_probe
(
struct
expansion_card
*
ec
,
const
struct
ecard_id
*
id
)
{
{
struct
net_device
*
dev
;
struct
net_device
*
dev
;
struct
ether1_priv
*
priv
;
int
i
,
ret
=
0
;
int
i
,
ret
=
0
;
ether1_banner
();
ether1_banner
();
ret
=
ecard_request_resources
(
ec
);
if
(
ret
)
goto
out
;
dev
=
alloc_etherdev
(
sizeof
(
struct
ether1_priv
));
dev
=
alloc_etherdev
(
sizeof
(
struct
ether1_priv
));
if
(
!
dev
)
{
if
(
!
dev
)
{
ret
=
-
ENOMEM
;
ret
=
-
ENOMEM
;
goto
out
;
goto
release
;
}
}
SET_MODULE_OWNER
(
dev
);
SET_MODULE_OWNER
(
dev
);
...
@@ -1013,15 +1016,9 @@ ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
...
@@ -1013,15 +1016,9 @@ ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
dev
->
base_addr
=
ecard_address
(
ec
,
ECARD_IOC
,
ECARD_FAST
);
dev
->
base_addr
=
ecard_address
(
ec
,
ECARD_IOC
,
ECARD_FAST
);
dev
->
irq
=
ec
->
irq
;
dev
->
irq
=
ec
->
irq
;
/*
* these will not fail - the nature of the bus ensures this
*/
request_region
(
dev
->
base_addr
,
16
,
dev
->
name
);
request_region
(
dev
->
base_addr
+
0x800
,
4096
,
dev
->
name
);
if
((
priv
(
dev
)
->
bus_type
=
ether1_reset
(
dev
))
==
0
)
{
if
((
priv
(
dev
)
->
bus_type
=
ether1_reset
(
dev
))
==
0
)
{
ret
=
-
ENODEV
;
ret
=
-
ENODEV
;
goto
releas
e
;
goto
fre
e
;
}
}
for
(
i
=
0
;
i
<
6
;
i
++
)
for
(
i
=
0
;
i
<
6
;
i
++
)
...
@@ -1029,7 +1026,7 @@ ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
...
@@ -1029,7 +1026,7 @@ ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
if
(
ether1_init_2
(
dev
))
{
if
(
ether1_init_2
(
dev
))
{
ret
=
-
ENODEV
;
ret
=
-
ENODEV
;
goto
releas
e
;
goto
fre
e
;
}
}
dev
->
open
=
ether1_open
;
dev
->
open
=
ether1_open
;
...
@@ -1042,7 +1039,7 @@ ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
...
@@ -1042,7 +1039,7 @@ ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
ret
=
register_netdev
(
dev
);
ret
=
register_netdev
(
dev
);
if
(
ret
)
if
(
ret
)
goto
releas
e
;
goto
fre
e
;
printk
(
KERN_INFO
"%s: ether1 in slot %d, "
,
printk
(
KERN_INFO
"%s: ether1 in slot %d, "
,
dev
->
name
,
ec
->
slot_no
);
dev
->
name
,
ec
->
slot_no
);
...
@@ -1053,11 +1050,11 @@ ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
...
@@ -1053,11 +1050,11 @@ ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
ecard_set_drvdata
(
ec
,
dev
);
ecard_set_drvdata
(
ec
,
dev
);
return
0
;
return
0
;
release:
free:
release_region
(
dev
->
base_addr
,
16
);
release_region
(
dev
->
base_addr
+
0x800
,
4096
);
free_netdev
(
dev
);
free_netdev
(
dev
);
out:
release:
ecard_release_resources
(
ec
);
out:
return
ret
;
return
ret
;
}
}
...
@@ -1068,10 +1065,8 @@ static void __devexit ether1_remove(struct expansion_card *ec)
...
@@ -1068,10 +1065,8 @@ static void __devexit ether1_remove(struct expansion_card *ec)
ecard_set_drvdata
(
ec
,
NULL
);
ecard_set_drvdata
(
ec
,
NULL
);
unregister_netdev
(
dev
);
unregister_netdev
(
dev
);
release_region
(
dev
->
base_addr
,
16
);
release_region
(
dev
->
base_addr
+
0x800
,
4096
);
free_netdev
(
dev
);
free_netdev
(
dev
);
ecard_release_resources
(
ec
);
}
}
static
const
struct
ecard_id
ether1_ids
[]
=
{
static
const
struct
ecard_id
ether1_ids
[]
=
{
...
...
drivers/net/arm/ether3.c
View file @
fe12455c
...
@@ -804,10 +804,14 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
...
@@ -804,10 +804,14 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
ether3_banner
();
ether3_banner
();
ret
=
ecard_request_resources
(
ec
);
if
(
ret
)
goto
out
;
dev
=
alloc_etherdev
(
sizeof
(
struct
dev_priv
));
dev
=
alloc_etherdev
(
sizeof
(
struct
dev_priv
));
if
(
!
dev
)
{
if
(
!
dev
)
{
ret
=
-
ENOMEM
;
ret
=
-
ENOMEM
;
goto
out
;
goto
release
;
}
}
SET_MODULE_OWNER
(
dev
);
SET_MODULE_OWNER
(
dev
);
...
@@ -818,14 +822,6 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
...
@@ -818,14 +822,6 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
goto
free
;
goto
free
;
}
}
/*
* this will not fail - the nature of the bus ensures this
*/
if
(
!
request_region
(
dev
->
base_addr
,
128
,
dev
->
name
))
{
ret
=
-
EBUSY
;
goto
free
;
}
init_timer
(
&
priv
(
dev
)
->
timer
);
init_timer
(
&
priv
(
dev
)
->
timer
);
/* Reset card...
/* Reset card...
...
@@ -850,13 +846,13 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
...
@@ -850,13 +846,13 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
case
BUS_UNKNOWN
:
case
BUS_UNKNOWN
:
printk
(
KERN_ERR
"%s: unable to identify bus width
\n
"
,
dev
->
name
);
printk
(
KERN_ERR
"%s: unable to identify bus width
\n
"
,
dev
->
name
);
ret
=
-
ENODEV
;
ret
=
-
ENODEV
;
goto
f
ailed
;
goto
f
ree
;
case
BUS_8
:
case
BUS_8
:
printk
(
KERN_ERR
"%s: %s found, but is an unsupported "
printk
(
KERN_ERR
"%s: %s found, but is an unsupported "
"8-bit card
\n
"
,
dev
->
name
,
name
);
"8-bit card
\n
"
,
dev
->
name
,
name
);
ret
=
-
ENODEV
;
ret
=
-
ENODEV
;
goto
f
ailed
;
goto
f
ree
;
default:
default:
break
;
break
;
...
@@ -864,7 +860,7 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
...
@@ -864,7 +860,7 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
if
(
ether3_init_2
(
dev
))
{
if
(
ether3_init_2
(
dev
))
{
ret
=
-
ENODEV
;
ret
=
-
ENODEV
;
goto
f
ailed
;
goto
f
ree
;
}
}
dev
->
open
=
ether3_open
;
dev
->
open
=
ether3_open
;
...
@@ -877,7 +873,7 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
...
@@ -877,7 +873,7 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
ret
=
register_netdev
(
dev
);
ret
=
register_netdev
(
dev
);
if
(
ret
)
if
(
ret
)
goto
f
ailed
;
goto
f
ree
;
printk
(
"%s: %s in slot %d, "
,
dev
->
name
,
name
,
ec
->
slot_no
);
printk
(
"%s: %s in slot %d, "
,
dev
->
name
,
name
,
ec
->
slot_no
);
for
(
i
=
0
;
i
<
6
;
i
++
)
for
(
i
=
0
;
i
<
6
;
i
++
)
...
@@ -886,11 +882,11 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
...
@@ -886,11 +882,11 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
ecard_set_drvdata
(
ec
,
dev
);
ecard_set_drvdata
(
ec
,
dev
);
return
0
;
return
0
;
failed:
free:
release_region
(
dev
->
base_addr
,
128
);
free:
free_netdev
(
dev
);
free_netdev
(
dev
);
out:
release:
ecard_release_resources
(
ec
);
out:
return
ret
;
return
ret
;
}
}
...
@@ -901,8 +897,8 @@ static void __devexit ether3_remove(struct expansion_card *ec)
...
@@ -901,8 +897,8 @@ static void __devexit ether3_remove(struct expansion_card *ec)
ecard_set_drvdata
(
ec
,
NULL
);
ecard_set_drvdata
(
ec
,
NULL
);
unregister_netdev
(
dev
);
unregister_netdev
(
dev
);
release_region
(
dev
->
base_addr
,
128
);
free_netdev
(
dev
);
free_netdev
(
dev
);
ecard_release_resources
(
ec
);
}
}
static
const
struct
ecard_id
ether3_ids
[]
=
{
static
const
struct
ecard_id
ether3_ids
[]
=
{
...
...
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