[PATCH v3 3/8] lib: Support ARCH_HAS_CPU_CACHE_INVALIDATE_MEMREGION
Randy Dunlap
rdunlap at infradead.org
Wed Aug 20 10:44:18 PDT 2025
On 8/20/25 3:29 AM, Jonathan Cameron wrote:
> +struct cache_coherency_device *
> +_cache_coherency_device_alloc(const struct coherency_ops *ops, size_t size);
> +/**
> + * cache_coherency_device_alloc - Allocate a cache coherency device
> + * @ops: Cache maintenance operations
> + * @drv_struct: structure that contains the struct cache_coherency_device
> + * @member: Name of the struct cache_coherency_device member in @drv_struct.
> + *
> + * This allocates and initializes the cache_coherency_device embedded in the
> + * drv_struct. Upon success the pointer must be freed via
> + * cache_coherency_device_free().
> + *
> + * Returns a 'drv_struct \*' on success, NULL on error.
Preferably:
* Returns: a &drv_struct * on success, %NULL on error.
> + */
> +#define cache_coherency_device_alloc(ops, drv_struct, member) \
> + ({ \
> + static_assert(__same_type(struct cache_coherency_device, \
> + ((drv_struct *)NULL)->member)); \
> + static_assert(offsetof(drv_struct, member) == 0); \
> + (drv_struct *)_cache_coherency_device_alloc(ops, \
> + sizeof(drv_struct)); \
> + })
> +void cache_coherency_device_free(struct cache_coherency_device *ccd);
> +
> +#endif
--
~Randy
More information about the linux-arm-kernel
mailing list