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
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
Show 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,
...
@@ -178,17 +178,6 @@ static struct net_device *init_netdev(struct net_device *dev, int sizeof_priv,
return
dev
;
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
* init_etherdev - Register ethernet device
* @dev: An ethernet device structure to be filled in, or %NULL if a new
* @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)
...
@@ -535,28 +524,6 @@ void tr_setup(struct net_device *dev)
dev
->
flags
=
IFF_BROADCAST
|
IFF_MULTICAST
;
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
* alloc_trdev - Register token ring device
* @sizeof_priv: Size of additional driver-private structure to be allocated
* @sizeof_priv: Size of additional driver-private structure to be allocated
...
@@ -574,21 +541,8 @@ struct net_device *alloc_trdev(int sizeof_priv)
...
@@ -574,21 +541,8 @@ struct net_device *alloc_trdev(int sizeof_priv)
return
alloc_netdev
(
sizeof_priv
,
"tr%d"
,
tr_setup
);
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
(
tr_setup
);
EXPORT_SYMBOL
(
init_trdev
);
EXPORT_SYMBOL
(
alloc_trdev
);
EXPORT_SYMBOL
(
alloc_trdev
);
EXPORT_SYMBOL
(
register_trdev
);
EXPORT_SYMBOL
(
unregister_trdev
);
#endif
/* CONFIG_TR */
#endif
/* CONFIG_TR */
...
...
drivers/net/pcmcia/ibmtr_cs.c
View file @
bea71ef2
...
@@ -208,10 +208,13 @@ static dev_link_t *ibmtr_attach(void)
...
@@ -208,10 +208,13 @@ static dev_link_t *ibmtr_attach(void)
flush_stale_links
();
flush_stale_links
();
/* Create new token-ring device */
/* Create new token-ring device */
info
=
kmalloc
(
sizeof
(
*
info
),
GFP_KERNEL
);
dev
=
alloc_trdev
(
sizeof
(
*
info
));
if
(
!
info
)
return
NULL
;
if
(
!
dev
)
memset
(
info
,
0
,
sizeof
(
*
info
));
return
NULL
;
link
=
&
info
->
link
;
link
->
priv
=
info
;
info
=
dev
->
priv
;
link
=
&
info
->
link
;
link
->
priv
=
info
;
init_timer
(
&
link
->
release
);
init_timer
(
&
link
->
release
);
link
->
release
.
function
=
&
ibmtr_release
;
link
->
release
.
function
=
&
ibmtr_release
;
...
@@ -232,12 +235,6 @@ static dev_link_t *ibmtr_attach(void)
...
@@ -232,12 +235,6 @@ static dev_link_t *ibmtr_attach(void)
link
->
conf
.
IntType
=
INT_MEMORY_AND_IO
;
link
->
conf
.
IntType
=
INT_MEMORY_AND_IO
;
link
->
conf
.
Present
=
PRESENT_OPTION
;
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
;
link
->
irq
.
Instance
=
info
->
dev
=
dev
;
dev
->
init
=
&
ibmtr_probe
;
dev
->
init
=
&
ibmtr_probe
;
...
@@ -258,11 +255,16 @@ static dev_link_t *ibmtr_attach(void)
...
@@ -258,11 +255,16 @@ static dev_link_t *ibmtr_attach(void)
ret
=
CardServices
(
RegisterClient
,
&
link
->
handle
,
&
client_reg
);
ret
=
CardServices
(
RegisterClient
,
&
link
->
handle
,
&
client_reg
);
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
cs_error
(
link
->
handle
,
RegisterClient
,
ret
);
cs_error
(
link
->
handle
,
RegisterClient
,
ret
);
ibmtr_detach
(
link
);
goto
out_detach
;
return
NULL
;
}
}
out:
return
link
;
return
link
;
out_detach:
ibmtr_detach
(
link
);
link
=
NULL
;
goto
out
;
}
/* ibmtr_attach */
}
/* ibmtr_attach */
/*======================================================================
/*======================================================================
...
@@ -307,12 +309,8 @@ static void ibmtr_detach(dev_link_t *link)
...
@@ -307,12 +309,8 @@ static void ibmtr_detach(dev_link_t *link)
/* Unlink device structure, free bits */
/* Unlink device structure, free bits */
*
linkp
=
link
->
next
;
*
linkp
=
link
->
next
;
if
(
info
->
dev
)
{
unregister_netdev
(
dev
);
unregister_trdev
(
info
->
dev
);
kfree
(
dev
);
kfree
(
info
->
dev
);
}
kfree
(
info
);
}
/* ibmtr_detach */
}
/* ibmtr_detach */
/*======================================================================
/*======================================================================
...
@@ -413,10 +411,10 @@ static void ibmtr_config(dev_link_t *link)
...
@@ -413,10 +411,10 @@ static void ibmtr_config(dev_link_t *link)
Adapters Technical Reference" SC30-3585 for this info. */
Adapters Technical Reference" SC30-3585 for this info. */
ibmtr_hw_setup
(
dev
,
mmiobase
);
ibmtr_hw_setup
(
dev
,
mmiobase
);
i
=
register_
tr
dev
(
dev
);
i
=
register_
net
dev
(
dev
);
if
(
i
!=
0
)
{
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
;
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 */
...
@@ -110,7 +110,6 @@ in the event that chatty debug messages are desired - jjs 12/30/98 */
#include <linux/module.h>
#include <linux/module.h>
#ifdef PCMCIA
#ifdef PCMCIA
#undef MODULE
#undef ENABLE_PAGING
#undef ENABLE_PAGING
#else
#else
#define ENABLE_PAGING 1
#define ENABLE_PAGING 1
...
@@ -352,7 +351,7 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr)
...
@@ -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
;
unsigned
char
segment
,
intr
=
0
,
irq
=
0
,
i
,
j
,
cardpresent
=
NOTOK
,
temp
=
0
;
void
*
t_mmio
=
0
;
void
*
t_mmio
=
0
;
struct
tok_info
*
ti
=
0
;
struct
tok_info
*
ti
=
dev
->
priv
;
void
*
cd_chanid
;
void
*
cd_chanid
;
unsigned
char
*
tchanid
,
ctemp
;
unsigned
char
*
tchanid
,
ctemp
;
#ifndef PCMCIA
#ifndef PCMCIA
...
@@ -361,14 +360,6 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr)
...
@@ -361,14 +360,6 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr)
static
int
version_printed
;
static
int
version_printed
;
#endif
#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
/* Query the adapter PIO base port which will return
* indication of where MMIO was placed. We also have a
* indication of where MMIO was placed. We also have a
* coded interrupt number.
* coded interrupt number.
...
@@ -404,7 +395,6 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr)
...
@@ -404,7 +395,6 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr)
*/
*/
#ifdef PCMCIA
#ifdef PCMCIA
iounmap
(
t_mmio
);
iounmap
(
t_mmio
);
ti
=
dev
->
priv
;
/*BMS moved up here */
t_mmio
=
(
void
*
)
ti
->
mmio
;
/*BMS to get virtual address */
t_mmio
=
(
void
*
)
ti
->
mmio
;
/*BMS to get virtual address */
irq
=
ti
->
irq
;
/*BMS to display the irq! */
irq
=
ti
->
irq
;
/*BMS to display the irq! */
#endif
#endif
...
@@ -454,30 +444,20 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr)
...
@@ -454,30 +444,20 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr)
DPRINTK
(
"Expected for MCA: "
);
DPRINTK
(
"Expected for MCA: "
);
PrtChanID
(
mcchannelid
,
1
);
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
/* If called from PCMCIA, it is already set up, so no need to
waste the memory, just use the existing structure */
waste the memory, just use the existing structure */
#ifndef PCMCIA
#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
;
ti
->
mmio
=
t_mmio
;
dev
->
priv
=
ti
;
/* this seems like the logical use of the
for
(
i
=
0
;
i
<
IBMTR_MAX_ADAPTERS
;
i
++
)
{
field ... let's try some empirical tests
if
(
turbo_io
[
i
]
!=
PIOaddr
)
using the token-info structure -- that
continue
;
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
;
#if IBMTR_DEBUG_MESSAGES
#if IBMTR_DEBUG_MESSAGES
printk
(
"ibmtr::tr_probe1, setting PIOaddr %x to Turbo
\n
"
,
printk
(
"ibmtr::tr_probe1, setting PIOaddr %x to Turbo
\n
"
,
PIOaddr
);
PIOaddr
);
#endif
#endif
ti
->
turbo
=
1
;
ti
->
turbo
=
1
;
t_irq
=
turbo_irq
[
i
];
t_irq
=
turbo_irq
[
i
];
}
}
#endif
/* !PCMCIA */
#endif
/* !PCMCIA */
ti
->
readlog_pending
=
0
;
ti
->
readlog_pending
=
0
;
...
@@ -826,11 +806,6 @@ static int __devinit trdev_init(struct net_device *dev)
...
@@ -826,11 +806,6 @@ static int __devinit trdev_init(struct net_device *dev)
dev
->
set_multicast_list
=
tok_set_multicast_list
;
dev
->
set_multicast_list
=
tok_set_multicast_list
;
dev
->
change_mtu
=
ibmtr_change_mtu
;
dev
->
change_mtu
=
ibmtr_change_mtu
;
#ifndef MODULE
#ifndef PCMCIA
tr_setup
(
dev
);
#endif
#endif
return
0
;
return
0
;
}
}
...
@@ -1948,21 +1923,21 @@ int init_module(void)
...
@@ -1948,21 +1923,21 @@ int init_module(void)
int
count
=
0
;
int
count
=
0
;
find_turbo_adapters
(
io
);
find_turbo_adapters
(
io
);
for
(
i
=
0
;
io
[
i
]
&&
(
i
<
IBMTR_MAX_ADAPTERS
);
i
++
)
{
for
(
i
=
0
;
io
[
i
]
&&
(
i
<
IBMTR_MAX_ADAPTERS
);
i
++
)
{
irq
[
i
]
=
0
;
irq
[
i
]
=
0
;
mem
[
i
]
=
0
;
mem
[
i
]
=
0
;
dev_ibmtr
[
i
]
=
NULL
;
dev_ibmtr
[
i
]
=
alloc_trdev
(
sizeof
(
struct
tok_info
));
dev_ibmtr
[
i
]
=
init_trdev
(
dev_ibmtr
[
i
],
0
);
if
(
dev_ibmtr
[
i
]
==
NULL
)
{
if
(
dev_ibmtr
[
i
]
==
NULL
)
{
if
(
i
==
0
)
if
(
i
==
0
)
return
-
ENOMEM
;
return
-
ENOMEM
;
break
;
break
;
}
}
dev_ibmtr
[
i
]
->
base_addr
=
io
[
i
];
dev_ibmtr
[
i
]
->
base_addr
=
io
[
i
];
dev_ibmtr
[
i
]
->
irq
=
irq
[
i
];
dev_ibmtr
[
i
]
->
irq
=
irq
[
i
];
dev_ibmtr
[
i
]
->
mem_start
=
mem
[
i
];
dev_ibmtr
[
i
]
->
mem_start
=
mem
[
i
];
dev_ibmtr
[
i
]
->
init
=
&
ibmtr_probe
;
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
]);
kfree
(
dev_ibmtr
[
i
]);
dev_ibmtr
[
i
]
=
NULL
;
dev_ibmtr
[
i
]
=
NULL
;
continue
;
continue
;
...
@@ -1970,7 +1945,7 @@ int init_module(void)
...
@@ -1970,7 +1945,7 @@ int init_module(void)
count
++
;
count
++
;
}
}
if
(
count
)
return
0
;
if
(
count
)
return
0
;
printk
(
"ibmtr: register_
tr
dev() returned non-zero.
\n
"
);
printk
(
"ibmtr: register_
net
dev() returned non-zero.
\n
"
);
return
-
EIO
;
return
-
EIO
;
}
/*init_module */
}
/*init_module */
...
@@ -1979,24 +1954,25 @@ void cleanup_module(void)
...
@@ -1979,24 +1954,25 @@ void cleanup_module(void)
int
i
,
j
;
int
i
,
j
;
for
(
i
=
0
;
i
<
IBMTR_MAX_ADAPTERS
;
i
++
){
for
(
i
=
0
;
i
<
IBMTR_MAX_ADAPTERS
;
i
++
){
if
(
!
dev_ibmtr
[
i
])
continue
;
if
(
!
dev_ibmtr
[
i
])
continue
;
if
(
dev_ibmtr
[
i
]
->
base_addr
)
{
if
(
dev_ibmtr
[
i
]
->
base_addr
)
{
outb
(
0
,
dev_ibmtr
[
i
]
->
base_addr
+
ADAPTRESET
);
outb
(
0
,
dev_ibmtr
[
i
]
->
base_addr
+
ADAPTRESET
);
for
(
j
=
jiffies
+
TR_RST_TIME
;
for
(
j
=
jiffies
+
TR_RST_TIME
;
time_before_eq
(
jiffies
,
j
);)
;
time_before_eq
(
jiffies
,
j
);)
;
outb
(
0
,
dev_ibmtr
[
i
]
->
base_addr
+
ADAPTRESETREL
);
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
]);
free_irq
(
dev_ibmtr
[
i
]
->
irq
,
dev_ibmtr
[
i
]);
release_region
(
dev_ibmtr
[
i
]
->
base_addr
,
IBMTR_IO_EXTENT
);
release_region
(
dev_ibmtr
[
i
]
->
base_addr
,
IBMTR_IO_EXTENT
);
#ifndef PCMCIA
#ifndef PCMCIA
{
{
struct
tok_info
*
ti
=
(
struct
tok_info
*
)
dev_ibmtr
[
i
]
->
priv
;
struct
tok_info
*
ti
=
(
struct
tok_info
*
)
iounmap
((
u32
*
)
ti
->
mmio
)
;
dev_ibmtr
[
i
]
->
priv
;
iounmap
((
u32
*
)
ti
->
sram_virt
)
;
iounmap
((
u32
*
)
ti
->
mmio
);
iounmap
((
u32
*
)
ti
->
sram_virt
);
}
}
#endif
#endif
kfree
(
dev_ibmtr
[
i
]
->
priv
);
kfree
(
dev_ibmtr
[
i
]);
kfree
(
dev_ibmtr
[
i
]);
dev_ibmtr
[
i
]
=
NULL
;
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,
...
@@ -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
int
tr_rebuild_header
(
struct
sk_buff
*
skb
);
extern
unsigned
short
tr_type_trans
(
struct
sk_buff
*
skb
,
struct
net_device
*
dev
);
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
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
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
#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