From patchwork Thu Dec 6 12:43:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 153022 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp10479804ljp; Thu, 6 Dec 2018 04:44:56 -0800 (PST) X-Google-Smtp-Source: AFSGD/UD03kH1HgJHAyY9Nn+n/oHnn+v3spAlHZ3GJwVwLTZj2G9UWApP4doFEMIeDfR7s5aLGvW X-Received: by 2002:a62:6503:: with SMTP id z3mr27641029pfb.169.1544100296633; Thu, 06 Dec 2018 04:44:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544100296; cv=none; d=google.com; s=arc-20160816; b=WDDKQ+RM1kYSiRUVLKZjSKjFPpKcHLB0qRUgFp0fahUW9ApaVerZ4VdyVruRchP+cA B8pBFGgwlXAa6xHEAbJNLH48nzsMxOCBY7kNYOQupFWFEIlWWrlJiWaAgOUY3/cpoBGI KECjeiFp9MXT0tPN6WKcgRBwG//FWvEz1H1i0p5NIkjjP0GwNtTpskQLWJ0FZbxZzHAQ 5lmy9LCiIf/uQuw/tGt9v3bRCLl1mfLL6z9jHZbJtHJVVLVzgNRvR6i0d+ZLrKlf5W1p LkYaE+LUQGzUNqsvrwQbYhqmFrFYbU5hFTWQSYqgDs+cyhrnCIOM7TlgMu6v6lGPMF89 Q0JA== 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=vyagLHp/sFfdrPUwP8QrUjF5aczl7hYJlH6LPWav89U=; b=khPZAXZcJNwBV2nkshSOwJUNQZm4UolXAI3yo8+XwIp5AsVhGAc+nx19QjuwBw0lBQ PI2oEk1lrAXxA9VomwG/7AiVQYyHYLOfqjvkACSHEyirnzoDeXpqW4e8IyFwEJ3CEQte T9EVvdwjHDtZEcqL3vB7j7+ZfjX+3qjyGcPMLPb+hiVxbf0+tRsv5rZUsP6ea4SYh5Kk d/f0n/d2AL/XnE3gOJswJ5RxcvSXIGAxxjBJakoOgdh6xvcI9yzTemCIkgJZUBf8+ccX 2DU/+RKjgsvZqxeyuJc4qSVuMxOwviKSQMBogfXTmOEjc8LSz/iUrDj6ng8bcPC8ngc/ wgIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ACbcqWTZ; 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 p64si240753pfg.79.2018.12.06.04.44.56; Thu, 06 Dec 2018 04:44:56 -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=ACbcqWTZ; 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 S1729843AbeLFMoz (ORCPT + 31 others); Thu, 6 Dec 2018 07:44:55 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:41162 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729738AbeLFMo1 (ORCPT ); Thu, 6 Dec 2018 07:44:27 -0500 Received: by mail-lf1-f65.google.com with SMTP id c16so231548lfj.8 for ; Thu, 06 Dec 2018 04:44:26 -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=vyagLHp/sFfdrPUwP8QrUjF5aczl7hYJlH6LPWav89U=; b=ACbcqWTZu4q1jZsuA2mpyfmQGyAZoHlMQQIMiFP7co3YT9RQXoeUfxzdeEZ33JThn1 p4NmIPn1kdMpUX68Qdxj6ZWsm/sbdMMDY44qUrU30Erz3WqktKdt/RXJvd2D95hWurjb t0PZwrZY24g32YAmjf/Ox/kHurhjEfz/zvp0Y= 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=vyagLHp/sFfdrPUwP8QrUjF5aczl7hYJlH6LPWav89U=; b=LYIqdPufLxzlLEpkvuWGcBjqegwSMF/tauDHGCyEX2qvG0E9erqIemYEVmPAPdmeCj 9kra3DuwdplFt9DvRnqduE8DwvpxnbJ1d9tsiPLDkFtdq3Tu5XsZMrFtAnrJEdPJBlia Ai7+R1RotOIzWHUA4CaFE2C04AiXd0HKY+OCCkZg0apQmpXgqiDNNNSbZrqGb1Z17ZT2 xyfFvdBpGeOwyUyqc9Rq0i6jIuzK19QmTEofQCGq+hCVeUWSjDsLqRw7eyRAOt76GcZT gu2zNmORo5CF2kCi7hhI9LBS+LX7/SB/ORukZMHIK2THZkyn89Z2LQ4MhNScPw/XN/hl 20qw== X-Gm-Message-State: AA+aEWZ/m3jCjZ8x5w9gGiLacGI6Pvk4YiSxFHpkGRScZfOKHQQ+45Jr PPVOgl3KdraYyj+jtDdOGvCkUQ== X-Received: by 2002:a19:c014:: with SMTP id q20mr15686432lff.16.1544100265323; Thu, 06 Dec 2018 04:44:25 -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.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Dec 2018 04:44:24 -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 v4] regulator: da9211: Hand over GPIO to regulator core Date: Thu, 6 Dec 2018 13:43:48 +0100 Message-Id: <20181206124351.10155-13-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 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 v3->v4: - Resending. 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])) {