@@ -32,14 +32,14 @@ static int fb_notifier_callback(struct notifier_block *self,
3232 return 0 ;
3333
3434 bd = container_of (self , struct backlight_device , fb_notif );
35- down (& bd -> sem );
35+ mutex_lock (& bd -> props_lock );
3636 if (bd -> props )
3737 if (!bd -> props -> check_fb ||
3838 bd -> props -> check_fb (evdata -> info )) {
3939 bd -> props -> fb_blank = * (int * )evdata -> data ;
4040 backlight_update_status (bd );
4141 }
42- up (& bd -> sem );
42+ mutex_unlock (& bd -> props_lock );
4343 return 0 ;
4444}
4545
@@ -71,10 +71,10 @@ static ssize_t backlight_show_power(struct class_device *cdev, char *buf)
7171 int rc = - ENXIO ;
7272 struct backlight_device * bd = to_backlight_device (cdev );
7373
74- down (& bd -> sem );
74+ mutex_lock (& bd -> props_lock );
7575 if (bd -> props )
7676 rc = sprintf (buf , "%d\n" , bd -> props -> power );
77- up (& bd -> sem );
77+ mutex_unlock (& bd -> props_lock );
7878
7979 return rc ;
8080}
@@ -92,14 +92,14 @@ static ssize_t backlight_store_power(struct class_device *cdev, const char *buf,
9292 if (size != count )
9393 return - EINVAL ;
9494
95- down (& bd -> sem );
95+ mutex_lock (& bd -> props_lock );
9696 if (bd -> props ) {
9797 pr_debug ("backlight: set power to %d\n" , power );
9898 bd -> props -> power = power ;
9999 backlight_update_status (bd );
100100 rc = count ;
101101 }
102- up (& bd -> sem );
102+ mutex_unlock (& bd -> props_lock );
103103
104104 return rc ;
105105}
@@ -109,10 +109,10 @@ static ssize_t backlight_show_brightness(struct class_device *cdev, char *buf)
109109 int rc = - ENXIO ;
110110 struct backlight_device * bd = to_backlight_device (cdev );
111111
112- down (& bd -> sem );
112+ mutex_lock (& bd -> props_lock );
113113 if (bd -> props )
114114 rc = sprintf (buf , "%d\n" , bd -> props -> brightness );
115- up (& bd -> sem );
115+ mutex_unlock (& bd -> props_lock );
116116
117117 return rc ;
118118}
@@ -130,7 +130,7 @@ static ssize_t backlight_store_brightness(struct class_device *cdev, const char
130130 if (size != count )
131131 return - EINVAL ;
132132
133- down (& bd -> sem );
133+ mutex_lock (& bd -> props_lock );
134134 if (bd -> props ) {
135135 if (brightness > bd -> props -> max_brightness )
136136 rc = - EINVAL ;
@@ -142,7 +142,7 @@ static ssize_t backlight_store_brightness(struct class_device *cdev, const char
142142 rc = count ;
143143 }
144144 }
145- up (& bd -> sem );
145+ mutex_unlock (& bd -> props_lock );
146146
147147 return rc ;
148148}
@@ -152,10 +152,10 @@ static ssize_t backlight_show_max_brightness(struct class_device *cdev, char *bu
152152 int rc = - ENXIO ;
153153 struct backlight_device * bd = to_backlight_device (cdev );
154154
155- down (& bd -> sem );
155+ mutex_lock (& bd -> props_lock );
156156 if (bd -> props )
157157 rc = sprintf (buf , "%d\n" , bd -> props -> max_brightness );
158- up (& bd -> sem );
158+ mutex_unlock (& bd -> props_lock );
159159
160160 return rc ;
161161}
@@ -166,10 +166,10 @@ static ssize_t backlight_show_actual_brightness(struct class_device *cdev,
166166 int rc = - ENXIO ;
167167 struct backlight_device * bd = to_backlight_device (cdev );
168168
169- down (& bd -> sem );
169+ mutex_lock (& bd -> props_lock );
170170 if (bd -> props && bd -> props -> get_brightness )
171171 rc = sprintf (buf , "%d\n" , bd -> props -> get_brightness (bd ));
172- up (& bd -> sem );
172+ mutex_unlock (& bd -> props_lock );
173173
174174 return rc ;
175175}
@@ -228,7 +228,7 @@ struct backlight_device *backlight_device_register(const char *name,
228228 return ERR_PTR (- ENOMEM );
229229
230230 mutex_init (& new_bd -> update_lock );
231- init_MUTEX (& new_bd -> sem );
231+ mutex_init (& new_bd -> props_lock );
232232 new_bd -> props = bp ;
233233 memset (& new_bd -> class_dev , 0 , sizeof (new_bd -> class_dev ));
234234 new_bd -> class_dev .class = & backlight_class ;
@@ -285,9 +285,9 @@ void backlight_device_unregister(struct backlight_device *bd)
285285 class_device_remove_file (& bd -> class_dev ,
286286 & bl_class_device_attributes [i ]);
287287
288- down (& bd -> sem );
288+ mutex_lock (& bd -> props_lock );
289289 bd -> props = NULL ;
290- up (& bd -> sem );
290+ mutex_unlock (& bd -> props_lock );
291291
292292 backlight_unregister_fb (bd );
293293
0 commit comments