Received: by 10.223.176.46 with SMTP id f43csp2055921wra; Thu, 25 Jan 2018 04:17:17 -0800 (PST) X-Google-Smtp-Source: AH8x227E73Pqht2GO184qDYxfRq8Rk7LVDJ1yjTe3OBsjPeoeqj2KbgGoDcBF5vgc6aWZu92qA8M X-Received: by 10.99.97.202 with SMTP id v193mr12673614pgb.84.1516882637255; Thu, 25 Jan 2018 04:17:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516882637; cv=none; d=google.com; s=arc-20160816; b=PabhZ/aJReqtqdbA60ezP08LCFVteTonDju7u8j4J5X2o0tofSDbyL8weq0cGgopjb 09+v5W7RQPcggSFD/D0Y7Jm4kKJIzXVyV0N3W9kUuuZaDFF4xnKlXXJ69UO5u9jTwy35 MzlV66UmEpWE5sgH8ZafAR0DHbnwATpscj8DDUWgcjzEGkOs9duXYvjlRwwjcxN8gkH3 toYaRelUwf/Y2DFI+m4ZGnpVeHw8GeXlybxktUt2q3EuLj1gJE5BAcb8Em6cHlHSd8Ll 9YE4O5Ate0hBumVUTIdOFu+rA5zsicL9OwSHOp+w9WTtYgAOGPP/f05VrSZLDKaXNbuI hW7g== 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=y9EXiVzHBhTR8IXNGF86Dzt91XjUsVXjTRVF8N1zJ5o=; b=AC7PwTtCbo9gJB3SdgFBME13PJ0Lm0ssIeszrCWGvi+TjZFUXlkMLmhq4N9NcM33N6 V1Ll0wvNLZk+H2gcWk0FqUhqgfFxCOQ5znUovuG9Bhmd3kL5A5LUn4lDoxP4E2fJPElZ /5ms8QItH7ezfh0mIvkw9mDFslSFNcrOMKpC1tryYVn3BCNaCZa0aTMLEK1YbmpQ+d92 Mkbm6CSlzc1FzSYNR7simFiiPKTsazafNFLlljH1aXYMlBGstVc9aDmAjqTsOOuO31bp BKJdq+CNHBwzw1vzHuPGdfvxPvmsXwjuiWnvOkITdHXzIrve0dOzam+3glJizUXNQlZk WQpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=iHVE1TlD; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v17si1495799pgn.551.2018.01.25.04.17.00; Thu, 25 Jan 2018 04:17:17 -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=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=iHVE1TlD; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752013AbeAYMPo (ORCPT + 99 others); Thu, 25 Jan 2018 07:15:44 -0500 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:40622 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751682AbeAYMPm (ORCPT ); Thu, 25 Jan 2018 07:15:42 -0500 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=y9EXiVzHBhTR8IXNGF86Dzt91XjUsVXjTRVF8N1zJ5o=; b=iHVE1TlDROcV j/KklkMkeJNPh1pdzoNE4GVNWQmNqSoM+GkxfwNAwMHXAVAMu8rfVfjJWXJdCV7D2zgvzWXzqWlV4 Z7sB8HVsGLFjAg3e51PImL3O8x7EzAI/qNSWtSfIbMH0CUSv9ggjoltsGIUHUPVew9eNmD6xhjHYx M+T0w=; 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 1eegRP-0005KZ-Q5; Thu, 25 Jan 2018 12:15:39 +0000 Received: from broonie by debutante with local (Exim 4.90) (envelope-from ) id 1eegRP-0006WK-B8; Thu, 25 Jan 2018 12:15:39 +0000 From: Mark Brown To: Chunyan Zhang Cc: Mark Brown , Mark Brown , Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Chunyan Zhang , linux-kernel@vger.kernel.org Subject: Applied "regulator: empty the old suspend functions" to the regulator tree In-Reply-To: <1513837506-26543-5-git-send-email-zhang.chunyan@linaro.org> Message-Id: Date: Thu, 25 Jan 2018 12:15:39 +0000 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch regulator: empty the old suspend functions 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 6103427372a81f7018525ca84c0647f36532a94e Mon Sep 17 00:00:00 2001 From: Chunyan Zhang Date: Tue, 23 Jan 2018 19:59:42 +0800 Subject: [PATCH] regulator: empty the old suspend functions 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 Signed-off-by: Mark Brown --- 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 5ea80e94eb69..080c2334edc5 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 e50519f13d4d..b4ddb56e7c19 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 -- 2.15.1