Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3545087imm; Sun, 30 Sep 2018 23:46:52 -0700 (PDT) X-Google-Smtp-Source: ACcGV61aoWZDrCM57FZhama8En5wotgYqjCl5buo/cbsGqRVwrmNgxCkeBJqHykGDpEb5K8Zofou X-Received: by 2002:a62:8dcd:: with SMTP id p74-v6mr9190555pfk.217.1538376412518; Sun, 30 Sep 2018 23:46:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538376412; cv=none; d=google.com; s=arc-20160816; b=f+oCyyswXtPqFWlRX/4aGficIYBtds41Wb10T20nq9tdEDDpJdIgsFArzAbvpdoyg7 uMYqWWx76NickNV7CUkxPmw3Fze5L8iPitqrAVxhv0+Cpp9GlDiu9QoLtp0q0tdF8LUH pbTzO/NkXbwA8Z5pe2ieCPmTpjE2tZlxiRE63rCzwKrlTJf9DDh9CR9+GUnrtabj4WMh MaUEcb7+cl9RQPJbjjFvXfyDnxyRbvoXFGypErrmcBB+vhaPLJL2dRpEby7UIEiXM8pt 0/VkDb3QZobQ9utt7evgWv5B5v3GInIE/IuKevwAojopyvkAIvBV967gIOr3SOzxNwnI YQzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:message-id :content-language:content-transfer-encoding:in-reply-to:mime-version :user-agent:date:from:cc:to:subject:dkim-signature:dkim-filter; bh=rdYEjRZezE/cKY58GXsgYvc4WfmTr0DXbMy3ceWLe2U=; b=bsd611d1wEu59tv4mKwKYMevHvS8G68U6zY2U3o/j3R0eCKugXK6twdCdQGGM3hsC9 fdsIaIRIISwEq0V2RwiBxl1CBoUOPSVFukkXrek7c7xz41YQVZ2sRGmVzK6DU4lX+TAH ZKynAbsM/4zYyLfjZ6vpf5HFxppzFXNZu9hqxayAppZiLam8mHxHYPkw8zz3zf1ONPBa pP2jkR0rrMwUD5zDKw8D6G8pi2vAuoGKFyzEiNyYbk30WQRkkQ4qZiVmVpr18PNrUsT/ OvMaY0qs6vFH8hZ2UyV09Ys4tyaDSCyuZpB40lLv8VeXVzS/BU9M2MijCNGk/2HL7Hj0 ps7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=IxgofUGr; 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=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w6-v6si11454159pgp.42.2018.09.30.23.46.36; Sun, 30 Sep 2018 23:46:52 -0700 (PDT) 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=@samsung.com header.s=mail20170921 header.b=IxgofUGr; 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=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728734AbeJANWg (ORCPT + 99 others); Mon, 1 Oct 2018 09:22:36 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:40214 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726486AbeJANWf (ORCPT ); Mon, 1 Oct 2018 09:22:35 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20181001064620euoutp022dde97e8f40ddc5b69e1166a5104b0ed~ZaSrO6Pj20753007530euoutp02M; Mon, 1 Oct 2018 06:46:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181001064620euoutp022dde97e8f40ddc5b69e1166a5104b0ed~ZaSrO6Pj20753007530euoutp02M DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1538376380; bh=rdYEjRZezE/cKY58GXsgYvc4WfmTr0DXbMy3ceWLe2U=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=IxgofUGrkvWaVCHzzWMyMGNlvHZ73oW+DS5i6cSKYfmu49Bx35LXy2vm+/d0RO974 mQstsZUpkHyCDNCpEaKR5MA7dTWVk7s1PFpq/gMW58IhJk6hMleJp6shnLziK+06Af g2v9ub11kZbetqfoZPtQe6iedBrvkpjr9daCOQxY= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181001064619eucas1p1dcab342ee92a0eb01754786458dd6bfc~ZaSqtnzM10813708137eucas1p1U; Mon, 1 Oct 2018 06:46:19 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id C0.9B.04806.BB2C1BB5; Mon, 1 Oct 2018 07:46:19 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20181001064618eucas1p28ccab6242ec7f562912a83584a65e768~ZaSpX0FfS1643816438eucas1p2f; Mon, 1 Oct 2018 06:46:18 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20181001064617eusmtrp12c17a9003d46ec99b2699e6127a14345~ZaSpEt7ij2053720537eusmtrp1P; Mon, 1 Oct 2018 06:46:17 +0000 (GMT) X-AuditID: cbfec7f5-34dff700000012c6-05-5bb1c2bb1301 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id E7.89.04128.9B2C1BB5; Mon, 1 Oct 2018 07:46:17 +0100 (BST) Received: from [106.116.147.30] (unknown [106.116.147.30]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20181001064616eusmtip11650b70a1b797085c962b3207aaf9bfc~ZaSn0Hmq_3141931419eusmtip1v; Mon, 1 Oct 2018 06:46:16 +0000 (GMT) Subject: Re: [PATCH] gpiolib: Fix incorrect use of find_next_zero_bit() To: Janusz Krzysztofik , Linus Walleij Cc: Miguel Ojeda Sandonis , Peter Korsgaard , Peter Rosin , Ulf Hansson , Andrew Lunn , Florian Fainelli , "David S. Miller" , Dominik Brodowski , Greg Kroah-Hartman , Kishon Vijay Abraham I , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Hartmut Knaack , Peter Meerwald-Stadler , Jiri Slaby , Willy Tarreau , Geert Uytterhoeven , Sebastien Bourdelin , Lukas Wunner , Rojhalat Ibrahim , Russell King , Tony Lindgren , Yegor Yefremov , =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= , Krzysztof Kozlowski , linux-gpio@vger.kernel.org, linux-i2c@vger.kernel.org, linux-mmc@vger.kernel.org, netdev@vger.kernel.org, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-serial@vger.kernel.org, Linux Samsung SOC , linux-kernel@vger.kernel.org From: Marek Szyprowski Date: Mon, 1 Oct 2018 08:46:16 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180929122022.6825-1-jmkrzyszt@gmail.com> Content-Transfer-Encoding: 7bit Content-Language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA01Tb0wTZxzOe3e9O7rVHJXJC8yZlI2FZcoM2/LbcGYmy3bZh4WYzLnVOOo8 wUHRtMCmn4gwhQYCUiJQiyU4KTKh9c+gFCl6FLpZpFgBka2bS4Q5EQSKJgrCPA83vv2e5/c8 7+95PrwsqZ6lY9m92TmCIVuXpaGVVGvvo8D6DvGs9q2frmIIhEQSrIFCCi72PWbg8ZSXgfHR TgIK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tbEP8ieHp+8EgxUfdOe+sa2oCshZpmtpX9BSYnZevUG 0iTqXwEhq4lYlwMAAA== Message-Id: <20181001064618eucas1p28ccab6242ec7f562912a83584a65e768~ZaSpX0FfS1643816438eucas1p2f@eucas1p2.samsung.com> X-CMS-MailID: 20181001064618eucas1p28ccab6242ec7f562912a83584a65e768 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20180929121916epcas4p2eb8be6cdd6b11d675510f0a54b546bb5 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180929121916epcas4p2eb8be6cdd6b11d675510f0a54b546bb5 References: <20180923235336.22148-2-jmkrzyszt@gmail.com> <20180929122022.6825-1-jmkrzyszt@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Janusz, On 2018-09-29 14:20, Janusz Krzysztofik wrote: > Commit b17566a6b08b ("gpiolib: Implement fast processing path in > get/set array"), already fixed to some extent with commit 5d581d7e8cdc > ("gpiolib: Fix missing updates of bitmap index"), introduced a new mode > of processing bitmaps where bits applicable for fast bitmap processing > path are supposed to be skipped while iterating bits which don't apply. > Unfortunately, find_next_zero_bit() function supposed to skip over > those fast bits is always called with a 'start' argument equal to an > index of last zero bit found and returns that index value again an > again, causing an infinite loop. > > Fix it by incrementing the index uncoditionally before > find_next_zero_bit() is optionally called. > > Reported-by: Marek Szyprowski > Signed-off-by: Janusz Krzysztofik Tested-by: Marek Szyprowski > --- > Marek, > > Could you please test it on top of next-20180920 with "gpiolib: Fix > missing updates of bitmap index" and optionally "mmc: pwrseq_simple: > Fix incorrect handling of GPIO bitmap" also applied? This patch finally fixes the boot issue on Samsung Chromebook Snow. Thanks! > > Thanks, > Janusz > > > drivers/gpio/gpiolib.c | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c > index 6ae13e3e05f1..940b543e966d 100644 > --- a/drivers/gpio/gpiolib.c > +++ b/drivers/gpio/gpiolib.c > @@ -2878,12 +2878,11 @@ int gpiod_get_array_value_complex(bool raw, bool can_sleep, > int hwgpio = gpio_chip_hwgpio(desc); > > __set_bit(hwgpio, mask); > + i++; > > if (array_info) > i = find_next_zero_bit(array_info->get_mask, > array_size, i); > - else > - i++; > } while ((i < array_size) && > (desc_array[i]->gdev->chip == chip)); > > @@ -2903,12 +2902,11 @@ int gpiod_get_array_value_complex(bool raw, bool can_sleep, > value = !value; > __assign_bit(j, value_bitmap, value); > trace_gpio_value(desc_to_gpio(desc), 1, value); > + j++; > > if (array_info) > j = find_next_zero_bit(array_info->get_mask, i, > j); > - else > - j++; > } > > if (mask != fastpath) > @@ -3191,12 +3189,11 @@ int gpiod_set_array_value_complex(bool raw, bool can_sleep, > __clear_bit(hwgpio, bits); > count++; > } > + i++; > > if (array_info) > i = find_next_zero_bit(array_info->set_mask, > array_size, i); > - else > - i++; > } while ((i < array_size) && > (desc_array[i]->gdev->chip == chip)); > /* push collected bits to outputs */ Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland