aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/backlight
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@rpsys.net>2007-02-10 18:07:48 -0500
committerRichard Purdie <rpurdie@rpsys.net>2007-02-20 04:26:53 -0500
commit599a52d12629394236d785615808845823875868 (patch)
tree4e2dfa3a25ce761be0ecc0490acabac553f77a67 /drivers/video/backlight
parent321709c5994f952b78d567fd7083dbebbdc381b7 (diff)
backlight: Separate backlight properties from backlight ops pointers
Per device data such as brightness belongs to the indivdual device and should therefore be separate from the the backlight operation function pointers. This patch splits the two types of data and allows simplifcation of some code. Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Diffstat (limited to 'drivers/video/backlight')
-rw-r--r--drivers/video/backlight/backlight.c79
-rw-r--r--drivers/video/backlight/corgi_bl.c16
-rw-r--r--drivers/video/backlight/hp680_bl.c14
-rw-r--r--drivers/video/backlight/lcd.c67
-rw-r--r--drivers/video/backlight/locomolcd.c12
-rw-r--r--drivers/video/backlight/progear_bl.c16
6 files changed, 89 insertions, 115 deletions
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index 822a373d3346..c65e81ff3578 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -35,14 +35,14 @@ static int fb_notifier_callback(struct notifier_block *self,
35 return 0; 35 return 0;
36 36
37 bd = container_of(self, struct backlight_device, fb_notif); 37 bd = container_of(self, struct backlight_device, fb_notif);
38 mutex_lock(&bd->props_lock); 38 mutex_lock(&bd->ops_lock);
39 if (bd->props) 39 if (bd->ops)
40 if (!bd->props->check_fb || 40 if (!bd->ops->check_fb ||
41 bd->props->check_fb(evdata->info)) { 41 bd->ops->check_fb(evdata->info)) {
42 bd->props->fb_blank = *(int *)evdata->data; 42 bd->props.fb_blank = *(int *)evdata->data;
43 backlight_update_status(bd); 43 backlight_update_status(bd);
44 } 44 }
45 mutex_unlock(&bd->props_lock); 45 mutex_unlock(&bd->ops_lock);
46 return 0; 46 return 0;
47} 47}
48 48
@@ -71,15 +71,9 @@ static inline void backlight_unregister_fb(struct backlight_device *bd)
71 71
72static ssize_t backlight_show_power(struct class_device *cdev, char *buf) 72static ssize_t backlight_show_power(struct class_device *cdev, char *buf)
73{ 73{
74 int rc = -ENXIO;
75 struct backlight_device *bd = to_backlight_device(cdev); 74 struct backlight_device *bd = to_backlight_device(cdev);
76 75
77 mutex_lock(&bd->props_lock); 76 return sprintf(buf, "%d\n", bd->props.power);
78 if (bd->props)
79 rc = sprintf(buf, "%d\n", bd->props->power);
80 mutex_unlock(&bd->props_lock);
81
82 return rc;
83} 77}
84 78
85static ssize_t backlight_store_power(struct class_device *cdev, const char *buf, size_t count) 79static ssize_t backlight_store_power(struct class_device *cdev, const char *buf, size_t count)
@@ -95,29 +89,23 @@ static ssize_t backlight_store_power(struct class_device *cdev, const char *buf,
95 if (size != count) 89 if (size != count)
96 return -EINVAL; 90 return -EINVAL;
97 91
98 mutex_lock(&bd->props_lock); 92 mutex_lock(&bd->ops_lock);
99 if (bd->props) { 93 if (bd->ops) {
100 pr_debug("backlight: set power to %d\n", power); 94 pr_debug("backlight: set power to %d\n", power);
101 bd->props->power = power; 95 bd->props.power = power;
102 backlight_update_status(bd); 96 backlight_update_status(bd);
103 rc = count; 97 rc = count;
104 } 98 }
105 mutex_unlock(&bd->props_lock); 99 mutex_unlock(&bd->ops_lock);
106 100
107 return rc; 101 return rc;
108} 102}
109 103
110static ssize_t backlight_show_brightness(struct class_device *cdev, char *buf) 104static ssize_t backlight_show_brightness(struct class_device *cdev, char *buf)
111{ 105{
112 int rc = -ENXIO;
113 struct backlight_device *bd = to_backlight_device(cdev); 106 struct backlight_device *bd = to_backlight_device(cdev);
114 107
115 mutex_lock(&bd->props_lock); 108 return sprintf(buf, "%d\n", bd->props.brightness);
116 if (bd->props)
117 rc = sprintf(buf, "%d\n", bd->props->brightness);
118 mutex_unlock(&bd->props_lock);
119
120 return rc;
121} 109}
122 110
123static ssize_t backlight_store_brightness(struct class_device *cdev, const char *buf, size_t count) 111static ssize_t backlight_store_brightness(struct class_device *cdev, const char *buf, size_t count)
@@ -133,34 +121,28 @@ static ssize_t backlight_store_brightness(struct class_device *cdev, const char
133 if (size != count) 121 if (size != count)
134 return -EINVAL; 122 return -EINVAL;
135 123
136 mutex_lock(&bd->props_lock); 124 mutex_lock(&bd->ops_lock);
137 if (bd->props) { 125 if (bd->ops) {
138 if (brightness > bd->props->max_brightness) 126 if (brightness > bd->props.max_brightness)
139 rc = -EINVAL; 127 rc = -EINVAL;
140 else { 128 else {
141 pr_debug("backlight: set brightness to %d\n", 129 pr_debug("backlight: set brightness to %d\n",
142 brightness); 130 brightness);
143 bd->props->brightness = brightness; 131 bd->props.brightness = brightness;
144 backlight_update_status(bd); 132 backlight_update_status(bd);
145 rc = count; 133 rc = count;
146 } 134 }
147 } 135 }
148 mutex_unlock(&bd->props_lock); 136 mutex_unlock(&bd->ops_lock);
149 137
150 return rc; 138 return rc;
151} 139}
152 140
153static ssize_t backlight_show_max_brightness(struct class_device *cdev, char *buf) 141static ssize_t backlight_show_max_brightness(struct class_device *cdev, char *buf)
154{ 142{
155 int rc = -ENXIO;
156 struct backlight_device *bd = to_backlight_device(cdev); 143 struct backlight_device *bd = to_backlight_device(cdev);
157 144
158 mutex_lock(&bd->props_lock); 145 return sprintf(buf, "%d\n", bd->props.max_brightness);
159 if (bd->props)
160 rc = sprintf(buf, "%d\n", bd->props->max_brightness);
161 mutex_unlock(&bd->props_lock);
162
163 return rc;
164} 146}
165 147
166static ssize_t backlight_show_actual_brightness(struct class_device *cdev, 148static ssize_t backlight_show_actual_brightness(struct class_device *cdev,
@@ -169,10 +151,10 @@ static ssize_t backlight_show_actual_brightness(struct class_device *cdev,
169 int rc = -ENXIO; 151 int rc = -ENXIO;
170 struct backlight_device *bd = to_backlight_device(cdev); 152 struct backlight_device *bd = to_backlight_device(cdev);
171 153
172 mutex_lock(&bd->props_lock); 154 mutex_lock(&bd->ops_lock);
173 if (bd->props && bd->props->get_brightness) 155 if (bd->ops && bd->ops->get_brightness)
174 rc = sprintf(buf, "%d\n", bd->props->get_brightness(bd)); 156 rc = sprintf(buf, "%d\n", bd->ops->get_brightness(bd));
175 mutex_unlock(&bd->props_lock); 157 mutex_unlock(&bd->ops_lock);
176 158
177 return rc; 159 return rc;
178} 160}
@@ -211,7 +193,7 @@ static const struct class_device_attribute bl_class_device_attributes[] = {
211 * respective framebuffer device). 193 * respective framebuffer device).
212 * @devdata: an optional pointer to be stored in the class_device. The 194 * @devdata: an optional pointer to be stored in the class_device. The
213 * methods may retrieve it by using class_get_devdata(&bd->class_dev). 195 * methods may retrieve it by using class_get_devdata(&bd->class_dev).
214 * @bp: the backlight properties structure. 196 * @ops: the backlight operations structure.
215 * 197 *
216 * Creates and registers new backlight class_device. Returns either an 198 * Creates and registers new backlight class_device. Returns either an
217 * ERR_PTR() or a pointer to the newly allocated device. 199 * ERR_PTR() or a pointer to the newly allocated device.
@@ -219,21 +201,20 @@ static const struct class_device_attribute bl_class_device_attributes[] = {
219struct backlight_device *backlight_device_register(const char *name, 201struct backlight_device *backlight_device_register(const char *name,
220 struct device *dev, 202 struct device *dev,
221 void *devdata, 203 void *devdata,
222 struct backlight_properties *bp) 204 struct backlight_ops *ops)
223{ 205{
224 int i, rc; 206 int i, rc;
225 struct backlight_device *new_bd; 207 struct backlight_device *new_bd;
226 208
227 pr_debug("backlight_device_alloc: name=%s\n", name); 209 pr_debug("backlight_device_alloc: name=%s\n", name);
228 210
229 new_bd = kmalloc(sizeof(struct backlight_device), GFP_KERNEL); 211 new_bd = kzalloc(sizeof(struct backlight_device), GFP_KERNEL);
230 if (!new_bd) 212 if (!new_bd)
231 return ERR_PTR(-ENOMEM); 213 return ERR_PTR(-ENOMEM);
232 214
233 mutex_init(&new_bd->update_lock); 215 mutex_init(&new_bd->update_lock);
234 mutex_init(&new_bd->props_lock); 216 mutex_init(&new_bd->ops_lock);
235 new_bd->props = bp; 217 new_bd->ops = ops;
236 memset(&new_bd->class_dev, 0, sizeof(new_bd->class_dev));
237 new_bd->class_dev.class = &backlight_class; 218 new_bd->class_dev.class = &backlight_class;
238 new_bd->class_dev.dev = dev; 219 new_bd->class_dev.dev = dev;
239 strlcpy(new_bd->class_dev.class_id, name, KOBJ_NAME_LEN); 220 strlcpy(new_bd->class_dev.class_id, name, KOBJ_NAME_LEN);
@@ -302,9 +283,9 @@ void backlight_device_unregister(struct backlight_device *bd)
302 class_device_remove_file(&bd->class_dev, 283 class_device_remove_file(&bd->class_dev,
303 &bl_class_device_attributes[i]); 284 &bl_class_device_attributes[i]);
304 285
305 mutex_lock(&bd->props_lock); 286 mutex_lock(&bd->ops_lock);
306 bd->props = NULL; 287 bd->ops = NULL;
307 mutex_unlock(&bd->props_lock); 288 mutex_unlock(&bd->ops_lock);
308 289
309 backlight_unregister_fb(bd); 290 backlight_unregister_fb(bd);
310 291
diff --git a/drivers/video/backlight/corgi_bl.c b/drivers/video/backlight/corgi_bl.c
index c1eba0e8a1b0..05f36811ac95 100644
--- a/drivers/video/backlight/corgi_bl.c
+++ b/drivers/video/backlight/corgi_bl.c
@@ -34,11 +34,11 @@ static unsigned long corgibl_flags;
34static int corgibl_send_intensity(struct backlight_device *bd) 34static int corgibl_send_intensity(struct backlight_device *bd)
35{ 35{
36 void (*corgi_kick_batt)(void); 36 void (*corgi_kick_batt)(void);
37 int intensity = bd->props->brightness; 37 int intensity = bd->props.brightness;
38 38
39 if (bd->props->power != FB_BLANK_UNBLANK) 39 if (bd->props.power != FB_BLANK_UNBLANK)
40 intensity = 0; 40 intensity = 0;
41 if (bd->props->fb_blank != FB_BLANK_UNBLANK) 41 if (bd->props.fb_blank != FB_BLANK_UNBLANK)
42 intensity = 0; 42 intensity = 0;
43 if (corgibl_flags & CORGIBL_SUSPENDED) 43 if (corgibl_flags & CORGIBL_SUSPENDED)
44 intensity = 0; 44 intensity = 0;
@@ -103,7 +103,7 @@ void corgibl_limit_intensity(int limit)
103EXPORT_SYMBOL(corgibl_limit_intensity); 103EXPORT_SYMBOL(corgibl_limit_intensity);
104 104
105 105
106static struct backlight_properties corgibl_data = { 106static struct backlight_ops corgibl_ops = {
107 .get_brightness = corgibl_get_intensity, 107 .get_brightness = corgibl_get_intensity,
108 .update_status = corgibl_send_intensity, 108 .update_status = corgibl_send_intensity,
109}; 109};
@@ -113,19 +113,19 @@ static int corgibl_probe(struct platform_device *pdev)
113 struct corgibl_machinfo *machinfo = pdev->dev.platform_data; 113 struct corgibl_machinfo *machinfo = pdev->dev.platform_data;
114 114
115 bl_machinfo = machinfo; 115 bl_machinfo = machinfo;
116 corgibl_data.max_brightness = machinfo->max_intensity;
117 if (!machinfo->limit_mask) 116 if (!machinfo->limit_mask)
118 machinfo->limit_mask = -1; 117 machinfo->limit_mask = -1;
119 118
120 corgi_backlight_device = backlight_device_register ("corgi-bl", 119 corgi_backlight_device = backlight_device_register ("corgi-bl",
121 &pdev->dev, NULL, &corgibl_data); 120 &pdev->dev, NULL, &corgibl_ops);
122 if (IS_ERR (corgi_backlight_device)) 121 if (IS_ERR (corgi_backlight_device))
123 return PTR_ERR (corgi_backlight_device); 122 return PTR_ERR (corgi_backlight_device);
124 123
125 platform_set_drvdata(pdev, corgi_backlight_device); 124 platform_set_drvdata(pdev, corgi_backlight_device);
126 125
127 corgibl_data.power = FB_BLANK_UNBLANK; 126 corgi_backlight_device->props.max_brightness = machinfo->max_intensity;
128 corgibl_data.brightness = machinfo->default_intensity; 127 corgi_backlight_device->props.power = FB_BLANK_UNBLANK;
128 corgi_backlight_device->props.brightness = machinfo->default_intensity;
129 corgibl_send_intensity(corgi_backlight_device); 129 corgibl_send_intensity(corgi_backlight_device);
130 130
131 printk("Corgi Backlight Driver Initialized.\n"); 131 printk("Corgi Backlight Driver Initialized.\n");
diff --git a/drivers/video/backlight/hp680_bl.c b/drivers/video/backlight/hp680_bl.c
index e7444c8f289d..0899fccbd570 100644
--- a/drivers/video/backlight/hp680_bl.c
+++ b/drivers/video/backlight/hp680_bl.c
@@ -33,11 +33,11 @@ static void hp680bl_send_intensity(struct backlight_device *bd)
33{ 33{
34 unsigned long flags; 34 unsigned long flags;
35 u16 v; 35 u16 v;
36 int intensity = bd->props->brightness; 36 int intensity = bd->props.brightness;
37 37
38 if (bd->props->power != FB_BLANK_UNBLANK) 38 if (bd->props.power != FB_BLANK_UNBLANK)
39 intensity = 0; 39 intensity = 0;
40 if (bd->props->fb_blank != FB_BLANK_UNBLANK) 40 if (bd->props.fb_blank != FB_BLANK_UNBLANK)
41 intensity = 0; 41 intensity = 0;
42 if (hp680bl_suspended) 42 if (hp680bl_suspended)
43 intensity = 0; 43 intensity = 0;
@@ -98,8 +98,7 @@ static int hp680bl_get_intensity(struct backlight_device *bd)
98 return current_intensity; 98 return current_intensity;
99} 99}
100 100
101static struct backlight_properties hp680bl_data = { 101static struct backlight_ops hp680bl_ops = {
102 .max_brightness = HP680_MAX_INTENSITY,
103 .get_brightness = hp680bl_get_intensity, 102 .get_brightness = hp680bl_get_intensity,
104 .update_status = hp680bl_set_intensity, 103 .update_status = hp680bl_set_intensity,
105}; 104};
@@ -109,13 +108,14 @@ static int __init hp680bl_probe(struct platform_device *pdev)
109 struct backlight_device *bd; 108 struct backlight_device *bd;
110 109
111 bd = backlight_device_register ("hp680-bl", &pdev->dev, NULL, 110 bd = backlight_device_register ("hp680-bl", &pdev->dev, NULL,
112 &hp680bl_data); 111 &hp680bl_ops);
113 if (IS_ERR(bd)) 112 if (IS_ERR(bd))
114 return PTR_ERR(bd); 113 return PTR_ERR(bd);
115 114
116 platform_set_drvdata(pdev, bd); 115 platform_set_drvdata(pdev, bd);
117 116
118 bd->props->brightness = HP680_DEFAULT_INTENSITY; 117 bd->props.max_brightness = HP680_MAX_INTENSITY;
118 bd->props.brightness = HP680_DEFAULT_INTENSITY;
119 hp680bl_send_intensity(bd); 119 hp680bl_send_intensity(bd);
120 120
121 return 0; 121 return 0;
diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c
index 430ba018a896..6ef8f0a7a137 100644
--- a/drivers/video/backlight/lcd.c
+++ b/drivers/video/backlight/lcd.c
@@ -31,11 +31,11 @@ static int fb_notifier_callback(struct notifier_block *self,
31 return 0; 31 return 0;
32 32
33 ld = container_of(self, struct lcd_device, fb_notif); 33 ld = container_of(self, struct lcd_device, fb_notif);
34 mutex_lock(&ld->props_lock); 34 mutex_lock(&ld->ops_lock);
35 if (ld->props) 35 if (ld->ops)
36 if (!ld->props->check_fb || ld->props->check_fb(evdata->info)) 36 if (!ld->ops->check_fb || ld->ops->check_fb(evdata->info))
37 ld->props->set_power(ld, *(int *)evdata->data); 37 ld->ops->set_power(ld, *(int *)evdata->data);
38 mutex_unlock(&ld->props_lock); 38 mutex_unlock(&ld->ops_lock);
39 return 0; 39 return 0;
40} 40}
41 41
@@ -66,12 +66,12 @@ static ssize_t lcd_show_power(struct class_device *cdev, char *buf)
66 int rc; 66 int rc;
67 struct lcd_device *ld = to_lcd_device(cdev); 67 struct lcd_device *ld = to_lcd_device(cdev);
68 68
69 mutex_lock(&ld->props_lock); 69 mutex_lock(&ld->ops_lock);
70 if (ld->props && ld->props->get_power) 70 if (ld->ops && ld->ops->get_power)
71 rc = sprintf(buf, "%d\n", ld->props->get_power(ld)); 71 rc = sprintf(buf, "%d\n", ld->ops->get_power(ld));
72 else 72 else
73 rc = -ENXIO; 73 rc = -ENXIO;
74 mutex_unlock(&ld->props_lock); 74 mutex_unlock(&ld->ops_lock);
75 75
76 return rc; 76 return rc;
77} 77}
@@ -89,13 +89,13 @@ static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_
89 if (size != count) 89 if (size != count)
90 return -EINVAL; 90 return -EINVAL;
91 91
92 mutex_lock(&ld->props_lock); 92 mutex_lock(&ld->ops_lock);
93 if (ld->props && ld->props->set_power) { 93 if (ld->ops && ld->ops->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->ops->set_power(ld, power);
96 rc = count; 96 rc = count;
97 } 97 }
98 mutex_unlock(&ld->props_lock); 98 mutex_unlock(&ld->ops_lock);
99 99
100 return rc; 100 return rc;
101} 101}
@@ -105,10 +105,10 @@ static ssize_t lcd_show_contrast(struct class_device *cdev, char *buf)
105 int rc = -ENXIO; 105 int rc = -ENXIO;
106 struct lcd_device *ld = to_lcd_device(cdev); 106 struct lcd_device *ld = to_lcd_device(cdev);
107 107
108 mutex_lock(&ld->props_lock); 108 mutex_lock(&ld->ops_lock);
109 if (ld->props && ld->props->get_contrast) 109 if (ld->ops && ld->ops->get_contrast)
110 rc = sprintf(buf, "%d\n", ld->props->get_contrast(ld)); 110 rc = sprintf(buf, "%d\n", ld->ops->get_contrast(ld));
111 mutex_unlock(&ld->props_lock); 111 mutex_unlock(&ld->ops_lock);
112 112
113 return rc; 113 return rc;
114} 114}
@@ -126,28 +126,22 @@ static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, si
126 if (size != count) 126 if (size != count)
127 return -EINVAL; 127 return -EINVAL;
128 128
129 mutex_lock(&ld->props_lock); 129 mutex_lock(&ld->ops_lock);
130 if (ld->props && ld->props->set_contrast) { 130 if (ld->ops && ld->ops->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->ops->set_contrast(ld, contrast);
133 rc = count; 133 rc = count;
134 } 134 }
135 mutex_unlock(&ld->props_lock); 135 mutex_unlock(&ld->ops_lock);
136 136
137 return rc; 137 return rc;
138} 138}
139 139
140static ssize_t lcd_show_max_contrast(struct class_device *cdev, char *buf) 140static ssize_t lcd_show_max_contrast(struct class_device *cdev, char *buf)
141{ 141{
142 int rc = -ENXIO;
143 struct lcd_device *ld = to_lcd_device(cdev); 142 struct lcd_device *ld = to_lcd_device(cdev);
144 143
145 mutex_lock(&ld->props_lock); 144 return sprintf(buf, "%d\n", ld->props.max_contrast);
146 if (ld->props)
147 rc = sprintf(buf, "%d\n", ld->props->max_contrast);
148 mutex_unlock(&ld->props_lock);
149
150 return rc;
151} 145}
152 146
153static void lcd_class_release(struct class_device *dev) 147static void lcd_class_release(struct class_device *dev)
@@ -180,27 +174,26 @@ static const struct class_device_attribute lcd_class_device_attributes[] = {
180 * respective framebuffer device). 174 * respective framebuffer device).
181 * @devdata: an optional pointer to be stored in the class_device. The 175 * @devdata: an optional pointer to be stored in the class_device. The
182 * methods may retrieve it by using class_get_devdata(ld->class_dev). 176 * methods may retrieve it by using class_get_devdata(ld->class_dev).
183 * @lp: the lcd properties structure. 177 * @ops: the lcd operations structure.
184 * 178 *
185 * Creates and registers a new lcd class_device. Returns either an ERR_PTR() 179 * Creates and registers a new lcd class_device. Returns either an ERR_PTR()
186 * or a pointer to the newly allocated device. 180 * or a pointer to the newly allocated device.
187 */ 181 */
188struct lcd_device *lcd_device_register(const char *name, void *devdata, 182struct lcd_device *lcd_device_register(const char *name, void *devdata,
189 struct lcd_properties *lp) 183 struct lcd_ops *ops)
190{ 184{
191 int i, rc; 185 int i, rc;
192 struct lcd_device *new_ld; 186 struct lcd_device *new_ld;
193 187
194 pr_debug("lcd_device_register: name=%s\n", name); 188 pr_debug("lcd_device_register: name=%s\n", name);
195 189
196 new_ld = kmalloc(sizeof(struct lcd_device), GFP_KERNEL); 190 new_ld = kzalloc(sizeof(struct lcd_device), GFP_KERNEL);
197 if (!new_ld) 191 if (!new_ld)
198 return ERR_PTR(-ENOMEM); 192 return ERR_PTR(-ENOMEM);
199 193
200 mutex_init(&new_ld->props_lock); 194 mutex_init(&new_ld->ops_lock);
201 mutex_init(&new_ld->update_lock); 195 mutex_init(&new_ld->update_lock);
202 new_ld->props = lp; 196 new_ld->ops = ops;
203 memset(&new_ld->class_dev, 0, sizeof(new_ld->class_dev));
204 new_ld->class_dev.class = &lcd_class; 197 new_ld->class_dev.class = &lcd_class;
205 strlcpy(new_ld->class_dev.class_id, name, KOBJ_NAME_LEN); 198 strlcpy(new_ld->class_dev.class_id, name, KOBJ_NAME_LEN);
206 class_set_devdata(&new_ld->class_dev, devdata); 199 class_set_devdata(&new_ld->class_dev, devdata);
@@ -253,9 +246,9 @@ void lcd_device_unregister(struct lcd_device *ld)
253 class_device_remove_file(&ld->class_dev, 246 class_device_remove_file(&ld->class_dev,
254 &lcd_class_device_attributes[i]); 247 &lcd_class_device_attributes[i]);
255 248
256 mutex_lock(&ld->props_lock); 249 mutex_lock(&ld->ops_lock);
257 ld->props = NULL; 250 ld->ops = NULL;
258 mutex_unlock(&ld->props_lock); 251 mutex_unlock(&ld->ops_lock);
259 lcd_unregister_fb(ld); 252 lcd_unregister_fb(ld);
260 class_device_unregister(&ld->class_dev); 253 class_device_unregister(&ld->class_dev);
261} 254}
diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c
index 3c5abbf0d042..d1312477813e 100644
--- a/drivers/video/backlight/locomolcd.c
+++ b/drivers/video/backlight/locomolcd.c
@@ -112,11 +112,11 @@ static int current_intensity;
112 112
113static int locomolcd_set_intensity(struct backlight_device *bd) 113static int locomolcd_set_intensity(struct backlight_device *bd)
114{ 114{
115 int intensity = bd->props->brightness; 115 int intensity = bd->props.brightness;
116 116
117 if (bd->props->power != FB_BLANK_UNBLANK) 117 if (bd->props.power != FB_BLANK_UNBLANK)
118 intensity = 0; 118 intensity = 0;
119 if (bd->props->fb_blank != FB_BLANK_UNBLANK) 119 if (bd->props.fb_blank != FB_BLANK_UNBLANK)
120 intensity = 0; 120 intensity = 0;
121 if (locomolcd_flags & LOCOMOLCD_SUSPENDED) 121 if (locomolcd_flags & LOCOMOLCD_SUSPENDED)
122 intensity = 0; 122 intensity = 0;
@@ -141,10 +141,9 @@ static int locomolcd_get_intensity(struct backlight_device *bd)
141 return current_intensity; 141 return current_intensity;
142} 142}
143 143
144static struct backlight_properties locomobl_data = { 144static struct backlight_ops locomobl_data = {
145 .get_brightness = locomolcd_get_intensity, 145 .get_brightness = locomolcd_get_intensity,
146 .update_status = locomolcd_set_intensity, 146 .update_status = locomolcd_set_intensity,
147 .max_brightness = 4,
148}; 147};
149 148
150#ifdef CONFIG_PM 149#ifdef CONFIG_PM
@@ -189,7 +188,8 @@ static int locomolcd_probe(struct locomo_dev *ldev)
189 return PTR_ERR (locomolcd_bl_device); 188 return PTR_ERR (locomolcd_bl_device);
190 189
191 /* Set up frontlight so that screen is readable */ 190 /* Set up frontlight so that screen is readable */
192 locomobl_data.brightness = 2; 191 locomolcd_bl_device->props.max_brightness = 4,
192 locomolcd_bl_device->props.brightness = 2;
193 locomolcd_set_intensity(locomolcd_bl_device); 193 locomolcd_set_intensity(locomolcd_bl_device);
194 194
195 return 0; 195 return 0;
diff --git a/drivers/video/backlight/progear_bl.c b/drivers/video/backlight/progear_bl.c
index 42d6acd96c1a..702269357861 100644
--- a/drivers/video/backlight/progear_bl.c
+++ b/drivers/video/backlight/progear_bl.c
@@ -35,11 +35,11 @@ static struct pci_dev *sb_dev = NULL;
35 35
36static int progearbl_set_intensity(struct backlight_device *bd) 36static int progearbl_set_intensity(struct backlight_device *bd)
37{ 37{
38 int intensity = bd->props->brightness; 38 int intensity = bd->props.brightness;
39 39
40 if (bd->props->power != FB_BLANK_UNBLANK) 40 if (bd->props.power != FB_BLANK_UNBLANK)
41 intensity = 0; 41 intensity = 0;
42 if (bd->props->fb_blank != FB_BLANK_UNBLANK) 42 if (bd->props.fb_blank != FB_BLANK_UNBLANK)
43 intensity = 0; 43 intensity = 0;
44 44
45 pci_write_config_byte(pmu_dev, PMU_LPCR, intensity + HW_LEVEL_MIN); 45 pci_write_config_byte(pmu_dev, PMU_LPCR, intensity + HW_LEVEL_MIN);
@@ -55,7 +55,7 @@ static int progearbl_get_intensity(struct backlight_device *bd)
55 return intensity - HW_LEVEL_MIN; 55 return intensity - HW_LEVEL_MIN;
56} 56}
57 57
58static struct backlight_properties progearbl_data = { 58static struct backlight_ops progearbl_ops = {
59 .get_brightness = progearbl_get_intensity, 59 .get_brightness = progearbl_get_intensity,
60 .update_status = progearbl_set_intensity, 60 .update_status = progearbl_set_intensity,
61}; 61};
@@ -84,15 +84,15 @@ static int progearbl_probe(struct platform_device *pdev)
84 84
85 progear_backlight_device = backlight_device_register("progear-bl", 85 progear_backlight_device = backlight_device_register("progear-bl",
86 &pdev->dev, NULL, 86 &pdev->dev, NULL,
87 &progearbl_data); 87 &progearbl_ops);
88 if (IS_ERR(progear_backlight_device)) 88 if (IS_ERR(progear_backlight_device))
89 return PTR_ERR(progear_backlight_device); 89 return PTR_ERR(progear_backlight_device);
90 90
91 platform_set_drvdata(pdev, progear_backlight_device); 91 platform_set_drvdata(pdev, progear_backlight_device);
92 92
93 progearbl_data.power = FB_BLANK_UNBLANK; 93 progear_backlight_device->props.power = FB_BLANK_UNBLANK;
94 progearbl_data.brightness = HW_LEVEL_MAX - HW_LEVEL_MIN; 94 progear_backlight_device->props.brightness = HW_LEVEL_MAX - HW_LEVEL_MIN;
95 progearbl_data.max_brightness = HW_LEVEL_MAX - HW_LEVEL_MIN; 95 progear_backlight_device->props.max_brightness = HW_LEVEL_MAX - HW_LEVEL_MIN;
96 progearbl_set_intensity(progear_backlight_device); 96 progearbl_set_intensity(progear_backlight_device);
97 97
98 return 0; 98 return 0;