]>
Commit | Line | Data |
---|---|---|
04fd09d4 SL |
1 | From 151300a366023767c43bacd994b0209b1dd23089 Mon Sep 17 00:00:00 2001 |
2 | From: Chen-Yu Tsai <wens@csie.org> | |
3 | Date: Sun, 27 Jan 2019 22:50:54 +0800 | |
4 | Subject: backlight: pwm_bl: Use gpiod_get_value_cansleep() to get initial | |
5 | state | |
6 | ||
7 | [ Upstream commit cec2b18832e26bc866bef2be22eff4e25bbc4034 ] | |
8 | ||
9 | gpiod_get_value() gives out a warning if access to the underlying gpiochip | |
10 | requires sleeping, which is common for I2C based chips: | |
11 | ||
12 | WARNING: CPU: 0 PID: 77 at drivers/gpio/gpiolib.c:2500 gpiod_get_value+0xd0/0x100 | |
13 | Modules linked in: | |
14 | CPU: 0 PID: 77 Comm: kworker/0:2 Not tainted 4.14.0-rc3-00589-gf32897915d48-dirty #90 | |
15 | Hardware name: Allwinner sun4i/sun5i Families | |
16 | Workqueue: events deferred_probe_work_func | |
17 | [<c010ec50>] (unwind_backtrace) from [<c010b784>] (show_stack+0x10/0x14) | |
18 | [<c010b784>] (show_stack) from [<c0797224>] (dump_stack+0x88/0x9c) | |
19 | [<c0797224>] (dump_stack) from [<c0125b08>] (__warn+0xe8/0x100) | |
20 | [<c0125b08>] (__warn) from [<c0125bd0>] (warn_slowpath_null+0x20/0x28) | |
21 | [<c0125bd0>] (warn_slowpath_null) from [<c037069c>] (gpiod_get_value+0xd0/0x100) | |
22 | [<c037069c>] (gpiod_get_value) from [<c03778d0>] (pwm_backlight_probe+0x238/0x508) | |
23 | [<c03778d0>] (pwm_backlight_probe) from [<c0411a2c>] (platform_drv_probe+0x50/0xac) | |
24 | [<c0411a2c>] (platform_drv_probe) from [<c0410224>] (driver_probe_device+0x238/0x2e8) | |
25 | [<c0410224>] (driver_probe_device) from [<c040e820>] (bus_for_each_drv+0x44/0x94) | |
26 | [<c040e820>] (bus_for_each_drv) from [<c040ff0c>] (__device_attach+0xb0/0x114) | |
27 | [<c040ff0c>] (__device_attach) from [<c040f4f8>] (bus_probe_device+0x84/0x8c) | |
28 | [<c040f4f8>] (bus_probe_device) from [<c040f944>] (deferred_probe_work_func+0x50/0x14c) | |
29 | [<c040f944>] (deferred_probe_work_func) from [<c013be84>] (process_one_work+0x1ec/0x414) | |
30 | [<c013be84>] (process_one_work) from [<c013ce5c>] (worker_thread+0x2b0/0x5a0) | |
31 | [<c013ce5c>] (worker_thread) from [<c0141908>] (kthread+0x14c/0x154) | |
32 | [<c0141908>] (kthread) from [<c0107ab0>] (ret_from_fork+0x14/0x24) | |
33 | ||
34 | This was missed in commit 0c9501f823a4 ("backlight: pwm_bl: Handle gpio | |
35 | that can sleep"). The code was then moved to a separate function in | |
36 | commit 7613c922315e ("backlight: pwm_bl: Move the checks for initial power | |
37 | state to a separate function"). | |
38 | ||
39 | The only usage of gpiod_get_value() is during the probe stage, which is | |
40 | safe to sleep in. Switch to gpiod_get_value_cansleep(). | |
41 | ||
42 | Fixes: 0c9501f823a4 ("backlight: pwm_bl: Handle gpio that can sleep") | |
43 | Signed-off-by: Chen-Yu Tsai <wens@csie.org> | |
44 | Acked-by: Maxime Ripard <maxime.ripard@bootlin.com> | |
45 | Acked-by: Daniel Thompson <daniel.thompson@linaro.org> | |
46 | Signed-off-by: Lee Jones <lee.jones@linaro.org> | |
47 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
48 | --- | |
49 | drivers/video/backlight/pwm_bl.c | 2 +- | |
50 | 1 file changed, 1 insertion(+), 1 deletion(-) | |
51 | ||
52 | diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c | |
53 | index 155153ecb894..2a0ce0c68302 100644 | |
54 | --- a/drivers/video/backlight/pwm_bl.c | |
55 | +++ b/drivers/video/backlight/pwm_bl.c | |
56 | @@ -212,7 +212,7 @@ static int pwm_backlight_initial_power_state(const struct pwm_bl_data *pb) | |
57 | */ | |
58 | ||
59 | /* if the enable GPIO is disabled, do not enable the backlight */ | |
60 | - if (pb->enable_gpio && gpiod_get_value(pb->enable_gpio) == 0) | |
61 | + if (pb->enable_gpio && gpiod_get_value_cansleep(pb->enable_gpio) == 0) | |
62 | return FB_BLANK_POWERDOWN; | |
63 | ||
64 | /* The regulator is disabled, do not enable the backlight */ | |
65 | -- | |
66 | 2.19.1 | |
67 |