Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3744356imm; Mon, 15 Oct 2018 03:31:46 -0700 (PDT) X-Google-Smtp-Source: ACcGV624ChK82Rea+vl5eZKrLKAlI4tCgXMVzZ2m/kI86tAsARSK+6mfJcEuhN6U3E6ZCzAIhKIH X-Received: by 2002:a17:902:109:: with SMTP id 9-v6mr16358995plb.320.1539599505996; Mon, 15 Oct 2018 03:31:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539599505; cv=none; d=google.com; s=arc-20160816; b=L/V9LHtOgh7V4ThF5/HGjcPK9O//oL5ZZvX8LvvniOo8V6Dr45t0fO6td+tIYy+L7x TOCNCFwFn8G7JQhROTVNlVhgFLxIvSU7qo+MohdXqIB8ZtsrD7Q2jSW2u0WNRDVxDn/R TOJwHv4ZiP96msHzx6ZrULZCoPrjlg5ImfRUiAQ+3UK7Cp0IhbN6dKgksupC0ooa5cDW trehz5a/4NXZwnV6/c5lFDYZbHg0w2AFRHgN/y4QoGMc/MqRQ4zB8PcECikT5p9tolGc y3zy5IS0lmYKmXw1uZRREj45rBDHQBP2/c9R2dcoVrvw2qCyeON6DMvEehZta1I7Dv0c rXLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature; bh=sSXtiDuCCaI2hcCx44yKcXUbp9izKXoYmZW203wptsk=; b=DrB5MMfPxuK+YoS1CXyWBMa848bPtUSqJ7djNN/quGkpzeQuaEYXZitQpRXZQPG44K ih9AYG/CeDX84NG2p80h33JmAqxNwSIunfrghHmomzLCBi2i0xt8asn4fzM1P2yVpwh0 VXu8urNUDqvx3s0VC8cmBYrmtMNpsImIFmrlckxVjzJmfI+vL3zeR8gk7DAE9YsklXNw 1x62GTHM4Qn/PD5qKZbhiwp/1/I3DuBSV35vATNBJ4mLsNUTbWLgXMRYmBcMt5CACxLy 6fGpxZ2aaWtf0y+Fwp7eIXmWe7sdWKKSWFTiv49fwYufm/Og2OltwF9dQYu8g1o7DNsv AOew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UujQ3IVa; 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 l6-v6si8995646pgh.373.2018.10.15.03.31.30; Mon, 15 Oct 2018 03:31:45 -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=@linaro.org header.s=google header.b=UujQ3IVa; 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 S1726764AbeJOSO2 (ORCPT + 99 others); Mon, 15 Oct 2018 14:14:28 -0400 Received: from mail-it1-f194.google.com ([209.85.166.194]:40740 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726400AbeJOSO2 (ORCPT ); Mon, 15 Oct 2018 14:14:28 -0400 Received: by mail-it1-f194.google.com with SMTP id i191-v6so26928016iti.5 for ; Mon, 15 Oct 2018 03:29:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=sSXtiDuCCaI2hcCx44yKcXUbp9izKXoYmZW203wptsk=; b=UujQ3IVaXFiuzoJVGekA7KleZXV5bAEnHoEkfmbYUHhbqr+/N+oFnFEI43wR55UHNF U6tDFeWnWrWnDomtqZdhHRHD8baI6lqsBACpu7p4jtYH4y8woQFhbCYai2DHNFA7H5dw tYJjaHQbLTCIIK5b20OkuL4p90fWZrF8VgwzY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=sSXtiDuCCaI2hcCx44yKcXUbp9izKXoYmZW203wptsk=; b=WcMOwlnSYS4pNFL4TatcBua0KSMuMbJOw/gxv/wXlo+UUgHAN2shmmF7i9dSgr9opN 1bEChv9AfNegWpidxSp1jycmT7nbTmp2uTaRcx9qyn2MxcL2Z3wTdz9Yqg+Ltif1tRsu bms5yOZFnJVuTyXCmr2OVsRxmkPOuNAlQM2A7LOvm77iPbvsz/PirknA/vf/fLpWjlRs aWAMCjgflx2RUFxPHCyCTdSMoVanAc6IOVZHlW0LXDehj5vTfeL4OfOBdiKz7g0jE8Uh 8aoLqO6Y7/a5PaOmgmMWZdCFdXDx3KY0ChO8jAZV13WQOZs4g0oEPNFpTWdoxf9g7WkV w6HA== X-Gm-Message-State: ABuFfogKgIQsqZ99C10HR8BNJrWWVlYKk8s6p2YieM+rciQpHr0CdCoS /+sxOiqFuLyMOGde33p01PRo+ckz81d358Lq9FiOPA== X-Received: by 2002:a24:4795:: with SMTP id t143-v6mr11502004itb.78.1539599388601; Mon, 15 Oct 2018 03:29:48 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:3941:0:0:0:0:0 with HTTP; Mon, 15 Oct 2018 03:29:08 -0700 (PDT) In-Reply-To: <20181012190901.1243-1-jmkrzyszt@gmail.com> References: <20180925192433.1377-1-jmkrzyszt@gmail.com> <20181012190901.1243-1-jmkrzyszt@gmail.com> From: Ulf Hansson Date: Mon, 15 Oct 2018 12:29:08 +0200 Message-ID: Subject: Re: [RFT PATCH] mmc: pwrseq_simple: Fix incorrect handling of GPIO bitmap To: Janusz Krzysztofik Cc: Linus Walleij , Marek Szyprowski , Krzysztof Kozlowski , "linux-mmc@vger.kernel.org" , linux-gpio@vger.kernel.org, Linux Samsung SOC , Linux Kernel Mailing List , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Linux ARM , Kukjin Kim , =?UTF-8?Q?Beno=C3=AEt_Cousson?= , Tony Lindgren , Enric Balletbo i Serra , Javier Martinez Canillas , linux-omap , Heiko Stuebner , "open list:ARM/Rockchip SoC..." , Carlo Caione , Kevin Hilman , "open list:ARM/Amlogic Meson..." Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12 October 2018 at 21:09, Janusz Krzysztofik wrote: > Commit b9762bebc633 ("gpiolib: Pass bitmaps, not integer arrays, to > get/set array") changed the way GPIO values are passed to > gpiod_get/set_array_value() and friends. The new code introduced into > mmc_pwrseq_simple_set_gpios_value() incorrectly interpretes the 'value' > argument as a bitmap of GPIO values and assigns it directly to the > 'values' bitmap variable passed to gpiod_set_array_value_cansleep() > instead of filling that bitmap with bits equal to the 'value' argument. > As a result, only member 0 of the array is handled correctly. > > Moreover, wrong assumption is taken about the 'values' bitmap size not > exceding the number of bits of the 'value' argument type. > > Fix it. > > Signed-off-by: Janusz Krzysztofik Acked-by: Ulf Hansson Kind regards Uffe > --- > Hi, > > I think that patch has been missed while we were resolving issues > related to GPIO fast bitmap processing. Since all issues other than the > one addreessed by this patch have been been hopefully identified and > fixed, GPIO tree seems now to be in good shape in regard to that. > However, I believe pwrseq_simple is still broken. Hence, I'm > resubmitting this patch to Ulf for inclusion in MMC tree, Cc: many other > people who are kindly requested to test it if possible. > > I've identified the following DT files representing devices which may be > affected (have more than one GPIO assigned to pwrseq_simple): > - arch/arm/boot/dts/imx6qdl-sr-som-brcm.dtsi > - arch/arm/boot/dts/exynos5250-snow-common.dtsi > - arch/arm/boot/dts/imx6sl-warp.dts > - arch/arm/boot/dts/omap3-igep0030.dts > - arch/arm/boot/dts/omap3-igep0020.dts > - arch/arm/boot/dts/rk3036-kylin.dts > - arch/arm64/boot/dts/rockchip/rk3368-r88.dts > - arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi > > Please start with checking if pwrseq_simple from linux-next works for > you and if not, please test if this patch fixes the issue. > > Thanks, > Janusz > > > drivers/mmc/core/pwrseq_simple.c | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c > index 7f882a2bb872..ece34c734693 100644 > --- a/drivers/mmc/core/pwrseq_simple.c > +++ b/drivers/mmc/core/pwrseq_simple.c > @@ -40,13 +40,22 @@ static void mmc_pwrseq_simple_set_gpios_value(struct mmc_pwrseq_simple *pwrseq, > struct gpio_descs *reset_gpios = pwrseq->reset_gpios; > > if (!IS_ERR(reset_gpios)) { > - DECLARE_BITMAP(values, BITS_PER_TYPE(value)); > + unsigned long *values; > int nvalues = reset_gpios->ndescs; > > - values[0] = value; > + values = bitmap_alloc(nvalues, GFP_KERNEL); > + if (!values) > + return; > + > + if (value) > + bitmap_fill(values, nvalues); > + else > + bitmap_zero(values, nvalues); > > gpiod_set_array_value_cansleep(nvalues, reset_gpios->desc, > reset_gpios->info, values); > + > + kfree(values); > } > } > > -- > 2.16.4 >