linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: linux@treblig.org
To: lgirdwood@gmail.com, broonie@kernel.org
Cc: linux-doc@vger.kernel.org, corbet@lwn.net,
	linux-kernel@vger.kernel.org,
	"Dr. David Alan Gilbert" <linux@treblig.org>
Subject: [PATCH 4/5] regulator: core: Remove unused regulator_suspend_(disable|enable)
Date: Sat, 26 Apr 2025 18:51:42 +0100	[thread overview]
Message-ID: <20250426175143.128086-5-linux@treblig.org> (raw)
In-Reply-To: <20250426175143.128086-1-linux@treblig.org>

From: "Dr. David Alan Gilbert" <linux@treblig.org>

regulator_suspend_disable() and regulator_suspend_enable() were added
by 2018's
commit f7efad10b5c4 ("regulator: add PM suspend and resume hooks")

but have remained unused.

Remove them and their helper function regulator_suspend_toggle().

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
 drivers/regulator/core.c           | 44 ------------------------------
 include/linux/regulator/consumer.h | 16 -----------
 2 files changed, 60 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 60c72d77f77a..90449f387b98 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -4244,50 +4244,6 @@ int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
 }
 EXPORT_SYMBOL_GPL(regulator_set_voltage);
 
-static inline int regulator_suspend_toggle(struct regulator_dev *rdev,
-					   suspend_state_t state, bool en)
-{
-	struct regulator_state *rstate;
-
-	rstate = regulator_get_suspend_state(rdev, state);
-	if (rstate == NULL)
-		return -EINVAL;
-
-	if (!rstate->changeable)
-		return -EPERM;
-
-	rstate->enabled = (en) ? ENABLE_IN_SUSPEND : DISABLE_IN_SUSPEND;
-
-	return 0;
-}
-
-int regulator_suspend_enable(struct regulator_dev *rdev,
-				    suspend_state_t state)
-{
-	return regulator_suspend_toggle(rdev, state, true);
-}
-EXPORT_SYMBOL_GPL(regulator_suspend_enable);
-
-int regulator_suspend_disable(struct regulator_dev *rdev,
-				     suspend_state_t state)
-{
-	struct regulator *regulator;
-	struct regulator_voltage *voltage;
-
-	/*
-	 * if any consumer wants this regulator device keeping on in
-	 * suspend states, don't set it as disabled.
-	 */
-	list_for_each_entry(regulator, &rdev->consumer_list, list) {
-		voltage = &regulator->voltage[state];
-		if (voltage->min_uV || voltage->max_uV)
-			return 0;
-	}
-
-	return regulator_suspend_toggle(rdev, state, false);
-}
-EXPORT_SYMBOL_GPL(regulator_suspend_disable);
-
 static int _regulator_set_suspend_voltage(struct regulator *regulator,
 					  int min_uV, int max_uV,
 					  suspend_state_t state)
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 0e9275079e17..a5479de53906 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -258,10 +258,6 @@ void devm_regulator_unregister_notifier(struct regulator *regulator,
 					struct notifier_block *nb);
 
 /* regulator suspend */
-int regulator_suspend_enable(struct regulator_dev *rdev,
-			     suspend_state_t state);
-int regulator_suspend_disable(struct regulator_dev *rdev,
-			      suspend_state_t state);
 int regulator_set_suspend_voltage(struct regulator *regulator, int min_uV,
 				  int max_uV, suspend_state_t state);
 
@@ -608,18 +604,6 @@ static inline int devm_regulator_unregister_notifier(struct regulator *regulator
 	return 0;
 }
 
-static inline int regulator_suspend_enable(struct regulator_dev *rdev,
-					   suspend_state_t state)
-{
-	return -EINVAL;
-}
-
-static inline int regulator_suspend_disable(struct regulator_dev *rdev,
-					    suspend_state_t state)
-{
-	return -EINVAL;
-}
-
 static inline int regulator_set_suspend_voltage(struct regulator *regulator,
 						int min_uV, int max_uV,
 						suspend_state_t state)
-- 
2.49.0


  parent reply	other threads:[~2025-04-26 17:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-26 17:51 [PATCH 0/5] Regulator deadcode cleanups linux
2025-04-26 17:51 ` [PATCH 1/5] regulator: devres: Remove unused devm_regulator_bulk_register_supply_alias linux
2025-04-26 17:51 ` [PATCH 2/5] regulator: core: Remove unused regulator_bulk_force_disable linux
2025-04-26 17:51 ` [PATCH 3/5] regulator: core: Remove unused regulator_*drvdata functions linux
2025-04-26 17:51 ` linux [this message]
2025-04-26 17:51 ` [PATCH 5/5] regulator: core: Remove unused regulator_set_suspend_voltage linux
2025-04-27 14:34 ` [PATCH 0/5] Regulator deadcode cleanups Mark Brown
2025-04-27 14:58   ` Dr. David Alan Gilbert
2025-04-30 23:18     ` Mark Brown
2025-05-01  0:03       ` Dr. David Alan Gilbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250426175143.128086-5-linux@treblig.org \
    --to=linux@treblig.org \
    --cc=broonie@kernel.org \
    --cc=corbet@lwn.net \
    --cc=lgirdwood@gmail.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).