Re: [PATCH v2] regmap: Add debugfs file for forcing field writes

From: Mark Brown
Date: Tue Jun 13 2023 - 11:40:46 EST


On Tue, Jun 13, 2023 at 05:02:27PM +0200, Greg Kroah-Hartman wrote:
> On Tue, Jun 13, 2023 at 01:42:27PM +0200, Waqar Hameed wrote:

> > +#undef REGMAP_ALLOW_FORCE_WRITE_FIELD_DEBUGFS
> > +#ifdef REGMAP_ALLOW_FORCE_WRITE_FIELD_DEBUGFS
> > + debugfs_create_bool("force_write_field", 0600, map->debugfs,
> > + &map->force_write_field);
> > +#endif

> Please no, that means this will never ever ever get used, and if it
> happens to break the build or runtime, no one will ever notice it.

> If you need this for your device/tree/distro, great, just keep it as an
> out-of-tree patch with the huge header "NEVER ENABLE THIS IN A REAL
> SYSTEM" or something like that.

We have an existing setting that parallels this which enables writes via
debugfs - there *is* demand for this sort of thing in development where
this is a viable configuration mechanism, having something in tree in a
way that requires an out of tree patch like you're suggesting to enable
it documents why the feature isn't something you can enable without code
changes whereas just not having anything means people send patches
adding the feature.

This one is very much safer than the general write thing, we probably
*could* have a Kconfig option but changing the guarantees underneath
drivers feels like it's going to explode if we just let it happen.

Attachment: signature.asc
Description: PGP signature