From patchwork Wed Dec 5 12:47:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 152899 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp9256073ljp; Wed, 5 Dec 2018 04:48:09 -0800 (PST) X-Google-Smtp-Source: AFSGD/UD+ANyyGtJnp33Sef71D1WVXkybcY11VSDFzSzxlKiRz/r9YyWMtROD2jzTlrLAQsVfelP X-Received: by 2002:a62:1b50:: with SMTP id b77mr24542423pfb.36.1544014089809; Wed, 05 Dec 2018 04:48:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544014089; cv=none; d=google.com; s=arc-20160816; b=mmCMmSesR2Q34D72rAfNSLtUV1XJfTSnRGF3YTy2LZslPYi0eSHHbETe89l7LSiqFy +Rt5L/yK3qpC5hMZk4SDMBQB9vL7BmcMUx4A9AS/czMh2bCdn5l7qVLa7mQWWAzPSb19 X4WF8CVD7jXeQ3G8QzWpMKJ0n+zM5g8Y4pSHGmm3CW0bPzR1/Yfer3/QV+7HF6ZYUNQ/ MKuM786V0+sqyrhn0rFrvFsTxpexruNjVy1NVv22JFQu6qPWFUckvLO+QnuCq4Y6xdFr R+QeMEAZ3JYEyqc0ChcJt8qwd102SjSsv81WSjOrhB3vEc9e/Q81Is9ZiVgXKm9p0zLe Hfcw== 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=jvbe/TI6Rhb2D1rfWmfe80Bc3HpvIOlePt1WuzAwmR8=; b=ouO/qWTMge848tX5zsPY8rIXifP9ep5+5MRtPjK39+/NuEZI64a5tdfTJeTBEaO5mT NJZGQ9vh+HAUW1GjY7fw44tG3CHgMzlwOvK3GJ2/Nu4uF0T4j7rAHtoQLNXYcDcBVZfb REv9wE4XtCo9HkweiGGiNMLk3VcHKHp2Z7bgfv7iCFv4drgqj6rjx5sNKXnPvj2PdUFR S7CcJmPyvilZF/5R7s8fMxmu/vMf6u7fXRQjjn6fPrN+9OFh2Lx2huC6NUdGwg1lAQI1 JGvvMQNy7hcupD/DvpyIW3qkju16fbtvQKd9yEcN6funDt9HNyYmZlEnnd2D1njDJ/Jq 9qqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f8Ypw5eD; 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 u7si20831947pfu.270.2018.12.05.04.48.09; Wed, 05 Dec 2018 04:48: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=f8Ypw5eD; 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 S1728009AbeLEMsI (ORCPT + 31 others); Wed, 5 Dec 2018 07:48:08 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:38063 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727774AbeLEMsD (ORCPT ); Wed, 5 Dec 2018 07:48:03 -0500 Received: by mail-lj1-f193.google.com with SMTP id c19-v6so18213880lja.5 for ; Wed, 05 Dec 2018 04:48: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=jvbe/TI6Rhb2D1rfWmfe80Bc3HpvIOlePt1WuzAwmR8=; b=f8Ypw5eDceNhgRdXslCuTXFxSyiXSv8KrlT/tecx8xboeHWIn1NIKL3cwKZST+fa24 CycsVp/wytPMYh1JQbwYhBaXf2K/cBaQ/CfiXB4FfYF3IedTyrKD0ygERiyoWTpoYuYw GD7t1FcntszXPtsjkKJEV1xUtUGQiy5yCjXzg= 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=jvbe/TI6Rhb2D1rfWmfe80Bc3HpvIOlePt1WuzAwmR8=; b=Dsi8TtBXB0/0zyTeaKd8SunaemqfC2pOZPkVurMz+iddENM8pQ5+zNXsDLZAXzT9+I mxH14pQ3MjAy+wc21OjAznrSmbWQm+9iZoR10WR2Z8/nLLXlNcZ9hXrtcoZXaje4TfMT ioEQV5qVka2TVfDg6vsYTi4Cedi3SIWfnXZU8/PoE8UXtjxeH/jRMvOLRlm/Cdc/y9fW by/2tKH8UHY1R00izDDaFJWD1LouXlQQR/choxQIeFncSLpOfM9mJCfEac2zvRxpqN5d kZppsLqjeyaodxRMLI71iPBk5LY1P4fUUKjuYZkRBzaxkrCmTXAfk2MaGH6D3Fvw5Lpo QtDg== X-Gm-Message-State: AA+aEWbJ1CpoC06MVmGjOEEnqy5J58lnvzPKdG38HjE17AmJxBBtqyND zxwCxjBzpYQkuh+cCYUDOdg5lA== X-Received: by 2002:a2e:8786:: with SMTP id n6-v6mr10153266lji.100.1544014080987; Wed, 05 Dec 2018 04:48:00 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id e19-v6sm3797125ljf.67.2018.12.05.04.47.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Dec 2018 04:48:00 -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 15/15 v3] regulator: s2mps11: Hand over GPIO to regulator core Date: Wed, 5 Dec 2018 13:47:21 +0100 Message-Id: <20181205124721.26624-16-linus.walleij@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181205124721.26624-1-linus.walleij@linaro.org> References: <20181205124721.26624-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 S2MPS11 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 v2->v3: - Resending. ChangeLog v1->v2: - New patch handling this drivers GPIO descriptors properly. --- drivers/regulator/s2mps11.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- 2.19.2 diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c index 63e66f485cc0..ee4a23ab0663 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c @@ -1178,7 +1178,12 @@ static int s2mps11_pmic_probe(struct platform_device *pdev) config.of_node = rdata[i].of_node; } config.ena_gpiod = s2mps11->ext_control_gpiod[i]; - + /* + * Hand the GPIO descriptor management over to the regulator + * core, remove it from devres management. + */ + if (config.ena_gpiod) + devm_gpiod_unhinge(&pdev->dev, config.ena_gpiod); regulator = devm_regulator_register(&pdev->dev, ®ulators[i], &config); if (IS_ERR(regulator)) {