Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp904276imm; Thu, 5 Jul 2018 10:57:55 -0700 (PDT) X-Google-Smtp-Source: AAOMgpchsBWs5FYrTuEB53acqg57PkOyQ1c51vJz5d+K8MZ64cKttoivCUA1og8iyT+6kXKQAD+x X-Received: by 2002:a62:2541:: with SMTP id l62-v6mr7511151pfl.0.1530813475422; Thu, 05 Jul 2018 10:57:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530813475; cv=none; d=google.com; s=arc-20160816; b=fSlmO/EHAKF2iuszzO0yS6to4A9KsKtmyopmTRb81zvL8PyAbsvOlcqRK3k3+o/Yws LJpYrHSvV6nSOMaPZcnWtCav/aCirjsdo9lPIGeSnSPQFqH86M9YtTjJaWZbCpsyum02 wEEPC3yJZLEU+85QqO+LOW0E8oYddUdzd9FPiG2X82L6TGvO06rV2gl3rplKafGbFFc/ jOeq2qjOf4bG5uSBhMPMPWpzVLPLqgG+lxooijmv2tEgGhd206CXhoIDb+JZeQwRVVQx IciS6h4gX/qpDAP/YVdR0VZrIQfde3EeM4fBDLdIaUOyQgoJP/+x5I+6vtS1M2Ja0BiV XaeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=w5i05gaKMVlSO2cIhgBdZFBMsDIzICkQf5lKEv3ZUNg=; b=RshPY1dGMA9vUEFFLu/MmFxi+EQeQ2nmeRbEska7DNe26PNmuXXJUOQwa/cPqkk4dd lM3WTPh2Dkn9JiUnZrO+4ny0HplTl/f1F+B9n+/pUouccgAXniZV8KXxtWgo5FVllTTE yV+XSaseT9hXRBmWV6awPR3NqwSBTsSA+0x5h9pCYWgNm9/6SwSh4O4+po9bugp0ANHb n0rKFknHvZ0YaR+5iyyrbru8Kx3dKRMCzQBsRlqrg5qSIjl8drJqDIWy/VBU7CKVdqQE f+XIm6ojKgHpCeZEOtX8APe0MnJjlnp+3KMBUl8cZfIYaC/F2o2+Ns/HK/x2Ot114fKn Pkrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=UOusofXS; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g33-v6si6460858plb.297.2018.07.05.10.57.41; Thu, 05 Jul 2018 10:57:55 -0700 (PDT) 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=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=UOusofXS; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753735AbeGER4a (ORCPT + 99 others); Thu, 5 Jul 2018 13:56:30 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:55852 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753447AbeGERzm (ORCPT ); Thu, 5 Jul 2018 13:55:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=w5i05gaKMVlSO2cIhgBdZFBMsDIzICkQf5lKEv3ZUNg=; b=UOusofXSJoS5 NoaLpeMUKeVc9L5H8d1rKu4vNKfAvwj5oaMfMFSE7901IpMvFmQgvMHvsuU3Z/1SdfxEIkVKUqy8v J+NIxhEKQmk9gF+iVLl9iFhavSCExbn+vyt4VO43JhxFJvcdKIHPC96yL7+Aqq8FUEEJZnRT4yhKV L//0I=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1fb8Tj-00012D-8f; Thu, 05 Jul 2018 17:55:39 +0000 Received: from broonie by debutante with local (Exim 4.91) (envelope-from ) id 1fb8Ti-00026e-NU; Thu, 05 Jul 2018 18:55:38 +0100 From: Mark Brown To: pascal paillet Cc: Mark Brown , "gregkh@linuxfoundation.org" , "lgirdwood@gmail.com" , "broonie@kernel.org" , "linux-kernel@vger.kernel.org" , "benjamin.gaignard@linaro.org" , Pascal PAILLET-LME , linux-kernel@vger.kernel.org Subject: Applied "regulator: core: Link consumer with regulator driver" to the regulator tree In-Reply-To: <1530800748-7300-3-git-send-email-p.paillet@st.com> Message-Id: Date: Thu, 05 Jul 2018 18:55:38 +0100 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch regulator: core: Link consumer with regulator driver has been applied to the regulator tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From ed1ae2dd9f242c7a36e8e39100f6a7f6bcdfdd89 Mon Sep 17 00:00:00 2001 From: pascal paillet Date: Thu, 5 Jul 2018 14:25:56 +0000 Subject: [PATCH] regulator: core: Link consumer with regulator driver Add a device link between the consumer and the driver so that the consumer is not suspended before the driver. The goal is to avoid implementing suspend_late ops in regulator drivers. Signed-off-by: pascal paillet Signed-off-by: Mark Brown --- drivers/regulator/core.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index da9b0fed8330..bb1324f93143 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1740,6 +1740,8 @@ struct regulator *_regulator_get(struct device *dev, const char *id, rdev->use_count = 0; } + device_link_add(dev, &rdev->dev, DL_FLAG_STATELESS); + return regulator; } @@ -1829,9 +1831,21 @@ static void _regulator_put(struct regulator *regulator) debugfs_remove_recursive(regulator->debugfs); - /* remove any sysfs entries */ - if (regulator->dev) + if (regulator->dev) { + int count = 0; + struct regulator *r; + + list_for_each_entry(r, &rdev->consumer_list, list) + if (r->dev == regulator->dev) + count++; + + if (count == 1) + device_link_remove(regulator->dev, &rdev->dev); + + /* remove any sysfs entries */ sysfs_remove_link(&rdev->dev.kobj, regulator->supply_name); + } + regulator_lock(rdev); list_del(®ulator->list); -- 2.18.0.rc2