Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10652093imu; Thu, 6 Dec 2018 04:46:06 -0800 (PST) X-Google-Smtp-Source: AFSGD/XDxyYLiXe89KBFp7DzxKOOybiF2+8Mip7wUb0X+foHu4e0g1257ZZhP3hTMOEDZ3/aqriD X-Received: by 2002:a17:902:784d:: with SMTP id e13mr28565479pln.188.1544100366389; Thu, 06 Dec 2018 04:46:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544100366; cv=none; d=google.com; s=arc-20160816; b=r8C8Gq3JxU2nzSkfn6oryP3AVjkxf6zfvXSmY2uTe2eO2BR2HwdMC6MB692xKhJXNU 9nUtbTz6iPc7KSiqViwGVQTlXpdExUfeORQATgLzJAC2nGjc/gVkbAYzfiaY0vCIeTiB mQRDlm2zOYyIo5IXc3+mFyG7qsd7S2rRU2HNistNxnar6RnYu0AQvbiid6zTZoh/VEgg 41q5Ss7RaELDj0/lOMRut4SAl3nAIGFmE9BA1VS+hqm15+nTXhTm/ogPm7KhvVeLqfBT 62ryQz1Xdiob2xg4StBDg/8dN0mjFXfZkC1amJQsquiZca/+JU01KQxwkCijVVmyehPg Je4g== 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=oKAz9vRWrhcJiPEjNMOm6R3Q3uTXzg6siwroEfHHagQ=; b=n5kJhpX1HpuNkvtQjPjl8hvb6otcGjpXtHFtI+8WD5yfxJ/vuUl0ANONHUwxbkdCsJ 2WN9F2JKe6JdlBrxKjblDRKR+RfVwbc7K2LnCMt3q3XMh2Lhe00p+G82SiuIl1CClUtv gS7dvNevg1jQDgdRFlbOdxkkbVEZYf1PbpjiOMXxPeZ744jr9ALGt0q6TXDTtCOAbRbU tevudAExEuZal2RdGoDjSGqHET+fpyeDL8EB0wGX2y0IHYogzCdVgvXCH2O9bO+iyGcG 5+Upt1N4kfKxgmq48elZDj9FFQzCnFe0Klnz1mZn0009Y+lJcRrUae4VlKKzMT+IZRcV 8ntw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ktqeeb5a; 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 d2si221926pfe.159.2018.12.06.04.45.50; Thu, 06 Dec 2018 04:46:06 -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=Ktqeeb5a; 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 S1729814AbeLFMoj (ORCPT + 99 others); Thu, 6 Dec 2018 07:44:39 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:43421 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729778AbeLFMod (ORCPT ); Thu, 6 Dec 2018 07:44:33 -0500 Received: by mail-lj1-f195.google.com with SMTP id 83-v6so258638ljf.10 for ; Thu, 06 Dec 2018 04:44:32 -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=oKAz9vRWrhcJiPEjNMOm6R3Q3uTXzg6siwroEfHHagQ=; b=Ktqeeb5ahv6w7WsxGlX9ficcZonMkHkUSX3y6h8JQbWBgbxCEyoUWhzMQnSfcnWdHg clj0NZdLA2ufjwYQXwVIytvZdSs1peFUgOw5MCUw0mRGUPfuc6cdlQ0ev+kcGKcD7t9z Q85XnfFi/KdI5kYfk+cxJa7Mv3p4rkk/63eIk= 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=oKAz9vRWrhcJiPEjNMOm6R3Q3uTXzg6siwroEfHHagQ=; b=EAdaWdhDMou2E5oPxNZkjuOnIzul4vE22XM5dJlSm+GP9IqV9nP8fV4Xz1kD2aPzd4 Eg7v9FH/tUkUq2JlcYDNTLvpoVK2fT0aQK7V4q0yiX04OZVbv3+bhUrKWZobjaS88f3G bZvlesyqpJ2zT7UIdOxTYfISyCD1pf0PQwLcRoLnQJ7fKDURL7ZZ0mPAyoP0MUEQUDp5 2qXD9ccBzq5MwcxE6c640hoqDslUC6lQctGOwdCPaVMYXoop99X1PhcEzCh9ejpLn4gW I1G443Vv5U+14j+SzzAhpFBs3leWk3WIr4lWqSM2mqH25k0rgFL8eUdUYAOA/tPScNgi p+4g== X-Gm-Message-State: AA+aEWZ4Q5gxF4vuv+TUhntL+VEJhN6gWtwmPfo5Ls8ztwMzi84qV/TE 1cj9g0eus2vfamJV/pJTIZ0+7w== X-Received: by 2002:a2e:55d3:: with SMTP id g80-v6mr20109433lje.78.1544100271217; Thu, 06 Dec 2018 04:44:31 -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.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Dec 2018 04:44:30 -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 v4] regulator: s2mps11: Hand over GPIO to regulator core Date: Thu, 6 Dec 2018 13:43:51 +0100 Message-Id: <20181206124351.10155-16-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 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 v3->v4: - Resending. 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