diff options
author | Dmitry Torokhov <dtor@mail.ru> | 2007-02-07 19:12:28 -0500 |
---|---|---|
committer | Richard Purdie <rpurdie@rpsys.net> | 2007-02-20 03:38:44 -0500 |
commit | 90968e8ebc4611896ff7f2ef0c0bf8455e845cd1 (patch) | |
tree | b2b59bb46bf1118f7283145953c494c5164534d0 /drivers/video/backlight/backlight.c | |
parent | dfcba200679dc3f62212154b65b40b835ce69ab7 (diff) |
backlight: Remove excessive (un)likelys
Remove excessive numbers of (un)likely()s in the backlight core.
There are no hot paths in this code so rely on compiler to do
the right thing.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Diffstat (limited to 'drivers/video/backlight/backlight.c')
-rw-r--r-- | drivers/video/backlight/backlight.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index 71056f8b621a..7a85be4d2b0a 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c | |||
@@ -37,7 +37,7 @@ static int fb_notifier_callback(struct notifier_block *self, | |||
37 | if (!bd->props->check_fb || | 37 | if (!bd->props->check_fb || |
38 | bd->props->check_fb(evdata->info)) { | 38 | bd->props->check_fb(evdata->info)) { |
39 | bd->props->fb_blank = *(int *)evdata->data; | 39 | bd->props->fb_blank = *(int *)evdata->data; |
40 | if (likely(bd->props && bd->props->update_status)) | 40 | if (bd->props && bd->props->update_status) |
41 | bd->props->update_status(bd); | 41 | bd->props->update_status(bd); |
42 | } | 42 | } |
43 | up(&bd->sem); | 43 | up(&bd->sem); |
@@ -73,7 +73,7 @@ static ssize_t backlight_show_power(struct class_device *cdev, char *buf) | |||
73 | struct backlight_device *bd = to_backlight_device(cdev); | 73 | struct backlight_device *bd = to_backlight_device(cdev); |
74 | 74 | ||
75 | down(&bd->sem); | 75 | down(&bd->sem); |
76 | if (likely(bd->props)) | 76 | if (bd->props) |
77 | rc = sprintf(buf, "%d\n", bd->props->power); | 77 | rc = sprintf(buf, "%d\n", bd->props->power); |
78 | up(&bd->sem); | 78 | up(&bd->sem); |
79 | 79 | ||
@@ -94,10 +94,10 @@ static ssize_t backlight_store_power(struct class_device *cdev, const char *buf, | |||
94 | return -EINVAL; | 94 | return -EINVAL; |
95 | 95 | ||
96 | down(&bd->sem); | 96 | down(&bd->sem); |
97 | if (likely(bd->props)) { | 97 | if (bd->props) { |
98 | pr_debug("backlight: set power to %d\n", power); | 98 | pr_debug("backlight: set power to %d\n", power); |
99 | bd->props->power = power; | 99 | bd->props->power = power; |
100 | if (likely(bd->props->update_status)) | 100 | if (bd->props->update_status) |
101 | bd->props->update_status(bd); | 101 | bd->props->update_status(bd); |
102 | rc = count; | 102 | rc = count; |
103 | } | 103 | } |
@@ -112,7 +112,7 @@ static ssize_t backlight_show_brightness(struct class_device *cdev, char *buf) | |||
112 | struct backlight_device *bd = to_backlight_device(cdev); | 112 | struct backlight_device *bd = to_backlight_device(cdev); |
113 | 113 | ||
114 | down(&bd->sem); | 114 | down(&bd->sem); |
115 | if (likely(bd->props)) | 115 | if (bd->props) |
116 | rc = sprintf(buf, "%d\n", bd->props->brightness); | 116 | rc = sprintf(buf, "%d\n", bd->props->brightness); |
117 | up(&bd->sem); | 117 | up(&bd->sem); |
118 | 118 | ||
@@ -133,14 +133,14 @@ static ssize_t backlight_store_brightness(struct class_device *cdev, const char | |||
133 | return -EINVAL; | 133 | return -EINVAL; |
134 | 134 | ||
135 | down(&bd->sem); | 135 | down(&bd->sem); |
136 | if (likely(bd->props)) { | 136 | if (bd->props) { |
137 | if (brightness > bd->props->max_brightness) | 137 | if (brightness > bd->props->max_brightness) |
138 | rc = -EINVAL; | 138 | rc = -EINVAL; |
139 | else { | 139 | else { |
140 | pr_debug("backlight: set brightness to %d\n", | 140 | pr_debug("backlight: set brightness to %d\n", |
141 | brightness); | 141 | brightness); |
142 | bd->props->brightness = brightness; | 142 | bd->props->brightness = brightness; |
143 | if (likely(bd->props->update_status)) | 143 | if (bd->props->update_status) |
144 | bd->props->update_status(bd); | 144 | bd->props->update_status(bd); |
145 | rc = count; | 145 | rc = count; |
146 | } | 146 | } |
@@ -156,7 +156,7 @@ static ssize_t backlight_show_max_brightness(struct class_device *cdev, char *bu | |||
156 | struct backlight_device *bd = to_backlight_device(cdev); | 156 | struct backlight_device *bd = to_backlight_device(cdev); |
157 | 157 | ||
158 | down(&bd->sem); | 158 | down(&bd->sem); |
159 | if (likely(bd->props)) | 159 | if (bd->props) |
160 | rc = sprintf(buf, "%d\n", bd->props->max_brightness); | 160 | rc = sprintf(buf, "%d\n", bd->props->max_brightness); |
161 | up(&bd->sem); | 161 | up(&bd->sem); |
162 | 162 | ||
@@ -170,7 +170,7 @@ static ssize_t backlight_show_actual_brightness(struct class_device *cdev, | |||
170 | struct backlight_device *bd = to_backlight_device(cdev); | 170 | struct backlight_device *bd = to_backlight_device(cdev); |
171 | 171 | ||
172 | down(&bd->sem); | 172 | down(&bd->sem); |
173 | if (likely(bd->props && bd->props->get_brightness)) | 173 | if (bd->props && bd->props->get_brightness) |
174 | rc = sprintf(buf, "%d\n", bd->props->get_brightness(bd)); | 174 | rc = sprintf(buf, "%d\n", bd->props->get_brightness(bd)); |
175 | up(&bd->sem); | 175 | up(&bd->sem); |
176 | 176 | ||
@@ -227,7 +227,7 @@ struct backlight_device *backlight_device_register(const char *name, | |||
227 | pr_debug("backlight_device_alloc: name=%s\n", name); | 227 | pr_debug("backlight_device_alloc: name=%s\n", name); |
228 | 228 | ||
229 | new_bd = kmalloc(sizeof(struct backlight_device), GFP_KERNEL); | 229 | new_bd = kmalloc(sizeof(struct backlight_device), GFP_KERNEL); |
230 | if (unlikely(!new_bd)) | 230 | if (!new_bd) |
231 | return ERR_PTR(-ENOMEM); | 231 | return ERR_PTR(-ENOMEM); |
232 | 232 | ||
233 | init_MUTEX(&new_bd->sem); | 233 | init_MUTEX(&new_bd->sem); |
@@ -239,7 +239,7 @@ struct backlight_device *backlight_device_register(const char *name, | |||
239 | class_set_devdata(&new_bd->class_dev, devdata); | 239 | class_set_devdata(&new_bd->class_dev, devdata); |
240 | 240 | ||
241 | rc = class_device_register(&new_bd->class_dev); | 241 | rc = class_device_register(&new_bd->class_dev); |
242 | if (unlikely(rc)) { | 242 | if (rc) { |
243 | kfree(new_bd); | 243 | kfree(new_bd); |
244 | return ERR_PTR(rc); | 244 | return ERR_PTR(rc); |
245 | } | 245 | } |
@@ -254,7 +254,7 @@ struct backlight_device *backlight_device_register(const char *name, | |||
254 | for (i = 0; i < ARRAY_SIZE(bl_class_device_attributes); i++) { | 254 | for (i = 0; i < ARRAY_SIZE(bl_class_device_attributes); i++) { |
255 | rc = class_device_create_file(&new_bd->class_dev, | 255 | rc = class_device_create_file(&new_bd->class_dev, |
256 | &bl_class_device_attributes[i]); | 256 | &bl_class_device_attributes[i]); |
257 | if (unlikely(rc)) { | 257 | if (rc) { |
258 | while (--i >= 0) | 258 | while (--i >= 0) |
259 | class_device_remove_file(&new_bd->class_dev, | 259 | class_device_remove_file(&new_bd->class_dev, |
260 | &bl_class_device_attributes[i]); | 260 | &bl_class_device_attributes[i]); |