mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] regmap: make range check functions static
@ 2022-03-28 22:56 Rasmus Villemoes
  2022-03-30 12:38 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Rasmus Villemoes @ 2022-03-28 22:56 UTC (permalink / raw)
  To: Mark Brown, Greg Kroah-Hartman, Rafael J. Wysocki
  Cc: Rasmus Villemoes, linux-kernel

regmap_reg_in_ranges() and regmap_check_range_table() have no callers
outside regmap.c, so they have no reason to be exported nor have
external linkage.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 drivers/base/regmap/regmap.c | 12 +++++-------
 include/linux/regmap.h       |  7 -------
 2 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 5e12f7cb5147..8b3fdc966ed6 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -57,9 +57,9 @@ static int _regmap_bus_reg_write(void *context, unsigned int reg,
 static int _regmap_bus_raw_write(void *context, unsigned int reg,
 				 unsigned int val);
 
-bool regmap_reg_in_ranges(unsigned int reg,
-			  const struct regmap_range *ranges,
-			  unsigned int nranges)
+static bool regmap_reg_in_ranges(unsigned int reg,
+				 const struct regmap_range *ranges,
+				 unsigned int nranges)
 {
 	const struct regmap_range *r;
 	int i;
@@ -69,10 +69,9 @@ bool regmap_reg_in_ranges(unsigned int reg,
 			return true;
 	return false;
 }
-EXPORT_SYMBOL_GPL(regmap_reg_in_ranges);
 
-bool regmap_check_range_table(struct regmap *map, unsigned int reg,
-			      const struct regmap_access_table *table)
+static bool regmap_check_range_table(struct regmap *map, unsigned int reg,
+				     const struct regmap_access_table *table)
 {
 	/* Check "no ranges" first */
 	if (regmap_reg_in_ranges(reg, table->no_ranges, table->n_no_ranges))
@@ -85,7 +84,6 @@ bool regmap_check_range_table(struct regmap *map, unsigned int reg,
 	return regmap_reg_in_ranges(reg, table->yes_ranges,
 				    table->n_yes_ranges);
 }
-EXPORT_SYMBOL_GPL(regmap_check_range_table);
 
 bool regmap_writeable(struct regmap *map, unsigned int reg)
 {
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index de81a94d7b30..5008db9bf69a 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -1210,9 +1210,6 @@ void regcache_cache_only(struct regmap *map, bool enable);
 void regcache_cache_bypass(struct regmap *map, bool enable);
 void regcache_mark_dirty(struct regmap *map);
 
-bool regmap_check_range_table(struct regmap *map, unsigned int reg,
-			      const struct regmap_access_table *table);
-
 int regmap_register_patch(struct regmap *map, const struct reg_sequence *regs,
 			  int num_regs);
 int regmap_parse_val(struct regmap *map, const void *buf,
@@ -1224,10 +1221,6 @@ static inline bool regmap_reg_in_range(unsigned int reg,
 	return reg >= range->range_min && reg <= range->range_max;
 }
 
-bool regmap_reg_in_ranges(unsigned int reg,
-			  const struct regmap_range *ranges,
-			  unsigned int nranges);
-
 static inline int regmap_set_bits(struct regmap *map,
 				  unsigned int reg, unsigned int bits)
 {
-- 
2.31.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] regmap: make range check functions static
  2022-03-28 22:56 [PATCH] regmap: make range check functions static Rasmus Villemoes
@ 2022-03-30 12:38 ` Mark Brown
  2022-04-11 14:59   ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2022-03-30 12:38 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: Greg Kroah-Hartman, Rafael J. Wysocki, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 314 bytes --]

On Tue, Mar 29, 2022 at 12:56:28AM +0200, Rasmus Villemoes wrote:
> regmap_reg_in_ranges() and regmap_check_range_table() have no callers
> outside regmap.c, so they have no reason to be exported nor have
> external linkage.

These are intentional API in case someone needs them, no need to
encourage open coding.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] regmap: make range check functions static
  2022-03-30 12:38 ` Mark Brown
@ 2022-04-11 14:59   ` Andy Shevchenko
  2022-04-12 12:30     ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2022-04-11 14:59 UTC (permalink / raw)
  To: Mark Brown
  Cc: Rasmus Villemoes, Greg Kroah-Hartman, Rafael J. Wysocki,
	Linux Kernel Mailing List

On Wed, Mar 30, 2022 at 11:17 PM Mark Brown <broonie@kernel.org> wrote:
>
> On Tue, Mar 29, 2022 at 12:56:28AM +0200, Rasmus Villemoes wrote:
> > regmap_reg_in_ranges() and regmap_check_range_table() have no callers
> > outside regmap.c, so they have no reason to be exported nor have
> > external linkage.
>
> These are intentional API in case someone needs them, no need to
> encourage open coding.

But currently it's not used and simply consumes namespace resources.
Isn't it our practice not to add dead code / etc?

In practice I assume that one will grep before implementing, or at
least at review stage it may be pointed out for a helper, that might
be exported when needed, no?

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] regmap: make range check functions static
  2022-04-11 14:59   ` Andy Shevchenko
@ 2022-04-12 12:30     ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2022-04-12 12:30 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Rasmus Villemoes, Greg Kroah-Hartman, Rafael J. Wysocki,
	Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 1025 bytes --]

On Mon, Apr 11, 2022 at 05:59:33PM +0300, Andy Shevchenko wrote:
> On Wed, Mar 30, 2022 at 11:17 PM Mark Brown <broonie@kernel.org> wrote:
> > On Tue, Mar 29, 2022 at 12:56:28AM +0200, Rasmus Villemoes wrote:

> > > regmap_reg_in_ranges() and regmap_check_range_table() have no callers
> > > outside regmap.c, so they have no reason to be exported nor have
> > > external linkage.

> > These are intentional API in case someone needs them, no need to
> > encourage open coding.

> But currently it's not used and simply consumes namespace resources.
> Isn't it our practice not to add dead code / etc?

> In practice I assume that one will grep before implementing, or at
> least at review stage it may be pointed out for a helper, that might
> be exported when needed, no?

Or they'll just look at it and think there must be some good reason
they're missing, or that having to deal with cross tree issues is too
much pain and just open code stuff.  It's not insurmountable but there
is a clarity and usability benefit here.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-04-12 12:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-28 22:56 [PATCH] regmap: make range check functions static Rasmus Villemoes
2022-03-30 12:38 ` Mark Brown
2022-04-11 14:59   ` Andy Shevchenko
2022-04-12 12:30     ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®