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/lcd.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/lcd.c')
-rw-r--r-- | drivers/video/backlight/lcd.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c index f95f0e33101d..959024812abc 100644 --- a/drivers/video/backlight/lcd.c +++ b/drivers/video/backlight/lcd.c | |||
@@ -67,7 +67,7 @@ static ssize_t lcd_show_power(struct class_device *cdev, char *buf) | |||
67 | struct lcd_device *ld = to_lcd_device(cdev); | 67 | struct lcd_device *ld = to_lcd_device(cdev); |
68 | 68 | ||
69 | down(&ld->sem); | 69 | down(&ld->sem); |
70 | if (likely(ld->props && ld->props->get_power)) | 70 | if (ld->props && ld->props->get_power) |
71 | rc = sprintf(buf, "%d\n", ld->props->get_power(ld)); | 71 | rc = sprintf(buf, "%d\n", ld->props->get_power(ld)); |
72 | else | 72 | else |
73 | rc = -ENXIO; | 73 | rc = -ENXIO; |
@@ -90,7 +90,7 @@ static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_ | |||
90 | return -EINVAL; | 90 | return -EINVAL; |
91 | 91 | ||
92 | down(&ld->sem); | 92 | down(&ld->sem); |
93 | if (likely(ld->props && ld->props->set_power)) { | 93 | if (ld->props && ld->props->set_power) { |
94 | pr_debug("lcd: set power to %d\n", power); | 94 | pr_debug("lcd: set power to %d\n", power); |
95 | ld->props->set_power(ld, power); | 95 | ld->props->set_power(ld, power); |
96 | rc = count; | 96 | rc = count; |
@@ -106,7 +106,7 @@ static ssize_t lcd_show_contrast(struct class_device *cdev, char *buf) | |||
106 | struct lcd_device *ld = to_lcd_device(cdev); | 106 | struct lcd_device *ld = to_lcd_device(cdev); |
107 | 107 | ||
108 | down(&ld->sem); | 108 | down(&ld->sem); |
109 | if (likely(ld->props && ld->props->get_contrast)) | 109 | if (ld->props && ld->props->get_contrast) |
110 | rc = sprintf(buf, "%d\n", ld->props->get_contrast(ld)); | 110 | rc = sprintf(buf, "%d\n", ld->props->get_contrast(ld)); |
111 | up(&ld->sem); | 111 | up(&ld->sem); |
112 | 112 | ||
@@ -127,7 +127,7 @@ static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, si | |||
127 | return -EINVAL; | 127 | return -EINVAL; |
128 | 128 | ||
129 | down(&ld->sem); | 129 | down(&ld->sem); |
130 | if (likely(ld->props && ld->props->set_contrast)) { | 130 | if (ld->props && ld->props->set_contrast) { |
131 | pr_debug("lcd: set contrast to %d\n", contrast); | 131 | pr_debug("lcd: set contrast to %d\n", contrast); |
132 | ld->props->set_contrast(ld, contrast); | 132 | ld->props->set_contrast(ld, contrast); |
133 | rc = count; | 133 | rc = count; |
@@ -143,7 +143,7 @@ static ssize_t lcd_show_max_contrast(struct class_device *cdev, char *buf) | |||
143 | struct lcd_device *ld = to_lcd_device(cdev); | 143 | struct lcd_device *ld = to_lcd_device(cdev); |
144 | 144 | ||
145 | down(&ld->sem); | 145 | down(&ld->sem); |
146 | if (likely(ld->props)) | 146 | if (ld->props) |
147 | rc = sprintf(buf, "%d\n", ld->props->max_contrast); | 147 | rc = sprintf(buf, "%d\n", ld->props->max_contrast); |
148 | up(&ld->sem); | 148 | up(&ld->sem); |
149 | 149 | ||
@@ -194,7 +194,7 @@ struct lcd_device *lcd_device_register(const char *name, void *devdata, | |||
194 | pr_debug("lcd_device_register: name=%s\n", name); | 194 | pr_debug("lcd_device_register: name=%s\n", name); |
195 | 195 | ||
196 | new_ld = kmalloc(sizeof(struct lcd_device), GFP_KERNEL); | 196 | new_ld = kmalloc(sizeof(struct lcd_device), GFP_KERNEL); |
197 | if (unlikely(!new_ld)) | 197 | if (!new_ld) |
198 | return ERR_PTR(-ENOMEM); | 198 | return ERR_PTR(-ENOMEM); |
199 | 199 | ||
200 | init_MUTEX(&new_ld->sem); | 200 | init_MUTEX(&new_ld->sem); |
@@ -205,7 +205,7 @@ struct lcd_device *lcd_device_register(const char *name, void *devdata, | |||
205 | class_set_devdata(&new_ld->class_dev, devdata); | 205 | class_set_devdata(&new_ld->class_dev, devdata); |
206 | 206 | ||
207 | rc = class_device_register(&new_ld->class_dev); | 207 | rc = class_device_register(&new_ld->class_dev); |
208 | if (unlikely(rc)) { | 208 | if (rc) { |
209 | kfree(new_ld); | 209 | kfree(new_ld); |
210 | return ERR_PTR(rc); | 210 | return ERR_PTR(rc); |
211 | } | 211 | } |
@@ -219,7 +219,7 @@ struct lcd_device *lcd_device_register(const char *name, void *devdata, | |||
219 | for (i = 0; i < ARRAY_SIZE(lcd_class_device_attributes); i++) { | 219 | for (i = 0; i < ARRAY_SIZE(lcd_class_device_attributes); i++) { |
220 | rc = class_device_create_file(&new_ld->class_dev, | 220 | rc = class_device_create_file(&new_ld->class_dev, |
221 | &lcd_class_device_attributes[i]); | 221 | &lcd_class_device_attributes[i]); |
222 | if (unlikely(rc)) { | 222 | if (rc) { |
223 | while (--i >= 0) | 223 | while (--i >= 0) |
224 | class_device_remove_file(&new_ld->class_dev, | 224 | class_device_remove_file(&new_ld->class_dev, |
225 | &lcd_class_device_attributes[i]); | 225 | &lcd_class_device_attributes[i]); |