From patchwork Thu Jan 4 07:22:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 123394 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp11109100qgn; Wed, 3 Jan 2018 23:24:04 -0800 (PST) X-Google-Smtp-Source: ACJfBosHsP8pS496ZM3DJbLyPyoQI/KGz9j+67bI+A8vMDJMTANv8odCX4i5TWaIiqmTQfis+y/H X-Received: by 10.98.152.25 with SMTP id q25mr3890736pfd.58.1515050644008; Wed, 03 Jan 2018 23:24:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515050644; cv=none; d=google.com; s=arc-20160816; b=Xm8Bq4HDrZESXVvsox4EE+6HqFCAJ3x5EXdJxivFqVy0b2bKIvcZ7Xn8xjBQ8pPdct p/UzPr/HHT9pQQQHrfobX5hmAfKDIMv3yVOvP6VQpadDdjvZtFp2PCaikEqtE/K6Kcky 7kytyXklqhqoDkEQIkAlZPYexauTKqsPGqVNBTULy/XxFW0L1FShcVwgfSrBUtnRsIsp /CTwEIJaRDB00HBKOaFHoiawKcxibYbgPzOQ8k8IT/dE7uNB+rPw8b2+TDYsCh+ro/uS LWVTnZktk1432538+NgmTu+hRwIgZFlY/au150+k3NyUN15fkzkrSMnuqeYaOvwZJ+WV MkjA== 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=nHRvBhsC1LnmuY+PtNiblL3WT5zYTHI7fmJowkn1glI=; b=CDl6MK+ulRrKNUXOC3tH2FuLsYYty8YkqgG8hc8cKuBX1v/S59N0ZwAQqZkuCrb0ev fMzh4f+GTk7qfDszrwe20NnprCSkMivd2eXZY2kyq4+zd0sfbmU7XhhACPCge4Mhf9XP FFRiESo1ggjlv8oZjkc24mDtp7VHb/BOvOlInueLHVZssy+Q/y7sU04r0wtZXROAaCIn Dt37clfeHRrNs94DLSbCyHvn/+wVhAAV0Cw/gvlSIgPJ5V2j7ilVKWV/vCDIIvIYV1vY j4+fAmIsiksPkSVLf+UKyEDfBttBJPAGMfPwztrXWFwHGGeQF4YkW2QU0B4va3CYg4dF duoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OwMer/Fz; 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 l12si1906800plc.265.2018.01.03.23.24.03; Wed, 03 Jan 2018 23:24:03 -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=OwMer/Fz; 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 S1751995AbeADHX7 (ORCPT + 28 others); Thu, 4 Jan 2018 02:23:59 -0500 Received: from mail-pl0-f68.google.com ([209.85.160.68]:43795 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752195AbeADHXy (ORCPT ); Thu, 4 Jan 2018 02:23:54 -0500 Received: by mail-pl0-f68.google.com with SMTP id z5so594962plo.10 for ; Wed, 03 Jan 2018 23:23:54 -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=OwMer/FzkogrfRQ2DFmf4RgXRJhtKLmXz06qZ+F6yyUz++vAHrOxwKs5l6drYZp7GL Wuk/ouMYmpsjVlIeC6kHjPxj3wTT/xpCR6WAT3+FEo7fvhFijocstH9SsXBBBUPKbey6 wX6tQyTNCHysZDeLLUa/9vlxOFpvaT+cwBhss= 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=M09NhC5KAw+Xhhu/BBK1cR+lUC4BdJfkW9awQ2/nj8nrahYwg5PREmkZC8+6kCDmlt ZSULdoDdz+E+PJjC1D3V56b1JrcjX9zQ2/MgVfCSNa2deHa37/KzhfH3lDe+s8RHWiKl wjCsx0/AB6/dvmu/GVL/xlUVyO+zeq79fFCa/WbsBklZAdYx00B7Qmv2ylwWTsUncOjz XOTtVpmzX798daQvs+kGhwGerYtWx1C79VtvfRJP+rTOYlw6CD1vT89A1BxZoRaOu38k H0HIDxHPBhSQZdk0n4MQ54biuT3/qM0tpewNb3vqNdVXup/TY+/rcmnrovT/+BX1qqBg BcrA== X-Gm-Message-State: AKGB3mJ3d2Ics6WmXt34s97c14CG0MkMHGDTBYOaqKPOz2FpTklAGHsr ryoBR2386ZvRP8c2DmNpSFI3nw== X-Received: by 10.84.172.1 with SMTP id m1mr3839503plb.345.1515050633659; Wed, 03 Jan 2018 23:23:53 -0800 (PST) Received: from ubt.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id s14sm6244456pfa.158.2018.01.03.23.23.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 03 Jan 2018 23:23:52 -0800 (PST) From: Chunyan Zhang To: Mark Brown , Rob Herring Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Ulf Hansson , Chunyan Zhang Subject: [PATCH V2 4/5] drivers: regulator: empty the old suspend functions Date: Thu, 4 Jan 2018 15:22:47 +0800 Message-Id: <1515050568-23876-5-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515050568-23876-1-git-send-email-zhang.chunyan@linaro.org> References: <1515050568-23876-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(-) -- 2.7.4 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