regmap: Drop unused devm_regmap_*_free() APIs
Subsystems (2)
PATCH v2 1/1 regmap: Drop unused devm_regmap_*_free() APIs
Besides the fact that currently defined devm_*_free() APIs are being unused, it's usually a sign of bad design to call such explicitly. Drop them and make people pay more attention on the misuse of devm_regmap_*() APIs,
---
v2: rebased on the top of latest vanilla
drivers/base/regmap/regmap.c | 36 ------------------------------------ include/linux/regmap.h | 3 --- 2 files changed, 39 deletions(-)
drivers/base/regmap/regmap.c +0 -36
@@ -1330,42 +1330,6 @@ void regmap_field_bulk_free(struct regmap_field *field) }EXPORT_SYMBOL_GPL (regmap_field_bulk_free); -/** -* devm_regmap_field_bulk_free() - Free a bulk register field allocated using -* devm_regmap_field_bulk_alloc. -* -* @dev: Device that will be interacted with -* @field: regmap field which should be freed. -* -* Free register field allocated using devm_regmap_field_bulk_alloc(). Usually -* drivers need not call this function, as the memory allocated via devm -* will be freed as per device-driver life-cycle. -*/ -void devm_regmap_field_bulk_free (struct device *dev, -struct regmap_field *field) -{ -devm_kfree (dev, field); -} -EXPORT_SYMBOL_GPL (devm_regmap_field_bulk_free); - -/** -* devm_regmap_field_free() - Free a register field allocated using -* devm_regmap_field_alloc. -* -* @dev: Device that will be interacted with -* @field: regmap field which should be freed. -* -* Free register field allocated using devm_regmap_field_alloc(). Usually -* drivers need not call this function, as the memory allocated via devm -* will be freed as per device-driver life-cyle. -*/ -void devm_regmap_field_free (struct device *dev, -struct regmap_field *field) -{ -devm_kfree (dev, field); -} -EXPORT_SYMBOL_GPL (devm_regmap_field_free); -/** * regmap_field_alloc() - Allocate and initialise a register field. *
include/linux/regmap.h +0 -3
@@ -1441,7 +1441,6 @@ void regmap_field_free(struct regmap_field *field);struct regmap_field *devm_regmap_field_alloc (struct device *dev,struct regmap *regmap,struct reg_field reg_field); -void devm_regmap_field_free (struct device *dev,struct regmap_field *field); int regmap_field_bulk_alloc(struct regmap *regmap, struct regmap_field **rm_field,
@@ -1452,8 +1451,6 @@ int devm_regmap_field_bulk_alloc(struct device *dev, struct regmap *regmap,struct regmap_field **field, const struct reg_field *reg_field, int num_fields); -void devm_regmap_field_bulk_free (struct device *dev, -struct regmap_field *field);int regmap_field_read (struct regmap_field *field,unsigned int *val); int regmap_field_update_bits_base(struct regmap_field *field,
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Mark Brown
maintainerQuoted 4 lines · Andy Shevchenko
Besides the fact that currently defined devm_*_free() APIs are being unused, it's usually a sign of bad design to call such explicitly. Drop them and make people pay more attention on the misuse of devm_regmap_*() APIs,
This just seems unhelpful, there's fairly obvious uses for something like this where we decide we can't actually use some things based on what we discover during probe.
Quoted 9 lines · Mark Brown
Quoted 4 lines · Andy Shevchenko
Besides the fact that currently defined devm_*_free() APIs are being unused, it's usually a sign of bad design to call such explicitly. Drop them and make people pay more attention on the misuse of devm_regmap_*() APIs,
This just seems unhelpful, there's fairly obvious uses for something like this where we decide we can't actually use some things based on what we discover during probe.
It's an effectively dead code. I rarely see people are using devm_*_free(), and when it's so, it is most likely by misunderstanding of the concept. For what you described I don't remember any _practical_ use case. Theoretically any dead code is useful, but it's not the point, right?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Mark Brown
maintainerQuoted 10 lines · Andy Shevchenko
Quoted 3 lines · Mark Brown
This just seems unhelpful, there's fairly obvious uses for something like this where we decide we can't actually use some things based on what we discover during probe.
It's an effectively dead code. I rarely see people are using devm_*_free(), and when it's so, it is most likely by misunderstanding of the concept. For what you described I don't remember any _practical_ use case. Theoretically any dead code is useful, but it's not the point, right?
The use case would be to read some ID registers in a subfeature then decide that it's not supported for some reason so we'll just ignore it at runtime. Given that you're also complaining about there being no current users there doesn't seem to be much problem with misuse.
Quoted 12 lines · Mark Brown
Quoted 10 lines · Andy Shevchenko
Quoted 3 lines · Mark Brown
This just seems unhelpful, there's fairly obvious uses for something like this where we decide we can't actually use some things based on what we discover during probe.
It's an effectively dead code. I rarely see people are using devm_*_free(), and when it's so, it is most likely by misunderstanding of the concept. For what you described I don't remember any _practical_ use case. Theoretically any dead code is useful, but it's not the point, right?
Quoted 4 lines
The use case would be to read some ID registers in a subfeature then decide that it's not supported for some reason so we'll just ignore it at runtime. Given that you're also complaining about there being no current users there doesn't seem to be much problem with misuse.
Yeah no users — no misuse :-)
Signature · 2 lines
With Best Regards, Andy Shevchenko