From patchwork Wed Dec 5 12:47:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 152897 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp9255979ljp; Wed, 5 Dec 2018 04:48:03 -0800 (PST) X-Google-Smtp-Source: AFSGD/Vr3Vk7Lpi+xJWqtfJ/Ej18rIYRNMXrVznbObHMhGjPbHfCFvQiwIJHBOpnt5P4ky5uywAK X-Received: by 2002:a62:7796:: with SMTP id s144mr24141159pfc.26.1544014083017; Wed, 05 Dec 2018 04:48:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544014083; cv=none; d=google.com; s=arc-20160816; b=BUS0ABygJnF7kC2GgsC/j+a1tulilwBx1/WjjGG44CzlnbEbp/irr0jy7WUvittknK LHFbw/hM8k6iNIeF4SGtL/L/m4GYDgjykb7N7/trun0SQYrWI9F6pthrOaUUqBY0xsoK W/lkapwkiBcn6BHwEPYkox4FG+e4q1Nm/Rs1S8nC7RCoI/mEy+pPlq5sdW5EgLBsHu9Y 6y1UBKR39jyI7n/mvMQYKqLXPIMqO0+pl3pkjJTGIYQmqEIKuWJfScKgx3JL43yYxR2f VQ+znW0kjj7ST4ZrBgEXS55Rmj7FS2PwFyzWVX16sgWm0+S+/+tmmMXjbpkG3pBD+ul3 LO0Q== 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=7kaSioRZMdN3SegrcZ9FLbUcYPNWPye8wQmfXmSzf3g=; b=tvdFQZ8VMZLWRGvYGGp0Wet3BYuOu4lYLjaDiAPOmELvZQ0WrBpI6WpGCswyOXR09h F8jat9HmGeWJLdFLG8PJZ6yOU/663Z/0iRcurB3OHiOZxl5mNwcRzG+n0ZvRt/dYjj7k AfcaiXhYvixNUUvLgOObAfEFpXlQknmj2owYjIsZQvQKCxuroTCrJ2Sl40plTfSOiUfR Dlm7vNNxp1TUz04snpSThrgLWQAddYzpue/2ePugX/h5yWhCkVJsIicwaLuXY59CvUBg vRj0PbR92ai4IjnCIn9/aS68PQ2VB0ZYrvEa7RqBDCG6QOsvmaLwfDje0P3+OYFjQ95T Z0jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B7K27khP; 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 3si20107812plq.138.2018.12.05.04.48.02; Wed, 05 Dec 2018 04:48:03 -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=B7K27khP; 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 S1727980AbeLEMsA (ORCPT + 31 others); Wed, 5 Dec 2018 07:48:00 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:34068 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727936AbeLEMr4 (ORCPT ); Wed, 5 Dec 2018 07:47:56 -0500 Received: by mail-lf1-f67.google.com with SMTP id p6so14619947lfc.1 for ; Wed, 05 Dec 2018 04:47:55 -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=7kaSioRZMdN3SegrcZ9FLbUcYPNWPye8wQmfXmSzf3g=; b=B7K27khPwEWSmKMr04bv9k4h3qpmIbyBbsn16ZRdZtsUWsIvKWNLq85f4OgSdCPa7K n5MF/4HYh+d9uY6MykHFLPGoL00CDbtGig+TNkPL7+vDiI8RDG4G8w/9sHfWhe1hrhI2 PWtZbdR4U6gz9aJHxJ9/IORImw1dYcXrJipCw= 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=7kaSioRZMdN3SegrcZ9FLbUcYPNWPye8wQmfXmSzf3g=; b=UVx3YJzcXqiyAAKiBspexun57yLNIgbE0IqvVNLvHLenGBNDyd0/QPBNNDJuTgH2oF kb7g5d8vu6Ns7mFJOOliNo1p9VMtiqyCYgapSKHEVoUIKaPcZY4dgmINECAyzg2kBxC9 +gLOLhfQd0Y2/t6cB9BCV4snqY1T/QlfE2RRVb5JQU4TqVi2G/NspkPxP8V6tSSPwade jKqXm6sUSwo/AWSG2MyMFHj4J8efhHv8XtjVojSl+w0+aE4hB8g5yiKEKiKdqDGzNkgF Ssy/TyJgMJ8tiqjd1kJFejL+VP6ERo6TQAwiwraO8CMirzwoZJVq293nxJ+sUzpPF+dt P3yw== X-Gm-Message-State: AA+aEWaVnmgjgs/vr+qQf7nNCXqQp4Keujj0+yrkXhdauZhsL/NG5cui W5j/6oGv7z4HjBJOLMsWau0a/A== X-Received: by 2002:a19:2906:: with SMTP id p6mr13910692lfp.17.1544014074729; Wed, 05 Dec 2018 04:47:54 -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.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Dec 2018 04:47:53 -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 12/15 v3] regulator: da9211: Hand over GPIO to regulator core Date: Wed, 5 Dec 2018 13:47:18 +0100 Message-Id: <20181205124721.26624-13-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 DA9211 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/da9211-regulator.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.19.2 diff --git a/drivers/regulator/da9211-regulator.c b/drivers/regulator/da9211-regulator.c index 8f68c7a05d27..109ee12d4362 100644 --- a/drivers/regulator/da9211-regulator.c +++ b/drivers/regulator/da9211-regulator.c @@ -389,6 +389,12 @@ static int da9211_regulator_init(struct da9211 *chip) else config.ena_gpiod = NULL; + /* + * Hand the GPIO descriptor management over to the regulator + * core, remove it from GPIO devres management. + */ + if (config.ena_gpiod) + devm_gpiod_unhinge(chip->dev, config.ena_gpiod); chip->rdev[i] = devm_regulator_register(chip->dev, &da9211_regulators[i], &config); if (IS_ERR(chip->rdev[i])) {