Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 24040
b: refs/heads/master
c: 14cc3e2
h: refs/heads/master
v: v3
  • Loading branch information
Ingo Molnar authored and Linus Torvalds committed Mar 26, 2006
1 parent 8e749bb commit 8a255e9
Show file tree
Hide file tree
Showing 21 changed files with 173 additions and 158 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: 353ab6e97b8f209dbecc9f650f1f84e3da2a7bb1
refs/heads/master: 14cc3e2b633bb64063698980974df4535368e98f
12 changes: 6 additions & 6 deletions trunk/arch/arm26/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <asm/system.h>
#include <asm/uaccess.h>
#include <asm/unistd.h>
#include <asm/semaphore.h>
#include <linux/mutex.h>

#include "ptrace.h"

Expand Down Expand Up @@ -207,19 +207,19 @@ void die_if_kernel(const char *str, struct pt_regs *regs, int err)
die(str, regs, err);
}

static DECLARE_MUTEX(undef_sem);
static DEFINE_MUTEX(undef_mutex);
static int (*undef_hook)(struct pt_regs *);

int request_undef_hook(int (*fn)(struct pt_regs *))
{
int ret = -EBUSY;

down(&undef_sem);
mutex_lock(&undef_mutex);
if (undef_hook == NULL) {
undef_hook = fn;
ret = 0;
}
up(&undef_sem);
mutex_unlock(&undef_mutex);

return ret;
}
Expand All @@ -228,12 +228,12 @@ int release_undef_hook(int (*fn)(struct pt_regs *))
{
int ret = -EINVAL;

down(&undef_sem);
mutex_lock(&undef_mutex);
if (undef_hook == fn) {
undef_hook = NULL;
ret = 0;
}
up(&undef_sem);
mutex_unlock(&undef_mutex);

return ret;
}
Expand Down
9 changes: 5 additions & 4 deletions trunk/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

#ifdef CONFIG_X86_POWERNOW_K8_ACPI
#include <linux/acpi.h>
#include <linux/mutex.h>
#include <acpi/processor.h>
#endif

Expand All @@ -49,7 +50,7 @@
#include "powernow-k8.h"

/* serialize freq changes */
static DECLARE_MUTEX(fidvid_sem);
static DEFINE_MUTEX(fidvid_mutex);

static struct powernow_k8_data *powernow_data[NR_CPUS];

Expand Down Expand Up @@ -943,17 +944,17 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
if (cpufreq_frequency_table_target(pol, data->powernow_table, targfreq, relation, &newstate))
goto err_out;

down(&fidvid_sem);
mutex_lock(&fidvid_mutex);

powernow_k8_acpi_pst_values(data, newstate);

if (transition_frequency(data, newstate)) {
printk(KERN_ERR PFX "transition frequency failed\n");
ret = 1;
up(&fidvid_sem);
mutex_unlock(&fidvid_mutex);
goto err_out;
}
up(&fidvid_sem);
mutex_unlock(&fidvid_mutex);

pol->cur = find_khz_freq_from_fid(data->currfid);
ret = 0;
Expand Down
13 changes: 7 additions & 6 deletions trunk/arch/i386/kernel/cpu/mtrr/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <linux/pci.h>
#include <linux/smp.h>
#include <linux/cpu.h>
#include <linux/mutex.h>

#include <asm/mtrr.h>

Expand All @@ -47,7 +48,7 @@
u32 num_var_ranges = 0;

unsigned int *usage_table;
static DECLARE_MUTEX(mtrr_sem);
static DEFINE_MUTEX(mtrr_mutex);

u32 size_or_mask, size_and_mask;

Expand Down Expand Up @@ -333,7 +334,7 @@ int mtrr_add_page(unsigned long base, unsigned long size,
/* No CPU hotplug when we change MTRR entries */
lock_cpu_hotplug();
/* Search for existing MTRR */
down(&mtrr_sem);
mutex_lock(&mtrr_mutex);
for (i = 0; i < num_var_ranges; ++i) {
mtrr_if->get(i, &lbase, &lsize, &ltype);
if (base >= lbase + lsize)
Expand Down Expand Up @@ -371,7 +372,7 @@ int mtrr_add_page(unsigned long base, unsigned long size,
printk(KERN_INFO "mtrr: no more MTRRs available\n");
error = i;
out:
up(&mtrr_sem);
mutex_unlock(&mtrr_mutex);
unlock_cpu_hotplug();
return error;
}
Expand Down Expand Up @@ -464,7 +465,7 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size)
max = num_var_ranges;
/* No CPU hotplug when we change MTRR entries */
lock_cpu_hotplug();
down(&mtrr_sem);
mutex_lock(&mtrr_mutex);
if (reg < 0) {
/* Search for existing MTRR */
for (i = 0; i < max; ++i) {
Expand Down Expand Up @@ -503,7 +504,7 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size)
set_mtrr(reg, 0, 0, 0);
error = reg;
out:
up(&mtrr_sem);
mutex_unlock(&mtrr_mutex);
unlock_cpu_hotplug();
return error;
}
Expand Down Expand Up @@ -685,7 +686,7 @@ void mtrr_ap_init(void)
if (!mtrr_if || !use_intel())
return;
/*
* Ideally we should hold mtrr_sem here to avoid mtrr entries changed,
* Ideally we should hold mtrr_mutex here to avoid mtrr entries changed,
* but this routine will be called in cpu boot time, holding the lock
* breaks it. This routine is called in two cases: 1.very earily time
* of software resume, when there absolutely isn't mtrr entry changes;
Expand Down
7 changes: 4 additions & 3 deletions trunk/arch/i386/kernel/microcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
#include <linux/miscdevice.h>
#include <linux/spinlock.h>
#include <linux/mm.h>
#include <linux/mutex.h>

#include <asm/msr.h>
#include <asm/uaccess.h>
Expand Down Expand Up @@ -114,7 +115,7 @@ MODULE_LICENSE("GPL");
static DEFINE_SPINLOCK(microcode_update_lock);

/* no concurrent ->write()s are allowed on /dev/cpu/microcode */
static DECLARE_MUTEX(microcode_sem);
static DEFINE_MUTEX(microcode_mutex);

static void __user *user_buffer; /* user area microcode data buffer */
static unsigned int user_buffer_size; /* it's size */
Expand Down Expand Up @@ -444,7 +445,7 @@ static ssize_t microcode_write (struct file *file, const char __user *buf, size_
return -EINVAL;
}

down(&microcode_sem);
mutex_lock(&microcode_mutex);

user_buffer = (void __user *) buf;
user_buffer_size = (int) len;
Expand All @@ -453,7 +454,7 @@ static ssize_t microcode_write (struct file *file, const char __user *buf, size_
if (!ret)
ret = (ssize_t)len;

up(&microcode_sem);
mutex_unlock(&microcode_mutex);

return ret;
}
Expand Down
Loading

0 comments on commit 8a255e9

Please sign in to comment.