linux/drivers/video/backlight
Chen-Yu Tsai cec2b18832 backlight: pwm_bl: Use gpiod_get_value_cansleep() to get initial state
gpiod_get_value() gives out a warning if access to the underlying gpiochip
requires sleeping, which is common for I2C based chips:

    WARNING: CPU: 0 PID: 77 at drivers/gpio/gpiolib.c:2500 gpiod_get_value+0xd0/0x100
    Modules linked in:
    CPU: 0 PID: 77 Comm: kworker/0:2 Not tainted 4.14.0-rc3-00589-gf32897915d48-dirty #90
    Hardware name: Allwinner sun4i/sun5i Families
    Workqueue: events deferred_probe_work_func
    [<c010ec50>] (unwind_backtrace) from [<c010b784>] (show_stack+0x10/0x14)
    [<c010b784>] (show_stack) from [<c0797224>] (dump_stack+0x88/0x9c)
    [<c0797224>] (dump_stack) from [<c0125b08>] (__warn+0xe8/0x100)
    [<c0125b08>] (__warn) from [<c0125bd0>] (warn_slowpath_null+0x20/0x28)
    [<c0125bd0>] (warn_slowpath_null) from [<c037069c>] (gpiod_get_value+0xd0/0x100)
    [<c037069c>] (gpiod_get_value) from [<c03778d0>] (pwm_backlight_probe+0x238/0x508)
    [<c03778d0>] (pwm_backlight_probe) from [<c0411a2c>] (platform_drv_probe+0x50/0xac)
    [<c0411a2c>] (platform_drv_probe) from [<c0410224>] (driver_probe_device+0x238/0x2e8)
    [<c0410224>] (driver_probe_device) from [<c040e820>] (bus_for_each_drv+0x44/0x94)
    [<c040e820>] (bus_for_each_drv) from [<c040ff0c>] (__device_attach+0xb0/0x114)
    [<c040ff0c>] (__device_attach) from [<c040f4f8>] (bus_probe_device+0x84/0x8c)
    [<c040f4f8>] (bus_probe_device) from [<c040f944>] (deferred_probe_work_func+0x50/0x14c)
    [<c040f944>] (deferred_probe_work_func) from [<c013be84>] (process_one_work+0x1ec/0x414)
    [<c013be84>] (process_one_work) from [<c013ce5c>] (worker_thread+0x2b0/0x5a0)
    [<c013ce5c>] (worker_thread) from [<c0141908>] (kthread+0x14c/0x154)
    [<c0141908>] (kthread) from [<c0107ab0>] (ret_from_fork+0x14/0x24)

This was missed in commit 0c9501f823 ("backlight: pwm_bl: Handle gpio
that can sleep"). The code was then moved to a separate function in
commit 7613c92231 ("backlight: pwm_bl: Move the checks for initial power
state to a separate function").

The only usage of gpiod_get_value() is during the probe stage, which is
safe to sleep in. Switch to gpiod_get_value_cansleep().

Fixes: 0c9501f823 ("backlight: pwm_bl: Handle gpio that can sleep")
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Acked-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2019-01-30 13:37:42 +00:00
..
88pm860x_bl.c backlight: 88pm860x_bl: Use of_node_name_eq for node name comparisons 2018-12-14 12:30:24 +00:00
aat2870_bl.c
adp5520_bl.c backlight: Update MODULE AUTHOR email address 2018-09-10 15:54:24 +01:00
adp8860_bl.c backlight: Update MODULE AUTHOR email address 2018-09-10 15:54:24 +01:00
adp8870_bl.c backlight: Update MODULE AUTHOR email address 2018-09-10 15:54:24 +01:00
ams369fg06.c spi: Drop owner assignment from spi_drivers 2015-10-28 10:30:17 +09:00
apple_bl.c backlight: apple_bl: Deprecate pci_get_bus_and_slot() 2017-12-20 13:47:05 +00:00
arcxcnn_bl.c backlight: Add support for Arctic Sand LED backlight driver chips 2017-04-25 09:22:23 +01:00
as3711_bl.c media: backlight: as3711_bl: convert to SPDX identifiers 2018-09-12 09:31:24 -04:00
backlight.c video: backlight: Add devres versions of of_find_backlight 2018-01-29 10:34:53 -05:00
bd6107.c
corgi_lcd.c backlight: tdo24m: Fix the SPI CS between transfers 2018-01-08 09:21:57 +00:00
cr_bllcd.c backlight: cr_bllcd: Add blank line after declarations 2014-08-29 08:24:51 +01:00
da903x_bl.c
da9052_bl.c backlight: da9052: Fix module autoload 2017-01-04 11:37:58 +00:00
ep93xx_bl.c
generic_bl.c backlight: generic-bl: Remove DRIVER1 state 2018-04-30 13:25:14 +01:00
gpio_backlight.c backlight: gpio_backlight: Delete pdata inversion 2017-08-07 17:11:28 +01:00
hp680_bl.c
hx8357.c
ili922x.c backlight: ili922x: Remove redundant variable len 2017-11-08 10:43:49 +00:00
ili9320.c
ili9320.h
ipaq_micro_bl.c
jornada720_bl.c backlight: jornada720: Remove 'else' after a return 2014-08-29 08:26:32 +01:00
jornada720_lcd.c backlight: jornada720: Remove 'else' after a return 2014-08-29 08:26:51 +01:00
kb3886_bl.c dmi: Mark all struct dmi_system_id instances const 2017-09-14 11:59:30 +02:00
Kconfig backlight: Remove ld9040 driver 2018-10-09 02:59:20 -07:00
l4f00242t03.c spi: Drop owner assignment from spi_drivers 2015-10-28 10:30:17 +09:00
lcd.c backlight: lcd: Fix race condition during register 2017-01-04 11:37:31 +00:00
lm3533_bl.c
lm3630a_bl.c backlight: lm3630a: Bump REG_MAX value to 0x50 instead of 0x1F 2017-07-17 13:27:06 +01:00
lm3639_bl.c backlight: lm3639: Unconditionally call led_classdev_unregister 2018-10-09 02:58:59 -07:00
lms283gf05.c spi: Drop owner assignment from spi_drivers 2015-10-28 10:30:17 +09:00
lms501kf03.c spi: Drop owner assignment from spi_drivers 2015-10-28 10:30:17 +09:00
locomolcd.c
lp855x_bl.c treewide: devm_kzalloc() -> devm_kcalloc() 2018-06-12 16:19:22 -07:00
lp8788_bl.c backlight: lp8788: Explicitly apply PWM config extracted from pwm_args 2016-05-17 14:45:04 +02:00
ltv350qv.c spi: Drop owner assignment from spi_drivers 2015-10-28 10:30:17 +09:00
ltv350qv.h
lv5207lp.c
Makefile backlight: Remove ld9040 driver 2018-10-09 02:59:20 -07:00
max8925_bl.c backlight: max8925_bl: Fix Device Tree node lookup 2018-06-11 13:40:32 +01:00
omap1_bl.c backlight: omap1: add blank line after declarations 2014-08-29 08:27:53 +01:00
ot200_bl.c
otm3225a.c backlight: otm3225a: Add support for ORISE OTM3225A LCD SoC 2018-04-30 10:50:44 +01:00
pandora_bl.c backlight: pandora: Stop using BL_CORE_DRIVER1 2018-04-30 13:25:14 +01:00
pcf50633-backlight.c backlight: pcf50633: Add blank line after declarations 2014-08-29 08:25:53 +01:00
platform_lcd.c
pm8941-wled.c backlight: pm8941: Convert to using %pOFn instead of device_node.name 2018-11-27 10:55:37 -06:00
pwm_bl.c backlight: pwm_bl: Use gpiod_get_value_cansleep() to get initial state 2019-01-30 13:37:42 +00:00
rave-sp-backlight.c backlight: Add RAVE SP backlight driver 2018-04-30 10:50:43 +01:00
sky81452-backlight.c backlight: sky81452: Remove unneeded use of IS_ERR_VALUE() macro 2015-08-25 08:43:21 +01:00
tdo24m.c backlight: tdo24m: Fix the SPI CS between transfers 2018-01-08 09:21:57 +00:00
tosa_bl.c backlight-tosa: Delete unnecessary assignment for the field "owner" 2016-10-06 09:27:25 +01:00
tosa_lcd.c backlight: tdo24m: Fix the SPI CS between transfers 2018-01-08 09:21:57 +00:00
tps65217_bl.c backlight: tps65217_bl: Fix Device Tree node lookup 2018-06-11 13:40:39 +01:00
vgg2432a4.c spi: Drop owner assignment from spi_drivers 2015-10-28 10:30:17 +09:00
wm831x_bl.c backlight: wm831x_bl: Add blank line after declarations 2014-08-29 08:26:21 +01:00