Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10651277imu; Thu, 6 Dec 2018 04:45:19 -0800 (PST) X-Google-Smtp-Source: AFSGD/UG11wf5yA8vjBPLS9wg68kOGu6kypIb+o+GscfmTQqlkuOESJPfFKPVcCrvZQEh2wiLrq+ X-Received: by 2002:a17:902:2e01:: with SMTP id q1mr8896881plb.97.1544100319546; Thu, 06 Dec 2018 04:45:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544100319; cv=none; d=google.com; s=arc-20160816; b=EYTjVeIByX/k7BMcdbRcC8LL+4QN+AxK8FpuSwijmQIkU9F06FRaZ+12bxVE7r1OEa B/yqRwCPl+80VFbC++SDI+0jQVY5QJlusHoYunzNHgCjeh1ufxvsa43+mlkC/j6CVJ7v X2t5fsNfwtv68fohBAhDE1YeDhqFXREKZ4mJkkdI/73hmoR/6VLg435Oi/2kGNes3t+X hDh648sPKYdI6BiAdHrbztwUeb9pTDNteN1KGBLcFd8NJqb0H4l/YT+TDsU5oWfGrr/o tn8z3+NRJQlZv4JobT2zhcumUla7sGRcxIKNsqaCFdAez0jDceAB0ZrtdXtE/5kdM2mG qq1g== 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=9VEANXWZbVqprII34eupTEX+PE8o+MRtLs3B6IBk600=; b=DQG1aij7sqxLy9IdG3EAR/zG+T+ZJkIeFExjHuzqfqSGMFWpgrMv2jE2DsGOZHZT/V UNrhYYXr9t4T8xeXYw+KJ31Y3c5t1mfL/F8syYNf3YmXQHICwydnTzDm0owOPp6kXF9U TgaxvVW3QhBa8B4NPqW90Y3j3VoraJ8a8FSYsmW6wx+xG7EIccas1xJ/txkpZrRWVJa6 34oRdpwNWeizD28FNN6JQoF0bV2eqV3FV4XUHFTHzNoU/1JknEq8FfUdv2jW6hRG6Qzx CeODKU2heSjtE5Wr5Jn5N3837JZQI5xcxdjSNiADAsJR5EDJU3dKH7jlCWlKnBBwwqjh RANA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IPMamB9K; 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 y11si177494pgj.442.2018.12.06.04.45.03; Thu, 06 Dec 2018 04:45:19 -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=IPMamB9K; 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 S1729615AbeLFMoJ (ORCPT + 99 others); Thu, 6 Dec 2018 07:44:09 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:41264 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729543AbeLFMoG (ORCPT ); Thu, 6 Dec 2018 07:44:06 -0500 Received: by mail-lj1-f193.google.com with SMTP id k15-v6so269922ljc.8 for ; Thu, 06 Dec 2018 04:44:04 -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=9VEANXWZbVqprII34eupTEX+PE8o+MRtLs3B6IBk600=; b=IPMamB9KYnwZi438OBhj+UVdVNuf5OLp++/S263ecahVnGvJcBonnfx10j8cDroEnd UYqmDTZ6XfqtuWHP1tlFGCZs3RjBSXSC7G55YMjP9vILMfjAAMVMxAkr8jJhQPy4NKFa aa1nyT9xfe/GA/hj59Pciz+PvJYVDlK3E0XqM= 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=9VEANXWZbVqprII34eupTEX+PE8o+MRtLs3B6IBk600=; b=L05IFQgumb8nA+NE7JF2ZlL/JmI5d05CB1rL60j0ewkxkSHk8a0XQRldvxmrfhDUMZ RYVsukLyn302bMHeCpnfVqe1o6t/g1eKjxpMEqxz8WyuMNVLuSeLM1mhqmGLdeNIYNnK 9o2iKKsAthj9at0fK6DuUMkziqoyQb4xaXaw4sv7mJWAjYrXgVpvW4cG8sYCsWkQ54fx jb/DQTj1TBQSjhw8xh76E3l3YmAcC+MxxmL9lmL3cu8a52+hei5mHDGBrD6UeUtrdzTS S6ubeCS7ghnVI2FgONf3M+DYXLb5zi61FS6FMbxrt1tOz8Ri2Cr8aVkAt/L/ewx1wCA0 ZRDQ== X-Gm-Message-State: AA+aEWZXRN8kv8nwch9Vi1RrkmSOkE9pYl1rgHGgjm9m0p15YXIMfthG 4OUIYV502pH/hRlXWJrpuSo96REMz+1JJQ== X-Received: by 2002:a2e:478f:: with SMTP id u137-v6mr18104660lja.142.1544100243897; Thu, 06 Dec 2018 04:44:03 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id j25-v6sm44071lji.77.2018.12.06.04.44.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Dec 2018 04:44:02 -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 v4] regulator: fixed: Let core handle GPIO descriptor Date: Thu, 6 Dec 2018 13:43:38 +0100 Message-Id: <20181206124351.10155-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181206124351.10155-1-linus.walleij@linaro.org> References: <20181206124351.10155-1-linus.walleij@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 v3->v4: - Resending. 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(-) 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); -- 2.19.2