aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc/appledisplay.c
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/usb/misc/appledisplay.c
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/usb/misc/appledisplay.c')
-rw-r--r--drivers/usb/misc/appledisplay.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c
index cd2c5574cf93..cf70c16f0e3f 100644
--- a/drivers/usb/misc/appledisplay.c
+++ b/drivers/usb/misc/appledisplay.c
@@ -141,7 +141,7 @@ static int appledisplay_bl_update_status(struct backlight_device *bd)
141 int retval; 141 int retval;
142 142
143 pdata->msgdata[0] = 0x10; 143 pdata->msgdata[0] = 0x10;
144 pdata->msgdata[1] = bd->props->brightness; 144 pdata->msgdata[1] = bd->props.brightness;
145 145
146 retval = usb_control_msg( 146 retval = usb_control_msg(
147 pdata->udev, 147 pdata->udev,
@@ -177,10 +177,9 @@ static int appledisplay_bl_get_brightness(struct backlight_device *bd)
177 return pdata->msgdata[1]; 177 return pdata->msgdata[1];
178} 178}
179 179
180static struct backlight_properties appledisplay_bl_data = { 180static struct backlight_ops appledisplay_bl_data = {
181 .get_brightness = appledisplay_bl_get_brightness, 181 .get_brightness = appledisplay_bl_get_brightness,
182 .update_status = appledisplay_bl_update_status, 182 .update_status = appledisplay_bl_update_status,
183 .max_brightness = 0xFF
184}; 183};
185 184
186static void appledisplay_work(struct work_struct *work) 185static void appledisplay_work(struct work_struct *work)
@@ -191,7 +190,7 @@ static void appledisplay_work(struct work_struct *work)
191 190
192 retval = appledisplay_bl_get_brightness(pdata->bd); 191 retval = appledisplay_bl_get_brightness(pdata->bd);
193 if (retval >= 0) 192 if (retval >= 0)
194 pdata->bd->props->brightness = retval; 193 pdata->bd->props.brightness = retval;
195 194
196 /* Poll again in about 125ms if there's still a button pressed */ 195 /* Poll again in about 125ms if there's still a button pressed */
197 if (pdata->button_pressed) 196 if (pdata->button_pressed)
@@ -285,6 +284,8 @@ static int appledisplay_probe(struct usb_interface *iface,
285 goto error; 284 goto error;
286 } 285 }
287 286
287 pdata->bd->props.max_brightness = 0xff;
288
288 /* Try to get brightness */ 289 /* Try to get brightness */
289 brightness = appledisplay_bl_get_brightness(pdata->bd); 290 brightness = appledisplay_bl_get_brightness(pdata->bd);
290 291
@@ -295,7 +296,7 @@ static int appledisplay_probe(struct usb_interface *iface,
295 } 296 }
296 297
297 /* Set brightness in backlight device */ 298 /* Set brightness in backlight device */
298 pdata->bd->props->brightness = brightness; 299 pdata->bd->props.brightness = brightness;
299 300
300 /* save our data pointer in the interface device */ 301 /* save our data pointer in the interface device */
301 usb_set_intfdata(iface, pdata); 302 usb_set_intfdata(iface, pdata);