return 0;
bd = container_of(self, struct backlight_device, fb_notif);
- down(&bd->sem);
+ mutex_lock(&bd->props_lock);
if (bd->props)
if (!bd->props->check_fb ||
bd->props->check_fb(evdata->info)) {
bd->props->fb_blank = *(int *)evdata->data;
backlight_update_status(bd);
}
- up(&bd->sem);
+ mutex_unlock(&bd->props_lock);
return 0;
}
int rc = -ENXIO;
struct backlight_device *bd = to_backlight_device(cdev);
- down(&bd->sem);
+ mutex_lock(&bd->props_lock);
if (bd->props)
rc = sprintf(buf, "%d\n", bd->props->power);
- up(&bd->sem);
+ mutex_unlock(&bd->props_lock);
return rc;
}
if (size != count)
return -EINVAL;
- down(&bd->sem);
+ mutex_lock(&bd->props_lock);
if (bd->props) {
pr_debug("backlight: set power to %d\n", power);
bd->props->power = power;
backlight_update_status(bd);
rc = count;
}
- up(&bd->sem);
+ mutex_unlock(&bd->props_lock);
return rc;
}
int rc = -ENXIO;
struct backlight_device *bd = to_backlight_device(cdev);
- down(&bd->sem);
+ mutex_lock(&bd->props_lock);
if (bd->props)
rc = sprintf(buf, "%d\n", bd->props->brightness);
- up(&bd->sem);
+ mutex_unlock(&bd->props_lock);
return rc;
}
if (size != count)
return -EINVAL;
- down(&bd->sem);
+ mutex_lock(&bd->props_lock);
if (bd->props) {
if (brightness > bd->props->max_brightness)
rc = -EINVAL;
rc = count;
}
}
- up(&bd->sem);
+ mutex_unlock(&bd->props_lock);
return rc;
}
int rc = -ENXIO;
struct backlight_device *bd = to_backlight_device(cdev);
- down(&bd->sem);
+ mutex_lock(&bd->props_lock);
if (bd->props)
rc = sprintf(buf, "%d\n", bd->props->max_brightness);
- up(&bd->sem);
+ mutex_unlock(&bd->props_lock);
return rc;
}
int rc = -ENXIO;
struct backlight_device *bd = to_backlight_device(cdev);
- down(&bd->sem);
+ mutex_lock(&bd->props_lock);
if (bd->props && bd->props->get_brightness)
rc = sprintf(buf, "%d\n", bd->props->get_brightness(bd));
- up(&bd->sem);
+ mutex_unlock(&bd->props_lock);
return rc;
}
return ERR_PTR(-ENOMEM);
mutex_init(&new_bd->update_lock);
- init_MUTEX(&new_bd->sem);
+ mutex_init(&new_bd->props_lock);
new_bd->props = bp;
memset(&new_bd->class_dev, 0, sizeof(new_bd->class_dev));
new_bd->class_dev.class = &backlight_class;
class_device_remove_file(&bd->class_dev,
&bl_class_device_attributes[i]);
- down(&bd->sem);
+ mutex_lock(&bd->props_lock);
bd->props = NULL;
- up(&bd->sem);
+ mutex_unlock(&bd->props_lock);
backlight_unregister_fb(bd);
return 0;
ld = container_of(self, struct lcd_device, fb_notif);
- down(&ld->sem);
+ mutex_lock(&ld->props_lock);
if (ld->props)
if (!ld->props->check_fb || ld->props->check_fb(evdata->info))
ld->props->set_power(ld, *(int *)evdata->data);
- up(&ld->sem);
+ mutex_unlock(&ld->props_lock);
return 0;
}
int rc;
struct lcd_device *ld = to_lcd_device(cdev);
- down(&ld->sem);
+ mutex_lock(&ld->props_lock);
if (ld->props && ld->props->get_power)
rc = sprintf(buf, "%d\n", ld->props->get_power(ld));
else
rc = -ENXIO;
- up(&ld->sem);
+ mutex_unlock(&ld->props_lock);
return rc;
}
if (size != count)
return -EINVAL;
- down(&ld->sem);
+ mutex_lock(&ld->props_lock);
if (ld->props && ld->props->set_power) {
pr_debug("lcd: set power to %d\n", power);
ld->props->set_power(ld, power);
rc = count;
}
- up(&ld->sem);
+ mutex_unlock(&ld->props_lock);
return rc;
}
int rc = -ENXIO;
struct lcd_device *ld = to_lcd_device(cdev);
- down(&ld->sem);
+ mutex_lock(&ld->props_lock);
if (ld->props && ld->props->get_contrast)
rc = sprintf(buf, "%d\n", ld->props->get_contrast(ld));
- up(&ld->sem);
+ mutex_unlock(&ld->props_lock);
return rc;
}
if (size != count)
return -EINVAL;
- down(&ld->sem);
+ mutex_lock(&ld->props_lock);
if (ld->props && ld->props->set_contrast) {
pr_debug("lcd: set contrast to %d\n", contrast);
ld->props->set_contrast(ld, contrast);
rc = count;
}
- up(&ld->sem);
+ mutex_unlock(&ld->props_lock);
return rc;
}
int rc = -ENXIO;
struct lcd_device *ld = to_lcd_device(cdev);
- down(&ld->sem);
+ mutex_lock(&ld->props_lock);
if (ld->props)
rc = sprintf(buf, "%d\n", ld->props->max_contrast);
- up(&ld->sem);
+ mutex_unlock(&ld->props_lock);
return rc;
}
if (!new_ld)
return ERR_PTR(-ENOMEM);
- init_MUTEX(&new_ld->sem);
+ mutex_init(&new_ld->props_lock);
mutex_init(&new_ld->update_lock);
new_ld->props = lp;
memset(&new_ld->class_dev, 0, sizeof(new_ld->class_dev));
class_device_remove_file(&ld->class_dev,
&lcd_class_device_attributes[i]);
- down(&ld->sem);
+ mutex_lock(&ld->props_lock);
ld->props = NULL;
- up(&ld->sem);
+ mutex_unlock(&ld->props_lock);
lcd_unregister_fb(ld);
class_device_unregister(&ld->class_dev);
}
/* Notes on locking:
*
- * backlight_device->sem is an internal backlight lock protecting the props
- * field and no code outside the core should need to touch it.
+ * backlight_device->props_lock is an internal backlight lock protecting the
+ * props field and no code outside the core should need to touch it.
*
* Access to update_status() is serialised by the update_lock mutex since
* most drivers seem to need this and historically get it wrong.
/* This protects the 'props' field. If 'props' is NULL, the driver that
registered this device has been unloaded, and if class_get_devdata()
points to something in the body of that driver, it is also invalid. */
- struct semaphore sem;
+ struct mutex props_lock;
/* If this is NULL, the backing module is unloaded */
struct backlight_properties *props;
/* Serialise access to update_status method */
/* Notes on locking:
*
- * lcd_device->sem is an internal backlight lock protecting the props
+ * lcd_device->props_lock is an internal backlight lock protecting the props
* field and no code outside the core should need to touch it.
*
* Access to set_power() is serialised by the update_lock mutex since
/* This protects the 'props' field. If 'props' is NULL, the driver that
registered this device has been unloaded, and if class_get_devdata()
points to something in the body of that driver, it is also invalid. */
- struct semaphore sem;
+ struct mutex props_lock;
/* If this is NULL, the backing module is unloaded */
struct lcd_properties *props;
/* Serialise access to set_power method */