Received: by 10.223.176.46 with SMTP id f43csp4078912wra; Tue, 23 Jan 2018 04:02:04 -0800 (PST) X-Google-Smtp-Source: AH8x227v5XR8/w9wq10RyTrYSlQWwXgeI4cNTBOmXdQ4kt4rzg/YpjVeuprZF06q6Vl4cwpdSDcd X-Received: by 2002:a17:902:b212:: with SMTP id t18-v6mr5141145plr.293.1516708924751; Tue, 23 Jan 2018 04:02:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516708924; cv=none; d=google.com; s=arc-20160816; b=Jq6Bdr5VQQikimpQBJi7Xe0b0BvslizR0vMTso29627j5bosUp0B2OXdSK8kLlaHQF 9AG14wGVSIxEoTztrveXIL3IuO+ZpmfBDg0iIAKpYxugXISm7mptfgZF2ZDkDtBLkoGq zFO+wkEvo2CuQ0+xdr+bDMlbBGKUKcO4xm5Z8Mv1OxO6kUVdOiA5Dm3Drnq8NfvJezhM CEI62KZu5NY74SWGCO+heWM+re7bbFVXZoXrUvCmJdun5AA2dnBn+UGtijHkiM4JHf9X rNTDKHOIi/Or5BxXFKSap7Nt+7ZL4S3hoiYgE0ER4g2oLCOIDQ1vspRx8yCapVuKd33t RHIw== 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=PgJpBAWoL6UfAEBRKx+NUQscAn0hvzT2js/EGzJp15w=; b=yl1t0CArcldjanky427luFiUZA7tzSGql+ZMlNO6Pt+9K6LdmRBz7i75mJo4knVhVx ottV8D6oM5RPYME77JMGwvZAtIBhHATvpYcMi1jidMyRIwxlrll5BsaZXvv/HkYl8GwP dYXB+lhwRtt83dyWb/VKJ3dcLBhMdz9ID2STnU3bkmZ+/k3cFQHdXoJw2QuhNvbG/Vf1 t+nFLSlhJJbgpoXHY/0k4XqvshlmdkofwIZETswA6ITima4Q8GhrdSm0f7VdH2nlryOr vdopoBMbTgIdfysvKxydZ1mkRlTKlHjInhrfJ0fC7sIiomGukKWTTH73vQ282wZJ6/GI jmVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hPuB5XBx; 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 n9-v6si4595045pls.744.2018.01.23.04.01.50; Tue, 23 Jan 2018 04:02:04 -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=hPuB5XBx; 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 S1751429AbeAWMBB (ORCPT + 99 others); Tue, 23 Jan 2018 07:01:01 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:34143 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751381AbeAWMA4 (ORCPT ); Tue, 23 Jan 2018 07:00:56 -0500 Received: by mail-pg0-f66.google.com with SMTP id r19so136278pgn.1 for ; Tue, 23 Jan 2018 04:00:56 -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=hPuB5XBxhv+tsegvEHW8c2zxSxLZrM4to0IY4SCB3Lw/1nGj9JPl2/ocUEXTN0u5Rr RNr4WpZQEJ+9z3tPXFU1gkF5K8S13u12YGeiIGlg22tbx5RE8U7/B3dR2vM9pY9EeASa yb0FpYfdhZvsmu1SNHVa3hVp3MCBI4dXOByhw= 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=OapuD27KPeclrrfbctb5AZXhfcbgsSu+jTk9NUwTSJDmYXj4OVWQ72Q2UbbCJwHSXo aT7mjqrYopWY/BbFEFtp3z91OAdyMLzkdDQGjV9Oq9abTaepuFkvdEJDtse0D1bEjHSQ o4KLw79E0uiiTRG+LmbJyRwuKMqcrojusxTh3KGB//SoirmuFIFxG18t9oHIWHVh8ZcW oum/HGp2n65ABtnSTKlEbz0VHaPt2tdf94XtjcDc8Ypl2QprSrCfvZjDnJ8cbjua8VTT DZyCTdgf48nUigrKpiKO8cR58sMDA8ABN9Wb0BZDftcVYtB72K35KhmoQkS63++X8HEB 6kBQ== X-Gm-Message-State: AKwxytfDv5jeHO1lFOQMhTZQvCIL1STvE3RhvCgSACJLPgYlgvUfmXdi Y+dkR+X/p7EBAsZoV/V1GajvrA== X-Received: by 10.101.80.204 with SMTP id s12mr8828833pgp.185.1516708856357; Tue, 23 Jan 2018 04:00:56 -0800 (PST) Received: from ubt.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id p75sm5853049pfi.148.2018.01.23.04.00.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Jan 2018 04:00:55 -0800 (PST) From: Chunyan Zhang To: Mark Brown , Rob Herring Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Chunyan Zhang Subject: [PATCH V4 4/5] drivers: regulator: empty the old suspend functions Date: Tue, 23 Jan 2018 19:59:42 +0800 Message-Id: <1516708783-6288-4-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516708783-6288-1-git-send-email-zhang.chunyan@linaro.org> References: <1516708783-6288-1-git-send-email-zhang.chunyan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) 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 -- 2.7.4