From patchwork Sat Dec 1 15:41: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: 152642 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp4934677ljp; Sat, 1 Dec 2018 07:53:31 -0800 (PST) X-Google-Smtp-Source: AFSGD/WRS6n84LcH6ehHlZ2lae2BZrpDQmNnHslwRg8ZMLhW2f4n/G0tpS+uZf9S71vmFTW62+5B X-Received: by 2002:a63:193:: with SMTP id 141mr8226300pgb.136.1543679611192; Sat, 01 Dec 2018 07:53:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543679611; cv=none; d=google.com; s=arc-20160816; b=a8K6j99WKRWGW1bSnwdrd7KX/Qu3KAF4Ap2u17volqNi8YrCKpDF6fdWWmzbFhRREe OKALGe/DENL24Gw3S1eA/VpuBIrOjksmSnAkSA2o74Bz+2HzogJk13xnFfii/OTBjN+f AjQenQncSU3iMABNKaS3SfKxN3XhR+BFHU2yGpBitlrsePtKlQ0YTbQo3VoL+KC4cqEN gxG3bzfSiYv8CSQLSOOa1CewUQsC74w2A8ZKGDiJEP6u0sXLWXOK1F2FosDksdWqBH9y /3dGCUfhYMq/rVQoANDf7ddrkFPcBAKtHxZ/p2HIez/szZgYcyTxDEQYRDavSo9ZlnqE l0cw== 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=44SPP0BIPcyJprau3J/HnN7hoNM3OEVwqSrrtldr13E=; b=K7fMfaQLUD1z1wv7h8B60Qq4rbjZDIqlzNd8FFCZeHJs6Z11Pbq1XDqHAbBAK8ZBru BH5aBlT8DAgqJbgO0fknbqNh876+HQgbLkTYUa25Ia/d0AQ4EBntmsXYbXhwAg0w0mU+ zTwqqF1peOZysw6cip5Bq0QhGuYFVJcohH/iXr9ZixA+kUpWGIQa43fApM99ZUlA91hs /lQnYFLImEkpx8aqpGEqYKuf/eVcc2B3VjdNQQNlBD+xdBMK6SGQKQzmV5SrNq2h/HG7 BNidrOtNe0U5Gbcz/ioN1mjfk4Y85aXbWPL0ekYF33h+U8ExViYE6lVc+oCG3hgxbCHG kNSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LK6zz3sX; 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 i5si8204825pgn.243.2018.12.01.07.53.30; Sat, 01 Dec 2018 07:53:31 -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=LK6zz3sX; 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 S1727396AbeLBDGQ (ORCPT + 32 others); Sat, 1 Dec 2018 22:06:16 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:36432 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727169AbeLBDGP (ORCPT ); Sat, 1 Dec 2018 22:06:15 -0500 Received: by mail-lj1-f196.google.com with SMTP id g11-v6so7641404ljk.3 for ; Sat, 01 Dec 2018 07:53:25 -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=44SPP0BIPcyJprau3J/HnN7hoNM3OEVwqSrrtldr13E=; b=LK6zz3sXhQ6zMfd6xPVCcwV+AB03r2QF/4TreQ7SOnGwmct1GuZSJvvfH8UzvCEAu5 YyVU3YXxCGpbPzh5z82lpCiD0SBw/7fXw7ykD6zf2KNC6x4/5bm52PYIp38Ko+PzuDKw VYLVz8MrsciLV6eQc2WPKfwwagY0/gikp9GGI= 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=44SPP0BIPcyJprau3J/HnN7hoNM3OEVwqSrrtldr13E=; b=YPt766hz5wno4z1Z01Sob4Qsp+5jSPcfRhCtXTC8iwYJeA+f2fUgl7aekp11lkzS0s 22mBRBpTlKVSlqap/fbkQ4YjJlyy+JyxTsnXzIb+Z4nK0u4PfGp3X7xYVG9kjo4FHK0q xcK/HrAa7Ff4PAcBozK7N2oYx3m5KYZJyVwqOcAjmqPtUZy2RYrOm2ndr7TcYYk9+Ap1 +sO8/+G4ijqhgvIR3/b1akeSzDrq2eoOiMS/9WzsTR8wo91samyy2qe2ANM1z8jE+f6/ tmj6P8chKCPiGrUDuvRWjlWY7FzKiIiNaUyokv6aeXs7XcFsbBvqfYT0032yBeHzzBlw +5hQ== X-Gm-Message-State: AA+aEWYTLpIQj69rnQmcRHBEIh7JgSkOIUtXfyhaY7BRa2DsyeEbPMqv 3He40nUeZQ8rx8lI24cJpvzb4A== X-Received: by 2002:a2e:9a56:: with SMTP id k22-v6mr1977164ljj.17.1543679605045; Sat, 01 Dec 2018 07:53:25 -0800 (PST) Received: from localhost.localdomain (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id 13-v6sm1365426ljj.49.2018.12.01.07.53.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 01 Dec 2018 07:53:24 -0800 (PST) From: Linus Walleij To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, Charles Keepax , Bartosz Golaszewski , Marek Szyprowski , Linus Walleij Subject: [PATCH 11/13 v2] regulator: s5m8767: Hand over GPIO to regulator core Date: Sat, 1 Dec 2018 16:41:49 +0100 Message-Id: <20181201154151.14890-12-linus.walleij@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181201154151.14890-1-linus.walleij@linaro.org> References: <20181201154151.14890-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 The GPIO descriptors used by the S5M8767 driver are retrieved during probe() and it is really helpful to have those under devres management because of all the errorpaths in the intialization. Using the new dev_gpiod_unhinge() call we can remove the devres management of the descriptor right before handing it over to the regulators core. Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - New patch handling this drivers GPIO descriptors properly. --- drivers/regulator/s5m8767.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) -- 2.19.1 diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c index 219b9afda0cb..d1edd8c2bcec 100644 --- a/drivers/regulator/s5m8767.c +++ b/drivers/regulator/s5m8767.c @@ -956,10 +956,17 @@ static int s5m8767_pmic_probe(struct platform_device *pdev) config.regmap = iodev->regmap_pmic; config.of_node = pdata->regulators[i].reg_node; config.ena_gpiod = NULL; - if (pdata->regulators[i].ext_control_gpiod) + if (pdata->regulators[i].ext_control_gpiod) { + /* Assigns config.ena_gpiod */ s5m8767_regulator_config_ext_control(s5m8767, &pdata->regulators[i], &config); + /* + * Hand the GPIO descriptor management over to the + * regulator core, remove it from devres management. + */ + devm_gpiod_unhinge(s5m8767->dev, config.ena_gpiod); + } rdev = devm_regulator_register(&pdev->dev, ®ulators[id], &config); if (IS_ERR(rdev)) {