Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp9430376imu; Wed, 5 Dec 2018 04:49:20 -0800 (PST) X-Google-Smtp-Source: AFSGD/WV0TybEmbA5+uAIwN2r2aFcGb2RJTYoSkRb82WRI+PG+8ePBVOEt2mWsiu2600lXf0OvT2 X-Received: by 2002:a17:902:f01:: with SMTP id 1mr23321699ply.143.1544014160844; Wed, 05 Dec 2018 04:49:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544014160; cv=none; d=google.com; s=arc-20160816; b=yW+Bp5efEHk9wDniw30sUefSNxJR/uR9lKMWbEEqOZRMHs71122RIr/MFyBLin4oef q+zEP/3KC7qY4XK0Rw25wB8IIzKn+sF61US0w8AC3oIAzmcgVYlxKzMuOyXzl6sksPny vpFAILb08F4zx4wty8QyMBtQb4ZOM7zdLOImanktULNaNlXpSzo0sXlFBVWNL3540rOq p/v/AfLJfvYd6VYNr3vQaDmsx5oQLIDgk8afOB8w5mKXrY/oKi/Z5HQ1BIWKcsIC4jQn RVUZaDyEzPVlL8CIBAS75qYIqZee1G4S/SUs4MMH8DAxbx0VSyk1h9XsJ9mlvXqyi0ZD hbhw== 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 59si21815403ple.291.2018.12.05.04.49.06; Wed, 05 Dec 2018 04:49:20 -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 S1728003AbeLEMsH (ORCPT + 99 others); Wed, 5 Dec 2018 07:48:07 -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 Content-Transfer-Encoding: 8bit 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(-) 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)) { -- 2.19.2