From: Mike Snitzer <snitzer@xxxxxxxxxx> Only caller can easily open-code call to uds_allocate_memory_nowait(). Reviewed-by: Susan LeGendre-McGhee <slegendr@xxxxxxxxxx> Signed-off-by: Mike Snitzer <snitzer@xxxxxxxxxx> Signed-off-by: Matthew Sakai <msakai@xxxxxxxxxx> --- drivers/md/dm-vdo/flush.c | 2 +- drivers/md/dm-vdo/memory-alloc.h | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/md/dm-vdo/flush.c b/drivers/md/dm-vdo/flush.c index 8c77337e5262..f5b96f9f76ab 100644 --- a/drivers/md/dm-vdo/flush.c +++ b/drivers/md/dm-vdo/flush.c @@ -104,7 +104,7 @@ static void *allocate_flush(gfp_t gfp_mask, void *pool_data) struct vdo_flush *flush; if ((gfp_mask & GFP_NOWAIT) == GFP_NOWAIT) { - flush = UDS_ALLOCATE_NOWAIT(struct vdo_flush, __func__); + flush = uds_allocate_memory_nowait(sizeof(struct vdo_flush), __func__); } else { int result = UDS_ALLOCATE(1, struct vdo_flush, __func__, &flush); diff --git a/drivers/md/dm-vdo/memory-alloc.h b/drivers/md/dm-vdo/memory-alloc.h index 1f0ac0500334..d6bf5e3dae2a 100644 --- a/drivers/md/dm-vdo/memory-alloc.h +++ b/drivers/md/dm-vdo/memory-alloc.h @@ -141,18 +141,16 @@ static inline int __must_check uds_allocate_cache_aligned(size_t size, const cha return uds_allocate_memory(size, L1_CACHE_BYTES, what, ptr); } -void *__must_check uds_allocate_memory_nowait(size_t size, const char *what); - /* * Allocate one element of the indicated type immediately, failing if the required memory is not * immediately available. * - * @TYPE: The type of objects to allocate - * @WHAT: What is being allocated (for error logging) + * @size: The number of bytes to allocate + * @what: What is being allocated (for error logging) * * Return: pointer to the memory, or NULL if the memory is not available. */ -#define UDS_ALLOCATE_NOWAIT(TYPE, WHAT) uds_allocate_memory_nowait(sizeof(TYPE), WHAT) +void *__must_check uds_allocate_memory_nowait(size_t size, const char *what); int __must_check uds_duplicate_string(const char *string, const char *what, char **new_string); -- 2.40.0