aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/aty/aty128fb.c20
-rw-r--r--drivers/video/aty/atyfb_base.c18
-rw-r--r--drivers/video/aty/radeon_backlight.c18
-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
-rw-r--r--drivers/video/chipsfb.c2
-rw-r--r--drivers/video/nvidia/nv_backlight.c18
-rw-r--r--drivers/video/riva/fbdev.c18
12 files changed, 133 insertions, 165 deletions
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
index 4de8d6252c3c..8726c3669713 100644
--- a/drivers/video/aty/aty128fb.c
+++ b/drivers/video/aty/aty128fb.c
@@ -1695,8 +1695,6 @@ static int __devinit aty128fb_setup(char *options)
1695#ifdef CONFIG_FB_ATY128_BACKLIGHT 1695#ifdef CONFIG_FB_ATY128_BACKLIGHT
1696#define MAX_LEVEL 0xFF 1696#define MAX_LEVEL 0xFF
1697 1697
1698static struct backlight_properties aty128_bl_data;
1699
1700static int aty128_bl_get_level_brightness(struct aty128fb_par *par, 1698static int aty128_bl_get_level_brightness(struct aty128fb_par *par,
1701 int level) 1699 int level)
1702{ 1700{
@@ -1730,12 +1728,12 @@ static int aty128_bl_update_status(struct backlight_device *bd)
1730 unsigned int reg = aty_ld_le32(LVDS_GEN_CNTL); 1728 unsigned int reg = aty_ld_le32(LVDS_GEN_CNTL);
1731 int level; 1729 int level;
1732 1730
1733 if (bd->props->power != FB_BLANK_UNBLANK || 1731 if (bd->props.power != FB_BLANK_UNBLANK ||
1734 bd->props->fb_blank != FB_BLANK_UNBLANK || 1732 bd->props.fb_blank != FB_BLANK_UNBLANK ||
1735 !par->lcd_on) 1733 !par->lcd_on)
1736 level = 0; 1734 level = 0;
1737 else 1735 else
1738 level = bd->props->brightness; 1736 level = bd->props.brightness;
1739 1737
1740 reg |= LVDS_BL_MOD_EN | LVDS_BLON; 1738 reg |= LVDS_BL_MOD_EN | LVDS_BLON;
1741 if (level > 0) { 1739 if (level > 0) {
@@ -1779,19 +1777,18 @@ static int aty128_bl_update_status(struct backlight_device *bd)
1779 1777
1780static int aty128_bl_get_brightness(struct backlight_device *bd) 1778static int aty128_bl_get_brightness(struct backlight_device *bd)
1781{ 1779{
1782 return bd->props->brightness; 1780 return bd->props.brightness;
1783} 1781}
1784 1782
1785static struct backlight_properties aty128_bl_data = { 1783static struct backlight_ops aty128_bl_data = {
1786 .get_brightness = aty128_bl_get_brightness, 1784 .get_brightness = aty128_bl_get_brightness,
1787 .update_status = aty128_bl_update_status, 1785 .update_status = aty128_bl_update_status,
1788 .max_brightness = (FB_BACKLIGHT_LEVELS - 1),
1789}; 1786};
1790 1787
1791static void aty128_bl_set_power(struct fb_info *info, int power) 1788static void aty128_bl_set_power(struct fb_info *info, int power)
1792{ 1789{
1793 if (info->bl_dev) { 1790 if (info->bl_dev) {
1794 info->bl_dev->props->power = power; 1791 info->bl_dev->props.power = power;
1795 backlight_update_status(info->bl_dev); 1792 backlight_update_status(info->bl_dev);
1796 } 1793 }
1797} 1794}
@@ -1825,8 +1822,9 @@ static void aty128_bl_init(struct aty128fb_par *par)
1825 63 * FB_BACKLIGHT_MAX / MAX_LEVEL, 1822 63 * FB_BACKLIGHT_MAX / MAX_LEVEL,
1826 219 * FB_BACKLIGHT_MAX / MAX_LEVEL); 1823 219 * FB_BACKLIGHT_MAX / MAX_LEVEL);
1827 1824
1828 bd->props->brightness = aty128_bl_data.max_brightness; 1825 bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
1829 bd->props->power = FB_BLANK_UNBLANK; 1826 bd->props.brightness = bd->props.max_brightness;
1827 bd->props.power = FB_BLANK_UNBLANK;
1830 backlight_update_status(bd); 1828 backlight_update_status(bd);
1831 1829
1832 printk("aty128: Backlight initialized (%s)\n", name); 1830 printk("aty128: Backlight initialized (%s)\n", name);
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index 35ba26567598..a7e0062233f2 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -2114,8 +2114,6 @@ static int atyfb_pci_resume(struct pci_dev *pdev)
2114#ifdef CONFIG_FB_ATY_BACKLIGHT 2114#ifdef CONFIG_FB_ATY_BACKLIGHT
2115#define MAX_LEVEL 0xFF 2115#define MAX_LEVEL 0xFF
2116 2116
2117static struct backlight_properties aty_bl_data;
2118
2119static int aty_bl_get_level_brightness(struct atyfb_par *par, int level) 2117static int aty_bl_get_level_brightness(struct atyfb_par *par, int level)
2120{ 2118{
2121 struct fb_info *info = pci_get_drvdata(par->pdev); 2119 struct fb_info *info = pci_get_drvdata(par->pdev);
@@ -2139,11 +2137,11 @@ static int aty_bl_update_status(struct backlight_device *bd)
2139 unsigned int reg = aty_ld_lcd(LCD_MISC_CNTL, par); 2137 unsigned int reg = aty_ld_lcd(LCD_MISC_CNTL, par);
2140 int level; 2138 int level;
2141 2139
2142 if (bd->props->power != FB_BLANK_UNBLANK || 2140 if (bd->props.power != FB_BLANK_UNBLANK ||
2143 bd->props->fb_blank != FB_BLANK_UNBLANK) 2141 bd->props.fb_blank != FB_BLANK_UNBLANK)
2144 level = 0; 2142 level = 0;
2145 else 2143 else
2146 level = bd->props->brightness; 2144 level = bd->props.brightness;
2147 2145
2148 reg |= (BLMOD_EN | BIASMOD_EN); 2146 reg |= (BLMOD_EN | BIASMOD_EN);
2149 if (level > 0) { 2147 if (level > 0) {
@@ -2160,13 +2158,12 @@ static int aty_bl_update_status(struct backlight_device *bd)
2160 2158
2161static int aty_bl_get_brightness(struct backlight_device *bd) 2159static int aty_bl_get_brightness(struct backlight_device *bd)
2162{ 2160{
2163 return bd->props->brightness; 2161 return bd->props.brightness;
2164} 2162}
2165 2163
2166static struct backlight_properties aty_bl_data = { 2164static struct backlight_ops aty_bl_data = {
2167 .get_brightness = aty_bl_get_brightness, 2165 .get_brightness = aty_bl_get_brightness,
2168 .update_status = aty_bl_update_status, 2166 .update_status = aty_bl_update_status,
2169 .max_brightness = (FB_BACKLIGHT_LEVELS - 1),
2170}; 2167};
2171 2168
2172static void aty_bl_init(struct atyfb_par *par) 2169static void aty_bl_init(struct atyfb_par *par)
@@ -2194,8 +2191,9 @@ static void aty_bl_init(struct atyfb_par *par)
2194 0x3F * FB_BACKLIGHT_MAX / MAX_LEVEL, 2191 0x3F * FB_BACKLIGHT_MAX / MAX_LEVEL,
2195 0xFF * FB_BACKLIGHT_MAX / MAX_LEVEL); 2192 0xFF * FB_BACKLIGHT_MAX / MAX_LEVEL);
2196 2193
2197 bd->props->brightness = aty_bl_data.max_brightness; 2194 bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
2198 bd->props->power = FB_BLANK_UNBLANK; 2195 bd->props.brightness = bd->props.max_brightness;
2196 bd->props.power = FB_BLANK_UNBLANK;
2199 backlight_update_status(bd); 2197 backlight_update_status(bd);
2200 2198
2201 printk("aty: Backlight initialized (%s)\n", name); 2199 printk("aty: Backlight initialized (%s)\n", name);
diff --git a/drivers/video/aty/radeon_backlight.c b/drivers/video/aty/radeon_backlight.c
index 8c775e6a7e03..0be25fa5540c 100644
--- a/drivers/video/aty/radeon_backlight.c
+++ b/drivers/video/aty/radeon_backlight.c
@@ -19,8 +19,6 @@
19 19
20#define MAX_RADEON_LEVEL 0xFF 20#define MAX_RADEON_LEVEL 0xFF
21 21
22static struct backlight_properties radeon_bl_data;
23
24struct radeon_bl_privdata { 22struct radeon_bl_privdata {
25 struct radeonfb_info *rinfo; 23 struct radeonfb_info *rinfo;
26 uint8_t negative; 24 uint8_t negative;
@@ -61,11 +59,11 @@ static int radeon_bl_update_status(struct backlight_device *bd)
61 * backlight. This provides some greater power saving and the display 59 * backlight. This provides some greater power saving and the display
62 * is useless without backlight anyway. 60 * is useless without backlight anyway.
63 */ 61 */
64 if (bd->props->power != FB_BLANK_UNBLANK || 62 if (bd->props.power != FB_BLANK_UNBLANK ||
65 bd->props->fb_blank != FB_BLANK_UNBLANK) 63 bd->props.fb_blank != FB_BLANK_UNBLANK)
66 level = 0; 64 level = 0;
67 else 65 else
68 level = bd->props->brightness; 66 level = bd->props.brightness;
69 67
70 del_timer_sync(&rinfo->lvds_timer); 68 del_timer_sync(&rinfo->lvds_timer);
71 radeon_engine_idle(); 69 radeon_engine_idle();
@@ -126,13 +124,12 @@ static int radeon_bl_update_status(struct backlight_device *bd)
126 124
127static int radeon_bl_get_brightness(struct backlight_device *bd) 125static int radeon_bl_get_brightness(struct backlight_device *bd)
128{ 126{
129 return bd->props->brightness; 127 return bd->props.brightness;
130} 128}
131 129
132static struct backlight_properties radeon_bl_data = { 130static struct backlight_ops radeon_bl_data = {
133 .get_brightness = radeon_bl_get_brightness, 131 .get_brightness = radeon_bl_get_brightness,
134 .update_status = radeon_bl_update_status, 132 .update_status = radeon_bl_update_status,
135 .max_brightness = (FB_BACKLIGHT_LEVELS - 1),
136}; 133};
137 134
138void radeonfb_bl_init(struct radeonfb_info *rinfo) 135void radeonfb_bl_init(struct radeonfb_info *rinfo)
@@ -188,8 +185,9 @@ void radeonfb_bl_init(struct radeonfb_info *rinfo)
188 63 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL, 185 63 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL,
189 217 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL); 186 217 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL);
190 187
191 bd->props->brightness = radeon_bl_data.max_brightness; 188 bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
192 bd->props->power = FB_BLANK_UNBLANK; 189 bd->props.brightness = bd->props.max_brightness;
190 bd->props.power = FB_BLANK_UNBLANK;
193 backlight_update_status(bd); 191 backlight_update_status(bd);
194 192
195 printk("radeonfb: Backlight initialized (%s)\n", name); 193 printk("radeonfb: Backlight initialized (%s)\n", name);
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;
diff --git a/drivers/video/chipsfb.c b/drivers/video/chipsfb.c
index 2a17dfc232f3..af313bf1a2da 100644
--- a/drivers/video/chipsfb.c
+++ b/drivers/video/chipsfb.c
@@ -395,7 +395,7 @@ chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent)
395 /* turn on the backlight */ 395 /* turn on the backlight */
396 mutex_lock(&pmac_backlight_mutex); 396 mutex_lock(&pmac_backlight_mutex);
397 if (pmac_backlight) { 397 if (pmac_backlight) {
398 pmac_backlight->props->power = FB_BLANK_UNBLANK; 398 pmac_backlight->props.power = FB_BLANK_UNBLANK;
399 backlight_update_status(pmac_backlight); 399 backlight_update_status(pmac_backlight);
400 } 400 }
401 mutex_unlock(&pmac_backlight_mutex); 401 mutex_unlock(&pmac_backlight_mutex);
diff --git a/drivers/video/nvidia/nv_backlight.c b/drivers/video/nvidia/nv_backlight.c
index 0e2bc519dcab..b7016e9b9e13 100644
--- a/drivers/video/nvidia/nv_backlight.c
+++ b/drivers/video/nvidia/nv_backlight.c
@@ -54,11 +54,11 @@ static int nvidia_bl_update_status(struct backlight_device *bd)
54 if (!par->FlatPanel) 54 if (!par->FlatPanel)
55 return 0; 55 return 0;
56 56
57 if (bd->props->power != FB_BLANK_UNBLANK || 57 if (bd->props.power != FB_BLANK_UNBLANK ||
58 bd->props->fb_blank != FB_BLANK_UNBLANK) 58 bd->props.fb_blank != FB_BLANK_UNBLANK)
59 level = 0; 59 level = 0;
60 else 60 else
61 level = bd->props->brightness; 61 level = bd->props.brightness;
62 62
63 tmp_pmc = NV_RD32(par->PMC, 0x10F0) & 0x0000FFFF; 63 tmp_pmc = NV_RD32(par->PMC, 0x10F0) & 0x0000FFFF;
64 tmp_pcrt = NV_RD32(par->PCRTC0, 0x081C) & 0xFFFFFFFC; 64 tmp_pcrt = NV_RD32(par->PCRTC0, 0x081C) & 0xFFFFFFFC;
@@ -81,13 +81,12 @@ static int nvidia_bl_update_status(struct backlight_device *bd)
81 81
82static int nvidia_bl_get_brightness(struct backlight_device *bd) 82static int nvidia_bl_get_brightness(struct backlight_device *bd)
83{ 83{
84 return bd->props->brightness; 84 return bd->props.brightness;
85} 85}
86 86
87static struct backlight_properties nvidia_bl_data = { 87static struct backlight_ops nvidia_bl_ops = {
88 .get_brightness = nvidia_bl_get_brightness, 88 .get_brightness = nvidia_bl_get_brightness,
89 .update_status = nvidia_bl_update_status, 89 .update_status = nvidia_bl_update_status,
90 .max_brightness = (FB_BACKLIGHT_LEVELS - 1),
91}; 90};
92 91
93void nvidia_bl_init(struct nvidia_par *par) 92void nvidia_bl_init(struct nvidia_par *par)
@@ -107,7 +106,7 @@ void nvidia_bl_init(struct nvidia_par *par)
107 106
108 snprintf(name, sizeof(name), "nvidiabl%d", info->node); 107 snprintf(name, sizeof(name), "nvidiabl%d", info->node);
109 108
110 bd = backlight_device_register(name, info->dev, par, &nvidia_bl_data); 109 bd = backlight_device_register(name, info->dev, par, &nvidia_bl_ops);
111 if (IS_ERR(bd)) { 110 if (IS_ERR(bd)) {
112 info->bl_dev = NULL; 111 info->bl_dev = NULL;
113 printk(KERN_WARNING "nvidia: Backlight registration failed\n"); 112 printk(KERN_WARNING "nvidia: Backlight registration failed\n");
@@ -119,8 +118,9 @@ void nvidia_bl_init(struct nvidia_par *par)
119 0x158 * FB_BACKLIGHT_MAX / MAX_LEVEL, 118 0x158 * FB_BACKLIGHT_MAX / MAX_LEVEL,
120 0x534 * FB_BACKLIGHT_MAX / MAX_LEVEL); 119 0x534 * FB_BACKLIGHT_MAX / MAX_LEVEL);
121 120
122 bd->props->brightness = nvidia_bl_data.max_brightness; 121 bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
123 bd->props->power = FB_BLANK_UNBLANK; 122 bd->props.brightness = nvidia_bl_data.max_brightness;
123 bd->props.power = FB_BLANK_UNBLANK;
124 backlight_update_status(bd); 124 backlight_update_status(bd);
125 125
126 printk("nvidia: Backlight initialized (%s)\n", name); 126 printk("nvidia: Backlight initialized (%s)\n", name);
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c
index 3a75def01b28..f8a3d608b208 100644
--- a/drivers/video/riva/fbdev.c
+++ b/drivers/video/riva/fbdev.c
@@ -308,11 +308,11 @@ static int riva_bl_update_status(struct backlight_device *bd)
308 U032 tmp_pcrt, tmp_pmc; 308 U032 tmp_pcrt, tmp_pmc;
309 int level; 309 int level;
310 310
311 if (bd->props->power != FB_BLANK_UNBLANK || 311 if (bd->props.power != FB_BLANK_UNBLANK ||
312 bd->props->fb_blank != FB_BLANK_UNBLANK) 312 bd->props.fb_blank != FB_BLANK_UNBLANK)
313 level = 0; 313 level = 0;
314 else 314 else
315 level = bd->props->brightness; 315 level = bd->props.brightness;
316 316
317 tmp_pmc = par->riva.PMC[0x10F0/4] & 0x0000FFFF; 317 tmp_pmc = par->riva.PMC[0x10F0/4] & 0x0000FFFF;
318 tmp_pcrt = par->riva.PCRTC0[0x081C/4] & 0xFFFFFFFC; 318 tmp_pcrt = par->riva.PCRTC0[0x081C/4] & 0xFFFFFFFC;
@@ -329,13 +329,12 @@ static int riva_bl_update_status(struct backlight_device *bd)
329 329
330static int riva_bl_get_brightness(struct backlight_device *bd) 330static int riva_bl_get_brightness(struct backlight_device *bd)
331{ 331{
332 return bd->props->brightness; 332 return bd->props.brightness;
333} 333}
334 334
335static struct backlight_properties riva_bl_data = { 335static struct backlight_ops riva_bl_ops = {
336 .get_brightness = riva_bl_get_brightness, 336 .get_brightness = riva_bl_get_brightness,
337 .update_status = riva_bl_update_status, 337 .update_status = riva_bl_update_status,
338 .max_brightness = (FB_BACKLIGHT_LEVELS - 1),
339}; 338};
340 339
341static void riva_bl_init(struct riva_par *par) 340static void riva_bl_init(struct riva_par *par)
@@ -355,7 +354,7 @@ static void riva_bl_init(struct riva_par *par)
355 354
356 snprintf(name, sizeof(name), "rivabl%d", info->node); 355 snprintf(name, sizeof(name), "rivabl%d", info->node);
357 356
358 bd = backlight_device_register(name, info->dev, par, &riva_bl_data); 357 bd = backlight_device_register(name, info->dev, par, &riva_bl_ops);
359 if (IS_ERR(bd)) { 358 if (IS_ERR(bd)) {
360 info->bl_dev = NULL; 359 info->bl_dev = NULL;
361 printk(KERN_WARNING "riva: Backlight registration failed\n"); 360 printk(KERN_WARNING "riva: Backlight registration failed\n");
@@ -367,8 +366,9 @@ static void riva_bl_init(struct riva_par *par)
367 MIN_LEVEL * FB_BACKLIGHT_MAX / MAX_LEVEL, 366 MIN_LEVEL * FB_BACKLIGHT_MAX / MAX_LEVEL,
368 FB_BACKLIGHT_MAX); 367 FB_BACKLIGHT_MAX);
369 368
370 bd->props->brightness = riva_bl_data.max_brightness; 369 bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
371 bd->props->power = FB_BLANK_UNBLANK; 370 bd->props.brightness = riva_bl_data.max_brightness;
371 bd->props.power = FB_BLANK_UNBLANK;
372 backlight_update_status(bd); 372 backlight_update_status(bd);
373 373
374 printk("riva: Backlight initialized (%s)\n", name); 374 printk("riva: Backlight initialized (%s)\n", name);