Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3335583imu; Mon, 28 Jan 2019 03:06:29 -0800 (PST) X-Google-Smtp-Source: ALg8bN7cYOP0h5WUSYRbBe6lCxrx2Rv9c4oTsAXaTwlJuGvc+iU/FTJqBZOJOSUtr9YzyfZD0Ags X-Received: by 2002:a17:902:b78b:: with SMTP id e11mr21401014pls.90.1548673589769; Mon, 28 Jan 2019 03:06:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548673589; cv=none; d=google.com; s=arc-20160816; b=wGalBhh+O1GlVkMDZ3ZK7SDaj3c9Z2iDaQLEvAkNYJ8xGIxodzvvfw4K0hDbnwKCFb VgSCn4mOVScl+v5rE9ZT/wtnICCN8p35u9k2mgDvz9cLqAYRS/uiKH0ZpRYPhHqEyl4S xiueDhlA7Tdd//ZGSOZUDGQbM8Gd1JefIuebRAXfXb/14Yjyx4frbkEbfGDVjrXrE6m2 xxruUrsCQccksB2neClUdFMHP4Oybh/lkJaWL7GjZYpCnD4dB775OUdibWqPsrl7D773 81GEuDgxAm381mj6fuUufxNas1ImepYND889E0faF00HAS/w6RDWeoNksMY6UB1I6xbm Xc9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=PB5pA5GKrN7y5OVHQcaOfdCOpg8Wl9SqU/L08GFqYsk=; b=CqKrGJ1BGiN0cKaGBS/Tn2P4JfnG89cBH5jPBhOPN05tfl7IqgXlRrk7ETFQT3b5HE AsdW6eQeyi1Z0dm6lcIOFz5pz0wRipmMxqDjNMxrQtN36MWDnxEdGkfZRVqgpEgnmIiM FYPwaDiwmsU/CbdMA1CPhjl8fhKbvJpSvRgTBT8eWeWhDwz4iTQZPEXTj5nm2WPu6aVA DFHdO/9J0hI05FouykbDPYjFp7J0pMKA3bQrOO7HCPpozcqtnt4ly2eEsLZptPEJchV4 CImSQeKahRBzECk1NHLhM4SnMfmBsnCoiTwuuDbbJTwJjBBV2EyTcuDGZ3UttPKQJkUX Zb7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QjhfuOYV; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b65si31582176pgc.259.2019.01.28.03.06.14; Mon, 28 Jan 2019 03:06:29 -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; dkim=pass header.i=@linaro.org header.s=google header.b=QjhfuOYV; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726829AbfA1LFy (ORCPT + 99 others); Mon, 28 Jan 2019 06:05:54 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:35074 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726735AbfA1LFx (ORCPT ); Mon, 28 Jan 2019 06:05:53 -0500 Received: by mail-wm1-f66.google.com with SMTP id t200so13504522wmt.0 for ; Mon, 28 Jan 2019 03:05:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=PB5pA5GKrN7y5OVHQcaOfdCOpg8Wl9SqU/L08GFqYsk=; b=QjhfuOYV8OofV2CJMprEm3LwJBR/f9YUZUpjS7rDuSciyY7uWnNShK1A++iahgx4oH DoTb9pj01Y/TP5Rve3jO7oOVmuUFW0GmrkGX95iwdENhUntGrHOZAYjLzUzOx2NKKtE0 tVOzbnCavJskGdU7gJskYdCkL86j7WAmLeSEE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=PB5pA5GKrN7y5OVHQcaOfdCOpg8Wl9SqU/L08GFqYsk=; b=q2/xETXilUJA3BvVQZXibVAZxZgYJCJQmE9D+GfqcM2P2Bor1n3/mTZORwUi/NAs9X AYRzunUnplCd9p0hDodqNXGjIb5X7sVJ2VbFQqUDVGQZmfiT6bZd1ND12EQ25MCsKcLX oY8EKwG8CecyNJZCYCkuuN+K5qlefKLPM8XVnORYqoHKR0ob9oTM0NKSMCa5BNj1Bdyh 453tFpkrPOcZHhij4S4lChPPjAsoUqczP5WY2Ty2dHYPSaKh5yNBiDja/8n7eouG4oQ6 /WxSht1/uRJHOQe7OU+LBiyMxb4NnNzB/lQ51KIUiAGqKecENhPjY+1BwqDeuqRHcvbj sCRQ== X-Gm-Message-State: AJcUukcQXuDP1iKFHJ/bVyjisqJbS2Z3oh7KSCkd3D+Jr52PixNQwILs D3wo2TLJjTfx6G4Q3ZYeFmJGnA== X-Received: by 2002:a1c:bd86:: with SMTP id n128mr16506937wmf.22.1548673551767; Mon, 28 Jan 2019 03:05:51 -0800 (PST) Received: from holly.lan (cpc141214-aztw34-2-0-cust773.18-1.cable.virginm.net. [86.9.19.6]) by smtp.gmail.com with ESMTPSA id j24sm139989260wrd.86.2019.01.28.03.05.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 03:05:50 -0800 (PST) Date: Mon, 28 Jan 2019 11:05:48 +0000 From: Daniel Thompson To: Chen-Yu Tsai Cc: Thierry Reding , Lee Jones , Jingoo Han , linux-pwm@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] backlight: pwm_bl: Use gpiod_get_value_cansleep() to get initial state Message-ID: <20190128110548.lqjgzxrppmezwtki@holly.lan> References: <20190127145054.3770-1-wens@csie.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190127145054.3770-1-wens@csie.org> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 27, 2019 at 10:50:54PM +0800, Chen-Yu Tsai wrote: > 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 Acked-by: Daniel Thompson Daniel. > --- > 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 >