Skip to contentSkip to conversation

iosys_map: Make dst a const in iosys_map_memcpy_to()

PATCH In review Lyude Paul 2 participants 2 messages Oct 16, 2025 – Oct 17, 2025

Subsystems (2)
lore
Share & tools
lore

Lyude Paul

author
#0 lore raw

PATCH 1/1 iosys_map: Make dst a const in iosys_map_memcpy_to()

A drive-by fix I discovered when writing up bindings for iosys_mem for
rust: while iosys_map_memcpy_to() does modify the memory pointed to by the iosys_map, it doesn't modify the actual iosys_map struct at all.

As such, let's add a const qualifier to this function.

---
 include/linux/iosys-map.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/iosys-map.h +1 -1
index 3e85afe794c0a..0ececbba04b3a 100644
@@ -278,7 +278,7 @@ static inline void iosys_map_clear(struct iosys_map *map)
  * system memory. Depending on the buffer's location, the helper picks the
  * correct method of accessing the memory.
  */
-static inline void iosys_map_memcpy_to(struct iosys_map *dst, size_t dst_offset,
+static inline void iosys_map_memcpy_to(const struct iosys_map *dst, size_t dst_offset,
 				       const void *src, size_t len)
 {
 	if (dst->is_iomem)

base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787

Signature · 1 line
2.51.0
#1 lore raw

Hi

Am 16.10.25 um 22:24 schrieb Lyude Paul:

Quoted 5 lines

A drive-by fix I discovered when writing up bindings for iosys_mem for
rust: while iosys_map_memcpy_to() does modify the memory pointed to by the iosys_map, it doesn't modify the actual iosys_map struct at all.

As such, let's add a const qualifier to this function.

As far as I'm concerned, the non-const is intentional. Because it's the destination, so expect it to be written. Thus passing arguments that are already const is most likely an error. And because I'd like to keep the option of doing something more complicated within iosys_map (e.g., some temp memory for handling I/O) and const might get in the way.

Best regads
Thomas

Quoted 21 lines
---
  include/linux/iosys-map.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/iosys-map.h +1 -1
index 3e85afe794c0a..0ececbba04b3a 100644
@@ -278,7 +278,7 @@ static inline void iosys_map_clear(struct iosys_map *map)
   * system memory. Depending on the buffer's location, the helper picks the
   * correct method of accessing the memory.
   */
-static inline void iosys_map_memcpy_to(struct iosys_map *dst, size_t dst_offset,
+static inline void iosys_map_memcpy_to(const struct iosys_map *dst, size_t dst_offset,
  				       const void *src, size_t len)
  {
  	if (dst->is_iomem)

base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787

Signature · 7 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)