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
5a084b66
Commit
5a084b66
authored
Jan 10, 2004
by
Alexander Viro
Committed by
Stephen Hemminger
Jan 10, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[netdrvr ibmlana] ibmlana switched to sane allocation, leaks fixed
parent
a3e292a1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
56 deletions
+37
-56
drivers/net/ibmlana.c
drivers/net/ibmlana.c
+37
-53
drivers/net/ibmlana.h
drivers/net/ibmlana.h
+0
-3
No files found.
drivers/net/ibmlana.c
View file @
5a084b66
...
...
@@ -906,7 +906,7 @@ static void ibmlana_set_multicast_list(struct net_device *dev)
static
int
startslot
;
/* counts through slots when probing multiple devices */
int
ibmlana_probe
(
struct
net_device
*
dev
)
static
int
ibmlana_probe
(
struct
net_device
*
dev
)
{
int
force_detect
=
0
;
int
slot
,
z
;
...
...
@@ -924,34 +924,21 @@ int ibmlana_probe(struct net_device *dev)
if
(
dev
->
mem_start
==
1
)
force_detect
=
1
;
/* search through slots */
if
(
dev
!=
NULL
)
{
base
=
dev
->
mem_start
;
irq
=
dev
->
irq
;
}
slot
=
mca_find_adapter
(
IBM_LANA_ID
,
startslot
);
base
=
dev
->
mem_start
;
irq
=
dev
->
irq
;
while
(
slot
!=
-
1
)
{
for
(
slot
=
startslot
;
(
slot
=
mca_find_adapter
(
IBM_LANA_ID
,
slot
))
!=
-
1
;
slot
++
)
{
/* deduce card addresses */
getaddrs
(
slot
,
&
base
,
&
memlen
,
&
iobase
,
&
irq
,
&
medium
);
/* slot already in use ? */
if
(
mca_is_adapter_used
(
slot
))
{
slot
=
mca_find_adapter
(
IBM_LANA_ID
,
slot
+
1
);
if
(
mca_is_adapter_used
(
slot
))
continue
;
}
/* were we looking for something different ? */
if
(
dev
->
irq
!=
0
||
dev
->
mem_start
!=
0
)
{
if
(
dev
->
irq
!=
0
&&
dev
->
irq
!=
irq
)
{
slot
=
mca_find_adapter
(
IBM_LANA_ID
,
slot
+
1
);
continue
;
}
if
(
dev
->
mem_start
!=
0
&&
dev
->
mem_start
!=
base
)
{
slot
=
mca_find_adapter
(
IBM_LANA_ID
,
slot
+
1
);
continue
;
}
}
if
(
dev
->
irq
&&
dev
->
irq
!=
irq
)
continue
;
if
(
dev
->
mem_start
&&
dev
->
mem_start
!=
base
)
continue
;
/* found something that matches */
break
;
}
...
...
@@ -977,16 +964,11 @@ int ibmlana_probe(struct net_device *dev)
mca_mark_as_used
(
slot
);
/* allocate structure */
priv
=
dev
->
priv
=
(
ibmlana_priv
*
)
kmalloc
(
sizeof
(
ibmlana_priv
),
GFP_KERNEL
);
if
(
!
priv
)
{
release_region
(
iobase
,
IBM_LANA_IORANGE
);
return
-
ENOMEM
;
}
priv
=
dev
->
priv
;
priv
->
slot
=
slot
;
priv
->
realirq
=
irq
;
priv
->
medium
=
medium
;
spin_lock_init
(
&
priv
->
lock
);
memset
(
&
priv
->
stat
,
0
,
sizeof
(
struct
net_device_stats
));
/* set base + irq for this device (irq not allocated so far) */
...
...
@@ -1006,10 +988,6 @@ int ibmlana_probe(struct net_device *dev)
dev
->
set_multicast_list
=
ibmlana_set_multicast_list
;
dev
->
flags
|=
IFF_MULTICAST
;
/* generic setup */
ether_setup
(
dev
);
/* copy out MAC address */
for
(
z
=
0
;
z
<
sizeof
(
dev
->
dev_addr
);
z
++
)
...
...
@@ -1044,7 +1022,7 @@ int ibmlana_probe(struct net_device *dev)
#define DEVMAX 5
static
struct
net_device
moddevs
[
DEVMAX
];
static
struct
net_device
*
moddevs
[
DEVMAX
];
static
int
irq
;
static
int
io
;
...
...
@@ -1056,41 +1034,47 @@ MODULE_LICENSE("GPL");
int
init_module
(
void
)
{
int
z
,
res
;
int
z
;
startslot
=
0
;
for
(
z
=
0
;
z
<
DEVMAX
;
z
++
)
{
moddevs
[
z
].
init
=
ibmlana_probe
;
moddevs
[
z
].
irq
=
irq
;
moddevs
[
z
].
base_addr
=
io
;
res
=
register_netdev
(
moddevs
+
z
);
if
(
res
!=
0
)
return
(
z
>
0
)
?
0
:
-
EIO
;
struct
net_device
*
dev
=
alloc_etherdev
(
sizeof
(
ibmlana_priv
));
if
(
!
dev
)
break
;
dev
->
irq
=
irq
;
dev
->
base_addr
=
io
;
if
(
ibmlana_probe
(
dev
))
{
free_netdev
(
dev
);
break
;
}
if
(
register_netdev
(
dev
))
{
ibmlana_priv
*
priv
=
dev
->
priv
;
release_region
(
dev
->
base_addr
,
IBM_LANA_IORANGE
);
mca_mark_as_unused
(
priv
->
slot
);
mca_set_adapter_name
(
priv
->
slot
,
""
);
mca_set_adapter_procfn
(
priv
->
slot
,
NULL
,
NULL
);
free_netdev
(
dev
);
break
;
}
moddevs
[
z
]
=
dev
;
}
return
0
;
return
(
z
>
0
)
?
0
:
-
EIO
;
}
void
cleanup_module
(
void
)
{
struct
net_device
*
dev
;
ibmlana_priv
*
priv
;
int
z
;
for
(
z
=
0
;
z
<
DEVMAX
;
z
++
)
{
dev
=
moddevs
+
z
;
if
(
dev
->
priv
!=
NULL
)
{
priv
=
(
ibmlana_priv
*
)
dev
->
priv
;
struct
net_device
*
dev
=
moddevs
[
z
];
if
(
dev
)
{
ibmlana_priv
*
priv
=
(
ibmlana_priv
*
)
dev
->
priv
;
unregister_netdev
(
dev
);
/*DeinitBoard(dev); */
if
(
dev
->
irq
!=
0
)
free_irq
(
dev
->
irq
,
dev
);
dev
->
irq
=
0
;
release_region
(
dev
->
base_addr
,
IBM_LANA_IORANGE
);
unregister_netdev
(
dev
);
mca_mark_as_unused
(
priv
->
slot
);
mca_set_adapter_name
(
priv
->
slot
,
""
);
mca_set_adapter_procfn
(
priv
->
slot
,
NULL
,
NULL
);
kfree
(
dev
->
priv
);
dev
->
priv
=
NULL
;
free_netdev
(
dev
);
}
}
}
...
...
drivers/net/ibmlana.h
View file @
5a084b66
...
...
@@ -275,7 +275,4 @@ typedef struct {
#endif
/* _IBM_LANA_DRIVER_ */
extern
int
ibmlana_probe
(
struct
net_device
*
);
#endif
/* _IBM_LANA_INCLUDE_ */
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