Commit cfc3899fcd0b3b990b29d3d33f75f4edf715e7d1

Authored by Ben Dooks
Committed by Richard Purdie
1 parent 5b0582ea42

backlight: Pass device through notify callback in the pwm driver

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>

Showing 2 changed files with 7 additions and 4 deletions Side-by-side Diff

drivers/video/backlight/pwm_bl.c
... ... @@ -22,8 +22,10 @@
22 22  
23 23 struct pwm_bl_data {
24 24 struct pwm_device *pwm;
  25 + struct device *dev;
25 26 unsigned int period;
26   - int (*notify)(int brightness);
  27 + int (*notify)(struct device *,
  28 + int brightness);
27 29 };
28 30  
29 31 static int pwm_backlight_update_status(struct backlight_device *bl)
... ... @@ -39,7 +41,7 @@
39 41 brightness = 0;
40 42  
41 43 if (pb->notify)
42   - brightness = pb->notify(brightness);
  44 + brightness = pb->notify(pb->dev, brightness);
43 45  
44 46 if (brightness == 0) {
45 47 pwm_config(pb->pwm, 0, pb->period);
... ... @@ -88,6 +90,7 @@
88 90  
89 91 pb->period = data->pwm_period_ns;
90 92 pb->notify = data->notify;
  93 + pb->dev = &pdev->dev;
91 94  
92 95 pb->pwm = pwm_request(data->pwm_id, "backlight");
93 96 if (IS_ERR(pb->pwm)) {
... ... @@ -146,7 +149,7 @@
146 149 struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
147 150  
148 151 if (pb->notify)
149   - pb->notify(0);
  152 + pb->notify(pb->dev, 0);
150 153 pwm_config(pb->pwm, 0, pb->period);
151 154 pwm_disable(pb->pwm);
152 155 return 0;
include/linux/pwm_backlight.h
... ... @@ -10,7 +10,7 @@
10 10 unsigned int dft_brightness;
11 11 unsigned int pwm_period_ns;
12 12 int (*init)(struct device *dev);
13   - int (*notify)(int brightness);
  13 + int (*notify)(struct device *dev, int brightness);
14 14 void (*exit)(struct device *dev);
15 15 };
16 16