From patchwork Wed Dec 5 12:47:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 152900 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp9256186ljp; Wed, 5 Dec 2018 04:48:15 -0800 (PST) X-Google-Smtp-Source: AFSGD/XFgkOP11qenEwXNuRDdih8+/m75CUxGcEFhKWs89P1C8Qy3CTk9hC6q93pS71nD0LR8prT X-Received: by 2002:a65:66ce:: with SMTP id c14mr19022862pgw.450.1544014095258; Wed, 05 Dec 2018 04:48:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544014095; cv=none; d=google.com; s=arc-20160816; b=m5TwJ55wyHvRjoaG4gx9lx9qKcfTz0J3dp4o5hJqJ0EoNErbSiA+MeegAuuRCNIDQf shFIVJL3iZtyZt97k7PrI362u5fzSZLdJhPDG4y5bPTR2auu5M93+5l093ayjBGMwZrG PCEYvb30ggy4KWbA+GxbEakVJfJVPhJwHa47c/ksvzL3B9SuYoewwpK2N09olTPium7w ShKOu7offK4Lv+Tfp4sw9VKXIRsDm6QCea/29nRTdZBcpASTCEM/xTgAnAJH/a2xyImJ 3et4EqzdujdIup6EknyyFxizW3Ya4ruKE+kpCozjtHtZ74rtWteemPmxEtGjnOPquWpn bxXw== 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=nDXJn4r2s+zy7VrlG4cSBIGqxAHZiQ7TczOaY5V2Rm8=; b=Bg0LVFOSEk5n+KoKk1e7ZKSy+8V8LR9mTilt/yUAeTYR6DslcCRcJfDUPr/vybRRoi I5uTAd8AF0V+gjSJe4naiftc+dA1LGd4laQOZaQBEqKx/NfAepr4pYnFms9Tg2fEQxcy rUEPCBUA7VZIydpX6T9eNWJ76wTUXo0noFMFB4LCBxgJv/JzZjjWJWND/1Sqr+wYKeVI 1ad7LF9D+Q+b1LoqLvyi5QDmPW6MbbTreVyRN4y5OVmbVaTLipAao9bHDlETgyqHzDG+ IfDqODA1VXUl0SVY8o1fT1gB6ZwZnCrQkZLHz55k5+TsZPVsuuifQtIRySnnF3RK5rOT KwrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="XVl/6G5S"; 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 w12si18042427pgs.182.2018.12.05.04.48.14; Wed, 05 Dec 2018 04:48:15 -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="XVl/6G5S"; 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 S1728020AbeLEMsN (ORCPT + 31 others); Wed, 5 Dec 2018 07:48:13 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:41430 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727182AbeLEMr7 (ORCPT ); Wed, 5 Dec 2018 07:47:59 -0500 Received: by mail-lj1-f195.google.com with SMTP id k15-v6so733769ljc.8 for ; Wed, 05 Dec 2018 04:47:57 -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=nDXJn4r2s+zy7VrlG4cSBIGqxAHZiQ7TczOaY5V2Rm8=; b=XVl/6G5S49/iWZPpOwxE5k94KUzcEZDoQVae5FXyOYLmyvWIpfcP98MVEKl3BWCwcr 7J28orekYDmunAVYBsEVT/Xcfvb6EnC+oOB9pwRY7e6/CfSfJORwhdpW6tu42e3cQukr tyPNQR9r80hmaaor9rRmUMXRISMJt6UAgZqHI= 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=nDXJn4r2s+zy7VrlG4cSBIGqxAHZiQ7TczOaY5V2Rm8=; b=jT5o51TkB1S7uFrCV90c+xTTrJMAf6/4d8cJZW0RbBicePfYD7PSyXIbf+yl5B+mdI oSpTGpaamnRscIliS3hFmZ/dcZr6MlC1w224U+SnLEn7bL9I571aNsb9OOeWs+A9xJe6 CT/07pAbWXyRemr3OwOe595DnPEQOU/ACyeLpNgGp4Z6tCliArJ0AyjIE5MwnCCBvOQD eRECqMBoPiuvtkeIWdZkNKPYHsAo+7Kr0hPNOAB+E2djvwK64SbWN6fI5Kyhm4S5NO8V Ig6Nzrtcyj/xSHVgEaYfFGEV2SEmW/h8nwxJMTr9QhzPAFVwPFfULzRca8ivfG0ohWeg L99g== X-Gm-Message-State: AA+aEWa2Ggwv2XDZ79NhGvu6tFv7sV8YCB7VjKI/1+iD4AKcXpkuAlpJ QxvPfOdr6e8h2V+379GBLPYg/A== X-Received: by 2002:a2e:5418:: with SMTP id i24-v6mr16955090ljb.51.1544014076783; Wed, 05 Dec 2018 04:47:56 -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.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Dec 2018 04:47:55 -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 v3] regulator: s5m8767: Hand over GPIO to regulator core Date: Wed, 5 Dec 2018 13:47:19 +0100 Message-Id: <20181205124721.26624-14-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 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 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(-) -- 2.19.2 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)) {