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
d171187b
Commit
d171187b
authored
Jun 03, 2003
by
Alexander Viro
Committed by
David S. Miller
Jun 03, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET]: Move 3c509 driver away from init_etherdev().
parent
173a9b29
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
31 deletions
+66
-31
drivers/net/3c509.c
drivers/net/3c509.c
+66
-31
No files found.
drivers/net/3c509.c
View file @
d171187b
...
@@ -300,17 +300,11 @@ static int nopnp;
...
@@ -300,17 +300,11 @@ static int nopnp;
*
*
* Both call el3_common_init/el3_common_remove. */
* Both call el3_common_init/el3_common_remove. */
static
int
__init
el3_common_init
(
struct
net_device
*
dev
)
static
void
__init
el3_common_init
(
struct
net_device
*
dev
)
{
{
struct
el3_private
*
lp
=
dev
->
priv
;
struct
el3_private
*
lp
=
dev
->
priv
;
short
i
;
short
i
;
el3_cards
++
;
if
(
!
lp
->
dev
)
/* probed devices are not chained */
{
lp
->
next_dev
=
el3_root_dev
;
el3_root_dev
=
dev
;
}
spin_lock_init
(
&
lp
->
lock
);
spin_lock_init
(
&
lp
->
lock
);
if
(
dev
->
mem_start
&
0x05
)
{
/* xcvr codes 1/3/4/12 */
if
(
dev
->
mem_start
&
0x05
)
{
/* xcvr codes 1/3/4/12 */
...
@@ -343,8 +337,6 @@ static int __init el3_common_init (struct net_device *dev)
...
@@ -343,8 +337,6 @@ static int __init el3_common_init (struct net_device *dev)
dev
->
tx_timeout
=
el3_tx_timeout
;
dev
->
tx_timeout
=
el3_tx_timeout
;
dev
->
watchdog_timeo
=
TX_TIMEOUT
;
dev
->
watchdog_timeo
=
TX_TIMEOUT
;
dev
->
do_ioctl
=
netdev_ioctl
;
dev
->
do_ioctl
=
netdev_ioctl
;
return
0
;
}
}
static
void
el3_common_remove
(
struct
net_device
*
dev
)
static
void
el3_common_remove
(
struct
net_device
*
dev
)
...
@@ -374,6 +366,7 @@ static int __init el3_probe(int card_idx)
...
@@ -374,6 +366,7 @@ static int __init el3_probe(int card_idx)
int
ioaddr
,
irq
,
if_port
;
int
ioaddr
,
irq
,
if_port
;
u16
phys_addr
[
3
];
u16
phys_addr
[
3
];
static
int
current_tag
;
static
int
current_tag
;
int
err
=
-
ENODEV
;
#if defined(__ISAPNP__) && !defined(CONFIG_X86_PC9800)
#if defined(__ISAPNP__) && !defined(CONFIG_X86_PC9800)
static
int
pnp_cards
;
static
int
pnp_cards
;
struct
pnp_dev
*
idev
=
NULL
;
struct
pnp_dev
*
idev
=
NULL
;
...
@@ -413,7 +406,8 @@ static int __init el3_probe(int card_idx)
...
@@ -413,7 +406,8 @@ static int __init el3_probe(int card_idx)
phys_addr
[
j
]
=
phys_addr
[
j
]
=
htons
(
read_eeprom
(
ioaddr
,
j
));
htons
(
read_eeprom
(
ioaddr
,
j
));
if_port
=
read_eeprom
(
ioaddr
,
8
)
>>
14
;
if_port
=
read_eeprom
(
ioaddr
,
8
)
>>
14
;
if
(
!
(
dev
=
init_etherdev
(
NULL
,
sizeof
(
struct
el3_private
))))
{
dev
=
alloc_etherdev
(
sizeof
(
struct
el3_private
));
if
(
!
dev
)
{
release_region
(
ioaddr
,
EL3_IO_EXTENT
);
release_region
(
ioaddr
,
EL3_IO_EXTENT
);
pnp_device_detach
(
idev
);
pnp_device_detach
(
idev
);
return
-
ENOMEM
;
return
-
ENOMEM
;
...
@@ -421,6 +415,8 @@ static int __init el3_probe(int card_idx)
...
@@ -421,6 +415,8 @@ static int __init el3_probe(int card_idx)
SET_MODULE_OWNER
(
dev
);
SET_MODULE_OWNER
(
dev
);
pnp_cards
++
;
pnp_cards
++
;
netdev_boot_setup_check
(
dev
);
goto
found
;
goto
found
;
}
}
}
}
...
@@ -514,11 +510,14 @@ static int __init el3_probe(int card_idx)
...
@@ -514,11 +510,14 @@ static int __init el3_probe(int card_idx)
irq
=
13
;
irq
=
13
;
#endif
#endif
if
(
!
(
dev
=
init_etherdev
(
NULL
,
sizeof
(
struct
el3_private
))))
dev
=
alloc_etherdev
(
sizeof
(
struct
el3_private
));
if
(
!
dev
)
return
-
ENOMEM
;
return
-
ENOMEM
;
SET_MODULE_OWNER
(
dev
);
SET_MODULE_OWNER
(
dev
);
netdev_boot_setup_check
(
dev
);
/* Set passed-in IRQ or I/O Addr. */
/* Set passed-in IRQ or I/O Addr. */
if
(
dev
->
irq
>
1
&&
dev
->
irq
<
16
)
if
(
dev
->
irq
>
1
&&
dev
->
irq
<
16
)
irq
=
dev
->
irq
;
irq
=
dev
->
irq
;
...
@@ -527,15 +526,13 @@ static int __init el3_probe(int card_idx)
...
@@ -527,15 +526,13 @@ static int __init el3_probe(int card_idx)
if
(
dev
->
mem_end
==
0x3c509
/* Magic key */
if
(
dev
->
mem_end
==
0x3c509
/* Magic key */
&&
dev
->
base_addr
>=
0x200
&&
dev
->
base_addr
<=
0x3e0
)
&&
dev
->
base_addr
>=
0x200
&&
dev
->
base_addr
<=
0x3e0
)
ioaddr
=
dev
->
base_addr
&
0x3f0
;
ioaddr
=
dev
->
base_addr
&
0x3f0
;
else
if
(
dev
->
base_addr
!=
ioaddr
)
{
else
if
(
dev
->
base_addr
!=
ioaddr
)
unregister_netdev
(
dev
);
goto
out
;
return
-
ENODEV
;
}
}
}
if
(
!
request_region
(
ioaddr
,
EL3_IO_EXTENT
,
"3c509"
))
{
if
(
!
request_region
(
ioaddr
,
EL3_IO_EXTENT
,
"3c509"
))
{
unregister_netdev
(
dev
)
;
err
=
-
EBUSY
;
return
-
EBUSY
;
goto
out
;
}
}
/* Set the adaptor tag so that the next card can be found. */
/* Set the adaptor tag so that the next card can be found. */
...
@@ -549,11 +546,8 @@ static int __init el3_probe(int card_idx)
...
@@ -549,11 +546,8 @@ static int __init el3_probe(int card_idx)
#endif
#endif
EL3WINDOW
(
0
);
EL3WINDOW
(
0
);
if
(
inw
(
ioaddr
)
!=
0x6d50
)
{
if
(
inw
(
ioaddr
)
!=
0x6d50
)
unregister_netdev
(
dev
);
goto
out1
;
release_region
(
ioaddr
,
EL3_IO_EXTENT
);
return
-
ENODEV
;
}
/* Free the interrupt so that some other card can use it. */
/* Free the interrupt so that some other card can use it. */
outw
(
0x0f00
,
ioaddr
+
WN0_IRQ
);
outw
(
0x0f00
,
ioaddr
+
WN0_IRQ
);
...
@@ -570,6 +564,11 @@ static int __init el3_probe(int card_idx)
...
@@ -570,6 +564,11 @@ static int __init el3_probe(int card_idx)
#if defined(__ISAPNP__) && !defined(CONFIG_X86_PC9800)
#if defined(__ISAPNP__) && !defined(CONFIG_X86_PC9800)
lp
->
dev
=
&
idev
->
dev
;
lp
->
dev
=
&
idev
->
dev
;
#endif
#endif
el3_common_init
(
dev
);
err
=
register_netdev
(
dev
);
if
(
err
)
goto
out1
;
#ifdef CONFIG_PM
#ifdef CONFIG_PM
/* register power management */
/* register power management */
...
@@ -581,7 +580,22 @@ static int __init el3_probe(int card_idx)
...
@@ -581,7 +580,22 @@ static int __init el3_probe(int card_idx)
}
}
#endif
#endif
return
el3_common_init
(
dev
);
el3_cards
++
;
#if !defined(__ISAPNP__) || defined(CONFIG_X86_PC9800)
lp
->
next_dev
=
el3_root_dev
;
el3_root_dev
=
dev
;
#endif
return
0
;
out1:
release_region
(
ioaddr
,
EL3_IO_EXTENT
);
#if defined(__ISAPNP__) && !defined(CONFIG_X86_PC9800)
if
(
idev
)
pnp_device_detach
(
idev
);
#endif
out:
kfree
(
dev
);
return
err
;
}
}
#ifdef CONFIG_MCA
#ifdef CONFIG_MCA
...
@@ -602,6 +616,7 @@ static int __init el3_mca_probe(struct device *device) {
...
@@ -602,6 +616,7 @@ static int __init el3_mca_probe(struct device *device) {
u_char
pos4
,
pos5
;
u_char
pos4
,
pos5
;
struct
mca_device
*
mdev
=
to_mca_device
(
device
);
struct
mca_device
*
mdev
=
to_mca_device
(
device
);
int
slot
=
mdev
->
slot
;
int
slot
=
mdev
->
slot
;
int
err
;
pos4
=
mca_device_read_stored_pos
(
mdev
,
4
);
pos4
=
mca_device_read_stored_pos
(
mdev
,
4
);
pos5
=
mca_device_read_stored_pos
(
mdev
,
5
);
pos5
=
mca_device_read_stored_pos
(
mdev
,
5
);
...
@@ -630,13 +645,14 @@ static int __init el3_mca_probe(struct device *device) {
...
@@ -630,13 +645,14 @@ static int __init el3_mca_probe(struct device *device) {
phys_addr
[
i
]
=
htons
(
read_eeprom
(
ioaddr
,
i
));
phys_addr
[
i
]
=
htons
(
read_eeprom
(
ioaddr
,
i
));
}
}
dev
=
init_etherdev
(
NULL
,
sizeof
(
struct
el3_private
));
dev
=
alloc_etherdev
(
sizeof
(
struct
el3_private
));
if
(
dev
==
NULL
)
{
if
(
dev
==
NULL
)
{
release_region
(
ioaddr
,
EL3_IO_EXTENT
);
release_region
(
ioaddr
,
EL3_IO_EXTENT
);
return
-
ENOMEM
;
return
-
ENOMEM
;
}
}
SET_MODULE_OWNER
(
dev
);
SET_MODULE_OWNER
(
dev
);
netdev_boot_setup_check
(
dev
);
memcpy
(
dev
->
dev_addr
,
phys_addr
,
sizeof
(
phys_addr
));
memcpy
(
dev
->
dev_addr
,
phys_addr
,
sizeof
(
phys_addr
));
dev
->
base_addr
=
ioaddr
;
dev
->
base_addr
=
ioaddr
;
...
@@ -646,8 +662,16 @@ static int __init el3_mca_probe(struct device *device) {
...
@@ -646,8 +662,16 @@ static int __init el3_mca_probe(struct device *device) {
lp
->
dev
=
device
;
lp
->
dev
=
device
;
lp
->
type
=
EL3_MCA
;
lp
->
type
=
EL3_MCA
;
device
->
driver_data
=
dev
;
device
->
driver_data
=
dev
;
el3_common_init
(
dev
);
err
=
register_netdev
(
dev
);
if
(
err
)
{
release_region
(
ioaddr
,
EL3_IO_EXTENT
);
return
-
ENOMEM
;
}
return
el3_common_init
(
dev
);
el3_cards
++
;
return
0
;
}
}
#endif
/* CONFIG_MCA */
#endif
/* CONFIG_MCA */
...
@@ -661,6 +685,7 @@ static int __init el3_eisa_probe (struct device *device)
...
@@ -661,6 +685,7 @@ static int __init el3_eisa_probe (struct device *device)
u16
phys_addr
[
3
];
u16
phys_addr
[
3
];
struct
net_device
*
dev
=
NULL
;
struct
net_device
*
dev
=
NULL
;
struct
eisa_device
*
edev
;
struct
eisa_device
*
edev
;
int
err
;
/* Yeepee, The driver framework is calling us ! */
/* Yeepee, The driver framework is calling us ! */
edev
=
to_eisa_device
(
device
);
edev
=
to_eisa_device
(
device
);
...
@@ -680,7 +705,7 @@ static int __init el3_eisa_probe (struct device *device)
...
@@ -680,7 +705,7 @@ static int __init el3_eisa_probe (struct device *device)
/* Restore the "Product ID" to the EEPROM read register. */
/* Restore the "Product ID" to the EEPROM read register. */
read_eeprom
(
ioaddr
,
3
);
read_eeprom
(
ioaddr
,
3
);
dev
=
init_etherdev
(
NULL
,
sizeof
(
struct
el3_private
));
dev
=
alloc_etherdev
(
sizeof
(
struct
el3_private
));
if
(
dev
==
NULL
)
{
if
(
dev
==
NULL
)
{
release_region
(
ioaddr
,
EL3_IO_EXTENT
);
release_region
(
ioaddr
,
EL3_IO_EXTENT
);
return
-
ENOMEM
;
return
-
ENOMEM
;
...
@@ -688,6 +713,8 @@ static int __init el3_eisa_probe (struct device *device)
...
@@ -688,6 +713,8 @@ static int __init el3_eisa_probe (struct device *device)
SET_MODULE_OWNER
(
dev
);
SET_MODULE_OWNER
(
dev
);
netdev_boot_setup_check
(
dev
);
memcpy
(
dev
->
dev_addr
,
phys_addr
,
sizeof
(
phys_addr
));
memcpy
(
dev
->
dev_addr
,
phys_addr
,
sizeof
(
phys_addr
));
dev
->
base_addr
=
ioaddr
;
dev
->
base_addr
=
ioaddr
;
dev
->
irq
=
irq
;
dev
->
irq
=
irq
;
...
@@ -696,8 +723,16 @@ static int __init el3_eisa_probe (struct device *device)
...
@@ -696,8 +723,16 @@ static int __init el3_eisa_probe (struct device *device)
lp
->
dev
=
device
;
lp
->
dev
=
device
;
lp
->
type
=
EL3_EISA
;
lp
->
type
=
EL3_EISA
;
eisa_set_drvdata
(
edev
,
dev
);
eisa_set_drvdata
(
edev
,
dev
);
el3_common_init
(
dev
);
return
el3_common_init
(
dev
);
err
=
register_netdev
(
dev
);
if
(
err
)
{
release_region
(
ioaddr
,
EL3_IO_EXTENT
);
return
err
;
}
el3_cards
++
;
return
0
;
}
}
#endif
#endif
...
...
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