Use mutex instead of semaphore in struct class. Signed-off-by: Dave Young <[EMAIL PROTECTED]> --- drivers/power/apm_power.c | 6 +++--- drivers/power/power_supply_core.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-)
diff -upr linux/drivers/power/apm_power.c linux.new/drivers/power/apm_power.c --- linux/drivers/power/apm_power.c 2007-12-28 10:36:26.000000000 +0800 +++ linux.new/drivers/power/apm_power.c 2007-12-28 10:38:03.000000000 +0800 @@ -207,10 +207,10 @@ static void apm_battery_apm_get_power_st union power_supply_propval status; union power_supply_propval capacity, time_to_full, time_to_empty; - down(&power_supply_class->sem); + mutex_lock(&power_supply_class->mutex); find_main_battery(); if (!main_battery) { - up(&power_supply_class->sem); + mutex_unlock(&power_supply_class->mutex); return; } @@ -278,7 +278,7 @@ static void apm_battery_apm_get_power_st } } - up(&power_supply_class->sem); + mutex_unlock(&power_supply_class->mutex); } static int __init apm_battery_init(void) diff -upr linux/drivers/power/power_supply_core.c linux.new/drivers/power/power_supply_core.c --- linux/drivers/power/power_supply_core.c 2007-12-28 10:36:49.000000000 +0800 +++ linux.new/drivers/power/power_supply_core.c 2007-12-28 10:38:55.000000000 +0800 @@ -31,7 +31,7 @@ static void power_supply_changed_work(st for (i = 0; i < psy->num_supplicants; i++) { struct device *dev; - down(&power_supply_class->sem); + mutex_lock(&power_supply_class->mutex); list_for_each_entry(dev, &power_supply_class->devices, node) { struct power_supply *pst = dev_get_drvdata(dev); @@ -40,7 +40,7 @@ static void power_supply_changed_work(st pst->external_power_changed(pst); } } - up(&power_supply_class->sem); + mutex_unlock(&power_supply_class->mutex); } power_supply_update_leds(psy); @@ -60,7 +60,7 @@ int power_supply_am_i_supplied(struct po union power_supply_propval ret = {0,}; struct device *dev; - down(&power_supply_class->sem); + mutex_lock(&power_supply_class->mutex); list_for_each_entry(dev, &power_supply_class->devices, node) { struct power_supply *epsy = dev_get_drvdata(dev); int i; @@ -76,7 +76,7 @@ int power_supply_am_i_supplied(struct po } } out: - up(&power_supply_class->sem); + mutex_unlock(&power_supply_class->mutex); dev_dbg(psy->dev, "%s %d\n", __FUNCTION__, ret.intval); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/