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
6857d83f
Commit
6857d83f
authored
Aug 05, 2003
by
Russell King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[netdrvr ARM] alloc_etherdev updates
parent
cd522168
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
58 deletions
+62
-58
drivers/net/arm/am79c961a.c
drivers/net/arm/am79c961a.c
+4
-3
drivers/net/arm/ether00.c
drivers/net/arm/ether00.c
+38
-43
drivers/net/arm/ether1.c
drivers/net/arm/ether1.c
+6
-3
drivers/net/arm/ether3.c
drivers/net/arm/ether3.c
+5
-2
drivers/net/arm/etherh.c
drivers/net/arm/etherh.c
+9
-7
No files found.
drivers/net/arm/am79c961a.c
View file @
6857d83f
...
@@ -657,7 +657,7 @@ static int __init am79c961_init(void)
...
@@ -657,7 +657,7 @@ static int __init am79c961_init(void)
struct
dev_priv
*
priv
;
struct
dev_priv
*
priv
;
int
i
,
ret
;
int
i
,
ret
;
dev
=
init_etherdev
(
NULL
,
sizeof
(
struct
dev_priv
));
dev
=
alloc_etherdev
(
sizeof
(
struct
dev_priv
));
ret
=
-
ENOMEM
;
ret
=
-
ENOMEM
;
if
(
!
dev
)
if
(
!
dev
)
goto
out
;
goto
out
;
...
@@ -715,12 +715,13 @@ static int __init am79c961_init(void)
...
@@ -715,12 +715,13 @@ static int __init am79c961_init(void)
dev
->
set_multicast_list
=
am79c961_setmulticastlist
;
dev
->
set_multicast_list
=
am79c961_setmulticastlist
;
dev
->
tx_timeout
=
am79c961_timeout
;
dev
->
tx_timeout
=
am79c961_timeout
;
return
0
;
ret
=
register_netdev
(
dev
);
if
(
ret
==
0
)
return
0
;
release:
release:
release_region
(
dev
->
base_addr
,
0x18
);
release_region
(
dev
->
base_addr
,
0x18
);
nodev:
nodev:
unregister_netdev
(
dev
);
kfree
(
dev
);
kfree
(
dev
);
out:
out:
return
ret
;
return
ret
;
...
...
drivers/net/arm/ether00.c
View file @
6857d83f
...
@@ -706,16 +706,6 @@ static int ether00_open(struct net_device* dev)
...
@@ -706,16 +706,6 @@ static int ether00_open(struct net_device* dev)
if
(
!
is_valid_ether_addr
(
dev
->
dev_addr
))
if
(
!
is_valid_ether_addr
(
dev
->
dev_addr
))
return
-
EINVAL
;
return
-
EINVAL
;
/* Allocate private memory */
dev
->
priv
=
kmalloc
(
sizeof
(
struct
net_priv
),
GFP_KERNEL
);
if
(
!
dev
->
priv
)
return
-
ENOMEM
;
memset
(
dev
->
priv
,
0
,
sizeof
(
struct
net_priv
));
priv
=
(
struct
net_priv
*
)
dev
->
priv
;
priv
->
tq_memupdate
.
routine
=
ether00_mem_update
;
priv
->
tq_memupdate
.
data
=
(
void
*
)
dev
;
spin_lock_init
(
&
priv
->
rx_lock
);
/* Install interrupt handlers */
/* Install interrupt handlers */
result
=
request_irq
(
dev
->
irq
,
ether00_int
,
0
,
"ether00"
,
dev
);
result
=
request_irq
(
dev
->
irq
,
ether00_int
,
0
,
"ether00"
,
dev
);
if
(
result
)
if
(
result
)
...
@@ -772,7 +762,6 @@ static int ether00_open(struct net_device* dev)
...
@@ -772,7 +762,6 @@ static int ether00_open(struct net_device* dev)
open_err2:
open_err2:
free_irq
(
dev
->
irq
,
dev
);
free_irq
(
dev
->
irq
,
dev
);
open_err1:
open_err1:
kfree
(
dev
->
priv
);
return
result
;
return
result
;
}
}
...
@@ -848,7 +837,6 @@ static int ether00_stop(struct net_device* dev)
...
@@ -848,7 +837,6 @@ static int ether00_stop(struct net_device* dev)
free_irq
(
dev
->
irq
,
dev
);
free_irq
(
dev
->
irq
,
dev
);
free_irq
(
2
,
dev
);
free_irq
(
2
,
dev
);
iounmap
(
priv
->
dma_data
);
iounmap
(
priv
->
dma_data
);
kfree
(
priv
);
return
0
;
return
0
;
}
}
...
@@ -901,23 +889,6 @@ static void ether00_get_ethernet_address(struct net_device* dev)
...
@@ -901,23 +889,6 @@ static void ether00_get_ethernet_address(struct net_device* dev)
}
}
static
int
ether00_init
(
struct
net_device
*
dev
)
{
ether_setup
(
dev
);
dev
->
open
=
ether00_open
;
dev
->
stop
=
ether00_stop
;
dev
->
set_multicast_list
=
ether00_set_multicast
;
dev
->
hard_start_xmit
=
ether00_tx
;
dev
->
get_stats
=
ether00_stats
;
ether00_get_ethernet_address
(
dev
);
SET_MODULE_OWNER
(
dev
);
return
0
;
}
/*
/*
* Keep a mapping of dev_info addresses -> port lines to use when
* Keep a mapping of dev_info addresses -> port lines to use when
* removing ports dev==NULL indicates unused entry
* removing ports dev==NULL indicates unused entry
...
@@ -929,13 +900,13 @@ static struct net_device* dev_list[ETH_NR];
...
@@ -929,13 +900,13 @@ static struct net_device* dev_list[ETH_NR];
static
int
ether00_add_device
(
struct
pldhs_dev_info
*
dev_info
,
void
*
dev_ps_data
)
static
int
ether00_add_device
(
struct
pldhs_dev_info
*
dev_info
,
void
*
dev_ps_data
)
{
{
struct
net_device
*
dev
;
struct
net_device
*
dev
;
struct
net_priv
*
priv
;
void
*
map_addr
;
void
*
map_addr
;
int
result
;
int
result
;
int
i
;
int
i
;
i
=
0
;
i
=
0
;
while
(
dev_list
[
i
])
while
(
dev_list
[
i
]
&&
i
<
ETH_NR
)
i
++
;
i
++
;
if
(
i
==
ETH_NR
){
if
(
i
==
ETH_NR
){
...
@@ -944,37 +915,61 @@ static int ether00_add_device(struct pldhs_dev_info* dev_info,void* dev_ps_data)
...
@@ -944,37 +915,61 @@ static int ether00_add_device(struct pldhs_dev_info* dev_info,void* dev_ps_data)
}
}
dev
=
kmalloc
(
sizeof
(
struct
net_device
),
GFP_KERNEL
);
if
(
!
request_mem_region
(
dev_info
->
base_addr
,
MAC_REG_SIZE
,
"ether00"
))
if
(
!
dev
){
return
-
EBUSY
;
return
-
ENOMEM
;
dev
=
alloc_etherdev
(
sizeof
(
struct
net_priv
));
if
(
!
dev
)
{
result
=
-
ENOMEM
;
goto
out_release
;
}
}
memset
(
dev
,
0
,
sizeof
(
struct
net_device
));
memset
(
dev
,
0
,
sizeof
(
struct
net_device
));
memset
(
dev
->
priv
,
0
,
sizeof
(
struct
net_priv
));
priv
=
dev
->
priv
;
priv
->
tq_memupdate
.
routine
=
ether00_mem_update
;
priv
->
tq_memupdate
.
data
=
(
void
*
)
dev
;
spin_lock_init
(
&
priv
->
rx_lock
);
map_addr
=
ioremap_nocache
(
dev_info
->
base_addr
,
SZ_4K
);
map_addr
=
ioremap_nocache
(
dev_info
->
base_addr
,
SZ_4K
);
if
(
!
map_addr
){
if
(
!
map_addr
){
return
-
ENOMEM
;
result
=
-
ENOMEM
;
out_kfree
;
}
}
dev
->
init
=
ether00_init
;
dev
->
open
=
ether00_open
;
strcpy
(
dev
->
name
,
"eth%d"
);
dev
->
stop
=
ether00_stop
;
dev
->
set_multicast_list
=
ether00_set_multicast
;
dev
->
hard_start_xmit
=
ether00_tx
;
dev
->
get_stats
=
ether00_stats
;
ether00_get_ethernet_address
(
dev
);
SET_MODULE_OWNER
(
dev
);
dev
->
base_addr
=
(
unsigned
int
)
map_addr
;
dev
->
base_addr
=
(
unsigned
int
)
map_addr
;
dev
->
irq
=
dev_info
->
irq
;
dev
->
irq
=
dev_info
->
irq
;
dev
->
features
=
NETIF_F_DYNALLOC
|
NETIF_F_HW_CSUM
;
dev
->
features
=
NETIF_F_DYNALLOC
|
NETIF_F_HW_CSUM
;
if
(
check_mem_region
((
unsigned
int
)
map_addr
,
MAC_REG_SIZE
)){
return
-
EBUSY
;
}
request_mem_region
((
unsigned
int
)
map_addr
,
MAC_REG_SIZE
,
"ether00"
);
result
=
register_netdev
(
dev
);
result
=
register_netdev
(
dev
);
if
(
result
){
if
(
result
){
printk
(
"Ether00: Error %i registering driver
\n
"
,
result
);
printk
(
"Ether00: Error %i registering driver
\n
"
,
result
);
return
result
;
goto
out_unmap
;
}
}
printk
(
"registered ether00 device at %#x
\n
"
,
dev_info
->
base_addr
);
printk
(
"registered ether00 device at %#x
\n
"
,
dev_info
->
base_addr
);
dev_list
[
i
]
=
dev
;
dev_list
[
i
]
=
dev
;
return
result
;
return
result
;
out_unmap:
iounmap
(
map_addr
);
out_kfree:
kfree
(
dev
);
out_release:
release_mem_region
(
dev_info
->
base_addr
,
MAC_REG_SIZE
);
return
result
;
}
}
...
...
drivers/net/arm/ether1.c
View file @
6857d83f
...
@@ -722,7 +722,7 @@ ether1_sendpacket (struct sk_buff *skb, struct net_device *dev)
...
@@ -722,7 +722,7 @@ ether1_sendpacket (struct sk_buff *skb, struct net_device *dev)
tx
.
tx_command
=
CMD_TX
|
CMD_INTR
;
tx
.
tx_command
=
CMD_TX
|
CMD_INTR
;
tx
.
tx_link
=
nopaddr
;
tx
.
tx_link
=
nopaddr
;
tx
.
tx_tbdoffset
=
tbdaddr
;
tx
.
tx_tbdoffset
=
tbdaddr
;
tbd
.
tbd_opts
=
TBD_EOL
|
len
;
tbd
.
tbd_opts
=
TBD_EOL
|
skb
->
len
;
tbd
.
tbd_link
=
I82586_NULL
;
tbd
.
tbd_link
=
I82586_NULL
;
tbd
.
tbd_bufl
=
dataddr
;
tbd
.
tbd_bufl
=
dataddr
;
tbd
.
tbd_bufh
=
0
;
tbd
.
tbd_bufh
=
0
;
...
@@ -1013,7 +1013,7 @@ ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
...
@@ -1013,7 +1013,7 @@ ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
ether1_banner
();
ether1_banner
();
dev
=
init_etherdev
(
NULL
,
sizeof
(
struct
ether1_priv
));
dev
=
alloc_etherdev
(
sizeof
(
struct
ether1_priv
));
if
(
!
dev
)
{
if
(
!
dev
)
{
ret
=
-
ENOMEM
;
ret
=
-
ENOMEM
;
goto
out
;
goto
out
;
...
@@ -1057,13 +1057,16 @@ ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
...
@@ -1057,13 +1057,16 @@ ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
dev
->
tx_timeout
=
ether1_timeout
;
dev
->
tx_timeout
=
ether1_timeout
;
dev
->
watchdog_timeo
=
5
*
HZ
/
100
;
dev
->
watchdog_timeo
=
5
*
HZ
/
100
;
ret
=
register_netdev
(
dev
);
if
(
ret
)
goto
release
;
ecard_set_drvdata
(
ec
,
dev
);
ecard_set_drvdata
(
ec
,
dev
);
return
0
;
return
0
;
release:
release:
release_region
(
dev
->
base_addr
,
16
);
release_region
(
dev
->
base_addr
,
16
);
release_region
(
dev
->
base_addr
+
0x800
,
4096
);
release_region
(
dev
->
base_addr
+
0x800
,
4096
);
unregister_netdev
(
dev
);
kfree
(
dev
);
kfree
(
dev
);
out:
out:
return
ret
;
return
ret
;
...
...
drivers/net/arm/ether3.c
View file @
6857d83f
...
@@ -822,7 +822,7 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
...
@@ -822,7 +822,7 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
ether3_banner
();
ether3_banner
();
dev
=
init_etherdev
(
NULL
,
sizeof
(
struct
dev_priv
));
dev
=
alloc_etherdev
(
sizeof
(
struct
dev_priv
));
if
(
!
dev
)
{
if
(
!
dev
)
{
ret
=
-
ENOMEM
;
ret
=
-
ENOMEM
;
goto
out
;
goto
out
;
...
@@ -898,13 +898,16 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
...
@@ -898,13 +898,16 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
dev
->
tx_timeout
=
ether3_timeout
;
dev
->
tx_timeout
=
ether3_timeout
;
dev
->
watchdog_timeo
=
5
*
HZ
/
100
;
dev
->
watchdog_timeo
=
5
*
HZ
/
100
;
ret
=
register_netdev
(
dev
);
if
(
ret
)
goto
failed
;
ecard_set_drvdata
(
ec
,
dev
);
ecard_set_drvdata
(
ec
,
dev
);
return
0
;
return
0
;
failed:
failed:
release_region
(
dev
->
base_addr
,
128
);
release_region
(
dev
->
base_addr
,
128
);
free:
free:
unregister_netdev
(
dev
);
kfree
(
dev
);
kfree
(
dev
);
out:
out:
return
ret
;
return
ret
;
...
...
drivers/net/arm/etherh.c
View file @
6857d83f
...
@@ -551,14 +551,14 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id)
...
@@ -551,14 +551,14 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id)
etherh_banner
();
etherh_banner
();
dev
=
init_etherdev
(
NULL
,
sizeof
(
struct
etherh_priv
));
dev
=
alloc_etherdev
(
sizeof
(
struct
etherh_priv
));
if
(
!
dev
)
{
if
(
!
dev
)
{
ret
=
-
ENOMEM
;
ret
=
-
ENOMEM
;
goto
out
;
goto
out
;
}
}
/*
/*
*
init
_etherdev allocs and zeros dev->priv
*
alloc
_etherdev allocs and zeros dev->priv
*/
*/
eh
=
dev
->
priv
;
eh
=
dev
->
priv
;
...
@@ -694,17 +694,19 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id)
...
@@ -694,17 +694,19 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id)
etherh_reset
(
dev
);
etherh_reset
(
dev
);
NS8390_init
(
dev
,
0
);
NS8390_init
(
dev
,
0
);
ret
=
register_netdev
(
dev
);
if
(
ret
)
goto
release
;
ecard_set_drvdata
(
ec
,
dev
);
ecard_set_drvdata
(
ec
,
dev
);
return
0
;
return
0
;
release:
release:
release_region
(
dev
->
base_addr
,
16
);
release_region
(
dev
->
base_addr
,
16
);
free:
free:
unregister_netdev
(
dev
);
kfree
(
dev
->
priv
);
kfree
(
dev
);
kfree
(
dev
);
out:
out:
return
ret
;
return
ret
;
}
}
...
...
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