From patchwork Sat Dec 1 15:41:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 152633 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp4934415ljp; Sat, 1 Dec 2018 07:53:11 -0800 (PST) X-Google-Smtp-Source: AFSGD/XdHMA/brANxTe2R6xe4oul2O5B2rf4DNM0LD5EDUhAJVgcvCCqYLAWkcvO03RTau7Bf2RU X-Received: by 2002:a62:6799:: with SMTP id t25mr9645747pfj.139.1543679591114; Sat, 01 Dec 2018 07:53:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543679591; cv=none; d=google.com; s=arc-20160816; b=M7Y1A+bOPuRBN2kdNk3igvd+fRXkyhqg2kpOyV0s0E02UZNXcasON4JRiMCcoNGvN6 6+vOGIolvysQsmRdiUEqmYDkc77VAolwvb5ZmH/TKnikf+tSQs/jAweMVdl9UXklIW7C gEinyTDwPL9cgWpOO43B0fAtzk+ixXdv7rDhSk7vX+A6XtyLVPbwx3MlgFIA+9fwSr8v jBImL/CXSFW0N2fvJ9q5BJ7sTjHZXq55YsXToQaxWfN8TKPvU/rt/Jg413Ka2wIY6AAQ vIuYVo4VxFVF/KiA8y7SwBp0jp0gcQmaQaVnp0RhbJP4zRwibFCD3sdo0dDuqTJJ3VRJ BI+Q== 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 :dkim-signature; bh=3iUsZ/16+oDFR/k1SSqoY5Bn/jlRg+zr47SC2D/gEWM=; b=cLJ2ioKPzf6KWHGnAjM6ksmnzNvBo1MRRhbi7lyGK7hFUI3JHtTQ5xxPzxZNv3Fwr0 JJS0PLU595BLADUPCermTAPq0cmG5znECLdGwVJNwe5zl9rsCWcKe3UK8VPhgNYc9JYC necG4MzTQb0QFLYW/6Wi2xWgspSzO4e6EBknATs4TvcduKql6QL9PHveZh6nxcg08g67 UVXkGaetxAIEGDgFwK/+M0hbLw0+EzK42Ym5F0XkSWw6RR19emuZMaThRM4iFA65TW98 rDw4NUIeK71gqpP/lFLs/375zyoO1sAakchIueSrBtjNp+/TXNCB2g8YtoI5XM7iYbgP V7hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=j3DMkc9d; 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 p9si7596622pgc.448.2018.12.01.07.53.10; Sat, 01 Dec 2018 07:53:11 -0800 (PST) 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=j3DMkc9d; 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 S1727225AbeLBDF4 (ORCPT + 32 others); Sat, 1 Dec 2018 22:05:56 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:47056 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727050AbeLBDFz (ORCPT ); Sat, 1 Dec 2018 22:05:55 -0500 Received: by mail-lf1-f68.google.com with SMTP id f23so6180451lfc.13 for ; Sat, 01 Dec 2018 07:53:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3iUsZ/16+oDFR/k1SSqoY5Bn/jlRg+zr47SC2D/gEWM=; b=j3DMkc9ddwMjPqKCKbD7hXOMHd2rlLnPLk6WsLo2IASfy3MDmNSzo4yEfkwl6w9fDO e5H5wiTmvGwZfk634qy9KHznxDvTwiL/1184WnjfTe+o6Xt6e8XJHym+JM7K/6iQuLYk NgePIWkTJ7aV7V6YD0hGP37ah01Qd039ZIWJ8= 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:mime-version:content-transfer-encoding; bh=3iUsZ/16+oDFR/k1SSqoY5Bn/jlRg+zr47SC2D/gEWM=; b=hkgqPTpQQaPONfpgg/4T55p+knB5L/zKfHYd7mOArP2FkahIq0nFKeyX57Bcf2Yq5I HmE+chPeOJwHRFOU2QMweE/07EFtNRoRgA9ukofmk81lU47cjwcMrWsjw8/wHThSGOIT L0hkhsMeAy2RfMrNREHhMeNvepvrL/D+WcFEzMO5ykztYZq/ybTEvMvij8HE5uMRl2oW SBBCj9zH2YTHENkju0NPx17rFwCD6yX+xmbmAQmbLizYiOyM+zpcPYPInKbeuZU/1qny 9kSKFvEaD0me5wjFE1ktpue222oOVxyredFrCnxFxW39qHQfrSf94IKvG0zINVdO0Ibe 08VA== X-Gm-Message-State: AA+aEWZu7fr5BhWlq48W5l8a29qvddMD8axX+MbxtvT5OMTpz19YL85b W3NBT3ur4njdGVgIBytl3qv5eg== X-Received: by 2002:a19:9904:: with SMTP id b4mr5610949lfe.95.1543679585544; Sat, 01 Dec 2018 07:53:05 -0800 (PST) Received: from localhost.localdomain (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id 13-v6sm1365426ljj.49.2018.12.01.07.53.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 01 Dec 2018 07:53:04 -0800 (PST) From: Linus Walleij To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, Charles Keepax , Bartosz Golaszewski , Marek Szyprowski , Linus Walleij Subject: [PATCH 02/13 v2] regulator: fixed: Let core handle GPIO descriptor Date: Sat, 1 Dec 2018 16:41:40 +0100 Message-Id: <20181201154151.14890-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181201154151.14890-1-linus.walleij@linaro.org> References: <20181201154151.14890-1-linus.walleij@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the gpiod_get() rather than the devm_* version so that the regulator core can handle the lifecycle of these descriptors. Fixes: efdfeb079cc3 ("regulator: fixed: Convert to use GPIO descriptor only") Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Drop the conditional gpiod_put() on the errorpath: the regulator core will take care of that once devm_regulator_register() gets called. - Put a comment in the code so maintainers knows not to use managed resources (devm*) --- drivers/regulator/fixed.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.19.1 diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c index ccc29038f19a..9abdb9130766 100644 --- a/drivers/regulator/fixed.c +++ b/drivers/regulator/fixed.c @@ -183,7 +183,11 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev) */ gflags |= GPIOD_FLAGS_BIT_NONEXCLUSIVE; - cfg.ena_gpiod = devm_gpiod_get_optional(&pdev->dev, NULL, gflags); + /* + * Do not use devm* here: the regulator core takes over the + * lifecycle management of the GPIO descriptor. + */ + cfg.ena_gpiod = gpiod_get_optional(&pdev->dev, NULL, gflags); if (IS_ERR(cfg.ena_gpiod)) return PTR_ERR(cfg.ena_gpiod);