[PATCH] regcache: Use sort()'s default swap() implementation

Thorsten Blum posted 1 patch 9 months, 2 weeks ago
drivers/base/regmap/regcache.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
[PATCH] regcache: Use sort()'s default swap() implementation
Posted by Thorsten Blum 9 months, 2 weeks ago
Use sort()'s default swap() implementation and remove the custom
regcache_defaults_swap() function.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 drivers/base/regmap/regcache.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index f7fcf2de1301..c7650fa434ad 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -34,21 +34,10 @@ static int regcache_defaults_cmp(const void *a, const void *b)
 		return 0;
 }
 
-static void regcache_defaults_swap(void *a, void *b, int size)
-{
-	struct reg_default *x = a;
-	struct reg_default *y = b;
-	struct reg_default tmp;
-
-	tmp = *x;
-	*x = *y;
-	*y = tmp;
-}
-
 void regcache_sort_defaults(struct reg_default *defaults, unsigned int ndefaults)
 {
 	sort(defaults, ndefaults, sizeof(*defaults),
-	     regcache_defaults_cmp, regcache_defaults_swap);
+	     regcache_defaults_cmp, NULL);
 }
 EXPORT_SYMBOL_GPL(regcache_sort_defaults);
 
-- 
2.49.0
Re: [PATCH] regcache: Use sort()'s default swap() implementation
Posted by Mark Brown 9 months, 1 week ago
On Mon, 28 Apr 2025 08:13:18 +0200, Thorsten Blum wrote:
> Use sort()'s default swap() implementation and remove the custom
> regcache_defaults_swap() function.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next

Thanks!

[1/1] regcache: Use sort()'s default swap() implementation
      commit: d30e845b0ae63400738709ca624a4a7bb69c4ba2

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
Re: [PATCH] regcache: Use sort()'s default swap() implementation
Posted by Markus Elfring 9 months, 2 weeks ago
…
> +++ b/drivers/base/regmap/regcache.c
…
>  void regcache_sort_defaults(struct reg_default *defaults, unsigned int ndefaults)
>  {
>  	sort(defaults, ndefaults, sizeof(*defaults),
> -	     regcache_defaults_cmp, regcache_defaults_swap);
> +	     regcache_defaults_cmp, NULL);
>  }
…

Would the following source code formatting become applicable?

+	sort(defaults, ndefaults, sizeof(*defaults), regcache_defaults_cmp, NULL);


Regards,
Markus
Re: [PATCH] regcache: Use sort()'s default swap() implementation
Posted by Mark Brown 9 months, 1 week ago
On Mon, Apr 28, 2025 at 11:00:46AM +0200, Markus Elfring wrote:

> Would the following source code formatting become applicable?
> 
> +	sort(defaults, ndefaults, sizeof(*defaults), regcache_defaults_cmp, NULL);

Feel free to ignore Markus, he has a long history of sending
unhelpful review comments and continues to ignore repeated requests
to stop.