Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 84b3da14 authored by Lee Jones's avatar Lee Jones Committed by Linus Walleij
Browse files

dmaengine: ste_dma40: Remove home-brew MAX() macro



The current implementation of the DMA40's local MAX() macro evaluates
its arguments more times than is necessary and it not type checked.
This patch strips replaces it with a new, more efficient constant.

Cc: Dan Williams <djbw@fb.com>
Cc: Per Forlin <per.forlin@stericsson.com>
Cc: Rabin Vincent <rabin@rab.in>
Acked-by: default avatarVinod Koul <vinod.koul@intel.com>
Reported-by: default avatarHarvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent df7c9bbc
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -53,8 +53,6 @@
#define D40_ALLOC_PHY		(1 << 30)
#define D40_ALLOC_PHY		(1 << 30)
#define D40_ALLOC_LOG_FREE	0
#define D40_ALLOC_LOG_FREE	0


#define MAX(a, b) (((a) < (b)) ? (b) : (a))

/* Reserved event lines for memcpy only. */
/* Reserved event lines for memcpy only. */
#define DB8500_DMA_MEMCPY_EV_0	51
#define DB8500_DMA_MEMCPY_EV_0	51
#define DB8500_DMA_MEMCPY_EV_1	56
#define DB8500_DMA_MEMCPY_EV_1	56
@@ -216,6 +214,9 @@ static u32 d40_backup_regs_chan[] = {
	D40_CHAN_REG_SDLNK,
	D40_CHAN_REG_SDLNK,
};
};


#define BACKUP_REGS_SZ_MAX ((BACKUP_REGS_SZ_V4A > BACKUP_REGS_SZ_V4B) ? \
			     BACKUP_REGS_SZ_V4A : BACKUP_REGS_SZ_V4B)

/**
/**
 * struct d40_interrupt_lookup - lookup table for interrupt handler
 * struct d40_interrupt_lookup - lookup table for interrupt handler
 *
 *
@@ -579,7 +580,7 @@ struct d40_base {
	resource_size_t			  lcpa_size;
	resource_size_t			  lcpa_size;
	struct kmem_cache		 *desc_slab;
	struct kmem_cache		 *desc_slab;
	u32				  reg_val_backup[BACKUP_REGS_SZ];
	u32				  reg_val_backup[BACKUP_REGS_SZ];
	u32				  reg_val_backup_v4[MAX(BACKUP_REGS_SZ_V4A, BACKUP_REGS_SZ_V4B)];
	u32				  reg_val_backup_v4[BACKUP_REGS_SZ_MAX];
	u32				 *reg_val_backup_chan;
	u32				 *reg_val_backup_chan;
	u16				  gcc_pwr_off_mask;
	u16				  gcc_pwr_off_mask;
	bool				  initialized;
	bool				  initialized;