From mboxrd@z Thu Jan 1 00:00:00 1970 From: Janusz Krzysztofik Subject: Re: [PATCH v7 4/4] gpiolib: Implement fast processing path in get/set array Date: Thu, 20 Sep 2018 18:21:09 +0200 Message-ID: <15226900.TQMLYV7PZ0@z50> References: <20180831225616.29221-1-jmkrzyszt@gmail.com> <20180920101151eucas1p221f5a1715b8556bb9d99bf08fe09ce6f~WE-_cEf4l0754207542eucas1p27@eucas1p2.samsung.com> <9860023.SlBYqtbjDV@z50> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Andrew Lunn , Ulf Hansson , linux-doc@vger.kernel.org, linux-iio@vger.kernel.org, Linus Walleij , Dominik Brodowski , Peter Rosin , netdev@vger.kernel.org, linux-i2c@vger.kernel.org, Peter Meerwald-Stadler , devel@driverdev.osuosl.org, Florian Fainelli , Jonathan Corbet , Janusz Krzysztofik , Krzysztof Kozlowski , Kishon Vijay Abraham I , Tony Lindgren , Lukas Wunner , Geert Uytterhoeven , linux-serial@vger.kernel.org, Jiri Slaby , Michael Hennerich , =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= , linux-gpio@vger.kernel.org, Russ To: Marek Szyprowski Return-path: In-Reply-To: <9860023.SlBYqtbjDV@z50> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" List-Id: netdev.vger.kernel.org On Thursday, September 20, 2018 5:48:22 PM CEST Janusz Krzysztofik wrote: > On Thursday, September 20, 2018 12:11:48 PM CEST Marek Szyprowski wrote: > > Hi All, > > > > On 2018-09-02 14:01, Janusz Krzysztofik wrote: > > > Certain GPIO descriptor arrays returned by gpio_get_array() may contain > > > information on direct mapping of array members to pins of a single GPIO > > > chip in hardware order. In such cases, bitmaps of values can be passed > > > directly from/to the chip's .get/set_multiple() callbacks without > > > wasting time on iterations. > > > > > > Add respective code to gpiod_get/set_array_bitmap_complex() functions. > > > Pins not applicable for fast path are processed as before, skipping > > > over the 'fast' ones. > > > > > > Cc: Jonathan Corbet > > > Signed-off-by: Janusz Krzysztofik > > > > I've just noticed that this patch landed in today's linux-next. Sadly it > > breaks booting of Exynos5250-based Samsung Snow Chromebook (ARM 32bit, > > device-tree source arch/arm/boot/dts/exynos5250-snow.dts). > > > > Booting hangs after detecting MMC cards. Reverting this patch fixes the > > boot. I will try later to add some debugs and investigate it further what > > really happens when booting hangs. > > Hi Marek, > > Thanks for reporting. Could you please try the following fix? Hi again, I realized the patch was not correct, j, not i, should be updated in second hunk. Please try the following one. Thanks, Janusz >>From a919c504850f6cb40e8e81267a3a37537f7c4fd4 Mon Sep 17 00:00:00 2001 From: Janusz Krzysztofik Date: Thu, 20 Sep 2018 17:37:21 +0200 Subject: [PATCH] gpiolib: Fix bitmap index not updated While skipping fast path bits, bitmap index is not updated with next found zero bit position. Fix it. Signed-off-by: Janusz Krzysztofik --- drivers/gpio/gpiolib.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index a53d17745d21..369bdd358fcc 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -2880,7 +2880,7 @@ int gpiod_get_array_value_complex(bool raw, bool can_sleep, __set_bit(hwgpio, mask); if (array_info) - find_next_zero_bit(array_info->get_mask, + i = find_next_zero_bit(array_info->get_mask, array_size, i); else i++; @@ -2905,7 +2905,8 @@ int gpiod_get_array_value_complex(bool raw, bool can_sleep, trace_gpio_value(desc_to_gpio(desc), 1, value); if (array_info) - find_next_zero_bit(array_info->get_mask, i, j); + j = find_next_zero_bit(array_info->get_mask, i, + j); else j++; } @@ -3192,7 +3193,7 @@ int gpiod_set_array_value_complex(bool raw, bool can_sleep, } if (array_info) - find_next_zero_bit(array_info->set_mask, + i = find_next_zero_bit(array_info->set_mask, array_size, i); else i++; -- 2.16.4