fb_defio: fix for non-dirty ptes
[safe/jmp/linux-2.6] / drivers / video / backlight / backlight.c
index 18829cf..e207810 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/ctype.h>
 #include <linux/err.h>
 #include <linux/fb.h>
+#include <linux/slab.h>
 
 #ifdef CONFIG_PMAC_BACKLIGHT
 #include <asm/backlight.h>
@@ -38,7 +39,7 @@ static int fb_notifier_callback(struct notifier_block *self,
        mutex_lock(&bd->ops_lock);
        if (bd->ops)
                if (!bd->ops->check_fb ||
-                   bd->ops->check_fb(evdata->info)) {
+                   bd->ops->check_fb(bd, evdata->info)) {
                        bd->props.fb_blank = *(int *)evdata->data;
                        if (bd->props.fb_blank == FB_BLANK_UNBLANK)
                                bd->props.state &= ~BL_CORE_FBBLANK;
@@ -269,7 +270,8 @@ EXPORT_SYMBOL(backlight_force_update);
  * ERR_PTR() or a pointer to the newly allocated device.
  */
 struct backlight_device *backlight_device_register(const char *name,
-               struct device *parent, void *devdata, const struct backlight_ops *ops)
+       struct device *parent, void *devdata, const struct backlight_ops *ops,
+       const struct backlight_properties *props)
 {
        struct backlight_device *new_bd;
        int rc;
@@ -289,6 +291,11 @@ struct backlight_device *backlight_device_register(const char *name,
        dev_set_name(&new_bd->dev, name);
        dev_set_drvdata(&new_bd->dev, devdata);
 
+       /* Set default properties */
+       if (props)
+               memcpy(&new_bd->props, props,
+                      sizeof(struct backlight_properties));
+
        rc = device_register(&new_bd->dev);
        if (rc) {
                kfree(new_bd);