Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp983965imu; Wed, 28 Nov 2018 02:47:42 -0800 (PST) X-Google-Smtp-Source: AFSGD/X2NYkpZf25fOo0vqbm0JEXhyixixp5FpiHPmQHpMx6/pmosYJimu+dTDIaBISvliC0Kgyp X-Received: by 2002:a17:902:9047:: with SMTP id w7mr36698528plz.270.1543402062228; Wed, 28 Nov 2018 02:47:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543402062; cv=none; d=google.com; s=arc-20160816; b=kSSf3YltGrO1bJK0ZYrUaUDPFknLGVcJAgbUKYGAwkXQVfp2tP4p3E8O22TF/vSCRD +PKa64wVYhNYN2lNr1Odyqec98m3opxFzMXgHmPAYm8aV85rTmN0sOk0TBQJQoxIq385 YCFR6cG8zOfXpk+UZxJkzgJxs4LPRZ9gjtXImL7cUzIh6RRxW2ndGh6xkkF82tlkb74R D4GUzYqraj6+ZiW1PQbzt0+elQlf/sKj7oe44YH/E4xBqtYjC6Fi03PbnoYT/3bBBN7q ZYQdjdZUDY6NaRpm+qp/2mcNsP17vI8G89+F8HaiXdwiN0+6t7g9Fz0t6C/0tQawB2Id c6+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=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 k6si786320pla.350.2018.11.28.02.47.27; Wed, 28 Nov 2018 02:47:42 -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 S1728093AbeK1VpQ (ORCPT + 99 others); Wed, 28 Nov 2018 16:45:16 -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 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: 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(-) 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; -- 2.19.1