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
a46c30fd
Commit
a46c30fd
authored
Jun 23, 2006
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET] myri_sbus: Convert to new SBUS device layer.
Signed-off-by:
David S. Miller
<
davem@davemloft.net
>
parent
ecba38ab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
55 deletions
+61
-55
drivers/net/myri_sbus.c
drivers/net/myri_sbus.c
+61
-55
No files found.
drivers/net/myri_sbus.c
View file @
a46c30fd
/* myri_sbus.
h
: MyriCOM MyriNET SBUS card driver.
/* myri_sbus.
c
: MyriCOM MyriNET SBUS card driver.
*
* Copyright (C) 1996, 1999
David S. Miller (davem@redhat.com
)
* Copyright (C) 1996, 1999
, 2006 David S. Miller (davem@davemloft.net
)
*/
static
char
version
[]
=
"myri_sbus.c:v
1.9 12/Sep/99 David S. Miller (davem@redhat.com
)
\n
"
;
"myri_sbus.c:v
2.0 June 23, 2006 David S. Miller (davem@davemloft.net
)
\n
"
;
#include <linux/module.h>
#include <linux/config.h>
...
...
@@ -81,10 +81,6 @@ static char version[] =
#define DHDR(x)
#endif
#ifdef MODULE
static
struct
myri_eth
*
root_myri_dev
;
#endif
static
void
myri_reset_off
(
void
__iomem
*
lp
,
void
__iomem
*
cregs
)
{
/* Clear IRQ mask. */
...
...
@@ -896,8 +892,9 @@ static void dump_eeprom(struct myri_eth *mp)
}
#endif
static
int
__init
myri_ether_init
(
struct
sbus_dev
*
sdev
,
int
num
)
static
int
__init
myri_ether_init
(
struct
sbus_dev
*
sdev
)
{
static
int
num
;
static
unsigned
version_printed
;
struct
net_device
*
dev
;
struct
myri_eth
*
mp
;
...
...
@@ -913,6 +910,9 @@ static int __init myri_ether_init(struct sbus_dev *sdev, int num)
if
(
version_printed
++
==
0
)
printk
(
version
);
SET_MODULE_OWNER
(
dev
);
SET_NETDEV_DEV
(
dev
,
&
sdev
->
ofdev
.
dev
);
mp
=
(
struct
myri_eth
*
)
dev
->
priv
;
spin_lock_init
(
&
mp
->
irq_lock
);
mp
->
myri_sdev
=
sdev
;
...
...
@@ -1092,10 +1092,9 @@ static int __init myri_ether_init(struct sbus_dev *sdev, int num)
goto
err_free_irq
;
}
#ifdef MODULE
mp
->
next_module
=
root_myri_dev
;
root_myri_dev
=
mp
;
#endif
dev_set_drvdata
(
&
sdev
->
ofdev
.
dev
,
mp
);
num
++
;
printk
(
"%s: MyriCOM MyriNET Ethernet "
,
dev
->
name
);
...
...
@@ -1114,61 +1113,68 @@ static int __init myri_ether_init(struct sbus_dev *sdev, int num)
return
-
ENODEV
;
}
static
int
__init
myri_sbus_match
(
struct
sbus_dev
*
sdev
)
{
char
*
name
=
sdev
->
prom_name
;
if
(
!
strcmp
(
name
,
"MYRICOM,mlanai"
)
||
!
strcmp
(
name
,
"myri"
))
return
1
;
static
int
__devinit
myri_sbus_probe
(
struct
of_device
*
dev
,
const
struct
of_device_id
*
match
)
{
struct
sbus_dev
*
sdev
=
to_sbus_device
(
&
dev
->
dev
)
;
return
0
;
return
myri_ether_init
(
sdev
)
;
}
static
int
__
init
myri_sbus_probe
(
void
)
static
int
__
devexit
myri_sbus_remove
(
struct
of_device
*
dev
)
{
struct
sbus_bus
*
bus
;
struct
sbus_dev
*
sdev
=
NULL
;
static
int
called
;
int
cards
=
0
,
v
;
struct
myri_eth
*
mp
=
dev_get_drvdata
(
&
dev
->
dev
);
struct
net_device
*
net_dev
=
mp
->
dev
;
#ifdef MODULE
root_myri_dev
=
NULL
;
#endif
unregister_netdevice
(
net_dev
);
if
(
called
)
return
-
ENODEV
;
called
++
;
for_each_sbus
(
bus
)
{
for_each_sbusdev
(
sdev
,
bus
)
{
if
(
myri_sbus_match
(
sdev
))
{
cards
++
;
DET
((
"Found myricom myrinet as %s
\n
"
,
sdev
->
prom_name
));
if
((
v
=
myri_ether_init
(
sdev
,
(
cards
-
1
))))
return
v
;
}
}
free_irq
(
net_dev
->
irq
,
net_dev
);
if
(
mp
->
eeprom
.
cpuvers
<
CPUVERS_4_0
)
{
sbus_iounmap
(
mp
->
regs
,
mp
->
reg_size
);
}
else
{
sbus_iounmap
(
mp
->
cregs
,
PAGE_SIZE
);
sbus_iounmap
(
mp
->
lregs
,
(
256
*
1024
));
sbus_iounmap
(
mp
->
lanai
,
(
512
*
1024
));
}
if
(
!
cards
)
return
-
ENODEV
;
free_netdev
(
net_dev
);
dev_set_drvdata
(
&
dev
->
dev
,
NULL
);
return
0
;
}
static
void
__exit
myri_sbus_cleanup
(
void
)
static
struct
of_device_id
myri_sbus_match
[]
=
{
{
.
name
=
"MYRICOM,mlanai"
,
},
{
.
name
=
"myri"
,
},
{},
};
MODULE_DEVICE_TABLE
(
of
,
myri_sbus_match
);
static
struct
of_platform_driver
myri_sbus_driver
=
{
.
name
=
"myri"
,
.
match_table
=
myri_sbus_match
,
.
probe
=
myri_sbus_probe
,
.
remove
=
__devexit_p
(
myri_sbus_remove
),
};
static
int
__init
myri_sbus_init
(
void
)
{
return
of_register_driver
(
&
myri_sbus_driver
,
&
sbus_bus_type
);
}
static
void
__exit
myri_sbus_exit
(
void
)
{
#ifdef MODULE
while
(
root_myri_dev
)
{
struct
myri_eth
*
next
=
root_myri_dev
->
next_module
;
unregister_netdev
(
root_myri_dev
->
dev
);
/* this will also free the co-allocated 'root_myri_dev' */
free_netdev
(
root_myri_dev
->
dev
);
root_myri_dev
=
next
;
}
#endif
/* MODULE */
of_unregister_driver
(
&
myri_sbus_driver
);
}
module_init
(
myri_sbus_probe
);
module_exit
(
myri_sbus_cleanup
);
module_init
(
myri_sbus_init
);
module_exit
(
myri_sbus_exit
);
MODULE_LICENSE
(
"GPL"
);
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