Skip to contentSkip to conversation

regmap: Clarify _regmap_update_bits() 'async' kernel-doc

PATCH Superseded Bjorn Helgaas 2 participants 4 messages Jul 17 – Jul 19

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 regmap: Clarify _regmap_update_bits() 'async' kernel-doc

The kernel-doc for the 'async' parameter didn't actually say what it does.

Reword it to clarify the read-modify-write mechanics: when 'async' is true, the write is queued asynchronously, but the read will still be synchronous unless the device uses a register cache.

Assisted-by Gemini:3.1 Pro
---
 drivers/base/regmap/regmap.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/base/regmap/regmap.c +5 -5
index e6e022b02637..430dc8233c40 100644
@@ -3296,11 +3296,11 @@ static int _regmap_update_bits(struct regmap *map, unsigned int reg,
  * Perform a read/modify/write cycle on a register map with change, async, force
  * options.
  *
- * If async is true:
- *
- * With most buses the read must be done synchronously so this is most useful
- * for devices with a cache which do not need to interact with the hardware to
- * determine the current register value.
+ * If async is true, queue an asynchronous write. However, most buses
+ * require synchronous reads, so the read-modify-write cycle will still
+ * block on the read unless the device uses a register cache.  Therefore,
+ * this flag is most useful for cached devices, where the current value can
+ * be read from memory without hardware I/O.
  *
  * Returns zero for success, a negative number on error.
  */
Signature · 1 line
2.53.0
maintainer
#1 lore raw
Quoted 4 lines · Bjorn Helgaas

Reword it to clarify the read-modify-write mechanics: when 'async' is true, the write is queued asynchronously, but the read will still be synchronous unless the device uses a register cache.

Quoted 10 lines

- * If async is true:
- *
- * With most buses the read must be done synchronously so this is most useful
- * for devices with a cache which do not need to interact with the hardware to
- * determine the current register value.
+ * If async is true, queue an asynchronous write. However, most buses
+ * require synchronous reads, so the read-modify-write cycle will still
+ * block on the read unless the device uses a register cache. Therefore,
+ * this flag is most useful for cached devices, where the current value can
+ * be read from memory without hardware I/O.

That's... verbose. If you want to add a statement that async mode will be using async I/O then possibly I guess but there's a whole bunch more there.

#2 lore raw
Quoted 17 lines · Mark Brown
Quoted 4 lines · Bjorn Helgaas

Reword it to clarify the read-modify-write mechanics: when 'async' is true, the write is queued asynchronously, but the read will still be synchronous unless the device uses a register cache.

Quoted 10 lines

- * If async is true:
- *
- * With most buses the read must be done synchronously so this is most useful
- * for devices with a cache which do not need to interact with the hardware to
- * determine the current register value.
+ * If async is true, queue an asynchronous write. However, most buses
+ * require synchronous reads, so the read-modify-write cycle will still
+ * block on the read unless the device uses a register cache. Therefore,
+ * this flag is most useful for cached devices, where the current value can
+ * be read from memory without hardware I/O.

Quoted 3 lines

That's... verbose. If you want to add a statement that async mode will be using async I/O then possibly I guess but there's a whole bunch more there.

The main problem is that the current text doesn't read well because "if async is true" isn't connected to the rest.

There are three functions that take an "async" parameter, but two just pass it on to regmap_update_bits_base(), so that seems like a reasonable single place to say something about it.

Maybe something like this would be enough?

If async is true, queue an asynchronous write. However, reads are synchronous on most buses, so they will still block unless the device uses a register cache.

maintainer
#3 lore raw
Quoted 11 lines · Bjorn Helgaas
Quoted 3 lines · Mark Brown

That's... verbose. If you want to add a statement that async mode will be using async I/O then possibly I guess but there's a whole bunch more there.

Maybe something like this would be enough?

If async is true, queue an asynchronous write. However, reads are synchronous on most buses, so they will still block unless the device uses a register cache.

Looks OK.