From patchwork Fri Mar 22 15:43:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160917 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp959909jan; Fri, 22 Mar 2019 08:45:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqwsRsEVXxTAyeTz4mwRXvEfwPp6urYcSSAFx+L46D7MPyc0VnqzvBQv9p2fDL4bUdguYh/4 X-Received: by 2002:a63:84c7:: with SMTP id k190mr9555789pgd.255.1553269540169; Fri, 22 Mar 2019 08:45:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553269540; cv=none; d=google.com; s=arc-20160816; b=R/4AYuKNeFhwZ8X1d7y10+mhkRXccqCaOOTCrqFtx7/oNmb9R4IGUWjGwX8Ms2lNj0 BwUhwTyhhy5lZs+So6XpAeasrSgOjs49sCoGbhFkxV8S31ysiCnjqMZIsYVk5zv7tafw q3/4+TqCr401mQL66Y9Kr/UVb4I458cD7Ml+jLgyQxFd3ETRi8XE21VPboXmjVx7GGhD j58J8TM/Ts8pPXyeh8iDokTlM6f5SAwHd0OGt6N+wvbSEnLpaLPDHMmiaVxxWAXmQp// WXrYTnxYU7xO1Cy63dUicPk70tLFMcKh03uG83QBgM+mPJmSPrX0AxCvoL+swg3ckwTR KdEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=7SfS1lu9X9xvbydoECY6+/B8CyrL5DX70kH/QK2qqy8=; b=RKOqGnLVTGr5TgB54kRRA4iTg9fT0STGawW3+4RPBGy/IueqShQ1MnexrNmcKMH/EQ qHTKvDXzs+ozLnxP9U0KJ+61v9sF4JoNceCo67HyQ9oAyJ1emjJwJGhG3Zf5HunCcu7s 9dbPDpIJvtNn4xbhVFYifXtsx/KB1CDuRr9eBqzUYolxtv02bgp23XcmwkTRAHJqpmPD obp4CuAdp0JcHxk64JThzgFuuLvlduNgfZ4YeBdGLe2VTHdgnTPNXgnPXa/3dqkHiUxE pe6QELd9PGZYrtW3dBvYFc1uOd53tSKiQpkA2n+EWqnzmFEoTROLtdlMNq6Oku8FJuY2 davA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j9si6907231pgp.17.2019.03.22.08.45.39; Fri, 22 Mar 2019 08:45:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727567AbfCVPpj (ORCPT + 5 others); Fri, 22 Mar 2019 11:45:39 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:46287 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727566AbfCVPpi (ORCPT ); Fri, 22 Mar 2019 11:45:38 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1MIMT4-1hAiPn1nlM-00EKiE; Fri, 22 Mar 2019 16:45:31 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Ulf Hansson , Janusz Krzysztofik , Linus Walleij , Geert Uytterhoeven , "Tobin C. Harding" Cc: Martin Fuzzey , Tony Lindgren , Arnd Bergmann , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.4.y 03/25] mmc: pwrseq_simple: Make reset-gpios optional to match doc Date: Fri, 22 Mar 2019 16:43:54 +0100 Message-Id: <20190322154425.3852517-4-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190322154425.3852517-1-arnd@arndb.de> References: <20190322154425.3852517-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:pXc1FdV5baiz8nobVE1STGDw+yPyuO8D5aCB7/njBTG3bn2KmqX B54PkMpx2O48DEyo0oTsTQh2OqB99IvxhcqDqcLvpXZfvWcMbXb7DI02DPEHVMTHsR3zJAE C9EHBZBp/8tdh65r5gU1/Y/445Fw9vYXoq0ruLJnN8yeCxvQTazXKptL+lHAGGDfU2I1jOn mHrJNqxoVwc9g9fUUdmAg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:i9vy6Ber0Rw=:2FHa5XeVUadCz07UFhhK8Q N0/0jVYWsP57lD454t4yBp3B0pMSi49Qhk91shLAA0gYXRziF7WzAhFGZb8HRpnLhzNG4Cy+p EKK9kGmm++e9Okqii/UqYDRyl9vm0sKbxeqnmPnsdfT5czujW9EtFnxBIwJ20d/3Kr6sP9Oqz ejEcFBLcob/fe69f6SA7rpv3leb9mBpLXoIh/RPAtkMqVbnU6nBasI6dgLbHHM+K/NBk+HuCR E8jfZOCpMhzGG74+M1flAByPNFDF0PZA0F4mNOM2XbjXwn9YX1TWgu/5rTBVnkX8YYwTo96Yw E/oMPXjPgR4WPml1T1N/RmMq/mMTcYN2+N6iVLgeaN0vIJ2xxM1rSp4DuQ+RdJuGDSZwgkc9a 7uYaCoeJHIBUq8jHP4+l4t5pvLDeefD0MbhLW/A/aSR+xjy98khe4K9+kjQhsKZ4zebaQHxut i1HPbQ7bPD6NhpL4xGIRAlHLnzSsEZsX/dG/KtOh/r1ehU4E4LrrBV0Uy32Cn83jipe5kNwfG JlML2T7xhU9LFYSG28pYJxJskHtCjgaqNtp7QllVwgSC6tRjaaQ2MAYC3dXy1brfzTGR3GIbi 4MU/u9CVT3iJVKShy2+1D5xr6DRX3UU3or2zQO+K/eZQ0Cmdxi85UYebUTr59mnuTpY2TGDWA lg2xDtZxAWmh6bXSVxvzlALJBRO3lhFYTgAXkslDkiVvOIe0HEj1d31AWGsDSaR7bsb1pN/R8 e3Lu5RZUO9igX40C8mSYHLWqDsc4sR2Hk1eigw== Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org From: Martin Fuzzey The DT binding doc says reset-gpios is an optional property but the code currently bails out if it is omitted. This is a regression since it breaks previously working device trees. Fix it by restoring the original documented behaviour. Fixes: ce037275861e ("mmc: pwrseq_simple: use GPIO descriptors array API") Tested-by: Tony Lindgren Signed-off-by: Martin Fuzzey Signed-off-by: Ulf Hansson (cherry picked from commit 64a67d4762ce3ce4c9466eadd152d825fbf84967) Signed-off-by: Arnd Bergmann --- drivers/mmc/core/pwrseq_simple.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) -- 2.20.0 diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c index 2b16263458af..aba786daebca 100644 --- a/drivers/mmc/core/pwrseq_simple.c +++ b/drivers/mmc/core/pwrseq_simple.c @@ -29,15 +29,18 @@ struct mmc_pwrseq_simple { static void mmc_pwrseq_simple_set_gpios_value(struct mmc_pwrseq_simple *pwrseq, int value) { - int i; struct gpio_descs *reset_gpios = pwrseq->reset_gpios; - int values[reset_gpios->ndescs]; - for (i = 0; i < reset_gpios->ndescs; i++) - values[i] = value; + if (!IS_ERR(reset_gpios)) { + int i; + int values[reset_gpios->ndescs]; - gpiod_set_array_value_cansleep(reset_gpios->ndescs, reset_gpios->desc, - values); + for (i = 0; i < reset_gpios->ndescs; i++) + values[i] = value; + + gpiod_set_array_value_cansleep( + reset_gpios->ndescs, reset_gpios->desc, values); + } } static void mmc_pwrseq_simple_pre_power_on(struct mmc_host *host) @@ -79,7 +82,8 @@ static void mmc_pwrseq_simple_free(struct mmc_host *host) struct mmc_pwrseq_simple *pwrseq = container_of(host->pwrseq, struct mmc_pwrseq_simple, pwrseq); - gpiod_put_array(pwrseq->reset_gpios); + if (!IS_ERR(pwrseq->reset_gpios)) + gpiod_put_array(pwrseq->reset_gpios); if (!IS_ERR(pwrseq->ext_clk)) clk_put(pwrseq->ext_clk); @@ -112,7 +116,9 @@ struct mmc_pwrseq *mmc_pwrseq_simple_alloc(struct mmc_host *host, } pwrseq->reset_gpios = gpiod_get_array(dev, "reset", GPIOD_OUT_HIGH); - if (IS_ERR(pwrseq->reset_gpios)) { + if (IS_ERR(pwrseq->reset_gpios) && + PTR_ERR(pwrseq->reset_gpios) != -ENOENT && + PTR_ERR(pwrseq->reset_gpios) != -ENOSYS) { ret = PTR_ERR(pwrseq->reset_gpios); goto clk_put; }