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; 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; 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); From patchwork Wed Nov 28 10:43:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 152242 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp923522ljp; Wed, 28 Nov 2018 02:44:09 -0800 (PST) X-Google-Smtp-Source: AFSGD/UXzg1zcXkT9prG+oZD4mtdEsRWg9fZtMEtkTmbCLCNR1C+ehcOSrzqXHQwdHKAGyjxTzQ1 X-Received: by 2002:a63:920a:: with SMTP id o10mr31688731pgd.141.1543401849226; Wed, 28 Nov 2018 02:44:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543401849; cv=none; d=google.com; s=arc-20160816; b=TdCODtleO2rZX47SK/DmilfYzQYeVvlX4YN4JCTqRons05kARONh9tGi4lXRwasDaf jarRiVlXXk2eM9HUvQOqs/qlJV8ERNYyGk4PjT8Rw640F6pBYaCLl5nLUT9TcyX8m+7S VExpzEwNquIA8Aa/8egI8AJ6AEyrJ7hNd4TPdr6fo6x/ysHACBs4syMPUdjxYE9PccpO enDfzXIyd7Y+7846wUpfsEZc+QlSCEgZUGavLhgf/S0acICGgWo1GP/TVP7jhZOkgfuX zk66EvRpHVwMeIDVXT9SJlYnmAa2U9nEUtWyRFdVcJ7OspsRCh/JpUbSMgS+dsW+idwn LV9w== 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=uFUKjxTT9vhRdoORnKcL1go1+WQ1lrKrvE6sIAkGI9I=; b=nQcRmylpmtYcsk3IPazbHvjuvlV02bxwablBzHPxUl37iyqM6PMqUsVhn2rhg6200U uI39OR8DEz5J/wny1Mgmzda/HEERIBacn8XfOsvMS04jyS2PEjfCc1sT9b40f+RaiLUi JR+iZQo7QBRmN5w2TReqonxR3FdySPR49av0JHX+H8RUvhw5hFpDvUvf+Awy36XDLAzC gk6iC7fSIPHX3cRwQEzc0b1+xFje3x1Xs9Iv1laGrJZEK1WYduDUomlYG+QqfdzBwmox q8EaJXaijnoMJJRtQ1p7tDeYb/CmD0OZgQy0xEQY474oR2N7fqKRtSvoEMC7zJS8ZiH+ Pcyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Nz0VKdjC; 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.08; Wed, 28 Nov 2018 02:44:09 -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=Nz0VKdjC; 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 S1728190AbeK1VpT (ORCPT + 32 others); Wed, 28 Nov 2018 16:45:19 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:34897 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728119AbeK1VpT (ORCPT ); Wed, 28 Nov 2018 16:45:19 -0500 Received: by mail-lj1-f193.google.com with SMTP id x85-v6so22982008ljb.2 for ; Wed, 28 Nov 2018 02:44:05 -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=uFUKjxTT9vhRdoORnKcL1go1+WQ1lrKrvE6sIAkGI9I=; b=Nz0VKdjCMqLGPbYKRJYOxaVnpQh1k58x0DVVOkjpY1BI3lwBX4HROZeN1QPA8vhlwp Xjg2dlpHd+vr6o2tPZT4t1T9ZjTOcMsmCdDC+dmQX/6YjAMaAqmlYtFYfvfBRtNo3bdZ D7pR+uGNDF41vynPtMgm0C+Z3M58qyv7tSPQU= 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=uFUKjxTT9vhRdoORnKcL1go1+WQ1lrKrvE6sIAkGI9I=; b=jhg1CJj/XtFu9RKpjhAjkUZFS7Nb1uHqu/NeP8hW7X7aJRFBdPzFNBEBjUg8NVMR48 aDdzm7NHA8v3+ECuTmR4jRDVU5kqfvl7p0KbK38OPFn8I7ArT7E1kyCLkdTI5tqjRFpO GIn9zYDWZVLb1Tzr/Myw0KKQYgiGaXp8FtjutT1eQ1DjZWwI7R2utfLYpXXnzDSmW7W9 lkfACSHL56it/xd4kEnfm9TixYM7P7aeGyycBdVb0D2qhWQbmUyhBPISQ6Kgjeeh64J1 dleXLdb1m7S8d2lDr4lsW+feOpmPQQfuiQXbSz+kZP671uCkT9WbSM0aF94dYBiA6rJx /TeA== X-Gm-Message-State: AA+aEWYIfMFD86aIRgW1xHqDzSzYFPGM3qoyOXCewdvIlJghV+khJLui 2jq/ihAMQDFbDqZruQqfvEeqYnzKi4IDmA== X-Received: by 2002:a2e:5054:: with SMTP id v20-v6mr22072216ljd.45.1543401844472; Wed, 28 Nov 2018 02:44:04 -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.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Nov 2018 02:44:03 -0800 (PST) From: Linus Walleij To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, Charles Keepax , Bartosz Golaszewski , Linus Walleij Subject: [PATCH 04/10] regulator: max8952: Let core handle GPIO descriptor Date: Wed, 28 Nov 2018 11:43:44 +0100 Message-Id: <20181128104350.31902-5-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: d7a261c2d1f2 ("regulator: max8952: Pass descriptor instead of GPIO number") Signed-off-by: Linus Walleij --- drivers/regulator/max8952.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) -- 2.19.1 diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c index 6c39fff73b8a..baa8b771a6e4 100644 --- a/drivers/regulator/max8952.c +++ b/drivers/regulator/max8952.c @@ -231,9 +231,9 @@ static int max8952_pmic_probe(struct i2c_client *client, else gflags = GPIOD_OUT_LOW; gflags |= GPIOD_FLAGS_BIT_NONEXCLUSIVE; - gpiod = devm_gpiod_get_optional(&client->dev, - "max8952,en", - gflags); + gpiod = gpiod_get_optional(&client->dev, + "max8952,en", + gflags); if (IS_ERR(gpiod)) return PTR_ERR(gpiod); if (gpiod) @@ -241,6 +241,8 @@ static int max8952_pmic_probe(struct i2c_client *client, rdev = devm_regulator_register(&client->dev, ®ulator, &config); if (IS_ERR(rdev)) { + if (gpiod) + gpiod_put(gpiod); ret = PTR_ERR(rdev); dev_err(&client->dev, "regulator init failed (%d)\n", ret); return ret; From patchwork Wed Nov 28 10:43:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 152243 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp923562ljp; Wed, 28 Nov 2018 02:44:11 -0800 (PST) X-Google-Smtp-Source: AFSGD/WC+pTzsF8WrAdMr7uj8/CS2Q/7DZmSqFFYJby+dPhEBWTQFpSEU+6jIDMb2XjADPBtKpi8 X-Received: by 2002:a17:902:27e6:: with SMTP id i35mr32630267plg.222.1543401851251; Wed, 28 Nov 2018 02:44:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543401851; cv=none; d=google.com; s=arc-20160816; b=VL8sfUO6GpUwLqwerm4sBw3ALmUxi1JOno7Ns27EO9O7QrapsruZkui6OhRZkXdBjE ofM8JTbxURy/csXxe+S78wKhpY7ilcr6LWYRVhG5hhdCKV8borGwBnlbPMGLtO7Qagbf 57oezHAFr7u4U9ITfejnbGWJh1Ubk/pOINYifT4mjmGCAnOIrkqgVlVeWDbDJsCkX1J5 s0Z4XAoeljvt3gZm5XeHLvi/arJVNc/q4jIvuYW/z4oO8E3h1SmdKbt+PtuzKarS6rBc k4rRV/8UKp80NcJB7szAHyssQ/yNTzry4KehHrTLp9EWFR17UYfxs7+N8AZxSvqsPQb7 Plaw== 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=QdQV+TtwR7nUQa2nhbCkXbp692jip7xowWS6qqziPL4=; b=WuFsal10qvSv16UBBE0owOU1KaHHUo5mOdHO+oX5a/hcof28/5mJgWUlotbHrpPLRh ZPDLAqV6Lgc6sPAuH+kxH9u626TTCrrzduJKxlzA42+WV8hDLu7/hrIlTziWrnKKCcwt JxZsGkjnfIuqgER4+mzhY0cmgd8RLsF4B/unabmsvRvAOqrk05hOgf3jX4w5xVqBoFpx BpNIVRdszSZViCQXqp42r8zUwsl6IurXsZOvdCljv/GauN60mzW5dSo7L+A29oW4HYxI U/6zS9VTQmsNBqUvRnCfqspU6utho0EEGYh5gCUh6UMHRVS94I7chYl69VEPzqyPM02g axHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZMVgeJmn; 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 o68si7293550pfo.140.2018.11.28.02.44.11; Wed, 28 Nov 2018 02:44:11 -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=ZMVgeJmn; 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 S1728233AbeK1VpV (ORCPT + 32 others); Wed, 28 Nov 2018 16:45:21 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:42337 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728157AbeK1VpV (ORCPT ); Wed, 28 Nov 2018 16:45:21 -0500 Received: by mail-lf1-f65.google.com with SMTP id l10so18961948lfh.9 for ; Wed, 28 Nov 2018 02:44:07 -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=QdQV+TtwR7nUQa2nhbCkXbp692jip7xowWS6qqziPL4=; b=ZMVgeJmnzdhwXVO/Tc+cwfs1zPRRsyfkEXSjNq4CJulE1Y7IB3f1RF6O/Yf+Pa26eP BF4JOzEd3Q/nZc8CM+XXlATF8nZc1RYpsvTA4sxn41UAdlqkofMDwRG+vVJaWIYmeQgb vXVCIAVp+/wg7h7t/JKe222qjV155CYc9ou08= 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=QdQV+TtwR7nUQa2nhbCkXbp692jip7xowWS6qqziPL4=; b=IlYT8t4ohT/M66KERBZJTBcUS2b2f6itEa3mQKmIvh9AQN4JoxcuJpIH9n18yMOJpg tTyLEpn7JxqXCFfM6UsXYtDQ/L8PLLmEgpOBXzq/9VeWJtMqL7rdUBm4bU3wp6yjvrd6 JRMWgHged3dLKLmbVYj1RYkcavcc6h354Cvy93xK+ijv+iIASf8uR9MjLOnJBTYOowd8 d6azyVNWHEwKLTIriVSxoR7eh/wJAfhqCHCzpYAwYOFcqYkwxRJCPY0mklsCy9gATmCa 3HIxMbZtfhjtHELdDJ5Hc3OiPNLyl75HKdPCsOqYFmRvddHCMG3qHYuMl1B9s2ARpgOv 70gQ== X-Gm-Message-State: AGRZ1gLsuMX0tO8mHxturHQlJfSRlUcDWgE/xQbjMoclTId0MSYOPBtD 8N3XrprBCgoSu7non+z3j4fnfQ== X-Received: by 2002:a19:5e5d:: with SMTP id z29mr20746732lfi.105.1543401846138; Wed, 28 Nov 2018 02:44:06 -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.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Nov 2018 02:44:05 -0800 (PST) From: Linus Walleij To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, Charles Keepax , Bartosz Golaszewski , Linus Walleij Subject: [PATCH 05/10] regulator: max8973: Let core handle GPIO descriptor Date: Wed, 28 Nov 2018 11:43:45 +0100 Message-Id: <20181128104350.31902-6-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: e7d2be696faa ("regulator: max8973: Pass descriptor instead of GPIO number") Signed-off-by: Linus Walleij --- drivers/regulator/max8973-regulator.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) -- 2.19.1 diff --git a/drivers/regulator/max8973-regulator.c b/drivers/regulator/max8973-regulator.c index e7a58b509032..6e11324cb9cf 100644 --- a/drivers/regulator/max8973-regulator.c +++ b/drivers/regulator/max8973-regulator.c @@ -632,7 +632,7 @@ static int max8973_probe(struct i2c_client *client, struct max8973_chip *max; bool pdata_from_dt = false; unsigned int chip_id; - struct gpio_desc *gpiod; + struct gpio_desc *gpiod = NULL; enum gpiod_flags gflags; int ret; @@ -759,9 +759,9 @@ static int max8973_probe(struct i2c_client *client, else gflags = GPIOD_OUT_LOW; gflags |= GPIOD_FLAGS_BIT_NONEXCLUSIVE; - gpiod = devm_gpiod_get_optional(&client->dev, - "maxim,enable", - gflags); + gpiod = gpiod_get_optional(&client->dev, + "maxim,enable", + gflags); if (IS_ERR(gpiod)) return PTR_ERR(gpiod); if (gpiod) { @@ -798,6 +798,8 @@ static int max8973_probe(struct i2c_client *client, ret = max8973_init_dcdc(max, pdata); if (ret < 0) { + if (gpiod) + gpiod_put(gpiod); dev_err(max->dev, "Max8973 Init failed, err = %d\n", ret); return ret; } @@ -811,6 +813,8 @@ static int max8973_probe(struct i2c_client *client, /* Register the regulators */ rdev = devm_regulator_register(&client->dev, &max->desc, &config); if (IS_ERR(rdev)) { + if (gpiod) + gpiod_put(gpiod); ret = PTR_ERR(rdev); dev_err(max->dev, "regulator register failed, err %d\n", ret); return ret; From patchwork Wed Nov 28 10:43:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 152244 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp923578ljp; Wed, 28 Nov 2018 02:44:13 -0800 (PST) X-Google-Smtp-Source: AJdET5es42ofixUwcb+8Wdjg+T58YNAddXj2mZSinQHqv2kIxMvuukzMmLHdG2o9ug8g+w+aujSk X-Received: by 2002:a62:1f9d:: with SMTP id l29mr36910954pfj.14.1543401852876; Wed, 28 Nov 2018 02:44:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543401852; cv=none; d=google.com; s=arc-20160816; b=AVE8pNHnJwtVqQT9gbZNtg28qH7oeYibjPfEJMwgOQvGdbnLuvdqd4rhunMFBSu+Xb fqZwl3VR9o7GcMAWfP380IFQxcAQN8ISvJbq5BkegGcz+oVyQUgeFzf9yW9nJtkUQ7aH mSi2Wk/UQanp6CvN2QkZCix2bSsuiX5c98xZv6B5LVEhe7LAwfJHJ56f6lUiMhdQHLXQ VH1e1ZlqiqUjeCTWqK+H86PpYZcdynbe7bwmVitOmh9gBYv17awZaikw1kf/MQBVSf8d gBF54Y3NEaPM9N775J8SvE6lHemHYPUTVresC3MJ4ncv5h6wIkU6z0xKpr2zeDLVH5HY +8Gw== 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=bERN1gHWFFWu4y/GIu0q47eugasKcAfYPgxYimfWOAc=; b=dnI62v7kGpW7YrJERKSaiHwL58/IrhRivW+vneNx+ixAia9zXU9AexofTfNxkqyEty yXKA6d6KdepLz2d0Spwur2IAmdGWBwIH5aFBO+Wltaz1weuAfii7sk2ffL7yqXZKb++4 X4dG04l0amgcvQszlcxOJBo3A+dmYkDXA10Zv6qluU3wS38LuzeOogtfrlf4IjXTLmC1 bhAtpQ6DFY/s/RKh2J+JX2jH9wxScSQbZRTtEE0MjDBC3RaJYMoLVGy4ZuNTDffrnfnK vjn9wgH8zyRtBIF8qtcun7/Rj7Yapt9JrNKEFmph/YUVsIcLXvs7pBqDEZv6fTFTCAgD ckpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Txmgq06A; 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 o68si7293550pfo.140.2018.11.28.02.44.12; Wed, 28 Nov 2018 02:44:12 -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=Txmgq06A; 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 S1728262AbeK1VpX (ORCPT + 32 others); Wed, 28 Nov 2018 16:45:23 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:38873 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728119AbeK1VpW (ORCPT ); Wed, 28 Nov 2018 16:45:22 -0500 Received: by mail-lf1-f65.google.com with SMTP id p86so18991209lfg.5 for ; Wed, 28 Nov 2018 02:44:09 -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=bERN1gHWFFWu4y/GIu0q47eugasKcAfYPgxYimfWOAc=; b=Txmgq06AWyWIxs4oH0GnuLdSwCl+s+vYjxdAXtWTOtv5nzK5nHs6kmoQlKhE3GBNxG PNOfSWKb0DsJu5SRz3Ty6JsYXgEEz/H0Jme0TNgcFwMHqZaVq8P6k4K1s6iMdnFc5iDC uQSZs6jI93XZ32u+34ifKWHdZ0ozCWciZ3gcI= 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=bERN1gHWFFWu4y/GIu0q47eugasKcAfYPgxYimfWOAc=; b=YTfrzd3utX4fwJjA5jB/XEXTmy6HmFYBoc6wbWAXg/Ry3geugFxIj77A3GGZ51oqdc U1VFG+9xIutIse6LRi5KqUhLM7wmWwUontEJoesiJCQTP2RylDFa3Vkz8z5ORktLf9a1 guEm9AbPOL0BChM1HF6gEN/cbXz878Uj2t+k98HQa/aUH9hnQ3nRsUzxPHA5WpHDAN1P BxMt6B3wQuCblsnHykTXcchy1kF0fkzoSM5lwhRk9ipuAQGF8/RksiSDPO4mdOnfYbT5 AbQmW2Z6jjRuJmARriqeApJPgcnw4E8WkRp/7ADpfZwAIvmRAo0EqLLeKx9Z0r+Xg117 TM6g== X-Gm-Message-State: AGRZ1gIc6tesr/RJ3QplaWzPStBX8r4AxSlI3LjfujGR84FDGZiBkJhk xPOXTa4u8tpQHT9TXJCK1AjwdQ== X-Received: by 2002:ac2:42c5:: with SMTP id n5mr20889914lfl.115.1543401848298; Wed, 28 Nov 2018 02:44:08 -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.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Nov 2018 02:44:07 -0800 (PST) From: Linus Walleij To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, Charles Keepax , Bartosz Golaszewski , Linus Walleij Subject: [PATCH 06/10] gpio: Export gpiod_get_from_of_node() Date: Wed, 28 Nov 2018 11:43:46 +0100 Message-Id: <20181128104350.31902-7-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 This function already exist inside gpiolib, we were just reluctant to make it available to the kernel at large as the devm_* seemed to be enough for anyone. However we found out that regulators need to do their own lifecycle/refcounting on GPIO descriptors and explicitly call gpiod_put() when done with a descriptor, so export this function so we can hand the refcounting over to the regulator core for these descriptors after retrieveal. Signed-off-by: Linus Walleij --- drivers/gpio/gpiolib.h | 6 ------ include/linux/gpio/consumer.h | 13 +++++++++++++ 2 files changed, 13 insertions(+), 6 deletions(-) -- 2.19.1 diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h index 087d865286a0..bc57f0dc5953 100644 --- a/drivers/gpio/gpiolib.h +++ b/drivers/gpio/gpiolib.h @@ -201,12 +201,6 @@ int gpiod_set_array_value_complex(bool raw, bool can_sleep, struct gpio_array *array_info, unsigned long *value_bitmap); -/* This is just passed between gpiolib and devres */ -struct gpio_desc *gpiod_get_from_of_node(struct device_node *node, - const char *propname, int index, - enum gpiod_flags dflags, - const char *label); - extern struct spinlock gpio_lock; extern struct list_head gpio_devices; diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h index f2f887795d43..348885f2f3d3 100644 --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h @@ -172,6 +172,10 @@ int desc_to_gpio(const struct gpio_desc *desc); struct device_node; struct fwnode_handle; +struct gpio_desc *gpiod_get_from_of_node(struct device_node *node, + const char *propname, int index, + enum gpiod_flags dflags, + const char *label); struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev, struct device_node *node, const char *propname, int index, @@ -517,6 +521,15 @@ static inline int desc_to_gpio(const struct gpio_desc *desc) struct device_node; struct fwnode_handle; +static inline +struct gpio_desc *gpiod_get_from_of_node(struct device_node *node, + const char *propname, int index, + enum gpiod_flags dflags, + const char *label) +{ + return ERR_PTR(-ENOSYS); +} + static inline struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev, struct device_node *node, From patchwork Wed Nov 28 10:43:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 152245 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp923613ljp; Wed, 28 Nov 2018 02:44:15 -0800 (PST) X-Google-Smtp-Source: AFSGD/UkYCtnZ1GLRgrq5D2lJ+UkjZU3OaC1pkQCGLUIIN+uik/iElJl6ldHUzRbphLQ2mjLlocy X-Received: by 2002:a62:4181:: with SMTP id g1mr13494207pfd.45.1543401854891; Wed, 28 Nov 2018 02:44:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543401854; cv=none; d=google.com; s=arc-20160816; b=QCicsBLNIE6eqT3/90EmF7z8jVVikOhA5/c7yybtIp/Id1J4WA6w21engN457u7Eky Z4LHlG/t1xEN9T38B7PghcmdwUDMTwx/WHNLzoEthyMh0ODElou5reS4KSPTyMFBMS0g NIGP+cYZfgB/9uHm3SYcYH5LAUMfHy5izs3ETpVbAUlk+eEWdsI8liDHqzo729cNUhD8 ziHkYCBthLr3MhhwvqSmgGOQYdyR1QcNf/c6ojGHJ3zjy1QRfC8rvJfiKbyq8UlI6Ssl krbtF3Z3HGfvvFCb79f94eZfdDQDJtk+ePhyC2JuwV1ihMWM5BuvO7a8nDexosk+aU/O uySA== 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=Qj9cUi+6gOc4BrcoirROwJkL8i1x0/qXXxenGaYp240=; b=diFOKB9Fg/T3J7B4GN+wtUdXCFUB9hQIAaSuZkVrXOjGZ9VPR5vZtloQOCaNeagA6i tEMT167iVxHmOjuzRUrV/5FChJk1Gjmo5yjawflBLX5fH6JR32n9/5qUSTSI1MKV19y5 qqb44zsmq6qw0AeGt/iDjKr08APWovMJlXmTAGAVJ2NZn3JUn33S/jwduahxpaE9zPBz 1HebH+s5XVs+uqYWQn32olHqyY84OxDAiB2NCoCpXIIZ04Ny7Twn8prhTCJ+b96mhsdN gCfZzkqkq33a57OFCeQyh7E0RqQqATz3MsQwnrVrESDH/Bk4siZEkMoniOkL+WVgQEHT OaWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OTei0WA3; 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 k11si6837725pgh.132.2018.11.28.02.44.14; Wed, 28 Nov 2018 02:44:14 -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=OTei0WA3; 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 S1728296AbeK1VpZ (ORCPT + 32 others); Wed, 28 Nov 2018 16:45:25 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:33253 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728119AbeK1VpY (ORCPT ); Wed, 28 Nov 2018 16:45:24 -0500 Received: by mail-lf1-f66.google.com with SMTP id i26so18981323lfc.0 for ; Wed, 28 Nov 2018 02:44:11 -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=Qj9cUi+6gOc4BrcoirROwJkL8i1x0/qXXxenGaYp240=; b=OTei0WA3qfzGmNXPR3XuoQKPZLjzXRefTJ2Tk31d9PYPDSSk1N0bdc6Ajoy1oSNhH6 5eu7YJSbSbCWKXP/Su9QydV4Raw7CJ6jBqJleOUfwhHyq2E1AVnybFJCuOqVmeebovcK DKfbYeyKEVhr4ajup+HMSJW18keAtNx18+BUI= 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=Qj9cUi+6gOc4BrcoirROwJkL8i1x0/qXXxenGaYp240=; b=NoF4Y/GQz4SX+tooWLq/x0+/Icla/FzVVYezOHG+zAXlFZJp9iRM6uNzJiQzCtWATs Zusgn1vxcB8F9cYhVR11zinfaObqHLzrLr4NZcDs0piuUw6rMQ0a9xuzaTXefZUCV5Zk sZa2Tsm/+/VmINInO855b9rz5OSDodNlFqPO6tFwwlwTu5PU+DJHaTuzRR2qeKKgbZC5 ryH4FW+DjF7RREH3Lh+sgJ00ZEaU384lunw/zKe9PJw4k41Z05IrlBhYZrOB4+NdzZ/D ZZLSKuHUM8KkYy7jawTlVzGI6mo3No1mgkYm61o+l3/hYrT/KoaW/NUvLQ2gF9omOmGt RogQ== X-Gm-Message-State: AGRZ1gKP9c8DJiIE/FGrOI21KFvRwC/aCFrTHIwW9CqJMox0vpOJnRgM 1ocGjpZdHsddGabD0Y4cU6HW4Q== X-Received: by 2002:a19:54d7:: with SMTP id b84mr20234596lfl.131.1543401850175; Wed, 28 Nov 2018 02:44:10 -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.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Nov 2018 02:44:09 -0800 (PST) From: Linus Walleij To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, Charles Keepax , Bartosz Golaszewski , Linus Walleij Subject: [PATCH 07/10] regulator: da9211: Let core handle GPIO descriptors Date: Wed, 28 Nov 2018 11:43:47 +0100 Message-Id: <20181128104350.31902-8-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_from_of_node() rather than the devm_* version so that the regulator core can handle the lifecycle of these descriptors. This patch requires "gpio: Export gpiod_get_from_of_node()" to be applied first. Fixes: 11da04af0d3b ("regulator: da9211: Pass descriptors instead of GPIO numbers") Signed-off-by: Linus Walleij --- drivers/regulator/da9211-regulator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.19.1 diff --git a/drivers/regulator/da9211-regulator.c b/drivers/regulator/da9211-regulator.c index 8f68c7a05d27..bfdead356526 100644 --- a/drivers/regulator/da9211-regulator.c +++ b/drivers/regulator/da9211-regulator.c @@ -293,8 +293,8 @@ static struct da9211_pdata *da9211_parse_regulators_dt( pdata->init_data[n] = da9211_matches[i].init_data; pdata->reg_node[n] = da9211_matches[i].of_node; - pdata->gpiod_ren[n] = devm_gpiod_get_from_of_node(dev, - da9211_matches[i].of_node, + pdata->gpiod_ren[n] = + gpiod_get_from_of_node(da9211_matches[i].of_node, "enable", 0, GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_NONEXCLUSIVE, From patchwork Wed Nov 28 10:43:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 152246 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp923664ljp; Wed, 28 Nov 2018 02:44:18 -0800 (PST) X-Google-Smtp-Source: AFSGD/X/MISudQhHVKgE0F/Q095pNfI2Dh3/cDWK40D8eTLp8CEuPiLBwxV7e6jaH2k3t4fZe5kW X-Received: by 2002:a63:1e56:: with SMTP id p22mr28991953pgm.126.1543401857948; Wed, 28 Nov 2018 02:44:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543401857; cv=none; d=google.com; s=arc-20160816; b=yronq0Z8vFgphow/dWJ18fe1NNV9SpNiLfFijdAZAOaMWtGTEFsfpvtcw7e+2nN39W 4oOj9wQ+La9IZ1+A7hbdK1fhBAiFQ7sOTugElCSPgb0FxVrHqSYGCNRhhYKGlg4pOwA8 /8lrStwSN1cwTVOV4m4gbKLxippnnD8n+2YZVKEpWTQNuGfxWNztqxBBnd0HKoeoKAKT wXm3kK6pwBDYdY41zezmoxAxKqnlPyFFdIXoOFBZDqqCl14UaagIVY6l7NwxrT60002W BXtYuGwV199IZNM3gdAJqF806YDvOAhtfEHRNN0/3jAloGf6LRPM2fO5sh8+g5ck+qxn Hnwg== 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=hQwrbOX6jWVhS2xXND6mp6kD61Itg1CrwK7UbFAIOVk=; b=Qc5D18PtFVUNRynSJYM5SW6XeBWwJRewlXsd/5C2zFCw5a2gtUky4nNy/0u0ZhdAd+ xocUqGtLp9TRgc2WvMJPhZgrd2VenLV1PLSqaSTkfVjBuN2FT21xfHNYlEJv7Pj/dnYK CyeCe7hp7AnRFDjGG0fewU6xew8V7NNmslULPc72dNhUaVL7seYsYMR+WwiQ7FiiIoLI cwsnNXjqdS6wgegxZu1IjwFLI4nEs3ZW78qJGX1Kmj0xn/7g66cdlWJ4WcWt0dLEHjZ1 JSeojPn6c9h5L0CuOogmJBbP8N5CAL+WLzPbmLLidV/hZauxyd6SKZuuQV8wCtDTElHK OjWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S9WNOSG0; 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 k11si6837725pgh.132.2018.11.28.02.44.17; Wed, 28 Nov 2018 02:44:17 -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=S9WNOSG0; 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 S1728332AbeK1Vp2 (ORCPT + 32 others); Wed, 28 Nov 2018 16:45:28 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:45593 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728119AbeK1Vp1 (ORCPT ); Wed, 28 Nov 2018 16:45:27 -0500 Received: by mail-lf1-f66.google.com with SMTP id b20so18953315lfa.12 for ; Wed, 28 Nov 2018 02:44:13 -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=hQwrbOX6jWVhS2xXND6mp6kD61Itg1CrwK7UbFAIOVk=; b=S9WNOSG03IE7X5xnnj7NI1JR1pvp3focVQkkb+B92qtxxF46HE4HtXk666CL9U6FV4 l/knRppcviKlsAIuZP938PhblJ0MYGUBJorly1o1esaVcTu0P9xhphSBJC72KMQg/NwA 9Ejf0J0UEVydxS2VUeyIKW0SonhMCFurYqLFg= 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=hQwrbOX6jWVhS2xXND6mp6kD61Itg1CrwK7UbFAIOVk=; b=MLl6Y6KkeAityWtBkfmGAJ1nTDiyVtDaFbCjNapywnNBvbuRl0QzlAHUmKudlD8cUc /vn2+HSAkZQxPcEKKwUfrN1niEX2fymPynDI1c16tv087/1DNPSsVN/pj/bxxZOS/oJm jFE6T4E9/QRWFa8FwWyZnTfxsOZD66zftOqNlip+LU4DvGaLo+Iw26jhqxZWi6uziluX Te5YYvwOiMnS+TeBNWE87BE28WKiWHhb7ezAnjECO6j6NB8UlnCxKjCW86VwErCBUpyh aBC17dX2h0T4DaZxL0k6QIbNWZ5SCLrHBWsCPzh4M+5F5Smf0ToDF2Rr3HGPYHpETZnw xNGw== X-Gm-Message-State: AA+aEWYOC1pVFAEsFzlzCMxD2RwTyMP0GR9uF7SbYwXe8rUshSqHh2A5 2JBevNZzsKC96jxyeADbrPD+QA== X-Received: by 2002:a19:c115:: with SMTP id r21mr2302710lff.144.1543401852268; Wed, 28 Nov 2018 02:44:12 -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.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Nov 2018 02:44:11 -0800 (PST) From: Linus Walleij To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, Charles Keepax , Bartosz Golaszewski , Linus Walleij Subject: [PATCH 08/10] regulator: max77686: Let core handle GPIO descriptor Date: Wed, 28 Nov 2018 11:43:48 +0100 Message-Id: <20181128104350.31902-9-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_from_of_node() rather than the devm_* version so that the regulator core can handle the lifecycle of these descriptors. Fixes: 96392c3d8ca4 ("regulator: max77686: Pass descriptor instead of GPIO number") Signed-off-by: Linus Walleij --- drivers/regulator/max77686-regulator.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.19.1 diff --git a/drivers/regulator/max77686-regulator.c b/drivers/regulator/max77686-regulator.c index f5cee1775905..236cd42002f0 100644 --- a/drivers/regulator/max77686-regulator.c +++ b/drivers/regulator/max77686-regulator.c @@ -255,8 +255,7 @@ static int max77686_of_parse_cb(struct device_node *np, case MAX77686_BUCK8: case MAX77686_BUCK9: case MAX77686_LDO20 ... MAX77686_LDO22: - config->ena_gpiod = devm_gpiod_get_from_of_node(max77686->dev, - np, + config->ena_gpiod = gpiod_get_from_of_node(np, "maxim,ena", 0, GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_NONEXCLUSIVE, From patchwork Wed Nov 28 10:43:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 152247 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp923686ljp; Wed, 28 Nov 2018 02:44:19 -0800 (PST) X-Google-Smtp-Source: AFSGD/WC0SJF+MMIF6lunPo5tuUvwKjisTU6trp+XCb+ZA/g2bgCKEcI7QmIoG2XZE4hbHiyBMPG X-Received: by 2002:a63:9809:: with SMTP id q9mr32731864pgd.109.1543401859621; Wed, 28 Nov 2018 02:44:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543401859; cv=none; d=google.com; s=arc-20160816; b=kioDM1W+R4qzjyr8mKGiDN+ibS1SuCXJv9m25TVZrWIqptJSpGyfzq/FckXRAKDGCU /YEb/bQW4vLnc0W8MT+ZIvZvR5t/AkDar0dzc2amMH8CrkR8s76U6NfRYysLhXTtSwaz u0Ck6ibIQZ5w8HWNy6NkVc9nYvU8M3oewGroDNoQJjQoItewbkwlXsO9p1zLQUq0xxyA /zl+5jsJQ1+QyipXdO2hKOa6Cg/eB9XYTlCnYqFCwHX6EKyIHWSSIHehpbogpAF/Q9B8 02BwAmQzlzw+jp/GQmF6CCdKc0fjuAeW6HYvn/N7CnQ0VpeSDQJUYZQE/+p8kaix5K+F 1kmg== 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=NYiM9hsLAwjDtY6nnK0M2ohtbKlx4iqaNDXUO8IxYxE=; b=PMLMNfYcZ2gRWJcyLjAygqbe783NP6NxIkHd+Q8if+2IKpLOi8MplKJheBdL/urS9p 4m56nqKJUBrHLSvMrHPG1CBWvEZA/0+Hprh4Wx5UpqROmVcJviLkJMgl7bP5h2adqC7T YXef6fspcYJgXg4RDciTXjPm7Uvq62xNav/XIDilyiyXEg8gLlXC5vzJVNO9fCnIN2fX TFgpYao2d68P9LoNiYl68cj9we5UXtCqMcMb+vGAZ4tHm+W5fh9YV43HrJVgLPKEW7Ty RJBq0Xi8Qe21ysFA4IqZU0WiL5CIStYvTEj7nMuofGJK/m4f9s+2jv64L3WPPMv7QpiM nbZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HcJP4fbq; 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 k11si6837725pgh.132.2018.11.28.02.44.19; Wed, 28 Nov 2018 02:44:19 -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=HcJP4fbq; 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 S1728352AbeK1Vpa (ORCPT + 32 others); Wed, 28 Nov 2018 16:45:30 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:37004 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728300AbeK1Vp3 (ORCPT ); Wed, 28 Nov 2018 16:45:29 -0500 Received: by mail-lf1-f68.google.com with SMTP id p17so18978934lfh.4 for ; Wed, 28 Nov 2018 02:44:15 -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=NYiM9hsLAwjDtY6nnK0M2ohtbKlx4iqaNDXUO8IxYxE=; b=HcJP4fbq2N7Qxt3f1FdI/Sjnzz0LP4Hb4PYty22w1YFJE2KjFeuXaUte5yhiURHTU1 hNgOrbejD9xUDBvEfN1F6XmphAvXPGJxyeMzg4fYKkxod9pUE5fT/GL4JGg8++HEGBex 4ldFonVtUGGgQUye+6Uw47YHDdpj0UajWw4dU= 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=NYiM9hsLAwjDtY6nnK0M2ohtbKlx4iqaNDXUO8IxYxE=; b=LUHfL2Feqpe4O4BHTwLr7wIwGzQjUgpdUSBwk/7bktbDHECQV/YuHF4/eif4UCpTSu GnLd/oPQfNf5GaYAU8o4auxXsLYbyv4N6hG9YHZwSA3BkX7GVuj/v2Uh86ZJpGeIC5Es PSNg1NYVsrPNzvaVEewohJPKq5RMl1oGB6Su663oTlnNalZtVFKE52tbVbRq0eTftTey 76klYm+wGnAOpyiFA5wsuqVlUQi5dfbJp9kY6AJxP9rps3kP2/PE7SlpZJdKXrcwGNkP E+vhc7rWMwIvd4L3NBiB09Et+IQd0xgbLhK1WvDYe14WxIAVl6U/u8CKQI+JhjYeg/91 cEhw== X-Gm-Message-State: AGRZ1gIOwMx2rJU+FBzvBCdR9TPXFcVBg15Xhx812J8MA0146UoD5Frm FxB/wPjcf6nvP2Q+uHmj/Zr6tYp4/FuPFg== X-Received: by 2002:a19:94d5:: with SMTP id o82mr19908179lfk.155.1543401854599; Wed, 28 Nov 2018 02:44:14 -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.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Nov 2018 02:44:13 -0800 (PST) From: Linus Walleij To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, Charles Keepax , Bartosz Golaszewski , Linus Walleij Subject: [PATCH 09/10] regulator: s5m8767: Let core handle GPIO descriptors Date: Wed, 28 Nov 2018 11:43:49 +0100 Message-Id: <20181128104350.31902-10-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_from_of_node() rather than the devm_* version so that the regulator core can handle the lifecycle of these descriptors. Introduce an errorpath so we free any retrieved descriptors properly. This patch requires "gpio: Export gpiod_get_from_of_node()" to be applied first. Fixes: 9ae5cc75ceaa ("regulator: s5m8767: Pass descriptor instead of GPIO number") Signed-off-by: Linus Walleij --- drivers/regulator/s5m8767.c | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) -- 2.19.1 diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c index 219b9afda0cb..2d8f6cd4f142 100644 --- a/drivers/regulator/s5m8767.c +++ b/drivers/regulator/s5m8767.c @@ -528,7 +528,7 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev, struct device_node *pmic_np, *regulators_np, *reg_np; struct sec_regulator_data *rdata; struct sec_opmode_data *rmode; - unsigned int i, dvs_voltage_nr = 8, ret; + unsigned int i, j, dvs_voltage_nr = 8, ret; pmic_np = iodev->dev->of_node; if (!pmic_np) { @@ -559,6 +559,7 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev, pdata->regulators = rdata; pdata->opmode = rmode; + j = 0; /* Keeps track of populated elements for errorpath */ for_each_child_of_node(regulators_np, reg_np) { for (i = 0; i < ARRAY_SIZE(regulators); i++) if (!of_node_cmp(reg_np->name, regulators[i].name)) @@ -571,9 +572,7 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev, continue; } - rdata->ext_control_gpiod = devm_gpiod_get_from_of_node( - &pdev->dev, - reg_np, + rdata->ext_control_gpiod = gpiod_get_from_of_node(reg_np, "s5m8767,pmic-ext-control-gpios", 0, GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_NONEXCLUSIVE, @@ -597,6 +596,7 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev, rmode->mode = S5M8767_OPMODE_NORMAL_MODE; } rmode++; + j++; } of_node_put(regulators_np); @@ -608,7 +608,8 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev, "s5m8767,pmic-buck2-dvs-voltage", pdata->buck2_voltage, dvs_voltage_nr)) { dev_err(iodev->dev, "buck2 voltages not specified\n"); - return -EINVAL; + ret = -EINVAL; + goto err_gpiod_put; } } @@ -619,7 +620,8 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev, "s5m8767,pmic-buck3-dvs-voltage", pdata->buck3_voltage, dvs_voltage_nr)) { dev_err(iodev->dev, "buck3 voltages not specified\n"); - return -EINVAL; + ret = -EINVAL; + goto err_gpiod_put; } } @@ -630,15 +632,18 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev, "s5m8767,pmic-buck4-dvs-voltage", pdata->buck4_voltage, dvs_voltage_nr)) { dev_err(iodev->dev, "buck4 voltages not specified\n"); - return -EINVAL; + ret = -EINVAL; + goto err_gpiod_put; } } if (pdata->buck2_gpiodvs || pdata->buck3_gpiodvs || pdata->buck4_gpiodvs) { ret = s5m8767_pmic_dt_parse_dvs_gpio(iodev, pdata, pmic_np); - if (ret) - return -EINVAL; + if (ret) { + ret = -EINVAL; + goto err_gpiod_put; + } if (of_property_read_u32(pmic_np, "s5m8767,pmic-buck-default-dvs-idx", @@ -654,8 +659,10 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev, } ret = s5m8767_pmic_dt_parse_ds_gpio(iodev, pdata, pmic_np); - if (ret) - return -EINVAL; + if (ret) { + ret = -EINVAL; + goto err_gpiod_put; + } if (of_get_property(pmic_np, "s5m8767,pmic-buck2-ramp-enable", NULL)) pdata->buck2_ramp_enable = true; @@ -674,6 +681,14 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev, } return 0; + +err_gpiod_put: + while (j) { + gpiod_put(rdata->ext_control_gpiod); + rdata--; + j--; + } + return ret; } #else static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev, From patchwork Wed Nov 28 10:43:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 152248 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp923721ljp; Wed, 28 Nov 2018 02:44:21 -0800 (PST) X-Google-Smtp-Source: AFSGD/UDep6J46DSMK3M6whMGI5x0Rg7D/Xuc7zpXhRAj73vKBQbmmWJ20h2s5Pbx4zEjsK0WAFD X-Received: by 2002:a63:1204:: with SMTP id h4mr32702619pgl.51.1543401861594; Wed, 28 Nov 2018 02:44:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543401861; cv=none; d=google.com; s=arc-20160816; b=IVCNo/p6r5nndlLo6q4k+op2tO3e3CEBLh4DrRekOrNmWcRZAp4D8xS5vtT9OezuST XioXn19I1RBaEjZ4BSoKDUmiaYMEo0XHBL0UU6PD0JObnZ2xB9VrbdBpTo6vYTbmn1gi CET60R1b9bDXS9ZDVaK7oxgxXdQSB3ZCPm7FytssGlD+YwM/tMk6CwzhNsHlQI9azy96 r4zQwLO6F9RCFGzGmq4fy/+0TVxIpvWmkcOaVoDKds6qLstsbYjTkVY45TQir/Vz88Hp 6w6OzetaMxIDmsS/YwyPBfddOX8IeFV6bxAh8oLXf6/PxSxncyzrMWZ15snxgp4Kpu9H frQQ== 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=1uQOl0jE+lEJ7qDRZSdw84mH6vUDxYf8b4kB11Qb3Ug=; b=dVuBjXMHpkMXBO5Q46MR0uHVwpsAHGSLlXUJp3e7ydha9OxHrlL3NZtv/bW0T9TJvq Lyo/6BXcQjB/XGi3AUrWNJcuAnP8DozF3ZepYH9o1podWuacofDivwtuAacJ6MQq7Dh2 xor5ODn1zwzYy0waw4dL6mtN+/rcRBFGFcGic6Pq8tzmY7kv58ChUL6wyGt4sBU2NgTs +2E66VYaUIBAnvqeWR+99YKab5cpJGcDfPHK18D2rJ0+WeFFbRVbress1tX6qy1mVEcy hqQL/TXAiMsWWViI9LgFhYNW3JpMAJBkkPOuaz6dfVKGdVHQk7Y+z7XtqOMSdHiAuEe0 AgSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UZyYbkFk; 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 r6si7076392pli.248.2018.11.28.02.44.21; Wed, 28 Nov 2018 02:44:21 -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=UZyYbkFk; 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 S1728377AbeK1Vpc (ORCPT + 32 others); Wed, 28 Nov 2018 16:45:32 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:44764 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728119AbeK1Vpb (ORCPT ); Wed, 28 Nov 2018 16:45:31 -0500 Received: by mail-lj1-f195.google.com with SMTP id k19-v6so22951515lji.11 for ; Wed, 28 Nov 2018 02:44:17 -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=1uQOl0jE+lEJ7qDRZSdw84mH6vUDxYf8b4kB11Qb3Ug=; b=UZyYbkFkpBwC3HkfdV23mGo6Oa+RM6a5ahe7ykaVE1nNS065LIt5QBJi+PC/Nwv5Py xaRlZGfBUmbND2jpEnHf3PEBjF+izNKix37xIQI6T+qL8IcV1La3HC2t1FvHEG3ZiEI7 HB3kH+LQ7KUQAIOzdF7k8PNUgI/c+BvGC31mo= 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=1uQOl0jE+lEJ7qDRZSdw84mH6vUDxYf8b4kB11Qb3Ug=; b=JUICw78jaaFkPFxVP8BKksMuCS6TeT3heCxAazaq7caQg6F6RDgIXCdEYzyjK8wE40 VB20sqHaPwzKsdwact/oOpuCPOhXDWwSCUIrwXrQfi8DrQFQ6gkGQA5gYQD8kr9S5wDH 95wiCyKMV0KYYHG42kiFt7CkUbpbXJ675k3bmxSY4EF0Qa/rUxiHsNalNLTnnZAon7HU 2vs8PfRMgX8ygEjEcmHDtC0nABctCBdYyCckP6iUvcMPNAmKygD/KZUxTf9aCuRAgDJU xeW3aKm8FivSjWwymQzkTiYoqjMHX3dD0dgolJoVUSN+8oen2zd9zC1EkcV1+lqFr6s4 sc8w== X-Gm-Message-State: AGRZ1gIiGiJ50NWIiSyfhTV5GScqOD4tdenyzLNY2QoS/jC3n89i0eIM MXCQ8Eh2sscRwFT47j1eIr/e2w== X-Received: by 2002:a2e:2b85:: with SMTP id r5-v6mr22045671ljr.91.1543401856328; Wed, 28 Nov 2018 02:44:16 -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.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Nov 2018 02:44:15 -0800 (PST) From: Linus Walleij To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, Charles Keepax , Bartosz Golaszewski , Linus Walleij Subject: [PATCH 10/10] regulator: tps65090: Let core handle GPIO descriptors Date: Wed, 28 Nov 2018 11:43:50 +0100 Message-Id: <20181128104350.31902-11-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_from_of_node() rather than the devm_* version so that the regulator core can handle the lifecycle of these descriptors. This patch requires "gpio: Export gpiod_get_from_of_node()" to be applied first. Fixes: 3012e81446d0 ("regulator: tps65090: Pass descriptor instead of GPIO number") Signed-off-by: Linus Walleij --- drivers/regulator/tps65090-regulator.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- 2.19.1 diff --git a/drivers/regulator/tps65090-regulator.c b/drivers/regulator/tps65090-regulator.c index db714d5edafc..223f6974a9f3 100644 --- a/drivers/regulator/tps65090-regulator.c +++ b/drivers/regulator/tps65090-regulator.c @@ -376,11 +376,11 @@ static struct tps65090_platform_data *tps65090_parse_dt_reg_data( gflags = GPIOD_OUT_LOW; gflags |= GPIOD_FLAGS_BIT_NONEXCLUSIVE; - rpdata->gpiod = devm_gpiod_get_from_of_node(&pdev->dev, - tps65090_matches[idx].of_node, - "dcdc-ext-control-gpios", 0, - gflags, - "tps65090"); + rpdata->gpiod = gpiod_get_from_of_node( + tps65090_matches[idx].of_node, + "dcdc-ext-control-gpios", 0, + gflags, + "tps65090"); if (IS_ERR(rpdata->gpiod)) return ERR_CAST(rpdata->gpiod); if (!rpdata->gpiod)