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
06290b1b
Commit
06290b1b
authored
Jul 10, 2003
by
Stephen Hemminger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[netdrvr dgrs] convert to using alloc_etherdev
parent
263cd274
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
14 deletions
+13
-14
drivers/net/dgrs.c
drivers/net/dgrs.c
+13
-14
No files found.
drivers/net/dgrs.c
View file @
06290b1b
...
@@ -1252,18 +1252,12 @@ dgrs_found_device(
...
@@ -1252,18 +1252,12 @@ dgrs_found_device(
{
{
DGRS_PRIV
*
priv
;
DGRS_PRIV
*
priv
;
struct
net_device
*
dev
,
*
aux
;
struct
net_device
*
dev
,
*
aux
;
/* Allocate and fill new device structure. */
int
dev_size
=
sizeof
(
struct
net_device
)
+
sizeof
(
DGRS_PRIV
);
int
i
,
ret
;
int
i
,
ret
;
dev
=
(
struct
net_device
*
)
kmalloc
(
dev_size
,
GFP_KERNEL
);
dev
=
alloc_etherdev
(
sizeof
(
DGRS_PRIV
));
if
(
!
dev
)
if
(
!
dev
)
return
-
ENOMEM
;
return
-
ENOMEM
;
memset
(
dev
,
0
,
dev_size
);
dev
->
priv
=
((
void
*
)
dev
)
+
sizeof
(
struct
net_device
);
priv
=
(
DGRS_PRIV
*
)
dev
->
priv
;
priv
=
(
DGRS_PRIV
*
)
dev
->
priv
;
dev
->
base_addr
=
io
;
dev
->
base_addr
=
io
;
...
@@ -1279,7 +1273,7 @@ dgrs_found_device(
...
@@ -1279,7 +1273,7 @@ dgrs_found_device(
dev
->
init
=
dgrs_probe1
;
dev
->
init
=
dgrs_probe1
;
SET_MODULE_OWNER
(
dev
);
SET_MODULE_OWNER
(
dev
);
ether_setup
(
dev
);
if
(
register_netdev
(
dev
)
!=
0
)
{
if
(
register_netdev
(
dev
)
!=
0
)
{
kfree
(
dev
);
kfree
(
dev
);
return
-
EIO
;
return
-
EIO
;
...
@@ -1302,15 +1296,18 @@ dgrs_found_device(
...
@@ -1302,15 +1296,18 @@ dgrs_found_device(
struct
net_device
*
devN
;
struct
net_device
*
devN
;
DGRS_PRIV
*
privN
;
DGRS_PRIV
*
privN
;
/* Allocate new dev and priv structures */
/* Allocate new dev and priv structures */
devN
=
(
struct
net_device
*
)
kmalloc
(
dev_size
,
GFP_KERNEL
);
devN
=
alloc_etherdev
(
sizeof
(
DGRS_PRIV
));
/* Make it an exact copy of dev[0]... */
ret
=
-
ENOMEM
;
ret
=
-
ENOMEM
;
if
(
!
devN
)
if
(
!
devN
)
goto
fail
;
goto
fail
;
memcpy
(
devN
,
dev
,
dev_size
);
memset
(
devN
->
name
,
0
,
sizeof
(
devN
->
name
));
/* Make it an exact copy of dev[0]... */
devN
->
priv
=
((
void
*
)
devN
)
+
sizeof
(
struct
net_device
);
*
devN
=
*
dev
;
/* copy the priv structure of dev[0] */
privN
=
(
DGRS_PRIV
*
)
devN
->
priv
;
privN
=
(
DGRS_PRIV
*
)
devN
->
priv
;
*
privN
=
*
priv
;
/* ... and zero out VM areas */
/* ... and zero out VM areas */
privN
->
vmem
=
0
;
privN
->
vmem
=
0
;
privN
->
vplxdma
=
0
;
privN
->
vplxdma
=
0
;
...
@@ -1318,9 +1315,11 @@ dgrs_found_device(
...
@@ -1318,9 +1315,11 @@ dgrs_found_device(
devN
->
irq
=
0
;
devN
->
irq
=
0
;
/* ... and base MAC address off address of 1st port */
/* ... and base MAC address off address of 1st port */
devN
->
dev_addr
[
5
]
+=
i
;
devN
->
dev_addr
[
5
]
+=
i
;
/* ... choose a new name */
strncpy
(
devN
->
name
,
"eth%d"
,
IFNAMSIZ
);
devN
->
init
=
dgrs_initclone
;
devN
->
init
=
dgrs_initclone
;
SET_MODULE_OWNER
(
devN
);
SET_MODULE_OWNER
(
devN
);
ether_setup
(
devN
);
ret
=
-
EIO
;
ret
=
-
EIO
;
if
(
register_netdev
(
devN
))
{
if
(
register_netdev
(
devN
))
{
kfree
(
devN
);
kfree
(
devN
);
...
...
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