Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 67951
b: refs/heads/master
c: 52e8c20
h: refs/heads/master
i:
  67949: 018b92e
  67947: 9dc9d84
  67943: 8eb59ab
  67935: 0823c4f
v: v3
  • Loading branch information
Dave Young authored and Greg Kroah-Hartman committed Oct 12, 2007
1 parent f51fa51 commit 503ffec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2ebefc50161a0a1cdebccd62be749e72abdbec37
refs/heads/master: 52e8c209d6d2bae6766b9940a107c73e943583f1
14 changes: 7 additions & 7 deletions trunk/fs/sysfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include <linux/namei.h>
#include <linux/poll.h>
#include <linux/list.h>
#include <linux/mutex.h>
#include <asm/uaccess.h>
#include <asm/semaphore.h>

#include "sysfs.h"

Expand Down Expand Up @@ -55,7 +55,7 @@ struct sysfs_buffer {
loff_t pos;
char * page;
struct sysfs_ops * ops;
struct semaphore sem;
struct mutex mutex;
int needs_read_fill;
int event;
};
Expand Down Expand Up @@ -128,7 +128,7 @@ 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;

down(&buffer->sem);
mutex_lock(&buffer->mutex);
if (buffer->needs_read_fill) {
retval = fill_read_buffer(file->f_path.dentry,buffer);
if (retval)
Expand All @@ -139,7 +139,7 @@ sysfs_read_file(struct file *file, char __user *buf, size_t count, loff_t *ppos)
retval = simple_read_from_buffer(buf, count, ppos, buffer->page,
buffer->count);
out:
up(&buffer->sem);
mutex_unlock(&buffer->mutex);
return retval;
}

Expand Down Expand Up @@ -228,13 +228,13 @@ sysfs_write_file(struct file *file, const char __user *buf, size_t count, loff_t
struct sysfs_buffer * buffer = file->private_data;
ssize_t len;

down(&buffer->sem);
mutex_lock(&buffer->mutex);
len = fill_write_buffer(buffer, buf, count);
if (len > 0)
len = flush_write_buffer(file->f_path.dentry, buffer, len);
if (len > 0)
*ppos += len;
up(&buffer->sem);
mutex_unlock(&buffer->mutex);
return len;
}

Expand Down Expand Up @@ -294,7 +294,7 @@ static int sysfs_open_file(struct inode *inode, struct file *file)
if (!buffer)
goto err_out;

init_MUTEX(&buffer->sem);
mutex_init(&buffer->mutex);
buffer->needs_read_fill = 1;
buffer->ops = ops;
file->private_data = buffer;
Expand Down

0 comments on commit 503ffec

Please sign in to comment.