From patchwork Fri Jan 12 10:18:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 124267 Delivered-To: patch@linaro.org Received: by 10.80.140.226 with SMTP id r31csp1694072edr; Fri, 12 Jan 2018 02:19:10 -0800 (PST) X-Google-Smtp-Source: ACJfBotwZDs3SxH+7i4tqZ3cQksAqeXXYnpTMOBrAN8lrQ+30CN/vggFN320WFABUJOqps8Pcu+o X-Received: by 10.84.150.130 with SMTP id h2mr25207107plh.116.1515752350142; Fri, 12 Jan 2018 02:19:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515752350; cv=none; d=google.com; s=arc-20160816; b=fjkGXrEQ3HTHpmaVMGkhIvKwuTlL0wfKvaQSRNo89JTo40DyeCW6lQn2vQVwI1oyLG kCAcuupzJB1H6cWrV5Raxj2gfZOsXqdUorY8GoebwZ0Cb7t2+PylFzZoKPCpcj4pOJ7+ RmaQFHz+6PhtJiMqPOOBu8PPNsoDiGqJ6ch8qSVYLKxfUC8/bCfHkAsQJ3Ig630wqNXW obK56YjGGyCBecSxL6E3Z5picI+KX3c0ulcKiFxogl8gv1yvmGbjIE5/7j/fZa35pJ9G odBhg1mQKNQgNLopP6mHJHPL5tRjwlIt1uqplXOfPqss/TljrxW5sTra6st9i/XorpGh YDXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=X6L1uBKnd2nmWo6NCCsYWIOQXZkzfLCnhgSRlvduXic=; b=hcuULWof8rx9eUzYFvqosqR/2RedL77c8l8JTem4Ilwojt80cc/Y4UMxJwf7RYdXuq WrqoXV5+t25ahECXEn4WYfsNGEv3x84GzWQusUBr8O4su+syk26srrmvPmB6LWxPyiui u3tQFgDfba2hYqgI2rpKq0lEq5/rYGKjffSYdVEu9558SB96hR1Fy8tiNMTn9PzIvp19 Hn4fxCHkCfbxussEHOMqan/Fu/KNwPVNBfG3fb9fhmtL6cDog8v3gvKL4w9RGpgUaPjk GZRzMnKxERZdvSr/PP+ckA30sZ4kIBf+M+HYzcISQe9YO6k0lmrM3sD5/yFm7x6oYEg2 ZsQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=XjybpFK/; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (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 b35si15501079plh.55.2018.01.12.02.19.09; Fri, 12 Jan 2018 02:19:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=XjybpFK/; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933122AbeALKTI (ORCPT + 6 others); Fri, 12 Jan 2018 05:19:08 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:44263 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933096AbeALKTG (ORCPT ); Fri, 12 Jan 2018 05:19:06 -0500 Received: by mail-pf0-f193.google.com with SMTP id m26so4084969pfj.11 for ; Fri, 12 Jan 2018 02:19:05 -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; bh=PgJpBAWoL6UfAEBRKx+NUQscAn0hvzT2js/EGzJp15w=; b=XjybpFK/F8eDcxOHM+u5TVyqMFbPNX22fA9ZRVh+0fPrfAe4AI4X8xSG/9Hrbqxkck LxJoo2dONS+ZBfahPw6+7nDC/KPXO1J8msQVvgX0Cer2Cp0qIGHaLZO/ttACCl8Qj/df LoQFld+ZATmP9HE9cJylu9siVib6XDj0WgUMs= 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; bh=PgJpBAWoL6UfAEBRKx+NUQscAn0hvzT2js/EGzJp15w=; b=MsMKjWpLqlK1LFmhe8W5rfTQ3b57gUX8CeVOwFaIdQmqYo+F7qw1g9j9tq6xjpP9Fj IHYY8bkAJIbe+tuqGoIkL8yaavqq4EHAbXWaNznE9UZzBmjCiqfXbx4wNL6R4MRGg75T vjn7MmQeQcqy8biyxMtyffOQfLTx8PlwDdN+Vw1NebnTBWb/IerR3OZmM273AaGqnbtB QPz60YJR6jcslRY7D0LxD/EtXU37F+CnCSVR2h5dIaGDgCwNjRnuNPOA+4Jp9fjq+bLl BKJhXHBwOOMpIlqJsEIqyl84iefeM2pwF9QSkID+ZI1SwJpqyNiyEy5QCqf0JRN2MsPI w9eg== X-Gm-Message-State: AKwxytfWr3C8DIqsVGbFTNw55clXpu14fpB4ykug08J1HmH0ymzFsmFp PIGlL7/y8eheZwFDpZU48ykcgw== X-Received: by 10.101.90.10 with SMTP id y10mr10304136pgs.445.1515752345435; Fri, 12 Jan 2018 02:19:05 -0800 (PST) Received: from ubt.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id m22sm44692613pfg.120.2018.01.12.02.19.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Jan 2018 02:19:04 -0800 (PST) From: Chunyan Zhang To: Mark Brown , Rob Herring Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Ulf Hansson , Arnd Bergmann , Chunyan Zhang Subject: [PATCH v3 4/5] drivers: regulator: empty the old suspend functions Date: Fri, 12 Jan 2018 18:18:24 +0800 Message-Id: <1515752305-15907-5-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515752305-15907-1-git-send-email-zhang.chunyan@linaro.org> References: <1515752305-15907-1-git-send-email-zhang.chunyan@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Regualtor suspend/resume functions should only be called by PM suspend core via registering dev_pm_ops, and regulator devices should implement the callback functions. Thus, any regulator consumer shouldn't call the regulator suspend/resume functions directly. In order to avoid compile errors, two empty functions with the same name still be left for the time being. Signed-off-by: Chunyan Zhang --- drivers/regulator/core.c | 74 --------------------------------------- include/linux/regulator/machine.h | 5 ++- 2 files changed, 2 insertions(+), 77 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 5ea80e9..080c233 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -4179,80 +4179,6 @@ void regulator_unregister(struct regulator_dev *rdev) } EXPORT_SYMBOL_GPL(regulator_unregister); -static int _regulator_suspend_prepare(struct device *dev, void *data) -{ - struct regulator_dev *rdev = dev_to_rdev(dev); - const suspend_state_t *state = data; - int ret; - - mutex_lock(&rdev->mutex); - ret = suspend_prepare(rdev, *state); - mutex_unlock(&rdev->mutex); - - return ret; -} - -/** - * regulator_suspend_prepare - prepare regulators for system wide suspend - * @state: system suspend state - * - * Configure each regulator with it's suspend operating parameters for state. - * This will usually be called by machine suspend code prior to supending. - */ -int regulator_suspend_prepare(suspend_state_t state) -{ - /* ON is handled by regulator active state */ - if (state == PM_SUSPEND_ON) - return -EINVAL; - - return class_for_each_device(®ulator_class, NULL, &state, - _regulator_suspend_prepare); -} -EXPORT_SYMBOL_GPL(regulator_suspend_prepare); - -static int _regulator_suspend_finish(struct device *dev, void *data) -{ - struct regulator_dev *rdev = dev_to_rdev(dev); - int ret; - - mutex_lock(&rdev->mutex); - if (rdev->use_count > 0 || rdev->constraints->always_on) { - if (!_regulator_is_enabled(rdev)) { - ret = _regulator_do_enable(rdev); - if (ret) - dev_err(dev, - "Failed to resume regulator %d\n", - ret); - } - } else { - if (!have_full_constraints()) - goto unlock; - if (!_regulator_is_enabled(rdev)) - goto unlock; - - ret = _regulator_do_disable(rdev); - if (ret) - dev_err(dev, "Failed to suspend regulator %d\n", ret); - } -unlock: - mutex_unlock(&rdev->mutex); - - /* Keep processing regulators in spite of any errors */ - return 0; -} - -/** - * regulator_suspend_finish - resume regulators from system wide suspend - * - * Turn on regulators that might be turned off by regulator_suspend_prepare - * and that should be turned on according to the regulators properties. - */ -int regulator_suspend_finish(void) -{ - return class_for_each_device(®ulator_class, NULL, NULL, - _regulator_suspend_finish); -} -EXPORT_SYMBOL_GPL(regulator_suspend_finish); /** * regulator_has_full_constraints - the system has fully specified constraints diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h index ce89c55..c4a56df 100644 --- a/include/linux/regulator/machine.h +++ b/include/linux/regulator/machine.h @@ -236,12 +236,12 @@ struct regulator_init_data { #ifdef CONFIG_REGULATOR void regulator_has_full_constraints(void); -int regulator_suspend_prepare(suspend_state_t state); -int regulator_suspend_finish(void); #else static inline void regulator_has_full_constraints(void) { } +#endif + static inline int regulator_suspend_prepare(suspend_state_t state) { return 0; @@ -250,6 +250,5 @@ static inline int regulator_suspend_finish(void) { return 0; } -#endif #endif