backlight: Pass device through notify callback in the pwm driver
authorBen Dooks <ben@simtec.co.uk>
Tue, 10 Nov 2009 17:20:40 +0000 (17:20 +0000)
committerRichard Purdie <rpurdie@linux.intel.com>
Thu, 17 Dec 2009 11:46:01 +0000 (11:46 +0000)
Add the device to the notify callback's arguments in the PWM backlight
driver. This brings the notify callback into line with the other
callbacks defined by this driver.

Signed-off-by: Ben Dooks <ben@simtec.co.uk>
Signed-off-by: Simtec Linux Team <linux@simtec.co.uk>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
drivers/video/backlight/pwm_bl.c
include/linux/pwm_backlight.h

index df9e0b32cf3998b13da790341446bf9ea3853489..9d2ec2a1cce8fff721d40680277d45ac5bc1bb55 100644 (file)
 
 struct pwm_bl_data {
        struct pwm_device       *pwm;
+       struct device           *dev;
        unsigned int            period;
-       int                     (*notify)(int brightness);
+       int                     (*notify)(struct device *,
+                                         int brightness);
 };
 
 static int pwm_backlight_update_status(struct backlight_device *bl)
@@ -39,7 +41,7 @@ static int pwm_backlight_update_status(struct backlight_device *bl)
                brightness = 0;
 
        if (pb->notify)
-               brightness = pb->notify(brightness);
+               brightness = pb->notify(pb->dev, brightness);
 
        if (brightness == 0) {
                pwm_config(pb->pwm, 0, pb->period);
@@ -88,6 +90,7 @@ static int pwm_backlight_probe(struct platform_device *pdev)
 
        pb->period = data->pwm_period_ns;
        pb->notify = data->notify;
+       pb->dev = &pdev->dev;
 
        pb->pwm = pwm_request(data->pwm_id, "backlight");
        if (IS_ERR(pb->pwm)) {
@@ -146,7 +149,7 @@ static int pwm_backlight_suspend(struct platform_device *pdev,
        struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
 
        if (pb->notify)
-               pb->notify(0);
+               pb->notify(pb->dev, 0);
        pwm_config(pb->pwm, 0, pb->period);
        pwm_disable(pb->pwm);
        return 0;
index 7a9754c96775091d1ac9ef9c002682e29c38ca88..01b3d759f1fccec7f88e1b276973aa6f70e5bae5 100644 (file)
@@ -10,7 +10,7 @@ struct platform_pwm_backlight_data {
        unsigned int dft_brightness;
        unsigned int pwm_period_ns;
        int (*init)(struct device *dev);
-       int (*notify)(int brightness);
+       int (*notify)(struct device *dev, int brightness);
        void (*exit)(struct device *dev);
 };