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
25e4e938
Commit
25e4e938
authored
Jun 02, 2003
by
Alexander Viro
Committed by
David S. Miller
Jun 02, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET]: Eliminate {init,register,unregister}_fcdev.
parent
58552705
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
135 deletions
+80
-135
drivers/message/fusion/mptlan.c
drivers/message/fusion/mptlan.c
+43
-42
drivers/net/fc/iph5526.c
drivers/net/fc/iph5526.c
+37
-53
drivers/net/net_init.c
drivers/net/net_init.c
+0
-36
include/linux/fcdevice.h
include/linux/fcdevice.h
+0
-4
No files found.
drivers/message/fusion/mptlan.c
View file @
25e4e938
...
...
@@ -1356,16 +1356,16 @@ mpt_lan_post_receive_buckets(void *dev_id)
}
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
struct
net_device
*
st
atic
st
ruct
net_device
*
mpt_register_lan_device
(
MPT_ADAPTER
*
mpt_dev
,
int
pnum
)
{
struct
net_device
*
dev
=
NULL
;
struct
net_device
*
dev
=
alloc_fcdev
(
sizeof
(
struct
mpt_lan_priv
))
;
struct
mpt_lan_priv
*
priv
=
NULL
;
u8
HWaddr
[
FC_ALEN
],
*
a
;
dev
=
init_fcdev
(
NULL
,
sizeof
(
struct
mpt_lan_priv
));
if
(
!
dev
)
return
(
NULL
);
return
NULL
;
dev
->
mtu
=
MPT_LAN_MTU
;
priv
=
(
struct
mpt_lan_priv
*
)
dev
->
priv
;
...
...
@@ -1435,15 +1435,18 @@ mpt_register_lan_device (MPT_ADAPTER *mpt_dev, int pnum)
SET_MODULE_OWNER
(
dev
);
if
(
register_netdev
(
dev
)
!=
0
)
{
kfree
(
dev
);
dev
=
NULL
;
}
return
dev
;
}
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
int
__init
mpt_lan_init
(
void
)
static
int
__init
mpt_lan_init
(
void
)
{
struct
net_device
*
dev
;
MPT_ADAPTER
*
curadapter
;
MPT_ADAPTER
*
p
;
int
i
,
j
;
show_mptmod_ver
(
LANAME
,
LANVER
);
...
...
@@ -1477,20 +1480,28 @@ mpt_lan_init (void)
mpt_landev
[
j
]
=
NULL
;
}
curadapter
=
mpt_adapter_find_first
();
while
(
curadapter
!=
NULL
)
{
for
(
i
=
0
;
i
<
curadapter
->
facts
.
NumberOfPorts
;
i
++
)
{
for
(
p
=
mpt_adapter_find_first
();
p
;
p
=
mpt_adapter_find_next
(
p
))
{
for
(
i
=
0
;
i
<
p
->
facts
.
NumberOfPorts
;
i
++
)
{
printk
(
KERN_INFO
MYNAM
": %s: PortNum=%x, ProtocolFlags=%02Xh (%c%c%c%c)
\n
"
,
curadapter
->
name
,
curadapter
->
pfacts
[
i
].
PortNumber
,
curadapter
->
pfacts
[
i
].
ProtocolFlags
,
MPT_PROTOCOL_FLAGS_c_c_c_c
(
curadapter
->
pfacts
[
i
].
ProtocolFlags
));
if
(
curadapter
->
pfacts
[
i
].
ProtocolFlags
&
MPI_PORTFACTS_PROTOCOL_LAN
)
{
dev
=
mpt_register_lan_device
(
curadapter
,
i
);
if
(
dev
!=
NULL
)
{
p
->
name
,
p
->
pfacts
[
i
].
PortNumber
,
p
->
pfacts
[
i
].
ProtocolFlags
,
MPT_PROTOCOL_FLAGS_c_c_c_c
(
p
->
pfacts
[
i
].
ProtocolFlags
));
if
(
!
(
p
->
pfacts
[
i
].
ProtocolFlags
&
MPI_PORTFACTS_PROTOCOL_LAN
))
{
printk
(
KERN_INFO
MYNAM
": %s: Hmmm... LAN protocol seems to be disabled on this adapter port!
\n
"
,
p
->
name
);
continue
;
}
dev
=
mpt_register_lan_device
(
p
,
i
);
if
(
!
dev
)
{
printk
(
KERN_ERR
MYNAM
": %s: Unable to register port%d as a LAN device
\n
"
,
p
->
name
,
p
->
pfacts
[
i
].
PortNumber
);
}
printk
(
KERN_INFO
MYNAM
": %s: Fusion MPT LAN device registered as '%s'
\n
"
,
curadapter
->
name
,
dev
->
name
);
p
->
name
,
dev
->
name
);
printk
(
KERN_INFO
MYNAM
": %s/%s: LanAddr = %02X:%02X:%02X:%02X:%02X:%02X
\n
"
,
IOC_AND_NETDEV_NAMES_s_s
(
dev
),
dev
->
dev_addr
[
0
],
dev
->
dev_addr
[
1
],
...
...
@@ -1499,29 +1510,19 @@ mpt_lan_init (void)
// printk (KERN_INFO MYNAM ": %s/%s: Max_TX_outstanding = %d\n",
// IOC_AND_NETDEV_NAMES_s_s(dev),
// NETDEV_TO_LANPRIV_PTR(dev)->tx_max_out);
j
=
curadapter
->
id
;
j
=
p
->
id
;
mpt_landev
[
j
]
=
dev
;
dlprintk
((
KERN_INFO
MYNAM
"/init: dev_addr=%p, mpt_landev[%d]=%p
\n
"
,
dev
,
j
,
mpt_landev
[
j
]));
}
else
{
printk
(
KERN_ERR
MYNAM
": %s: Unable to register port%d as a LAN device
\n
"
,
curadapter
->
name
,
curadapter
->
pfacts
[
i
].
PortNumber
);
}
}
else
{
printk
(
KERN_INFO
MYNAM
": %s: Hmmm... LAN protocol seems to be disabled on this adapter port!
\n
"
,
curadapter
->
name
);
}
}
curadapter
=
mpt_adapter_find_next
(
curadapter
);
}
return
0
;
}
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
static
void
mpt_lan_exit
(
void
)
static
void
__exit
mpt_lan_exit
(
void
)
{
int
i
;
...
...
@@ -1532,7 +1533,7 @@ static void mpt_lan_exit(void)
printk
(
KERN_INFO
": %s/%s: Fusion MPT LAN device unregistered
\n
"
,
IOC_AND_NETDEV_NAMES_s_s
(
dev
));
unregister_
fc
dev
(
dev
);
unregister_
net
dev
(
dev
);
//mpt_landev[i] = (struct net_device *) 0xdeadbeef; /* Debug */
mpt_landev
[
i
]
=
NULL
;
}
...
...
drivers/net/fc/iph5526.c
View file @
25e4e938
...
...
@@ -242,16 +242,15 @@ static int __init iph5526_probe_pci(struct net_device *dev)
#ifdef MODULE
struct
fc_info
*
fi
=
(
struct
fc_info
*
)
dev
->
priv
;
#else
struct
fc_info
*
fi
;
struct
fc_info
*
fi
=
fc
[
count
]
;
static
int
count
;
int
err
;
if
(
fc
[
count
]
!=
NULL
)
{
if
(
dev
==
NULL
)
{
dev
=
init_fcdev
(
NULL
,
0
);
if
(
dev
==
NULL
)
return
-
ENOMEM
;
}
fi
=
fc
[
count
];
if
(
!
fi
)
return
-
ENODEV
;
fc_setup
(
dev
);
count
++
;
#endif
fi
->
dev
=
dev
;
dev
->
base_addr
=
fi
->
base_addr
;
...
...
@@ -267,12 +266,6 @@ static int __init iph5526_probe_pci(struct net_device *dev)
dev
->
dev_addr
[
3
]
=
(
fi
->
g
.
my_port_name_low
&
0x00FF0000
)
>>
16
;
dev
->
dev_addr
[
4
]
=
(
fi
->
g
.
my_port_name_low
&
0x0000FF00
)
>>
8
;
dev
->
dev_addr
[
5
]
=
fi
->
g
.
my_port_name_low
;
#ifndef MODULE
count
++
;
}
else
return
-
ENODEV
;
#endif
display_cache
(
fi
);
return
0
;
}
...
...
@@ -287,9 +280,6 @@ static int __init fcdev_init(struct net_device *dev)
dev
->
change_mtu
=
iph5526_change_mtu
;
dev
->
tx_timeout
=
iph5526_timeout
;
dev
->
watchdog_timeo
=
5
*
HZ
;
#ifndef MODULE
fc_setup
(
dev
);
#endif
return
0
;
}
...
...
@@ -4507,7 +4497,7 @@ static int scsi_registered;
int
init_module
(
void
)
{
int
i
=
0
;
int
i
=
0
;
driver_template
.
module
=
THIS_MODULE
;
scsi_register_host
(
&
driver_template
);
...
...
@@ -4520,26 +4510,20 @@ int i = 0;
}
while
(
fc
[
i
]
!=
NULL
)
{
dev_fc
[
i
]
=
NULL
;
dev_fc
[
i
]
=
init_fcdev
(
dev_fc
[
i
],
0
);
if
(
dev_fc
[
i
]
==
NULL
)
{
struct
net_device
*
dev
=
alloc_fcdev
(
0
);
if
(
!
dev
)
{
printk
(
"iph5526.c: init_fcdev failed for card #%d
\n
"
,
i
+
1
);
break
;
}
dev_fc
[
i
]
->
irq
=
irq
;
dev_fc
[
i
]
->
mem_end
=
bad
;
dev_fc
[
i
]
->
base_addr
=
io
;
dev_fc
[
i
]
->
init
=
iph5526_probe
;
dev_fc
[
i
]
->
priv
=
fc
[
i
];
fc
[
i
]
->
dev
=
dev_fc
[
i
];
if
(
register_fcdev
(
dev_fc
[
i
])
!=
0
)
{
kfree
(
dev_fc
[
i
]);
dev_fc
[
i
]
=
NULL
;
if
(
i
==
0
)
{
printk
(
"iph5526.c: IP registeration failed!!!
\n
"
);
return
-
ENODEV
;
}
dev
->
priv
=
fc
[
i
];
iph5526_probe_pci
(
dev
);
err
=
register_netdev
(
dev
);
if
(
err
<
0
)
{
kfree
(
dev
);
printk
(
"iph5526.c: init_fcdev failed for card #%d
\n
"
,
i
+
1
);
break
;
}
dev_fc
[
i
]
=
dev
;
i
++
;
}
if
(
i
==
0
)
...
...
@@ -4550,13 +4534,13 @@ int i = 0;
void
cleanup_module
(
void
)
{
int
i
=
0
;
int
i
=
0
;
while
(
fc
[
i
]
!=
NULL
)
{
struct
net_device
*
dev
=
fc
[
i
]
->
dev
;
void
*
priv
=
dev
->
priv
;
fc
[
i
]
->
g
.
dont_init
=
TRUE
;
take_tachyon_offline
(
fc
[
i
]);
unregister_
fc
dev
(
dev
);
unregister_
net
dev
(
dev
);
clean_up_memory
(
fc
[
i
]);
if
(
dev
->
priv
)
kfree
(
priv
);
...
...
drivers/net/net_init.c
View file @
25e4e938
...
...
@@ -654,7 +654,6 @@ EXPORT_SYMBOL(unregister_trdev);
#endif
/* CONFIG_TR */
#ifdef CONFIG_NET_FC
void
fc_setup
(
struct
net_device
*
dev
)
...
...
@@ -674,28 +673,6 @@ void fc_setup(struct net_device *dev)
dev
->
flags
=
IFF_BROADCAST
;
}
/**
* init_fcdev - Register fibre channel device
* @dev: A fibre channel 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 fibre channel-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_fcdev
(
struct
net_device
*
dev
,
int
sizeof_priv
)
{
return
init_netdev
(
dev
,
sizeof_priv
,
"fc%d"
,
fc_setup
);
}
/**
* alloc_fcdev - Register fibre channel device
* @sizeof_priv: Size of additional driver-private structure to be allocated
...
...
@@ -713,21 +690,8 @@ struct net_device *alloc_fcdev(int sizeof_priv)
return
alloc_netdev
(
sizeof_priv
,
"fc%d"
,
fc_setup
);
}
int
register_fcdev
(
struct
net_device
*
dev
)
{
return
__register_netdev
(
dev
);
}
void
unregister_fcdev
(
struct
net_device
*
dev
)
{
unregister_netdev
(
dev
);
}
EXPORT_SYMBOL
(
fc_setup
);
EXPORT_SYMBOL
(
init_fcdev
);
EXPORT_SYMBOL
(
alloc_fcdev
);
EXPORT_SYMBOL
(
register_fcdev
);
EXPORT_SYMBOL
(
unregister_fcdev
);
#endif
/* CONFIG_NET_FC */
include/linux/fcdevice.h
View file @
25e4e938
...
...
@@ -33,11 +33,7 @@ extern int fc_header(struct sk_buff *skb, struct net_device *dev,
extern
int
fc_rebuild_header
(
struct
sk_buff
*
skb
);
extern
unsigned
short
fc_type_trans
(
struct
sk_buff
*
skb
,
struct
net_device
*
dev
);
extern
struct
net_device
*
init_fcdev
(
struct
net_device
*
dev
,
int
sizeof_priv
);
extern
struct
net_device
*
alloc_fcdev
(
int
sizeof_priv
);
extern
int
register_fcdev
(
struct
net_device
*
dev
);
extern
void
unregister_fcdev
(
struct
net_device
*
dev
);
#endif
#endif
/* _LINUX_FCDEVICE_H */
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