Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10652030imu; Thu, 6 Dec 2018 04:46:02 -0800 (PST) X-Google-Smtp-Source: AFSGD/V9TemVgLdj4ivutwryZWreEty07k1M/UCsmOiZA45ZngsQYZQCdd1x64YyIeegrelFdilM X-Received: by 2002:a62:d0c1:: with SMTP id p184mr28183276pfg.245.1544100362521; Thu, 06 Dec 2018 04:46:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544100362; cv=none; d=google.com; s=arc-20160816; b=jG0NP2NEr9ZFXejWIRq+Sx39k1sNg95R7PVDhvP9Ck/rXQiFU7jcR3b8YoK/hCU/gJ Yh6wwgxwDcGgoHEfCWn3R/aR4LydiJeU2nyNxezyarh0Dl+G6RR00xybIq0iN3nbr/nd QxgrnG4vdRbHbBFU0CHLayWAnW/R1yG+I60rmtFD/DF2kBRj41b9cJYzZsrdE6NPflpg A4xAZHBGrkhtSxBuu3FI1dBM1S166MHn8hBRNyRZmaSy0EP8uSvQj8wC68XNJYQr6DWJ 6yc9GN6OgDjg+YbYI/zuyir97h9tnuQeWnuUC8OlcColvxK8aoHvioB6h4LTeK0aabrM uvBA== 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 33si233997plg.62.2018.12.06.04.45.46; Thu, 06 Dec 2018 04:46:02 -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 S1729777AbeLFMob (ORCPT + 99 others); Thu, 6 Dec 2018 07:44:31 -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 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 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(-) 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)) { -- 2.19.2