From patchwork Wed Nov 28 10:43:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 152240 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp923484ljp; Wed, 28 Nov 2018 02:44:06 -0800 (PST) X-Google-Smtp-Source: AFSGD/UjF+O1ux6Lltm4W+PL+YrW2Z9PSZkyqAnGBSGm8esZlspzcvtbl2VIBi46iZtc4QjpXN+T X-Received: by 2002:a63:2507:: with SMTP id l7mr31384192pgl.22.1543401846255; Wed, 28 Nov 2018 02:44:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543401846; cv=none; d=google.com; s=arc-20160816; b=uO1j0ZH5QfEIAoTgnTe7ugQmolUm3QD5Lk7HJT1Xld+5ALUnTiAOCBkslbk5+A7wr/ 8qQR2H4DYBxI0dgz82l0x3JfH30kg7ItdItnUGffddnX6EXtFp5nd7tDxyfRqhTZP/wa YJpHgsBXWbHmKL+tjqZcJQ2LyoL/FGHtwOzkcd7iyu87ZwpMU3t6ZA2N+DQCRvTLg8LY tHL6y7vgK9Z3Sza9QgwJhA4VjSmVoL10h0JhA0JJJuWwPQmiJkx5j3yMH9aQzC6MqTEB MheVgvjx3IGuXqkzMLuwtAg4RoklxOx6MEUO4vMbD1+z9O3V5sIpL+3gKxrKMF9aC+6y jVUg== 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=UgH5BLrY5mQhMxyJsxrsvTNe6D7bSCIeA0AxXEad3l0=; b=rK2NNHlo+tw3PYRjewQhrpd7LBXUjW2veW1jN8TeMfdM2xPfX8JFrq5RPJOtRkfIsS gCNm+m4wswA7otC3hemgxi+CKKqGd2Kmjq2P1QpTpZAw82dBxQa+BY2ZiROj6bGvBmMo fojV8TLj2/Ve58EvxQv/yHQXQx8hvtDa79qqgKTHf0gnXkq6iCgFyPCLzopAIXaEYvTq INOILXndUpKfykd+sTvLw+TgCmxR5pTcukjPv4DQMqfCojBZjX0sBC3seQSJCYDHhJHl gGYVdP8cTP6KfbO9zW2XxGq8F/aXbwWu4uX8lSDT0stZqaX2f176/vdNX374TD7d2PUS mz/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Nuts55cB; 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.06; Wed, 28 Nov 2018 02:44:06 -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=Nuts55cB; 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 S1728111AbeK1VpR (ORCPT + 32 others); Wed, 28 Nov 2018 16:45:17 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:39030 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728050AbeK1VpP (ORCPT ); Wed, 28 Nov 2018 16:45:15 -0500 Received: by mail-lj1-f194.google.com with SMTP id t9-v6so22959183ljh.6 for ; Wed, 28 Nov 2018 02:44:01 -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=UgH5BLrY5mQhMxyJsxrsvTNe6D7bSCIeA0AxXEad3l0=; b=Nuts55cBGeXdFX4HEqvC1KvJMqk7W5K8vwEiLU0fGIJNWDw9v/dgCDviPkAk2wIicc iCTsByewZqMhowQxtYflzjzfRrpPyH766Cxp1v+AuKSfNPUXU7wta8OdmaZX/vwoFlxd ZY56lNyyKX1ex+aqlLWMgjcOHfLtNB4BwadhQ= 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=UgH5BLrY5mQhMxyJsxrsvTNe6D7bSCIeA0AxXEad3l0=; b=Fcz6qVy6HrVbTl055lLxVZj1QroSel2/86PKEDyuOOVXuYqa6WdAskgq2xKN/ZWx7D YjX3kpuy7mUlcR2IlTVS3+OFms5I8J9UIJVUC/eJ8yrxZ9+3/z6F1Gj/7WWELHjr7Ykn zHE4PHgFqOiIys3EdyLQgF4e6Vpix4547HBekZhgCTa/FWpxmrITeg+MO8rfkyurJx4L KXAQOIhnwuvc8O+ZWO2mSJADiBpJHtUDZqHXJOaKaOAz/TT0UuRrP/wGHfmREknVhf9G zH1Qs5mY+RUisn2Q5jbL3FMl2ouOeOGrXTHiMPicl7kFDnpgxw5ighGZkLkF1XLGfZ49 HfiQ== X-Gm-Message-State: AA+aEWYP5zqLQuKjSmJCsvBe4TpyFVMbYm5Jxbp+on/EHBY34/4D8UdH iAB3OtojrCTh3w8XPI5e4f9fnLh+J6XG3A== X-Received: by 2002:a2e:5109:: with SMTP id f9-v6mr3876765ljb.52.1543401840510; Wed, 28 Nov 2018 02:44:00 -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.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Nov 2018 02:43:59 -0800 (PST) From: Linus Walleij To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, Charles Keepax , Bartosz Golaszewski , Linus Walleij Subject: [PATCH 02/10] regulator: lm363x: Let core handle GPIO descriptor Date: Wed, 28 Nov 2018 11:43:42 +0100 Message-Id: <20181128104350.31902-3-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: b2d751b7f69b ("regulator: lm363x: Pass descriptor instead of GPIO number") Signed-off-by: Linus Walleij --- drivers/regulator/lm363x-regulator.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) -- 2.19.1 diff --git a/drivers/regulator/lm363x-regulator.c b/drivers/regulator/lm363x-regulator.c index bbedb08d257b..06cfba441c46 100644 --- a/drivers/regulator/lm363x-regulator.c +++ b/drivers/regulator/lm363x-regulator.c @@ -227,10 +227,10 @@ static struct gpio_desc *lm363x_regulator_of_get_enable_gpio(struct device *dev, */ switch (id) { case LM3632_LDO_POS: - return devm_gpiod_get_index_optional(dev, "enable", 0, + return gpiod_get_index_optional(dev, "enable", 0, GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE); case LM3632_LDO_NEG: - return devm_gpiod_get_index_optional(dev, "enable", 1, + return gpiod_get_index_optional(dev, "enable", 1, GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE); default: return NULL; @@ -263,6 +263,8 @@ static int lm363x_regulator_probe(struct platform_device *pdev) LM3632_EXT_EN_MASK, LM3632_EXT_EN_MASK); if (ret) { + if (gpiod) + gpiod_put(gpiod); dev_err(dev, "External pin err: %d\n", ret); return ret; } @@ -270,6 +272,8 @@ static int lm363x_regulator_probe(struct platform_device *pdev) rdev = devm_regulator_register(dev, &lm363x_regulator_desc[id], &cfg); if (IS_ERR(rdev)) { + if (gpiod) + gpiod_put(gpiod); ret = PTR_ERR(rdev); dev_err(dev, "[%d] regulator register err: %d\n", id, ret); return ret;