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
36b519df
Commit
36b519df
authored
Mar 12, 2013
by
Tejun Heo
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'for-3.10-subsys_virtual_register' into for-3.10
parents
ba630e49
d73ce004
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
22 deletions
+57
-22
drivers/base/base.h
drivers/base/base.h
+2
-0
drivers/base/bus.c
drivers/base/bus.c
+52
-21
drivers/base/core.c
drivers/base/core.c
+1
-1
include/linux/device.h
include/linux/device.h
+2
-0
No files found.
drivers/base/base.h
View file @
36b519df
...
...
@@ -101,6 +101,8 @@ static inline int hypervisor_init(void) { return 0; }
extern
int
platform_bus_init
(
void
);
extern
void
cpu_dev_init
(
void
);
struct
kobject
*
virtual_device_parent
(
struct
device
*
dev
);
extern
int
bus_add_device
(
struct
device
*
dev
);
extern
void
bus_probe_device
(
struct
device
*
dev
);
extern
void
bus_remove_device
(
struct
device
*
dev
);
...
...
drivers/base/bus.c
View file @
36b519df
...
...
@@ -1205,26 +1205,10 @@ static void system_root_device_release(struct device *dev)
{
kfree
(
dev
);
}
/**
* subsys_system_register - register a subsystem at /sys/devices/system/
* @subsys: system subsystem
* @groups: default attributes for the root device
*
* All 'system' subsystems have a /sys/devices/system/<name> root device
* with the name of the subsystem. The root device can carry subsystem-
* wide attributes. All registered devices are below this single root
* device and are named after the subsystem with a simple enumeration
* number appended. The registered devices are not explicitely named;
* only 'id' in the device needs to be set.
*
* Do not use this interface for anything new, it exists for compatibility
* with bad ideas only. New subsystems should use plain subsystems; and
* add the subsystem-wide attributes should be added to the subsystem
* directory itself and not some create fake root-device placed in
* /sys/devices/system/<name>.
*/
int
subsys_system_register
(
struct
bus_type
*
subsys
,
const
struct
attribute_group
**
groups
)
static
int
subsys_register
(
struct
bus_type
*
subsys
,
const
struct
attribute_group
**
groups
,
struct
kobject
*
parent_of_root
)
{
struct
device
*
dev
;
int
err
;
...
...
@@ -1243,7 +1227,7 @@ int subsys_system_register(struct bus_type *subsys,
if
(
err
<
0
)
goto
err_name
;
dev
->
kobj
.
parent
=
&
system_kset
->
kobj
;
dev
->
kobj
.
parent
=
parent_of_root
;
dev
->
groups
=
groups
;
dev
->
release
=
system_root_device_release
;
...
...
@@ -1263,8 +1247,55 @@ int subsys_system_register(struct bus_type *subsys,
bus_unregister
(
subsys
);
return
err
;
}
/**
* subsys_system_register - register a subsystem at /sys/devices/system/
* @subsys: system subsystem
* @groups: default attributes for the root device
*
* All 'system' subsystems have a /sys/devices/system/<name> root device
* with the name of the subsystem. The root device can carry subsystem-
* wide attributes. All registered devices are below this single root
* device and are named after the subsystem with a simple enumeration
* number appended. The registered devices are not explicitely named;
* only 'id' in the device needs to be set.
*
* Do not use this interface for anything new, it exists for compatibility
* with bad ideas only. New subsystems should use plain subsystems; and
* add the subsystem-wide attributes should be added to the subsystem
* directory itself and not some create fake root-device placed in
* /sys/devices/system/<name>.
*/
int
subsys_system_register
(
struct
bus_type
*
subsys
,
const
struct
attribute_group
**
groups
)
{
return
subsys_register
(
subsys
,
groups
,
&
system_kset
->
kobj
);
}
EXPORT_SYMBOL_GPL
(
subsys_system_register
);
/**
* subsys_virtual_register - register a subsystem at /sys/devices/virtual/
* @subsys: virtual subsystem
* @groups: default attributes for the root device
*
* All 'virtual' subsystems have a /sys/devices/system/<name> root device
* with the name of the subystem. The root device can carry subsystem-wide
* attributes. All registered devices are below this single root device.
* There's no restriction on device naming. This is for kernel software
* constructs which need sysfs interface.
*/
int
subsys_virtual_register
(
struct
bus_type
*
subsys
,
const
struct
attribute_group
**
groups
)
{
struct
kobject
*
virtual_dir
;
virtual_dir
=
virtual_device_parent
(
NULL
);
if
(
!
virtual_dir
)
return
-
ENOMEM
;
return
subsys_register
(
subsys
,
groups
,
virtual_dir
);
}
int
__init
buses_init
(
void
)
{
bus_kset
=
kset_create_and_add
(
"bus"
,
&
bus_uevent_ops
,
NULL
);
...
...
drivers/base/core.c
View file @
36b519df
...
...
@@ -690,7 +690,7 @@ void device_initialize(struct device *dev)
set_dev_node
(
dev
,
-
1
);
}
st
atic
st
ruct
kobject
*
virtual_device_parent
(
struct
device
*
dev
)
struct
kobject
*
virtual_device_parent
(
struct
device
*
dev
)
{
static
struct
kobject
*
virtual_dir
=
NULL
;
...
...
include/linux/device.h
View file @
36b519df
...
...
@@ -302,6 +302,8 @@ void subsys_interface_unregister(struct subsys_interface *sif);
int
subsys_system_register
(
struct
bus_type
*
subsys
,
const
struct
attribute_group
**
groups
);
int
subsys_virtual_register
(
struct
bus_type
*
subsys
,
const
struct
attribute_group
**
groups
);
/**
* struct class - device classes
...
...
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