linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Madalin Bucur <madalin.bucur@nxp.com>
To: davem@davemloft.net, netdev@vger.kernel.org
Cc: roy.pledge@nxp.com, laurentiu.tudor@nxp.com,
	linux-kernel@vger.kernel.org,
	Madalin Bucur <madalin.bucur@nxp.com>
Subject: [PATCH 11/20] dpaa_eth: simplify variables used in dpaa_cleanup_tx_fd()
Date: Tue,  8 Oct 2019 15:10:32 +0300	[thread overview]
Message-ID: <1570536641-25104-12-git-send-email-madalin.bucur@nxp.com> (raw)
In-Reply-To: <1570536641-25104-1-git-send-email-madalin.bucur@nxp.com>

Avoid casts and repeated conversions.

Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 14ebdb10fcd4..d4601e31261e 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -1585,13 +1585,13 @@ static struct sk_buff *dpaa_cleanup_tx_fd(const struct dpaa_priv *priv,
 	struct device *dev = priv->net_dev->dev.parent;
 	struct skb_shared_hwtstamps shhwtstamps;
 	dma_addr_t addr = qm_fd_addr(fd);
+	void *vaddr = phys_to_virt(addr);
 	const struct qm_sg_entry *sgt;
-	struct sk_buff **skbh, *skb;
+	struct sk_buff *skb;
 	int nr_frags, i;
 	u64 ns;
 
-	skbh = (struct sk_buff **)phys_to_virt(addr);
-	skb = *skbh;
+	skb = *(struct sk_buff **)vaddr;
 
 	if (unlikely(qm_fd_get_format(fd) == qm_fd_sg)) {
 		nr_frags = skb_shinfo(skb)->nr_frags;
@@ -1602,7 +1602,7 @@ static struct sk_buff *dpaa_cleanup_tx_fd(const struct dpaa_priv *priv,
 		/* The sgt buffer has been allocated with netdev_alloc_frag(),
 		 * it's from lowmem.
 		 */
-		sgt = phys_to_virt(addr + qm_fd_get_offset(fd));
+		sgt = vaddr + qm_fd_get_offset(fd);
 
 		/* sgt[0] is from lowmem, was dma_map_single()-ed */
 		dma_unmap_single(priv->tx_dma_dev, qm_sg_addr(&sgt[0]),
@@ -1617,7 +1617,7 @@ static struct sk_buff *dpaa_cleanup_tx_fd(const struct dpaa_priv *priv,
 		}
 	} else {
 		dma_unmap_single(priv->tx_dma_dev, addr,
-				 skb_tail_pointer(skb) - (u8 *)skbh, dma_dir);
+				 skb_tail_pointer(skb) - (u8 *)vaddr, dma_dir);
 	}
 
 	/* DMA unmapping is required before accessing the HW provided info */
@@ -1625,7 +1625,7 @@ static struct sk_buff *dpaa_cleanup_tx_fd(const struct dpaa_priv *priv,
 	    skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) {
 		memset(&shhwtstamps, 0, sizeof(shhwtstamps));
 
-		if (!fman_port_get_tstamp(priv->mac_dev->port[TX], (void *)skbh,
+		if (!fman_port_get_tstamp(priv->mac_dev->port[TX], vaddr,
 					  &ns)) {
 			shhwtstamps.hwtstamp = ns_to_ktime(ns);
 			skb_tstamp_tx(skb, &shhwtstamps);
@@ -1636,7 +1636,7 @@ static struct sk_buff *dpaa_cleanup_tx_fd(const struct dpaa_priv *priv,
 
 	if (qm_fd_get_format(fd) == qm_fd_sg)
 		/* Free the page frag that we allocated on Tx */
-		skb_free_frag(phys_to_virt(addr));
+		skb_free_frag(vaddr);
 
 	return skb;
 }
-- 
2.1.0


  parent reply	other threads:[~2019-10-08 12:11 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-08 12:10 [PATCH 00/20] DPAA fixes Madalin Bucur
2019-10-08 12:10 ` [PATCH 01/20] fsl/fman: don't touch liodn base regs reserved on non-PAMU SoCs Madalin Bucur
2019-10-08 12:10 ` [PATCH 02/20] dpaa_eth: defer probing after qbman Madalin Bucur
2019-10-08 12:10 ` [PATCH 03/20] dpaa_eth: remove redundant code Madalin Bucur
2019-10-08 12:10 ` [PATCH 04/20] fsl/fman: add API to get the device behind a fman port Madalin Bucur
2019-10-08 12:10 ` [PATCH 05/20] dpaa_eth: change DMA device Madalin Bucur
2019-10-08 12:10 ` [PATCH 06/20] fsl/fman: remove unused struct member Madalin Bucur
2019-10-08 12:10 ` [PATCH 07/20] dpaa_eth: use only one buffer pool per interface Madalin Bucur
2019-10-08 12:10 ` [PATCH 08/20] dpaa_eth: use page backed rx buffers Madalin Bucur
2019-10-08 12:10 ` [PATCH 09/20] dpaa_eth: perform DMA unmapping before read Madalin Bucur
2019-10-08 12:10 ` [PATCH 10/20] dpaa_eth: avoid timestamp read on error paths Madalin Bucur
2019-10-08 12:10 ` Madalin Bucur [this message]
2019-10-08 12:10 ` [PATCH 12/20] dpaa_eth: use fd information in dpaa_cleanup_tx_fd() Madalin Bucur
2019-10-08 12:10 ` [PATCH 13/20] dpaa_eth: use a page to store the SGT Madalin Bucur
2019-10-08 12:10 ` [PATCH 14/20] soc: fsl: qbman: allow registering a device link for the portal user Madalin Bucur
2019-10-08 12:10 ` [PATCH 15/20] dpaa_eth: register a device link for the qman portal used Madalin Bucur
2019-10-08 12:10 ` [PATCH 16/20] dpaa_eth: add dropped frames to percpu ethtool stats Madalin Bucur
2019-10-08 12:10 ` [PATCH 17/20] dpaa_eth: remove netdev_err() for user errors Madalin Bucur
2019-10-08 12:10 ` [PATCH 18/20] dpaa_eth: extend delays in ndo_stop Madalin Bucur
2019-10-08 12:10 ` [PATCH 19/20] dpaa_eth: add dpaa_dma_to_virt() Madalin Bucur
2019-10-09  7:39   ` Christoph Hellwig
2019-10-09 10:06     ` Laurentiu Tudor
2019-10-09 10:56     ` Madalin-cristian Bucur
2019-10-08 12:10 ` [PATCH 20/20] dpaa_eth: cleanup skb_to_contig_fd() Madalin Bucur
2019-10-09  4:01 ` [PATCH 00/20] DPAA fixes Jakub Kicinski
2019-10-09  5:53   ` Madalin-cristian Bucur

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=1570536641-25104-12-git-send-email-madalin.bucur@nxp.com \
    --to=madalin.bucur@nxp.com \
    --cc=davem@davemloft.net \
    --cc=laurentiu.tudor@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=roy.pledge@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).