Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp982980imu; Wed, 28 Nov 2018 02:46:27 -0800 (PST) X-Google-Smtp-Source: AFSGD/XFrXLKSgCIDLW94JY8PjrigWlx7h7wZBl/7mxQPe87+Zy6e04E8SgtRPfG79ax8kdB1MtB X-Received: by 2002:a63:62c3:: with SMTP id w186mr33030030pgb.345.1543401987020; Wed, 28 Nov 2018 02:46:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543401986; cv=none; d=google.com; s=arc-20160816; b=wzNVWI6I/EJF8WYYN2Iai5q8x9N/RO7lE6mHgTABVsfknmNegVdE0VQAF1zKveCV71 Owq1tVaM4D8HxuzyA4eYmKCFMMAcSZ1K+Vr1KqZD5E5nfpAOMJuyM5oDC85+QT81jc/A K5FpS4DdPUcGdyzoVtfG/dc1IdQ6ilGlm6pwTOJhYv0LBV7rfhBI58HKdxsak/LTyick 9jT3XFVuxJM/EluFOoZatFZPUDMOFtmjUZMw7W0jx95E2YW70tqntqgEKh/2a1HDhL8L 0mI1H5GOJ730pO+rlrGRFfM+btdAE5HpM8+xO13W2+rfityuPUnTN8C3yk6zgk60IFYi 3FSQ== 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=U0ANQBd09LcGDKebw9OrEkrU3xRG8J5BfhAYKK76wok=; b=KUnWrsBdXawLf7oq1+wFNDRbw+3HjE3IheO7XWExRpwgu1xkdUOTBUXlllWRTvu4no nSyjFNx/uWSOC6u8XDU62Z8pgmjGl70B8oA0M5U48ShyhXfHIdFGh60W793lJeBU9+1d 8Xl+OUhFC/3kYy1FeO4BtFyitoZVdNYDgdoVKXvl0moQkL6j3cdT1Fza8srxP7QXNxY+ AR7qVhWtDWDEJLAavwlHfqPPHm9akp9xwuoKgdg2JrQMvb+1lw2pCnpg+9FT7NRqDyyR kTJjiw//PE9Ey6JgTpaQST7CKo2RDsuXwngNPzyxKzxAE/sZf9skcF7JHohxiX9O07T1 x3jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EcWJrBHi; 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 s11si6721976pgk.344.2018.11.28.02.46.11; Wed, 28 Nov 2018 02:46:26 -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=EcWJrBHi; 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 S1728142AbeK1VpR (ORCPT + 99 others); Wed, 28 Nov 2018 16:45:17 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:36942 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727476AbeK1VpR (ORCPT ); Wed, 28 Nov 2018 16:45:17 -0500 Received: by mail-lj1-f196.google.com with SMTP id e5-v6so22981635lja.4 for ; Wed, 28 Nov 2018 02:44:03 -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=U0ANQBd09LcGDKebw9OrEkrU3xRG8J5BfhAYKK76wok=; b=EcWJrBHi25Mrr1atFR0tEoCdEdwFxVdh5RM0THY+2gytq0Ri1MOvDGAb6PpL/AGNK9 6z4IN6RqNgtaZE2zLaLNEUsQx4ALWt7nr3Qa1S91/3Ggj9n7PGNDCucGSzhcbo0Ogiv2 MvqKUn2Pv5WyVTgZGuia2X+Ixcb3KFBk9Nmtk= 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=U0ANQBd09LcGDKebw9OrEkrU3xRG8J5BfhAYKK76wok=; b=Qe2j3ALKtySDvrpyEd1QkXLaRhNikaKMhhl5FLOqdNJGc6CSNsyyxrnNE6qhNyXsa3 6fl8pPNPIPL24YO51/t31nSIJLQf5wkqDfwZOahvqFB9fVEfI6egwvlHaZ/DIXZyDliE TefwErzCrJ991IjXbNB6G1xl/rkyyuROolUE9bCinH8qHJylXiLnB1hdxlRlspGTgudr dQboJ4N6d0jj+lEs1LY4zAhcjWa4hCMD0IBRCoKQK6hrZDI95oBuCPv04mMIrRGU2StN QiAGjLJYcW9S/HlM8sruNmcCsJ5QNmWOuDn6U1o4pPWLsKid0SxmfYFtEVs/Ue506iI4 CrjQ== X-Gm-Message-State: AA+aEWYJGFcl27q/l6U9Ke+vCZia/80E9WbKzw5bW80FDTHlxkn2f3WV qK9MZK/AT70jc5+nz0o5XVsD5A== X-Received: by 2002:a2e:9d86:: with SMTP id c6-v6mr6496603ljj.146.1543401842378; Wed, 28 Nov 2018 02:44:02 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id c20sm1095101lfj.67.2018.11.28.02.44.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Nov 2018 02:44:01 -0800 (PST) From: Linus Walleij To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, Charles Keepax , Bartosz Golaszewski , Linus Walleij Subject: [PATCH 03/10] regulator: lp8788-ldo: Let core handle GPIO descriptor Date: Wed, 28 Nov 2018 11:43:43 +0100 Message-Id: <20181128104350.31902-4-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: 2468f0d51548 ("regulator: lp8788-ldo: Pass descriptor instead of GPIO number") Signed-off-by: Linus Walleij --- drivers/regulator/lp8788-ldo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/lp8788-ldo.c b/drivers/regulator/lp8788-ldo.c index 553b4790050f..416d073ec62c 100644 --- a/drivers/regulator/lp8788-ldo.c +++ b/drivers/regulator/lp8788-ldo.c @@ -502,7 +502,7 @@ static int lp8788_config_ldo_enable_mode(struct platform_device *pdev, } /* FIXME: check default mode for GPIO here: high or low? */ - ldo->ena_gpiod = devm_gpiod_get_index_optional(&pdev->dev, + ldo->ena_gpiod = gpiod_get_index_optional(&pdev->dev, "enable", enable_id, GPIOD_OUT_HIGH | @@ -548,6 +548,8 @@ static int lp8788_dldo_probe(struct platform_device *pdev) rdev = devm_regulator_register(&pdev->dev, &lp8788_dldo_desc[id], &cfg); if (IS_ERR(rdev)) { + if (ldo->ena_gpiod) + gpiod_put(ldo->ena_gpiod); ret = PTR_ERR(rdev); dev_err(&pdev->dev, "DLDO%d regulator register err = %d\n", id + 1, ret); -- 2.19.1