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
97ef4805
Commit
97ef4805
authored
Jun 11, 2003
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Merge
bk://ldm.bkbits.net/linux-2.5-core
into home.transmeta.com:/home/torvalds/v2.5/linux
parents
75006b98
b6f43d8d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
15 deletions
+30
-15
drivers/base/class.c
drivers/base/class.c
+0
-2
drivers/base/sys.c
drivers/base/sys.c
+23
-7
fs/sysfs/bin.c
fs/sysfs/bin.c
+2
-2
fs/sysfs/file.c
fs/sysfs/file.c
+4
-4
include/linux/sysdev.h
include/linux/sysdev.h
+1
-0
No files found.
drivers/base/class.c
View file @
97ef4805
...
...
@@ -264,8 +264,6 @@ int class_device_add(struct class_device *class_dev)
return
-
EINVAL
;
parent
=
class_get
(
class_dev
->
class
);
if
(
class_dev
->
dev
)
get_device
(
class_dev
->
dev
);
pr_debug
(
"CLASS: registering class device: ID = '%s'
\n
"
,
class_dev
->
class_id
);
...
...
drivers/base/sys.c
View file @
97ef4805
...
...
@@ -117,9 +117,16 @@ int sysdev_driver_register(struct sysdev_class * cls,
struct
sysdev_driver
*
drv
)
{
down_write
(
&
system_subsys
.
rwsem
);
if
(
cls
&&
kset_get
(
&
cls
->
kset
))
if
(
cls
&&
kset_get
(
&
cls
->
kset
))
{
list_add_tail
(
&
drv
->
entry
,
&
cls
->
drivers
);
else
/* If devices of this class already exist, tell the driver */
if
(
drv
->
add
)
{
struct
sys_device
*
dev
;
list_for_each_entry
(
dev
,
&
cls
->
kset
.
list
,
kobj
.
entry
)
drv
->
add
(
dev
);
}
}
else
list_add_tail
(
&
drv
->
entry
,
&
global_drivers
);
up_write
(
&
system_subsys
.
rwsem
);
return
0
;
...
...
@@ -136,8 +143,14 @@ void sysdev_driver_unregister(struct sysdev_class * cls,
{
down_write
(
&
system_subsys
.
rwsem
);
list_del_init
(
&
drv
->
entry
);
if
(
cls
)
if
(
cls
)
{
if
(
drv
->
remove
)
{
struct
sys_device
*
dev
;
list_for_each_entry
(
dev
,
&
cls
->
kset
.
list
,
kobj
.
entry
)
drv
->
remove
(
dev
);
}
kset_put
(
&
cls
->
kset
);
}
up_write
(
&
system_subsys
.
rwsem
);
}
...
...
@@ -170,7 +183,7 @@ int sys_device_register(struct sys_device * sysdev)
if
(
!
error
)
{
struct
sysdev_driver
*
drv
;
down_
read
(
&
system_subsys
.
rwsem
);
down_
write
(
&
system_subsys
.
rwsem
);
/* Generic notification is implicit, because it's that
* code that should have called us.
*/
...
...
@@ -186,7 +199,7 @@ int sys_device_register(struct sys_device * sysdev)
if
(
drv
->
add
)
drv
->
add
(
sysdev
);
}
up_
read
(
&
system_subsys
.
rwsem
);
up_
write
(
&
system_subsys
.
rwsem
);
}
return
error
;
}
...
...
@@ -195,7 +208,7 @@ void sys_device_unregister(struct sys_device * sysdev)
{
struct
sysdev_driver
*
drv
;
down_
read
(
&
system_subsys
.
rwsem
);
down_
write
(
&
system_subsys
.
rwsem
);
list_for_each_entry
(
drv
,
&
global_drivers
,
entry
)
{
if
(
drv
->
remove
)
drv
->
remove
(
sysdev
);
...
...
@@ -205,7 +218,10 @@ void sys_device_unregister(struct sys_device * sysdev)
if
(
drv
->
remove
)
drv
->
remove
(
sysdev
);
}
up_read
(
&
system_subsys
.
rwsem
);
list_del_init
(
&
sysdev
->
entry
);
up_write
(
&
system_subsys
.
rwsem
);
kobject_unregister
(
&
sysdev
->
kobj
);
}
...
...
fs/sysfs/bin.c
View file @
97ef4805
...
...
@@ -22,7 +22,7 @@ fill_read(struct dentry *dentry, char *buffer, loff_t off, size_t count)
}
static
ssize_t
read
(
struct
file
*
file
,
char
*
userbuf
,
size_t
count
,
loff_t
*
off
)
read
(
struct
file
*
file
,
char
__user
*
userbuf
,
size_t
count
,
loff_t
*
off
)
{
char
*
buffer
=
file
->
private_data
;
struct
dentry
*
dentry
=
file
->
f_dentry
;
...
...
@@ -65,7 +65,7 @@ flush_write(struct dentry *dentry, char *buffer, loff_t offset, size_t count)
return
attr
->
write
(
kobj
,
buffer
,
offset
,
count
);
}
static
ssize_t
write
(
struct
file
*
file
,
const
char
*
userbuf
,
static
ssize_t
write
(
struct
file
*
file
,
const
char
__user
*
userbuf
,
size_t
count
,
loff_t
*
off
)
{
char
*
buffer
=
file
->
private_data
;
...
...
fs/sysfs/file.c
View file @
97ef4805
...
...
@@ -109,7 +109,7 @@ static int fill_read_buffer(struct file * file, struct sysfs_buffer * buffer)
* the amount they specify each time.
* This may be called continuously until the buffer is empty.
*/
static
int
flush_read_buffer
(
struct
sysfs_buffer
*
buffer
,
char
*
buf
,
static
int
flush_read_buffer
(
struct
sysfs_buffer
*
buffer
,
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
int
error
;
...
...
@@ -143,7 +143,7 @@ static int flush_read_buffer(struct sysfs_buffer * buffer, char * buf,
*/
static
ssize_t
sysfs_read_file
(
struct
file
*
file
,
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
sysfs_read_file
(
struct
file
*
file
,
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
struct
sysfs_buffer
*
buffer
=
file
->
private_data
;
ssize_t
retval
=
0
;
...
...
@@ -169,7 +169,7 @@ sysfs_read_file(struct file *file, char *buf, size_t count, loff_t *ppos)
*/
static
int
fill_write_buffer
(
struct
sysfs_buffer
*
buffer
,
const
char
*
buf
,
size_t
count
)
fill_write_buffer
(
struct
sysfs_buffer
*
buffer
,
const
char
__user
*
buf
,
size_t
count
)
{
int
error
;
...
...
@@ -224,7 +224,7 @@ flush_write_buffer(struct file * file, struct sysfs_buffer * buffer, size_t coun
*/
static
ssize_t
sysfs_write_file
(
struct
file
*
file
,
const
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
sysfs_write_file
(
struct
file
*
file
,
const
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
struct
sysfs_buffer
*
buffer
=
file
->
private_data
;
...
...
include/linux/sysdev.h
View file @
97ef4805
...
...
@@ -72,6 +72,7 @@ struct sys_device {
u32
id
;
struct
sysdev_class
*
cls
;
struct
kobject
kobj
;
struct
list_head
entry
;
};
extern
int
sys_device_register
(
struct
sys_device
*
);
...
...
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