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
bea71ef2
Commit
bea71ef2
authored
Jun 02, 2003
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET]: Eliminate {init,register,unregister}_trdev().
parent
b87d5d4d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
115 deletions
+40
-115
drivers/net/net_init.c
drivers/net/net_init.c
+0
-46
drivers/net/pcmcia/ibmtr_cs.c
drivers/net/pcmcia/ibmtr_cs.c
+18
-20
drivers/net/tokenring/ibmtr.c
drivers/net/tokenring/ibmtr.c
+22
-46
include/linux/trdevice.h
include/linux/trdevice.h
+0
-3
No files found.
drivers/net/net_init.c
View file @
bea71ef2
...
...
@@ -178,17 +178,6 @@ static struct net_device *init_netdev(struct net_device *dev, int sizeof_priv,
return
dev
;
}
#if defined(CONFIG_HIPPI) || defined(CONFIG_TR) || defined(CONFIG_NET_FC)
static
int
__register_netdev
(
struct
net_device
*
dev
)
{
if
(
dev
->
init
&&
dev
->
init
(
dev
)
!=
0
)
{
unregister_netdev
(
dev
);
return
-
EIO
;
}
return
0
;
}
#endif
/**
* init_etherdev - Register ethernet device
* @dev: An ethernet device structure to be filled in, or %NULL if a new
...
...
@@ -535,28 +524,6 @@ void tr_setup(struct net_device *dev)
dev
->
flags
=
IFF_BROADCAST
|
IFF_MULTICAST
;
}
/**
* init_trdev - Register token ring device
* @dev: A token ring device structure to be filled in, or %NULL if a new
* struct should be allocated.
* @sizeof_priv: Size of additional driver-private structure to be allocated
* for this ethernet device
*
* Fill in the fields of the device structure with token ring-generic values.
*
* If no device structure is passed, a new one is constructed, complete with
* a private data area of size @sizeof_priv. A 32-byte (not bit)
* alignment is enforced for this private data area.
*
* If an empty string area is passed as dev->name, or a new structure is made,
* a new name string is constructed.
*/
struct
net_device
*
init_trdev
(
struct
net_device
*
dev
,
int
sizeof_priv
)
{
return
init_netdev
(
dev
,
sizeof_priv
,
"tr%d"
,
tr_setup
);
}
/**
* alloc_trdev - Register token ring device
* @sizeof_priv: Size of additional driver-private structure to be allocated
...
...
@@ -574,21 +541,8 @@ struct net_device *alloc_trdev(int sizeof_priv)
return
alloc_netdev
(
sizeof_priv
,
"tr%d"
,
tr_setup
);
}
int
register_trdev
(
struct
net_device
*
dev
)
{
return
__register_netdev
(
dev
);
}
void
unregister_trdev
(
struct
net_device
*
dev
)
{
unregister_netdev
(
dev
);
}
EXPORT_SYMBOL
(
tr_setup
);
EXPORT_SYMBOL
(
init_trdev
);
EXPORT_SYMBOL
(
alloc_trdev
);
EXPORT_SYMBOL
(
register_trdev
);
EXPORT_SYMBOL
(
unregister_trdev
);
#endif
/* CONFIG_TR */
...
...
drivers/net/pcmcia/ibmtr_cs.c
View file @
bea71ef2
...
...
@@ -208,10 +208,13 @@ static dev_link_t *ibmtr_attach(void)
flush_stale_links
();
/* Create new token-ring device */
info
=
kmalloc
(
sizeof
(
*
info
),
GFP_KERNEL
);
if
(
!
info
)
return
NULL
;
memset
(
info
,
0
,
sizeof
(
*
info
));
link
=
&
info
->
link
;
link
->
priv
=
info
;
dev
=
alloc_trdev
(
sizeof
(
*
info
));
if
(
!
dev
)
return
NULL
;
info
=
dev
->
priv
;
link
=
&
info
->
link
;
link
->
priv
=
info
;
init_timer
(
&
link
->
release
);
link
->
release
.
function
=
&
ibmtr_release
;
...
...
@@ -232,12 +235,6 @@ static dev_link_t *ibmtr_attach(void)
link
->
conf
.
IntType
=
INT_MEMORY_AND_IO
;
link
->
conf
.
Present
=
PRESENT_OPTION
;
dev
=
init_trdev
(
NULL
,
0
);
if
(
dev
==
NULL
)
{
ibmtr_detach
(
link
);
return
NULL
;
}
dev
->
priv
=
&
info
->
ti
;
link
->
irq
.
Instance
=
info
->
dev
=
dev
;
dev
->
init
=
&
ibmtr_probe
;
...
...
@@ -258,11 +255,16 @@ static dev_link_t *ibmtr_attach(void)
ret
=
CardServices
(
RegisterClient
,
&
link
->
handle
,
&
client_reg
);
if
(
ret
!=
0
)
{
cs_error
(
link
->
handle
,
RegisterClient
,
ret
);
ibmtr_detach
(
link
);
return
NULL
;
goto
out_detach
;
}
out:
return
link
;
out_detach:
ibmtr_detach
(
link
);
link
=
NULL
;
goto
out
;
}
/* ibmtr_attach */
/*======================================================================
...
...
@@ -307,12 +309,8 @@ static void ibmtr_detach(dev_link_t *link)
/* Unlink device structure, free bits */
*
linkp
=
link
->
next
;
if
(
info
->
dev
)
{
unregister_trdev
(
info
->
dev
);
kfree
(
info
->
dev
);
}
kfree
(
info
);
unregister_netdev
(
dev
);
kfree
(
dev
);
}
/* ibmtr_detach */
/*======================================================================
...
...
@@ -413,10 +411,10 @@ static void ibmtr_config(dev_link_t *link)
Adapters Technical Reference" SC30-3585 for this info. */
ibmtr_hw_setup
(
dev
,
mmiobase
);
i
=
register_
tr
dev
(
dev
);
i
=
register_
net
dev
(
dev
);
if
(
i
!=
0
)
{
printk
(
KERN_NOTICE
"ibmtr_cs: register_
tr
dev() failed
\n
"
);
printk
(
KERN_NOTICE
"ibmtr_cs: register_
net
dev() failed
\n
"
);
goto
failed
;
}
...
...
drivers/net/tokenring/ibmtr.c
View file @
bea71ef2
...
...
@@ -110,7 +110,6 @@ in the event that chatty debug messages are desired - jjs 12/30/98 */
#include <linux/module.h>
#ifdef PCMCIA
#undef MODULE
#undef ENABLE_PAGING
#else
#define ENABLE_PAGING 1
...
...
@@ -352,7 +351,7 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr)
unsigned
char
segment
,
intr
=
0
,
irq
=
0
,
i
,
j
,
cardpresent
=
NOTOK
,
temp
=
0
;
void
*
t_mmio
=
0
;
struct
tok_info
*
ti
=
0
;
struct
tok_info
*
ti
=
dev
->
priv
;
void
*
cd_chanid
;
unsigned
char
*
tchanid
,
ctemp
;
#ifndef PCMCIA
...
...
@@ -361,14 +360,6 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr)
static
int
version_printed
;
#endif
#ifndef MODULE
#ifndef PCMCIA
dev
=
init_trdev
(
dev
,
0
);
if
(
!
dev
)
return
-
ENOMEM
;
#endif
#endif
/* Query the adapter PIO base port which will return
* indication of where MMIO was placed. We also have a
* coded interrupt number.
...
...
@@ -404,7 +395,6 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr)
*/
#ifdef PCMCIA
iounmap
(
t_mmio
);
ti
=
dev
->
priv
;
/*BMS moved up here */
t_mmio
=
(
void
*
)
ti
->
mmio
;
/*BMS to get virtual address */
irq
=
ti
->
irq
;
/*BMS to display the irq! */
#endif
...
...
@@ -454,30 +444,20 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr)
DPRINTK
(
"Expected for MCA: "
);
PrtChanID
(
mcchannelid
,
1
);
}
/* Now,
allocate
some of the pl0 buffers for this driver.. */
/* Now,
setup
some of the pl0 buffers for this driver.. */
/* If called from PCMCIA, it is already set up, so no need to
waste the memory, just use the existing structure */
#ifndef PCMCIA
ti
=
(
struct
tok_info
*
)
kmalloc
(
sizeof
(
struct
tok_info
),
GFP_KERNEL
);
if
(
ti
==
NULL
)
{
iounmap
(
t_mmio
);
return
-
ENOMEM
;
}
memset
(
ti
,
0
,
sizeof
(
struct
tok_info
));
ti
->
mmio
=
t_mmio
;
dev
->
priv
=
ti
;
/* this seems like the logical use of the
field ... let's try some empirical tests
using the token-info structure -- that
should fit with out future hope of multiple
adapter support as well /dwm */
for
(
i
=
0
;
i
<
IBMTR_MAX_ADAPTERS
;
i
++
)
{
if
(
turbo_io
[
i
]
!=
PIOaddr
)
continue
;
for
(
i
=
0
;
i
<
IBMTR_MAX_ADAPTERS
;
i
++
)
{
if
(
turbo_io
[
i
]
!=
PIOaddr
)
continue
;
#if IBMTR_DEBUG_MESSAGES
printk
(
"ibmtr::tr_probe1, setting PIOaddr %x to Turbo
\n
"
,
PIOaddr
);
printk
(
"ibmtr::tr_probe1, setting PIOaddr %x to Turbo
\n
"
,
PIOaddr
);
#endif
ti
->
turbo
=
1
;
t_irq
=
turbo_irq
[
i
];
ti
->
turbo
=
1
;
t_irq
=
turbo_irq
[
i
];
}
#endif
/* !PCMCIA */
ti
->
readlog_pending
=
0
;
...
...
@@ -826,11 +806,6 @@ static int __devinit trdev_init(struct net_device *dev)
dev
->
set_multicast_list
=
tok_set_multicast_list
;
dev
->
change_mtu
=
ibmtr_change_mtu
;
#ifndef MODULE
#ifndef PCMCIA
tr_setup
(
dev
);
#endif
#endif
return
0
;
}
...
...
@@ -1948,21 +1923,21 @@ int init_module(void)
int
count
=
0
;
find_turbo_adapters
(
io
);
for
(
i
=
0
;
io
[
i
]
&&
(
i
<
IBMTR_MAX_ADAPTERS
);
i
++
)
{
irq
[
i
]
=
0
;
mem
[
i
]
=
0
;
dev_ibmtr
[
i
]
=
NULL
;
dev_ibmtr
[
i
]
=
init_trdev
(
dev_ibmtr
[
i
],
0
);
dev_ibmtr
[
i
]
=
alloc_trdev
(
sizeof
(
struct
tok_info
));
if
(
dev_ibmtr
[
i
]
==
NULL
)
{
if
(
i
==
0
)
if
(
i
==
0
)
return
-
ENOMEM
;
break
;
break
;
}
dev_ibmtr
[
i
]
->
base_addr
=
io
[
i
];
dev_ibmtr
[
i
]
->
irq
=
irq
[
i
];
dev_ibmtr
[
i
]
->
mem_start
=
mem
[
i
];
dev_ibmtr
[
i
]
->
init
=
&
ibmtr_probe
;
if
(
register_
tr
dev
(
dev_ibmtr
[
i
])
!=
0
)
{
if
(
register_
net
dev
(
dev_ibmtr
[
i
])
!=
0
)
{
kfree
(
dev_ibmtr
[
i
]);
dev_ibmtr
[
i
]
=
NULL
;
continue
;
...
...
@@ -1970,7 +1945,7 @@ int init_module(void)
count
++
;
}
if
(
count
)
return
0
;
printk
(
"ibmtr: register_
tr
dev() returned non-zero.
\n
"
);
printk
(
"ibmtr: register_
net
dev() returned non-zero.
\n
"
);
return
-
EIO
;
}
/*init_module */
...
...
@@ -1979,24 +1954,25 @@ void cleanup_module(void)
int
i
,
j
;
for
(
i
=
0
;
i
<
IBMTR_MAX_ADAPTERS
;
i
++
){
if
(
!
dev_ibmtr
[
i
])
continue
;
if
(
!
dev_ibmtr
[
i
])
continue
;
if
(
dev_ibmtr
[
i
]
->
base_addr
)
{
outb
(
0
,
dev_ibmtr
[
i
]
->
base_addr
+
ADAPTRESET
);
for
(
j
=
jiffies
+
TR_RST_TIME
;
time_before_eq
(
jiffies
,
j
);)
;
outb
(
0
,
dev_ibmtr
[
i
]
->
base_addr
+
ADAPTRESETREL
);
}
unregister_
tr
dev
(
dev_ibmtr
[
i
]);
unregister_
net
dev
(
dev_ibmtr
[
i
]);
free_irq
(
dev_ibmtr
[
i
]
->
irq
,
dev_ibmtr
[
i
]);
release_region
(
dev_ibmtr
[
i
]
->
base_addr
,
IBMTR_IO_EXTENT
);
#ifndef PCMCIA
{
struct
tok_info
*
ti
=
(
struct
tok_info
*
)
dev_ibmtr
[
i
]
->
priv
;
iounmap
((
u32
*
)
ti
->
mmio
)
;
iounmap
((
u32
*
)
ti
->
sram_virt
)
;
struct
tok_info
*
ti
=
(
struct
tok_info
*
)
dev_ibmtr
[
i
]
->
priv
;
iounmap
((
u32
*
)
ti
->
mmio
);
iounmap
((
u32
*
)
ti
->
sram_virt
);
}
#endif
kfree
(
dev_ibmtr
[
i
]
->
priv
);
kfree
(
dev_ibmtr
[
i
]);
dev_ibmtr
[
i
]
=
NULL
;
}
...
...
include/linux/trdevice.h
View file @
bea71ef2
...
...
@@ -34,10 +34,7 @@ extern int tr_header(struct sk_buff *skb, struct net_device *dev,
extern
int
tr_rebuild_header
(
struct
sk_buff
*
skb
);
extern
unsigned
short
tr_type_trans
(
struct
sk_buff
*
skb
,
struct
net_device
*
dev
);
extern
void
tr_source_route
(
struct
sk_buff
*
skb
,
struct
trh_hdr
*
trh
,
struct
net_device
*
dev
);
extern
struct
net_device
*
init_trdev
(
struct
net_device
*
dev
,
int
sizeof_priv
);
extern
struct
net_device
*
alloc_trdev
(
int
sizeof_priv
);
extern
int
register_trdev
(
struct
net_device
*
dev
);
extern
void
unregister_trdev
(
struct
net_device
*
dev
);
#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