* [PATCH v2 1/1] regmap: Drop unused devm_regmap_*_free() APIs
@ 2025-01-16 12:43 Andy Shevchenko
2025-01-16 16:15 ` Mark Brown
0 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2025-01-16 12:43 UTC (permalink / raw)
To: Mark Brown, linux-kernel
Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
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,
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: rebased on the top of latest vanilla
drivers/base/regmap/regmap.c | 36 ------------------------------------
include/linux/regmap.h | 3 ---
2 files changed, 39 deletions(-)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 197c79b66828..2314744201b4 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -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.
*
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 3a96d068915f..c7f51f0b13af 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -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,
--
2.43.0.rc1.1336.g36b5255a03ac
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/1] regmap: Drop unused devm_regmap_*_free() APIs
2025-01-16 12:43 [PATCH v2 1/1] regmap: Drop unused devm_regmap_*_free() APIs Andy Shevchenko
@ 2025-01-16 16:15 ` Mark Brown
2025-01-16 16:24 ` Andy Shevchenko
0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2025-01-16 16:15 UTC (permalink / raw)
To: Andy Shevchenko
Cc: linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki,
Danilo Krummrich
[-- Attachment #1: Type: text/plain, Size: 463 bytes --]
On Thu, Jan 16, 2025 at 02:43:30PM +0200, Andy Shevchenko wrote:
> 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.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/1] regmap: Drop unused devm_regmap_*_free() APIs
2025-01-16 16:15 ` Mark Brown
@ 2025-01-16 16:24 ` Andy Shevchenko
2025-01-16 16:41 ` Mark Brown
0 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2025-01-16 16:24 UTC (permalink / raw)
To: Mark Brown
Cc: linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki,
Danilo Krummrich
On Thu, Jan 16, 2025 at 04:15:05PM +0000, Mark Brown wrote:
> On Thu, Jan 16, 2025 at 02:43:30PM +0200, Andy Shevchenko wrote:
> > 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?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/1] regmap: Drop unused devm_regmap_*_free() APIs
2025-01-16 16:24 ` Andy Shevchenko
@ 2025-01-16 16:41 ` Mark Brown
2025-01-16 17:51 ` Andy Shevchenko
0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2025-01-16 16:41 UTC (permalink / raw)
To: Andy Shevchenko
Cc: linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki,
Danilo Krummrich
[-- Attachment #1: Type: text/plain, Size: 877 bytes --]
On Thu, Jan 16, 2025 at 06:24:50PM +0200, Andy Shevchenko wrote:
> On Thu, Jan 16, 2025 at 04:15:05PM +0000, Mark Brown wrote:
> > 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.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/1] regmap: Drop unused devm_regmap_*_free() APIs
2025-01-16 16:41 ` Mark Brown
@ 2025-01-16 17:51 ` Andy Shevchenko
0 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2025-01-16 17:51 UTC (permalink / raw)
To: Mark Brown
Cc: linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki,
Danilo Krummrich
On Thu, Jan 16, 2025 at 04:41:36PM +0000, Mark Brown wrote:
> On Thu, Jan 16, 2025 at 06:24:50PM +0200, Andy Shevchenko wrote:
> > On Thu, Jan 16, 2025 at 04:15:05PM +0000, Mark Brown wrote:
>
> > > 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.
Yeah no users — no misuse :-)
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-01-16 17:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-16 12:43 [PATCH v2 1/1] regmap: Drop unused devm_regmap_*_free() APIs Andy Shevchenko
2025-01-16 16:15 ` Mark Brown
2025-01-16 16:24 ` Andy Shevchenko
2025-01-16 16:41 ` Mark Brown
2025-01-16 17:51 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox