regmap: Remove dynamic allocation warnings for rbtree and maple

Message ID 20230721-regmap-enable-kmalloc-v1-1-f78287e794d3@kernel.org
State New
Headers
Series regmap: Remove dynamic allocation warnings for rbtree and maple |

Commit Message

Mark Brown July 21, 2023, 4:31 p.m. UTC
  Thanks to Dan and Guenter's very prompt updates of the rbtree and maple
caches to support GPF_ATOMIC allocations and since the update shook out
a bunch of users at least some of whom have been suitably careful about
ensuring that the cache is prepoulated so there are no dynamic
allocations after init let's revert the warnings.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/base/regmap/regmap.c | 9 ---------
 1 file changed, 9 deletions(-)


---
base-commit: b0393e1fe40e962574613a5cdc4a470d6c1de023
change-id: 20230721-regmap-enable-kmalloc-2e2d0d018cef

Best regards,
  

Comments

Guenter Roeck July 21, 2023, 4:39 p.m. UTC | #1
On 7/21/23 09:31, Mark Brown wrote:
> Thanks to Dan and Guenter's very prompt updates of the rbtree and maple
> caches to support GPF_ATOMIC allocations and since the update shook out
> a bunch of users at least some of whom have been suitably careful about
> ensuring that the cache is prepoulated so there are no dynamic
> allocations after init let's revert the warnings.
> 
> Signed-off-by: Mark Brown <broonie@kernel.org>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>   drivers/base/regmap/regmap.c | 9 ---------
>   1 file changed, 9 deletions(-)
> 
> diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
> index 6c637b18d6b0..8b37451fa931 100644
> --- a/drivers/base/regmap/regmap.c
> +++ b/drivers/base/regmap/regmap.c
> @@ -723,15 +723,6 @@ struct regmap *__regmap_init(struct device *dev,
>   	} else {
>   		if ((bus && bus->fast_io) ||
>   		    config->fast_io) {
> -			/*
> -			 * fast_io is incompatible with REGCACHE_RBTREE and REGCACHE_MAPLE
> -			 * since both need to dynamically allocate memory.
> -			 */
> -			if (config->cache_type == REGCACHE_RBTREE ||
> -			    config->cache_type == REGCACHE_MAPLE) {
> -				ret = -EINVAL;
> -				goto err_name;
> -			}
>   			if (config->use_raw_spinlock) {
>   				raw_spin_lock_init(&map->raw_spinlock);
>   				map->lock = regmap_lock_raw_spinlock;
> 
> ---
> base-commit: b0393e1fe40e962574613a5cdc4a470d6c1de023
> change-id: 20230721-regmap-enable-kmalloc-2e2d0d018cef
> 
> Best regards,
  
Mark Brown July 21, 2023, 5:41 p.m. UTC | #2
On Fri, 21 Jul 2023 17:31:36 +0100, Mark Brown wrote:
> Thanks to Dan and Guenter's very prompt updates of the rbtree and maple
> caches to support GPF_ATOMIC allocations and since the update shook out
> a bunch of users at least some of whom have been suitably careful about
> ensuring that the cache is prepoulated so there are no dynamic
> allocations after init let's revert the warnings.
> 
> 
> [...]

Applied to

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

Thanks!

[1/1] regmap: Remove dynamic allocation warnings for rbtree and maple
      commit: e02a4ccbeced64aa10f4e99683c721ec43e993c1

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
  

Patch

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 6c637b18d6b0..8b37451fa931 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -723,15 +723,6 @@  struct regmap *__regmap_init(struct device *dev,
 	} else {
 		if ((bus && bus->fast_io) ||
 		    config->fast_io) {
-			/*
-			 * fast_io is incompatible with REGCACHE_RBTREE and REGCACHE_MAPLE
-			 * since both need to dynamically allocate memory.
-			 */
-			if (config->cache_type == REGCACHE_RBTREE ||
-			    config->cache_type == REGCACHE_MAPLE) {
-				ret = -EINVAL;
-				goto err_name;
-			}
 			if (config->use_raw_spinlock) {
 				raw_spin_lock_init(&map->raw_spinlock);
 				map->lock = regmap_lock_raw_spinlock;