Commit 8c8b8859 authored by Daniel Walker's avatar Daniel Walker Committed by Ingo Molnar

mcheck mce_64: mce_read_sem to mutex

Converted to a mutex, and changed the name to mce_read_mutex.
Signed-off-by: default avatarDaniel Walker <dwalker@mvista.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent fa20efd2
...@@ -564,7 +564,7 @@ static ssize_t mce_read(struct file *filp, char __user *ubuf, size_t usize, ...@@ -564,7 +564,7 @@ static ssize_t mce_read(struct file *filp, char __user *ubuf, size_t usize,
loff_t *off) loff_t *off)
{ {
unsigned long *cpu_tsc; unsigned long *cpu_tsc;
static DECLARE_MUTEX(mce_read_sem); static DEFINE_MUTEX(mce_read_mutex);
unsigned next; unsigned next;
char __user *buf = ubuf; char __user *buf = ubuf;
int i, err; int i, err;
...@@ -573,12 +573,12 @@ static ssize_t mce_read(struct file *filp, char __user *ubuf, size_t usize, ...@@ -573,12 +573,12 @@ static ssize_t mce_read(struct file *filp, char __user *ubuf, size_t usize,
if (!cpu_tsc) if (!cpu_tsc)
return -ENOMEM; return -ENOMEM;
down(&mce_read_sem); mutex_lock(&mce_read_mutex);
next = rcu_dereference(mcelog.next); next = rcu_dereference(mcelog.next);
/* Only supports full reads right now */ /* Only supports full reads right now */
if (*off != 0 || usize < MCE_LOG_LEN*sizeof(struct mce)) { if (*off != 0 || usize < MCE_LOG_LEN*sizeof(struct mce)) {
up(&mce_read_sem); mutex_unlock(&mce_read_mutex);
kfree(cpu_tsc); kfree(cpu_tsc);
return -EINVAL; return -EINVAL;
} }
...@@ -621,7 +621,7 @@ static ssize_t mce_read(struct file *filp, char __user *ubuf, size_t usize, ...@@ -621,7 +621,7 @@ static ssize_t mce_read(struct file *filp, char __user *ubuf, size_t usize,
memset(&mcelog.entry[i], 0, sizeof(struct mce)); memset(&mcelog.entry[i], 0, sizeof(struct mce));
} }
} }
up(&mce_read_sem); mutex_unlock(&mce_read_mutex);
kfree(cpu_tsc); kfree(cpu_tsc);
return err ? -EFAULT : buf - ubuf; return err ? -EFAULT : buf - ubuf;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment