From patchwork Fri Jan 26 13:08:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 125962 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp323974ljd; Fri, 26 Jan 2018 05:09:28 -0800 (PST) X-Google-Smtp-Source: AH8x226EXiiFxjA7Q8G7jTq7OafFCjK2NLIx4J3h+H+v6Aylg3kkEnX0ySPt5MLQlGEXVopkMcB2 X-Received: by 2002:a17:902:901:: with SMTP id 1-v6mr8326457plm.165.1516972168090; Fri, 26 Jan 2018 05:09:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516972168; cv=none; d=google.com; s=arc-20160816; b=H6ExNOofAM4F+jHTyC2eUrVEKLhgUb7kerhjbaBSFDgcijK+3QxY0MkaszD6tGD60X KEiPcjlynli7JFEHicogAn18LlzIG0UGDXuLzufC02d2qGQLHjqURtTyU0NPsS7ZwJ6u sZoOhH/8QRBkB9g6aaDA3mqQA+pwdnNVtwjXqsFBINdNyYwPB/FjWBM3LwZGznhjI5tO LFL6EWHKoG0+/R10T146oosgOTFdR9MHgQySVoPO1NNsc+BFtIChLlnLr79OOpYBFSao 0ZFDyOEkIakFruRREGyRmzxSr+TKMhOPJvkNRQ6+JBHVi/rVo5NHE1wQG210Yn/PJNIH OcIA== 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=cTh3bUYwIqpYwOxlDEVMhJ5u0EGdn/ktA+i0QZr9GYhXgVSJPvHMm9EN/P92bOoNUQ l5ilYejgEe3D6VmwutFZMuYPM3wpmsQHOi6KaLg5PEu36APNLDeMtrnHQ28qbt6DjJo9 hOot5EB4heccYMqt7hUqCDbwHiv6+xMyqtAyq/ou0WyCKtZzTN221YprJ9R4MrfwR3ul n5O+So2YZBjMCplOWWSzOc0C9DnB1nhWDzKSR3XpLpmsAwPDXmTsouQRa9a+skavc3U6 SX4qAYHzWOqGEYOU+cM4A+9bVq6nF/ag38cHUt2ilC1TUSLE+a09pYn/ksQFIhVU/IF7 /Hzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a8XhowLn; 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 q16-v6si2974572pls.74.2018.01.26.05.09.27; Fri, 26 Jan 2018 05:09:28 -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=a8XhowLn; 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 S1751789AbeAZNJZ (ORCPT + 28 others); Fri, 26 Jan 2018 08:09:25 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:33987 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751733AbeAZNJT (ORCPT ); Fri, 26 Jan 2018 08:09:19 -0500 Received: by mail-pf0-f194.google.com with SMTP id e76so235819pfk.1 for ; Fri, 26 Jan 2018 05:09:19 -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=a8XhowLnmhmePXQRvnJ1gF7cT/1zfPiYFFV1dPBzRlR/YqERNKKHNQA+VALHfZ21cC SIOe05EiGRnRNC128TcHoIs2r6mgPr3l5QXCeqd7dG4eYF3zOx07Fofd0GA+SpyjOHE4 DvTROzvVX0qCQkjbzLaK7L2s0Dccaq25YRymo= 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=BbJGFrZYVQHFFN4ZDTZrlIWf828rrDzv+Te1mBzJjR+7sVaEi3pxrkvGyMQruuJX7g CG1Cg4kgNkvOow6cCpnPW0r6Zp9yNmH4wMFwLV+irOsVQVly/f/c6IMM9Nc0Wbpkptxp vdglLrg9AYs/gA8QUyCRNFkCMvUHHoUXzi2+bKxQSstxu8CbNdeX5rClyZo0hZ0aJ3Rq UPNBYihKOuwVkGxqf3GUoc/Y3mo26L+mRwd4SKkEK3zOEkm3ZxHsTUncKQ+7eLM20o4f kZNyvxxcuaRvQ32pSxW+BtuphhKPzvfexpgAdbHLUP3qAgVnX3BWT+wA8kdojYROJ8ZE NObQ== X-Gm-Message-State: AKwxytdnUaSmmNXuWG8A+/UTcKjnCUpIzsBIoiamsNR+Jfg2TeWzqGSh R4Uy6WcR0xCMrwfx6fHQRpk70w== X-Received: by 10.98.228.5 with SMTP id r5mr19617920pfh.193.1516972159008; Fri, 26 Jan 2018 05:09:19 -0800 (PST) Received: from ubt.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id b6sm18663238pfe.85.2018.01.26.05.09.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 26 Jan 2018 05:09:18 -0800 (PST) From: Chunyan Zhang To: Mark Brown , Rob Herring Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Chunyan Zhang Subject: [PATCH V5 4/5] drivers: regulator: empty the old suspend functions Date: Fri, 26 Jan 2018 21:08:46 +0800 Message-Id: <1516972127-972-5-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516972127-972-1-git-send-email-zhang.chunyan@linaro.org> References: <1516972127-972-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 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