Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2518344imu; Sun, 27 Jan 2019 06:52:36 -0800 (PST) X-Google-Smtp-Source: ALg8bN65YL/id6QX0Ug+J/2C1ZdI9uQV1NV2FuXtS4ghj/mAd93lhctcDiJ+MW/GpByQQA8f40LI X-Received: by 2002:a17:902:b68d:: with SMTP id c13mr18466016pls.102.1548600756310; Sun, 27 Jan 2019 06:52:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548600756; cv=none; d=google.com; s=arc-20160816; b=xkuLW2hwR7+F0sDt09FOYzD0FYC6egRrtQP2S3DMbK3HQaOQEZV9Doidags6lncf16 2aShVaGdEs97YC9VjwWU1zBIxK+W1XJV+YTxRh68Z+aIOMvpzAYj4jBWl1F8pvAtyLfd mF6hdnhWRcCOeVhsn+9X+7hTRVXxf4xAUWezAf6tDZ2yZsYRhAZW9Q94MxI0s5okI3SZ faJFic3iW8OZYwNv0Rb0N4u8DYcQbByv+HipfU5BOFZy7gjmsGkW3a0/yeIGRDgtNt7t SxEwg7/g2OCzLKc1eDlzpmy7GgSXcONkY6CNTBYWGTdyUwWZ2ZqKZnPVagN6NJYaXpFN 46qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=XInzTUZUBPOIB64Z7ChpHMbRmLbIAdlBK3OQ3scko0M=; b=v2jmot9vBA9ldUSU2Lb15o8G4fQsoXvAKy9eusTqx6FojSsKVhJma7hc1olDvXlbQq EjH4Rl/bxI492LVjO9V3pYSeY/dtgLXxO5XvAZpp65S6ga8Qbnwe3Naje+8Sieo0ww4+ FCQOg8/jNFmS/KEdFHJT2bs0jzYK5Pcc63CA59AEY2n7vOoPXhxjM8nvVKLg64rFvitM 2C5Tcd3We2ycKrmeQajzm6B8exN/BQAnqFMTBqkYFoMzVMui7vNDiWBCqPOAMajPDV0D XzmiLkDpAdIQ5/Hh2T9QO5cUcPrsrNJ2k3yshUzsORqapT+Qi4yLlMgEpf35iTPjciNF bk6Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3si29934183pgl.468.2019.01.27.06.52.20; Sun, 27 Jan 2019 06:52:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726999AbfA0Ou5 (ORCPT + 99 others); Sun, 27 Jan 2019 09:50:57 -0500 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76]:60138 "EHLO wens.csie.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726511AbfA0Ou5 (ORCPT ); Sun, 27 Jan 2019 09:50:57 -0500 Received: by wens.csie.org (Postfix, from userid 1000) id CC4905FD14; Sun, 27 Jan 2019 22:50:55 +0800 (CST) From: Chen-Yu Tsai To: Thierry Reding , Lee Jones , Daniel Thompson , Jingoo Han Cc: Chen-Yu Tsai , linux-pwm@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard , linux-arm-kernel@lists.infradead.org Subject: [PATCH] backlight: pwm_bl: Use gpiod_get_value_cansleep() to get initial state Date: Sun, 27 Jan 2019 22:50:54 +0800 Message-Id: <20190127145054.3770-1-wens@csie.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (dump_stack+0x88/0x9c) [] (dump_stack) from [] (__warn+0xe8/0x100) [] (__warn) from [] (warn_slowpath_null+0x20/0x28) [] (warn_slowpath_null) from [] (gpiod_get_value+0xd0/0x100) [] (gpiod_get_value) from [] (pwm_backlight_probe+0x238/0x508) [] (pwm_backlight_probe) from [] (platform_drv_probe+0x50/0xac) [] (platform_drv_probe) from [] (driver_probe_device+0x238/0x2e8) [] (driver_probe_device) from [] (bus_for_each_drv+0x44/0x94) [] (bus_for_each_drv) from [] (__device_attach+0xb0/0x114) [] (__device_attach) from [] (bus_probe_device+0x84/0x8c) [] (bus_probe_device) from [] (deferred_probe_work_func+0x50/0x14c) [] (deferred_probe_work_func) from [] (process_one_work+0x1ec/0x414) [] (process_one_work) from [] (worker_thread+0x2b0/0x5a0) [] (worker_thread) from [] (kthread+0x14c/0x154) [] (kthread) from [] (ret_from_fork+0x14/0x24) This was missed in commit 0c9501f823a4 ("backlight: pwm_bl: Handle gpio that can sleep"). The code was then moved to a separate function in commit 7613c922315e ("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: 0c9501f823a4 ("backlight: pwm_bl: Handle gpio that can sleep") Signed-off-by: Chen-Yu Tsai --- drivers/video/backlight/pwm_bl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index feb90764a811..53b8ceea9bde 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -435,7 +435,7 @@ static int pwm_backlight_initial_power_state(const struct pwm_bl_data *pb) */ /* if the enable GPIO is disabled, do not enable the backlight */ - if (pb->enable_gpio && gpiod_get_value(pb->enable_gpio) == 0) + if (pb->enable_gpio && gpiod_get_value_cansleep(pb->enable_gpio) == 0) return FB_BLANK_POWERDOWN; /* The regulator is disabled, do not enable the backlight */ -- 2.20.1