regmap: detach regmap from dev on regmap_exit
Subsystems (3)
PATCH v3 1/1 regmap: detach regmap from dev on regmap_exit
At the end of __regmap_init(), if dev is not NULL, regmap_attach_dev() is called, which adds a devres reference to the regmap, to be able to retrieve a dev's regmap by name using dev_get_regmap().
When calling regmap_exit, the opposite does not happen, and the reference is kept until the dev is detached.
Add a regmap_detach_dev() function, export it and call it in regmap_exit(), to make sure that the devres reference is not kept.
---
V2:
* switch to static function
V3:
* move inter-version changelog after ---
drivers/base/regmap/regmap.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/base/regmap/regmap.c +12 -0
@@ -598,6 +598,17 @@ int regmap_attach_dev(struct device *dev, struct regmap *map, }EXPORT_SYMBOL_GPL (regmap_attach_dev); +static int dev_get_regmap_match (struct device *dev,void *res,void *data); + +static int regmap_detach_dev (struct device *dev,struct regmap *map) +{ +if (!dev) +return 0 ; + +return devres_release (dev, dev_get_regmap_release, + dev_get_regmap_match, (void *)map->name); +} +static enum regmap_endian regmap_get_reg_endian (const struct regmap_bus *bus,const struct regmap_config *config) {
@@ -1445,6 +1456,7 @@ void regmap_exit(struct regmap *map) {struct regmap_async *async; +regmap_detach_dev (map->dev, map);regcache_exit (map);regmap_debugfs_exit (map);
Signature · 1 line
2.47.0
kernel test robot
build botFYI: kernel test robot notices the stable kernel rule is not satisfied.
Hi,
Thanks for your patch.
FYI: kernel test robot notices the stable kernel rule is not satisfied.
The check is based on https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html#option-1
Rule: add the tag "Cc: [email protected]" in the sign-off area to have the patch automatically included in the stable tree.
Subject: [PATCH v3] regmap: detach regmap from dev on regmap_exit
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Mark Brown
maintainerQuoted 8 lines · Cosmin Tanislav
At the end of
__regmap_init(), if dev is not NULL,regmap_attach_dev()is called, which adds a devres reference to the regmap, to be able to retrieve a dev's regmap by name usingdev_get_regmap().When calling
regmap_exit, the opposite does not happen, and the reference is kept until the dev is detached.[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next
Thanks!
[1/1] regmap: detach regmap from dev on regmap_exit
commit: 3061e170381af96d1e66799d34264e6414d428a7
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