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
6ffc67a8
Commit
6ffc67a8
authored
Jan 10, 2004
by
Jeff Garzik
Committed by
Stephen Hemminger
Jan 10, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[netdrvr tc35815] switch to using alloc_etherdev
Also handle ioremap failure.
parent
f87f47b4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
15 deletions
+24
-15
drivers/net/tc35815.c
drivers/net/tc35815.c
+24
-15
No files found.
drivers/net/tc35815.c
View file @
6ffc67a8
...
@@ -525,31 +525,32 @@ tc35815_probe(struct pci_dev *pdev,
...
@@ -525,31 +525,32 @@ tc35815_probe(struct pci_dev *pdev,
static
int
__devinit
tc35815_probe1
(
struct
pci_dev
*
pdev
,
unsigned
int
base_addr
,
unsigned
int
irq
)
static
int
__devinit
tc35815_probe1
(
struct
pci_dev
*
pdev
,
unsigned
int
base_addr
,
unsigned
int
irq
)
{
{
static
unsigned
version_printed
=
0
;
static
unsigned
version_printed
=
0
;
int
i
;
int
i
,
ret
;
struct
tc35815_local
*
lp
;
struct
tc35815_local
*
lp
;
struct
tc35815_regs
*
tr
;
struct
tc35815_regs
*
tr
;
struct
net_device
*
dev
;
struct
net_device
*
dev
;
/* Allocate a new 'dev' if needed. */
/* Allocate a new 'dev' if needed. */
dev
=
init_etherdev
(
NULL
,
sizeof
(
struct
tc35815_local
));
dev
=
alloc_etherdev
(
sizeof
(
struct
tc35815_local
));
if
(
dev
==
NULL
)
if
(
dev
==
NULL
)
return
-
ENOMEM
;
return
-
ENOMEM
;
/*
/*
*
init
_etherdev allocs and zeros dev->priv
*
alloc
_etherdev allocs and zeros dev->priv
*/
*/
lp
=
dev
->
priv
;
lp
=
dev
->
priv
;
if
(
tc35815_debug
&&
version_printed
++
==
0
)
if
(
tc35815_debug
&&
version_printed
++
==
0
)
printk
(
KERN_DEBUG
"%s"
,
version
);
printk
(
KERN_DEBUG
"%s"
,
version
);
printk
(
KERN_INFO
"%s: %s found at %#x, irq %d
\n
"
,
dev
->
name
,
cardname
,
base_addr
,
irq
);
/* Fill in the 'dev' fields. */
/* Fill in the 'dev' fields. */
dev
->
irq
=
irq
;
dev
->
irq
=
irq
;
dev
->
base_addr
=
(
unsigned
long
)
ioremap
(
base_addr
,
dev
->
base_addr
=
(
unsigned
long
)
ioremap
(
base_addr
,
sizeof
(
struct
tc35815_regs
));
sizeof
(
struct
tc35815_regs
));
if
(
!
dev
->
base_addr
)
{
ret
=
-
ENOMEM
;
goto
err_out
;
}
tr
=
(
struct
tc35815_regs
*
)
dev
->
base_addr
;
tr
=
(
struct
tc35815_regs
*
)
dev
->
base_addr
;
tc35815_chip_reset
(
dev
);
tc35815_chip_reset
(
dev
);
...
@@ -566,9 +567,6 @@ static int __devinit tc35815_probe1(struct pci_dev *pdev, unsigned int base_addr
...
@@ -566,9 +567,6 @@ static int __devinit tc35815_probe1(struct pci_dev *pdev, unsigned int base_addr
dev
->
dev_addr
[
i
]
=
data
&
0xff
;
dev
->
dev_addr
[
i
]
=
data
&
0xff
;
dev
->
dev_addr
[
i
+
1
]
=
data
>>
8
;
dev
->
dev_addr
[
i
+
1
]
=
data
>>
8
;
}
}
for
(
i
=
0
;
i
<
6
;
i
++
)
printk
(
" %2.2x"
,
dev
->
dev_addr
[
i
]);
printk
(
"
\n
"
);
/* Initialize the device structure. */
/* Initialize the device structure. */
lp
->
pdev
=
pdev
;
lp
->
pdev
=
pdev
;
...
@@ -590,8 +588,6 @@ static int __devinit tc35815_probe1(struct pci_dev *pdev, unsigned int base_addr
...
@@ -590,8 +588,6 @@ static int __devinit tc35815_probe1(struct pci_dev *pdev, unsigned int base_addr
/* do auto negotiation */
/* do auto negotiation */
tc35815_phy_chip_init
(
dev
);
tc35815_phy_chip_init
(
dev
);
printk
(
KERN_INFO
"%s: linkspeed %dMbps, %s Duplex
\n
"
,
dev
->
name
,
lp
->
linkspeed
,
lp
->
fullduplex
?
"Full"
:
"Half"
);
dev
->
open
=
tc35815_open
;
dev
->
open
=
tc35815_open
;
dev
->
stop
=
tc35815_close
;
dev
->
stop
=
tc35815_close
;
...
@@ -602,12 +598,25 @@ static int __devinit tc35815_probe1(struct pci_dev *pdev, unsigned int base_addr
...
@@ -602,12 +598,25 @@ static int __devinit tc35815_probe1(struct pci_dev *pdev, unsigned int base_addr
dev
->
set_multicast_list
=
tc35815_set_multicast_list
;
dev
->
set_multicast_list
=
tc35815_set_multicast_list
;
SET_MODULE_OWNER
(
dev
);
SET_MODULE_OWNER
(
dev
);
#if 0 /* XXX called in init_etherdev */
ret
=
register_netdev
(
dev
);
/* Fill in the fields of the device structure with ethernet values. */
if
(
ret
)
ether_setup(dev);
goto
err_out_iounmap
;
#endif
printk
(
KERN_INFO
"%s: %s found at %#x, irq %d, MAC"
,
dev
->
name
,
cardname
,
base_addr
,
irq
);
for
(
i
=
0
;
i
<
6
;
i
++
)
printk
(
" %2.2x"
,
dev
->
dev_addr
[
i
]);
printk
(
"
\n
"
);
printk
(
KERN_INFO
"%s: linkspeed %dMbps, %s Duplex
\n
"
,
dev
->
name
,
lp
->
linkspeed
,
lp
->
fullduplex
?
"Full"
:
"Half"
);
return
0
;
return
0
;
err_out_iounmap:
iounmap
((
void
*
)
dev
->
base_addr
);
err_out:
free_netdev
(
dev
);
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