* [PATCH][resend] sysfs/file.c - use mutex instead of semaphore
@ 2007-07-26 11:03 Dave Young
2007-07-26 5:46 ` Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: Dave Young @ 2007-07-26 11:03 UTC (permalink / raw)
To: gregkh; +Cc: akpm, linux-kernel
Use mutex instead of semaphore in sysfs/file.c : sys_buffer.
Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
---
fs/sysfs/file.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff -upr linux/fs/sysfs/file.c linux.new/fs/sysfs/file.c
--- linux/fs/sysfs/file.c 2007-07-26 10:55:11.000000000 +0000
+++ linux.new/fs/sysfs/file.c 2007-07-26 10:57:13.000000000 +0000
@@ -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"
@@ -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;
};
@@ -128,7 +128,7 @@ sysfs_read_file(struct file *file, char
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)
@@ -139,7 +139,7 @@ sysfs_read_file(struct file *file, char
retval = simple_read_from_buffer(buf, count, ppos, buffer->page,
buffer->count);
out:
- up(&buffer->sem);
+ mutex_unlock(&buffer->mutex);
return retval;
}
@@ -228,13 +228,13 @@ sysfs_write_file(struct file *file, cons
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;
}
@@ -294,7 +294,7 @@ static int sysfs_open_file(struct inode
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;
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH][resend] sysfs/file.c - use mutex instead of semaphore
2007-07-26 11:03 [PATCH][resend] sysfs/file.c - use mutex instead of semaphore Dave Young
@ 2007-07-26 5:46 ` Greg KH
2007-07-26 6:46 ` Dave Young
0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2007-07-26 5:46 UTC (permalink / raw)
To: Dave Young; +Cc: akpm, linux-kernel
On Thu, Jul 26, 2007 at 11:03:54AM +0000, Dave Young wrote:
> Use mutex instead of semaphore in sysfs/file.c : sys_buffer.
Thanks, it's in my queue, but I'm at a conference this week, so I'll get
to it on monday, sorry for the delay.
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH][resend] sysfs/file.c - use mutex instead of semaphore
2007-07-26 5:46 ` Greg KH
@ 2007-07-26 6:46 ` Dave Young
2007-07-26 12:03 ` WANG Cong
0 siblings, 1 reply; 5+ messages in thread
From: Dave Young @ 2007-07-26 6:46 UTC (permalink / raw)
To: Greg KH; +Cc: akpm, linux-kernel
>On 7/26/07, Greg KH <gregkh@suse.de> wrote:
> On Thu, Jul 26, 2007 at 11:03:54AM +0000, Dave Young wrote:
> > Use mutex instead of semaphore in sysfs/file.c : sys_buffer.
>
> Thanks, it's in my queue, but I'm at a conference this week, so I'll get
> to it on monday, sorry for the delay.
>
Hi, thank you. I'm not sure why it's ignored, I think maybe it should
be splitted to two patches.
Andrew has added this one to -mm tree. I'm happy to hear from you. I
will send the seperated header cleanup patch again. gmail will convert
tab to white space, so I have to send another post.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH][resend] sysfs/file.c - use mutex instead of semaphore
2007-07-26 6:46 ` Dave Young
@ 2007-07-26 12:03 ` WANG Cong
2007-07-27 0:38 ` Dave Young
0 siblings, 1 reply; 5+ messages in thread
From: WANG Cong @ 2007-07-26 12:03 UTC (permalink / raw)
To: Dave Young; +Cc: Greg KH, akpm, linux-kernel
On Thu, Jul 26, 2007 at 06:46:26AM +0000, Dave Young wrote:
>>On 7/26/07, Greg KH <gregkh@suse.de> wrote:
>> On Thu, Jul 26, 2007 at 11:03:54AM +0000, Dave Young wrote:
>> > Use mutex instead of semaphore in sysfs/file.c : sys_buffer.
>>
>> Thanks, it's in my queue, but I'm at a conference this week, so I'll get
>> to it on monday, sorry for the delay.
>>
>Hi, thank you. I'm not sure why it's ignored, I think maybe it should
>be splitted to two patches.
>
>Andrew has added this one to -mm tree. I'm happy to hear from you. I
>will send the seperated header cleanup patch again. gmail will convert
> tab to white space, so I have to send another post.
Well, it seems that you use web browsers to visit gmail. Can you try to
use an email client, such as claws mail, mutt, or even git-send-email?
I am using gmail with mutt, tabs aren't replaced.
Regards!
--
To do great work, you have to have a pure mind. You can think only about the
mathematics. Everything else is human weakness. Accepting prizes is showing
weakness.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH][resend] sysfs/file.c - use mutex instead of semaphore
2007-07-26 12:03 ` WANG Cong
@ 2007-07-27 0:38 ` Dave Young
0 siblings, 0 replies; 5+ messages in thread
From: Dave Young @ 2007-07-27 0:38 UTC (permalink / raw)
To: WANG Cong; +Cc: Greg KH, akpm, linux-kernel
>On 7/26/07, WANG Cong <xiyou.wangcong@gmail.com> wrote:
> On Thu, Jul 26, 2007 at 06:46:26AM +0000, Dave Young wrote:
> >>On 7/26/07, Greg KH <gregkh@suse.de> wrote:
> >> On Thu, Jul 26, 2007 at 11:03:54AM +0000, Dave Young wrote:
> >> > Use mutex instead of semaphore in sysfs/file.c : sys_buffer.
> >>
> >> Thanks, it's in my queue, but I'm at a conference this week, so I'll get
> >> to it on monday, sorry for the delay.
> >>
> >Hi, thank you. I'm not sure why it's ignored, I think maybe it should
> >be splitted to two patches.
> >
> >Andrew has added this one to -mm tree. I'm happy to hear from you. I
> >will send the seperated header cleanup patch again. gmail will convert
> > tab to white space, so I have to send another post.
>
> Well, it seems that you use web browsers to visit gmail. Can you try to
> use an email client, such as claws mail, mutt, or even git-send-email?
> I am using gmail with mutt, tabs aren't replaced.
>
Yes, I use webmail to write messages other than patches, the patches
are sent by mutt.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-07-27 0:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-26 11:03 [PATCH][resend] sysfs/file.c - use mutex instead of semaphore Dave Young
2007-07-26 5:46 ` Greg KH
2007-07-26 6:46 ` Dave Young
2007-07-26 12:03 ` WANG Cong
2007-07-27 0:38 ` Dave Young
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.