summaryrefslogtreecommitdiff
path: root/include/linux/iosys-map.h
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2022-08-08 14:53:53 +0200
committerThomas Zimmermann <tzimmermann@suse.de>2022-08-10 09:15:16 +0200
commit116d902fa9ff1f559b66bafad0f0cad90df95d21 (patch)
tree6de05772f4cbc2d05390d63bf0fa0ec7bd955092 /include/linux/iosys-map.h
parent730c2bf4ad395acf0aa0820535fdb8ea6abe5df1 (diff)
iosys-map: Add IOSYS_MAP_INIT_VADDR_IOMEM()
Add IOSYS_MAP_INIT_VADDR_IOMEM() for static init of variables of type struct iosys_map. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20220808125406.20752-2-tzimmermann@suse.de
Diffstat (limited to 'include/linux/iosys-map.h')
-rw-r--r--include/linux/iosys-map.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/include/linux/iosys-map.h b/include/linux/iosys-map.h
index a533cae189d7..cb71aa616bd3 100644
--- a/include/linux/iosys-map.h
+++ b/include/linux/iosys-map.h
@@ -46,10 +46,13 @@
*
* iosys_map_set_vaddr(&map, 0xdeadbeaf);
*
- * To set an address in I/O memory, use iosys_map_set_vaddr_iomem().
+ * To set an address in I/O memory, use IOSYS_MAP_INIT_VADDR_IOMEM() or
+ * iosys_map_set_vaddr_iomem().
*
* .. code-block:: c
*
+ * struct iosys_map map = IOSYS_MAP_INIT_VADDR_IOMEM(0xdeadbeaf);
+ *
* iosys_map_set_vaddr_iomem(&map, 0xdeadbeaf);
*
* Instances of struct iosys_map do not have to be cleaned up, but
@@ -122,6 +125,16 @@ struct iosys_map {
}
/**
+ * IOSYS_MAP_INIT_VADDR_IOMEM - Initializes struct iosys_map to an address in I/O memory
+ * @vaddr_iomem_: An I/O-memory address
+ */
+#define IOSYS_MAP_INIT_VADDR_IOMEM(vaddr_iomem_) \
+ { \
+ .vaddr_iomem = (vaddr_iomem_), \
+ .is_iomem = true, \
+ }
+
+/**
* IOSYS_MAP_INIT_OFFSET - Initializes struct iosys_map from another iosys_map
* @map_: The dma-buf mapping structure to copy from
* @offset_: Offset to add to the other mapping