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
[]
=
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/module.h>
#include <linux/config.h>
#include <linux/config.h>
...
@@ -81,10 +81,6 @@ static char version[] =
...
@@ -81,10 +81,6 @@ static char version[] =
#define DHDR(x)
#define DHDR(x)
#endif
#endif
#ifdef MODULE
static
struct
myri_eth
*
root_myri_dev
;
#endif
static
void
myri_reset_off
(
void
__iomem
*
lp
,
void
__iomem
*
cregs
)
static
void
myri_reset_off
(
void
__iomem
*
lp
,
void
__iomem
*
cregs
)
{
{
/* Clear IRQ mask. */
/* Clear IRQ mask. */
...
@@ -896,8 +892,9 @@ static void dump_eeprom(struct myri_eth *mp)
...
@@ -896,8 +892,9 @@ static void dump_eeprom(struct myri_eth *mp)
}
}
#endif
#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
;
static
unsigned
version_printed
;
struct
net_device
*
dev
;
struct
net_device
*
dev
;
struct
myri_eth
*
mp
;
struct
myri_eth
*
mp
;
...
@@ -913,6 +910,9 @@ static int __init myri_ether_init(struct sbus_dev *sdev, int num)
...
@@ -913,6 +910,9 @@ static int __init myri_ether_init(struct sbus_dev *sdev, int num)
if
(
version_printed
++
==
0
)
if
(
version_printed
++
==
0
)
printk
(
version
);
printk
(
version
);
SET_MODULE_OWNER
(
dev
);
SET_NETDEV_DEV
(
dev
,
&
sdev
->
ofdev
.
dev
);
mp
=
(
struct
myri_eth
*
)
dev
->
priv
;
mp
=
(
struct
myri_eth
*
)
dev
->
priv
;
spin_lock_init
(
&
mp
->
irq_lock
);
spin_lock_init
(
&
mp
->
irq_lock
);
mp
->
myri_sdev
=
sdev
;
mp
->
myri_sdev
=
sdev
;
...
@@ -1092,10 +1092,9 @@ static int __init myri_ether_init(struct sbus_dev *sdev, int num)
...
@@ -1092,10 +1092,9 @@ static int __init myri_ether_init(struct sbus_dev *sdev, int num)
goto
err_free_irq
;
goto
err_free_irq
;
}
}
#ifdef MODULE
dev_set_drvdata
(
&
sdev
->
ofdev
.
dev
,
mp
);
mp
->
next_module
=
root_myri_dev
;
root_myri_dev
=
mp
;
num
++
;
#endif
printk
(
"%s: MyriCOM MyriNET Ethernet "
,
dev
->
name
);
printk
(
"%s: MyriCOM MyriNET Ethernet "
,
dev
->
name
);
...
@@ -1114,61 +1113,68 @@ static int __init myri_ether_init(struct sbus_dev *sdev, int num)
...
@@ -1114,61 +1113,68 @@ static int __init myri_ether_init(struct sbus_dev *sdev, int num)
return
-
ENODEV
;
return
-
ENODEV
;
}
}
static
int
__init
myri_sbus_match
(
struct
sbus_dev
*
sdev
)
{
char
*
name
=
sdev
->
prom_name
;
if
(
!
strcmp
(
name
,
"MYRICOM,mlanai"
)
||
static
int
__devinit
myri_sbus_probe
(
struct
of_device
*
dev
,
const
struct
of_device_id
*
match
)
!
strcmp
(
name
,
"myri"
))
{
return
1
;
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
myri_eth
*
mp
=
dev_get_drvdata
(
&
dev
->
dev
);
struct
sbus_dev
*
sdev
=
NULL
;
struct
net_device
*
net_dev
=
mp
->
dev
;
static
int
called
;
int
cards
=
0
,
v
;
#ifdef MODULE
unregister_netdevice
(
net_dev
);
root_myri_dev
=
NULL
;
#endif
if
(
called
)
free_irq
(
net_dev
->
irq
,
net_dev
);
return
-
ENODEV
;
called
++
;
if
(
mp
->
eeprom
.
cpuvers
<
CPUVERS_4_0
)
{
sbus_iounmap
(
mp
->
regs
,
mp
->
reg_size
);
for_each_sbus
(
bus
)
{
}
else
{
for_each_sbusdev
(
sdev
,
bus
)
{
sbus_iounmap
(
mp
->
cregs
,
PAGE_SIZE
);
if
(
myri_sbus_match
(
sdev
))
{
sbus_iounmap
(
mp
->
lregs
,
(
256
*
1024
));
cards
++
;
sbus_iounmap
(
mp
->
lanai
,
(
512
*
1024
));
DET
((
"Found myricom myrinet as %s
\n
"
,
sdev
->
prom_name
));
if
((
v
=
myri_ether_init
(
sdev
,
(
cards
-
1
))))
return
v
;
}
}
}
}
if
(
!
cards
)
return
-
ENODEV
;
free_netdev
(
net_dev
);
dev_set_drvdata
(
&
dev
->
dev
,
NULL
);
return
0
;
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
of_unregister_driver
(
&
myri_sbus_driver
);
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 */
}
}
module_init
(
myri_sbus_probe
);
module_init
(
myri_sbus_init
);
module_exit
(
myri_sbus_cleanup
);
module_exit
(
myri_sbus_exit
);
MODULE_LICENSE
(
"GPL"
);
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