Message ID | 20181206124351.10155-12-linus.walleij@linaro.org |
---|---|
State | Accepted |
Commit | 48bd226f0ab3b91a837213cbfa15319f377effad |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp10479452ljp; Thu, 6 Dec 2018 04:44:30 -0800 (PST) X-Google-Smtp-Source: AFSGD/WmtVWsp0yO8U86cl6WZIpEgaWOiGm8LC8TB9tA+iLVpZADdq/G+FSdAELpfMedsh93eTpE X-Received: by 2002:a63:5a08:: with SMTP id o8mr22619172pgb.185.1544100270211; Thu, 06 Dec 2018 04:44:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544100270; cv=none; d=google.com; s=arc-20160816; b=xldWEl9QiglaCw/rYxjVv67Pjavr8Am+O2Eyot/kKGdB+EME3UI8n3zZHu+RNQLhtV Z7sZRBeOngui6J9c5uWxpU/AY/OSJLMjcQpf+Lgcx94ptT9nmWu3BsZLcEs44lhBTdzp oh7UGVgNlBxIsiSk6GKzAGIIu7LmspeTqRvGnQwoGnPRFSx0BAN8iG46S62mXlNvwLnf QucDt+bcGmXcjZjf7trTic6n3pW6GbhWKg0UKMUiK0JqYx+zh3TWqC1sZqpOyQdIVnnw eRkROC4G6g9mlCDdSkgR2IbiPBgO801zo5b9kjY40JRUHzUXU9v6iBBSdIKsf1uUVQdy DBWg== 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=4y2b8gfjVdDJn6awlRT6qg9t1Md297IZ+m34M/dErEA=; b=hi+68fvVHiDGhcR8xO3ZtuYNPcMer/wJoLwODk1yW/Ywofgpjc62mooFhR/JXt5lYL COP5VeohugaxwlQckuPA1EdDKjrMmU3XbRqwtp2+5AqEWMpmVePP0R3ojXWru+Q1crg+ p9UYyGNgQU4VFIzpxuc9mFDBhKx0FjnNClCUJ5VQe1MDrzxWIaXb+QSQDq/XGz1NGId1 LaiN9CXDA0nBtKHnhtcNl7TaqrtGW2oiKdIx9hp8DM7RJcOOn5f95gpkvC0aRuaIROCB MMIHoHM/VDkepdRjWsku9BnpzovVAqLE/RtLYHuFzYalvIXTnh3aa+/cPcMOfFFrTv8V mIbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=INbC4BzP; 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: <linux-kernel-owner@vger.kernel.org> Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h68si208548plb.375.2018.12.06.04.44.29; Thu, 06 Dec 2018 04:44:30 -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=INbC4BzP; 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 S1729762AbeLFMo2 (ORCPT <rfc822;igor.opaniuk@linaro.org> + 31 others); Thu, 6 Dec 2018 07:44:28 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:34505 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729369AbeLFMoZ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 6 Dec 2018 07:44:25 -0500 Received: by mail-lf1-f66.google.com with SMTP id p6so262885lfc.1 for <linux-kernel@vger.kernel.org>; Thu, 06 Dec 2018 04:44:24 -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=4y2b8gfjVdDJn6awlRT6qg9t1Md297IZ+m34M/dErEA=; b=INbC4BzPSiBO1R9J+pKLcyUU3/vHy0yg3IarqReUW6CnBPkVWAujz8muLjx44C3Hb5 fYQa/g7RQ9A+C0JGdv0fS84V2zG72nmF6Bp1bTJZzELcq/GqtoY2qRMwT0pOF21EJ1GY vwXOy/b7874WUOMW3jep1wUr77MhxaB3nWdxo= 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=4y2b8gfjVdDJn6awlRT6qg9t1Md297IZ+m34M/dErEA=; b=WzWSFR3te0KfWUhUOG9prw9RWgoJQTR3Z1w36DVuse2ZBkQk03FzYfCCtAcnvjbx/2 gHFHnAXsTwkbMEppn8FSuuucBQkg8PDQnW1b/7isd/MZzEfS4OfojLlrUIk3139sGWwQ abRZ/bA5brfKZ4fxIaayuSsiWlv05AKNQoj82A9Yb0KWES3l1Dk6doC1iHOxTors1oTC zNFTBwQtnUNvoJU3Mgybos3ncyhRCUKoCoc6iiEHq3mCt+tc4AewxWLM2EYZ+hdqra0/ GJp05MWNfj2lScm9RF8VOy/vAnVWTLzxlGFmJ2REklhQ0TsOskSzckKTIbP1o3d5WOF6 fHIw== X-Gm-Message-State: AA+aEWaegiI54oeOgL9OVa4fdjI/2TIJKICpYXM5yU9lRu4D1v0VgA6d 3s5Q660e6gWsHLxh0SYA6WzhKw== X-Received: by 2002:a19:641d:: with SMTP id y29mr15632212lfb.14.1544100263304; Thu, 06 Dec 2018 04:44:23 -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.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Dec 2018 04:44:22 -0800 (PST) From: Linus Walleij <linus.walleij@linaro.org> To: Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org> Cc: linux-kernel@vger.kernel.org, Charles Keepax <ckeepax@opensource.cirrus.com>, Bartosz Golaszewski <bgolaszewski@baylibre.com>, Marek Szyprowski <m.szyprowski@samsung.com>, Linus Walleij <linus.walleij@linaro.org> Subject: [PATCH 11/15 v4] regulator: max8973: Let core handle GPIO descriptor Date: Thu, 6 Dec 2018 13:43:47 +0100 Message-Id: <20181206124351.10155-12-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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org |
Series |
Regulator ena_gpiod fixups
|
expand
|
diff --git a/drivers/regulator/max8973-regulator.c b/drivers/regulator/max8973-regulator.c index e7a58b509032..9aee1444181d 100644 --- a/drivers/regulator/max8973-regulator.c +++ b/drivers/regulator/max8973-regulator.c @@ -808,7 +808,13 @@ static int max8973_probe(struct i2c_client *client, config.of_node = client->dev.of_node; config.regmap = max->regmap; - /* Register the regulators */ + /* + * Register the regulators + * Turn the GPIO descriptor over to the regulator core for + * lifecycle management if we pass an ena_gpiod. + */ + if (config.ena_gpiod) + devm_gpiod_unhinge(&client->dev, config.ena_gpiod); rdev = devm_regulator_register(&client->dev, &max->desc, &config); if (IS_ERR(rdev)) { ret = PTR_ERR(rdev);
The probe path of this driver is a bit complex: sometimes the GPIO descriptor is passed to the regulator core, sometimes it is not. To handle it in a simple way: stick with the devm_* resource management and unhinge the GPIO descriptor devres handling right before passing it to the regulator core, if we pass it to the regulator core. Fixes: e7d2be696faa ("regulator: max8973: Pass descriptor instead of GPIO number") Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- ChangeLog v3->v4: - Stick with devm_*, use devm_gpiod_unhinge() to handle the descriptor for lifecycling in the regulator core as suggested by Charles. ChangeLog v2->v3: - Resending. ChangeLog v1->v2: - Drop the gpiod_put() on the errorpath after devm_regulator_register() as this will be handled by the regulator core. - Fix the second case of devm_gpiod_get() - Put a comment in the code so maintainers knows not to use managed resources (devm*) --- drivers/regulator/max8973-regulator.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) -- 2.19.2