All of lore.kernel.org
 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 5/5] regulator: core: Remove unused regulator_set_suspend_voltage
Date: Sat, 26 Apr 2025 18:51:43 +0100	[thread overview]
Message-ID: <20250426175143.128086-6-linux@treblig.org> (raw)
In-Reply-To: <20250426175143.128086-1-linux@treblig.org>

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

regulator_set_suspend_voltage() was added as part of 2018's
commit f7efad10b5c4 ("regulator: add PM suspend and resume hooks")
but is unused.

Remove it, and the helpers it's the only user of.

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

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 90449f387b98..a0d740a565a6 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -446,12 +446,6 @@ int regulator_check_voltage(struct regulator_dev *rdev,
 	return 0;
 }
 
-/* return 0 if the state is valid */
-static int regulator_check_states(suspend_state_t state)
-{
-	return (state > PM_SUSPEND_MAX || state == PM_SUSPEND_TO_IDLE);
-}
-
 /* Make sure we select a voltage that suits the needs of all
  * regulator consumers
  */
@@ -4244,46 +4238,6 @@ int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
 }
 EXPORT_SYMBOL_GPL(regulator_set_voltage);
 
-static int _regulator_set_suspend_voltage(struct regulator *regulator,
-					  int min_uV, int max_uV,
-					  suspend_state_t state)
-{
-	struct regulator_dev *rdev = regulator->rdev;
-	struct regulator_state *rstate;
-
-	rstate = regulator_get_suspend_state(rdev, state);
-	if (rstate == NULL)
-		return -EINVAL;
-
-	if (rstate->min_uV == rstate->max_uV) {
-		rdev_err(rdev, "The suspend voltage can't be changed!\n");
-		return -EPERM;
-	}
-
-	return regulator_set_voltage_unlocked(regulator, min_uV, max_uV, state);
-}
-
-int regulator_set_suspend_voltage(struct regulator *regulator, int min_uV,
-				  int max_uV, suspend_state_t state)
-{
-	struct ww_acquire_ctx ww_ctx;
-	int ret;
-
-	/* PM_SUSPEND_ON is handled by regulator_set_voltage() */
-	if (regulator_check_states(state) || state == PM_SUSPEND_ON)
-		return -EINVAL;
-
-	regulator_lock_dependent(regulator->rdev, &ww_ctx);
-
-	ret = _regulator_set_suspend_voltage(regulator, min_uV,
-					     max_uV, state);
-
-	regulator_unlock_dependent(regulator->rdev, &ww_ctx);
-
-	return ret;
-}
-EXPORT_SYMBOL_GPL(regulator_set_suspend_voltage);
-
 /**
  * regulator_set_voltage_time - get raise/fall time
  * @regulator: regulator source
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index a5479de53906..3383a6de58d1 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -257,10 +257,6 @@ int regulator_unregister_notifier(struct regulator *regulator,
 void devm_regulator_unregister_notifier(struct regulator *regulator,
 					struct notifier_block *nb);
 
-/* regulator suspend */
-int regulator_set_suspend_voltage(struct regulator *regulator, int min_uV,
-				  int max_uV, suspend_state_t state);
-
 /* driver data - core doesn't touch */
 void *regulator_get_drvdata(struct regulator *regulator);
 
@@ -604,13 +600,6 @@ static inline int devm_regulator_unregister_notifier(struct regulator *regulator
 	return 0;
 }
 
-static inline int regulator_set_suspend_voltage(struct regulator *regulator,
-						int min_uV, int max_uV,
-						suspend_state_t state)
-{
-	return -EINVAL;
-}
-
 static inline void *regulator_get_drvdata(struct regulator *regulator)
 {
 	return NULL;
-- 
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 ` [PATCH 4/5] regulator: core: Remove unused regulator_suspend_(disable|enable) linux
2025-04-26 17:51 ` linux [this message]
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-6-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.