From patchwork Thu Dec 6 12: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: 153019 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp10479502ljp; Thu, 6 Dec 2018 04:44:34 -0800 (PST) X-Google-Smtp-Source: AFSGD/VwyrURtrToIeEr52r1t6ub/R54T9RSxOE1l6igzKgQ760sJxUebKrtfY1bMoT8rYRDHty8 X-Received: by 2002:a62:c28e:: with SMTP id w14mr28297318pfk.115.1544100274233; Thu, 06 Dec 2018 04:44:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544100274; cv=none; d=google.com; s=arc-20160816; b=BleVxonOqeuDjmtQaYyG+YzsqNrEGGoSwqF/POOG0AHIuwEja2fe8WkGEoczlPE1Td dPmP6g3WHM18N6ZNJibB7aGm2c8yQGVzJxLG4zkx7MER696JmVUyHKPDmagJ6gkkEv34 aLWAJONXXzByZYV2qxz9TjPitChao31gX7eri6DcUezs5x2Vn8+sAS57ONyfYnTLqip9 jbueKNHKc9tmwFE6wW3rPz2b2LKktOmvgWm6A567Pb46z8g+4rSLx3V4gA1/k3AhEdOc 63AUPL4u/sW7aS5pMlntING4Lfi1Dqo+BaTgJxTUWvCBeyCavExMitUowRg+SFmN8DbT zJAA== 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=zGDBokyGc+waU3E1xYhS96RewI7zWHyNAJ0hdJjfFDM=; b=074D+Hy39rwz+B4RHoX4T2mXXSZlWmISadPggADMh5RchJJ/zJRXZi8rhusGVyNYyJ +Uk1jq7eHRg6WPKCGF2Lb3PBZEXwaN4fcOXa0Alle36LhimsfB3gaKyZjxUxBMFBDgJd RsQ90iSkEU/pE2q271zKZAYcFwXeREoKcKr1utVtQ7W49M2YuIb8mnt/wxcsQOaFJfwC yhxAtBpzEW3ZSsDTtXGk6/amTSM7bjIVveBCxbNiKRpuZWdh679XUkfYvENgzQ6e+rAG X+YcAsxd4utFREOuqOO7RwtXZAFlvb8MabjSIJAu1TS6WTNAbsFMJqIrENgzJQHu/g3g D3Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NrPm+qib; 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 f15si213227plr.144.2018.12.06.04.44.33; Thu, 06 Dec 2018 04:44:34 -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=NrPm+qib; 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 S1729786AbeLFMod (ORCPT + 31 others); Thu, 6 Dec 2018 07:44:33 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:36416 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729754AbeLFMo3 (ORCPT ); Thu, 6 Dec 2018 07:44:29 -0500 Received: by mail-lj1-f195.google.com with SMTP id g11-v6so297501ljk.3 for ; Thu, 06 Dec 2018 04:44:27 -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=zGDBokyGc+waU3E1xYhS96RewI7zWHyNAJ0hdJjfFDM=; b=NrPm+qibyIgVlHSHLt0ZviQ+VgMeGK8smdvRd0xLjh9KoI4Mb7eRkh4l+ILhBr09S2 6AT3GiijfrzgnToNM+R9QdtDXKN569AsHfzWqp87ZhY4SuMImYBcRE4VqRA96XlthQV+ hIDlkvfDpGN9KiC4UnU6dz205zFamiPxaSBww= 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=zGDBokyGc+waU3E1xYhS96RewI7zWHyNAJ0hdJjfFDM=; b=cQrESawUA2/rRZj+KgvjNqH0tvTtTJeVL89/C5NmWPbiyksWX9NS1gYyWM1iidw0Z1 CfS/Y+86KoCquMshlXpVpDJtO8Li00T+6PitCwubonKp2ep1PDdmLlcZts5yDpteYIG+ Oibr4scLGumlBB5iGVLbqX8JkncrF+Q54ur9BGCtxCJnGhlvfUFwIzUfPo/A4jfdf+0J fIyyql7gZ9yc7qjV9vwbe8oAsSc35lH4/OYAvfwsoz/JC5JiM60elESFXQQP4DiTHAdx 6Dy+f/2fEYMv9v5JqGZlFH/+vF5XZFkrbsOg1sTCwZtg8IHldUA6PWoLCP2h1xgfvaBn /WXw== X-Gm-Message-State: AA+aEWYSVTx8nkrpv/CnRQ6jkTHt+E+5upISysk2s5SMMdZKMMTHhCJa hnQZAn4XbhmQYqdCoKUsEQcJ5Q== X-Received: by 2002:a2e:841:: with SMTP id g1-v6mr19744345ljd.21.1544100267205; Thu, 06 Dec 2018 04:44:27 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id j25-v6sm44071lji.77.2018.12.06.04.44.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Dec 2018 04:44:26 -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 13/15 v4] regulator: s5m8767: Hand over GPIO to regulator core Date: Thu, 6 Dec 2018 13:43:49 +0100 Message-Id: <20181206124351.10155-14-linus.walleij@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181206124351.10155-1-linus.walleij@linaro.org> References: <20181206124351.10155-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 v3->v4: - Resending. ChangeLog v2->v3: - Resending. 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.2 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)) {