From patchwork Thu Dec 21 06:25:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 122511 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp485795qgn; Wed, 20 Dec 2017 22:26:29 -0800 (PST) X-Google-Smtp-Source: ACJfBou0nElrNh0+PKLKRwQd8XIm7eECH85Zfsrw28ZcRujgE1wu8oodQCTV5QOGS3hE4E3scEyH X-Received: by 10.84.233.72 with SMTP id k8mr9296669plt.420.1513837589096; Wed, 20 Dec 2017 22:26:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513837589; cv=none; d=google.com; s=arc-20160816; b=dLFtRzTw3iJIXRD+OD75zb8Gqky4OUJ8zGkcMGlmfATX3xOcmLJjbBKKBUJ7HPRGso bXDtyX+Xsr0Hez3EWsQZy0j9ZHGSTYmOz+ZrywMBSm8tQXvdnqybEYluPvtR1UTk6c53 t7sF0ts0MTCfZ4CzzSk7g332orlX0zEEHPWGWWgyqzutjmBtRWmRLanALl7WCnNvNz2S k33bTQVTJjqfN2SyaYAVedtNQwQb3q78SKJ+5yox3oCM77UloR4/OqUkx72xoY1lSzx7 pzC5zxi+SBatJsRguCDgLcL0PAUGMnLeX9dn0+oPr0lF2+Bt7sBJuoZSqx7pF2aOBRgO Tj3w== 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=lYsYhI3Z/pRWMn6HIFpDfVEtWIA+2IFgvZw8KvlZzeA=; b=Q+I3yv84NilhbEO5mupANyZ4VjeLxZLpJNHR310cS8tWMTOjXvmy1Hd2xi+JdWTK7C 5Hr1BWCZRrhb+xYuv37NjjjVThXquOLYZPR5bj0thyuOv3BJE1JycVD53ELvOHhNvzGp MlIsC3uqzi9lj0xE//So3PJD0BFr5QG1FZmzK+LKE2dgcpwhfRBSM7thbsmr8LdNYAm2 MY0gnuRqKsAxeWZbLtwt+6LkBBSprCss1dw8oa+SBL3k+fVgVBZqIvOk98eMKLDTAM7f WGjnLF3i6lVdGyI0fxx7qK3Qd9JHaJOLMkMvtggEC/Fp0AW2tOavSL5HqQfDDcY0bKJI R9Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Z9blwrdO; 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 o1si14065420plk.131.2017.12.20.22.26.28; Wed, 20 Dec 2017 22:26:29 -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=Z9blwrdO; 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 S932569AbdLUG01 (ORCPT + 6 others); Thu, 21 Dec 2017 01:26:27 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:42491 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752146AbdLUGZp (ORCPT ); Thu, 21 Dec 2017 01:25:45 -0500 Received: by mail-pf0-f193.google.com with SMTP id d23so13590558pfe.9 for ; Wed, 20 Dec 2017 22:25:45 -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=nHRvBhsC1LnmuY+PtNiblL3WT5zYTHI7fmJowkn1glI=; b=Z9blwrdOeh1aY3DHYz88wg/8ETo/DmW7vOphilPcQz+/uw9Ym2VwhKwJJsLGs0qJDz eixMXz3T7Ye12EuH83FMcgIhTDOmYn95wFHf0t7AN0ZbA/NFjaI3+qWibqzCMNWRtEPX Wm3eVJpKrb2Ozzu+GbA9GQWEH1BvDFVE9SW6k= 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=nHRvBhsC1LnmuY+PtNiblL3WT5zYTHI7fmJowkn1glI=; b=KXsBgFUepqBARMzxu+spZl7MhsZSd4GD+WDWwBDCDrnMPVbh3gSbT0A2D1dT8Xd+PD ZToqla4Y1qnch2by22P2qrZezV1R1/yS1W/0bSytIX+f/4mK/fSzlPFJD8s+K427HURf M9VzMYywUnMWuRdL2yjuTHGQoL7R+GkttDbMYvW/1jjyUqyR51S855GOyEKJS0Ftws7g i6DQqCcgrJhh2DYinDElBT1nbGostXKqWLUo/bnun8nfjd8jCqSPVR49F46xwMwDXGmo ewe03jOU5t5RRq+Mjl7wjiUwUmx6CdtndBm56KEK0FCwVp88OOHl7woVvj3cHu3VmZrZ j/hg== X-Gm-Message-State: AKGB3mJx0CC47Q9775nL0GJo+PFUfWJBae+EM103w+jON8Ik/zULbjqh ttmbhjTsdoalzMPW+Q2qlPa6Fg== X-Received: by 10.98.0.19 with SMTP id 19mr9387422pfa.136.1513837545345; Wed, 20 Dec 2017 22:25:45 -0800 (PST) Received: from ubt.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id o88sm36970683pfj.175.2017.12.20.22.25.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Dec 2017 22:25:44 -0800 (PST) From: Chunyan Zhang To: Mark Brown , Rob Herring Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Chunyan Zhang Subject: [PATCH 4/5] drivers: regulator: empty the old suspend functions Date: Thu, 21 Dec 2017 14:25:05 +0800 Message-Id: <1513837506-26543-5-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513837506-26543-1-git-send-email-zhang.chunyan@linaro.org> References: <1513837506-26543-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 e50519f..b4ddb56 100644 --- a/include/linux/regulator/machine.h +++ b/include/linux/regulator/machine.h @@ -231,12 +231,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; @@ -245,6 +245,5 @@ static inline int regulator_suspend_finish(void) { return 0; } -#endif #endif