Re: [PATCH RFC 1/2] regmap: add option to disable debugfs
From: Dong Aisheng
Date: Wed Jun 22 2022 - 12:43:09 EST
On Thu, Jun 23, 2022 at 12:27 AM Mark Brown <broonie@xxxxxxxxxx> wrote:
> > > > - WARN_ON(map->cache_bypass && enable);
> > > > +// WARN_ON(map->cache_bypass && enable);
>
> > > What is the purpose of this change? Why would the combination of cache
> > > only and bypass modes work be a good idea, and how should things behave
> > > in that case?
>
> > Because without this change, there will be a kernel dump caused by
> > WARN_ON when drivers call regcache_cache_only(map, true) after power
> > is off. There's no cache used in the imx blkctl driver. So map->cache_bypass
> > is default to true.
>
> cache_bypass is only going to be true if something enabled bypass, why
> would a device that doesn't use a cache enable bypass? It does get
> turned on transiently by things like patching but those only make sense
> if the device can be accessed so caceh_only shouldn't be on then.
It was enabled by default according to the code:
__regmap_init -> regcache_init
int regcache_init(struct regmap *map, const struct regmap_config *config)
{
int ret;
int i;
void *tmp_buf;
if (map->cache_type == REGCACHE_NONE) {
if (config->reg_defaults || config->num_reg_defaults_raw)
dev_warn(map->dev,
"No cache used with register defaults set!\n");
map->cache_bypass = true;
return 0;
}
}
Regards
Aisheng