All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
To: netdev@vger.kernel.org
Cc: Li Yang <leoyang.li@nxp.com>,
	"David S . Miller" <davem@davemloft.net>,
	Zhao Qiang <qiang.zhao@nxp.com>, Andrew Lunn <andrew@lunn.ch>,
	Christophe Leroy <christophe.leroy@csgroup.eu>,
	Jakub Kicinski <kuba@kernel.org>,
	Joakim Tjernlund <Joakim.Tjernlund@infinera.com>,
	Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Subject: [PATCH net-next v2 04/17] soc: fsl: qe: add cpm_muram_free_addr() helper
Date: Tue, 19 Jan 2021 16:07:49 +0100	[thread overview]
Message-ID: <20210119150802.19997-5-rasmus.villemoes@prevas.dk> (raw)
In-Reply-To: <20210119150802.19997-1-rasmus.villemoes@prevas.dk>

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 <rasmus.villemoes@prevas.dk>
---
 drivers/soc/fsl/qe/qe_common.c | 12 ++++++++++++
 include/soc/fsl/qe/qe.h        |  5 +++++
 2 files changed, 17 insertions(+)

diff --git a/drivers/soc/fsl/qe/qe_common.c b/drivers/soc/fsl/qe/qe_common.c
index 303cc2f5eb4a..448ef7f5321a 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);
diff --git a/include/soc/fsl/qe/qe.h b/include/soc/fsl/qe/qe.h
index 8ee3747433c0..66f1afc393d1 100644
--- a/include/soc/fsl/qe/qe.h
+++ b/include/soc/fsl/qe/qe.h
@@ -104,6 +104,7 @@ s32 cpm_muram_alloc_fixed(unsigned long offset, unsigned long size);
 void __iomem *cpm_muram_addr(unsigned long offset);
 unsigned long cpm_muram_offset(const void __iomem *addr);
 dma_addr_t cpm_muram_dma(void __iomem *addr);
+void cpm_muram_free_addr(const void __iomem *addr);
 #else
 static inline s32 cpm_muram_alloc(unsigned long size,
 				  unsigned long align)
@@ -135,6 +136,9 @@ static inline dma_addr_t cpm_muram_dma(void __iomem *addr)
 {
 	return 0;
 }
+static inline void cpm_muram_free_addr(const void __iomem *addr)
+{
+}
 #endif /* defined(CONFIG_CPM) || defined(CONFIG_QUICC_ENGINE) */
 
 /* QE PIO */
@@ -239,6 +243,7 @@ static inline int qe_alive_during_sleep(void)
 #define qe_muram_addr cpm_muram_addr
 #define qe_muram_offset cpm_muram_offset
 #define qe_muram_dma cpm_muram_dma
+#define qe_muram_free_addr cpm_muram_free_addr
 
 #ifdef CONFIG_PPC32
 #define qe_iowrite8(val, addr)     out_8(addr, val)
-- 
2.23.0


  parent reply	other threads:[~2021-01-19 15:19 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-19 15:07 [PATCH net-next v2 00/17] ucc_geth improvements Rasmus Villemoes
2021-01-19 15:07 ` [PATCH net-next v2 01/17] ethernet: ucc_geth: remove unused read of temoder field Rasmus Villemoes
2021-01-19 15:07 ` [PATCH net-next v2 02/17] soc: fsl: qe: make cpm_muram_offset take a const void* argument Rasmus Villemoes
2021-01-19 18:42   ` Leo Li
2021-01-19 15:07 ` [PATCH net-next v2 03/17] soc: fsl: qe: store muram_vbase as a void pointer instead of u8 Rasmus Villemoes
2021-01-19 18:45   ` Li Yang
2021-01-19 15:07 ` Rasmus Villemoes [this message]
2021-01-19 18:46   ` [PATCH net-next v2 04/17] soc: fsl: qe: add cpm_muram_free_addr() helper Li Yang
2021-01-19 15:07 ` [PATCH net-next v2 05/17] ethernet: ucc_geth: use qe_muram_free_addr() Rasmus Villemoes
2021-01-19 15:07 ` [PATCH net-next v2 06/17] ethernet: ucc_geth: remove unnecessary memset_io() calls Rasmus Villemoes
2021-01-19 15:07 ` [PATCH net-next v2 07/17] ethernet: ucc_geth: replace kmalloc+memset by kzalloc Rasmus Villemoes
2021-01-19 15:07 ` [PATCH net-next v2 08/17] ethernet: ucc_geth: remove {rx,tx}_glbl_pram_offset from struct ucc_geth_private Rasmus Villemoes
2021-01-20  6:57   ` Christophe Leroy
2021-01-20 11:26     ` Rasmus Villemoes
2021-01-19 15:07 ` [PATCH net-next v2 09/17] ethernet: ucc_geth: factor out parsing of {rx,tx}-clock{,-name} properties Rasmus Villemoes
2021-01-19 15:07 ` [PATCH net-next v2 10/17] ethernet: ucc_geth: constify ugeth_primary_info Rasmus Villemoes
2021-01-19 15:07 ` [PATCH net-next v2 11/17] ethernet: ucc_geth: don't statically allocate eight ucc_geth_info Rasmus Villemoes
2021-01-20  7:02   ` Christophe Leroy
2021-01-20 11:25     ` Rasmus Villemoes
2021-01-20 11:30       ` Christophe Leroy
2021-01-19 15:07 ` [PATCH net-next v2 12/17] ethernet: ucc_geth: use UCC_GETH_{RX,TX}_BD_RING_ALIGNMENT macros directly Rasmus Villemoes
2021-01-19 15:07 ` [PATCH net-next v2 13/17] ethernet: ucc_geth: remove bd_mem_part and all associated code Rasmus Villemoes
2021-01-20  7:17   ` Christophe Leroy
2021-01-20 11:33     ` Rasmus Villemoes
2021-01-19 15:07 ` [PATCH net-next v2 14/17] ethernet: ucc_geth: replace kmalloc_array()+for loop by kcalloc() Rasmus Villemoes
2021-01-20  7:19   ` Christophe Leroy
2021-01-19 15:08 ` [PATCH net-next v2 15/17] ethernet: ucc_geth: add helper to replace repeated switch statements Rasmus Villemoes
2021-01-19 15:08 ` [PATCH net-next v2 16/17] ethernet: ucc_geth: inform the compiler that numQueues is always 1 Rasmus Villemoes
2021-01-19 15:08 ` [PATCH net-next v2 17/17] ethernet: ucc_geth: simplify rx/tx allocations Rasmus Villemoes
2021-01-19 17:52 ` [PATCH net-next v2 00/17] ucc_geth improvements Leo Li
2021-01-21 20:30 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210119150802.19997-5-rasmus.villemoes@prevas.dk \
    --to=rasmus.villemoes@prevas.dk \
    --cc=Joakim.Tjernlund@infinera.com \
    --cc=andrew@lunn.ch \
    --cc=christophe.leroy@csgroup.eu \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=leoyang.li@nxp.com \
    --cc=netdev@vger.kernel.org \
    --cc=qiang.zhao@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.