diff options
Diffstat (limited to 'fs/sysfs/file.c')
-rw-r--r-- | fs/sysfs/file.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 3e1cc062a740..b21d11b46754 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
@@ -8,8 +8,8 @@ | |||
8 | #include <linux/namei.h> | 8 | #include <linux/namei.h> |
9 | #include <linux/poll.h> | 9 | #include <linux/poll.h> |
10 | #include <linux/list.h> | 10 | #include <linux/list.h> |
11 | #include <linux/mutex.h> | ||
11 | #include <asm/uaccess.h> | 12 | #include <asm/uaccess.h> |
12 | #include <asm/semaphore.h> | ||
13 | 13 | ||
14 | #include "sysfs.h" | 14 | #include "sysfs.h" |
15 | 15 | ||
@@ -55,7 +55,7 @@ struct sysfs_buffer { | |||
55 | loff_t pos; | 55 | loff_t pos; |
56 | char * page; | 56 | char * page; |
57 | struct sysfs_ops * ops; | 57 | struct sysfs_ops * ops; |
58 | struct semaphore sem; | 58 | struct mutex mutex; |
59 | int needs_read_fill; | 59 | int needs_read_fill; |
60 | int event; | 60 | int event; |
61 | }; | 61 | }; |
@@ -128,7 +128,7 @@ sysfs_read_file(struct file *file, char __user *buf, size_t count, loff_t *ppos) | |||
128 | struct sysfs_buffer * buffer = file->private_data; | 128 | struct sysfs_buffer * buffer = file->private_data; |
129 | ssize_t retval = 0; | 129 | ssize_t retval = 0; |
130 | 130 | ||
131 | down(&buffer->sem); | 131 | mutex_lock(&buffer->mutex); |
132 | if (buffer->needs_read_fill) { | 132 | if (buffer->needs_read_fill) { |
133 | retval = fill_read_buffer(file->f_path.dentry,buffer); | 133 | retval = fill_read_buffer(file->f_path.dentry,buffer); |
134 | if (retval) | 134 | if (retval) |
@@ -139,7 +139,7 @@ sysfs_read_file(struct file *file, char __user *buf, size_t count, loff_t *ppos) | |||
139 | retval = simple_read_from_buffer(buf, count, ppos, buffer->page, | 139 | retval = simple_read_from_buffer(buf, count, ppos, buffer->page, |
140 | buffer->count); | 140 | buffer->count); |
141 | out: | 141 | out: |
142 | up(&buffer->sem); | 142 | mutex_unlock(&buffer->mutex); |
143 | return retval; | 143 | return retval; |
144 | } | 144 | } |
145 | 145 | ||
@@ -228,13 +228,13 @@ sysfs_write_file(struct file *file, const char __user *buf, size_t count, loff_t | |||
228 | struct sysfs_buffer * buffer = file->private_data; | 228 | struct sysfs_buffer * buffer = file->private_data; |
229 | ssize_t len; | 229 | ssize_t len; |
230 | 230 | ||
231 | down(&buffer->sem); | 231 | mutex_lock(&buffer->mutex); |
232 | len = fill_write_buffer(buffer, buf, count); | 232 | len = fill_write_buffer(buffer, buf, count); |
233 | if (len > 0) | 233 | if (len > 0) |
234 | len = flush_write_buffer(file->f_path.dentry, buffer, len); | 234 | len = flush_write_buffer(file->f_path.dentry, buffer, len); |
235 | if (len > 0) | 235 | if (len > 0) |
236 | *ppos += len; | 236 | *ppos += len; |
237 | up(&buffer->sem); | 237 | mutex_unlock(&buffer->mutex); |
238 | return len; | 238 | return len; |
239 | } | 239 | } |
240 | 240 | ||
@@ -294,7 +294,7 @@ static int sysfs_open_file(struct inode *inode, struct file *file) | |||
294 | if (!buffer) | 294 | if (!buffer) |
295 | goto err_out; | 295 | goto err_out; |
296 | 296 | ||
297 | init_MUTEX(&buffer->sem); | 297 | mutex_init(&buffer->mutex); |
298 | buffer->needs_read_fill = 1; | 298 | buffer->needs_read_fill = 1; |
299 | buffer->ops = ops; | 299 | buffer->ops = ops; |
300 | file->private_data = buffer; | 300 | file->private_data = buffer; |