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
0123d4ef
Commit
0123d4ef
authored
Sep 25, 2003
by
Maneesh Soni
Committed by
David S. Miller
Sep 25, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET]: Remove attribute group when unregistering netdev from sysfs.
parent
5c675a44
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
3 deletions
+25
-3
net/core/dev.c
net/core/dev.c
+2
-1
net/core/net-sysfs.c
net/core/net-sysfs.c
+23
-2
No files found.
net/core/dev.c
View file @
0123d4ef
...
@@ -179,6 +179,7 @@ int netdev_fastroute_obstacles;
...
@@ -179,6 +179,7 @@ int netdev_fastroute_obstacles;
extern
int
netdev_sysfs_init
(
void
);
extern
int
netdev_sysfs_init
(
void
);
extern
int
netdev_register_sysfs
(
struct
net_device
*
);
extern
int
netdev_register_sysfs
(
struct
net_device
*
);
extern
int
netdev_unregister_sysfs
(
struct
net_device
*
);
/*******************************************************************************
/*******************************************************************************
...
@@ -2819,7 +2820,7 @@ void netdev_run_todo(void)
...
@@ -2819,7 +2820,7 @@ void netdev_run_todo(void)
break
;
break
;
case
NETREG_UNREGISTERING
:
case
NETREG_UNREGISTERING
:
class_device_del
(
&
dev
->
class_
dev
);
netdev_unregister_sysfs
(
dev
);
dev
->
reg_state
=
NETREG_UNREGISTERED
;
dev
->
reg_state
=
NETREG_UNREGISTERED
;
netdev_wait_allrefs
(
dev
);
netdev_wait_allrefs
(
dev
);
...
...
net/core/net-sysfs.c
View file @
0123d4ef
...
@@ -383,6 +383,21 @@ static struct class net_class = {
...
@@ -383,6 +383,21 @@ static struct class net_class = {
#endif
#endif
};
};
void
netdev_unregister_sysfs
(
struct
net_device
*
net
)
{
struct
class_device
*
class_dev
=
&
(
net
->
class_dev
);
if
(
net
->
get_stats
)
sysfs_remove_group
(
&
class_dev
->
kobj
,
&
netstat_group
);
#ifdef WIRELESS_EXT
if
(
net
->
get_wireless_stats
)
sysfs_remove_group
(
&
class_dev
->
kobj
,
&
wireless_group
);
#endif
class_device_del
(
class_dev
);
}
/* Create sysfs entries for network device. */
/* Create sysfs entries for network device. */
int
netdev_register_sysfs
(
struct
net_device
*
net
)
int
netdev_register_sysfs
(
struct
net_device
*
net
)
{
{
...
@@ -411,9 +426,15 @@ int netdev_register_sysfs(struct net_device *net)
...
@@ -411,9 +426,15 @@ int netdev_register_sysfs(struct net_device *net)
#ifdef WIRELESS_EXT
#ifdef WIRELESS_EXT
if
(
net
->
get_wireless_stats
&&
if
(
net
->
get_wireless_stats
&&
(
ret
=
sysfs_create_group
(
&
class_dev
->
kobj
,
&
wireless_group
)))
(
ret
=
sysfs_create_group
(
&
class_dev
->
kobj
,
&
wireless_group
)))
goto
out_unreg
;
goto
out_cleanup
;
#endif
return
0
;
out_cleanup:
if
(
net
->
get_stats
)
sysfs_remove_group
(
&
class_dev
->
kobj
,
&
netstat_group
);
#else
return
0
;
return
0
;
#endif
out_unreg:
out_unreg:
printk
(
KERN_WARNING
"%s: sysfs attribute registration failed %d
\n
"
,
printk
(
KERN_WARNING
"%s: sysfs attribute registration failed %d
\n
"
,
...
...
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