From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bryan Wu Subject: Re: [PATCH 1/2] leds: trigger: gpio: fix warning in gpio trigger for gpios whose accessor function may sleep Date: Thu, 11 Sep 2014 17:13:02 -0700 Message-ID: References: <1410248433-24005-1-git-send-email-LW@KARO-electronics.de> <1410248433-24005-2-git-send-email-LW@KARO-electronics.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from mail-lb0-f181.google.com ([209.85.217.181]:43154 "EHLO mail-lb0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752160AbaILANY convert rfc822-to-8bit (ORCPT ); Thu, 11 Sep 2014 20:13:24 -0400 In-Reply-To: <1410248433-24005-2-git-send-email-LW@KARO-electronics.de> Sender: linux-leds-owner@vger.kernel.org List-Id: linux-leds@vger.kernel.org To: =?UTF-8?Q?Lothar_Wa=C3=9Fmann?= Cc: Linux LED Subsystem , lkml , Richard Purdie On Tue, Sep 9, 2014 at 12:40 AM, Lothar Wa=C3=9Fmann wrote: > When using a GPIO driver whose accessor functions may sleep (e.g. an > I2C GPIO extender like PCA9554) the following warning is issued: > WARNING: CPU: 0 PID: 665 at drivers/gpio/gpiolib.c:2274 gpiod_get_raw= _value+0x3c/0x48() > Modules linked in: > CPU: 0 PID: 665 Comm: kworker/0:2 Not tainted 3.16.0-karo+ #115 > Workqueue: events gpio_trig_work > [] (unwind_backtrace) from [] (show_stack+0x10/0x= 14) > [] (show_stack) from [] (warn_slowpath_common+0x6= 4/0x84) > [] (warn_slowpath_common) from [] (warn_slowpath_= null+0x1c/0x24) > [] (warn_slowpath_null) from [] (gpiod_get_raw_va= lue+0x3c/0x48) > [] (gpiod_get_raw_value) from [] (gpio_trig_work+= 0x1c/0xb0) > [] (gpio_trig_work) from [] (process_one_work+0x1= 44/0x38c) > [] (process_one_work) from [] (worker_thread+0x60= /0x5cc) > [] (worker_thread) from [] (kthread+0xb4/0xd0) > [] (kthread) from [] (ret_from_fork+0x14/0x24) > ---[ end trace cd51a1dad8b86c9c ]--- > > Fix this by using the _cansleep() variant of gpio_get_value(). > Good catch, I will merge this. Thanks, -Bryan > Signed-off-by: Lothar Wa=C3=9Fmann > --- > drivers/leds/trigger/ledtrig-gpio.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/leds/trigger/ledtrig-gpio.c b/drivers/leds/trigg= er/ledtrig-gpio.c > index 35812e3..c86c418 100644 > --- a/drivers/leds/trigger/ledtrig-gpio.c > +++ b/drivers/leds/trigger/ledtrig-gpio.c > @@ -48,7 +48,7 @@ static void gpio_trig_work(struct work_struct *work= ) > if (!gpio_data->gpio) > return; > > - tmp =3D gpio_get_value(gpio_data->gpio); > + tmp =3D gpio_get_value_cansleep(gpio_data->gpio); > if (gpio_data->inverted) > tmp =3D !tmp; > > -- > 1.7.10.4 >