From patchwork Thu Dec 6 12:43:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 153021 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp10479618ljp; Thu, 6 Dec 2018 04:44:42 -0800 (PST) X-Google-Smtp-Source: AFSGD/V4IOVYZJ5C6aS43IO1/cCcmzcJOrrY1yC3vciNNo0btd+v+6st31jG6vEu6CXMsWLhzowd X-Received: by 2002:a63:b4c:: with SMTP id a12mr24340567pgl.131.1544100282452; Thu, 06 Dec 2018 04:44:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544100282; cv=none; d=google.com; s=arc-20160816; b=oqis6EoOOhqHp61OgFpyzD8NrucALe3D1nEQcfyl1iCXkr4UPhAS6JaGhZQKz/QDse Fu3zOg0jqDcRnEtVS/lWBZSfLJPd7M9dHvXTS2l8FF50/OKyexGEj0AgprNvh7w5f6M+ wVqwg+5Raj/Jn4MsFVI99qYLM+qY2bEPksFxpW/MYQfC+aCWR6cV/pb5XH+xrezLPsRy r+khM/NyvilVGFKoQLhFl8Q9bBTR8vg5YZ4hys49G8pBRtet/TMupTfKLQ4MRFfAc5b2 GWxLK1BLmgZ8wI2oAvyGfmMAB/MK7MTwzCKLZynU6IVNiqR+WEH9rJLFQttboa6eApnN CtNQ== 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 f15si213227plr.144.2018.12.06.04.44.42; Thu, 06 Dec 2018 04:44:42 -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 S1729820AbeLFMok (ORCPT + 31 others); Thu, 6 Dec 2018 07:44:40 -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 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(-) -- 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)) {