Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1123085imm; Fri, 12 Oct 2018 12:09:59 -0700 (PDT) X-Google-Smtp-Source: ACcGV62bK48I4wBgmaZzeQFaPpy/9A9+4rUW9k/khHsj4zpvaAM7PifyjuUhRVt23Me6vUnoDChC X-Received: by 2002:a63:2323:: with SMTP id j35-v6mr6678918pgj.337.1539371399899; Fri, 12 Oct 2018 12:09:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539371399; cv=none; d=google.com; s=arc-20160816; b=yq1YngQfdBv2h1rRBMC69r0XviVR6uEFqJtEoo9vLkXhjdhciERhYYgqEVrYlQy3C7 wayogsvfJdEbhzH5O2TnYe/bqrb4UkMUX20E1qOdy7TAQivKxcfrGkHxbTPvRlA22Fz8 UT0aYVq9OV9m/uDsXzTPXwTtaALz1qZW2rDhMLCzp0YWJpFr7uBgdsAWI3CaGOkw7OqL UghCijJrfxzYNt9LS9Au8FMfD7h9KeLtg3etVrfSF1QXa9Uq4+PVyL2+oe4pfL6sCLrZ qpkyXC8zqTkPsC6XweYX8f3lfNEdwU3x69TnvNLqvmVvYFzdyef9zV4Qp1vhD83rTD6w +k9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=GaRB0w55q1HTP3osbZnN3wKaaRwWOUx826TTBAkNzwU=; b=YmYjb/629EkL4E8Q/aHB8Sesy3feihaOtM6X2zKacmh4uxYO3QPcJjwGTxOX/3m2U+ KXx6vpxEf+jfP4o0fDWmYrNvCSX3aDLmAle3yQ5m6O9BHd1yqC/QLAe3secLU9ozjnFs be1J+WIQ1o5A7jMYs4ySf32GiXJ6thosf+sC8wTWbL3Tsb+ZdQ3aQKf6fwNvw5c5/tmQ 7YcbO3ngXwNN/plOTP0QhtQ9JQE3pEq3C9Z4OfORvwSEz5/MokZziG7AAM3NMKmHyFO5 A9p4PMnbna8o5B2+7ykHKqVF7ANRSgQeC43XVqc3QbL7fhS9v7Q1rFK7GpTEENhZmHS1 C0nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=I9iDldZe; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o12-v6si2192471pfd.102.2018.10.12.12.09.45; Fri, 12 Oct 2018 12:09:59 -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=@gmail.com header.s=20161025 header.b=I9iDldZe; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726786AbeJMCll (ORCPT + 99 others); Fri, 12 Oct 2018 22:41:41 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:41379 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725851AbeJMCll (ORCPT ); Fri, 12 Oct 2018 22:41:41 -0400 Received: by mail-lj1-f195.google.com with SMTP id u21-v6so12243673lja.8; Fri, 12 Oct 2018 12:07:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GaRB0w55q1HTP3osbZnN3wKaaRwWOUx826TTBAkNzwU=; b=I9iDldZetEfJHGROPZ+tW9BimkrelJAhW2cHPlZw0ObA9z6+EqaL/3Z/W5MtVixpmv QLeREBzalrBiJ/ocb3exNtHtxFLh5BKC3nXuU5y8z/h8li3yqE6aAoEmRVBvjjTDQZwi UkQNC/FbFiSAqbWQwiSrEybQVtfAIXHbpqNC9NZyVnITv6o2iWredhlNQl4sK6/C+fxD xtsH0hTldnipI37f/H0OXYqd34KQwuljizQ4d/rkvKpEpM/dWCYnDhYkk1h62X9llNZN 0w127upK8b4WiGidTl/RNvoSnvCk+d76D3jVQOEH4AbtlGh8S6z9KHxJr/oK/2NKg0lm CQ7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GaRB0w55q1HTP3osbZnN3wKaaRwWOUx826TTBAkNzwU=; b=HN94NIK5WAJnUDNhnvl7lj2D661melW/iucN/xL0cLu9CmnH7Ggo7E545rajJqdPiy HALn0t7fdobo+W2DTj5GanzCw7NfW+rIg1jtcHdE8oLKNDyWaHdl32mMBAzB3ohjNCmu 5+WBHQQvR3NgR3YrIi/HemCFOOD8P/iar8ivZKrlCeeldc0ZeHVE3wX2XMZ0TuuRnFlT PRqlIdI5fIrvMlwpndtIfQ5LhXQSFwvRi21hy8Rf+aHOsMs9/pVkkGH8SP+mLqRgcgiu uPBTxZHeieixhcZjPh2vTeX7Ns7MQFCB02YfN6qvTzJsyeDlR5owThKqP6AH5HGUtZ4B tdjQ== X-Gm-Message-State: ABuFfogtaJROEfqX9TvHVffqzN+70RlDO/cm3LDe703sDAtgnEdzaLLW x9UI1luTvZEWtwXYT4NzSrk= X-Received: by 2002:a2e:9f17:: with SMTP id u23-v6mr4729689ljk.53.1539371263199; Fri, 12 Oct 2018 12:07:43 -0700 (PDT) Received: from localhost.localdomain ([31.0.86.150]) by smtp.gmail.com with ESMTPSA id h8-v6sm412359lfc.47.2018.10.12.12.07.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Oct 2018 12:07:42 -0700 (PDT) From: Janusz Krzysztofik To: Ulf Hansson Cc: Linus Walleij , Marek Szyprowski , Krzysztof Kozlowski , linux-mmc@vger.kernel.org, linux-gpio@vger.kernel.org, Linux Samsung SOC , linux-kernel@vger.kernel.org, Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org, Kukjin Kim , =?UTF-8?q?Beno=C3=AEt=20Cousson?= , Tony Lindgren , Enric Balletbo i Serra , Javier Martinez Canillas , linux-omap@vger.kernel.org, Heiko Stuebner , linux-rockchip@lists.infradead.org, Carlo Caione , Kevin Hilman , linux-amlogic@lists.infradead.org, Janusz Krzysztofik Subject: [RFT PATCH] mmc: pwrseq_simple: Fix incorrect handling of GPIO bitmap Date: Fri, 12 Oct 2018 21:09:01 +0200 Message-Id: <20181012190901.1243-1-jmkrzyszt@gmail.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180925192433.1377-1-jmkrzyszt@gmail.com> References: <20180925192433.1377-1-jmkrzyszt@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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