* [PATCH 0/5] Regulator deadcode cleanups
@ 2025-04-26 17:51 linux
2025-04-26 17:51 ` [PATCH 1/5] regulator: devres: Remove unused devm_regulator_bulk_register_supply_alias linux
` (5 more replies)
0 siblings, 6 replies; 10+ messages in thread
From: linux @ 2025-04-26 17:51 UTC (permalink / raw)
To: lgirdwood, broonie
Cc: linux-doc, corbet, linux-kernel, Dr. David Alan Gilbert
From: "Dr. David Alan Gilbert" <linux@treblig.org>
Hi,
This is a bunch of deadcode cleanups for functions
that are unused (for quite some time).
The first patch was originally sent in October last
year but didn't get any traction; the rest are new.
Dave
Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Dr. David Alan Gilbert (5):
regulator: devres: Remove unused
devm_regulator_bulk_register_supply_alias
regulator: core: Remove unused regulator_bulk_force_disable
regulator: core: Remove unused regulator_*drvdata functions
regulator: core: Remove unused regulator_suspend_(disable|enable)
regulator: core: Remove unused regulator_set_suspend_voltage
.../driver-api/driver-model/devres.rst | 1 -
drivers/regulator/core.c | 141 ------------------
drivers/regulator/devres.c | 74 ---------
include/linux/regulator/consumer.h | 47 ------
include/linux/regulator/driver.h | 1 -
5 files changed, 264 deletions(-)
--
2.49.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/5] regulator: devres: Remove unused devm_regulator_bulk_register_supply_alias
2025-04-26 17:51 [PATCH 0/5] Regulator deadcode cleanups linux
@ 2025-04-26 17:51 ` linux
2025-04-26 17:51 ` [PATCH 2/5] regulator: core: Remove unused regulator_bulk_force_disable linux
` (4 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: linux @ 2025-04-26 17:51 UTC (permalink / raw)
To: lgirdwood, broonie
Cc: linux-doc, corbet, linux-kernel, Dr. David Alan Gilbert
From: "Dr. David Alan Gilbert" <linux@treblig.org>
devm_regulator_bulk_register_supply_alias() has been unused since 2014's
commit d137be00ee01 ("mfd: core: Don't use devres functions before device
is added")
Remove it, and the static helpers only it used.
Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
.../driver-api/driver-model/devres.rst | 1 -
drivers/regulator/devres.c | 74 -------------------
include/linux/regulator/consumer.h | 6 --
3 files changed, 81 deletions(-)
diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentation/driver-api/driver-model/devres.rst
index d75728eb05f8..9a0122fceabd 100644
--- a/Documentation/driver-api/driver-model/devres.rst
+++ b/Documentation/driver-api/driver-model/devres.rst
@@ -424,7 +424,6 @@ PWM
devm_fwnode_pwm_get()
REGULATOR
- devm_regulator_bulk_register_supply_alias()
devm_regulator_bulk_get()
devm_regulator_bulk_get_const()
devm_regulator_bulk_get_enable()
diff --git a/drivers/regulator/devres.c b/drivers/regulator/devres.c
index 2cf03042fddf..3fb01417fa5a 100644
--- a/drivers/regulator/devres.c
+++ b/drivers/regulator/devres.c
@@ -490,15 +490,6 @@ struct regulator_supply_alias_match {
const char *id;
};
-static int devm_regulator_match_supply_alias(struct device *dev, void *res,
- void *data)
-{
- struct regulator_supply_alias_match *match = res;
- struct regulator_supply_alias_match *target = data;
-
- return match->dev == target->dev && strcmp(match->id, target->id) == 0;
-}
-
static void devm_regulator_destroy_supply_alias(struct device *dev, void *res)
{
struct regulator_supply_alias_match *match = res;
@@ -547,71 +538,6 @@ int devm_regulator_register_supply_alias(struct device *dev, const char *id,
}
EXPORT_SYMBOL_GPL(devm_regulator_register_supply_alias);
-static void devm_regulator_unregister_supply_alias(struct device *dev,
- const char *id)
-{
- struct regulator_supply_alias_match match;
- int rc;
-
- match.dev = dev;
- match.id = id;
-
- rc = devres_release(dev, devm_regulator_destroy_supply_alias,
- devm_regulator_match_supply_alias, &match);
- if (rc != 0)
- WARN_ON(rc);
-}
-
-/**
- * devm_regulator_bulk_register_supply_alias - Managed register
- * multiple aliases
- *
- * @dev: device to supply
- * @id: list of supply names or regulator IDs
- * @alias_dev: device that should be used to lookup the supply
- * @alias_id: list of supply names or regulator IDs that should be used to
- * lookup the supply
- * @num_id: number of aliases to register
- *
- * @return 0 on success, a negative error number on failure.
- *
- * This helper function allows drivers to register several supply
- * aliases in one operation, the aliases will be automatically
- * unregisters when the source device is unbound. If any of the
- * aliases cannot be registered any aliases that were registered
- * will be removed before returning to the caller.
- */
-int devm_regulator_bulk_register_supply_alias(struct device *dev,
- const char *const *id,
- struct device *alias_dev,
- const char *const *alias_id,
- int num_id)
-{
- int i;
- int ret;
-
- for (i = 0; i < num_id; ++i) {
- ret = devm_regulator_register_supply_alias(dev, id[i],
- alias_dev,
- alias_id[i]);
- if (ret < 0)
- goto err;
- }
-
- return 0;
-
-err:
- dev_err(dev,
- "Failed to create supply alias %s,%s -> %s,%s\n",
- id[i], dev_name(dev), alias_id[i], dev_name(alias_dev));
-
- while (--i >= 0)
- devm_regulator_unregister_supply_alias(dev, id[i]);
-
- return ret;
-}
-EXPORT_SYMBOL_GPL(devm_regulator_bulk_register_supply_alias);
-
struct regulator_notifier_match {
struct regulator *regulator;
struct notifier_block *nb;
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 56fe2693d9b2..1e20c7330cd4 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -185,12 +185,6 @@ int devm_regulator_register_supply_alias(struct device *dev, const char *id,
struct device *alias_dev,
const char *alias_id);
-int devm_regulator_bulk_register_supply_alias(struct device *dev,
- const char *const *id,
- struct device *alias_dev,
- const char *const *alias_id,
- int num_id);
-
/* regulator output control and status */
int __must_check regulator_enable(struct regulator *regulator);
int regulator_disable(struct regulator *regulator);
--
2.49.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/5] regulator: core: Remove unused regulator_bulk_force_disable
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 ` linux
2025-04-26 17:51 ` [PATCH 3/5] regulator: core: Remove unused regulator_*drvdata functions linux
` (3 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: linux @ 2025-04-26 17:51 UTC (permalink / raw)
To: lgirdwood, broonie
Cc: linux-doc, corbet, linux-kernel, Dr. David Alan Gilbert
From: "Dr. David Alan Gilbert" <linux@treblig.org>
regulator_bulk_force_disable() was explicitly added in 2012 by
commit e1de2f423462 ("regulator: add regulator_bulk_force_disable
function")
but hasn't been used.
Remove it.
Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
drivers/regulator/core.c | 34 ------------------------------
include/linux/regulator/consumer.h | 8 -------
2 files changed, 42 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 90629a756693..32e3919e37d2 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -5196,40 +5196,6 @@ int regulator_bulk_disable(int num_consumers,
}
EXPORT_SYMBOL_GPL(regulator_bulk_disable);
-/**
- * regulator_bulk_force_disable - force disable multiple regulator consumers
- *
- * @num_consumers: Number of consumers
- * @consumers: Consumer data; clients are stored here.
- *
- * This convenience API allows consumers to forcibly disable multiple regulator
- * clients in a single API call.
- * NOTE: This should be used for situations when device damage will
- * likely occur if the regulators are not disabled (e.g. over temp).
- * Although regulator_force_disable function call for some consumers can
- * return error numbers, the function is called for all consumers.
- *
- * Return: 0 on success or a negative error number on failure.
- */
-int regulator_bulk_force_disable(int num_consumers,
- struct regulator_bulk_data *consumers)
-{
- int i;
- int ret = 0;
-
- for (i = 0; i < num_consumers; i++) {
- consumers[i].ret =
- regulator_force_disable(consumers[i].consumer);
-
- /* Store first error for reporting */
- if (consumers[i].ret && !ret)
- ret = consumers[i].ret;
- }
-
- return ret;
-}
-EXPORT_SYMBOL_GPL(regulator_bulk_force_disable);
-
/**
* regulator_bulk_free - free multiple regulator consumers
*
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 1e20c7330cd4..999eba865c20 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -209,8 +209,6 @@ int devm_regulator_bulk_get_enable(struct device *dev, int num_consumers,
const char * const *id);
int regulator_bulk_disable(int num_consumers,
struct regulator_bulk_data *consumers);
-int regulator_bulk_force_disable(int num_consumers,
- struct regulator_bulk_data *consumers);
void regulator_bulk_free(int num_consumers,
struct regulator_bulk_data *consumers);
@@ -470,12 +468,6 @@ static inline int regulator_bulk_disable(int num_consumers,
return 0;
}
-static inline int regulator_bulk_force_disable(int num_consumers,
- struct regulator_bulk_data *consumers)
-{
- return 0;
-}
-
static inline void regulator_bulk_free(int num_consumers,
struct regulator_bulk_data *consumers)
{
--
2.49.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/5] regulator: core: Remove unused regulator_*drvdata functions
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 ` linux
2025-04-26 17:51 ` [PATCH 4/5] regulator: core: Remove unused regulator_suspend_(disable|enable) linux
` (2 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: linux @ 2025-04-26 17:51 UTC (permalink / raw)
To: lgirdwood, broonie
Cc: linux-doc, corbet, linux-kernel, Dr. David Alan Gilbert
From: "Dr. David Alan Gilbert" <linux@treblig.org>
regulator_get_init_drvdata() was added in 2008 by the
commit a5766f11cfd3 ("regulator: core - Rework machine API to remove string
based functions.")
regulator_set_drvdata() was also added in 2008 by the
commit 414c70cb91c4 ("regulator: regulator framework core")
neither have been used since,
Remove them.
Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
drivers/regulator/core.c | 17 -----------------
include/linux/regulator/consumer.h | 6 ------
include/linux/regulator/driver.h | 1 -
3 files changed, 24 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 32e3919e37d2..60c72d77f77a 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -6096,17 +6096,6 @@ void *regulator_get_drvdata(struct regulator *regulator)
}
EXPORT_SYMBOL_GPL(regulator_get_drvdata);
-/**
- * regulator_set_drvdata - set regulator driver data
- * @regulator: regulator
- * @data: data
- */
-void regulator_set_drvdata(struct regulator *regulator, void *data)
-{
- regulator->rdev->reg_data = data;
-}
-EXPORT_SYMBOL_GPL(regulator_set_drvdata);
-
/**
* rdev_get_id - get regulator ID
* @rdev: regulator
@@ -6131,12 +6120,6 @@ struct regmap *rdev_get_regmap(struct regulator_dev *rdev)
}
EXPORT_SYMBOL_GPL(rdev_get_regmap);
-void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data)
-{
- return reg_init_data->driver_data;
-}
-EXPORT_SYMBOL_GPL(regulator_get_init_drvdata);
-
#ifdef CONFIG_DEBUG_FS
static int supply_map_show(struct seq_file *sf, void *data)
{
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 999eba865c20..0e9275079e17 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -267,7 +267,6 @@ int regulator_set_suspend_voltage(struct regulator *regulator, int min_uV,
/* driver data - core doesn't touch */
void *regulator_get_drvdata(struct regulator *regulator);
-void regulator_set_drvdata(struct regulator *regulator, void *data);
/* misc helpers */
@@ -633,11 +632,6 @@ static inline void *regulator_get_drvdata(struct regulator *regulator)
return NULL;
}
-static inline void regulator_set_drvdata(struct regulator *regulator,
- void *data)
-{
-}
-
static inline int regulator_count_voltages(struct regulator *regulator)
{
return 0;
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 4a216fdba354..e849bab379f2 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -765,7 +765,6 @@ int regulator_set_active_discharge_regmap(struct regulator_dev *rdev,
int regulator_set_current_limit_regmap(struct regulator_dev *rdev,
int min_uA, int max_uA);
int regulator_get_current_limit_regmap(struct regulator_dev *rdev);
-void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data);
int regulator_find_closest_bigger(unsigned int target, const unsigned int *table,
unsigned int num_sel, unsigned int *sel);
int regulator_set_ramp_delay_regmap(struct regulator_dev *rdev, int ramp_delay);
--
2.49.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/5] regulator: core: Remove unused regulator_suspend_(disable|enable)
2025-04-26 17:51 [PATCH 0/5] Regulator deadcode cleanups linux
` (2 preceding siblings ...)
2025-04-26 17:51 ` [PATCH 3/5] regulator: core: Remove unused regulator_*drvdata functions linux
@ 2025-04-26 17:51 ` linux
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
5 siblings, 0 replies; 10+ messages in thread
From: linux @ 2025-04-26 17:51 UTC (permalink / raw)
To: lgirdwood, broonie
Cc: linux-doc, corbet, linux-kernel, Dr. David Alan Gilbert
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 = ®ulator->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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 5/5] regulator: core: Remove unused regulator_set_suspend_voltage
2025-04-26 17:51 [PATCH 0/5] Regulator deadcode cleanups linux
` (3 preceding siblings ...)
2025-04-26 17:51 ` [PATCH 4/5] regulator: core: Remove unused regulator_suspend_(disable|enable) linux
@ 2025-04-26 17:51 ` linux
2025-04-27 14:34 ` [PATCH 0/5] Regulator deadcode cleanups Mark Brown
5 siblings, 0 replies; 10+ messages in thread
From: linux @ 2025-04-26 17:51 UTC (permalink / raw)
To: lgirdwood, broonie
Cc: linux-doc, corbet, linux-kernel, Dr. David Alan Gilbert
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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 0/5] Regulator deadcode cleanups
2025-04-26 17:51 [PATCH 0/5] Regulator deadcode cleanups linux
` (4 preceding siblings ...)
2025-04-26 17:51 ` [PATCH 5/5] regulator: core: Remove unused regulator_set_suspend_voltage linux
@ 2025-04-27 14:34 ` Mark Brown
2025-04-27 14:58 ` Dr. David Alan Gilbert
5 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2025-04-27 14:34 UTC (permalink / raw)
To: linux; +Cc: lgirdwood, linux-doc, corbet, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 368 bytes --]
On Sat, Apr 26, 2025 at 06:51:38PM +0100, linux@treblig.org wrote:
> This is a bunch of deadcode cleanups for functions
> that are unused (for quite some time).
> The first patch was originally sent in October last
> year but didn't get any traction; the rest are new.
Please do some analysis as to why the functions are there, don't just
blindly delete things.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/5] Regulator deadcode cleanups
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
0 siblings, 1 reply; 10+ messages in thread
From: Dr. David Alan Gilbert @ 2025-04-27 14:58 UTC (permalink / raw)
To: Mark Brown; +Cc: lgirdwood, linux-doc, corbet, linux-kernel
* Mark Brown (broonie@kernel.org) wrote:
> On Sat, Apr 26, 2025 at 06:51:38PM +0100, linux@treblig.org wrote:
>
> > This is a bunch of deadcode cleanups for functions
> > that are unused (for quite some time).
> > The first patch was originally sent in October last
> > year but didn't get any traction; the rest are new.
>
> Please do some analysis as to why the functions are there, don't just
> blindly delete things.
I'd appreciate some more idea of what you're after; each patch
shows where and when the function was added or last used. Some have
comments saying things like the devm_ version is being used (so it
seemed reasonable to me to delete the plain version if no one uses it).
For each one I've checked _when_ it was last used and not deleted
anything that's been used in the last few years; I've not deleted
anything which has been recently added or only recently unused.
That level seems to have been fine on the other ~300 clean up
patches other maintainers have taken; you seem to be after something
different - I'm fine to add that if you can just explain what
you want.
Just point me in the right direction and I can have more of a dig.
Dave
--
-----Open up your eyes, open up your mind, open up your code -------
/ Dr. David Alan Gilbert | Running GNU/Linux | Happy \
\ dave @ treblig.org | | In Hex /
\ _________________________|_____ http://www.treblig.org |_______/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/5] Regulator deadcode cleanups
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
0 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2025-04-30 23:18 UTC (permalink / raw)
To: Dr. David Alan Gilbert; +Cc: lgirdwood, linux-doc, corbet, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1137 bytes --]
On Sun, Apr 27, 2025 at 02:58:03PM +0000, Dr. David Alan Gilbert wrote:
> * Mark Brown (broonie@kernel.org) wrote:
> > Please do some analysis as to why the functions are there, don't just
> > blindly delete things.
> I'd appreciate some more idea of what you're after; each patch
> shows where and when the function was added or last used. Some have
Something that indicates that this is a patch written by a human rather
than some automated noise, that considers things like API usability and
coherence, or what people might do if the API is not available when they
need it, rather than just mechanically churning something out. None of
your commit logs consider what the code you're deleting does at all.
> comments saying things like the devm_ version is being used (so it
> seemed reasonable to me to delete the plain version if no one uses it).
Deleting the plain version of something where a devm version exists is
an obvious example of making the API less coherent and hard to use,
managed resources aren't universally appropriate and so you should
generally be able to do the same thing with manual resource management.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/5] Regulator deadcode cleanups
2025-04-30 23:18 ` Mark Brown
@ 2025-05-01 0:03 ` Dr. David Alan Gilbert
0 siblings, 0 replies; 10+ messages in thread
From: Dr. David Alan Gilbert @ 2025-05-01 0:03 UTC (permalink / raw)
To: Mark Brown; +Cc: lgirdwood, linux-doc, corbet, linux-kernel
* Mark Brown (broonie@kernel.org) wrote:
> On Sun, Apr 27, 2025 at 02:58:03PM +0000, Dr. David Alan Gilbert wrote:
> > * Mark Brown (broonie@kernel.org) wrote:
>
> > > Please do some analysis as to why the functions are there, don't just
> > > blindly delete things.
>
> > I'd appreciate some more idea of what you're after; each patch
> > shows where and when the function was added or last used. Some have
>
> Something that indicates that this is a patch written by a human rather
> than some automated noise, that considers things like API usability and
> coherence, or what people might do if the API is not available when they
> need it, rather than just mechanically churning something out. None of
> your commit logs consider what the code you're deleting does at all.
I do manually write each patch, but I don't have that global feel of the
API; but I do use my judgement to avoid some things:
* I tend not to remove one side of an obvious pair of functions
(e.g. a set/clear or an alloc/free)
* I avoid things that look like a function for every firmware interface
where the functions are almost documenting the interface.
* I only bother deleting one line functions if it's part of a set.
and some others. It's not automatic, but I don't claim to understand
the whole interface. I will try and follow a thread if I end up deleting
something which then makes it look like something else isn't needed.
I do have _some_ feel - so have spotted some bugs where a function
should have been called.
> > comments saying things like the devm_ version is being used (so it
> > seemed reasonable to me to delete the plain version if no one uses it).
>
> Deleting the plain version of something where a devm version exists is
> an obvious example of making the API less coherent and hard to use,
> managed resources aren't universally appropriate and so you should
> generally be able to do the same thing with manual resource management.
OK, that's something I hadn't expected - I'd thought if one style was
used for many years, that the other was redundant.
It can be quite tricky to see why functions have ended up not being
used for years (or decades), some is making a nice API, but sometimes
it's people blindly copying another API or who had a set of patches
which used the function but those patches got abandoned.
It also varies a lot between maintainer - some really prefer not
to have unused functions at all.
Dave
--
-----Open up your eyes, open up your mind, open up your code -------
/ Dr. David Alan Gilbert | Running GNU/Linux | Happy \
\ dave @ treblig.org | | In Hex /
\ _________________________|_____ http://www.treblig.org |_______/
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2025-05-01 0:03 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [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
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).