From patchwork Wed Dec 5 12:47:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 152904 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp9256684ljp; Wed, 5 Dec 2018 04:48:51 -0800 (PST) X-Google-Smtp-Source: AFSGD/V2i5qwvf8Q2HIiiN0ldw6mX+AIRqZEPkyaUgI7w16zobg3fBOQ3fyp7xvmM7DP25rBMtKy X-Received: by 2002:a63:1e56:: with SMTP id p22mr10443684pgm.126.1544014131277; Wed, 05 Dec 2018 04:48:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544014131; cv=none; d=google.com; s=arc-20160816; b=QqWed14PL8w7ekql9Nsndaj5AzIRb4kHCo6WUM2LC7+5X9gnUAPx9nAq1kYKtVWxod YJ8733h4zeIWFeI9JGfPAnbZQtPJd/Fc18/qJ5bBUeRS3EH8lgqhbuWPahcJzk/6skZT 989+UdCfiTQLw5dMTflOedCgN+omIUpPsgxiSxB3m/6ioa3NIdLK+IT2DnBeXNlN8ihx jPi3oZdt7aHSPJtR+GWEeWs8eQ0luq/7VX+kisuwB+TffbrbtRUhIgP0mTI1N6Q2rvWp UtXGlaudCTNRFO0+TOl7A4Gqo1sFwoGVIIg77DoPNQmBq8ROfFYCBgrvjZ78cmDgoEsa QvGA== 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=O/tSaH5O7cNIBaIVmHZFPw2uq5T69lxPBmIyOOIA2ik=; b=xm2zqH9Jb6FBid2TdR2AmILtCPmRmh1B9Hk+pHI6jy0DHy4DXhM9aewWF4tg5NiCFq 9ju7E68rl8GNpWExZeOsU021rUFZDI9j9z2tlpm/dlmaC39aQHJZ8eQTYHZuQNOHXKt+ Ior7+z8ssU0rZY6sCvRM/56RlHMUXFgh/binrCouKa/es1IfyidNdj8miv/Tn7R+EMYF cNXbMnkpqqLkcrUF2XFo/CikXuSujwQ/bQTU4TKcWFs4t3T5Sw2mObPlWWKFDM5UuF7f Lx13o2I25QY+46GlE3u+A3zpxlRgstTdl2TLBXh8ooeDdbtGksxalzXki1cdBvzpfCUx w3+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WBImvxxn; 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 b124si20109893pfg.47.2018.12.05.04.48.50; Wed, 05 Dec 2018 04:48:51 -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=WBImvxxn; 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 S1728070AbeLEMst (ORCPT + 31 others); Wed, 5 Dec 2018 07:48:49 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:39944 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726909AbeLEMrf (ORCPT ); Wed, 5 Dec 2018 07:47:35 -0500 Received: by mail-lj1-f195.google.com with SMTP id n18-v6so18208205lji.7 for ; Wed, 05 Dec 2018 04:47:34 -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=O/tSaH5O7cNIBaIVmHZFPw2uq5T69lxPBmIyOOIA2ik=; b=WBImvxxnrLj10G/y4YEWYG2puvBbKj7GH0JoF5G/lDv2wynU9DgaAsouFmDQ5jSwC7 ExweG2i/py0nlbYJTr+ghEqr8MTKmYpk0uufPqZ9Jh06P+ZCYa1nnETFOWRXLtir2D/U mxV0o9VssUFLZp6jmcSuDh34XAml0OnIfp9tE= 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=O/tSaH5O7cNIBaIVmHZFPw2uq5T69lxPBmIyOOIA2ik=; b=M+fPUpaqW4qkz1Sq2Np5K5dxqCbVywKEKNbnLe8hxRUT0cu3I+fhLdGC+V6DpO4QSw SK28SUtFPinh3//vD2uPtSTghyKJVUfbc+K4tmBanVU1MOrlPfK81S6ZQFudv8zF5iZm g3CmsW+ySdwk2JqnU0KfIzC1wlImAefhMrEvD8wHAJYR2i5QIJphnIJNs0Pf2hUhTXMg wNP2i0qbJI6JCEApOZE6IEiNCrS8IaZuJ++ggQq91B+FERB1W6ihWa5hX7ID1gyZ/hvV Vr8GTlq/0Pe8utkGdbvii/KYqIqqo68whfvG563MBAPyY+fAjVT8mJbESLkctjDl1dtS Np+g== X-Gm-Message-State: AA+aEWbwtDXz/qDVnRiBZum+bcgj9+YvlWOz1h+IzRuAoOfgjsUmdAx4 EYcaPHuNXyX/mbiIWoog0vJEYA== X-Received: by 2002:a2e:449c:: with SMTP id b28-v6mr15208124ljf.47.1544014053364; Wed, 05 Dec 2018 04:47:33 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id e19-v6sm3797125ljf.67.2018.12.05.04.47.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Dec 2018 04:47:32 -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/15 v3] regulator: fixed: Let core handle GPIO descriptor Date: Wed, 5 Dec 2018 13:47:08 +0100 Message-Id: <20181205124721.26624-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181205124721.26624-1-linus.walleij@linaro.org> References: <20181205124721.26624-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 v2->v3: - Resending. 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.2 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);