summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLen Brown2006-07-10 08:39:23 +0200
committerLen Brown2006-07-10 08:39:23 +0200
commit1b045e5d207fc65e6708e303c2ab4249bf619982 (patch)
tree75e8db9acf0f9e5df4bf8b88b1731739d9f1faf0 /drivers
parent[PATCH] i386: use thread_info flags for debug regs and IO bitmaps (diff)
parentACPI: SBS: fix initialization, sem2mutex (diff)
downloadkernel-qcow2-linux-1b045e5d207fc65e6708e303c2ab4249bf619982.tar.gz
kernel-qcow2-linux-1b045e5d207fc65e6708e303c2ab4249bf619982.tar.xz
kernel-qcow2-linux-1b045e5d207fc65e6708e303c2ab4249bf619982.zip
Pull battery into test branch
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/cm_sbs.c46
1 files changed, 14 insertions, 32 deletions
diff --git a/drivers/acpi/cm_sbs.c b/drivers/acpi/cm_sbs.c
index 574a75a166c5..a01ce6700bfe 100644
--- a/drivers/acpi/cm_sbs.c
+++ b/drivers/acpi/cm_sbs.c
@@ -39,50 +39,43 @@ ACPI_MODULE_NAME("cm_sbs")
static struct proc_dir_entry *acpi_ac_dir;
static struct proc_dir_entry *acpi_battery_dir;
-static struct semaphore cm_sbs_sem;
+static DEFINE_MUTEX(cm_sbs_mutex);
-static int lock_ac_dir_cnt = 0;
-static int lock_battery_dir_cnt = 0;
+static int lock_ac_dir_cnt;
+static int lock_battery_dir_cnt;
struct proc_dir_entry *acpi_lock_ac_dir(void)
{
-
- down(&cm_sbs_sem);
- if (!acpi_ac_dir) {
+ mutex_lock(&cm_sbs_mutex);
+ if (!acpi_ac_dir)
acpi_ac_dir = proc_mkdir(ACPI_AC_CLASS, acpi_root_dir);
- }
if (acpi_ac_dir) {
lock_ac_dir_cnt++;
} else {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Cannot create %s\n", ACPI_AC_CLASS));
}
- up(&cm_sbs_sem);
+ mutex_unlock(&cm_sbs_mutex);
return acpi_ac_dir;
}
-
EXPORT_SYMBOL(acpi_lock_ac_dir);
void acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir_param)
{
-
- down(&cm_sbs_sem);
- if (acpi_ac_dir_param) {
+ mutex_lock(&cm_sbs_mutex);
+ if (acpi_ac_dir_param)
lock_ac_dir_cnt--;
- }
if (lock_ac_dir_cnt == 0 && acpi_ac_dir_param && acpi_ac_dir) {
remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir);
acpi_ac_dir = 0;
}
- up(&cm_sbs_sem);
+ mutex_unlock(&cm_sbs_mutex);
}
-
EXPORT_SYMBOL(acpi_unlock_ac_dir);
struct proc_dir_entry *acpi_lock_battery_dir(void)
{
-
- down(&cm_sbs_sem);
+ mutex_lock(&cm_sbs_mutex);
if (!acpi_battery_dir) {
acpi_battery_dir =
proc_mkdir(ACPI_BATTERY_CLASS, acpi_root_dir);
@@ -93,39 +86,28 @@ struct proc_dir_entry *acpi_lock_battery_dir(void)
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Cannot create %s\n", ACPI_BATTERY_CLASS));
}
- up(&cm_sbs_sem);
+ mutex_unlock(&cm_sbs_mutex);
return acpi_battery_dir;
}
-
EXPORT_SYMBOL(acpi_lock_battery_dir);
void acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir_param)
{
-
- down(&cm_sbs_sem);
- if (acpi_battery_dir_param) {
+ mutex_lock(&cm_sbs_mutex);
+ if (acpi_battery_dir_param)
lock_battery_dir_cnt--;
- }
if (lock_battery_dir_cnt == 0 && acpi_battery_dir_param
&& acpi_battery_dir) {
remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir);
acpi_battery_dir = 0;
}
- up(&cm_sbs_sem);
+ mutex_unlock(&cm_sbs_mutex);
return;
}
-
EXPORT_SYMBOL(acpi_unlock_battery_dir);
static int __init acpi_cm_sbs_init(void)
{
-
- if (acpi_disabled)
- return 0;
-
- init_MUTEX(&cm_sbs_sem);
-
return 0;
}
-
subsys_initcall(acpi_cm_sbs_init);