···3131 return 0;32323333 ld = container_of(self, struct lcd_device, fb_notif);3434- down(&ld->sem);3434+ mutex_lock(&ld->props_lock);3535 if (ld->props)3636 if (!ld->props->check_fb || ld->props->check_fb(evdata->info))3737 ld->props->set_power(ld, *(int *)evdata->data);3838- up(&ld->sem);3838+ mutex_unlock(&ld->props_lock);3939 return 0;4040}4141···6666 int rc;6767 struct lcd_device *ld = to_lcd_device(cdev);68686969- down(&ld->sem);6969+ mutex_lock(&ld->props_lock);7070 if (ld->props && ld->props->get_power)7171 rc = sprintf(buf, "%d\n", ld->props->get_power(ld));7272 else7373 rc = -ENXIO;7474- up(&ld->sem);7474+ mutex_unlock(&ld->props_lock);75757676 return rc;7777}···8989 if (size != count)9090 return -EINVAL;91919292- down(&ld->sem);9292+ mutex_lock(&ld->props_lock);9393 if (ld->props && ld->props->set_power) {9494 pr_debug("lcd: set power to %d\n", power);9595 ld->props->set_power(ld, power);9696 rc = count;9797 }9898- up(&ld->sem);9898+ mutex_unlock(&ld->props_lock);9999100100 return rc;101101}···105105 int rc = -ENXIO;106106 struct lcd_device *ld = to_lcd_device(cdev);107107108108- down(&ld->sem);108108+ mutex_lock(&ld->props_lock);109109 if (ld->props && ld->props->get_contrast)110110 rc = sprintf(buf, "%d\n", ld->props->get_contrast(ld));111111- up(&ld->sem);111111+ mutex_unlock(&ld->props_lock);112112113113 return rc;114114}···126126 if (size != count)127127 return -EINVAL;128128129129- down(&ld->sem);129129+ mutex_lock(&ld->props_lock);130130 if (ld->props && ld->props->set_contrast) {131131 pr_debug("lcd: set contrast to %d\n", contrast);132132 ld->props->set_contrast(ld, contrast);133133 rc = count;134134 }135135- up(&ld->sem);135135+ mutex_unlock(&ld->props_lock);136136137137 return rc;138138}···142142 int rc = -ENXIO;143143 struct lcd_device *ld = to_lcd_device(cdev);144144145145- down(&ld->sem);145145+ mutex_lock(&ld->props_lock);146146 if (ld->props)147147 rc = sprintf(buf, "%d\n", ld->props->max_contrast);148148- up(&ld->sem);148148+ mutex_unlock(&ld->props_lock);149149150150 return rc;151151}···197197 if (!new_ld)198198 return ERR_PTR(-ENOMEM);199199200200- init_MUTEX(&new_ld->sem);200200+ mutex_init(&new_ld->props_lock);201201 mutex_init(&new_ld->update_lock);202202 new_ld->props = lp;203203 memset(&new_ld->class_dev, 0, sizeof(new_ld->class_dev));···253253 class_device_remove_file(&ld->class_dev,254254 &lcd_class_device_attributes[i]);255255256256- down(&ld->sem);256256+ mutex_lock(&ld->props_lock);257257 ld->props = NULL;258258- up(&ld->sem);258258+ mutex_unlock(&ld->props_lock);259259 lcd_unregister_fb(ld);260260 class_device_unregister(&ld->class_dev);261261}
+3-3
include/linux/backlight.h
···14141515/* Notes on locking:1616 *1717- * backlight_device->sem is an internal backlight lock protecting the props1818- * field and no code outside the core should need to touch it.1717+ * backlight_device->props_lock is an internal backlight lock protecting the1818+ * props field and no code outside the core should need to touch it.1919 *2020 * Access to update_status() is serialised by the update_lock mutex since2121 * most drivers seem to need this and historically get it wrong.···5757 /* This protects the 'props' field. If 'props' is NULL, the driver that5858 registered this device has been unloaded, and if class_get_devdata()5959 points to something in the body of that driver, it is also invalid. */6060- struct semaphore sem;6060+ struct mutex props_lock;6161 /* If this is NULL, the backing module is unloaded */6262 struct backlight_properties *props;6363 /* Serialise access to update_status method */
+2-2
include/linux/lcd.h
···14141515/* Notes on locking:1616 *1717- * lcd_device->sem is an internal backlight lock protecting the props1717+ * lcd_device->props_lock is an internal backlight lock protecting the props1818 * field and no code outside the core should need to touch it.1919 *2020 * Access to set_power() is serialised by the update_lock mutex since···5252 /* This protects the 'props' field. If 'props' is NULL, the driver that5353 registered this device has been unloaded, and if class_get_devdata()5454 points to something in the body of that driver, it is also invalid. */5555- struct semaphore sem;5555+ struct mutex props_lock;5656 /* If this is NULL, the backing module is unloaded */5757 struct lcd_properties *props;5858 /* Serialise access to set_power method */