From patchwork Wed Nov 28 10:43:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 152241 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp923500ljp; Wed, 28 Nov 2018 02:44:07 -0800 (PST) X-Google-Smtp-Source: AFSGD/Uc6TMeNGGsvwx+eXbuSWg5FDEsFOGZ8LOC/DRYPzKr3vZ3Pd8ilG0JXW/4m1iSDbKIsWPj X-Received: by 2002:a17:902:780a:: with SMTP id p10mr37347498pll.54.1543401847752; Wed, 28 Nov 2018 02:44:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543401847; cv=none; d=google.com; s=arc-20160816; b=aCtuJu2AoOUdw4TlbAiYK3x4qSsVrTXlH7mR2bzmh5kfa5mOEocLHww1g2zztmeNAU o9ujnEE+ljGmx75iGyM+Bu6yYZ2o6Z9GMrredVM4q+jGz3cG2TVt/nF/jTa7bKRBj5t9 HrsilElajcRm44B5sxI0RTwfh0ae+5Zq9cE517uPVCSwPqSbFfl1l1Ubw8eMip7X4ujh oeWOSzB4ewRmI8Nx1Me7Etr6jDvt54/CmNI9DRInB8UALFxoW/q01VxMvRhAEXlO9eJa F/mdsnaRDcXN+8i/6f0d98yzKyxtYql7rU4KraqpJOC1hYADG/eiCqZcq3unWssBAORU /PyA== 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 bj7-v6si6872718plb.193.2018.11.28.02.44.07; Wed, 28 Nov 2018 02:44:07 -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 S1728152AbeK1VpR (ORCPT + 32 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 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(-) -- 2.19.1 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);