From 186b8daffb4ec2dabb8a3d93b329b16152a5a100 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Tue, 19 Jan 2021 16:07:49 +0100 Subject: soc: fsl: qe: add cpm_muram_free_addr() helper Add a helper that takes a virtual address rather than the muram offset. This will be used in a couple of places to avoid having to store both the offset and the virtual address, as well as removing NULL checks from the callers. Signed-off-by: Rasmus Villemoes Acked-by: Li Yang Signed-off-by: Jakub Kicinski --- drivers/soc/fsl/qe/qe_common.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'drivers/soc') diff --git a/drivers/soc/fsl/qe/qe_common.c b/drivers/soc/fsl/qe/qe_common.c index 236d962d45f1..654e9246ce6b 100644 --- a/drivers/soc/fsl/qe/qe_common.c +++ b/drivers/soc/fsl/qe/qe_common.c @@ -238,3 +238,15 @@ dma_addr_t cpm_muram_dma(void __iomem *addr) return muram_pbase + (addr - muram_vbase); } EXPORT_SYMBOL(cpm_muram_dma); + +/* + * As cpm_muram_free, but takes the virtual address rather than the + * muram offset. + */ +void cpm_muram_free_addr(const void __iomem *addr) +{ + if (!addr) + return; + cpm_muram_free(cpm_muram_offset(addr)); +} +EXPORT_SYMBOL(cpm_muram_free_addr); -- cgit v1.2.3