From patchwork Wed Nov 28 10:43:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 152239 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp923450ljp; Wed, 28 Nov 2018 02:44:03 -0800 (PST) X-Google-Smtp-Source: AFSGD/U9WrhMjTR6SlNwfYsDE9XML61AsRIbnNT1K+Omi+yFpKaf5DubzSMVQt3s2EqNjt8NUhfm X-Received: by 2002:a63:ee4c:: with SMTP id n12mr31707004pgk.21.1543401843362; Wed, 28 Nov 2018 02:44:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543401843; cv=none; d=google.com; s=arc-20160816; b=J/t69Hpp4hUGIYq68IT6zZuX/2qBtV6Qd1Cz+Ty1sEsOh5dbD44eZ7Tt1xKSgBdLWe s+Xs+A5XgZ8EUWDFX1Zw6U53lSHbnhue7HzZxvwtsT3J4qaOia1u0n3dFH0x4uR8waJR s3VdAXIWlBM5B1kzWeLbJqF5SwvkMZHFmESqgrmAKNdvm+qqfPazEhtv4YTzSceBUhiZ aAzLkcNpEhvNbGyg3dH8pVWG96GpQJfcGhfcUpmO84RUjO/Cm80fnk1sLTHA7pVvKdgm XpRZo09r9dObi8y+314bAGd38WQ8ATNOgmJMTfEcPzfmDemSPDh+1pDO0+o00tjwg/iR eDzQ== 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=jSq5Ux3lrLmf0ju6pKXh6bN4YVbhItoKJwwx9fdJpto=; b=HpT2Kig1z3Shy2PF2MINt97DyMGdbL3bwXcJCUaPcQpsT2HLH96JWJxszfwfwVxilw 3Z6JxiPaREI9jVB7pHDvd80hQGnqhArTObvfq6VGZg0dLgO+qfl+JEc9P813sp64bISz 6tGw8zY5ymc79AM2lY4U4K6NQLG1K0CJhUt0lNQrw4agI3tlzpt9Qx0Sy5h6C4hES7wa F+EHvl9SnP+iAnPyFF1dWt9zH3dssqVLIeBIc2UQBmDnr3YSVtNsIVWezK9LxeT8jSl7 05GSvDvCxtVAJbKQILp6fGf+5XDgKknzcWK6uneyRjSEwKf2banyFd2aXdF+7BjlSUG+ uMpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Ij1NGoa/"; 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 e17si6715248pgj.142.2018.11.28.02.44.03; Wed, 28 Nov 2018 02:44:03 -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="Ij1NGoa/"; 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 S1728056AbeK1VpO (ORCPT + 32 others); Wed, 28 Nov 2018 16:45:14 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:46203 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727476AbeK1VpN (ORCPT ); Wed, 28 Nov 2018 16:45:13 -0500 Received: by mail-lj1-f193.google.com with SMTP id v15-v6so22950848ljh.13 for ; Wed, 28 Nov 2018 02:43:59 -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=jSq5Ux3lrLmf0ju6pKXh6bN4YVbhItoKJwwx9fdJpto=; b=Ij1NGoa/A2B/u/G+rImlfcOhPrcxErU8dgsxUZqhi+BwomCsddOelRw6r/ZZH24v1e h8qeB6gVF0Ap0XtKhPVDBg/ryDGKVewCd3vR9JcjLxDK/JN7vb2WMgiA1AD+6gQuEEE1 Vs7D7qpmxHlb+uDF3Mh8i5F8OCeJow8eiVVwk= 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=jSq5Ux3lrLmf0ju6pKXh6bN4YVbhItoKJwwx9fdJpto=; b=hycIVoYwdPoj6fsjTG3jdd7c7dtWgsRKnVFoh8Je03KU9XOehtOM1jl2BWhB2JjjWJ Rn2BzYA1Cw2Hie1qCeMqP9zzDd6e9j9o5w7dOA0lxbzMwrCN6o5PYjQkEw0oLiFm+Y/3 yS1lbhJDAHx9e0II+iUX1XPoeHYzW9doIBKyb60EsVM0nhQ8SopGoHETf67d4mWsXBZX JBvNi8yX8vF/TKddwPW8C/UO4CcNdBw1HXuQNyA8KDZ4a0O/vp4SxYLjlXsPoYnxSG64 lwWp+ux+xH+mSRAto20hsFfeT4uRlzS2H39lDiaJ4DNbIvYLriCOoCXC0/458R6LLcfB zBQQ== X-Gm-Message-State: AA+aEWao2+m1hZhTIbGs42ePRMPF9Za2N/1MmvSjKq89wpNUyD7iEGHK F/y8TOaY8bWZJ0G5gR81J29Y7A== X-Received: by 2002:a2e:5d12:: with SMTP id r18-v6mr24873236ljb.89.1543401838245; Wed, 28 Nov 2018 02:43:58 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id c20sm1095101lfj.67.2018.11.28.02.43.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Nov 2018 02:43:57 -0800 (PST) From: Linus Walleij To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, Charles Keepax , Bartosz Golaszewski , Linus Walleij Subject: [PATCH 01/10] regulator: fixed: Let core handle GPIO descriptor Date: Wed, 28 Nov 2018 11:43:41 +0100 Message-Id: <20181128104350.31902-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181128104350.31902-1-linus.walleij@linaro.org> References: <20181128104350.31902-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 --- drivers/regulator/fixed.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.19.1 diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c index ccc29038f19a..52091ebf7164 100644 --- a/drivers/regulator/fixed.c +++ b/drivers/regulator/fixed.c @@ -183,7 +183,7 @@ 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); + cfg.ena_gpiod = gpiod_get_optional(&pdev->dev, NULL, gflags); if (IS_ERR(cfg.ena_gpiod)) return PTR_ERR(cfg.ena_gpiod); @@ -195,6 +195,8 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev) drvdata->dev = devm_regulator_register(&pdev->dev, &drvdata->desc, &cfg); if (IS_ERR(drvdata->dev)) { + if (cfg.ena_gpiod) + gpiod_put(cfg.ena_gpiod); ret = PTR_ERR(drvdata->dev); dev_err(&pdev->dev, "Failed to register regulator: %d\n", ret); return ret;